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.

358 lines
13 KiB

  1. //*********************************************************************
  2. //* Microsoft Windows **
  3. //* Copyright(c) Microsoft Corp., 1999 **
  4. //*********************************************************************
  5. //
  6. // MSOBMAIN.H - Header for the implementation of CObMain
  7. //
  8. // HISTORY:
  9. //
  10. // 1/27/99 a-jaswed Created.
  11. //
  12. #ifndef _MSOBMAIN_H_
  13. #define _MSOBMAIN_H_
  14. #include <util.h>
  15. #include "licdll.h"
  16. #include "debug.h"
  17. #include "userinfo.h"
  18. #include "tapiloc.h"
  19. #include "pid.h"
  20. #include "signup.h"
  21. #include "status.h"
  22. #include "direct.h"
  23. #include "register.h"
  24. #include "api.h"
  25. #include "language.h"
  26. #include "eula.h"
  27. #include "sysclock.h"
  28. #include "appdefs.h"
  29. #include "obshel.h"
  30. #include "obcomm.h"
  31. #include "setup.h" // // BUGBUG: Temp syssetup stub declarations
  32. #include "setupkey.h"
  33. #define OOBE_STATUS_HEIGHT 12 // Percent height of the status pane
  34. #define FINISH_OK 0x00000000
  35. #define FINISH_REBOOT 0x00000001
  36. #define FINISH_BAD_PID 0x00000002
  37. #define FINISH_BAD_EULA 0x00000004
  38. #define FINISH_BAD_STAMP 0x00000008
  39. // Setup types from winlogon\setup.h
  40. #define SETUPTYPE_NONE 0
  41. #define SETUPTYPE_FULL 1
  42. #define SETUPTYPE_NOREBOOT 2
  43. #define SETUPTYPE_UPGRADE 4
  44. #define MNRMAXCREDENTIAL 128
  45. typedef UINT APIERR;
  46. typedef LPVOID HPWL;
  47. typedef HPWL* LPHPWL;
  48. typedef APIERR (WINAPI* LPFnCreatePasswordCache) (LPHPWL lphCache, const CHAR* pszUsername, const CHAR* pszPassword);
  49. typedef PVOID HDEVNOTIFY;
  50. typedef HDEVNOTIFY *PHDEVNOTIFY;
  51. #define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000
  52. #define DEVICE_NOTIFY_SERVICE_HANDLE 0x00000001
  53. #define DEVICE_NOTIFY_COMPLETION_HANDLE 0x00000002
  54. #define DBT_DEVTYP_DEVICEINTERFACE 0x00000005 // device interface class
  55. #define DBT_DEVTYP_HANDLE 0x00000006 // file system handle
  56. static const CHAR cszRegisterDeviceNotification[]
  57. = "RegisterDeviceNotificationA";
  58. static const CHAR cszUnregisterDeviceNotification[]
  59. = "UnregisterDeviceNotification";
  60. typedef HDEVNOTIFY (WINAPI * REGISTERDEVICENOTIFICATIONA) (
  61. IN HANDLE hRecipient,
  62. IN LPVOID NotificationFilter,
  63. IN DWORD Flags
  64. );
  65. typedef BOOL (WINAPI* UNREGISTERDEVICENOTIFICATION) (
  66. IN HDEVNOTIFY Handle
  67. );
  68. #define OOBE_1ND_SERVICESSTARTED L"oobe_1nd_servicesstarted"
  69. #define OOBE_2ND_CONTINUE L"oobe_2nd_continue"
  70. #define OOBE_2ND_DONE L"oobe_2nd_done"
  71. /* A5DCBF10-6530-11D2-901F-00C04FB951ED */
  72. DEFINE_GUID(GUID_CLASS_USB_DEVICE, 0xA5DCBF10L, 0x6530, 0x11D2, 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED);
  73. class CObMain : public IDispatch
  74. {
  75. public: // data
  76. IObShellMainPane* m_pObShellMainPane;
  77. IObCommunicationManager2* m_pObCommunicationManager;
  78. // License Agent
  79. ICOMLicenseAgent* m_pLicenseAgent;
  80. BOOL m_bPostToMs;
  81. CTapiLocationInfo* m_pTapiInfo;
  82. CUserInfo* m_pUserInfo;
  83. WCHAR m_szStartPage[MAX_PATH];
  84. WCHAR m_szIspUrl [MAX_PATH*4];
  85. BOOL m_fIsOEMDebugMode;
  86. BOOL m_bProcessQueuedEvents;
  87. private: // data
  88. // Ref count
  89. //
  90. ULONG m_cRef;
  91. // Instance info
  92. //
  93. HINSTANCE m_hInstance;
  94. HWND m_hwndBackground;
  95. HANDLE m_BackgroundWindowThreadHandle;
  96. // Parent window info
  97. //
  98. HWND m_hwndParent;
  99. RECT m_rectMainPane;
  100. BOOL m_bMainPaneReady;
  101. BOOL m_bStatusPaneReady;
  102. int m_iCurrentSelection;
  103. int m_iTotalItems;
  104. // System Metrics
  105. //
  106. int m_iScrWidth;
  107. int m_iScrHeight;
  108. // window.external objects
  109. //
  110. CProductID* m_pProductID;
  111. CSignup* m_pSignup;
  112. CStatus* m_pStatus;
  113. CDirections* m_pDirections;
  114. CLanguage* m_pLanguage;
  115. CEula* m_pEula;
  116. CRegister* m_pRegister;
  117. CSystemClock* m_pSysClock;
  118. CAPI* m_pAPI;
  119. CDebug* m_pDebug;
  120. // Reminder info
  121. //
  122. BOOL m_bRemindRegistered;
  123. BOOL m_bRemindISPSignuped;
  124. int m_nRmdIndx;
  125. // OOBE state info
  126. //
  127. APMD m_apmd;
  128. DWORD m_prop;
  129. BOOL m_fFinished;
  130. OOBE_SHUTDOWN_ACTION m_OobeShutdownAction;
  131. BOOL m_fRunIEOnClose;
  132. BOOL m_bDisableFontSmoothingOnExit;
  133. BOOL m_bAuditMode;
  134. // Hardware info
  135. //
  136. BOOL m_bDoCheck;
  137. DWORD m_dwHWChkResult;
  138. HDEVNOTIFY m_hDevNotify;
  139. HINSTANCE m_hInstShell32;
  140. // Network info
  141. //
  142. DWORD m_dwJoinStatus;
  143. //INI stuff
  144. WCHAR m_szStatusLogo [MAX_PATH+1];
  145. WCHAR m_szStatusLogoBg [MAX_PATH+1];
  146. HANDLE m_CompNameStartThread;
  147. // Debugging info
  148. //
  149. ATOM m_atomDebugKey;
  150. // Migrated user list
  151. PSTRINGLIST m_pMigratedUserList;
  152. int m_iMigratedUserCount;
  153. WCHAR m_szDefaultAccount[UNLEN];
  154. // 2nd instance of OOBE
  155. BOOL m_bSecondInstanceNeeded;
  156. BOOL m_bSecondInstance;
  157. HANDLE m_1ndInst_ServicesReady;
  158. HANDLE m_2ndInst_Continue;
  159. HANDLE m_2ndInst_Done;
  160. HANDLE m_2ndOOBE_hProcess;
  161. private: // methods
  162. void ShowOOBEWindow ();
  163. void InitObShellMainPane ();
  164. void DoCancelDialog ();
  165. void PlaceIEInRunonce ();
  166. void CreateDefaultUser ();
  167. void CheckForStatusPaneItems (void);
  168. bool LoadStatusItems (LPCWSTR szSectionNamePostfix);
  169. bool LoadStatusItems (BSTR bstrSectionNamePostfix);
  170. bool LoadStatusItems (UINT uiSectionNamePostfix);
  171. DWORD NeedKbdMouseChk ();
  172. DWORD GetAppLCID ();
  173. BOOL DeleteReminder (INT nType,
  174. BOOL bAll=FALSE);
  175. BOOL AddReminder (INT nType);
  176. BOOL DoRegisterDeviceInterface();
  177. BOOL UnRegisterDeviceInterface();
  178. void UpdateMuiFiles ();
  179. BOOL OnDial (UINT nConnectionType,
  180. BSTR bstrISPFile,
  181. DWORD nISPIndex,
  182. BOOL bRedial
  183. );
  184. BOOL IsViewerInstalled (BSTR bstrExt);
  185. void CreateIdentityAccounts ();
  186. BOOL CreateMigratedUserList ();
  187. void FixPasswordAttributes (LPWSTR szName, DWORD flags);
  188. BOOL RemoveDefaultAccount ();
  189. LONG GetLocalUserCount ();
  190. HRESULT CreateModemConnectoid(BSTR bstrAreaCode,
  191. BSTR bstrPhoneNumber,
  192. BOOL fAutoIPAddress,
  193. DWORD ipaddr_A,
  194. DWORD ipaddr_B,
  195. DWORD ipaddr_C,
  196. DWORD ipaddr_D,
  197. BOOL fAutoDNS,
  198. DWORD ipaddrDns_A,
  199. DWORD ipaddrDns_B,
  200. DWORD ipaddrDns_C,
  201. DWORD ipaddrDns_D,
  202. DWORD ipaddrDnsAlt_A,
  203. DWORD ipaddrDnsAlt_B,
  204. DWORD ipaddrDnsAlt_C,
  205. DWORD ipaddrDnsAlt_D,
  206. BSTR bstrUserName,
  207. BSTR bstrPassword);
  208. HRESULT CreatePppoeConnectoid(BSTR bstrServiceName,
  209. BOOL fAutoIPAddress,
  210. DWORD ipaddr_A,
  211. DWORD ipaddr_B,
  212. DWORD ipaddr_C,
  213. DWORD ipaddr_D,
  214. BOOL fAutoDNS,
  215. DWORD ipaddrDns_A,
  216. DWORD ipaddrDns_B,
  217. DWORD ipaddrDns_C,
  218. DWORD ipaddrDns_D,
  219. DWORD ipaddrDnsAlt_A,
  220. DWORD ipaddrDnsAlt_B,
  221. DWORD ipaddrDnsAlt_C,
  222. DWORD ipaddrDnsAlt_D,
  223. BSTR bstrUserName,
  224. BSTR bstrPassword
  225. );
  226. BOOL IsSetupUpgrade ();
  227. BOOL IsUpgrade ();
  228. DWORD DetermineUpgradeType ();
  229. VOID OnComputerNameChangeComplete(BOOL StartAsThread);
  230. DWORD JoinDomain (IN BSTR DomainName,
  231. IN BSTR UserAccount,
  232. IN BSTR Password,
  233. IN BOOL Flag
  234. );
  235. DWORD GetNetJoinInformation ();
  236. BOOL IsSelectVariation ();
  237. VOID Activate (IN DWORD PostToMs
  238. );
  239. BSTR GetProxySettings ();
  240. VOID AsyncInvoke (IN INT cDispid,
  241. IN const DISPID* dispids,
  242. IN LPCWSTR szReturnFunction,
  243. IN INT iTimeout
  244. );
  245. public: // methods
  246. CObMain (APMD Apmd, DWORD Prop, int RmdIndx);
  247. ~CObMain ();
  248. BOOL InitApplicationWindow ();
  249. BOOL Init ();
  250. DWORD StartRpcSs ();
  251. void Cleanup ();
  252. void CleanupForReboot (CSetupKey& setupkey);
  253. void CleanupForPowerDown (CSetupKey& setupkey);
  254. void RemoveRestartStuff (CSetupKey& setupkey);
  255. BOOL SetConnectoidInfo ();
  256. BOOL RunOOBE ();
  257. BOOL PowerDown (BOOL fRestart);
  258. OOBE_SHUTDOWN_ACTION DisplayReboot();
  259. void SetAppMode (APMD apmd) {m_apmd = apmd;}
  260. BOOL InMode (APMD apmd) {return m_apmd == apmd;}
  261. BOOL InOobeMode () {return InMode(APMD_OOBE);}
  262. BOOL InMSNMode () {return InMode(APMD_MSN);}
  263. void SetProperty (DWORD prop) {m_prop |= prop;}
  264. void ClearProperty (DWORD prop) {m_prop &= ~prop;}
  265. BOOL FHasProperty (DWORD prop) {return m_prop & prop;}
  266. BOOL FFullScreen () {return FHasProperty(PROP_FULLSCREEN);}
  267. void SetStatus (BOOL b);
  268. void SetMain (BOOL b);
  269. void DoAuditBootKeySequence ();
  270. BOOL DoAuditBoot ();
  271. BOOL OEMAuditboot ();
  272. void SetReminderIndx (int nRmdIndx) {m_nRmdIndx = nRmdIndx;}
  273. BOOL RegisterDebugHotKey ();
  274. void UnregisterDebugHotKey ();
  275. BOOL IsDebugHotKey (WORD wKeyCode) {
  276. return (wKeyCode == m_atomDebugKey);
  277. }
  278. void WaitForPnPCompletion ();
  279. void ServiceStartDone ();
  280. void Set2ndInstance(BOOL b2ndInstance) { m_bSecondInstance = b2ndInstance;
  281. return;}
  282. BOOL Is2ndInstance() { return m_bSecondInstance;}
  283. BOOL CreateBackground();
  284. void StopBackgroundWindow();
  285. BOOL OEMPassword();
  286. BOOL InAuditMode() {return m_bAuditMode;}
  287. void PlayBackgroundMusic ();
  288. void StopBackgroundMusic ();
  289. void SetComputerDescription ();
  290. HRESULT ExecScriptFn (IN LPCWSTR szScriptFn,
  291. IN VARIANT* pvarReturns,
  292. IN int cReturns
  293. );
  294. // IUnknown Interfaces
  295. STDMETHODIMP QueryInterface (REFIID riid, LPVOID* ppvObj);
  296. STDMETHODIMP_(ULONG) AddRef ();
  297. STDMETHODIMP_(ULONG) Release ();
  298. //IDispatch Interfaces
  299. STDMETHOD (GetTypeInfoCount) (UINT* pcInfo);
  300. STDMETHOD (GetTypeInfo) (UINT, LCID, ITypeInfo** );
  301. STDMETHOD (GetIDsOfNames) (REFIID, OLECHAR**, UINT, LCID, DISPID* );
  302. STDMETHOD (Invoke) (DISPID dispidMember, REFIID riid, LCID lcid,
  303. WORD wFlags, DISPPARAMS* pdispparams,
  304. VARIANT* pvarResult, EXCEPINFO* pexcepinfo,
  305. UINT* puArgErr);
  306. }; // class CObMain
  307. BOOL IsProfessionalSKU();
  308. void CleanupForLogon(CSetupKey& setupkey);
  309. void RemovePersistData();
  310. void CheckDigitalID();
  311. #endif // _MSOBMAIN_H_