MCPcopy Create free account
hub / github.com/Schnocker/NoEye / ZwWriteFile_Hook

Method ZwWriteFile_Hook

NoEye/ServiceConnection.cpp:114–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112 }
113
114 NTSTATUS NTAPI XDriver::ZwWriteFile_Hook(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
115 {
116
117 typedef struct BATTLEYE_DATA
118 {
119 BYTE ID;
120 BYTE Data[256];
121 }BATTLEYE_DATA, *PBATTLEYE_DATA;
122 PBATTLEYE_DATA Packet = reinterpret_cast<PBATTLEYE_DATA>(Buffer);
123 for (auto Handle : fIOs)
124 {
125 if (Handle == FileHandle &&
126 Length == 4)
127 {
128 *reinterpret_cast<DWORD*>(Buffer) = GetCurrentProcessId();
129 }
130 }
131 if (Length && Buffer && Packet->ID == 2)
132 {
133 if (*reinterpret_cast<DWORD*>(reinterpret_cast<DWORD_PTR>(Buffer) + 1) == 0)
134 {
135 *reinterpret_cast<DWORD*>(reinterpret_cast<DWORD_PTR>(Buffer) + 1) = dwProcessId;
136 }
137 }
138
139 return o_ZwWriteFile(FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, Buffer, Length, ByteOffset, Key);
140 }
141 }
142}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected