home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / sti.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  31.8 KB  |  1,003 lines

  1. /*++
  2.  
  3. Copyright (c) 1986-1997  Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     sti.h
  8.  
  9. Abstract:
  10.  
  11.     This module contains the user mode still image APIs in COM format
  12.  
  13. Revision History:
  14.  
  15.  
  16. --*/
  17.  
  18. #ifndef _STICOM_
  19. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  20. #define _STICOM_
  21.  
  22. //
  23. // Set packing
  24. //
  25. #include <pshpack8.h>
  26.  
  27. //
  28. // Only use UNICODE STI interfaces
  29. //
  30. #define STI_UNICODE 1
  31.  
  32. //
  33. // Include COM definitions
  34. //
  35. #ifndef _NO_COM
  36. #include <objbase.h>
  37. #endif
  38.  
  39. #include <stireg.h>
  40. #include <stierr.h>
  41.  
  42. //
  43. // Compiler pragmas
  44. //
  45. #pragma warning(disable:4200)       // warning about zero-sized arrays being non-stadard C extension
  46.  
  47. #define DLLEXP __declspec( dllexport )
  48.  
  49. #ifdef __cplusplus
  50. extern "C" {
  51. #endif
  52.  
  53. #if defined( _WIN32 ) && !defined( _NO_COM)
  54.  
  55. /*
  56.  * Class IID's
  57.  */
  58.  
  59. // B323F8E0-2E68-11D0-90EA-00AA0060F86C
  60. DEFINE_GUID(CLSID_Sti, 0xB323F8E0L, 0x2E68, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C);
  61.  
  62. /*
  63.  * Interface IID's
  64.  */
  65.  
  66. // {641BD880-2DC8-11D0-90EA-00AA0060F86C}
  67. DEFINE_GUID(IID_IStillImageW, 0x641BD880L, 0x2DC8, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C);
  68.  
  69. // {A7B1F740-1D7F-11D1-ACA9-00A02438AD48}
  70. DEFINE_GUID(IID_IStillImageA, 0xA7B1F740L, 0x1D7F, 0x11D1, 0xAC, 0xA9, 0x00, 0xA0, 0x24, 0x38, 0xAD, 0x48);
  71.  
  72.  
  73. // {6CFA5A80-2DC8-11D0-90EA-00AA0060F86C}
  74. DEFINE_GUID(IID_IStiDevice, 0x6CFA5A80L, 0x2DC8, 0x11D0, 0x90, 0xEA, 0x00, 0xAA, 0x00, 0x60, 0xF8, 0x6C);
  75.  
  76. /*
  77.  * Standard event GUIDs
  78.  */
  79.  
  80. // {740D9EE6-70F1-11d1-AD10-00A02438AD48}
  81. DEFINE_GUID(GUID_DeviceArrivedLaunch, 0x740d9ee6, 0x70f1, 0x11d1, 0xad, 0x10, 0x0, 0xa0, 0x24, 0x38, 0xad, 0x48);
  82.  
  83. // {A6C5A715-8C6E-11d2-977A-0000F87A926F}
  84. DEFINE_GUID(GUID_ScanImage,
  85. 0xa6c5a715, 0x8c6e, 0x11d2, 0x97, 0x7a, 0x0, 0x0, 0xf8, 0x7a, 0x92, 0x6f);
  86.  
  87.  // {B441F425-8C6E-11d2-977A-0000F87A926F}
  88. DEFINE_GUID(GUID_ScanPrintImage,
  89. 0xb441f425, 0x8c6e, 0x11d2, 0x97, 0x7a, 0x0, 0x0, 0xf8, 0x7a, 0x92, 0x6f);
  90.  
  91.  
  92. // {C00EB793-8C6E-11d2-977A-0000F87A926F}
  93. DEFINE_GUID(GUID_ScanFaxImage,
  94. 0xc00eb793, 0x8c6e, 0x11d2, 0x97, 0x7a, 0x0, 0x0, 0xf8, 0x7a, 0x92, 0x6f);
  95.  
  96.  
  97. // {C00EB795-8C6E-11d2-977A-0000F87A926F}
  98. DEFINE_GUID(GUID_STIUserDefined1,
  99. 0xc00eb795, 0x8c6e, 0x11d2, 0x97, 0x7a, 0x0, 0x0, 0xf8, 0x7a, 0x92, 0x6f);
  100.  
  101.  
  102. // {C77AE9C5-8C6E-11d2-977A-0000F87A926F}
  103. DEFINE_GUID(GUID_STIUserDefined2,
  104. 0xc77ae9c5, 0x8c6e, 0x11d2, 0x97, 0x7a, 0x0, 0x0, 0xf8, 0x7a, 0x92, 0x6f);
  105.  
  106.  
  107. // {C77AE9C6-8C6E-11d2-977A-0000F87A926F}
  108. DEFINE_GUID(GUID_STIUserDefined3,
  109. 0xc77ae9c6, 0x8c6e, 0x11d2, 0x97, 0x7a, 0x0, 0x0, 0xf8, 0x7a, 0x92, 0x6f);
  110.  
  111. #endif
  112.  
  113. //
  114. // Generic constants and definitions
  115. //
  116. #define STI_VERSION_FLAG_MASK       0xff000000
  117. #define STI_VERSION_FLAG_UNICODE    0x01000000
  118.  
  119. #define GET_STIVER_MAJOR(dwVersion)   (HIWORD(dwVersion) & ~STI_VERSION_FLAG_MASK)
  120. #define GET_STIVER_MINOR(dwVersion)   LOWORD(dwVersion)
  121.  
  122. #define STI_VERSION_REAL            0x00000002
  123. #define STI_VERSION_MIN_ALLOWED     0x00000002
  124.  
  125. #ifdef UNICODE
  126. #define STI_VERSION                 (STI_VERSION_REAL | STI_VERSION_FLAG_UNICODE)
  127. #else
  128. #define STI_VERSION                 (STI_VERSION_REAL)
  129. #endif
  130.  
  131. //
  132. // Maximum length of internal device name
  133. //
  134. #define STI_MAX_INTERNAL_NAME_LENGTH    128
  135.  
  136. // begin sti_device_information
  137.  
  138. //
  139. //  Device information definitions and prototypes
  140. // ----------------------------------------------
  141. //
  142.  
  143. //
  144. //  Following information is used for enumerating still image devices , currently configured
  145. //  in the system. Presence of the device in the enumerated list does not mean availability
  146. // of the device, it only means that device was installed at least once and had not been removed since.
  147. //
  148.  
  149. //
  150. // Type of device ( scanner, camera) is represented by DWORD value with
  151. // hi word containing generic device type , and lo word containing sub-type
  152. //
  153. typedef enum _STI_DEVICE_MJ_TYPE {
  154.     StiDeviceTypeDefault          = 0,
  155.     StiDeviceTypeScanner          = 1,
  156.     StiDeviceTypeDigitalCamera    = 2
  157. } STI_DEVICE_MJ_TYPE;
  158.  
  159. typedef DWORD STI_DEVICE_TYPE;
  160.  
  161. //
  162. // Macros to extract device type/subtype from single type field
  163. //
  164. #define GET_STIDEVICE_TYPE(dwDevType)   HIWORD(dwDevType)
  165. #define GET_STIDEVICE_SUBTYPE(dwDevType)   LOWORD(dwDevType)
  166.  
  167. //
  168. // Device capabilities bits.
  169. // Various capabilities are grouped into separate bitmasks
  170. //
  171.  
  172. typedef struct _STI_DEV_CAPS {
  173.     DWORD   dwGeneric;
  174. } STI_DEV_CAPS, *PSTI_DEV_CAPS;
  175.  
  176. //
  177. // Generic capabilities mask contain 16 bits , common for all devices, maintained by MS
  178. // and 16 bits , which USD can use for proprietary capbailities reporting.
  179. //
  180.  
  181. #define GET_STIDCOMMON_CAPS(dwGenericCaps)   LOWORD(dwGenericCaps)
  182. #define GET_STIVENDOR_CAPS(dwGenericCaps)    HIWORD(dwGenericCaps)
  183.  
  184. #define STI_GENCAP_COMMON_MASK  (DWORD)0x00ff
  185.  
  186. //
  187. // Notifications are supported.
  188. // If this capability set , device can be subscribed to .
  189. //
  190. #define STI_GENCAP_NOTIFICATIONS    0x00000001
  191.  
  192. //
  193. // Polling required .
  194. // This capability is used when previous is set to TRUE. Presence of it means
  195. // that device is not capable of issuing "truly" asyncronous notifications, but can
  196. // be polled to determine the moment when event happened
  197. #define STI_GENCAP_POLLING_NEEDED   0x00000002
  198.  
  199. //
  200. // Generate event on device arrival
  201. // If this capability is set, still image service will generate event when device
  202. // instance is successfully initialized ( typically in response to PnP arrival)
  203.  
  204. //
  205. // Note: on initial service enumeration events will nto be generated to avoid
  206. // end-user confusion.
  207. //
  208. #define STI_GENCAP_GENERATE_ARRIVALEVENT    0x00000004
  209.  
  210. //
  211. // Auto port selection on non-PnP buses
  212. // This capability indicates that USD is able to detect non-PnP device on a
  213. // bus , device is supposed to be attached to.
  214. //
  215. #define STI_GENCAP_AUTO_PORTSELECT   0x00000008
  216.  
  217.  
  218. //
  219. //
  220. // Type of bus connection for those in need to know
  221. //
  222. #define STI_HW_CONFIG_UNKNOWN   0x0001
  223. #define STI_HW_CONFIG_SCSI      0x0002
  224. #define STI_HW_CONFIG_USB       0x0004
  225. #define STI_HW_CONFIG_SERIAL    0x0008
  226. #define STI_HW_CONFIG_PARALLEL  0x0010
  227.  
  228. //
  229. // Device information structure, this is not configurable. This data is returned from
  230. // device enumeration API and is used for populating UI or selecting which device
  231. // should be used in current session
  232. //
  233. typedef struct _STI_DEVICE_INFORMATIONW {
  234.     DWORD   dwSize;
  235.  
  236.     // Type of the hardware imaging device
  237.     STI_DEVICE_TYPE   DeviceType;
  238.  
  239.     // Device identifier for reference when creating device object
  240.     WCHAR   szDeviceInternalName[STI_MAX_INTERNAL_NAME_LENGTH];
  241.  
  242.     // Set of capabilities flags
  243.     STI_DEV_CAPS   DeviceCapabilities;
  244.  
  245.     // This includes bus type
  246.     DWORD   dwHardwareConfiguration;
  247.  
  248.     // Vendor description string
  249.     LPWSTR    pszVendorDescription;
  250.  
  251.     // Device description , provided by vendor
  252.     LPWSTR    pszDeviceDescription;
  253.  
  254.     // String , representing port on which device is accessible.
  255.     LPWSTR    pszPortName;
  256.  
  257.     // Control panel propery provider
  258.     LPWSTR    pszPropProvider;
  259.  
  260.     // Local specific ("friendly") name of the device, mainly used for showing in the UI
  261.     LPWSTR    pszLocalName;
  262.  
  263. } STI_DEVICE_INFORMATIONW, *PSTI_DEVICE_INFORMATIONW;
  264.  
  265. typedef struct _STI_DEVICE_INFORMATIONA {
  266.     DWORD   dwSize;
  267.  
  268.     // Type of the hardware imaging device
  269.     STI_DEVICE_TYPE   DeviceType;
  270.  
  271.     // Device identifier for reference when creating device object
  272.     CHAR    szDeviceInternalName[STI_MAX_INTERNAL_NAME_LENGTH];
  273.  
  274.     // Set of capabilities flags
  275.     STI_DEV_CAPS   DeviceCapabilities;
  276.  
  277.     // This includes bus type
  278.     DWORD   dwHardwareConfiguration;
  279.  
  280.     // Vendor description string
  281.     LPCSTR    pszVendorDescription;
  282.  
  283.     // Device description , provided by vendor
  284.     LPCSTR    pszDeviceDescription;
  285.  
  286.     // String , representing port on which device is accessible.
  287.     LPCSTR    pszPortName;
  288.  
  289.     // Control panel propery provider
  290.     LPCSTR    pszPropProvider;
  291.  
  292.     // Local specific ("friendly") name of the device, mainly used for showing in the UI
  293.     LPCSTR    pszLocalName;
  294.  
  295. } STI_DEVICE_INFORMATIONA, *PSTI_DEVICE_INFORMATIONA;
  296.  
  297. #if defined(UNICODE) || defined(STI_UNICODE)
  298. typedef STI_DEVICE_INFORMATIONW STI_DEVICE_INFORMATION;
  299. typedef PSTI_DEVICE_INFORMATIONW PSTI_DEVICE_INFORMATION;
  300. #else
  301. typedef STI_DEVICE_INFORMATIONA STI_DEVICE_INFORMATION;
  302. typedef PSTI_DEVICE_INFORMATIONA PSTI_DEVICE_INFORMATION;
  303. #endif
  304.  
  305. //
  306. // EXTENDED STI INFORMATION TO COVER WIA
  307. //
  308.  
  309. typedef struct _STI_WIA_DEVICE_INFORMATIONW {
  310.     DWORD   dwSize;
  311.  
  312.     // Type of the hardware imaging device
  313.     STI_DEVICE_TYPE   DeviceType;
  314.  
  315.     // Device identifier for reference when creating device object
  316.     WCHAR   szDeviceInternalName[STI_MAX_INTERNAL_NAME_LENGTH];
  317.  
  318.     // Set of capabilities flags
  319.     STI_DEV_CAPS   DeviceCapabilities;
  320.  
  321.     // This includes bus type
  322.     DWORD   dwHardwareConfiguration;
  323.  
  324.     // Vendor description string
  325.     LPWSTR    pszVendorDescription;
  326.  
  327.     // Device description , provided by vendor
  328.     LPWSTR    pszDeviceDescription;
  329.  
  330.     // String , representing port on which device is accessible.
  331.     LPWSTR    pszPortName;
  332.  
  333.     // Control panel propery provider
  334.     LPWSTR    pszPropProvider;
  335.  
  336.     // Local specific ("friendly") name of the device, mainly used for showing in the UI
  337.     LPWSTR    pszLocalName;
  338.  
  339.     //
  340.     // WIA values
  341.     //
  342.  
  343.     LPWSTR    pszUiDll;
  344.     LPWSTR    pszServer;
  345.  
  346. } STI_WIA_DEVICE_INFORMATIONW, *PSTI_WIA_DEVICE_INFORMATIONW;
  347.  
  348.  
  349. typedef struct _STI_WIA_DEVICE_INFORMATIONA {
  350.     DWORD   dwSize;
  351.  
  352.     // Type of the hardware imaging device
  353.     STI_DEVICE_TYPE   DeviceType;
  354.  
  355.     // Device identifier for reference when creating device object
  356.     CHAR    szDeviceInternalName[STI_MAX_INTERNAL_NAME_LENGTH];
  357.  
  358.     // Set of capabilities flags
  359.     STI_DEV_CAPS   DeviceCapabilities;
  360.  
  361.     // This includes bus type
  362.     DWORD   dwHardwareConfiguration;
  363.  
  364.     // Vendor description string
  365.     LPCSTR    pszVendorDescription;
  366.  
  367.     // Device description , provided by vendor
  368.     LPCSTR    pszDeviceDescription;
  369.  
  370.     // String , representing port on which device is accessible.
  371.     LPCSTR    pszPortName;
  372.  
  373.     // Control panel propery provider
  374.     LPCSTR    pszPropProvider;
  375.  
  376.     // Local specific ("friendly") name of the device, mainly used for showing in the UI
  377.     LPCSTR    pszLocalName;
  378.  
  379.     //
  380.     // WIA values
  381.     //
  382.  
  383.     LPCSTR    pszUiDll;
  384.     LPCSTR    pszServer;
  385.  
  386. } STI_WIA_DEVICE_INFORMATIONA, *PSTI_WIA_DEVICE_INFORMATIONA;
  387.  
  388.  
  389. #if defined(UNICODE) || defined(STI_UNICODE)
  390. typedef STI_WIA_DEVICE_INFORMATIONW STI_WIA_DEVICE_INFORMATION;
  391. typedef PSTI_WIA_DEVICE_INFORMATIONW PSTI_WIA_DEVICE_INFORMATION;
  392. #else
  393. typedef STI_WIA_DEVICE_INFORMATIONA STI_WIA_DEVICE_INFORMATION;
  394. typedef PSTI_WIA_DEVICE_INFORMATIONA PSTI_WIA_DEVICE_INFORMATION;
  395. #endif
  396.  
  397.  
  398. // end sti_device_information
  399.  
  400. //
  401. // Device state information.
  402. // ------------------------
  403. //
  404. // Following types  are used to inquire state characteristics of the device after
  405. // it had been opened.
  406. //
  407. // Device configuration structure contains configurable parameters reflecting
  408. // current state of the device
  409. //
  410. //
  411. // Device hardware status.
  412. //
  413.  
  414. //
  415. // Individual bits for state acquiring  through StatusMask
  416. //
  417.  
  418. // State of hardware as known to USD
  419. #define STI_DEVSTATUS_ONLINE_STATE      0x0001
  420.  
  421. // State of pending events ( as known to USD)
  422. #define STI_DEVSTATUS_EVENTS_STATE      0x0002
  423.  
  424. //
  425. // Online state values
  426. //
  427. #define STI_ONLINESTATE_OPERATIONAL         0x00000001
  428. #define STI_ONLINESTATE_PENDING             0x00000002
  429. #define STI_ONLINESTATE_ERROR               0x00000004
  430. #define STI_ONLINESTATE_PAUSED              0x00000008
  431. #define STI_ONLINESTATE_PAPER_JAM           0x00000010
  432. #define STI_ONLINESTATE_PAPER_PROBLEM       0x00000020
  433. #define STI_ONLINESTATE_OFFLINE             0x00000040
  434. #define STI_ONLINESTATE_IO_ACTIVE           0x00000080
  435. #define STI_ONLINESTATE_BUSY                0x00000100
  436. #define STI_ONLINESTATE_TRANSFERRING        0x00000200
  437. #define STI_ONLINESTATE_INITIALIZING        0x00000400
  438. #define STI_ONLINESTATE_WARMING_UP          0x00000800
  439. #define STI_ONLINESTATE_USER_INTERVENTION   0x00001000
  440. #define STI_ONLINESTATE_POWER_SAVE          0x00002000
  441.  
  442. //
  443. // Event processing parameters
  444. //
  445. #define STI_EVENTHANDLING_ENABLED           0x00000001
  446. #define STI_EVENTHANDLING_POLLING           0x00000002
  447. #define STI_EVENTHANDLING_PENDING           0x00000004
  448.  
  449. typedef struct _STI_DEVICE_STATUS {
  450.  
  451.     DWORD   dwSize;
  452.  
  453.     // Request field - bits of status to verify
  454.     DWORD   StatusMask;
  455.  
  456.     //
  457.     // Fields are set when status mask contains STI_DEVSTATUS_ONLINE_STATE bit set
  458.     //
  459.     // Bitmask describing  device state
  460.     DWORD   dwOnlineState;
  461.  
  462.     // Device status code as defined by vendor
  463.     DWORD   dwHardwareStatusCode;
  464.  
  465.     //
  466.     // Fields are set when status mask contains STI_DEVSTATUS_EVENTS_STATE bit set
  467.     //
  468.  
  469.     // State of device notification processing (enabled, pending)
  470.     DWORD   dwEventHandlingState;
  471.  
  472.     // If device is polled, polling interval in ms
  473.     DWORD   dwPollingInterval;
  474.  
  475. } STI_DEVICE_STATUS,*PSTI_DEVICE_STATUS;
  476.  
  477. //
  478. // Structure to describe diagnostic ( test ) request to be processed by USD
  479. //
  480.  
  481. // Basic test for presence of associated hardware
  482. #define STI_DIAGCODE_HWPRESENCE         0x00000001
  483.  
  484. //
  485. // Status bits for diagnostic
  486. //
  487.  
  488. //
  489. // generic diagnostic errors
  490. //
  491.  
  492. typedef struct _ERROR_INFOW {
  493.  
  494.     DWORD   dwSize;
  495.  
  496.     // Generic error , describing results of last operation
  497.     DWORD   dwGenericError;
  498.  
  499.     // vendor specific error code
  500.     DWORD   dwVendorError;
  501.  
  502.     // String, describing in more details results of last operation if it failed
  503.     WCHAR   szExtendedErrorText[255];
  504.  
  505. } STI_ERROR_INFOW,*PSTI_ERROR_INFOW;
  506.  
  507. typedef struct _ERROR_INFOA {
  508.  
  509.     DWORD   dwSize;
  510.  
  511.     DWORD   dwGenericError;
  512.     DWORD   dwVendorError;
  513.  
  514.     CHAR   szExtendedErrorText[255];
  515.  
  516. } STI_ERROR_INFOA,*PSTI_ERROR_INFOA;
  517.  
  518. #if defined(UNICODE) || defined(STI_UNICODE)
  519. typedef STI_ERROR_INFOW STI_ERROR_INFO;
  520. #else
  521. typedef STI_ERROR_INFOA STI_ERROR_INFO;
  522. #endif
  523.  
  524. typedef STI_ERROR_INFO* PSTI_ERROR_INFO;
  525.  
  526. typedef struct _STI_DIAG {
  527.  
  528.     DWORD   dwSize;
  529.  
  530.     // Diagnostic request fields. Are set on request by caller
  531.  
  532.     // One of the
  533.     DWORD   dwBasicDiagCode;
  534.     DWORD   dwVendorDiagCode;
  535.  
  536.     // Response fields
  537.     DWORD   dwStatusMask;
  538.  
  539.     STI_ERROR_INFO  sErrorInfo;
  540.  
  541. } STI_DIAG,*LPSTI_DIAG;
  542.  
  543. //
  544. typedef STI_DIAG    DIAG;
  545. typedef LPSTI_DIAG  LPDIAG;
  546.  
  547.  
  548. // end device state information.
  549.  
  550. //
  551. // Flags passed to WriteToErrorLog call in a first parameter, indicating type of the message
  552. // which needs to be logged
  553. //
  554. #define STI_TRACE_INFORMATION       0x00000001
  555. #define STI_TRACE_WARNING           0x00000002
  556. #define STI_TRACE_ERROR             0x00000004
  557.  
  558. //
  559. // Event notification mechansims.
  560. // ------------------------------
  561. //
  562. // Those are used to inform last subscribed caller of the changes in device state, initiated by
  563. // device.
  564. //
  565. // The only supported discipline of notification is stack. The last caller to subscribe will be notified
  566. // and will receive notification data. After caller unsubscribes , the previously subscribed caller will
  567. // become active.
  568. //
  569.  
  570. // Notifications are sent to subscriber via window message. Window handle is passed as
  571. // parameter
  572. #define STI_SUBSCRIBE_FLAG_WINDOW   0x0001
  573.  
  574. // Device notification is signalling Win32 event ( auto-set event). Event handle
  575. // is passed as a parameter
  576. #define STI_SUBSCRIBE_FLAG_EVENT    0x0002
  577.  
  578. typedef struct _STISUBSCRIBE {
  579.  
  580.     DWORD   dwSize;
  581.  
  582.     DWORD   dwFlags;
  583.  
  584.     // Not used . Will be used for subscriber to set bit mask filtering different events
  585.     DWORD   dwFilter;
  586.  
  587.     // When STI_SUBSCRIBE_FLAG_WINDOW bit is set, following fields should be set
  588.     // Handle of the window which will receive notification message
  589.     HWND    hWndNotify;
  590.  
  591.     // Handle of Win32 auto-reset event , which will be signalled whenever device has
  592.     // notification pending
  593.     HANDLE  hEvent;
  594.  
  595.     // Code of notification message, sent to window
  596.     UINT    uiNotificationMessage;
  597.  
  598. } STISUBSCRIBE,*LPSTISUBSCRIBE;
  599.  
  600. #define MAX_NOTIFICATION_DATA   64
  601.  
  602.  
  603. //
  604. // Structure to describe notification information
  605. //
  606. typedef struct _STINOTIFY {
  607.  
  608.     DWORD   dwSize;                 // Total size of the notification structure
  609.  
  610.     // GUID of the notification being retrieved
  611.     GUID    guidNotificationCode;
  612.  
  613.     // Vendor specific notification description
  614.     BYTE    abNotificationData[MAX_NOTIFICATION_DATA];     // USD specific
  615.  
  616. } STINOTIFY,*LPSTINOTIFY;
  617.  
  618.  
  619. // end event_mechanisms
  620.  
  621. //
  622. // STI device broadcasting
  623. //
  624.  
  625. //
  626. // When STI Device is being added or removed, PnP broadacst is being sent , but it is not obvious
  627. // for application code to recognize if it is STI device and if so, what is the name of the
  628. // device. STI subsystem will analyze PnP broadcasts and rebroadcast another message via
  629. // BroadcastSystemMessage / WM_DEVICECHANGE / DBT_USERDEFINED .
  630.  
  631. // String passed as user defined message contains STI prefix, action and device name
  632.  
  633. #define STI_ADD_DEVICE_BROADCAST_ACTION     "Arrival"
  634. #define STI_REMOVE_DEVICE_BROADCAST_ACTION  "Removal"
  635.  
  636. #define STI_ADD_DEVICE_BROADCAST_STRING     "STI\\" STI_ADD_DEVICE_BROADCAST_ACTION "\\%s"
  637. #define STI_REMOVE_DEVICE_BROADCAST_STRING  "STI\\" STI_REMOVE_DEVICE_BROADCAST_ACTION "\\%s"
  638.  
  639.  
  640. // end STI broadcasting
  641.  
  642.  
  643. //
  644. // Device create modes
  645. //
  646.  
  647. // Device is being opened only for status querying and notifications receiving
  648. #define STI_DEVICE_CREATE_STATUS         0x00000001
  649.  
  650. // Device is being opened for data transfer ( supersedes status mode)
  651. #define STI_DEVICE_CREATE_DATA           0x00000002
  652.  
  653. #define STI_DEVICE_CREATE_BOTH           0x00000003
  654.  
  655. //
  656. // Bit mask for legitimate mode bits, which can be used when calling CreateDevice
  657. //
  658. #define STI_DEVICE_CREATE_MASK           0x0000FFFF
  659.  
  660. //
  661. // Flags controlling device enumeration
  662. //
  663. #define STIEDFL_ALLDEVICES             0x00000000
  664. #define STIEDFL_ATTACHEDONLY           0x00000001
  665.  
  666. //
  667. // Control code , sent to the device through raw control interface
  668. //
  669. typedef  DWORD STI_RAW_CONTROL_CODE;
  670.  
  671. //
  672. // All raw codes below this one are reserved for future use.
  673. //
  674. #define STI_RAW_RESERVED    0x1000
  675.  
  676.  /*
  677.   * COM Interfaces to STI
  678.   */
  679.  
  680. #ifdef __cplusplus
  681.  
  682. /* 'struct' not 'class' per the way DECLARE_INTERFACE_ is defined */
  683. interface IStillImageW;
  684. interface IStillImageA;
  685.  
  686. interface IStiDevice;
  687.  
  688. #endif
  689.  
  690. #ifndef MIDL_PASS
  691.  
  692. //DLLEXP STDMETHODIMP StiCreateInstanceW(HINSTANCE hinst, DWORD dwVer, interface IStillImageW **ppSti, LPUNKNOWN punkOuter);
  693. //DLLEXP STDMETHODIMP StiCreateInstanceA(HINSTANCE hinst, DWORD dwVer, interface IStillImageA **ppSti, LPUNKNOWN punkOuter);
  694. STDMETHODIMP StiCreateInstanceW(HINSTANCE hinst, DWORD dwVer, interface IStillImageW **ppSti, LPUNKNOWN punkOuter);
  695. STDMETHODIMP StiCreateInstanceA(HINSTANCE hinst, DWORD dwVer, interface IStillImageA **ppSti, LPUNKNOWN punkOuter);
  696.  
  697. #if defined(UNICODE) || defined(STI_UNICODE)
  698. #define IID_IStillImage     IID_IStillImageW
  699. #define IStillImage         IStillImageW
  700. #define StiCreateInstance   StiCreateInstanceW
  701. #else
  702. #define IID_IStillImage     IID_IStillImageA
  703. #define IStillImage         IStillImageA
  704. #define StiCreateInstance   StiCreateInstanceA
  705. #endif
  706.  
  707. typedef interface IStiDevice              *LPSTILLIMAGEDEVICE;
  708.  
  709. typedef interface IStillImage             *PSTI;
  710. typedef interface IStiDevice              *PSTIDEVICE;
  711.  
  712. typedef interface IStillImageA            *PSTIA;
  713. typedef interface IStiDeviceA             *PSTIDEVICEA;
  714.  
  715. typedef interface IStillImageW            *PSTIW;
  716. typedef interface IStiDeviceW             *PSTIDEVICEW;
  717.  
  718. //DLLEXP STDMETHODIMP StiCreateInstance(HINSTANCE hinst, DWORD dwVer, PSTI *ppSti, LPUNKNOWN punkOuter);
  719.  
  720. /*
  721.  * IStillImage interface
  722.  *
  723.  * Top level STI access interface.
  724.  *
  725.  */
  726.  
  727. #undef INTERFACE
  728. #define INTERFACE IStillImageW
  729. DECLARE_INTERFACE_(IStillImageW, IUnknown)
  730. {
  731.     /*** IUnknown methods ***/
  732.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  733.     STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  734.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  735.  
  736.     /*** IStillImage methods ***/
  737.     STDMETHOD(Initialize) (THIS_ HINSTANCE hinst,DWORD dwVersion) PURE;
  738.  
  739.     STDMETHOD(GetDeviceList)(THIS_ DWORD dwType,DWORD dwFlags,DWORD *pdwItemsReturned,LPVOID *ppBuffer) PURE;
  740.     STDMETHOD(GetDeviceInfo)(THIS_ LPWSTR  pwszDeviceName, LPVOID *ppBuffer) PURE;
  741.  
  742.     STDMETHOD(CreateDevice) (THIS_ LPWSTR  pwszDeviceName, DWORD   dwMode, PSTIDEVICE *pDevice,LPUNKNOWN punkOuter) PURE;
  743.  
  744.     //
  745.     // Device instance values. Used to associate various data with device.
  746.     //
  747.     STDMETHOD(GetDeviceValue)(THIS_ LPWSTR  pwszDeviceName,LPWSTR    pValueName,LPDWORD  pType,LPBYTE   pData,LPDWORD    cbData);
  748.     STDMETHOD(SetDeviceValue)(THIS_ LPWSTR  pwszDeviceName,LPWSTR   pValueName,DWORD   Type,LPBYTE  pData,DWORD   cbData);
  749.  
  750.     //
  751.     // For appllication started through push model launch, returns associated information
  752.     //
  753.     STDMETHOD(GetSTILaunchInformation)(THIS_ LPWSTR  pwszDeviceName, DWORD *pdwEventCode,LPWSTR  pwszEventName) PURE;
  754.     STDMETHOD(RegisterLaunchApplication)(THIS_ LPWSTR  pwszAppName,LPWSTR  pwszCommandLine) PURE;
  755.     STDMETHOD(UnregisterLaunchApplication)(THIS_ LPWSTR  pwszAppName) PURE;
  756.  
  757.     //
  758.     // To control state of notification handling. For polled devices this means state of monitor
  759.     // polling, for true notification devices means enabling/disabling notification flow
  760.     // from monitor to registered applications
  761.     //
  762.     STDMETHOD(EnableHwNotifications)(THIS_ LPCWSTR  pwszDeviceName,BOOL bNewState) PURE;
  763.     STDMETHOD(GetHwNotificationState)(THIS_ LPCWSTR  pwszDeviceName,BOOL *pbCurrentState) PURE;
  764.  
  765.     //
  766.     // When device is installed but not accessible, application may request bus refresh
  767.     // which in some cases will make device known. This is mainly used for nonPnP buses
  768.     // like SCSI, when device was powered on after PnP enumeration
  769.     //
  770.     //
  771.     STDMETHOD(RefreshDeviceBus)(THIS_ LPCWSTR  pwszDeviceName) PURE;
  772.  
  773.     //
  774.     // Launch application to emulate event on a device. Used by "control center" style components,
  775.     // which intercept device event , analyze and later force launch based on certain criteria.
  776.     //
  777.     STDMETHOD(LaunchApplicationForDevice)(THIS_ LPWSTR  pwszDeviceName,LPWSTR    pwszAppName,LPSTINOTIFY    pStiNotify);
  778.  
  779.     //
  780.     // For non-PnP devices with non-known bus type connection, setup extension, associated with the
  781.     // device can set it's parameters
  782.     //
  783.     STDMETHOD(SetupDeviceParameters)(THIS_ PSTI_DEVICE_INFORMATIONW);
  784.  
  785.     //
  786.     // Write message to STI error log
  787.     //
  788.     STDMETHOD(WriteToErrorLog)(THIS_ DWORD dwMessageType,LPCWSTR pszMessage) PURE;
  789.  
  790.     #ifdef NOT_IMPLEMENTED
  791.  
  792.         //
  793.         // TO register application for receiving various STI notifications
  794.         //
  795.         STIMETHOD(RegisterDeviceNotification(THIS_ LPWSTR  pwszAppName,LPSUBSCRIBE lpSubscribe) PURE;
  796.         STIMETHOD(UnregisterDeviceNotification(THIS_ ) PURE;
  797.  
  798.     #endif //NOT_IMPLEMENTED
  799.  
  800. };
  801.  
  802. typedef struct IStillImageW *LPSTILLIMAGEW;
  803.  
  804. #undef INTERFACE
  805. #define INTERFACE IStillImageA
  806. DECLARE_INTERFACE_(IStillImageA, IUnknown)
  807. {
  808.     /*** IUnknown methods ***/
  809.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  810.     STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  811.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  812.  
  813.     /*** IStillImage methods ***/
  814.     STDMETHOD(Initialize) (THIS_ HINSTANCE hinst,DWORD dwVersion) PURE;
  815.  
  816.     STDMETHOD(GetDeviceList)(THIS_ DWORD dwType,DWORD dwFlags,DWORD *pdwItemsReturned,LPVOID *ppBuffer) PURE;
  817.     STDMETHOD(GetDeviceInfo)(THIS_ LPCSTR  pwszDeviceName, LPVOID *ppBuffer) PURE;
  818.  
  819.     STDMETHOD(CreateDevice) (THIS_ LPCSTR  pwszDeviceName, DWORD   dwMode, PSTIDEVICE *pDevice,LPUNKNOWN punkOuter) PURE;
  820.  
  821.     //
  822.     // Device instance values. Used to associate various data with device.
  823.     //
  824.     STDMETHOD(GetDeviceValue)(THIS_ LPCSTR  pwszDeviceName,LPCSTR   pValueName,LPDWORD  pType,LPBYTE   pData,LPDWORD    cbData);
  825.     STDMETHOD(SetDeviceValue)(THIS_ LPCSTR  pwszDeviceName,LPCSTR   pValueName,DWORD   Type,LPBYTE  pData,DWORD   cbData);
  826.  
  827.     //
  828.     // For appllication started through push model launch, returns associated information
  829.     //
  830.     STDMETHOD(GetSTILaunchInformation)(THIS_ LPSTR  pwszDeviceName, DWORD *pdwEventCode,LPSTR  pwszEventName) PURE;
  831.     STDMETHOD(RegisterLaunchApplication)(THIS_ LPCSTR  pwszAppName,LPCSTR  pwszCommandLine) PURE;
  832.     STDMETHOD(UnregisterLaunchApplication)(THIS_ LPCSTR  pwszAppName) PURE;
  833.  
  834.     //
  835.     // To control state of notification handling. For polled devices this means state of monitor
  836.     // polling, for true notification devices means enabling/disabling notification flow
  837.     // from monitor to registered applications
  838.     //
  839.     STDMETHOD(EnableHwNotifications)(THIS_ LPCSTR  pwszDeviceName,BOOL bNewState) PURE;
  840.     STDMETHOD(GetHwNotificationState)(THIS_ LPCSTR  pwszDeviceName,BOOL *pbCurrentState) PURE;
  841.  
  842.     //
  843.     // When device is installed but not accessible, application may request bus refresh
  844.     // which in some cases will make device known. This is mainly used for nonPnP buses
  845.     // like SCSI, when device was powered on after PnP enumeration
  846.     //
  847.     //
  848.     STDMETHOD(RefreshDeviceBus)(THIS_ LPCSTR  pwszDeviceName) PURE;
  849.  
  850.     //
  851.     // Launch application to emulate event on a device. Used by "control center" style components,
  852.     // which intercept device event , analyze and later force launch based on certain criteria.
  853.     //
  854.     STDMETHOD(LaunchApplicationForDevice)(THIS_ LPCSTR    pwszDeviceName,LPCSTR    pwszAppName,LPSTINOTIFY    pStiNotify);
  855.  
  856.  
  857.     //
  858.     // For non-PnP devices with non-known bus type connection, setup extension, associated with the
  859.     // device can set it's parameters
  860.     //
  861.     STDMETHOD(SetupDeviceParameters)(THIS_ PSTI_DEVICE_INFORMATIONA);
  862.  
  863.     //
  864.     // Write message to STI error log
  865.     //
  866.     STDMETHOD(WriteToErrorLog)(THIS_ DWORD dwMessageType,LPCSTR pszMessage) PURE;
  867.  
  868.     #ifdef NOT_IMPLEMENTED
  869.  
  870.         //
  871.         // TO register application for receiving various STI notifications
  872.         //
  873.         STIMETHOD(RegisterDeviceNotification(THIS_ LPWSTR  pwszAppName,LPSUBSCRIBE lpSubscribe) PURE;
  874.         STIMETHOD(UnregisterDeviceNotification(THIS_ ) PURE;
  875.  
  876.     #endif //NOT_IMPLEMENTED
  877.  
  878. };
  879.  
  880. typedef struct IStillImageA *LPSTILLIMAGEA;
  881.  
  882. #if defined(UNICODE) || defined(STI_UNICODE)
  883. #define IStillImageVtbl     IStillImageWVtbl
  884. #else
  885. #define IStillImageVtbl     IStillImageAVtbl
  886. #endif
  887.  
  888. typedef struct IStillImage  *LPSTILLIMAGE;
  889.  
  890. #if !defined(__cplusplus) || defined(CINTERFACE)
  891. #define IStillImage_QueryInterface(p,a,b)       (p)->lpVtbl->QueryInterface(p,a,b)
  892. #define IStillImage_AddRef(p)                   (p)->lpVtbl->AddRef(p)
  893. #define IStillImage_Release(p)                  (p)->lpVtbl->Release(p)
  894. #define IStillImage_Initialize(p,a,b)           (p)->lpVtbl->Initialize(p,a,b)
  895.  
  896. #define IStillImage_GetDeviceList(p,a,b,c,d)    (p)->lpVtbl->GetDeviceList(p,a,b,c,d)
  897. #define IStillImage_GetDeviceInfo(p,a,b)        (p)->lpVtbl->GetDeviceInfo(p,a,b)
  898. #define IStillImage_CreateDevice(p,a,b,c,d)     (p)->lpVtbl->CreateDevice(p,a,b,c,d)
  899. #define IStillImage_GetDeviceValue(p,a,b,c,d,e)           (p)->lpVtbl->GetDeviceValue(p,a,b,c,d,e)
  900. #define IStillImage_SetDeviceValue(p,a,b,c,d,e)           (p)->lpVtbl->SetDeviceValue(p,a,b,c,d,e)
  901. #define IStillImage_GetSTILaunchInformation(p,a,b,c)      (p)->lpVtbl->GetSTILaunchInformation(p,a,b,c)
  902. #define IStillImage_RegisterLaunchApplication(p,a,b)      (p)->lpVtbl->RegisterLaunchApplication(p,a,b)
  903. #define IStillImage_UnregisterLaunchApplication(p,a)      (p)->lpVtbl->UnregisterLaunchApplication(p,a)
  904. #define IStillImage_EnableHwNotifications(p,a,b)          (p)->lpVtbl->EnableHwNotifications(p,a,b)
  905. #define IStillImage_GetHwNotificationState(p,a,b)         (p)->lpVtbl->GetHwNotificationState(p,a,b)
  906. #define IStillImage_RefreshDeviceBus(p,a)                 (p)->lpVtbl->RefreshDeviceBus(p,a)
  907.  
  908. #endif
  909.  
  910. /*
  911.  * IStillImage_Device interface
  912.  *
  913.  * This is generic per device interface. Specialized interfaces are also
  914.  * available
  915.  */
  916. #undef INTERFACE
  917. #define INTERFACE IStiDevice
  918. DECLARE_INTERFACE_(IStiDevice, IUnknown)
  919. {
  920.     /*** IUnknown methods ***/
  921.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  922.     STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  923.     STDMETHOD_(ULONG, Release) (THIS) PURE;
  924.  
  925.     /*** IStiDevice methods ***/
  926.     STDMETHOD(Initialize) (THIS_ HINSTANCE hinst,LPCWSTR pwszDeviceName,DWORD dwVersion,DWORD  dwMode) PURE;
  927.  
  928.     STDMETHOD(GetCapabilities) (THIS_ PSTI_DEV_CAPS pDevCaps) PURE;
  929.  
  930.     STDMETHOD(GetStatus) (THIS_ PSTI_DEVICE_STATUS pDevStatus) PURE;
  931.  
  932.     STDMETHOD(DeviceReset)(THIS ) PURE;
  933.     STDMETHOD(Diagnostic)(THIS_ LPSTI_DIAG pBuffer) PURE;
  934.  
  935.     STDMETHOD(Escape)(THIS_ STI_RAW_CONTROL_CODE    EscapeFunction,LPVOID  lpInData,DWORD   cbInDataSize,LPVOID pOutData,DWORD dwOutDataSize,LPDWORD pdwActualData) PURE ;
  936.  
  937.     STDMETHOD(GetLastError) (THIS_ LPDWORD pdwLastDeviceError) PURE;
  938.  
  939.     STDMETHOD(LockDevice) (THIS_ DWORD dwTimeOut) PURE;
  940.     STDMETHOD(UnLockDevice) (THIS ) PURE;
  941.  
  942.     STDMETHOD(RawReadData)(THIS_ LPVOID lpBuffer,LPDWORD lpdwNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE;
  943.     STDMETHOD(RawWriteData)(THIS_ LPVOID lpBuffer,DWORD nNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE;
  944.  
  945.     STDMETHOD(RawReadCommand)(THIS_ LPVOID lpBuffer,LPDWORD lpdwNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE;
  946.     STDMETHOD(RawWriteCommand)(THIS_ LPVOID lpBuffer,DWORD nNumberOfBytes,LPOVERLAPPED lpOverlapped) PURE;
  947.  
  948.     //
  949.     // Subscription is used to enable "control center" style applications , where flow of
  950.     // notifications should be redirected from monitor itself to another "launcher"
  951.     //
  952.     STDMETHOD(Subscribe)(THIS_ LPSTISUBSCRIBE lpSubsribe) PURE;
  953.     STDMETHOD(GetLastNotificationData)(THIS_ LPSTINOTIFY   lpNotify) PURE;
  954.     STDMETHOD(UnSubscribe)(THIS ) PURE;
  955.  
  956.     STDMETHOD(GetLastErrorInfo) (THIS_ STI_ERROR_INFO *pLastErrorInfo) PURE;
  957. };
  958.  
  959. #if !defined(__cplusplus) || defined(CINTERFACE)
  960. #define IStiDevice_QueryInterface(p,a,b)        (p)->lpVtbl->QueryInterface(p,a,b)
  961. #define IStiDevice_AddRef(p)                    (p)->lpVtbl->AddRef(p)
  962. #define IStiDevice_Release(p)                   (p)->lpVtbl->Release(p)
  963. #define IStiDevice_Initialize(p,a,b,c,d)        (p)->lpVtbl->Initialize(p,a,b,c,d)
  964.  
  965. #define IStiDevice_GetCapabilities(p,a)         (p)->lpVtbl->GetCapabilities(p,a)
  966. #define IStiDevice_GetStatus(p,a)               (p)->lpVtbl->GetStatus(p,a)
  967. #define IStiDevice_DeviceReset(p)               (p)->lpVtbl->DeviceReset(p)
  968. #define IStiDevice_LockDevice(p,a)              (p)->lpVtbl->LockDevice(p,a)
  969. #define IStiDevice_UnLockDevice(p)              (p)->lpVtbl->UnLockDevice(p)
  970.  
  971. #define IStiDevice_Diagnostic(p,a)              (p)->lpVtbl->Diagnostic(p,a)
  972. #define IStiDevice_Escape(p,a,b,c,d,e,f)        (p)->lpVtbl->Escape(p,a,b,c,d,e,f)
  973. #define IStiDevice_GetLastError(p,a)            (p)->lpVtbl->GetLastError(p,a)
  974. #define IStiDevice_RawReadData(p,a,b,c)         (p)->lpVtbl->RawReadData(p,a,b,c)
  975. #define IStiDevice_RawWriteData(p,a,b,c)        (p)->lpVtbl->RawWriteData(p,a,b,c)
  976. #define IStiDevice_RawReadCommand(p,a,b,c)      (p)->lpVtbl->RawReadCommand(p,a,b,c)
  977. #define IStiDevice_RawWriteCommand(p,a,b,c)     (p)->lpVtbl->RawWriteCommand(p,a,b,c)
  978.  
  979. #define IStiDevice_Subscribe(p,a)               (p)->lpVtbl->Subscribe(p,a)
  980. #define IStiDevice_GetNotificationData(p,a)     (p)->lpVtbl->GetNotificationData(p,a)
  981. #define IStiDevice_UnSubscribe(p)               (p)->lpVtbl->UnSubscribe(p)
  982.  
  983. #define IStiDevice_GetLastErrorInfo(p,a)        (p)->lpVtbl->GetLastErrorInfo(p,a)
  984.  
  985. #endif
  986.  
  987. #endif  // MIDL_PASS
  988.  
  989. #ifdef __cplusplus
  990. };
  991. #endif
  992.  
  993. //
  994. // Reset packing
  995. //
  996. #include <poppack.h>
  997.  
  998. #pragma option pop /*P_O_Pop*/
  999. #endif // _STICOM_
  1000.  
  1001.  
  1002.  
  1003.