-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(rage-device/five): Error out on cloud files #1234
Conversation
The issue: The application seems to get stuck in a loop when cloud files are accessed, this is caused by users installing their GTA on the cloud, causing the game to neither load, nor 'gracefully' exit. The solution: To correct this, we simply get the file attributes and check if the following flag is set: `FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS`. If it's set, we return an invalid handle, so it's passed down the stack. Once this errors, `FatalError` under `OpenArchiveWrap` will be triggered. I have modified the message so any affected clients are notified in the event this occurs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a small suggestion + a question about skipping hook usage, looking good otherwise 👍
@@ -40,6 +40,14 @@ static decltype(&CreateFileW) createFileW; | |||
|
|||
static HANDLE WINAPI CreateFileWDummy(_In_ LPCWSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _In_ DWORD dwCreationDisposition, _In_ DWORD dwFlagsAndAttributes, _In_opt_ HANDLE hTemplateFile) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think CreateFileWDummy
could use a rename to something that reflects its new purpose (e.g. CreateFileWNoRecallFlag
) now that it's no longer just a simple/dummy forwarder of the call
@@ -48,8 +56,6 @@ static void ResetPackfile(const char* archive) | |||
// if this is update.rpf, maybe we should do something about that? | |||
if (strcmp(archive, "update/update.rpf") == 0) | |||
{ | |||
createFileW = hook::iat("kernel32.dll", CreateFileWDummy, "CreateFileW"); | |||
|
|||
HANDLE hFile = createFileW(L"update/update.rpf", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double check, is calling the original CreateFileW intended here or should that also be piped through the hook?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me, PR description matches the changes perfectly.
The issue:
The application seems to get stuck in a loop when cloud files are
accessed, this is caused by users installing their GTA on the cloud,
causing the game to neither load, nor 'gracefully' exit.
The solution:
To correct this, we simply get the file attributes and check if
the following flag is set:
FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS
. Ifit's set, we return an invalid handle, so it's passed down the stack.
Once this errors,
FatalError
underOpenArchiveWrap
will betriggered. I have modified the message so any affected clients are
notified in the event this occurs.