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.

234 lines
4.1 KiB

  1. #if defined(FE_SB) && defined(_X86_)
  2. #if !defined(_MACHINE_DEFN_)
  3. #define _MACHINE_DEFN_
  4. #if defined( _AUTOCHECK_ )
  5. extern "C" {
  6. #include "ntdef.h"
  7. // #include "machine.h"
  8. #ifndef _MACHINE_ID_
  9. #define _MACHINE_ID_
  10. //
  11. // These definition is only for Intel platform.
  12. //
  13. //
  14. // Hardware platform ID
  15. //
  16. #define PC_AT_COMPATIBLE 0x00000000
  17. #define PC_9800_COMPATIBLE 0x00000001
  18. #define FMR_COMPATIBLE 0x00000002
  19. //
  20. // NT Vendor ID
  21. //
  22. #define NT_MICROSOFT 0x00010000
  23. #define NT_NEC 0x00020000
  24. #define NT_FUJITSU 0x00040000
  25. //
  26. // Vendor/Machine IDs
  27. //
  28. // DWORD MachineID
  29. //
  30. // 31 15 0
  31. // +-------------+-------------+
  32. // | Vendor ID | Platform ID |
  33. // +-------------+-------------+
  34. //
  35. #define MACHINEID_MS_PCAT (NT_MICROSOFT|PC_AT_COMPATIBLE)
  36. #define MACHINEID_MS_PC98 (NT_MICROSOFT|PC_9800_COMPATIBLE)
  37. #define MACHINEID_NEC_PC98 (NT_NEC |PC_9800_COMPATIBLE)
  38. #define MACHINEID_FUJITSU_FMR (NT_FUJITSU |FMR_COMPATIBLE)
  39. //
  40. // Build 683 compatibility.
  41. //
  42. // !!! should be removed.
  43. #define MACHINEID_MICROSOFT MACHINEID_MS_PCAT
  44. //
  45. // Macros
  46. //
  47. #define ISNECPC98(x) (x == MACHINEID_NEC_PC98)
  48. #define ISFUJITSUFMR(x) (x == MACHINEID_FUJITSU_FMR)
  49. #define ISMICROSOFT(x) (x == MACHINEID_MS_PCAT)
  50. //
  51. // Functions.
  52. //
  53. //
  54. // User mode ( NT API )
  55. //
  56. LONG
  57. NtGetMachineIdentifierValue(
  58. IN OUT PULONG Value
  59. );
  60. //
  61. // User mode ( Win32 API )
  62. //
  63. LONG
  64. RegGetMachineIdentifierValue(
  65. IN OUT PULONG Value
  66. );
  67. #endif // _MACHINE_ID_
  68. }
  69. extern "C"
  70. InitializeMachineId(
  71. VOID
  72. );
  73. extern ULONG _dwMachineId;
  74. #define InitializeMachineData() InitializeMachineId();
  75. #define IsFMR_N() ( ISFUJITSUFMR( _dwMachineId ) )
  76. #define IsPC98_N() ( ISNECPC98( _dwMachineId ) )
  77. #define IsPCAT_N() ( ISMICROSOFT( _dwMachineId ) )
  78. #else // _AUTOCHECK_
  79. DECLARE_CLASS( MACHINE );
  80. extern "C" {
  81. // #include "machine.h"
  82. #ifndef _MACHINE_ID_
  83. #define _MACHINE_ID_
  84. //
  85. // These definition is only for Intel platform.
  86. //
  87. //
  88. // Hardware platform ID
  89. //
  90. #define PC_AT_COMPATIBLE 0x00000000
  91. #define PC_9800_COMPATIBLE 0x00000001
  92. #define FMR_COMPATIBLE 0x00000002
  93. //
  94. // NT Vendor ID
  95. //
  96. #define NT_MICROSOFT 0x00010000
  97. #define NT_NEC 0x00020000
  98. #define NT_FUJITSU 0x00040000
  99. //
  100. // Vendor/Machine IDs
  101. //
  102. // DWORD MachineID
  103. //
  104. // 31 15 0
  105. // +-------------+-------------+
  106. // | Vendor ID | Platform ID |
  107. // +-------------+-------------+
  108. //
  109. #define MACHINEID_MS_PCAT (NT_MICROSOFT|PC_AT_COMPATIBLE)
  110. #define MACHINEID_MS_PC98 (NT_MICROSOFT|PC_9800_COMPATIBLE)
  111. #define MACHINEID_NEC_PC98 (NT_NEC |PC_9800_COMPATIBLE)
  112. #define MACHINEID_FUJITSU_FMR (NT_FUJITSU |FMR_COMPATIBLE)
  113. //
  114. // Build 683 compatibility.
  115. //
  116. // !!! should be removed.
  117. #define MACHINEID_MICROSOFT MACHINEID_MS_PCAT
  118. //
  119. // Macros
  120. //
  121. #define ISNECPC98(x) (x == MACHINEID_NEC_PC98)
  122. #define ISFUJITSUFMR(x) (x == MACHINEID_FUJITSU_FMR)
  123. #define ISMICROSOFT(x) (x == MACHINEID_MS_PCAT)
  124. //
  125. // Functions.
  126. //
  127. //
  128. // User mode ( NT API )
  129. //
  130. LONG
  131. NtGetMachineIdentifierValue(
  132. IN OUT PULONG Value
  133. );
  134. //
  135. // User mode ( Win32 API )
  136. //
  137. LONG
  138. RegGetMachineIdentifierValue(
  139. IN OUT PULONG Value
  140. );
  141. #endif // _MACHINE_ID_
  142. }
  143. class MACHINE : public OBJECT {
  144. public:
  145. ULIB_EXPORT
  146. DECLARE_CONSTRUCTOR( MACHINE );
  147. NONVIRTUAL
  148. ULIB_EXPORT
  149. BOOLEAN
  150. Initialize( VOID );
  151. NONVIRTUAL
  152. ULIB_EXPORT
  153. BOOLEAN
  154. IsFMR( VOID );
  155. NONVIRTUAL
  156. ULIB_EXPORT
  157. BOOLEAN
  158. IsPC98( VOID );
  159. NONVIRTUAL
  160. ULIB_EXPORT
  161. BOOLEAN
  162. IsPCAT( VOID );
  163. private:
  164. STATIC DWORD _dwMachineId;
  165. };
  166. extern ULIB_EXPORT MACHINE MachinePlatform;
  167. #define InitializeMachineData() MachinePlatform.Initialize()
  168. #define IsFMR_N() MachinePlatform.IsFMR()
  169. #define IsPC98_N() MachinePlatform.IsPC98()
  170. #define IsPCAT_N() MachinePlatform.IsPCAT()
  171. #endif // defiend(_AUTOCHECK_)
  172. #endif // _MACHINE_DEFN_
  173. #endif // defined(FE_SB) && defiend(_X86_)