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.

264 lines
10 KiB

  1. /*****************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 1999 - 2000
  4. *
  5. * TITLE: globals.cpp
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: RickTu
  10. *
  11. * DATE: 9/16/99
  12. *
  13. * DESCRIPTION: Globals for this module
  14. *
  15. *****************************************************************************/
  16. #include <precomp.h>
  17. #pragma hdrstop
  18. PROPID gItemPropIDs[NUM_CAM_ITEM_PROPS] = {
  19. WIA_IPA_DATATYPE,
  20. WIA_IPA_DEPTH,
  21. WIA_IPA_PIXELS_PER_LINE,
  22. WIA_IPA_NUMBER_OF_LINES,
  23. WIA_IPC_THUMBNAIL,
  24. WIA_IPA_ITEM_TIME,
  25. WIA_IPC_THUMB_WIDTH,
  26. WIA_IPC_THUMB_HEIGHT,
  27. WIA_IPA_PREFERRED_FORMAT,
  28. WIA_IPA_ITEM_SIZE,
  29. WIA_IPA_FORMAT,
  30. WIA_IPA_TYMED,
  31. WIA_IPA_COMPRESSION,
  32. WIA_IPA_CHANNELS_PER_PIXEL,
  33. WIA_IPA_BITS_PER_CHANNEL,
  34. WIA_IPA_PLANAR,
  35. WIA_IPA_BYTES_PER_LINE,
  36. WIA_IPA_ACCESS_RIGHTS,
  37. WIA_IPA_MIN_BUFFER_SIZE
  38. };
  39. LPOLESTR gItemPropNames[NUM_CAM_ITEM_PROPS] =
  40. {
  41. WIA_IPA_DATATYPE_STR,
  42. WIA_IPA_DEPTH_STR,
  43. WIA_IPA_PIXELS_PER_LINE_STR,
  44. WIA_IPA_NUMBER_OF_LINES_STR,
  45. WIA_IPC_THUMBNAIL_STR,
  46. WIA_IPA_ITEM_TIME_STR,
  47. WIA_IPC_THUMB_WIDTH_STR,
  48. WIA_IPC_THUMB_HEIGHT_STR,
  49. WIA_IPA_PREFERRED_FORMAT_STR,
  50. WIA_IPA_ITEM_SIZE_STR,
  51. WIA_IPA_FORMAT_STR,
  52. WIA_IPA_TYMED_STR,
  53. WIA_IPA_COMPRESSION_STR,
  54. WIA_IPA_CHANNELS_PER_PIXEL_STR,
  55. WIA_IPA_BITS_PER_CHANNEL_STR,
  56. WIA_IPA_PLANAR_STR,
  57. WIA_IPA_BYTES_PER_LINE_STR,
  58. WIA_IPA_ACCESS_RIGHTS_STR,
  59. WIA_IPA_MIN_BUFFER_SIZE_STR
  60. };
  61. PROPID gItemCameraPropIDs[WIA_NUM_IPC] = {
  62. WIA_IPC_AUDIO_AVAILABLE,
  63. WIA_IPC_AUDIO_DATA
  64. };
  65. LPOLESTR gItemCameraPropNames[WIA_NUM_IPC] =
  66. {
  67. WIA_IPC_AUDIO_AVAILABLE_STR,
  68. WIA_IPC_AUDIO_DATA_STR,
  69. };
  70. PROPID gDevicePropIDs[NUM_CAM_DEV_PROPS] =
  71. {
  72. WIA_DPA_CONNECT_STATUS,
  73. WIA_DPC_PICTURES_TAKEN,
  74. WIA_DPC_THUMB_WIDTH,
  75. WIA_DPC_THUMB_HEIGHT,
  76. WIA_DPV_DSHOW_DEVICE_PATH,
  77. WIA_DPV_IMAGES_DIRECTORY,
  78. WIA_DPV_LAST_PICTURE_TAKEN
  79. };
  80. LPOLESTR gDevicePropNames[NUM_CAM_DEV_PROPS] =
  81. {
  82. WIA_DPA_CONNECT_STATUS_STR,
  83. WIA_DPC_PICTURES_TAKEN_STR,
  84. WIA_DPC_THUMB_WIDTH_STR,
  85. WIA_DPC_THUMB_HEIGHT_STR,
  86. WIA_DPV_DSHOW_DEVICE_PATH_STR,
  87. WIA_DPV_IMAGES_DIRECTORY_STR,
  88. WIA_DPV_LAST_PICTURE_TAKEN_STR
  89. };
  90. PROPSPEC gDevicePropSpecDefaults[NUM_CAM_DEV_PROPS] = {
  91. {PRSPEC_PROPID, WIA_DPA_CONNECT_STATUS},
  92. {PRSPEC_PROPID, WIA_DPC_PICTURES_TAKEN},
  93. {PRSPEC_PROPID, WIA_DPC_THUMB_WIDTH},
  94. {PRSPEC_PROPID, WIA_DPC_THUMB_HEIGHT},
  95. {PRSPEC_PROPID, WIA_DPV_DSHOW_DEVICE_PATH},
  96. {PRSPEC_PROPID, WIA_DPV_IMAGES_DIRECTORY},
  97. {PRSPEC_PROPID, WIA_DPV_LAST_PICTURE_TAKEN}
  98. };
  99. WIA_PROPERTY_INFO gDevPropInfoDefaults[NUM_CAM_DEV_PROPS] = {
  100. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPA_CONNECT_STATUS
  101. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_PICTURES_TAKEN
  102. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_THUMB_WIDTH
  103. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_DPC_THUMB_HEIGHT
  104. {WIA_PROP_READ | WIA_PROP_NONE, VT_LPWSTR, 0, 0, 0, 0}, // WIA_DPV_DSHOW_DEVICE_PATH
  105. {WIA_PROP_READ | WIA_PROP_NONE, VT_LPWSTR, 0, 0, 0, 0}, // WIA_DPV_IMAGES_DIRECTORY
  106. {WIA_PROP_RW | WIA_PROP_NONE, VT_LPWSTR, 0, 0, 0, 0} // WIA_DPV_LAST_PICTURE_TAKEN
  107. };
  108. PROPSPEC gPropSpecDefaults[NUM_CAM_ITEM_PROPS] = {
  109. {PRSPEC_PROPID, WIA_IPA_DATATYPE},
  110. {PRSPEC_PROPID, WIA_IPA_DEPTH},
  111. {PRSPEC_PROPID, WIA_IPA_PIXELS_PER_LINE},
  112. {PRSPEC_PROPID, WIA_IPA_NUMBER_OF_LINES},
  113. {PRSPEC_PROPID, WIA_IPC_THUMBNAIL},
  114. {PRSPEC_PROPID, WIA_IPA_ITEM_TIME},
  115. {PRSPEC_PROPID, WIA_IPC_THUMB_WIDTH},
  116. {PRSPEC_PROPID, WIA_IPC_THUMB_HEIGHT},
  117. {PRSPEC_PROPID, WIA_IPA_PREFERRED_FORMAT},
  118. {PRSPEC_PROPID, WIA_IPA_ITEM_SIZE},
  119. {PRSPEC_PROPID, WIA_IPA_FORMAT},
  120. {PRSPEC_PROPID, WIA_IPA_TYMED},
  121. {PRSPEC_PROPID, WIA_IPA_COMPRESSION},
  122. {PRSPEC_PROPID, WIA_IPA_CHANNELS_PER_PIXEL},
  123. {PRSPEC_PROPID, WIA_IPA_BITS_PER_CHANNEL},
  124. {PRSPEC_PROPID, WIA_IPA_PLANAR},
  125. {PRSPEC_PROPID, WIA_IPA_BYTES_PER_LINE},
  126. {PRSPEC_PROPID, WIA_IPA_ACCESS_RIGHTS},
  127. {PRSPEC_PROPID, WIA_IPA_MIN_BUFFER_SIZE},
  128. };
  129. LONG gPropVarDefaults[(sizeof(PROPVARIANT) / sizeof(LONG)) * (NUM_CAM_ITEM_PROPS)] = {
  130. // VARTYPE reserved val pad/array ptr
  131. (LONG)VT_I4, 0x00000000, WIA_DATA_COLOR,0x00000000, // WIA_IPA_DATATYPE
  132. (LONG)VT_I4, 0x00000000, 24, 0x00000000, // WIA_IPA_DEPTH
  133. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_PIXELS_PER_LINE
  134. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_NUMBER_OF_LINES
  135. (LONG)VT_VECTOR | VT_UI1, 0x00000000, 0, 0x00000000, // WIA_IPC_THUMBNAIL
  136. (LONG)VT_VECTOR | VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_ITEM_TIME
  137. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPC_THUMB_WIDTH
  138. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPC_THUMB_HEIGHT
  139. (LONG)VT_CLSID, 0x00000000, PtrToLong(PREFFERED_FORMAT_NOM)/* BUGBUG can our dll be loaded at > 4gig ??*/,0x00000000, // WIA_IPA_PREFERRED_FORMAT
  140. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_ITEM_SIZE
  141. (LONG)VT_CLSID, 0x00000000, PtrToLong(FORMAT_NOM)/* BUGBUG can our dll be loaded at > 4gig ??*/, 0x00000000, // WIA_IPA_FORMAT
  142. (LONG)VT_I4, 0x00000000, TYMED_FILE, 0x00000000, // WIA_IPA_TYMED
  143. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_COMPRESSION
  144. (LONG)VT_I4, 0x00000000, 3, 0x00000000, // WIA_IPA_CHANNELS PER PIXEL
  145. (LONG)VT_I4, 0x00000000, 8, 0x00000000, // WIA_IPA_BITS PER CHANNEL
  146. (LONG)VT_I4, 0x00000000, WIA_PACKED_PIXEL, 0x00000000, // WIA_IPA_PLANAR
  147. (LONG)VT_I4, 0x00000000, 0, 0x00000000, // WIA_IPA_WIDTH IN BYTES
  148. (LONG)VT_I4, 0x00000000, WIA_ITEM_RD, 0x00000000, // WIA_IPA_ACCESS_RIGHTS
  149. (LONG)VT_I4, 0x00000000, 65535, 0x00000000, // WIA_IPA_MIN_BUFFER_SIZE
  150. };
  151. // Default device extended properties.
  152. #define NUM_DATATYPE 1
  153. LONG lDataTypes[NUM_DATATYPE] = {
  154. WIA_DATA_COLOR
  155. };
  156. #define NUM_DEPTH 1
  157. LONG lDepths[NUM_DEPTH] = {
  158. 24
  159. };
  160. //
  161. // Different formats supported
  162. //
  163. #define NUM_FORMAT 3
  164. GUID* pguidFormats[NUM_FORMAT] =
  165. {
  166. (GUID*) &WiaImgFmt_JPEG,
  167. (GUID*) &WiaImgFmt_MEMORYBMP,
  168. (GUID*) &WiaImgFmt_BMP
  169. };
  170. GUID g_guidFormats[NUM_FORMAT]; // FormatID's specified in pguidFormats are copied to g_guidFormats
  171. // during SetFormatAttribs
  172. //
  173. // This is an array of WIA_FORMAT_INFOs, describing the different formats
  174. // and their corresponding media types. Initialized in minidrvr.cpp
  175. //
  176. WIA_FORMAT_INFO* g_wfiTable = NULL;
  177. //
  178. // Different media types supported
  179. //
  180. #define NUM_TYMED 2
  181. LONG lTymeds [NUM_TYMED]= {
  182. TYMED_FILE,
  183. TYMED_CALLBACK,
  184. };
  185. //
  186. // Extended information for each property
  187. //
  188. WIA_PROPERTY_INFO gWiaPropInfoDefaults[NUM_CAM_ITEM_PROPS] = {
  189. {WIA_PROP_READ | WIA_PROP_LIST, VT_I4, NUM_DATATYPE, WIA_DATA_COLOR, PtrToLong(lDataTypes)/* BUGBUG can our dll be loaded at > 4gig ??*/, 0}, // WIA_IPA_DATATYPE
  190. {WIA_PROP_READ | WIA_PROP_LIST, VT_I4, NUM_DEPTH, 24, PtrToLong(lDepths)/* BUGBUG can our dll be loaded at > 4gig ??*/, 0}, // WIA_IPA_DEPTH
  191. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_PIXELS_PER_LINE
  192. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_NUMBER_OF_LINES
  193. {WIA_PROP_READ | WIA_PROP_NONE, VT_V_UI1, 0, 0, 0, 0}, // WIA_IPC_THUMBNAIL
  194. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_ITEM_TIME
  195. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPC_THUMB_WIDTH
  196. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPC_THUMB_HEIGHT
  197. {WIA_PROP_READ | WIA_PROP_NONE, VT_CLSID, 0, 0, 0, 0}, // WIA_IPA_PREFERRED_FORMAT, set later
  198. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_ITEM_SIZE
  199. {WIA_PROP_RW | WIA_PROP_LIST, VT_CLSID, 0, 0, 0, 0}, // WIA_IPA_FORMAT, set later
  200. {WIA_PROP_RW | WIA_PROP_LIST, VT_I4, NUM_TYMED, TYMED_FILE, PtrToLong(lTymeds)/* BUGBUG can our dll be loaded at > 4gig ??*/, 0}, // WIA_IPA_TYMED
  201. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_COMPRESSION
  202. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_CHANNELS
  203. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_BITS_PER_CHANNEL
  204. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_PLANAR
  205. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_BYTES_PER_LINE
  206. {WIA_PROP_RW | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_ACCESS_RIGHTS
  207. {WIA_PROP_READ | WIA_PROP_NONE, VT_I4, 0, 0, 0, 0}, // WIA_IPA_MIN_BUFFER_SIZE
  208. };
  209. //
  210. // Device capabilities. Events are listed before commands to simplify the
  211. // implementation of drvGetCapabilities(...)
  212. //
  213. #define N WIA_NOTIFICATION_EVENT
  214. #define A WIA_ACTION_EVENT
  215. #define NA (WIA_NOTIFICATION_EVENT | WIA_ACTION_EVENT)
  216. WIA_DEV_CAP_DRV gCapabilities[NUM_CAP_ENTRIES] =
  217. {
  218. {(GUID *)&WIA_EVENT_DEVICE_CONNECTED, N, L"Device connected", L"Device connected", WIA_ICON_DEVICE_CONNECTED},
  219. {(GUID *)&WIA_EVENT_DEVICE_DISCONNECTED, N, L"Device disconnected", L"Device disconnected", WIA_ICON_DEVICE_DISCONNECTED},
  220. {(GUID *)&WIA_EVENT_ITEM_CREATED, N, L"New picture created", L"New picture created", WIA_ICON_ITEM_CREATED},
  221. {(GUID *)&WIA_EVENT_ITEM_DELETED, N, L"Picture deleted", L"Picture deleted", WIA_ICON_ITEM_DELETED},
  222. {(GUID *)&WIA_CMD_TAKE_PICTURE, 0, L"Take picture", L"Take picture", WIA_ICON_TAKE_PICTURE}
  223. };