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.

137 lines
2.6 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Win2000VersionLie.cpp
  5. Abstract:
  6. This DLL hooks GetVersion and GetVersionEx so that they return Windows 2000
  7. version credentials.
  8. Notes:
  9. This is a general purpose shim.
  10. History:
  11. 03/13/2000 clupu Created
  12. --*/
  13. #include "precomp.h"
  14. IMPLEMENT_SHIM_BEGIN(Win2000VersionLie)
  15. #include "ShimHookMacro.h"
  16. APIHOOK_ENUM_BEGIN
  17. APIHOOK_ENUM_ENTRY(GetVersionExA)
  18. APIHOOK_ENUM_ENTRY(GetVersionExW)
  19. APIHOOK_ENUM_ENTRY(GetVersion)
  20. APIHOOK_ENUM_END
  21. /*++
  22. This stub function fixes up the OSVERSIONINFO structure that is
  23. returned to the caller with Windows 95 credentials.
  24. --*/
  25. BOOL
  26. APIHOOK(GetVersionExA)(
  27. OUT LPOSVERSIONINFOA lpVersionInformation
  28. )
  29. {
  30. BOOL bReturn = FALSE;
  31. if (ORIGINAL_API(GetVersionExA)(lpVersionInformation)) {
  32. LOGN(
  33. eDbgLevelInfo,
  34. "[GetVersionExA] called. return Win2k.");
  35. //
  36. // Fixup the structure with the Win2k data.
  37. //
  38. lpVersionInformation->dwMajorVersion = 5;
  39. lpVersionInformation->dwMinorVersion = 0;
  40. lpVersionInformation->dwBuildNumber = 2195;
  41. lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
  42. *lpVersionInformation->szCSDVersion = '\0';
  43. bReturn = TRUE;
  44. }
  45. return bReturn;
  46. }
  47. /*++
  48. This stub function fixes up the OSVERSIONINFO structure that is
  49. returned to the caller with Windows 95 credentials. This is the
  50. wide-character version of GetVersionExW.
  51. --*/
  52. BOOL
  53. APIHOOK(GetVersionExW)(
  54. OUT LPOSVERSIONINFOW lpVersionInformation
  55. )
  56. {
  57. BOOL bReturn = FALSE;
  58. if (ORIGINAL_API(GetVersionExW)(lpVersionInformation)) {
  59. LOGN(
  60. eDbgLevelInfo,
  61. "[GetVersionExW] called. return Win2k.");
  62. //
  63. // Fixup the structure with the Win2k data.
  64. //
  65. lpVersionInformation->dwMajorVersion = 5;
  66. lpVersionInformation->dwMinorVersion = 0;
  67. lpVersionInformation->dwBuildNumber = 2195;
  68. lpVersionInformation->dwPlatformId = VER_PLATFORM_WIN32_NT;
  69. *lpVersionInformation->szCSDVersion = L'\0';
  70. bReturn = TRUE;
  71. }
  72. return bReturn;
  73. }
  74. /*++
  75. This stub function returns Windows 95 credentials.
  76. --*/
  77. DWORD
  78. APIHOOK(GetVersion)(
  79. void
  80. )
  81. {
  82. LOGN(
  83. eDbgLevelInfo,
  84. "[GetVersion] called. return Win2k.");
  85. return (DWORD)0x08930005;
  86. }
  87. /*++
  88. Register hooked functions
  89. --*/
  90. HOOK_BEGIN
  91. APIHOOK_ENTRY(KERNEL32.DLL, GetVersionExA)
  92. APIHOOK_ENTRY(KERNEL32.DLL, GetVersionExW)
  93. APIHOOK_ENTRY(KERNEL32.DLL, GetVersion)
  94. HOOK_END
  95. IMPLEMENT_SHIM_END