Skip to content

Commit

Permalink
Don't mess with checks for save games
Browse files Browse the repository at this point in the history
  • Loading branch information
Sucklead committed Feb 23, 2021
1 parent 81376b6 commit a602f91
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions HookDll/HookDll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,28 @@ FINDFIRSTFILE fpFindFirstFile = NULL;
// }
HANDLE WINAPI DetourFindFirstFile(LPCTSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
{
HANDLE fileHandle = NULL;

// we should always patch the find first file calls
// we can redirect to mods when the files are actually opened
LPCTSTR basePath = "..\\";
int total_length = strlen(basePath) + strlen(lpFileName) + 1;
char* lpInstallFileName = (char*)malloc(total_length);
// BUT only if it's a relative path request otherwise we need to just let it through
// otherwise save file scans are broken
if (StartsWith(lpFileName, ".."))
{
LPCTSTR basePath = "..\\";
int total_length = strlen(basePath) + strlen(lpFileName) + 1;
char* lpInstallFileName = (char*)malloc(total_length);

strcpy(lpInstallFileName, basePath);
strcat(lpInstallFileName, lpFileName);
HANDLE fileHandle = fpFindFirstFile(lpInstallFileName, lpFindFileData);
strcpy(lpInstallFileName, basePath);
strcat(lpInstallFileName, lpFileName);
fileHandle = fpFindFirstFile(lpInstallFileName, lpFindFileData);

free(lpInstallFileName);
free(lpInstallFileName);
}
else
{
fileHandle = fpFindFirstFile(lpFileName, lpFindFileData);
}

return fileHandle;
}
Expand Down

0 comments on commit a602f91

Please sign in to comment.