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.

148 lines
3.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: T F I N D . H
  7. //
  8. // Contents: Tray find device callback for UPnP Tray Monitor
  9. //
  10. // Notes:
  11. //
  12. // Author: jeffspr 7 Dec 1999
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #ifndef _TRAYFIND_H_
  17. #define _TRAYFIND_H_
  18. #include <upnp.h>
  19. #include <upnpshell.h>
  20. #include <upclsid.h>
  21. #include <shlguid.h>
  22. #include <shlobj.h>
  23. #include <shlobjp.h>
  24. #include "nsbase.h"
  25. #include <clist.h>
  26. extern CONST WCHAR c_szNetworkNeighborhoodFolderPath[];
  27. extern CONST WCHAR c_szDelegateFolderPrefix[];
  28. extern CONST SIZE_T c_cchDelegateFolderPrefix;
  29. extern CONST TCHAR c_szMainWindowClassName[];
  30. extern CONST TCHAR c_szMainWindowTitle[];
  31. #define WM_USER_TRAYCALLBACK (WM_USER+1)
  32. struct NAME_MAP
  33. {
  34. LPTSTR szUdn;
  35. LPTSTR szName;
  36. };
  37. struct NewDeviceNode
  38. {
  39. public:
  40. NewDeviceNode();
  41. ~NewDeviceNode();
  42. PTSTR pszUDN;
  43. PTSTR pszDisplayName;
  44. PTSTR pszType;
  45. PTSTR pszPresentationURL;
  46. PTSTR pszManufacturerName;
  47. PTSTR pszModelNumber;
  48. PTSTR pszModelName;
  49. PTSTR pszDescription;
  50. };
  51. class /* ATL_NO_VTABLE */ CUPnPMonitorDeviceFinderCallback :
  52. public CComObjectRootEx <CComMultiThreadModel>,
  53. public IUPnPDeviceFinderCallback
  54. {
  55. public:
  56. HRESULT FinalConstruct()
  57. {
  58. return CoCreateFreeThreadedMarshaler(GetControllingUnknown(),
  59. &m_pUnkMarshaler);
  60. }
  61. void FinalRelease()
  62. {
  63. m_pUnkMarshaler->Release();
  64. }
  65. IUnknown *m_pUnkMarshaler;
  66. CUPnPMonitorDeviceFinderCallback();
  67. ~CUPnPMonitorDeviceFinderCallback();
  68. DECLARE_NOT_AGGREGATABLE(CUPnPMonitorDeviceFinderCallback)
  69. DECLARE_GET_CONTROLLING_UNKNOWN()
  70. BEGIN_COM_MAP(CUPnPMonitorDeviceFinderCallback)
  71. COM_INTERFACE_ENTRY(IUPnPDeviceFinderCallback)
  72. COM_INTERFACE_ENTRY_AGGREGATE(IID_IMarshal, m_pUnkMarshaler)
  73. END_COM_MAP()
  74. // *** IUPnPDeviceFinderCallback methods ***
  75. STDMETHOD(DeviceAdded)(LONG lFindData, IUPnPDevice * pDevice);
  76. STDMETHOD(DeviceRemoved)(LONG lFindData, BSTR bstrUDN);
  77. STDMETHOD(SearchComplete)(LONG lFindData);
  78. };
  79. HWND StartUPnPTray();
  80. HRESULT HrInitializeUI();
  81. HRESULT HrInitTrayData();
  82. HRESULT HrSaveTrayData();
  83. HRESULT HrLoadPersistedDevices();
  84. HRESULT HrSavePersistedDevices();
  85. HRESULT HrOpenUPnPRegRoot(HKEY * phkeyRegRoot);
  86. HRESULT HrStartSearch(VOID);
  87. extern IUPnPDeviceFinder * g_pdfTray;
  88. extern HWND g_hwnd;
  89. extern BOOL g_fSearchInProgress;
  90. VOID RemoveTrayIcon(HWND hwnd);
  91. HRESULT HrUpdateTrayInfo();
  92. HRESULT HrCreateDeviceNodeFromDevice(IUPnPDevice *pDevice,
  93. NewDeviceNode ** ppNDN);
  94. LPWSTR CreateChangeNotifyString(LPCWSTR pszUdn);
  95. // device cache used by the folder object
  96. //
  97. struct FolderDeviceNode
  98. {
  99. WCHAR pszUDN[MAX_PATH];
  100. WCHAR pszDisplayName[MAX_PATH];
  101. WCHAR pszPresentationURL[MAX_PATH];
  102. WCHAR pszType[MAX_PATH];
  103. WCHAR pszDescription[MAX_PATH];
  104. BOOL fDeleted;
  105. };
  106. class CListFolderDeviceNode;
  107. extern CListFolderDeviceNode g_CListFolderDeviceNode;
  108. extern CRITICAL_SECTION g_csFolderDeviceList;
  109. class CListString;
  110. class CListNDN;
  111. class CListNameMap;
  112. // Our full device list.
  113. //
  114. extern CListString g_CListUDN;
  115. extern CListString g_CListUDNSearch;
  116. extern CListNameMap g_CListNameMap;
  117. extern CListNDN g_CListNewDeviceNode;
  118. #endif // _TRAYFIND_H_