Leaked source code of windows server 2003
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.

227 lines
7.4 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. #define KACF_OLE32ENABLEASYNCDOCFILE 0x00000200
  41. enum {
  42. AVT_OSVERSIONINFO = 1, // Designates that an OSVERSIONINFO type info is contained within
  43. AVT_PATCHINFO // Designates that patching info is contained within
  44. };
  45. //
  46. // This variable length struct is the main basic data type contained within
  47. // the ApplicationGoo registry entry. Anything can be contained within here:
  48. // ResourceVersionInfo, VersionlyingInfo, patches, etc. You need to use the
  49. // XXX function to bounce down these correctly.
  50. //
  51. typedef struct _APP_VARIABLE_INFO {
  52. //
  53. // Type of variable length struct (defined above)
  54. //
  55. ULONG dwVariableType;
  56. //
  57. // Total size of this particular variable length struct
  58. //
  59. ULONG dwVariableInfoSize;
  60. //
  61. // The variable length data itself is to follow. It's commented out
  62. // as the length is undefined, could even be zero.
  63. //
  64. // UCHAR VariableInfo[];
  65. } APP_VARIABLE_INFO, *PAPP_VARIABLE_INFO;
  66. typedef struct _PRE_APP_COMPAT_INFO {
  67. //
  68. // Total size of this entry
  69. //
  70. ULONG dwEntryTotalSize;
  71. //
  72. // Amount of version resource information present in this entry
  73. //
  74. ULONG dwResourceInfoSize;
  75. //
  76. // Actual version resource information itself. It's commented out
  77. // as some apps have no version info. For the apps that do, below
  78. // is where it would start
  79. //
  80. // UCHAR ResourceInfo[];
  81. } PRE_APP_COMPAT_INFO, *PPRE_APP_COMPAT_INFO;
  82. //
  83. // This struct is what is read directly out of the registry under
  84. // HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\EXEname - ApplicationGoo.
  85. // Its a "Pre" structure cuz we won't be keeping all of it, if we decide its
  86. // a match to the app in question. You should make no assumptions of what
  87. // is contained beyond AppCompatEntry, as everything will be variable length.
  88. // If a match is found to the app being executed, a cleaner "Post" structure
  89. // is made and should be used by all.
  90. //
  91. typedef struct _APP_COMPAT_GOO {
  92. //
  93. // Total size of the "Pre" structure
  94. //
  95. ULONG dwTotalGooSize;
  96. //
  97. // At least one "Pre" app compat entry will be present (possibly more)
  98. //
  99. PRE_APP_COMPAT_INFO AppCompatEntry[1];
  100. } APP_COMPAT_GOO, *PAPP_COMPAT_GOO;
  101. //
  102. // This is the "Post" app compat structure. Variable length data can follow
  103. // the CompatibilityFlags field, so you should use the XXX function to find
  104. // any variable length data you might have in here. We have a "Pre" and
  105. // "Post" struct to try and save space in the registry and in resident RAM.
  106. //
  107. typedef struct _APP_COMPAT_INFO {
  108. //
  109. // Size of app compat entry
  110. //
  111. ULONG dwTotalSize;
  112. //
  113. // Bitmask of various app compat flags, see KACF definitions
  114. //
  115. ULARGE_INTEGER CompatibilityFlags;
  116. //
  117. // We may have zero, or many APP_VARIABLE_INFO structs to follow
  118. //
  119. } APP_COMPAT_INFO, *PAPP_COMPAT_INFO;
  120. typedef struct {
  121. ULONG dwOSVersionInfoSize;
  122. ULONG dwMajorVersion;
  123. ULONG dwMinorVersion;
  124. ULONG dwBuildNumber;
  125. ULONG dwPlatformId;
  126. USHORT wServicePackMajor;
  127. USHORT wServicePackMinor;
  128. USHORT wSuiteMask;
  129. UCHAR wProductType;
  130. UCHAR wReserved;
  131. WCHAR szCSDVersion[ 128 ];
  132. } EFFICIENTOSVERSIONINFOEXW, *PEFFICIENTOSVERSIONINFOEXW;
  133. //
  134. // New shim application compatibility flags and information
  135. //
  136. #define KACF_DISABLESYSKEYMESSAGES 0x00000001 // Sucks up WM_SYSKEYUP, WM_SYSKEYDOWN, WM_SYSMENU
  137. // so a particular app will not be able to alt-tab
  138. // to the desktop
  139. typedef struct _APP_COMPAT_SHIM_INFO {
  140. //
  141. // List of API hooked
  142. //
  143. PVOID pHookAPIList;
  144. //
  145. // List of patch hooks
  146. //
  147. PVOID pHookPatchList;
  148. //
  149. // List of the APIs to be hooked
  150. //
  151. PVOID ppHookAPI;
  152. //
  153. // Count of hooked APIs
  154. //
  155. ULONG dwHookAPICount;
  156. //
  157. // Exe specific inclusions/exclusion
  158. //
  159. PVOID pExeFilter;
  160. //
  161. // Global exclusions
  162. //
  163. PVOID pGlobalFilterList;
  164. //
  165. // Late bound DLL exclusions
  166. //
  167. PVOID pLBFilterList;
  168. //
  169. // Crit sec
  170. //
  171. PVOID pCritSec;
  172. //
  173. // Shim heap
  174. //
  175. PVOID pShimHeap;
  176. } APP_COMPAT_SHIM_INFO, *PAPP_COMPAT_SHIM_INFO;