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.

119 lines
2.1 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name :
  4. isplat.cxx
  5. Abstract:
  6. This module defines functions for determining platform types
  7. Author:
  8. Johnson Apacible (johnsona) 19-Nov-1996
  9. --*/
  10. #include <nt.h>
  11. #include <ntrtl.h>
  12. #include <nturtl.h>
  13. #include <windows.h>
  14. #include <isplat.h>
  15. #include <inetsvcs.h>
  16. PLATFORM_TYPE TsPlatformType = PtInvalid;
  17. typedef
  18. BOOLEAN
  19. (NTAPI *GET_PRODUCT_TYPE)(
  20. PNT_PRODUCT_TYPE
  21. );
  22. PLATFORM_TYPE
  23. IISGetPlatformType(
  24. VOID
  25. )
  26. /*++
  27. This function consults the registry and determines the platform type
  28. for this machine.
  29. Arguments:
  30. None
  31. Returns:
  32. Platform type
  33. --*/
  34. {
  35. PLATFORM_TYPE pt;
  36. LONG result;
  37. HKEY keyHandle;
  38. WCHAR productType[30];
  39. DWORD type;
  40. BOOL isNt = TRUE;
  41. OSVERSIONINFO osInfo;
  42. //
  43. // See if the platform type has already been discovered.
  44. //
  45. if ( TsPlatformType != PtInvalid ) {
  46. return(TsPlatformType);
  47. }
  48. //
  49. // see if this is win95
  50. //
  51. osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  52. if ( GetVersionEx( &osInfo ) ) {
  53. isNt = (osInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
  54. } else {
  55. IIS_PRINTF((buff,"GetVersionEx failed with %d\n",
  56. GetLastError()));
  57. }
  58. if ( isNt ) {
  59. HINSTANCE hNtdll;
  60. NT_PRODUCT_TYPE ntType;
  61. GET_PRODUCT_TYPE pfnGetProductType;
  62. //
  63. // Get the product type from the system
  64. //
  65. pt = PtNtWorkstation;
  66. hNtdll = LoadLibrary("ntdll.dll");
  67. if ( hNtdll != NULL ) {
  68. pfnGetProductType = (GET_PRODUCT_TYPE)
  69. GetProcAddress(hNtdll, "RtlGetNtProductType");
  70. if ( (pfnGetProductType != NULL) &&
  71. pfnGetProductType( &ntType ) ) {
  72. if ( (ntType == NtProductLanManNt) ||
  73. (ntType == NtProductServer) ) {
  74. pt = PtNtServer;
  75. }
  76. }
  77. FreeLibrary( hNtdll );
  78. }
  79. } else {
  80. pt = PtWindows95;
  81. }
  82. TsPlatformType = pt;
  83. return(pt);
  84. } // IISGetPlatformType