1 #ifndef COMPAT_UNDOC_H 2 #define COMPAT_UNDOC_H 3 4 5 typedef struct _ReactOS_ShimData 6 { 7 DWORD dwReserved1[130]; 8 DWORD dwSize; 9 DWORD dwMagic; 10 DWORD dwReserved2[242]; 11 DWORD dwRosProcessCompatVersion; 12 } ReactOS_ShimData; 13 14 15 #define REACTOS_SHIMDATA_MAGIC 0xAC0DEDAB 16 #define REACTOS_COMPATVERSION_UNINITIALIZED 0xfffffffe 17 #define REACTOS_COMPATVERSION_IGNOREMANIFEST 0xffffffff 18 19 // Returns values in the form of _WIN32_WINNT_VISTA, _WIN32_WINNT_WIN7 etc 20 static 21 inline 22 DWORD RosGetProcessCompatVersion(VOID) 23 { 24 static DWORD g_CompatVersion = REACTOS_COMPATVERSION_UNINITIALIZED; 25 if (g_CompatVersion == REACTOS_COMPATVERSION_UNINITIALIZED) 26 { 27 ReactOS_ShimData* pShimData = (ReactOS_ShimData*)NtCurrentPeb()->pShimData; 28 if (pShimData && pShimData->dwMagic == REACTOS_SHIMDATA_MAGIC && 29 pShimData->dwSize == sizeof(ReactOS_ShimData)) 30 { 31 g_CompatVersion = pShimData->dwRosProcessCompatVersion; 32 } 33 } 34 return g_CompatVersion < REACTOS_COMPATVERSION_UNINITIALIZED ? g_CompatVersion : 0; 35 } 36 37 static 38 inline 39 UINT RosGetProcessEffectiveVersion(VOID) 40 { 41 PPEB peb = NtCurrentPeb(); 42 UINT shimVer = RosGetProcessCompatVersion(); 43 if (shimVer) 44 return shimVer; 45 else 46 return (peb->OSMajorVersion << 8) | (peb->OSMinorVersion); 47 } 48 49 #endif // COMPAT_UNDOC_H 50