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.

445 lines
14 KiB

  1. //*********************************************************************
  2. //* Microsoft Windows **
  3. //* Copyright(c) Microsoft Corp., 1999 **
  4. //*********************************************************************
  5. //
  6. // Directions.CPP - Header for the implementation of CDirections
  7. //
  8. // HISTORY:
  9. //
  10. // 1/27/99 a-jaswed Created.
  11. //
  12. #include "direct.h"
  13. #include "appdefs.h"
  14. #include "dispids.h"
  15. #include "msobmain.h"
  16. #include "resource.h"
  17. DISPATCHLIST DirectionsExternalInterface[] =
  18. {
  19. {L"get_DoMouseTutorial", DISPID_DIRECTIONS_GET_DOMOUSETUTORIAL },
  20. {L"get_DoOEMRegistration", DISPID_DIRECTIONS_GET_DOOEMREGISTRATION },
  21. {L"get_DoRegionalKeyboard", DISPID_DIRECTIONS_GET_DOREGIONALKEYBOARD },
  22. {L"get_DoOEMHardwareCheck", DISPID_DIRECTIONS_GET_DOOEMHARDWARECHECK },
  23. {L"get_DoBrowseNow", DISPID_DIRECTIONS_GET_DOBROWSENOW },
  24. {L"get_ISPSignup", DISPID_DIRECTIONS_GET_ISPSIGNUP },
  25. {L"get_Offline", DISPID_DIRECTIONS_GET_OFFLINE },
  26. {L"get_OEMOfferCode", DISPID_DIRECTIONS_GET_OFFERCODE },
  27. {L"get_AppMode", DISPID_DIRECTIONS_GET_APPMODE },
  28. {L"get_OEMCust", DISPID_DIRECTIONS_GET_OEMCUST },
  29. {L"get_DoOEMAddRegistration", DISPID_DIRECTIONS_GET_DOOEMADDREGISTRATION},
  30. {L"get_DoIMETutorial", DISPID_DIRECTIONS_GET_DOIMETUTORIAL },
  31. {L"get_DoTimeZone", DISPID_DIRECTIONS_GET_DOTIMEZONE },
  32. {L"get_TimeZoneValue", DISPID_DIRECTIONS_GET_TIMEZONEVALUE },
  33. {L"get_DoSkipAnimation", DISPID_DIRECTIONS_GET_DOSKIPANIMATION },
  34. {L"get_DoWelcomeFadeIn", DISPID_DIRECTIONS_GET_DOWELCOMEFADEIN },
  35. {L"get_IntroOnly", DISPID_DIRECTIONS_GET_INTROONLY },
  36. {L"get_AgentDisabled", DISPID_DIRECTIONS_GET_AGENTDISABLED },
  37. {L"get_ShowISPMigration", DISPID_DIRECTIONS_GET_SHOWISPMIGRATION },
  38. {L"get_DoJoinDomain", DISPID_DIRECTIONS_GET_DOJOINDOMAIN },
  39. {L"get_DoAdminPassword", DISPID_DIRECTIONS_GET_DOADMINPASSWORD }
  40. };
  41. /////////////////////////////////////////////////////////////
  42. // CDirections::CDirections
  43. CDirections::CDirections(HINSTANCE hInstance, DWORD dwAppMode)
  44. {
  45. // Init member vars
  46. m_cRef = 0;
  47. m_hInstance = hInstance;
  48. m_dwAppMode = dwAppMode;
  49. }
  50. /////////////////////////////////////////////////////////////
  51. // CDirections::~CDirections
  52. CDirections::~CDirections()
  53. {
  54. assert(m_cRef == 0);
  55. }
  56. ////////////////////////////////////////////////
  57. ////////////////////////////////////////////////
  58. //// GET / SET :: DirectionsLocale
  59. ////
  60. HRESULT CDirections::get_DoMouseTutorial(LPVARIANT pvResult)
  61. {
  62. return GetINIKeyBSTR(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OPTIONS,
  63. IDS_KEY_MOUSETUTORIAL, pvResult);
  64. }
  65. HRESULT CDirections::get_DoOEMRegistration(LPVARIANT pvResult)
  66. {
  67. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OEMREGISTRATIONPAGE,
  68. IDS_KEY_OEMREGPAGE, pvResult);
  69. }
  70. HRESULT CDirections::get_DoRegionalKeyboard(LPVARIANT pvResult)
  71. {
  72. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OPTIONS,
  73. IDS_KEY_INTL_SETTINGS, pvResult);
  74. }
  75. HRESULT CDirections::get_DoOEMHardwareCheck(LPVARIANT pvResult)
  76. {
  77. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OEMHARDWARECHECK,
  78. IDS_KEY_OEMHWCHECK, pvResult);
  79. }
  80. HRESULT CDirections::get_DoBrowseNow(LPVARIANT pvResult)
  81. {
  82. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_BROWSENOW,
  83. IDS_KEY_BROWSENOW, pvResult);
  84. }
  85. HRESULT CDirections::get_ISPSignup(LPVARIANT pvResult)
  86. {
  87. return GetINIKeyBSTR(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_SIGNUP,
  88. IDS_KEY_ISPSIGNUP, pvResult);
  89. }
  90. HRESULT CDirections::get_Offline(LPVARIANT pvResult)
  91. {
  92. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_STARTUPOPTIONS,
  93. IDS_KEY_OFFLINE, pvResult);
  94. }
  95. HRESULT CDirections::get_OEMOfferCode(LPVARIANT pvResult)
  96. {
  97. return GetINIKeyBSTR(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_SIGNUP,
  98. IDS_KEY_OEMOFFERCODE, pvResult);
  99. }
  100. HRESULT CDirections::get_OEMCust(LPVARIANT pvResult)
  101. {
  102. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OPTIONS,
  103. IDS_KEY_OEMCUST, pvResult);
  104. }
  105. HRESULT CDirections::get_DoOEMAddRegistration(LPVARIANT pvResult)
  106. {
  107. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OEMREGISTRATIONPAGE,
  108. IDS_KEY_OEMADDREGPAGE, pvResult);
  109. }
  110. HRESULT CDirections::get_DoTimeZone(LPVARIANT pvResult)
  111. {
  112. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OPTIONS,
  113. IDS_KEY_TIMEZONE, pvResult);
  114. }
  115. HRESULT CDirections::get_TimeZoneValue(LPVARIANT pvResult)
  116. {
  117. return GetINIKeyBSTR(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OPTIONS,
  118. IDS_KEY_TIMEZONEVAL, pvResult);
  119. }
  120. HRESULT CDirections::get_DoIMETutorial(LPVARIANT pvResult)
  121. {
  122. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OPTIONS,
  123. IDS_KEY_IMETUTORIAL, pvResult);
  124. }
  125. HRESULT CDirections::get_DoSkipAnimation(LPVARIANT pvResult)
  126. {
  127. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_STARTUPOPTIONS,
  128. IDS_SKIPANIMATION, pvResult);
  129. }
  130. HRESULT CDirections::get_DoWelcomeFadeIn(LPVARIANT pvResult)
  131. {
  132. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_STARTUPOPTIONS,
  133. IDS_DOWELCOMEFADEIN, pvResult);
  134. }
  135. HRESULT CDirections::get_IntroOnly(LPVARIANT pvResult)
  136. {
  137. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OPTIONS,
  138. IDS_INTROONLY, pvResult);
  139. }
  140. HRESULT CDirections::get_AgentDisabled(LPVARIANT pvResult)
  141. {
  142. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OPTIONS,
  143. IDS_AGENTDISABLED, pvResult);
  144. }
  145. HRESULT CDirections::get_ShowISPMigration(LPVARIANT pvResult)
  146. {
  147. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_SIGNUP,
  148. IDS_KEY_SHOWISPMIGRATION, pvResult);
  149. }
  150. HRESULT CDirections::get_DoJoinDomain(LPVARIANT pvResult)
  151. {
  152. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OPTIONS,
  153. IDS_KEY_JOINDOMAIN, pvResult);
  154. }
  155. HRESULT CDirections::get_DoAdminPassword(LPVARIANT pvResult)
  156. {
  157. return GetINIKeyUINT(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_OPTIONS,
  158. IDS_KEY_ADMINPASSWORD, pvResult);
  159. }
  160. /////////////////////////////////////////////////////////////
  161. /////////////////////////////////////////////////////////////
  162. /////////////////////////////////////////////////////////////
  163. /////// IUnknown implementation
  164. ///////
  165. ///////
  166. /////////////////////////////////////////////////////////////
  167. // CDirections::QueryInterface
  168. STDMETHODIMP CDirections::QueryInterface(REFIID riid, LPVOID* ppvObj)
  169. {
  170. // must set out pointer parameters to NULL
  171. *ppvObj = NULL;
  172. if ( riid == IID_IUnknown)
  173. {
  174. AddRef();
  175. *ppvObj = (IUnknown*)this;
  176. return ResultFromScode(S_OK);
  177. }
  178. if (riid == IID_IDispatch)
  179. {
  180. AddRef();
  181. *ppvObj = (IDispatch*)this;
  182. return ResultFromScode(S_OK);
  183. }
  184. // Not a supported interface
  185. return ResultFromScode(E_NOINTERFACE);
  186. }
  187. /////////////////////////////////////////////////////////////
  188. // CDirections::AddRef
  189. STDMETHODIMP_(ULONG) CDirections::AddRef()
  190. {
  191. return ++m_cRef;
  192. }
  193. /////////////////////////////////////////////////////////////
  194. // CDirections::Release
  195. STDMETHODIMP_(ULONG) CDirections::Release()
  196. {
  197. return --m_cRef;
  198. }
  199. /////////////////////////////////////////////////////////////
  200. /////////////////////////////////////////////////////////////
  201. /////////////////////////////////////////////////////////////
  202. /////// IDispatch implementation
  203. ///////
  204. ///////
  205. /////////////////////////////////////////////////////////////
  206. // CDirections::GetTypeInfo
  207. STDMETHODIMP CDirections::GetTypeInfo(UINT, LCID, ITypeInfo**)
  208. {
  209. return E_NOTIMPL;
  210. }
  211. /////////////////////////////////////////////////////////////
  212. // CDirections::GetTypeInfoCount
  213. STDMETHODIMP CDirections::GetTypeInfoCount(UINT* pcInfo)
  214. {
  215. return E_NOTIMPL;
  216. }
  217. /////////////////////////////////////////////////////////////
  218. // CDirections::GetIDsOfNames
  219. STDMETHODIMP CDirections::GetIDsOfNames(REFIID riid,
  220. OLECHAR** rgszNames,
  221. UINT cNames,
  222. LCID lcid,
  223. DISPID* rgDispId)
  224. {
  225. HRESULT hr = DISP_E_UNKNOWNNAME;
  226. rgDispId[0] = DISPID_UNKNOWN;
  227. for (int iX = 0; iX < sizeof(DirectionsExternalInterface)/sizeof(DISPATCHLIST); iX ++)
  228. {
  229. if(lstrcmp(DirectionsExternalInterface[iX].szName, rgszNames[0]) == 0)
  230. {
  231. rgDispId[0] = DirectionsExternalInterface[iX].dwDispID;
  232. hr = NOERROR;
  233. break;
  234. }
  235. }
  236. // Set the disid's for the parameters
  237. if (cNames > 1)
  238. {
  239. // Set a DISPID for function parameters
  240. for (UINT i = 1; i < cNames ; i++)
  241. rgDispId[i] = DISPID_UNKNOWN;
  242. }
  243. return hr;
  244. }
  245. /////////////////////////////////////////////////////////////
  246. // CDirections::Invoke
  247. HRESULT CDirections::Invoke
  248. (
  249. DISPID dispidMember,
  250. REFIID riid,
  251. LCID lcid,
  252. WORD wFlags,
  253. DISPPARAMS* pdispparams,
  254. VARIANT* pvarResult,
  255. EXCEPINFO* pexcepinfo,
  256. UINT* puArgErr
  257. )
  258. {
  259. HRESULT hr = S_OK;
  260. switch(dispidMember)
  261. {
  262. case DISPID_DIRECTIONS_GET_AGENTDISABLED:
  263. TRACE(L"DISPID_DIRECTIONS_GET_AGENTDISABLED\n");
  264. if (NULL != pvarResult)
  265. get_AgentDisabled(pvarResult);
  266. break;
  267. case DISPID_DIRECTIONS_GET_DOMOUSETUTORIAL:
  268. TRACE(L"DISPID_DIRECTIONS_GET_DOMOUSETUTORIAL\n");
  269. if (NULL != pvarResult)
  270. get_DoMouseTutorial(pvarResult);
  271. break;
  272. case DISPID_DIRECTIONS_GET_DOTIMEZONE:
  273. TRACE(L"DISPID_DIRECTIONS_GET_DOTIMEZONE\n");
  274. if (NULL != pvarResult)
  275. get_DoTimeZone(pvarResult);
  276. break;
  277. case DISPID_DIRECTIONS_GET_DOIMETUTORIAL:
  278. TRACE(L"DISPID_DIRECTIONS_GET_DOIMETUTORIAL\n");
  279. if (NULL != pvarResult)
  280. get_DoIMETutorial(pvarResult);
  281. break;
  282. case DISPID_DIRECTIONS_GET_TIMEZONEVALUE:
  283. TRACE(L"DISPID_DIRECTIONS_GET_TIMEZONEVALUE\n");
  284. if (NULL != pvarResult)
  285. get_TimeZoneValue(pvarResult);
  286. break;
  287. case DISPID_DIRECTIONS_GET_DOOEMREGISTRATION:
  288. TRACE(L"DISPID_DIRECTIONS_GET_DOOEMREGISTRATION\n");
  289. if (NULL != pvarResult)
  290. get_DoOEMRegistration(pvarResult);
  291. break;
  292. case DISPID_DIRECTIONS_GET_DOREGIONALKEYBOARD:
  293. TRACE(L"DISPID_DIRECTIONS_GET_DOREGIONALKEYBOARD\n");
  294. if (NULL != pvarResult)
  295. get_DoRegionalKeyboard(pvarResult);
  296. break;
  297. case DISPID_DIRECTIONS_GET_DOOEMHARDWARECHECK:
  298. TRACE(L"DISPID_DIRECTIONS_GET_DOOEMHARDWARECHECK\n");
  299. if (NULL != pvarResult)
  300. get_DoOEMHardwareCheck(pvarResult);
  301. break;
  302. case DISPID_DIRECTIONS_GET_DOBROWSENOW:
  303. TRACE(L"DISPID_DIRECTIONS_GET_DOBROWSENOW\n");
  304. if (NULL != pvarResult)
  305. get_DoBrowseNow(pvarResult);
  306. break;
  307. case DISPID_DIRECTIONS_GET_DOSKIPANIMATION:
  308. TRACE(L"DISPID_DIRECTIONS_GET_DOSKIPANIMATION\n");
  309. if (NULL != pvarResult)
  310. get_DoSkipAnimation(pvarResult);
  311. break;
  312. case DISPID_DIRECTIONS_GET_DOWELCOMEFADEIN:
  313. TRACE(L"DISPID_DIRECTIONS_GET_DOWELCOMEFADEIN\n");
  314. if (NULL != pvarResult)
  315. get_DoWelcomeFadeIn(pvarResult);
  316. break;
  317. case DISPID_DIRECTIONS_GET_INTROONLY:
  318. TRACE(L"DISPID_DIRECTIONS_GET_INTROONLY\n");
  319. if (NULL != pvarResult)
  320. get_IntroOnly(pvarResult);
  321. break;
  322. case DISPID_DIRECTIONS_GET_ISPSIGNUP:
  323. TRACE(L"DISPID_DIRECTIONS_GET_ISPSIGNUP\n");
  324. if (NULL != pvarResult)
  325. get_ISPSignup(pvarResult);
  326. break;
  327. case DISPID_DIRECTIONS_GET_OFFLINE:
  328. TRACE(L"DISPID_DIRECTIONS_GET_OFFLINE\n");
  329. if (NULL != pvarResult)
  330. get_Offline(pvarResult);
  331. break;
  332. case DISPID_DIRECTIONS_GET_OFFERCODE:
  333. TRACE(L"DISPID_DIRECTIONS_GET_OFFERCODE\n");
  334. if (NULL != pvarResult)
  335. get_OEMOfferCode(pvarResult);
  336. break;
  337. case DISPID_DIRECTIONS_GET_OEMCUST:
  338. TRACE(L"DISPID_DIRECTIONS_GET_OEMCUST\n");
  339. if (NULL != pvarResult)
  340. get_OEMCust(pvarResult);
  341. break;
  342. case DISPID_DIRECTIONS_GET_DOOEMADDREGISTRATION:
  343. TRACE(L"DISPID_DIRECTIONS_GET_DOOEMADDREGISTRATION\n");
  344. if (NULL != pvarResult)
  345. get_DoOEMAddRegistration(pvarResult);
  346. break;
  347. case DISPID_DIRECTIONS_GET_APPMODE:
  348. TRACE(L"DISPID_DIRECTIONS_GET_APPMODE\n");
  349. if (NULL != pvarResult)
  350. {
  351. VariantInit(pvarResult);
  352. V_VT(pvarResult) = VT_I4;
  353. V_I4(pvarResult) = m_dwAppMode;
  354. hr = S_OK;
  355. }
  356. break;
  357. case DISPID_DIRECTIONS_GET_SHOWISPMIGRATION:
  358. TRACE(L"DISPID_DIRECTIONS_GET_SHOWISPMIGRATION\n");
  359. if (NULL != pvarResult)
  360. {
  361. get_ShowISPMigration(pvarResult);
  362. }
  363. break;
  364. case DISPID_DIRECTIONS_GET_DOJOINDOMAIN:
  365. TRACE(L"DISPID_DIRECTIONS_GET_DOJOINDOMAIN");
  366. if (NULL != pvarResult)
  367. get_DoJoinDomain(pvarResult);
  368. break;
  369. case DISPID_DIRECTIONS_GET_DOADMINPASSWORD:
  370. TRACE(L"DISPID_DIRECTIONS_GET_DOADMINPASSWORD");
  371. if (NULL != pvarResult)
  372. get_DoAdminPassword(pvarResult);
  373. break;
  374. default:
  375. hr = DISP_E_MEMBERNOTFOUND;
  376. break;
  377. }
  378. return hr;
  379. }