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.

1182 lines
26 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // Common utility functions
  4. //
  5. //-----------------------------------------------------------------------------
  6. #include <stdio.h>
  7. #include <windows.h>
  8. #include <objbase.h>
  9. #include <initguid.h>
  10. #include "imaging.h"
  11. #include "gdiplusimaging.h"
  12. #include "frametest.h"
  13. BOOL
  14. AnsiToUnicodeStr(
  15. const CHAR* ansiStr,
  16. WCHAR* unicodeStr,
  17. INT unicodeSize
  18. )
  19. {
  20. return MultiByteToWideChar(CP_ACP,
  21. 0,
  22. ansiStr,
  23. -1,
  24. unicodeStr,
  25. unicodeSize) > 0;
  26. }
  27. BOOL
  28. UnicodeToAnsiStr(
  29. const WCHAR* unicodeStr,
  30. CHAR* ansiStr,
  31. INT ansiSize
  32. )
  33. {
  34. return WideCharToMultiByte(
  35. CP_ACP,
  36. 0,
  37. unicodeStr,
  38. -1,
  39. ansiStr,
  40. ansiSize,
  41. NULL,
  42. NULL) > 0;
  43. }
  44. void
  45. USAGE()
  46. {
  47. printf("******************************************************\n");
  48. printf("Usage: frametest [-?] [-w width] [-h height] [-x x] [-y y] Img\n");
  49. printf("-w-----------Specify the window width. Default is 300\n");
  50. printf("-h-----------Specify the window height. Default is 300\n");
  51. printf("-x-----------Specify the window X position. Default is 0\n");
  52. printf("-y-----------Specify the window Y position. Default is 0\n");
  53. printf("-?-----------Print this usage message\n");
  54. printf("ImageFile----File to be opened\n");
  55. printf("Use PageDown and PageUp to goto next/previous page\n");
  56. }// USAGE()
  57. #define SizeofWSTR(s) (sizeof(WCHAR) * (wcslen(s) + 1))
  58. #define SizeofSTR(s) (strlen(s) + 1)
  59. //
  60. // Compose a file type filter string given an array of
  61. // ImageCodecInfo structures
  62. //
  63. CHAR*
  64. MakeFilterFromCodecs(
  65. UINT count,
  66. const ImageCodecInfo* codecs,
  67. BOOL open
  68. )
  69. {
  70. static const CHAR allFiles[] = "All Files\0*.*";
  71. // Figure out the total size of the filter string
  72. UINT index;
  73. UINT size;
  74. for ( index = size = 0; index < count; ++index )
  75. {
  76. size += SizeofWSTR(codecs[index].FormatDescription)
  77. + SizeofWSTR(codecs[index].FilenameExtension);
  78. }
  79. if ( open )
  80. {
  81. size += sizeof(allFiles);
  82. }
  83. size += sizeof(CHAR);
  84. // Allocate memory
  85. CHAR *filter = (CHAR*)malloc(size);
  86. CHAR* p = filter;
  87. const WCHAR* ws;
  88. if ( !filter )
  89. {
  90. return NULL;
  91. }
  92. if ( open )
  93. {
  94. memcpy(p, allFiles, sizeof(allFiles));
  95. p += sizeof(allFiles);
  96. }
  97. for ( index = 0; index < count; ++index )
  98. {
  99. ws = codecs[index].FormatDescription;
  100. size = SizeofWSTR(ws);
  101. if ( UnicodeToAnsiStr(ws, p, size) )
  102. {
  103. p += SizeofSTR(p);
  104. }
  105. else
  106. {
  107. break;
  108. }
  109. ws = codecs[index].FilenameExtension;
  110. size = SizeofWSTR(ws);
  111. if ( UnicodeToAnsiStr(ws, p, size) )
  112. {
  113. p += SizeofSTR(p);
  114. }
  115. else
  116. {
  117. break;
  118. }
  119. }
  120. if ( index < count )
  121. {
  122. free(filter);
  123. return NULL;
  124. }
  125. *((CHAR*)p) = '\0';
  126. return filter;
  127. }// MakeFilterFromCodecs()
  128. /****************************************************************************\
  129. *
  130. * FUNCTION : ShowMyDialog(int id,HWND hwnd,FARPROC fpfn)
  131. *
  132. * PURPOSE : This function displays a dialog box
  133. *
  134. * RETURNS : The exit code.
  135. *
  136. \****************************************************************************/
  137. BOOL
  138. ShowMyDialog(
  139. INT id,
  140. HWND hwnd,
  141. DLGPROC fpfn
  142. )
  143. {
  144. BOOL fRC;
  145. HINSTANCE hInst;
  146. hInst = (HINSTANCE)GetWindowLongPtr(hwnd, GWLP_HINSTANCE);
  147. fRC = (BOOL)DialogBox(hInst, MAKEINTRESOURCE(id), hwnd, fpfn);
  148. FreeProcInstance(fpfn);
  149. return fRC;
  150. }// ShowMyDialog()
  151. typedef struct _SFFS
  152. {
  153. // Search Find File Structure
  154. unsigned char buff[21]; // dos search info
  155. unsigned char wAttr;
  156. union
  157. {
  158. unsigned short timeVariable; // RPC47
  159. unsigned int time:16;
  160. struct
  161. {
  162. unsigned int sec : 5;
  163. unsigned int mint: 6;
  164. unsigned int hr : 5;
  165. };
  166. };
  167. union
  168. {
  169. unsigned short dateVariable;
  170. unsigned int date:16;
  171. struct
  172. {
  173. unsigned int dom : 5;
  174. unsigned int mon : 4;
  175. unsigned int yr : 7;
  176. };
  177. };
  178. unsigned long cbFile;
  179. unsigned char szFileName[13];
  180. } SFFS;
  181. VOID
  182. FileTimeToDosTime(
  183. FILETIME fileTime
  184. )
  185. {
  186. SFFS sffs;
  187. INT yr, mo, dy, sc;
  188. if ( CoFileTimeToDosDateTime(&fileTime,
  189. &sffs.dateVariable, &sffs.timeVariable))
  190. {
  191. yr = sffs.yr + 1980;
  192. mo = sffs.mon;
  193. dy = sffs.dom;
  194. // sc = (DWORD)sffs.hr * 3600 + sffs.mint * 60 + sffs.sec * 2;
  195. printf("%d:%d:%d %d:%d:%d\n", yr, mo, dy, sffs.hr, sffs.mint,sffs.sec);
  196. }
  197. }
  198. VOID
  199. DisplayTagName(PROPID id)
  200. {
  201. VERBOSE(("ID=%d [0x%x] ", id, id));
  202. // Print the TAG name according to its ID
  203. switch ( id )
  204. {
  205. case TAG_EXIF_IFD:
  206. VERBOSE(("EXIF IFD: "));
  207. break;
  208. case TAG_GPS_IFD:
  209. VERBOSE(("GPS IFD: "));
  210. break;
  211. case TAG_NEW_SUBFILE_TYPE:
  212. VERBOSE(("New Subfile Type: "));
  213. break;
  214. case TAG_SUBFILE_TYPE:
  215. VERBOSE(("Subfile Type: "));
  216. break;
  217. case TAG_IMAGE_WIDTH:
  218. VERBOSE(("Image Width: "));
  219. break;
  220. case TAG_IMAGE_HEIGHT:
  221. VERBOSE(("Image Height: "));
  222. break;
  223. case TAG_BITS_PER_SAMPLE:
  224. VERBOSE(("Bits Per Sample: "));
  225. break;
  226. case TAG_COMPRESSION:
  227. VERBOSE(("Compression: "));
  228. break;
  229. case TAG_THUMBNAIL_COMPRESSION:
  230. VERBOSE(("Thumbnail Compression: "));
  231. break;
  232. case TAG_THUMBNAIL_RESOLUTION_X:
  233. VERBOSE(("Thumbnail X resolution: "));
  234. break;
  235. case TAG_THUMBNAIL_RESOLUTION_Y:
  236. VERBOSE(("Thumbnail Y resolution: "));
  237. break;
  238. case TAG_THUMBNAIL_RESOLUTION_UNIT:
  239. VERBOSE(("Thumbnail resolution unit: "));
  240. break;
  241. case TAG_PHOTOMETRIC_INTERP:
  242. VERBOSE(("Photometric Interpolation: "));
  243. break;
  244. case TAG_THRESH_HOLDING:
  245. VERBOSE(("Photometric Interpolation: "));
  246. break;
  247. case TAG_CELL_WIDTH:
  248. VERBOSE(("Cell Width: "));
  249. break;
  250. case TAG_CELL_HEIGHT:
  251. VERBOSE(("Cell Height: "));
  252. break;
  253. case TAG_FILL_ORDER:
  254. VERBOSE(("Fill Order: "));
  255. break;
  256. case TAG_DOCUMENT_NAME:
  257. VERBOSE(("Document name: "));
  258. break;
  259. case TAG_ORIENTATION:
  260. VERBOSE(("Orientation: "));
  261. break;
  262. case TAG_SAMPLES_PER_PIXEL:
  263. VERBOSE(("Sample Per Pixel: "));
  264. break;
  265. case TAG_PLANAR_CONFIG:
  266. VERBOSE(("Planar Configuration: "));
  267. break;
  268. case TAG_PAGE_NAME:
  269. VERBOSE(("Page Name: "));
  270. break;
  271. case TAG_X_POSITION:
  272. VERBOSE(("X Position: "));
  273. break;
  274. case TAG_Y_POSITION:
  275. VERBOSE(("Y Position: "));
  276. break;
  277. case TAG_FREE_OFFSET:
  278. VERBOSE(("Free Offset: "));
  279. break;
  280. case TAG_FREE_BYTE_COUNTS:
  281. VERBOSE(("Free Byte Count: "));
  282. break;
  283. case TAG_GRAY_RESPONSE_UNIT:
  284. VERBOSE(("Gray Response Unit: "));
  285. break;
  286. case TAG_GRAY_RESPONSE_CURVE:
  287. VERBOSE(("Gray Response Curve: "));
  288. break;
  289. case TAG_T4_OPTION:
  290. VERBOSE(("T4 Option: "));
  291. break;
  292. case TAG_T6_OPTION:
  293. VERBOSE(("T6 Option: "));
  294. break;
  295. case TAG_YCbCr_SUBSAMPLING:
  296. VERBOSE(("YCbCr Subsampling: "));
  297. break;
  298. case TAG_YCbCr_POSITIONING:
  299. VERBOSE(("YCbCr position: "));
  300. break;
  301. case TAG_MIN_SAMPLE_VALUE:
  302. VERBOSE(("Min sample value: "));
  303. break;
  304. case TAG_MAX_SAMPLE_VALUE:
  305. VERBOSE(("Max sample value: "));
  306. break;
  307. case TAG_X_RESOLUTION:
  308. VERBOSE(("X Resolution: "));
  309. break;
  310. case TAG_Y_RESOLUTION:
  311. VERBOSE(("Y Resolution: "));
  312. break;
  313. case TAG_RESOLUTION_UNIT:
  314. VERBOSE(("Resolution UNIT: "));
  315. break;
  316. case TAG_PAGE_NUMBER:
  317. VERBOSE(("Page Number: "));
  318. break;
  319. case TAG_HOST_COMPUTER:
  320. VERBOSE(("Host Computer: "));
  321. break;
  322. case TAG_PREDICTOR:
  323. VERBOSE(("Predictor: "));
  324. break;
  325. case TAG_RESOLUTION_X_UNIT:
  326. VERBOSE(("X Resolution UNIT: "));
  327. break;
  328. case TAG_RESOLUTION_Y_UNIT:
  329. VERBOSE(("Y Resolution UNIT: "));
  330. break;
  331. case TAG_RESOLUTION_X_LENGTH_UNIT:
  332. VERBOSE(("X Resolution UNIT LENGTH: "));
  333. break;
  334. case TAG_RESOLUTION_Y_LENGTH_UNIT:
  335. VERBOSE(("Y Resolution UNIT LENGTH: "));
  336. break;
  337. case TAG_STRIP_OFFSETS:
  338. VERBOSE(("Strip Offsets: "));
  339. break;
  340. case TAG_ROWS_PER_STRIP:
  341. VERBOSE(("Rows Per Strip: "));
  342. break;
  343. case TAG_STRIP_BYTES_COUNT:
  344. VERBOSE(("Strip Bytes Count: "));
  345. break;
  346. case TAG_JPEG_INTER_FORMAT:
  347. VERBOSE(("JPEG thumbnail offset: "));
  348. break;
  349. case TAG_JPEG_INTER_LENGTH:
  350. VERBOSE(("JPEG thumbnail Length: "));
  351. break;
  352. case TAG_TRANSFER_FUNCTION:
  353. VERBOSE(("Transfer Function: "));
  354. break;
  355. case TAG_WHITE_POINT:
  356. VERBOSE(("White Point: "));
  357. break;
  358. case TAG_PRIMAY_CHROMATICS:
  359. VERBOSE(("Primay_Chromatics: "));
  360. break;
  361. case TAG_COLOR_MAP:
  362. VERBOSE(("Color Map: "));
  363. break;
  364. case TAG_HALFTONE_HINTS:
  365. VERBOSE(("HalfTone Hints: "));
  366. break;
  367. case TAG_TILE_WIDTH:
  368. VERBOSE(("Tile Width: "));
  369. break;
  370. case TAG_TILE_LENGTH:
  371. VERBOSE(("Tile Height: "));
  372. break;
  373. case TAG_TILE_OFFSET:
  374. VERBOSE(("Tile Offset: "));
  375. break;
  376. case TAG_TILE_BYTE_COUNTS:
  377. VERBOSE(("Tile Byte Count: "));
  378. break;
  379. case TAG_INK_SET:
  380. VERBOSE(("Ink Set: "));
  381. break;
  382. case TAG_INK_NAMES:
  383. VERBOSE(("Ink Names: "));
  384. break;
  385. case TAG_NUMBER_OF_INKS:
  386. VERBOSE(("Number of Inks: "));
  387. break;
  388. case TAG_DOT_RANGE:
  389. VERBOSE(("Dot Range: "));
  390. break;
  391. case TAG_TARGET_PRINTER:
  392. VERBOSE(("Target Printer: "));
  393. break;
  394. case TAG_EXTRA_SAMPLES:
  395. VERBOSE(("Extra Samples: "));
  396. break;
  397. case TAG_SAMPLE_FORMAT:
  398. VERBOSE(("Sample Format: "));
  399. break;
  400. case TAG_SMIN_SAMPLE_VALUE:
  401. VERBOSE(("SMin Sample Value: "));
  402. break;
  403. case TAG_SMAX_SAMPLE_VALUE:
  404. VERBOSE(("SMax Sample Value: "));
  405. break;
  406. case TAG_TRANSFER_RANGE:
  407. VERBOSE(("Transfer Range: "));
  408. break;
  409. case TAG_JPEG_PROC:
  410. VERBOSE(("JPEG Proc: "));
  411. break;
  412. case TAG_JPEG_RESTART_INTERVAL:
  413. VERBOSE(("JPEG Restart Interval: "));
  414. break;
  415. case TAG_JPEG_LOSSLESS_PREDICTORS:
  416. VERBOSE(("JPEG Lossless Predictors: "));
  417. break;
  418. case TAG_JPEG_POINT_TRANSFORMS:
  419. VERBOSE(("JPEG Point Transforms: "));
  420. break;
  421. case TAG_JPEG_Q_TABLES:
  422. VERBOSE(("JPEG Q Tables: "));
  423. break;
  424. case TAG_JPEG_DC_TABLES:
  425. VERBOSE(("JPEG DC Tables: "));
  426. break;
  427. case TAG_JPEG_AC_TABLES:
  428. VERBOSE(("JPEG AC Tables: "));
  429. break;
  430. case TAG_YCbCr_COEFFICIENTS:
  431. VERBOSE(("YCbCr Coefficients: "));
  432. break;
  433. case TAG_REF_BLACK_WHITE:
  434. VERBOSE(("ReferenceBlackWhite: "));
  435. break;
  436. case TAG_DATE_TIME:
  437. VERBOSE(("Date Time: "));
  438. break;
  439. case TAG_IMAGE_DESCRIPTION:
  440. VERBOSE(("Description: "));
  441. break;
  442. case TAG_EQUIP_MAKE:
  443. VERBOSE(("Equipment Make "));
  444. break;
  445. case TAG_EQUIP_MODEL:
  446. VERBOSE(("Equipment Model "));
  447. break;
  448. case TAG_SOFTWARE_USED:
  449. VERBOSE(("Software Used: "));
  450. break;
  451. case TAG_ARTIST:
  452. VERBOSE(("Artist: "));
  453. break;
  454. case TAG_COPYRIGHT:
  455. VERBOSE(("Copyright: "));
  456. break;
  457. case TAG_PRINT_FLAGS:
  458. VERBOSE(("Print flags: "));
  459. break;
  460. case TAG_PRINT_FLAGS_VERSION:
  461. VERBOSE(("Print flags information---Version: "));
  462. break;
  463. case TAG_PRINT_FLAGS_CROP:
  464. VERBOSE(("Print flags information---Crop: "));
  465. break;
  466. case TAG_PRINT_FLAGS_BLEEDWIDTH:
  467. VERBOSE(("Print flags information---Bleed Width: "));
  468. break;
  469. case TAG_PRINT_FLAGS_BLEEDWIDTHSCALE:
  470. VERBOSE(("Print flags information---Bleed Width Scale: "));
  471. break;
  472. case TAG_COLORTRANSFER_FUNCTION:
  473. VERBOSE(("Color transfer function--"));
  474. break;
  475. case TAG_PIXEL_UNIT:
  476. VERBOSE(("Pixel UNIT: "));
  477. break;
  478. case TAG_PIXEL_PER_UNIT_X:
  479. VERBOSE(("Pixels Per UNIT in X: "));
  480. break;
  481. case TAG_PIXEL_PER_UNIT_Y:
  482. VERBOSE(("Pixels Per UNIT in Y: "));
  483. break;
  484. case TAG_PALETTE_HISTOGRAM:
  485. VERBOSE(("Palette histogram: "));
  486. break;
  487. case TAG_HALFTONE_LPI:
  488. VERBOSE(("Color halftoning information LPI:"));
  489. break;
  490. case TAG_HALFTONE_LPI_UNIT:
  491. VERBOSE(("Color halftoning information LPI UNIT:"));
  492. break;
  493. case TAG_HALFTONE_DEGREE:
  494. VERBOSE(("Color halftoning information Degree:"));
  495. break;
  496. case TAG_HALFTONE_SHAPE:
  497. VERBOSE(("Color halftoning information Shape:"));
  498. break;
  499. case TAG_HALFTONE_MISC:
  500. VERBOSE(("Color halftoning information Misc:"));
  501. break;
  502. case TAG_HALFTONE_SCREEN:
  503. VERBOSE(("Color halftoning information Screen:"));
  504. break;
  505. case TAG_JPEG_QUALITY:
  506. VERBOSE(("JPEG quality: "));
  507. break;
  508. case TAG_GRID_SIZE:
  509. VERBOSE(("Grid and guides: "));
  510. break;
  511. case TAG_THUMBNAIL_FORMAT:
  512. VERBOSE(("Thumbnail Data Format: "));
  513. break;
  514. case TAG_THUMBNAIL_WIDTH:
  515. case TAG_THUMBNAIL_IMAGE_WIDTH:
  516. VERBOSE(("Thumbnail Width: "));
  517. break;
  518. case TAG_THUMBNAIL_HEIGHT:
  519. case TAG_THUMBNAIL_IMAGE_HEIGHT:
  520. VERBOSE(("Thumbnail Height: "));
  521. break;
  522. case TAG_THUMBNAIL_COLORDEPTH:
  523. VERBOSE(("Thumbnail Color depth: "));
  524. break;
  525. case TAG_THUMBNAIL_PLANES:
  526. VERBOSE(("Thumbnail Number of plane: "));
  527. break;
  528. case TAG_THUMBNAIL_RAWBYTES:
  529. VERBOSE(("Thumbnail Raw bytes (bytes): "));
  530. break;
  531. case TAG_THUMBNAIL_SIZE:
  532. VERBOSE(("Thumbnail Data Size (bytes): "));
  533. break;
  534. case TAG_THUMBNAIL_COMPRESSED_SIZE:
  535. VERBOSE(("Thumbnail Compressed Size (bytes): "));
  536. break;
  537. case TAG_THUMBNAIL_DATA:
  538. VERBOSE(("Thumbnail data bits: "));
  539. break;
  540. case TAG_LUMINANCE_TABLE:
  541. VERBOSE(("Luminance table "));
  542. break;
  543. case TAG_CHROMINANCE_TABLE:
  544. VERBOSE(("Chrominance table "));
  545. break;
  546. case TAG_IMAGE_TITLE:
  547. VERBOSE(("Image title: "));
  548. break;
  549. case TAG_ICC_PROFILE:
  550. VERBOSE(("ICC PROFILE "));
  551. break;
  552. case TAG_ICC_PROFILE_DESCRIPTOR:
  553. VERBOSE(("ICC PROFILE descriptor: "));
  554. break;
  555. case TAG_SRGB_RENDERING_INTENT:
  556. VERBOSE(("sRGB rendering intent: "));
  557. break;
  558. case TAG_GAMMA:
  559. VERBOSE(("GAMMA "));
  560. break;
  561. case TAG_FRAMEDELAY:
  562. VERBOSE(("Frame delay "));
  563. break;
  564. case TAG_LOOPCOUNT:
  565. VERBOSE(("Loop count "));
  566. break;
  567. case EXIF_TAG_VER:
  568. VERBOSE(("EXIF Version: "));
  569. break;
  570. case EXIF_TAG_FPX_VER:
  571. VERBOSE(("FlashPixVersion Version: "));
  572. break;
  573. case EXIF_TAG_COLOR_SPACE:
  574. VERBOSE(("Color Space: "));
  575. break;
  576. case EXIF_TAG_COMP_CONFIG:
  577. VERBOSE(("Components Configuration: "));
  578. break;
  579. case EXIF_TAG_COMP_BPP:
  580. VERBOSE(("Components Bits Per Pixel: "));
  581. break;
  582. case EXIF_TAG_PIX_X_DIM:
  583. VERBOSE(("Pixel X Dimension: "));
  584. break;
  585. case EXIF_TAG_PIX_Y_DIM:
  586. VERBOSE(("Pixel Y Dimension: "));
  587. break;
  588. case EXIF_TAG_MAKER_NOTE:
  589. VERBOSE(("Maker Note: "));
  590. break;
  591. case EXIF_TAG_USER_COMMENT:
  592. VERBOSE(("User Comments: "));
  593. break;
  594. case EXIF_TAG_RELATED_WAV:
  595. VERBOSE(("Related WAV File: "));
  596. break;
  597. case EXIF_TAG_D_T_ORIG:
  598. VERBOSE(("Date Time Original: "));
  599. break;
  600. case EXIF_TAG_D_T_DIGITIZED:
  601. VERBOSE(("Date Time Digitized: "));
  602. break;
  603. case EXIF_TAG_D_T_SUBSEC:
  604. VERBOSE(("Date & Time subseconds: "));
  605. break;
  606. case EXIF_TAG_D_T_ORIG_SS:
  607. VERBOSE(("Date & Time original subseconds: "));
  608. break;
  609. case EXIF_TAG_D_T_DIG_SS:
  610. VERBOSE(("Date & Time digitized subseconds: "));
  611. break;
  612. case EXIF_TAG_EXPOSURE_TIME:
  613. VERBOSE(("Exposure Time: "));
  614. break;
  615. case EXIF_TAG_F_NUMBER:
  616. VERBOSE(("F Number: "));
  617. break;
  618. case EXIF_TAG_EXPOSURE_PROG:
  619. VERBOSE(("Exposure Program: "));
  620. break;
  621. case EXIF_TAG_SPECTRAL_SENSE:
  622. VERBOSE(("Spectral Sense: "));
  623. break;
  624. case EXIF_TAG_ISO_SPEED:
  625. VERBOSE(("ISO Speed: "));
  626. break;
  627. case EXIF_TAG_OECF:
  628. VERBOSE(("Opto-Electric Conversion Function values: "));
  629. break;
  630. case EXIF_TAG_SHUTTER_SPEED:
  631. VERBOSE(("Shutter Speed: "));
  632. break;
  633. case EXIF_TAG_APERATURE:
  634. VERBOSE(("Aperature: "));
  635. break;
  636. case EXIF_TAG_BRIGHTNESS:
  637. VERBOSE(("Brightness: "));
  638. break;
  639. case EXIF_TAG_EXPOSURE_BIAS:
  640. VERBOSE(("Exposure Bias: "));
  641. break;
  642. case EXIF_TAG_MAX_APERATURE:
  643. VERBOSE(("Max Aperature: "));
  644. break;
  645. case EXIF_TAG_SUBJECT_DIST:
  646. VERBOSE(("Subject Distance: "));
  647. break;
  648. case EXIF_TAG_METERING_MODE:
  649. VERBOSE(("Metering Mode: "));
  650. break;
  651. case EXIF_TAG_LIGHT_SOURCE:
  652. VERBOSE(("Light Source: "));
  653. break;
  654. case EXIF_TAG_FLASH:
  655. VERBOSE(("Flash: "));
  656. break;
  657. case EXIF_TAG_FOCAL_LENGTH:
  658. VERBOSE(("Focal Length: "));
  659. break;
  660. case EXIF_TAG_FLASH_ENERGY:
  661. VERBOSE(("Flash Energy: "));
  662. break;
  663. case EXIF_TAG_SPATIAL_FR:
  664. VERBOSE(("Spacial Frequency Response: "));
  665. break;
  666. case EXIF_TAG_FOCAL_X_RES:
  667. VERBOSE(("Focal Plane X Resolution: "));
  668. break;
  669. case EXIF_TAG_FOCAL_Y_RES:
  670. VERBOSE(("Focal Plane Y Resolution: "));
  671. break;
  672. case EXIF_TAG_FOCAL_RES_UNIT:
  673. VERBOSE(("Focal Plane Resolution Unit: "));
  674. break;
  675. case EXIF_TAG_SUBJECT_LOC:
  676. VERBOSE(("Subject Location: "));
  677. break;
  678. case EXIF_TAG_EXPOSURE_INDEX:
  679. VERBOSE(("Exposure Index: "));
  680. break;
  681. case EXIF_TAG_SENSING_METHOD:
  682. VERBOSE(("Sensing Method: "));
  683. break;
  684. case EXIF_TAG_FILE_SOURCE:
  685. VERBOSE(("File Source: "));
  686. break;
  687. case EXIF_TAG_SCENE_TYPE:
  688. VERBOSE(("Scene Type: "));
  689. break;
  690. case EXIF_TAG_CFA_PATTERN:
  691. VERBOSE(("CFA Pattern: "));
  692. break;
  693. case EXIF_TAG_INTEROP:
  694. VERBOSE(("Interoperability Unit: "));
  695. break;
  696. case GPS_TAG_VER:
  697. VERBOSE(("GPS Version: "));
  698. break;
  699. case GPS_TAG_LATTITUDE_REF:
  700. VERBOSE(("GPS Lattitude Reference: "));
  701. break;
  702. case GPS_TAG_LATTITUDE:
  703. VERBOSE(("GPS Lattitude: "));
  704. break;
  705. case GPS_TAG_LONGITUDE_REF:
  706. VERBOSE(("GPS Longitude Reference: "));
  707. break;
  708. case GPS_TAG_LONGITUDE:
  709. VERBOSE(("GPS Longitude: "));
  710. break;
  711. case GPS_TAG_ALTITUDE_REF:
  712. VERBOSE(("GPS Altitude Reference: "));
  713. break;
  714. case GPS_TAG_ALTITUDE:
  715. VERBOSE(("GPS Altitude: "));
  716. break;
  717. case GPS_TAG_GPS_TIME:
  718. VERBOSE(("GPS Time: "));
  719. break;
  720. case GPS_TAG_GPS_SATELLITES:
  721. VERBOSE(("GPS Satellites: "));
  722. break;
  723. case GPS_TAG_GPS_STATUS:
  724. VERBOSE(("GPS Status: "));
  725. break;
  726. case GPS_TAG_GPS_MEASURE_MODE:
  727. VERBOSE(("GPS Measure Mode: "));
  728. break;
  729. case GPS_TAG_GPS_DOP:
  730. VERBOSE(("GPS Measurement precision: "));
  731. break;
  732. case GPS_TAG_SPEED_REF:
  733. VERBOSE(("GPS Speed Reference: "));
  734. break;
  735. case GPS_TAG_SPEED:
  736. VERBOSE(("GPS Speed: "));
  737. break;
  738. case GPS_TAG_TRACK_REF:
  739. VERBOSE(("GPS Track Reference: "));
  740. break;
  741. case GPS_TAG_TRACK:
  742. VERBOSE(("GPS Track: "));
  743. break;
  744. case GPS_TAG_IMG_DIR_REF:
  745. VERBOSE(("GPS Image Direction Reference: "));
  746. break;
  747. case GPS_TAG_IMG_DIR:
  748. VERBOSE(("GPS Image Direction: "));
  749. break;
  750. case GPS_TAG_MAP_DATUM:
  751. VERBOSE(("GPS Map Datum: "));
  752. break;
  753. case GPS_TAG_DEST_LAT_REF:
  754. VERBOSE(("GPS Destination Latitude Reference: "));
  755. break;
  756. case GPS_TAG_DEST_LAT:
  757. VERBOSE(("GPS Destination Latitude: "));
  758. break;
  759. case GPS_TAG_DEST_LONG_REF:
  760. VERBOSE(("GPS Longitude Reference: "));
  761. break;
  762. case GPS_TAG_DEST_LONG:
  763. VERBOSE(("GPS Longitude: "));
  764. break;
  765. case GPS_TAG_DEST_BEAR_REF:
  766. VERBOSE(("GPS Destination Bear Reference: "));
  767. break;
  768. case GPS_TAG_DEST_BEAR:
  769. VERBOSE(("GPS Destination Bear: "));
  770. break;
  771. case GPS_TAG_DEST_DIST_REF:
  772. VERBOSE(("GPS Destination Distance Reference: "));
  773. break;
  774. case GPS_TAG_DEST_DIST:
  775. VERBOSE(("GPS Destination Distance: "));
  776. break;
  777. default:
  778. VERBOSE(("Unknown Tag "));
  779. break;
  780. }
  781. }// DisplayTagName()
  782. VOID
  783. DisplayPropertyItem(
  784. PropertyItem* pItem
  785. )
  786. {
  787. // Print out the name first
  788. DisplayTagName(pItem->id);
  789. switch ( pItem->type )
  790. {
  791. case TAG_TYPE_BYTE:
  792. {
  793. // Print pItem->length bytes of information
  794. BYTE* pcTemp = (BYTE*)pItem->value;
  795. for ( int i = 0; i < (int)pItem->length; ++i )
  796. {
  797. VERBOSE(("%2.2x", *pcTemp++));
  798. }
  799. VERBOSE(("\n"));
  800. #if 0 //(THUMBNAIL DATA testing)
  801. if ( pItem->id == TAG_THUMBNAIL_DATA )
  802. {
  803. FILE* fHandle = fopen("foo.jpg", "w");
  804. fwrite(pItem->value, 1, pItem->length, fHandle);
  805. fclose(fHandle);
  806. }
  807. #endif
  808. break;
  809. }
  810. case TAG_TYPE_ASCII:
  811. VERBOSE(("%s\n", pItem->value));
  812. break;
  813. case TAG_TYPE_SHORT:
  814. {
  815. int iTotalItems = pItem->length / sizeof(SHORT);
  816. unsigned short* pusTemp = (unsigned short*)pItem->value;
  817. for ( int i = 0; i < iTotalItems; ++i )
  818. {
  819. VERBOSE(("%d ", *pusTemp));
  820. pusTemp++;
  821. }
  822. VERBOSE(("\n"));
  823. break;
  824. }
  825. case TAG_TYPE_LONG:
  826. {
  827. int iTotalItems = pItem->length / sizeof(LONG);
  828. long* plTemp = (long*)pItem->value;
  829. for ( int i = 0; i < iTotalItems; ++i )
  830. {
  831. VERBOSE(("%ld ", *plTemp));
  832. plTemp++;
  833. }
  834. VERBOSE(("\n"));
  835. break;
  836. }
  837. case TAG_TYPE_RATIONAL:
  838. case TAG_TYPE_SRATIONAL:
  839. {
  840. // Each RATIONAL/SRATIONAL contains 2 LONGs
  841. INT iNumOfValue = pItem->length / ( 2 * sizeof(LONG) );
  842. LONG* pLong = (LONG*)pItem->value;
  843. for ( int i = 0; i < iNumOfValue; ++i )
  844. {
  845. LONG lNum = *pLong;
  846. LONG lDen = *(pLong + 1);
  847. VERBOSE(("%f ", (float)lNum/lDen));
  848. pLong += 2;
  849. }
  850. VERBOSE(("\n"));
  851. break;
  852. }
  853. case TAG_TYPE_UNDEFINED:
  854. {
  855. // Print pItem->length bytes of information
  856. BYTE* pcTemp = (BYTE*)pItem->value;
  857. for ( int i = 0; i < (int)pItem->length; ++i )
  858. {
  859. VERBOSE(("%2.2x ", *pcTemp++));
  860. }
  861. VERBOSE(("\n"));
  862. break;
  863. }
  864. case TAG_TYPE_SLONG:
  865. VERBOSE(("%p\n", pItem->value));
  866. break;
  867. default:
  868. VERBOSE(("Unknown VT type\n"));
  869. break;
  870. }
  871. }// DisplayPropertyItem()
  872. VOID
  873. ToggleScaleFactorMenu(
  874. UINT uiMenuItem,
  875. HMENU hMenu
  876. )
  877. {
  878. for ( UINT uiTemp = IDM_VIEW_ZOOM_FITWINDOW_W;
  879. uiTemp <= IDM_VIEW_ZOOM_REALSIZE; uiTemp++ )
  880. {
  881. if ( uiTemp == uiMenuItem )
  882. {
  883. CheckMenuItem(hMenu, uiMenuItem, MF_BYCOMMAND | MF_CHECKED);
  884. }
  885. else
  886. {
  887. CheckMenuItem(hMenu, uiTemp, MF_BYCOMMAND | MF_UNCHECKED);
  888. }
  889. }
  890. }// ToggleScaleFactorMenu()
  891. VOID
  892. ToggleScaleOptionMenu(
  893. UINT uiMenuItem,
  894. HMENU hMenu
  895. )
  896. {
  897. for ( UINT uiTemp = IDM_VIEW_OPTION_BILINEAR;
  898. uiTemp <= IDM_VIEW_OPTION_HIGHCUBIC; uiTemp++ )
  899. {
  900. if ( uiTemp == uiMenuItem )
  901. {
  902. CheckMenuItem(hMenu, uiMenuItem, MF_BYCOMMAND | MF_CHECKED);
  903. }
  904. else
  905. {
  906. CheckMenuItem(hMenu, uiTemp, MF_BYCOMMAND | MF_UNCHECKED);
  907. }
  908. }
  909. }// ToggleScaleOptionMenu()
  910. VOID
  911. ToggleWrapModeOptionMenu(
  912. UINT uiMenuItem,
  913. HMENU hMenu
  914. )
  915. {
  916. for ( UINT uiTemp = IDM_VIEW_OPTION_WRAPMODETILE;
  917. uiTemp <= IDM_VIEW_OPTION_WRAPMODECLAMPFF; uiTemp++ )
  918. {
  919. if ( uiTemp == uiMenuItem )
  920. {
  921. CheckMenuItem(hMenu, uiMenuItem, MF_BYCOMMAND | MF_CHECKED);
  922. }
  923. else
  924. {
  925. CheckMenuItem(hMenu, uiTemp, MF_BYCOMMAND | MF_UNCHECKED);
  926. }
  927. }
  928. }// ToggleWrapModeOptionMenu()