/* Native port of GVVPatch.cs (Jon Lech Johansen ) by Paul Tenny */ #include #include #include int main (int argc, char *argv[]) { FILE *dll; unsigned char target[] = {0xBF,0x40,0x65,0x00,0x10,0xE9,0x36,0xFC,0xFF,0xFF}, *file_contents, the90[] = {0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90}; const unsigned char file_location[512]; HKEY Key; LONG l = 512, file_size = 0; RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\GoogleVideoViewer\\VLC", 0, KEY_QUERY_VALUE, &Key); RegQueryValueEx(Key, "InstallDir", NULL, NULL, (LPBYTE) file_location, &l); RegCloseKey(Key); snprintf(&file_location[l - 1], 512 - l, "\\plugins\\libaccess_http_plugin.dll"); dll = fopen(file_location, "r+"); fseek(dll, 0, SEEK_END); file_size = ftell(dll) + 1; file_contents = (char *) malloc (file_size); fseek(dll, 0, SEEK_SET); fread(file_contents, 1, file_size - 1, dll); unsigned int pos = 0; for(pos = 0; pos < file_size; pos++) { if (file_contents[pos] == target[0]) { int found = 0; for (found = 0; found <= 9, (file_contents[pos + found] == target[found]); found++) {} if (found == 10) break; } } printf("%s: 0x%04x (%d)\n", file_location, pos, pos); fseek(dll, pos + 1, SEEK_SET); fwrite(&the90, 1, sizeof(the90), dll); fflush(dll); fclose(dll); }