VPatch--Patch Directly
I found VPatch can only path the source file to a new file.
I want to patch the source file directly and create a backup of it.
Here is the my code of vpatchdll.c:
static char source[1024];
static char dest[1024];
static char exename[1024];
HANDLE hPatch, hSource, hDest;
int result;
//added by Shao Hao - update source file directly and create a backup to dst file.
popstring(exename);
if (!lstrcmpi(exename, "/replace")) { // replace mode
popstring(exename);
popstring(dest);
popstring(source);
if (!MoveFile(dest, source))
return;
}
else { // normal patching
popstring(source);
popstring(dest);
}
hPatch = CreateFile(exename, GENERIC_READ, FILE_SHARE_READ, NULL,
...
use the new vpatch like this:
vpatch::vpatchfile /REPLACE "$PLUGINSDIR\patch.pat" "$INSTDIR\oldfile.txt" "$INSTDIR\backup.txt"
Have a Fun:)