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.

141 lines
3.0 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: C O N F O L D . C P P
  7. //
  8. // Contents: CUPnPDeviceFolder base functions.
  9. //
  10. // Notes:
  11. //
  12. // Author: jeffspr 18 Mar 1998
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "pch.h"
  16. #pragma hdrstop
  17. // Map of replaceable items in connfold.rgs file
  18. // this allows us to localize these items
  19. //
  20. struct _ATL_REGMAP_ENTRY g_FolderRegMap[] =
  21. {
  22. { L"UPNPDeviceFolderName", NULL },
  23. { L"UPNPDeviceFolderInfoTip", NULL },
  24. { NULL, NULL }
  25. };
  26. //+---------------------------------------------------------------------------
  27. //
  28. // Member: CUPnPDeviceFolder::UpdateRegistry
  29. //
  30. // Purpose: Apply registry data in upnpfold.rgs
  31. //
  32. // Arguments:
  33. // fRegister [in] Whether to register
  34. //
  35. // Returns:
  36. //
  37. // Author: jeffspr 4 Sep 1999
  38. //
  39. // Notes:
  40. //
  41. HRESULT WINAPI CUPnPDeviceFolder::UpdateRegistry(BOOL fRegister)
  42. {
  43. HRESULT hr = S_OK;
  44. // Fill in localized strings for the two replaceable parameters
  45. //
  46. g_FolderRegMap[0].szData = WszLoadIds(IDS_UPNPFOLD_NAME);
  47. g_FolderRegMap[1].szData = WszLoadIds(IDS_UPNPFOLD_INFOTIP);
  48. if (!g_FolderRegMap[0].szData || !g_FolderRegMap[1].szData)
  49. {
  50. hr = E_FAIL;
  51. }
  52. else
  53. {
  54. hr = _Module.UpdateRegistryFromResourceD(
  55. IDR_UPNPFOLD,
  56. fRegister,
  57. g_FolderRegMap);
  58. }
  59. return hr;
  60. }
  61. //+---------------------------------------------------------------------------
  62. //
  63. // Member: CUPnPDeviceFolder::CUPnPDeviceFolder
  64. //
  65. // Purpose: Constructor for the primary Folder object
  66. //
  67. // Arguments:
  68. // (none)
  69. //
  70. // Returns:
  71. //
  72. // Author: jeffspr 18 Mar 1998
  73. //
  74. // Notes:
  75. //
  76. CUPnPDeviceFolder::CUPnPDeviceFolder()
  77. {
  78. m_pidlFolderRoot = NULL;
  79. SHGetMalloc(&m_pMalloc);
  80. m_pDelegateMalloc = NULL; /* Not delegating yet, use regular malloc */
  81. }
  82. //+---------------------------------------------------------------------------
  83. //
  84. // Member: CUPnPDeviceFolder::~CUPnPDeviceFolder
  85. //
  86. // Purpose: Destructor for the primary folder object
  87. //
  88. // Arguments:
  89. // (none)
  90. //
  91. // Returns:
  92. //
  93. // Author: jeffspr 18 Mar 1998
  94. //
  95. // Notes:
  96. //
  97. CUPnPDeviceFolder::~CUPnPDeviceFolder()
  98. {
  99. if (m_pidlFolderRoot)
  100. FreeIDL(m_pidlFolderRoot);
  101. if (m_pMalloc)
  102. m_pMalloc->Release();
  103. if (m_pDelegateMalloc)
  104. m_pDelegateMalloc->Release();
  105. }
  106. //+---------------------------------------------------------------------------
  107. //
  108. // Member: CUPnPDeviceFolder::PidlGetFolderRoot
  109. //
  110. // Purpose: Return the folder pidl. If NULL at this time, generate
  111. // the pidl for future usage.
  112. //
  113. // Arguments:
  114. // (none)
  115. //
  116. // Returns:
  117. //
  118. // Author: jeffspr 10 Jan 1999
  119. //
  120. // Notes:
  121. //
  122. LPITEMIDLIST CUPnPDeviceFolder::PidlGetFolderRoot()
  123. {
  124. HRESULT hr = S_OK;
  125. Assert(m_pidlFolderRoot);
  126. return m_pidlFolderRoot;
  127. }