mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 847468 - Poison NtWriteFileGather. r=BenWa.
--HG-- extra : rebase_source : 23ad1eec802f547504e08aa5dc8e7d90b2bf0708
This commit is contained in:
parent
ca0a572643
commit
c8d22986fb
@ -117,6 +117,8 @@ int main()
|
||||
#endif
|
||||
TestHook("user32.dll", "TrackPopupMenu") &&
|
||||
TestHook("ntdll.dll", "NtFlushBuffersFile") &&
|
||||
TestHook("ntdll.dll", "NtWriteFile") &&
|
||||
TestHook("ntdll.dll", "NtWriteFileGather") &&
|
||||
TestHook("ntdll.dll", "LdrLoadDll")) {
|
||||
printf("TEST-PASS | WindowsDllInterceptor | all checks passed\n");
|
||||
return 0;
|
||||
|
@ -51,6 +51,24 @@ patched_WriteFile(HANDLE aFile, HANDLE aEvent, PIO_APC_ROUTINE aApc,
|
||||
aBuffer, aLength, aOffset, aKey);
|
||||
}
|
||||
|
||||
|
||||
typedef NTSTATUS (WINAPI* WriteFileGather_fn)(HANDLE, HANDLE, PIO_APC_ROUTINE,
|
||||
void*, PIO_STATUS_BLOCK,
|
||||
FILE_SEGMENT_ELEMENT*,
|
||||
ULONG, PLARGE_INTEGER, PULONG);
|
||||
WriteFileGather_fn gOriginalWriteFileGather;
|
||||
|
||||
static NTSTATUS WINAPI
|
||||
patched_WriteFileGather(HANDLE aFile, HANDLE aEvent, PIO_APC_ROUTINE aApc,
|
||||
void* aApcUser, PIO_STATUS_BLOCK aIoStatus,
|
||||
FILE_SEGMENT_ELEMENT* aSegments, ULONG aLength,
|
||||
PLARGE_INTEGER aOffset, PULONG aKey)
|
||||
{
|
||||
AbortOnBadWrite(aFile);
|
||||
return gOriginalWriteFileGather(aFile, aEvent, aApc, aApcUser, aIoStatus,
|
||||
aSegments, aLength, aOffset, aKey);
|
||||
}
|
||||
|
||||
void AbortOnBadWrite(HANDLE aFile)
|
||||
{
|
||||
if (!PoisonWriteEnabled())
|
||||
@ -77,6 +95,7 @@ void PoisonWrite() {
|
||||
sNtDllInterceptor.Init("ntdll.dll");
|
||||
sNtDllInterceptor.AddHook("NtFlushBuffersFile", reinterpret_cast<intptr_t>(patched_FlushBuffersFile), reinterpret_cast<void**>(&gOriginalFlushBuffersFile));
|
||||
sNtDllInterceptor.AddHook("NtWriteFile", reinterpret_cast<intptr_t>(patched_WriteFile), reinterpret_cast<void**>(&gOriginalWriteFile));
|
||||
sNtDllInterceptor.AddHook("NtWriteFileGather", reinterpret_cast<intptr_t>(patched_WriteFileGather), reinterpret_cast<void**>(&gOriginalWriteFileGather));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user