Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

225 lines
7.1 KiB

  1. //
  2. // Helpful macro
  3. //
  4. #define FIELDOFFSET(type, field) ((int)(&((type *)1)->field)-1)
  5. //
  6. // The macro that should be used to check for apphack flags
  7. //
  8. #define APPCOMPATFLAG(_flag) (NtCurrentPeb()->AppCompatFlags.QuadPart & (_flag))
  9. //
  10. // Application compatibility flags and information
  11. //
  12. #define KACF_OLDGETSHORTPATHNAME 0x00000001 // Don't be like Win9x: in GetShortPathName(), NT 4
  13. // did not care if the file existed - it would give
  14. // the short path name anyway. This behavior was
  15. // changed in NT 5 (Win2000) to reflect behavior of
  16. // Win9x which will fail if the file does not exist.
  17. // Turning on this flag will give the old behavior
  18. // for the app.
  19. #define KACF_VERSIONLIE 0x00000002 // Used to signify app will
  20. // be lied to wrt what version
  21. // of the OS its running on via
  22. // GetVersion(), GetVersionEx()
  23. #define KACF_GETDISKFREESPACE 0x00000008 // Make GetDiskFreeSpace 2G friendly
  24. #define KACF_GETTEMPPATH 0x00000010 // Make GetTempPath return x:\temp
  25. #define KACF_FTMFROMCURRENTAPT 0x00000020 // If set, a DCOM Free-Threaded-Marshaled Object has
  26. // its' stub parked in the apartment that the object is
  27. // marshaled from instead of the Neutral-Apartment.
  28. // Having to set this bit indicates a busted App
  29. // that is not following the rules for FTM objects. The
  30. // app probably has other subtle problems that NT 4 or
  31. // Win9x didn't show. Blindly using the ATL wizard to
  32. // enable using the FTM is usually the source of the bug.
  33. #define KACF_DISALLOWORBINDINGCHANGES 0x00000040 // If set, the process will not be notified of changes
  34. // in the local machine bindings used by COM.
  35. #define KACF_OLE32VALIDATEPTRS 0x00000080 // If set, ole32.dll will use the IsBadReadPtr family of
  36. // functions to verify pointer arguments in the standard COM APIs.
  37. // This was the default behavior on all platforms prior to Whistler.
  38. #define KACF_DISABLECICERO 0x00000100 // If set, Cicero support for the current process
  39. // is disabled.
  40. enum {
  41. AVT_OSVERSIONINFO = 1, // Designates that an OSVERSIONINFO type info is contained within
  42. AVT_PATCHINFO // Designates that patching info is contained within
  43. };
  44. //
  45. // This variable length struct is the main basic data type contained within
  46. // the ApplicationGoo registry entry. Anything can be contained within here:
  47. // ResourceVersionInfo, VersionlyingInfo, patches, etc. You need to use the
  48. // XXX function to bounce down these correctly.
  49. //
  50. typedef struct _APP_VARIABLE_INFO {
  51. //
  52. // Type of variable length struct (defined above)
  53. //
  54. ULONG dwVariableType;
  55. //
  56. // Total size of this particular variable length struct
  57. //
  58. ULONG dwVariableInfoSize;
  59. //
  60. // The variable length data itself is to follow. It's commented out
  61. // as the length is undefined, could even be zero.
  62. //
  63. // UCHAR VariableInfo[];
  64. } APP_VARIABLE_INFO, *PAPP_VARIABLE_INFO;
  65. typedef struct _PRE_APP_COMPAT_INFO {
  66. //
  67. // Total size of this entry
  68. //
  69. ULONG dwEntryTotalSize;
  70. //
  71. // Amount of version resource information present in this entry
  72. //
  73. ULONG dwResourceInfoSize;
  74. //
  75. // Actual version resource information itself. It's commented out
  76. // as some apps have no version info. For the apps that do, below
  77. // is where it would start
  78. //
  79. // UCHAR ResourceInfo[];
  80. } PRE_APP_COMPAT_INFO, *PPRE_APP_COMPAT_INFO;
  81. //
  82. // This struct is what is read directly out of the registry under
  83. // HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\EXEname - ApplicationGoo.
  84. // Its a "Pre" structure cuz we won't be keeping all of it, if we decide its
  85. // a match to the app in question. You should make no assumptions of what
  86. // is contained beyond AppCompatEntry, as everything will be variable length.
  87. // If a match is found to the app being executed, a cleaner "Post" structure
  88. // is made and should be used by all.
  89. //
  90. typedef struct _APP_COMPAT_GOO {
  91. //
  92. // Total size of the "Pre" structure
  93. //
  94. ULONG dwTotalGooSize;
  95. //
  96. // At least one "Pre" app compat entry will be present (possibly more)
  97. //
  98. PRE_APP_COMPAT_INFO AppCompatEntry[1];
  99. } APP_COMPAT_GOO, *PAPP_COMPAT_GOO;
  100. //
  101. // This is the "Post" app compat structure. Variable length data can follow
  102. // the CompatibilityFlags field, so you should use the XXX function to find
  103. // any variable length data you might have in here. We have a "Pre" and
  104. // "Post" struct to try and save space in the registry and in resident RAM.
  105. //
  106. typedef struct _APP_COMPAT_INFO {
  107. //
  108. // Size of app compat entry
  109. //
  110. ULONG dwTotalSize;
  111. //
  112. // Bitmask of various app compat flags, see KACF definitions
  113. //
  114. ULARGE_INTEGER CompatibilityFlags;
  115. //
  116. // We may have zero, or many APP_VARIABLE_INFO structs to follow
  117. //
  118. } APP_COMPAT_INFO, *PAPP_COMPAT_INFO;
  119. typedef struct {
  120. ULONG dwOSVersionInfoSize;
  121. ULONG dwMajorVersion;
  122. ULONG dwMinorVersion;
  123. ULONG dwBuildNumber;
  124. ULONG dwPlatformId;
  125. USHORT wServicePackMajor;
  126. USHORT wServicePackMinor;
  127. USHORT wSuiteMask;
  128. UCHAR wProductType;
  129. UCHAR wReserved;
  130. WCHAR szCSDVersion[ 128 ];
  131. } EFFICIENTOSVERSIONINFOEXW, *PEFFICIENTOSVERSIONINFOEXW;
  132. //
  133. // New shim application compatibility flags and information
  134. //
  135. #define KACF_DISABLESYSKEYMESSAGES 0x00000001 // Sucks up WM_SYSKEYUP, WM_SYSKEYDOWN, WM_SYSMENU
  136. // so a particular app will not be able to alt-tab
  137. // to the desktop
  138. typedef struct _APP_COMPAT_SHIM_INFO {
  139. //
  140. // List of API hooked
  141. //
  142. PVOID pHookAPIList;
  143. //
  144. // List of patch hooks
  145. //
  146. PVOID pHookPatchList;
  147. //
  148. // List of the APIs to be hooked
  149. //
  150. PVOID ppHookAPI;
  151. //
  152. // Count of hooked APIs
  153. //
  154. ULONG dwHookAPICount;
  155. //
  156. // Exe specific inclusions/exclusion
  157. //
  158. PVOID pExeFilter;
  159. //
  160. // Global exclusions
  161. //
  162. PVOID pGlobalFilterList;
  163. //
  164. // Late bound DLL exclusions
  165. //
  166. PVOID pLBFilterList;
  167. //
  168. // Crit sec
  169. //
  170. PVOID pCritSec;
  171. //
  172. // Shim heap
  173. //
  174. PVOID pShimHeap;
  175. } APP_COMPAT_SHIM_INFO, *PAPP_COMPAT_SHIM_INFO;