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.

87 lines
1.3 KiB

  1. #include "mslocusr.h"
  2. #include "msluglob.h"
  3. #include <ole2.h>
  4. CUserSettings::CUserSettings(void)
  5. : m_cRef(1),
  6. m_clsid(GUID_NULL),
  7. m_nlsName(NULL),
  8. m_hkey(NULL)
  9. {
  10. // nothing else
  11. }
  12. CUserSettings::~CUserSettings(void)
  13. {
  14. if (m_hkey != NULL) {
  15. ::RegCloseKey(m_hkey);
  16. #ifdef DEBUG
  17. m_hkey = NULL;
  18. #endif
  19. }
  20. }
  21. STDMETHODIMP CUserSettings::QueryInterface(REFIID riid, LPVOID * ppvObj)
  22. {
  23. if (!IsEqualIID(riid, IID_IUnknown) &&
  24. !IsEqualIID(riid, IID_IUserSettings)) {
  25. return ResultFromScode(E_NOINTERFACE);
  26. }
  27. *ppvObj = this;
  28. AddRef();
  29. return NOERROR;
  30. }
  31. STDMETHODIMP_(ULONG) CUserSettings::AddRef(void)
  32. {
  33. return ++m_cRef;
  34. }
  35. STDMETHODIMP_(ULONG) CUserSettings::Release(void)
  36. {
  37. ULONG cRef;
  38. cRef = --m_cRef;
  39. if (0L == m_cRef) {
  40. delete this;
  41. }
  42. return cRef;
  43. }
  44. STDMETHODIMP CUserSettings::GetCLSID(CLSID *pclsidOut)
  45. {
  46. return E_NOTIMPL;
  47. }
  48. STDMETHODIMP CUserSettings::GetName(LPSTR pbBuffer, LPDWORD pcbBuffer)
  49. {
  50. if (m_nlsName.QueryError())
  51. return ResultFromScode(E_OUTOFMEMORY);
  52. UINT err = NPSCopyNLS(&m_nlsName, pbBuffer, pcbBuffer);
  53. return HRESULT_FROM_WIN32(err);
  54. }
  55. STDMETHODIMP CUserSettings::GetDisplayName(LPSTR pbBuffer, LPDWORD pcbBuffer)
  56. {
  57. return E_NOTIMPL;
  58. }
  59. STDMETHODIMP CUserSettings::QueryKey(HKEY *phkeyOut)
  60. {
  61. return E_NOTIMPL;
  62. }