#define WIN32_LEAN_AND_MEAN #define _WIN32_WINNT 0x0601 #include #include LONG NTAPI NtQuerySystemInformation(ULONG,void *,ULONG,ULONG *); typedef struct { ULONG reserved,timer,page,pages,lowest,highest,granularity; ULONG_PTR minimum,maximum,affinity; BYTE processors; } BasicInformation; __declspec(dllexport) volatile unsigned phase; int raven_entry(void) { BasicInformation info; ULONG length=0; SetLastError(71); if (sizeof(info)!=64 || NtQuerySystemInformation(0,&info,sizeof(info),&length)!=0 || length!=sizeof(info) || GetLastError()!=71 || info.reserved || info.page!=4096 || info.granularity!=65536 || !info.pages || info.highestActiveProcessorCount!=system.dwNumberOfProcessors || processors->MaximumProcessorCountActiveProcessorCount || processors->MaximumProcessorCount>64 || processors->ActiveProcessorMask!=system.dwActiveProcessorMask) return 8; for (unsigned index=0;indexReserved);++index) if(processors->Reserved[index]) return 10; if (GetLogicalProcessorInformationEx(RelationGroup,&group,NULL) || GetLastError()!=ERROR_INVALID_PARAMETER) return 11; size=sizeof(group); if (GetLogicalProcessorInformationEx((LOGICAL_PROCESSOR_RELATIONSHIP)0x1234,&group,&size) || GetLastError()!=ERROR_INVALID_PARAMETER || size!=sizeof(group)) return 12; static unsigned char all[4096]; size=sizeof(all); if (!GetLogicalProcessorInformationEx(RelationAll,(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX)all,&size)) return 13; unsigned offset=0,groups=0; while(offsetSize<8 || entry->Size>size-offset) return 14; if(entry->Relationship==RelationGroup) { if(entry->Size!=required) return 15; for(unsigned index=0;indexSize; } if(groups!=1) return 17; } phase=1; return 0; }