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.

219 lines
5.8 KiB

  1. /*******************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORP., 1997
  4. *
  5. * TITLE: DevMgr.h
  6. *
  7. * VERSION: 2.0
  8. *
  9. * AUTHOR: ReedB
  10. *
  11. * DATE: 26 Dec, 1997
  12. *
  13. * DESCRIPTION:
  14. * Declarations and definitions for the WIA device manager object.
  15. *
  16. *******************************************************************************/
  17. #include <shobjidl.h>
  18. #ifndef __WIA_NOTIFY_H_
  19. #define __WIA_NOTIFY_H_
  20. #define WM_NOTIFY_WIA_DEV_EVENT WM_USER+400
  21. typedef struct _WIANOTIFY {
  22. LONG lSize;
  23. BSTR bstrDevId;
  24. STINOTIFY stiNotify;
  25. } WIANOTIFY, *PWIANOTIFY;
  26. #endif
  27. #ifndef WIANOTIFY_VOLUME_DEF
  28. #define WM_NOTIFY_WIA_VOLUME_EVENT WM_USER+501
  29. typedef struct _WIANOTIFY_VOLUME {
  30. LONG lSize;
  31. DWORD unitmask;
  32. } WIANOTIFY_VOLUME, *PWIANOTIFY_VOLUME;
  33. #define WIANOTIFY_VOLUME_DEF
  34. #endif
  35. //
  36. // MAX amount of time to wait for device enumeration, in milliseconds
  37. //
  38. #define DEVICE_LIST_WAIT_TIME 30000
  39. class CFactory;
  40. class CWiaDevMgr : public IWiaDevMgr,
  41. public IWiaNotifyDevMgr,
  42. public IHWEventHandler
  43. {
  44. public:
  45. static HRESULT CreateInstance(const IID& iid, void** ppv);
  46. private:
  47. // IUnknown methods
  48. HRESULT _stdcall QueryInterface(const IID& iid, void** ppv);
  49. ULONG _stdcall AddRef();
  50. ULONG _stdcall Release();
  51. //
  52. // IHWEventHandler
  53. //
  54. HRESULT _stdcall Initialize(
  55. LPCWSTR pszParams);
  56. HRESULT _stdcall HandleEvent(
  57. LPCWSTR pszDeviceID,
  58. LPCWSTR pszAltDeviceID,
  59. LPCWSTR pszEventType);
  60. HRESULT _stdcall HandleEventWithContent(
  61. LPCWSTR pszDeviceID,
  62. LPCWSTR pszAltDeviceID,
  63. LPCWSTR pszEventType,
  64. LPCWSTR pszContentTypeHandler,
  65. IDataObject* pdataobject);
  66. //
  67. // IWiaNotifyDevMgr Methods
  68. //
  69. HRESULT _stdcall NewDeviceArrival()
  70. {
  71. //
  72. // Just refresh active list
  73. //
  74. ::StiPostMessage(NULL,
  75. STIMON_MSG_REFRESH,
  76. STIMON_MSG_REFRESH_REREAD,
  77. STIMON_MSG_REFRESH_NEW | STIMON_MSG_PURGE_REMOVED);
  78. // STIMON_MSG_REFRESH_NEW);
  79. return S_OK;
  80. };
  81. //
  82. // IWiaDevMgr methods
  83. //
  84. HRESULT _stdcall EnumDeviceInfo(
  85. LONG lFlag,
  86. IEnumWIA_DEV_INFO **ppIEnum);
  87. HRESULT _stdcall CreateDevice(
  88. BSTR pbstrDeviceID,
  89. IWiaItem **ppItemRoot);
  90. HRESULT _stdcall SelectDeviceDlg(
  91. HWND hwndParent,
  92. LONG lDeviceType,
  93. LONG lFlags,
  94. BSTR *pbstrDeviceID,
  95. IWiaItem **ppItemRoot);
  96. HRESULT _stdcall SelectDeviceDlgID(
  97. HWND hwndParent,
  98. LONG lDeviceType,
  99. LONG lFlags,
  100. BSTR *pbstrDeviceID );
  101. HRESULT _stdcall GetImageDlg(
  102. HWND hwndParent,
  103. LONG lDeviceType,
  104. LONG lFlags,
  105. LONG lIntent,
  106. IWiaItem *pItemRoot,
  107. BSTR bstrFilename,
  108. GUID *pguidFormat);
  109. HRESULT _stdcall RegisterEventCallbackProgram(
  110. LONG lFlags,
  111. BSTR bstrDeviceID,
  112. const GUID *pEventGUID,
  113. BSTR bstrCommandline,
  114. BSTR bstrName,
  115. BSTR bstrDescription,
  116. BSTR bstrIcon);
  117. HRESULT _stdcall RegisterEventCallbackInterface(
  118. LONG lFlags,
  119. BSTR bstrDeviceID,
  120. const GUID *pEventGUID,
  121. IWiaEventCallback *pIWIAEventCallback,
  122. IUnknown **ppIEvent);
  123. HRESULT _stdcall RegisterEventCallbackCLSID(
  124. LONG lFlags,
  125. BSTR bstrDeviceID,
  126. const GUID *pEventGUID,
  127. const GUID *pClsID,
  128. BSTR bstrName,
  129. BSTR bstrDescription,
  130. BSTR bstrIcon);
  131. HRESULT _stdcall AddDeviceDlg(
  132. HWND hWndParent,
  133. LONG lFlags);
  134. //
  135. // helper functins
  136. //
  137. HRESULT FindMatchingDevice(
  138. BSTR bstrDeviceID,
  139. IWiaPropertyStorage **ppIWiaPropStg);
  140. HRESULT FindFileSystemDriver(
  141. LPCWSTR pszAltDeviceID,
  142. BSTR *pbstrDeviceId);
  143. HRESULT RunAcquisitionManager(
  144. BSTR bstrDeviceId);
  145. friend CFactory;
  146. CWiaDevMgr();
  147. HRESULT Initialize();
  148. ~CWiaDevMgr();
  149. //
  150. // member variables
  151. //
  152. ULONG m_cRef; // Reference count for this object.
  153. ITypeInfo* m_pITypeInfo; // Pointer to type information.
  154. };
  155. /**************************************************************************\
  156. *
  157. * Add Device Dilaog return
  158. *
  159. *
  160. *
  161. * History:
  162. *
  163. * 12/22/1998 Original Version
  164. *
  165. \**************************************************************************/
  166. typedef struct _WIA_ADD_DEVICE {
  167. char szServerName[MAX_PATH];
  168. WCHAR wszServerName[MAX_PATH];
  169. BSTR bstrDeviceID;
  170. BOOL bLocal;
  171. HWND hWndParent;
  172. }WIA_ADD_DEVICE,*PWIA_ADD_DEVICE;
  173. HRESULT DisplayAddDlg(PWIA_ADD_DEVICE);