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.

179 lines
6.8 KiB

  1. //*********************************************************************
  2. //* Microsoft Windows **
  3. //* Copyright(c) Microsoft Corp., 1999 **
  4. //*********************************************************************
  5. //
  6. // USERINFO.H - Header for the implementation of CUserInfo
  7. //
  8. // HISTORY:
  9. //
  10. // 1/27/99 a-jaswed Created.
  11. //
  12. #ifndef _USERINFO_H_
  13. #define _USERINFO_H_
  14. #include <windows.h>
  15. #include <assert.h>
  16. #include <oleauto.h>
  17. #include <lmcons.h>
  18. #include "util.h"
  19. typedef struct tag_REGDATAELEMENT
  20. {
  21. LPCWSTR lpQueryElementName; // Static name to put in query string
  22. LPWSTR lpQueryElementValue; // data for element
  23. DWORD dwValidateFlag; // validation bit flag for this element
  24. }REGDATAELEMENT, *LPREGDATAELEMENT;
  25. // "IdentityXXX" where XXX is 3 digit integer
  26. const USHORT IDENTITY_REGVALUE_LEN_MAX = 12;
  27. // Maximum length for data in an identity
  28. //
  29. const USHORT IDENTITY_CCH_MAX = UNLEN;
  30. typedef struct tag_IDENTITYELEMENT
  31. {
  32. WCHAR rgchRegValue[IDENTITY_REGVALUE_LEN_MAX];
  33. WCHAR rgchIdentity[IDENTITY_CCH_MAX + 1];
  34. } IDENTITYELEMENT;
  35. class CUserInfo : public IDispatch
  36. {
  37. public:
  38. const static USHORT IDENTITIES_MAX = 6;
  39. const static USHORT RESERVED_IDENTITIES_MAX = 2;
  40. const static int RESERVED_IDENTITIES_IDS[RESERVED_IDENTITIES_MAX];
  41. private:
  42. HINSTANCE m_hInstance;
  43. ULONG m_cRef;
  44. DWORD m_dwCountryCode;
  45. WCHAR m_szUserInfoINIFile [MAX_PATH];
  46. // BUGBUG: Do all these buffers really need to be MAX_PATH characters??
  47. // Registration data
  48. WCHAR m_szFirstName [MAX_PATH];
  49. WCHAR m_szMiddleInitial [MAX_PATH];
  50. WCHAR m_szLastName [MAX_PATH];
  51. WCHAR m_szFuriganaName [MAX_PATH];
  52. WCHAR m_szCompanyName [MAX_PATH];
  53. WCHAR m_szAddress1 [MAX_PATH*2];
  54. WCHAR m_szAddress2 [MAX_PATH*2];
  55. WCHAR m_szCity [MAX_PATH];
  56. WCHAR m_szState [MAX_PATH];
  57. WCHAR m_szZip [MAX_PATH];
  58. WCHAR m_szCountry [MAX_PATH];
  59. WCHAR m_szPrimaryEmail [MAX_PATH];
  60. WCHAR m_szSecondaryEmail [MAX_PATH];
  61. WCHAR m_szAreaCode [MAX_PATH];
  62. WCHAR m_szPhoneNumber [MAX_PATH];
  63. VARIANT_BOOL m_fMSUpdate;
  64. VARIANT_BOOL m_fMSOffer;
  65. VARIANT_BOOL m_fOtherOffer;
  66. DWORD m_dwCountryID;
  67. LPREGDATAELEMENT m_RegDataElements;
  68. // New user accounts
  69. WCHAR m_szOwnerName[MAX_PATH];
  70. VARIANT_BOOL m_fOEMIdentities;
  71. VARIANT_BOOL m_fUseIdentities;
  72. IDENTITYELEMENT m_rgIdentities[IDENTITIES_MAX];
  73. TCHAR m_szReservedIdentities[RESERVED_IDENTITIES_MAX][MAX_PATH];
  74. WCHAR m_szDefaultNewUser[MAX_PATH];
  75. //GET functions
  76. HRESULT get_FuriganaName (BSTR* pbstrVal);
  77. HRESULT get_SecondaryEmail (BSTR* pbstrVal);
  78. HRESULT get_AreaCode (BSTR* pbstrVal);
  79. HRESULT get_PhoneNumber (BSTR* pbstrVal);
  80. //SET functions
  81. HRESULT set_FirstName (WCHAR* pszVal);
  82. HRESULT set_MiddleInitial (WCHAR* pszVal);
  83. HRESULT set_LastName (WCHAR* pszVal);
  84. HRESULT set_CompanyName (WCHAR* pszVal);
  85. HRESULT set_Address1 (WCHAR* pszVal);
  86. HRESULT set_Address2 (WCHAR* pszVal);
  87. HRESULT set_City (WCHAR* pszVal);
  88. HRESULT set_State (WCHAR* pszVal);
  89. HRESULT set_Zip (WCHAR* pszVal);
  90. HRESULT set_Country (WCHAR* pszVal);
  91. HRESULT set_PrimaryEmail (WCHAR* pszVal);
  92. HRESULT set_SecondaryEmail (WCHAR* pszVal);
  93. HRESULT set_AreaCode (WCHAR* pszVal);
  94. HRESULT set_PhoneNumber (WCHAR* pszVal);
  95. HRESULT set_FuriganaName (WCHAR* pszVal);
  96. HRESULT set_OwnerName (WCHAR* pszVal);
  97. HRESULT set_Identity (UINT uiIndex, WCHAR* pszVal);
  98. HRESULT set_UseIdentities (VARIANT_BOOL fVal);
  99. HRESULT set_MSUpdate (VARIANT_BOOL fVal);
  100. HRESULT set_MSOffer (VARIANT_BOOL fVal);
  101. HRESULT set_OtherOffer (VARIANT_BOOL fVal);
  102. HRESULT set_CountryID (DWORD dwVal);
  103. // CHECK functions
  104. HRESULT check_Identity (UINT uiIndex, VARIANT_BOOL* pfValid);
  105. HRESULT check_Identity (WCHAR* pszVal, VARIANT_BOOL* pfValid);
  106. STDMETHOD(SuggestIdentity0)();
  107. void ReadUserInfo (HKEY hKey, WCHAR* pszKey, WCHAR* pszValue, DWORD dwSize);
  108. void WriteUserInfo (WCHAR* pszBuf, WCHAR* pszKey, WCHAR* pszValue);
  109. void FixString (BSTR bstrVal);
  110. public:
  111. CUserInfo (HINSTANCE hInstance);
  112. ~CUserInfo ();
  113. HRESULT GetQueryString (BSTR bstrBaseURL, BSTR *lpReturnURL);
  114. //Public GET functions
  115. HRESULT get_FirstName (BSTR* pbstrVal);
  116. HRESULT get_MiddleInitial (BSTR* pbstrVal);
  117. HRESULT get_LastName (BSTR* pbstrVal);
  118. HRESULT get_Address1 (BSTR* pbstrVal);
  119. HRESULT get_Address2 (BSTR* pbstrVal);
  120. HRESULT get_City (BSTR* pbstrVal);
  121. HRESULT get_State (BSTR* pbstrVal);
  122. HRESULT get_Zip (BSTR* pbstrVal);
  123. HRESULT get_Country (BSTR* pbstrVal);
  124. HRESULT get_PrimaryEmail (BSTR* pbstrVal);
  125. HRESULT get_CompanyName (BSTR* pbstrVal);
  126. HRESULT set_CountryCode (DWORD dwCountryCd);
  127. HRESULT get_OwnerName (BSTR* pbstrVal);
  128. HRESULT get_Identity (UINT uiIndex, BSTR* pbstrVal);
  129. HRESULT get_UseIdentities (VARIANT_BOOL* pfVal);
  130. HRESULT get_MSUpdate (VARIANT_BOOL* pfVal);
  131. HRESULT get_MSOffer (VARIANT_BOOL* pfVal);
  132. HRESULT get_OtherOffer (VARIANT_BOOL* pfVal);
  133. HRESULT get_CountryID (DWORD* pdwVal);
  134. HRESULT get_OEMIdentities (VARIANT_BOOL* pfVal){
  135. *pfVal = m_fOEMIdentities;
  136. return S_OK;
  137. }
  138. HRESULT get_IdentitiesMax (SHORT* uiMax){
  139. *uiMax = IDENTITIES_MAX;
  140. return S_OK;
  141. }
  142. HRESULT get_Identities (PSTRINGLIST* pUserList);
  143. HRESULT set_DefaultNewUser (WCHAR * pszVal);
  144. HRESULT get_DefaultNewUser (BSTR* pszVal);
  145. // IUnknown Interfaces
  146. STDMETHODIMP QueryInterface (REFIID riid, LPVOID* ppvObj);
  147. STDMETHODIMP_(ULONG) AddRef ();
  148. STDMETHODIMP_(ULONG) Release ();
  149. //IDispatch Interfaces
  150. STDMETHOD (GetTypeInfoCount) (UINT* pcInfo);
  151. STDMETHOD (GetTypeInfo) (UINT, LCID, ITypeInfo** );
  152. STDMETHOD (GetIDsOfNames) (REFIID, OLECHAR**, UINT, LCID, DISPID* );
  153. STDMETHOD (Invoke) (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr);
  154. };
  155. #endif