Leaked source code of windows server 2003
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.

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