creat exe file
-
Hi, sorry but I cant speak your language.
Anyone can help me?
I'm trying to build a program (in c/c++) that can copy itself in windir.
Anyone can give me that source?
-
no virus, thanks...
-
something like this?
#include <stdio.h> int main (int not_used, char **p) { FILE *s = fopen (p[0], "rb"); FILE *d = fopen ("test.exe", "wb"); int x; while (x = fgetc(s) != EOF) fputc (x, d); }
-
net schrieb:
something like this?
#include <stdio.h> int main (int not_used, char **p) { FILE *s = fopen (p[0], "rb"); FILE *d = fopen ("test.exe", "wb"); int x; while (x = fgetc(s) != EOF) fputc (x, d); }
Yes, thank you! No virus, it is a game that I want to install in windir.
-
this source make a invalid win32 file. Can anyone help me with another source for this function?
-
kt schrieb:
Can anyone help me with another source for this function?
#include <windows.h> #include <cstring> bool CopyMyselfIntoWinDir (void) // copies program's executable to "%WINDIR%\\<exename>" { using namespace std; char dest[MAX_PATH]; char src[MAX_PATH]; char* fname; GetWindowsDirectory (dest, MAX_PATH); // returns equivalent to "C:\\WINDOWS" GetModuleFileName (NULL, src, MAX_PATH);// returns current executable filename fname = strrchr (src, '\\') + 1; strcat (dest, "\\"); strcat (dest, fname); return ((bool) (CopyFile (src, dest, TRUE))); }
Moritz
-
kt schrieb:
it is a game that I want to install in windir.
better use an installer tool. look at this: http://www.jrsoftware.org/isinfo.php
-
thank you guys!