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.

300 lines
10 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Main.cpp
  5. Abstract:
  6. Notes:
  7. History:
  8. 15/11/2000 clupu Created
  9. 11/30/2000 a-brienw modified for beginning of misc shim
  10. --*/
  11. #include "precomp.h"
  12. #include "ShimHookMacro.h"
  13. DECLARE_SHIM(AddProcessParametersFlags)
  14. DECLARE_SHIM(AliasDXDC)
  15. DECLARE_SHIM(CorrectACMArgs)
  16. DECLARE_SHIM(CorrectACMStreamOpen)
  17. DECLARE_SHIM(CorrectActiveMoviePath)
  18. DECLARE_SHIM(CorrectCreateIcon)
  19. DECLARE_SHIM(CorrectCreateSurface)
  20. DECLARE_SHIM(CorrectFarEastFont)
  21. DECLARE_SHIM(CorrectFilePathInSetDlgItemText)
  22. DECLARE_SHIM(CorrectFilePathsUninstall)
  23. DECLARE_SHIM(CorrectOpenFileExclusive)
  24. DECLARE_SHIM(CorrectVerInstallFile)
  25. DECLARE_SHIM(CUASAppFix)
  26. DECLARE_SHIM(CUASDisableCicero)
  27. DECLARE_SHIM(DelayDllInit)
  28. DECLARE_SHIM(DelayShowGroup)
  29. DECLARE_SHIM(DelayWin95VersionLie)
  30. DECLARE_SHIM(DelayWinMMCallback)
  31. DECLARE_SHIM(DeleteSpecifiedFiles)
  32. DECLARE_SHIM(DeRandomizeExeName)
  33. DECLARE_SHIM(DisableBoostThread)
  34. DECLARE_SHIM(DisableFilterKeys)
  35. DECLARE_SHIM(DisableScreenSaver)
  36. DECLARE_SHIM(DisableStickyKeys)
  37. #ifndef SHIM_WIN2K
  38. DECLARE_SHIM(DisableThemes)
  39. #endif // SHIM_WIN2K
  40. DECLARE_SHIM(DisableW2KOwnerDrawButtonStates)
  41. DECLARE_SHIM(EmptyClipboardtoSet)
  42. DECLARE_SHIM(EmulateGetStdHandle)
  43. DECLARE_SHIM(EmulateGetStringType)
  44. DECLARE_SHIM(EmulateGetUIEffects)
  45. DECLARE_SHIM(EmulateLZHandles)
  46. DECLARE_SHIM(EnlargeGetObjectBufferSize)
  47. DECLARE_SHIM(ExtractAssociatedIcon)
  48. DECLARE_SHIM(FailCloseProfileUserMapping)
  49. DECLARE_SHIM(FailGetStdHandle)
  50. DECLARE_SHIM(FailObsoleteShellAPIs)
  51. DECLARE_SHIM(FailOpenFile)
  52. DECLARE_SHIM(FakeThemeMetrics)
  53. DECLARE_SHIM(FilterNetworkResources)
  54. DECLARE_SHIM(FixServiceStartupCircularDependency)
  55. DECLARE_SHIM(Force640x480x8)
  56. DECLARE_SHIM(Force640x480x16)
  57. DECLARE_SHIM(ForceAdminAccess)
  58. DECLARE_SHIM(ForceAnsiWindowProc)
  59. DECLARE_SHIM(ForceAppendMenuSuccess)
  60. DECLARE_SHIM(ForceApplicationFocus)
  61. DECLARE_SHIM(ForceAVIWindow)
  62. DECLARE_SHIM(ForceDefaultSystemPaletteEntries)
  63. DECLARE_SHIM(ForceDirectDrawEmulation)
  64. DECLARE_SHIM(ForceDirectDrawWait)
  65. DECLARE_SHIM(ForceDisplayMode)
  66. DECLARE_SHIM(ForceSeparateVDM)
  67. DECLARE_SHIM(ForceSimpleWindow)
  68. DECLARE_SHIM(ForceTemporaryModeChange)
  69. DECLARE_SHIM(ForceWorkingDirectoryToEXEPath)
  70. DECLARE_SHIM(FUSBadApplicationType1)
  71. DECLARE_SHIM(FUSBadApplicationType2)
  72. DECLARE_SHIM(FUSBadApplicationType3)
  73. DECLARE_SHIM(FUSBadApplicationType4)
  74. DECLARE_SHIM(GetVolumeInformationLie)
  75. DECLARE_SHIM(GlobalMemoryStatusLie)
  76. DECLARE_SHIM(GlobalMemoryStatusTrim)
  77. DECLARE_SHIM(HandleDBCSUserName)
  78. DECLARE_SHIM(HandleDBCSUserName2)
  79. DECLARE_SHIM(HandleEmptyAccessCheck)
  80. DECLARE_SHIM(HeapClearAllocation)
  81. DECLARE_SHIM(HeapDelayLocalFree)
  82. DECLARE_SHIM(HeapForceGrowable)
  83. DECLARE_SHIM(HeapIgnoreMoveable)
  84. DECLARE_SHIM(HeapLookasideFree)
  85. DECLARE_SHIM(HeapPadAllocation)
  86. DECLARE_SHIM(HeapValidateFrees)
  87. DECLARE_SHIM(HideCursor)
  88. DECLARE_SHIM(HideTaskBar)
  89. DECLARE_SHIM(IEUnHarden)
  90. DECLARE_SHIM(IgnoreAltTab)
  91. DECLARE_SHIM(IgnoreCoCreateInstance)
  92. DECLARE_SHIM(IgnoreCRTExit)
  93. DECLARE_SHIM(IgnoreDebugOutput)
  94. DECLARE_SHIM(IgnoreFreeLibrary)
  95. DECLARE_SHIM(IgnoreHungAppPaint)
  96. DECLARE_SHIM(IgnoreMCIStop)
  97. DECLARE_SHIM(IgnoreMessageBox)
  98. DECLARE_SHIM(IgnoreNoModeChange)
  99. DECLARE_SHIM(IgnoreOemToChar)
  100. DECLARE_SHIM(IgnoreSysColChanges)
  101. DECLARE_SHIM(IgnoreTAPIDisconnect)
  102. DECLARE_SHIM(IgnoreVBOverflow)
  103. DECLARE_SHIM(IgnoreZeroMoveWindow)
  104. DECLARE_SHIM(InjectDll)
  105. DECLARE_SHIM(KeepWindowOnMonitor)
  106. DECLARE_SHIM(LazyReleaseDC)
  107. DECLARE_SHIM(LimitFindFile)
  108. DECLARE_SHIM(LoadComctl32Version5)
  109. DECLARE_SHIM(LoadLibraryCWD)
  110. DECLARE_SHIM(LowerThreadPriority)
  111. DECLARE_SHIM(MoveIniToRegistry)
  112. DECLARE_SHIM(MoveWinInitRenameToReg)
  113. DECLARE_SHIM(NullHwndInMessageBox)
  114. DECLARE_SHIM(PaletteRestore)
  115. DECLARE_SHIM(PopulateDefaultHKCUSettings)
  116. DECLARE_SHIM(PropagateProcessHistory)
  117. DECLARE_SHIM(RecopyExeFromCD)
  118. DECLARE_SHIM(RedirectDBCSTempPath)
  119. DECLARE_SHIM(RedirectEXE)
  120. DECLARE_SHIM(RedirectWindowsDirToSystem32)
  121. DECLARE_SHIM(RemoveBroadcastPostMessage)
  122. DECLARE_SHIM(RemoveDDEFlagFromShellExecuteEx)
  123. DECLARE_SHIM(RemoveInvalidW2KWindowStyles)
  124. DECLARE_SHIM(RemoveIpFromMsInfoCommandLine)
  125. DECLARE_SHIM(RemoveNoBufferingFlagFromCreateFile)
  126. DECLARE_SHIM(RemoveOverlappedFlagFromCreateFile)
  127. DECLARE_SHIM(RemoveReadOnlyAttribute)
  128. DECLARE_SHIM(RestoreSystemCursors)
  129. DECLARE_SHIM(SearchPathInAppPaths)
  130. DECLARE_SHIM(SetEnvironmentVariable)
  131. DECLARE_SHIM(StackSwap)
  132. DECLARE_SHIM(TerminateExe)
  133. DECLARE_SHIM(TrimVersionInfo)
  134. DECLARE_SHIM(UnMirrorImageList)
  135. DECLARE_SHIM(WaveOutUsePreferredDevice)
  136. DECLARE_SHIM(WinG32SysToSys32)
  137. VOID MULTISHIM_NOTIFY_FUNCTION()(DWORD fdwReason)
  138. {
  139. switch (fdwReason)
  140. {
  141. case DLL_PROCESS_ATTACH:
  142. DPF("AcGenral", eDbgLevelSpew, "General Purpose Shims initialized.");
  143. break;
  144. case DLL_PROCESS_DETACH:
  145. DPF("AcGenral", eDbgLevelSpew, "General Purpose Shims uninitialized.");
  146. break;
  147. default:
  148. break;
  149. }
  150. }
  151. MULTISHIM_BEGIN()
  152. MULTISHIM_ENTRY(AddProcessParametersFlags)
  153. MULTISHIM_ENTRY(AliasDXDC)
  154. MULTISHIM_ENTRY(CorrectACMArgs)
  155. MULTISHIM_ENTRY(CorrectACMStreamOpen)
  156. MULTISHIM_ENTRY(CorrectActiveMoviePath)
  157. MULTISHIM_ENTRY(CorrectCreateIcon)
  158. MULTISHIM_ENTRY(CorrectCreateSurface)
  159. MULTISHIM_ENTRY(CorrectFarEastFont)
  160. MULTISHIM_ENTRY(CorrectFilePathInSetDlgItemText)
  161. MULTISHIM_ENTRY(CorrectFilePathsUninstall)
  162. MULTISHIM_ENTRY(CorrectOpenFileExclusive)
  163. MULTISHIM_ENTRY(CorrectVerInstallFile)
  164. MULTISHIM_ENTRY(CUASAppFix)
  165. MULTISHIM_ENTRY(CUASDisableCicero)
  166. MULTISHIM_ENTRY(DelayDllInit)
  167. MULTISHIM_ENTRY(DelayShowGroup)
  168. MULTISHIM_ENTRY(DelayWin95VersionLie)
  169. MULTISHIM_ENTRY(DelayWinMMCallback)
  170. MULTISHIM_ENTRY(DeleteSpecifiedFiles)
  171. MULTISHIM_ENTRY(DeRandomizeExeName)
  172. MULTISHIM_ENTRY(DisableBoostThread)
  173. MULTISHIM_ENTRY(DisableFilterKeys)
  174. MULTISHIM_ENTRY(DisableScreenSaver)
  175. MULTISHIM_ENTRY(DisableStickyKeys)
  176. #ifndef SHIM_WIN2K
  177. MULTISHIM_ENTRY(DisableThemes)
  178. #endif // SHIM_WIN2K
  179. MULTISHIM_ENTRY(DisableW2KOwnerDrawButtonStates)
  180. MULTISHIM_ENTRY(EmptyClipboardtoSet)
  181. MULTISHIM_ENTRY(EmulateGetStdHandle)
  182. MULTISHIM_ENTRY(EmulateGetStringType)
  183. MULTISHIM_ENTRY(EmulateGetUIEffects)
  184. MULTISHIM_ENTRY(EmulateLZHandles)
  185. MULTISHIM_ENTRY(EnlargeGetObjectBufferSize)
  186. MULTISHIM_ENTRY(ExtractAssociatedIcon)
  187. MULTISHIM_ENTRY(FailCloseProfileUserMapping)
  188. MULTISHIM_ENTRY(FailGetStdHandle)
  189. MULTISHIM_ENTRY(FailObsoleteShellAPIs)
  190. MULTISHIM_ENTRY(FailOpenFile)
  191. MULTISHIM_ENTRY(FakeThemeMetrics)
  192. MULTISHIM_ENTRY(FilterNetworkResources)
  193. MULTISHIM_ENTRY(FixServiceStartupCircularDependency)
  194. MULTISHIM_ENTRY(Force640x480x8)
  195. MULTISHIM_ENTRY(Force640x480x16)
  196. MULTISHIM_ENTRY(ForceAdminAccess)
  197. MULTISHIM_ENTRY(ForceAnsiWindowProc)
  198. MULTISHIM_ENTRY(ForceAppendMenuSuccess)
  199. MULTISHIM_ENTRY(ForceApplicationFocus)
  200. MULTISHIM_ENTRY(ForceAVIWindow)
  201. MULTISHIM_ENTRY(ForceDefaultSystemPaletteEntries)
  202. MULTISHIM_ENTRY(ForceDirectDrawEmulation)
  203. MULTISHIM_ENTRY(ForceDirectDrawWait)
  204. MULTISHIM_ENTRY(ForceDisplayMode)
  205. MULTISHIM_ENTRY(ForceSeparateVDM)
  206. MULTISHIM_ENTRY(ForceSimpleWindow)
  207. MULTISHIM_ENTRY(ForceTemporaryModeChange)
  208. MULTISHIM_ENTRY(ForceWorkingDirectoryToEXEPath)
  209. MULTISHIM_ENTRY(FUSBadApplicationType1)
  210. MULTISHIM_ENTRY(FUSBadApplicationType2)
  211. MULTISHIM_ENTRY(FUSBadApplicationType3)
  212. MULTISHIM_ENTRY(FUSBadApplicationType4)
  213. MULTISHIM_ENTRY(GetVolumeInformationLie)
  214. MULTISHIM_ENTRY(GlobalMemoryStatusLie)
  215. MULTISHIM_ENTRY(GlobalMemoryStatusTrim)
  216. MULTISHIM_ENTRY(HandleDBCSUserName)
  217. MULTISHIM_ENTRY(HandleDBCSUserName2)
  218. MULTISHIM_ENTRY(HandleEmptyAccessCheck)
  219. MULTISHIM_ENTRY(HeapClearAllocation)
  220. MULTISHIM_ENTRY(HeapDelayLocalFree)
  221. MULTISHIM_ENTRY(HeapForceGrowable)
  222. MULTISHIM_ENTRY(HeapIgnoreMoveable)
  223. MULTISHIM_ENTRY(HeapLookasideFree)
  224. MULTISHIM_ENTRY(HeapPadAllocation)
  225. MULTISHIM_ENTRY(HeapValidateFrees)
  226. MULTISHIM_ENTRY(HideCursor)
  227. MULTISHIM_ENTRY(HideTaskBar)
  228. MULTISHIM_ENTRY(IEUnHarden)
  229. MULTISHIM_ENTRY(IgnoreAltTab)
  230. MULTISHIM_ENTRY(IgnoreCoCreateInstance)
  231. MULTISHIM_ENTRY(IgnoreCRTExit)
  232. MULTISHIM_ENTRY(IgnoreDebugOutput)
  233. MULTISHIM_ENTRY(IgnoreFreeLibrary)
  234. MULTISHIM_ENTRY(IgnoreHungAppPaint)
  235. MULTISHIM_ENTRY(IgnoreMCIStop)
  236. MULTISHIM_ENTRY(IgnoreMessageBox)
  237. MULTISHIM_ENTRY(IgnoreNoModeChange)
  238. MULTISHIM_ENTRY(IgnoreOemToChar)
  239. MULTISHIM_ENTRY(IgnoreSysColChanges)
  240. MULTISHIM_ENTRY(IgnoreTAPIDisconnect)
  241. MULTISHIM_ENTRY(IgnoreVBOverflow)
  242. MULTISHIM_ENTRY(IgnoreZeroMoveWindow)
  243. MULTISHIM_ENTRY(InjectDll)
  244. MULTISHIM_ENTRY(KeepWindowOnMonitor)
  245. MULTISHIM_ENTRY(LazyReleaseDC)
  246. MULTISHIM_ENTRY(LimitFindFile)
  247. MULTISHIM_ENTRY(LoadComctl32Version5)
  248. MULTISHIM_ENTRY(LoadLibraryCWD)
  249. MULTISHIM_ENTRY(LowerThreadPriority)
  250. MULTISHIM_ENTRY(MoveIniToRegistry)
  251. MULTISHIM_ENTRY(MoveWinInitRenameToReg)
  252. MULTISHIM_ENTRY(NullHwndInMessageBox)
  253. MULTISHIM_ENTRY(PaletteRestore)
  254. MULTISHIM_ENTRY(PopulateDefaultHKCUSettings)
  255. MULTISHIM_ENTRY(PropagateProcessHistory)
  256. MULTISHIM_ENTRY(RecopyExeFromCD)
  257. MULTISHIM_ENTRY(RedirectDBCSTempPath)
  258. MULTISHIM_ENTRY(RedirectEXE)
  259. MULTISHIM_ENTRY(RedirectWindowsDirToSystem32)
  260. MULTISHIM_ENTRY(RemoveBroadcastPostMessage)
  261. MULTISHIM_ENTRY(RemoveDDEFlagFromShellExecuteEx)
  262. MULTISHIM_ENTRY(RemoveInvalidW2KWindowStyles)
  263. MULTISHIM_ENTRY(RemoveIpFromMsInfoCommandLine)
  264. MULTISHIM_ENTRY(RemoveNoBufferingFlagFromCreateFile)
  265. MULTISHIM_ENTRY(RemoveOverlappedFlagFromCreateFile)
  266. MULTISHIM_ENTRY(RemoveReadOnlyAttribute)
  267. MULTISHIM_ENTRY(RestoreSystemCursors)
  268. MULTISHIM_ENTRY(SearchPathInAppPaths)
  269. MULTISHIM_ENTRY(SetEnvironmentVariable)
  270. MULTISHIM_ENTRY(StackSwap)
  271. MULTISHIM_ENTRY(TerminateExe)
  272. MULTISHIM_ENTRY(TrimVersionInfo)
  273. MULTISHIM_ENTRY(UnMirrorImageList)
  274. MULTISHIM_ENTRY(WaveOutUsePreferredDevice)
  275. MULTISHIM_ENTRY(WinG32SysToSys32)
  276. CALL_MULTISHIM_NOTIFY_FUNCTION()
  277. MULTISHIM_END()