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.

147 lines
3.5 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1996 - 1997
  3. All rights reserved.
  4. Module Name:
  5. compinfo.hxx
  6. Abstract:
  7. Local and remote computer information detection header.
  8. Author:
  9. 10/17/95 <adamk> created.
  10. Steve Kiraly (SteveKi) 21-Jan-1996 used for downlevel server detection
  11. Revision History:
  12. --*/
  13. #ifndef _COMPINFO_H_
  14. #define _COMPINFO_H_
  15. extern TCHAR const PROCESSOR_ARCHITECTURE_NAME_INTEL[];
  16. extern TCHAR const PROCESSOR_ARCHITECTURE_NAME_MIPS[];
  17. extern TCHAR const PROCESSOR_ARCHITECTURE_NAME_ALPHA[];
  18. extern TCHAR const PROCESSOR_ARCHITECTURE_NAME_POWERPC[];
  19. extern TCHAR const PROCESSOR_ARCHITECTURE_NAME_UNKNOWN[];
  20. extern TCHAR const ENVIRONMENT_IA64[];
  21. extern TCHAR const ENVIRONMENT_INTEL[];
  22. extern TCHAR const ENVIRONMENT_MIPS[];
  23. extern TCHAR const ENVIRONMENT_ALPHA[];
  24. extern TCHAR const ENVIRONMENT_POWERPC[];
  25. extern TCHAR const ENVIRONMENT_WINDOWS[];
  26. extern TCHAR const ENVIRONMENT_UNKNOWN[];
  27. extern TCHAR const ENVIRONMENT_NATIVE[];
  28. extern TCHAR const c_szProductOptionsPath[];
  29. extern TCHAR const c_szProductOptions[];
  30. extern TCHAR const c_szWorkstation[];
  31. extern TCHAR const c_szServer1[];
  32. extern TCHAR const c_szServer2[];
  33. ///////////////////////////////////////////////////////////////////////////////
  34. // CComputerInfo
  35. class CComputerInfo
  36. {
  37. public:
  38. CComputerInfo(LPCTSTR pComputerName = gszNULL );
  39. ~CComputerInfo();
  40. BOOL IsRunningWindowsNT() const;
  41. BOOL IsRunningWindows95() const;
  42. BOOL IsRunningNtServer() const;
  43. BOOL IsRunningNtWorkstation() const;
  44. DWORD GetOSBuildNumber() const;
  45. WORD GetProcessorArchitecture() const;
  46. LPCTSTR GetProcessorArchitectureName() const;
  47. LPCTSTR GetProcessorArchitectureDirectoryName() const;
  48. LPCTSTR GetNativeEnvironment() const;
  49. DWORD GetSpoolerVersion() const;
  50. BOOL GetInfo();
  51. BOOL GetProductInfo();
  52. private:
  53. // structure for returning registry info
  54. // see GetRegistryKeyInfo()
  55. typedef struct
  56. {
  57. DWORD NumSubKeys;
  58. DWORD MaxSubKeyLength;
  59. DWORD MaxClassLength;
  60. DWORD NumValues;
  61. DWORD MaxValueNameLength;
  62. DWORD MaxValueDataLength;
  63. DWORD SecurityDescriptorLength;
  64. FILETIME LastWriteTime;
  65. } REGISTRY_KEY_INFO;
  66. enum ProductType
  67. {
  68. kNtUnknown,
  69. kNtWorkstation,
  70. kNtServer,
  71. };
  72. //
  73. // Prevent copying and assignment.
  74. //
  75. CComputerInfo::
  76. CComputerInfo(
  77. const CComputerInfo &
  78. );
  79. CComputerInfo &
  80. CComputerInfo::
  81. operator =(
  82. const CComputerInfo &
  83. );
  84. LPTSTR
  85. AllocateRegistryString(
  86. LPCTSTR pServerName,
  87. HKEY hRegistryRoot,
  88. LPCTSTR pKeyName,
  89. LPCTSTR pValueName
  90. );
  91. BOOL
  92. GetRegistryKeyInfo(
  93. LPCTSTR pServerName,
  94. HKEY hRegistryRoot,
  95. LPCTSTR pKeyName,
  96. REGISTRY_KEY_INFO* pKeyInfo
  97. );
  98. BOOL
  99. IsInfoValid(
  100. VOID
  101. ) const;
  102. ProductType
  103. GetLocalProductInfo(
  104. VOID
  105. );
  106. ProductType
  107. GetRemoteProductInfo(
  108. VOID
  109. );
  110. TString ComputerName;
  111. OSVERSIONINFO OSInfo;
  112. BOOL OSIsDebugVersion;
  113. WORD ProcessorArchitecture;
  114. DWORD ProcessorCount;
  115. ProductType ProductOption;
  116. };
  117. #endif