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.

93 lines
1.8 KiB

  1. //____________________________________________________________________________
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1995 - 1996.
  5. //
  6. // File: mfccore.cpp
  7. //
  8. // Contents: put functions that use mfc in here.
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History:
  15. //
  16. //____________________________________________________________________________
  17. #include <afx.h>
  18. #ifndef DECLSPEC_UUID
  19. #if _MSC_VER >= 1100
  20. #define DECLSPEC_UUID(x) __declspec(uuid(x))
  21. #else
  22. #define DECLSPEC_UUID(x)
  23. #endif
  24. #endif
  25. #include <mmc.h>
  26. #include "guidhelp.h"
  27. #include "macros.h"
  28. USE_HANDLE_MACROS("GUIDHELP(guidhelp.cpp)")
  29. #include <basetyps.h>
  30. #include "cstr.h"
  31. #include "regkey.h"
  32. #ifdef _DEBUG
  33. #define new DEBUG_NEW
  34. #undef THIS_FILE
  35. static char THIS_FILE[] = __FILE__;
  36. #endif
  37. static CLIPFORMAT g_CFNodeType = 0;
  38. static CLIPFORMAT g_CFSnapInCLSID = 0;
  39. static CLIPFORMAT g_CFDisplayName = 0;
  40. HRESULT ExtractString( IDataObject* piDataObject,
  41. CLIPFORMAT cfClipFormat,
  42. CString* pstr, // OUT: Pointer to CStr to store data
  43. DWORD cchMaxLength)
  44. {
  45. if (pstr == NULL)
  46. return E_POINTER;
  47. CStr cstr(*pstr);
  48. HRESULT hr = ExtractString(piDataObject, cfClipFormat, &cstr, cchMaxLength);
  49. *pstr = cstr;
  50. return hr;
  51. }
  52. HRESULT GuidToCString( CString* pstr, const GUID& guid )
  53. {
  54. if (pstr == NULL)
  55. return E_POINTER;
  56. CStr cstr(*pstr);
  57. HRESULT hr = GuidToCStr(&cstr, guid);
  58. *pstr = cstr;
  59. return S_OK;
  60. }
  61. HRESULT LoadRootDisplayName(IComponentData* pIComponentData,
  62. CString& strDisplayName)
  63. {
  64. CStr cstr = strDisplayName;
  65. HRESULT hr = LoadRootDisplayName(pIComponentData, cstr);
  66. strDisplayName = cstr;
  67. return hr;
  68. }