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.

68 lines
1.7 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1998
  6. //
  7. // File: pch.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #include "pch.h"
  11. #ifdef _ATL_STATIC_REGISTRY
  12. #include <statreg.h>
  13. #include <statreg.cpp>
  14. #endif
  15. #include <atlimpl.cpp>
  16. #include <atlwin.cpp>
  17. HRESULT WINAPI COuDelegComModule::UpdateRegistryCLSID(const CLSID& clsid, BOOL bRegister)
  18. {
  19. static const WCHAR szIPS32[] = _T("InprocServer32");
  20. static const WCHAR szCLSID[] = _T("CLSID");
  21. HRESULT hRes = S_OK;
  22. LPOLESTR lpOleStrCLSIDValue;
  23. ::StringFromCLSID(clsid, &lpOleStrCLSIDValue);
  24. CRegKey key;
  25. if (bRegister)
  26. {
  27. LONG lRes = key.Open(HKEY_CLASSES_ROOT, szCLSID);
  28. if (lRes == ERROR_SUCCESS)
  29. {
  30. lRes = key.Create(key, lpOleStrCLSIDValue);
  31. if (lRes == ERROR_SUCCESS)
  32. {
  33. WCHAR szModule[_MAX_PATH];
  34. ::GetModuleFileName(m_hInst, szModule, _MAX_PATH);
  35. key.SetKeyValue(szIPS32, szModule);
  36. }
  37. }
  38. if (lRes != ERROR_SUCCESS)
  39. hRes = HRESULT_FROM_WIN32(lRes);
  40. }
  41. else
  42. {
  43. key.Attach(HKEY_CLASSES_ROOT);
  44. if (key.Open(key, szCLSID) == ERROR_SUCCESS)
  45. key.RecurseDeleteKey(lpOleStrCLSIDValue);
  46. }
  47. ::CoTaskMemFree(lpOleStrCLSIDValue);
  48. return hRes;
  49. }
  50. BOOL COuDelegComModule::InitClipboardFormats()
  51. {
  52. _ASSERTE(m_cfDsObjectNames == 0);
  53. m_cfDsObjectNames = ::RegisterClipboardFormat(CFSTR_DSOBJECTNAMES);
  54. _ASSERTE(m_cfParentHwnd == 0);
  55. m_cfParentHwnd = ::RegisterClipboardFormat(CFSTR_DS_PARENTHWND);
  56. _ASSERTE(m_cfDsopSelectionList == 0);
  57. m_cfDsopSelectionList = RegisterClipboardFormat(CFSTR_DSOP_DS_SELECTION_LIST);
  58. return (m_cfDsObjectNames != 0) && (m_cfParentHwnd != 0) && (m_cfDsopSelectionList != 0);
  59. }