@@ -23,6 +23,8 @@ struct PakHeader
2323};
2424#pragma pack()
2525
26+ static const DWORD PakMagic = 0x5a6f12e1 ;
27+
2628// track encrypted index locations that we've found
2729struct PakIndex
2830{
@@ -77,7 +79,7 @@ static void CheckPakHeader(HANDLE hFile, const PakHeaderOld *header, const GUID
7779 WCHAR path[MAX_PATH ];
7880 GetFinalPathNameByHandleW (hFile, path, MAX_PATH , 0 );
7981
80- if (header->bEncrypted )
82+ if (header != NULL && header ->bEncrypted )
8183 {
8284 SendStringMessage (L" Reading pak info for %ws (encrypted)" , path);
8385
@@ -191,14 +193,18 @@ static BOOL WINAPI hook_ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nSize, LPD
191193
192194 if (ok)
193195 {
194- if (*lpSize >= sizeof (PakHeader) && header->data .magic == 0x5a6f12e1 )
196+ if (*lpSize >= sizeof (PakHeader) && header->data .magic == PakMagic )
195197 {
196198 CheckPakHeader (hFile, &header->data , &header->guid );
197199 }
198- else if (*lpSize >= sizeof (PakHeaderOld) && headerOld->magic == 0x5a6f12e1 )
200+ else if (*lpSize >= sizeof (PakHeaderOld) && headerOld->magic == PakMagic )
199201 {
200202 CheckPakHeader (hFile, headerOld);
201203 }
204+ else if (*lpSize >= sizeof (DWORD ) && *(DWORD *)lpBuffer == PakMagic)
205+ {
206+ CheckPakHeader (hFile, NULL );
207+ }
202208 else for (auto &index : g_pakIndexes)
203209 {
204210 // see if we're reading the encrypted index for one of the pak files we found earlier
0 commit comments