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.

105 lines
2.6 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. ISA2000SP1.cpp
  5. Abstract:
  6. Changes HKLM\System\CurrentControlSet\Services\mspfltex\start from 4 to 2 to
  7. re-enable ISA services.
  8. Notes:
  9. This is a specific shim.
  10. History:
  11. 11/19/2002 astritz Created
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(ISA2000SP1)
  15. #include "ShimHookMacro.h"
  16. APIHOOK_ENUM_BEGIN
  17. APIHOOK_ENUM_END
  18. BOOL
  19. NOTIFY_FUNCTION(
  20. DWORD fdwReason
  21. )
  22. {
  23. if (fdwReason == SHIM_STATIC_DLLS_INITIALIZED) {
  24. HKEY hKey = 0;
  25. if( ERROR_SUCCESS == RegOpenKeyExW(
  26. HKEY_LOCAL_MACHINE,
  27. L"System\\CurrentControlSet\\Services\\mspfltex",
  28. 0,
  29. KEY_ALL_ACCESS,
  30. &hKey
  31. ))
  32. {
  33. DWORD dwOldValue = 0;
  34. DWORD dwType = 0;
  35. DWORD dwSize = sizeof(dwOldValue);
  36. if( ERROR_SUCCESS == RegQueryValueExW(
  37. hKey,
  38. L"start",
  39. 0,
  40. &dwType,
  41. (LPBYTE)&dwOldValue,
  42. &dwSize
  43. ))
  44. {
  45. if ( REG_DWORD == dwType && dwOldValue == 4 )
  46. {
  47. DWORD dwNewValue = 2;
  48. if( ERROR_SUCCESS == RegSetValueExW(
  49. hKey,
  50. L"start",
  51. 0,
  52. REG_DWORD,
  53. (LPBYTE)&dwNewValue,
  54. sizeof(dwNewValue)
  55. ))
  56. {
  57. LOGN( eDbgLevelError, "[INIT] Changed HKLM\\System\\CurrentControlSet\\Services\\mspfltex\\start from 4 to 2.");
  58. } else {
  59. LOGN( eDbgLevelError, "[INIT] Failed to change HKLM\\System\\CurrentControlSet\\Services\\mspfltex\\start from 4 to 2.");
  60. }
  61. } else {
  62. LOGN( eDbgLevelError, "[INIT] HKLM\\System\\CurrentControlSet\\Services\\mspfltex\\start was not 4 so not changing.");
  63. }
  64. } else {
  65. LOGN( eDbgLevelError, "[INIT] Failed to query HKLM\\System\\CurrentControlSet\\Services\\mspfltex\\start.");
  66. }
  67. RegCloseKey(hKey);
  68. } else {
  69. LOGN( eDbgLevelError, "[INIT] Failed to open HKLM\\System\\CurrentControlSet\\Services\\mspfltex.");
  70. }
  71. }
  72. return TRUE;
  73. }
  74. /*++
  75. Register hooked functions
  76. --*/
  77. HOOK_BEGIN
  78. CALL_NOTIFY_FUNCTION
  79. HOOK_END
  80. IMPLEMENT_SHIM_END