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.

257 lines
6.5 KiB

  1. //*********************************************************************
  2. //* Microsoft Windows **
  3. //* Copyright(c) Microsoft Corp., 1999 **
  4. //*********************************************************************
  5. //
  6. // SIGNUP.CPP - Header for the implementation of CSignup
  7. //
  8. // HISTORY:
  9. //
  10. // 1/27/99 a-jaswed Created.
  11. //
  12. #include "signup.h"
  13. #include "appdefs.h"
  14. #include "dispids.h"
  15. #include "msobmain.h"
  16. #include "resource.h"
  17. DISPATCHLIST SignupExternalInterface[] =
  18. {
  19. {L"get_Locale", DISPID_SIGNUP_GET_LOCALE },
  20. {L"get_IDLocale", DISPID_SIGNUP_GET_IDLOCALE },
  21. {L"get_Text1", DISPID_SIGNUP_GET_TEXT1 },
  22. {L"get_Text2", DISPID_SIGNUP_GET_TEXT2 },
  23. {L"get_OEMName", DISPID_SIGNUP_GET_OEMNAME },
  24. };
  25. /////////////////////////////////////////////////////////////
  26. // CSignup::CSignup
  27. CSignup::CSignup(HINSTANCE hInstance)
  28. {
  29. // Init member vars
  30. m_cRef = 0;
  31. m_hInstance = hInstance;
  32. }
  33. /////////////////////////////////////////////////////////////
  34. // CSignup::~CSignup
  35. CSignup::~CSignup()
  36. {
  37. assert(m_cRef == 0);
  38. }
  39. ////////////////////////////////////////////////
  40. ////////////////////////////////////////////////
  41. //// GET / SET :: SignupLocale
  42. ////
  43. HRESULT CSignup::get_Locale(LPVARIANT pvResult)
  44. {
  45. return GetINIKeyBSTR(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_SIGNUP,
  46. IDS_KEY_LOCALE, pvResult);
  47. }
  48. HRESULT CSignup::get_IDLocale(LPVARIANT pvResult)
  49. {
  50. return GetINIKeyBSTR(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_SIGNUP,
  51. IDS_KEY_IDLOCALE, pvResult);
  52. }
  53. HRESULT CSignup::get_Text1(LPVARIANT pvResult)
  54. {
  55. return GetINIKeyBSTR(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_SIGNUP,
  56. IDS_KEY_TEXT1, pvResult);
  57. }
  58. HRESULT CSignup::get_Text2(LPVARIANT pvResult)
  59. {
  60. return GetINIKeyBSTR(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_SIGNUP,
  61. IDS_KEY_TEXT2, pvResult);
  62. }
  63. HRESULT CSignup::get_OEMName(LPVARIANT pvResult)
  64. {
  65. return GetINIKeyBSTR(m_hInstance, INI_SETTINGS_FILENAME, IDS_SECTION_BRANDING,
  66. IDS_KEY_OEMNAME, pvResult);
  67. }
  68. /////////////////////////////////////////////////////////////
  69. /////////////////////////////////////////////////////////////
  70. /////////////////////////////////////////////////////////////
  71. /////// IUnknown implementation
  72. ///////
  73. ///////
  74. /////////////////////////////////////////////////////////////
  75. // CSignup::QueryInterface
  76. STDMETHODIMP CSignup::QueryInterface(REFIID riid, LPVOID* ppvObj)
  77. {
  78. // must set out pointer parameters to NULL
  79. *ppvObj = NULL;
  80. if ( riid == IID_IUnknown)
  81. {
  82. AddRef();
  83. *ppvObj = (IUnknown*)this;
  84. return ResultFromScode(S_OK);
  85. }
  86. if (riid == IID_IDispatch)
  87. {
  88. AddRef();
  89. *ppvObj = (IDispatch*)this;
  90. return ResultFromScode(S_OK);
  91. }
  92. // Not a supported interface
  93. return ResultFromScode(E_NOINTERFACE);
  94. }
  95. /////////////////////////////////////////////////////////////
  96. // CSignup::AddRef
  97. STDMETHODIMP_(ULONG) CSignup::AddRef()
  98. {
  99. return ++m_cRef;
  100. }
  101. /////////////////////////////////////////////////////////////
  102. // CSignup::Release
  103. STDMETHODIMP_(ULONG) CSignup::Release()
  104. {
  105. return --m_cRef;
  106. }
  107. /////////////////////////////////////////////////////////////
  108. /////////////////////////////////////////////////////////////
  109. /////////////////////////////////////////////////////////////
  110. /////// IDispatch implementation
  111. ///////
  112. ///////
  113. /////////////////////////////////////////////////////////////
  114. // CSignup::GetTypeInfo
  115. STDMETHODIMP CSignup::GetTypeInfo(UINT, LCID, ITypeInfo**)
  116. {
  117. return E_NOTIMPL;
  118. }
  119. /////////////////////////////////////////////////////////////
  120. // CSignup::GetTypeInfoCount
  121. STDMETHODIMP CSignup::GetTypeInfoCount(UINT* pcInfo)
  122. {
  123. return E_NOTIMPL;
  124. }
  125. /////////////////////////////////////////////////////////////
  126. // CSignup::GetIDsOfNames
  127. STDMETHODIMP CSignup::GetIDsOfNames(REFIID riid,
  128. OLECHAR** rgszNames,
  129. UINT cNames,
  130. LCID lcid,
  131. DISPID* rgDispId)
  132. {
  133. HRESULT hr = DISP_E_UNKNOWNNAME;
  134. rgDispId[0] = DISPID_UNKNOWN;
  135. for (int iX = 0; iX < sizeof(SignupExternalInterface)/sizeof(DISPATCHLIST); iX ++)
  136. {
  137. if(lstrcmp(SignupExternalInterface[iX].szName, rgszNames[0]) == 0)
  138. {
  139. rgDispId[0] = SignupExternalInterface[iX].dwDispID;
  140. hr = NOERROR;
  141. break;
  142. }
  143. }
  144. // Set the disid's for the parameters
  145. if (cNames > 1)
  146. {
  147. // Set a DISPID for function parameters
  148. for (UINT i = 1; i < cNames ; i++)
  149. rgDispId[i] = DISPID_UNKNOWN;
  150. }
  151. return hr;
  152. }
  153. /////////////////////////////////////////////////////////////
  154. // CSignup::Invoke
  155. HRESULT CSignup::Invoke
  156. (
  157. DISPID dispidMember,
  158. REFIID riid,
  159. LCID lcid,
  160. WORD wFlags,
  161. DISPPARAMS* pdispparams,
  162. VARIANT* pvarResult,
  163. EXCEPINFO* pexcepinfo,
  164. UINT* puArgErr
  165. )
  166. {
  167. HRESULT hr = S_OK;
  168. switch(dispidMember)
  169. {
  170. case DISPID_SIGNUP_GET_LOCALE:
  171. {
  172. TRACE(L"DISPID_SIGNUP_GET_LOCALE\n");
  173. if (NULL != pvarResult)
  174. get_Locale(pvarResult);
  175. break;
  176. }
  177. case DISPID_SIGNUP_GET_IDLOCALE:
  178. {
  179. TRACE(L"DISPID_SIGNUP_GET_IDLOCALE\n");
  180. if (NULL != pvarResult)
  181. get_IDLocale(pvarResult);
  182. break;
  183. }
  184. case DISPID_SIGNUP_GET_TEXT1:
  185. {
  186. TRACE(L"DISPID_SIGNUP_GET_TEXT1\n");
  187. if (NULL != pvarResult)
  188. get_Text1(pvarResult);
  189. break;
  190. }
  191. case DISPID_SIGNUP_GET_TEXT2:
  192. {
  193. TRACE(L"DISPID_SIGNUP_GET_TEXT2\n");
  194. if (NULL != pvarResult)
  195. get_Text2(pvarResult);
  196. break;
  197. }
  198. case DISPID_SIGNUP_GET_OEMNAME:
  199. {
  200. TRACE(L"DISPID_SIGNUP_GET_OEMNAME\n");
  201. if (NULL != pvarResult)
  202. get_OEMName(pvarResult);
  203. break;
  204. }
  205. default:
  206. {
  207. hr = DISP_E_MEMBERNOTFOUND;
  208. break;
  209. }
  210. }
  211. return hr;
  212. }