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.

226 lines
5.8 KiB

  1. /*********************************************************************
  2. Registration Wizard
  3. CRegWiz.h
  4. 11/3/94 - Tracy Ferrier
  5. (c) 1994-95 Microsoft Corporation
  6. **********************************************************************/
  7. #ifndef __CRegWizard__
  8. #define __CRegWizard__
  9. #include <tchar.h>
  10. const kMaxProductCount = 12;
  11. const kSystemInventoryItemCount = 13;
  12. const kMaxCountryCount = 250;
  13. typedef enum
  14. {
  15. kInfoFirstName = 0,
  16. kInfoLastName,
  17. kInfoCompany,
  18. kInfoMailingAddress,
  19. kInfoAdditionalAddress,
  20. kInfoCity,
  21. kInfoState,
  22. kInfoZip,
  23. kInfoCountry,
  24. kInfoPhoneNumber,
  25. kInfoDeclinesNonMSProducts,
  26. kInfoProductID,
  27. kInfoProcessor,
  28. kInfoMathCoProcessor,
  29. kInfoTotalRAM,
  30. kInfoTotalDiskSpace,
  31. kInfoRemoveableMedia,
  32. kInfoDisplayResolution,
  33. kInfoDisplayColorDepth,
  34. kInfoPointingDevice,
  35. kInfoNetwork,
  36. kInfoModem,
  37. kInfoSoundCard,
  38. kInfoCDROM,
  39. kInfoOperatingSystem,
  40. kInfoIncludeSystem,
  41. kInfoIncludeProducts,
  42. kInfoApplicationName,
  43. kInfoOEM,
  44. kInfoVersion,
  45. kInfoMakerCompany,
  46. kInfoResultPath,
  47. kInfoDate,
  48. kInfoLanguage,
  49. kInfoEmailName,
  50. kInfoResellerName,
  51. kInfoResellerCity,
  52. kInfoResellerState,
  53. kInfoHWID,
  54. kInfoMSID,
  55. kInfoPhoneExt,
  56. kDivisionName, // Division name and User Id is added for FE 3/3/98
  57. kUserId,
  58. kAreaCode,
  59. kHomeSwKnow,
  60. kHomeExcited,
  61. kHomePcSwKnow,
  62. kBusinessRole,
  63. kScsiAdapterInfo, // System Inventory
  64. kComputerManufacturer, // Sysinv Dlg , entry
  65. kMiddleName,
  66. kInfoLastIndex
  67. }InfoIndex;
  68. #define kFirstSystemIndex kInfoProcessor
  69. #define kLastSystemIndex kInfoOperatingSystem
  70. typedef enum
  71. {
  72. kTriStateFalse,
  73. kTriStateTrue,
  74. kTriStateUndefined
  75. }TriState;
  76. // Typedefs for JumpTableElement; kMaxAddrSpecTableSize can be
  77. // no larger than the largest value representable by JTE
  78. typedef _TUCHAR JTE;
  79. #define kMaxAddrSpecTableSize 255
  80. #define kMaxLenSize 127
  81. #define kAddrSpecCount 19
  82. //typedef _TSCHAR MAXLEN;
  83. typedef char MAXLEN;
  84. typedef struct
  85. {
  86. MAXLEN maxLen[kAddrSpecCount];
  87. }ADDRSPEC,*PADDRSPEC;
  88. typedef enum
  89. {
  90. kAddrSpecFirstName = 0,
  91. kAddrSpecLastName,
  92. kAddrSpecCompanyName,
  93. kAddrSpecAddress,
  94. kAddrSpecAddress2,
  95. kAddrSpecCity,
  96. kAddrSpecState,
  97. kAddrSpecPostalCode,
  98. kAddrSpecPhone,
  99. kAddrSpecEmailName,
  100. kAddrSpecResellerName,
  101. kAddrSpecResellerCity,
  102. kAddrSpecResellerState,
  103. kAddrSpecExtension,
  104. kAddrSpecDivision,
  105. kAddrSpecAreaCode,
  106. kAddrSpecUserId,
  107. kSIComputerManufacturer,
  108. kAddrMiddleName
  109. }ADDRSPEC_FIELD;
  110. class CRegWizard
  111. {
  112. public:
  113. CRegWizard(HINSTANCE hInstance, LPTSTR szParamRegKey);
  114. virtual ~CRegWizard();
  115. void StartRegWizardDialog(int wDlgResID, DLGPROC lpDialogProc);
  116. void ActivateRegWizardDialog( void );
  117. INT_PTR ProcessRegWizardDialog( void );
  118. void EndRegWizardDialog(INT_PTR wExitID);
  119. BOOL IsDialogActive( void );
  120. void SetWindowCaption(LPTSTR lpszWindowsCaption);
  121. LPTSTR GetWindowCaption();
  122. INT_PTR GetDialogExitButton( void );
  123. BOOL GetInputParameterStatus( void );
  124. BOOL GetInputParameterString(short paramID, LPTSTR szParam);
  125. BOOL IsRegistered( void );
  126. int AddProduct(LPTSTR szProductName,LPTSTR szProductPath);
  127. void SetInformationString(InfoIndex index, LPTSTR szInfo);
  128. BOOL GetInformationString(InfoIndex index, LPTSTR szInfo);
  129. void SetTriStateInformation(InfoIndex index, TriState infoValue);
  130. TriState GetTriStateInformation(InfoIndex index);
  131. void WriteEnableInformation(InfoIndex index, BOOL shouldWrite);
  132. BOOL IsInformationWriteEnabled(InfoIndex index);
  133. TriState GetProductSearchLibraryStatus( void );
  134. BOOL GetProductSearchProcAddress(FARPROC* lpfnProductSearch);
  135. void SetProductSearchStatus(TriState searchCompleted);
  136. TriState GetProductSearchStatus( void );
  137. void SetSystemInventoryStatus(BOOL invCompleted);
  138. BOOL GetSystemInventoryStatus( void );
  139. void GetProductName(LPTSTR szProductName,INT_PTR index);
  140. HICON GetProductIcon(INT_PTR index);
  141. short GetProductCount( void );
  142. void WriteInfoToRegistry( void );
  143. BOOL GetInfoRegValueName(InfoIndex infoIndex,LPTSTR szValueName);
  144. void GetInfoRegistrationParentKey(LPTSTR szRegKey);
  145. HINSTANCE GetInstance( void );
  146. void SetCountryCode(DWORD countryCode);
  147. DWORD GetCountryCode( void );
  148. void GetCountryAddrSpec(LONG lCountryID,ADDRSPEC* addrSpec );
  149. void GetAddrSpecProperties(DWORD dwCountryCode, ADDRSPEC_FIELD addrSpecField, MAXLEN* maxLen,BOOL* isRequired);
  150. void ConfigureEditTextField(HWND hwndDlg,int editFieldID,ADDRSPEC_FIELD addrSpecField,int iAttachedStrID);
  151. void SetLogFileName(LPTSTR lpszLogFilePath);
  152. void DestroyOpenedWindow()
  153. {
  154. if (m_hwndCurrDialog)
  155. {
  156. DestroyWindow(m_hwndCurrDialog);
  157. m_hwndCurrDialog = NULL;
  158. }
  159. }
  160. void GetRegKey(LPTSTR szRegKey);
  161. HWND GetCurrDialog(void );
  162. void SetDialogHide(HWND hDialogToHide);
  163. BOOL ShowPrevDialog(void);
  164. void SetPrevDialog(void);
  165. void SetDialogExitButton( int nButton );
  166. static BOOL IsEditTextFieldValid(HWND hwndDlg,int editID);
  167. static void GetEditTextFieldAttachedString(HWND hwndDlg,int editID,LPTSTR szAttached,int cbBufferSize);
  168. void ResolveCurrentCountryCode( void );
  169. BOOL GetMSIDfromCookie(LPTSTR);
  170. _TCHAR m_szParamRegKey[256];
  171. private:
  172. void BuildAddrSpecTables( void );
  173. void ReadInfoFromRegistry( void );
  174. void CreateLogFile( void );
  175. void WriteToLogFile(LPTSTR lpszLine);
  176. void CloseLogFile( void );
  177. HINSTANCE m_hInstance;
  178. HACCEL m_hAccel;
  179. LPTSTR m_rgszProductName[kMaxProductCount];
  180. LPTSTR m_rgszProductPath[kMaxProductCount];
  181. HICON m_rghProductIcon[kMaxProductCount];
  182. LPTSTR m_rgszInfoArray[kInfoLastIndex];
  183. BOOL m_writeEnable[kInfoLastIndex];
  184. short m_productNameCount;
  185. TriState m_searchCompleted;
  186. BOOL m_systemInventoryCompleted;
  187. _TCHAR m_szWindowsCaption[256];
  188. _TCHAR m_szInfoParentKey[256];
  189. _TCHAR m_szLogFilePath[_MAX_PATH];
  190. FARPROC m_lpfnProductSearch;
  191. DWORD m_countryCode;
  192. HANDLE m_addrJumpTable;
  193. HANDLE m_addrSpecTable;
  194. HANDLE m_hLogFile;
  195. BOOL m_dialogActive;
  196. HWND m_hwndStartDialog;
  197. HWND m_hwndCurrDialog;
  198. INT_PTR m_wDialogExitButton;
  199. HWND m_hwndDialogToHide;
  200. HWND m_hwndPrevDialog;
  201. HINSTANCE m_ccpLibrary;
  202. };
  203. #endif