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.

154 lines
3.2 KiB

  1. // Copyright (c) 1997-2001 Microsoft Corporation
  2. //
  3. // File: state.h
  4. //
  5. // Synopsis: Declares the state object that is global
  6. // to CYS. It holds the network and OS/SKU info
  7. //
  8. // History: 02/02/2001 JeffJon Created
  9. #ifndef __CYS_STATE_H
  10. #define __CYS_STATE_H
  11. #include "NetworkAdapterConfig.h"
  12. #define CYS_DATACENTER_SERVER 0x00000001
  13. #define CYS_ADVANCED_SERVER 0x00000002
  14. #define CYS_SERVER 0x00000004
  15. #define CYS_PERSONAL 0x00000008
  16. #define CYS_PROFESSIONAL 0x00000010
  17. #define CYS_64BIT 0x80000000
  18. #define CYS_32BIT 0x40000000
  19. #define CYS_ALL_SERVER_SKUS (CYS_DATACENTER_SERVER | \
  20. CYS_ADVANCED_SERVER | \
  21. CYS_SERVER | \
  22. CYS_64BIT | \
  23. CYS_32BIT)
  24. #define CYS_ALL_SKUS_NO_64BIT (CYS_DATACENTER_SERVER | \
  25. CYS_ADVANCED_SERVER | \
  26. CYS_SERVER | \
  27. CYS_32BIT)
  28. class State
  29. {
  30. public:
  31. // Called from WinMain to delete the global instance of the state object
  32. static
  33. void
  34. Destroy();
  35. // Retrieves a reference to the global instance of the state object
  36. static
  37. State&
  38. GetInstance();
  39. // Does the work to determine the state of the machine
  40. bool
  41. RetrieveMachineConfigurationInformation(HWND hwndParent);
  42. // Data accessors
  43. int
  44. GetNICCount() const;
  45. NetworkInterface
  46. GetNIC(unsigned int nicIndex);
  47. bool
  48. IsDC() const;
  49. bool
  50. IsDCPromoRunning() const;
  51. bool
  52. IsDCPromoPendingReboot() const;
  53. bool
  54. IsUpgradeState() const;
  55. bool
  56. IsFirstDC() const;
  57. bool
  58. IsDHCPServerAvailable() const { return dhcpServerAvailable; }
  59. bool
  60. HasStateBeenRetrieved() const { return hasStateBeenRetrieved; }
  61. bool
  62. RerunWizard() const { return rerunWizard; }
  63. void
  64. SetRerunWizard(bool rerun);
  65. DWORD
  66. GetProductSKU() const { return productSKU; }
  67. DWORD
  68. GetPlatform() const { return platform; }
  69. bool
  70. HasNTFSDrive() const;
  71. bool
  72. SetHomeRegkey(const String& newKeyValue);
  73. bool
  74. GetHomeRegkey(String& newKeyValue) const;
  75. String
  76. GetComputerName();
  77. private:
  78. // Determines if there is a DHCP server on the network
  79. void
  80. CheckDhcpServer();
  81. HRESULT
  82. RetrieveNICInformation();
  83. void
  84. RetrieveProductSKU();
  85. void
  86. RetrievePlatform();
  87. void
  88. RetrieveDriveInformation();
  89. bool hasStateBeenRetrieved;
  90. bool dhcpAvailabilityRetrieved;
  91. bool dhcpServerAvailable;
  92. bool rerunWizard;
  93. bool hasNTFSDrive;
  94. DWORD productSKU;
  95. DWORD platform;
  96. String computerName;
  97. NetworkAdapterConfig adapterConfiguration;
  98. // Constructor
  99. State();
  100. // not defined: no copying allowed
  101. State(const State&);
  102. const State& operator=(const State&);
  103. };
  104. #endif // __CYS_STATE_H