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.

225 lines
6.1 KiB

  1. // function prototypes
  2. DWORD GetVersionStuff(LPTSTR szFileName, DWORD *pdwLangRet, VS_FIXEDFILEINFO *pvsRet);
  3. VOID PrintFileType(DWORD lBinaryType);
  4. VOID PrintFileAttributes(DWORD dwAttr);
  5. VOID PrintFileSizeAndDate(WIN32_FIND_DATA *pfd);
  6. VOID PrintFileVersion(LPTSTR szFileName);
  7. BOOL FListFiles(LPTSTR szDir, LPTSTR szPat);
  8. DWORD MyGetBinaryType(LPTSTR szFileName);
  9. VOID __cdecl PrintErrorMessage(DWORD dwError, LPTSTR szFmt, ...);
  10. #define FA_DIR(_x) ((_x) & FILE_ATTRIBUTE_DIRECTORY)
  11. // filever cmd line flags
  12. #define FSTR_RECURSE 0x0001
  13. #define FSTR_VERBOSE 0x0002
  14. #define FSTR_EXESONLY 0x0004
  15. #define FSTR_SHORTNAME 0x0008
  16. #define FSTR_BAREFORMAT 0x0010
  17. #define FSTR_PRINTDIR 0x0020
  18. #define FSTR_NOATTRS 0x0040
  19. #define FSTR_NODATETIME 0x0080
  20. #ifdef DEBUG
  21. #define FSTR_DEBUG 0x8000
  22. #endif
  23. // PrintFileAttr struct
  24. typedef struct _FileAttr
  25. {
  26. DWORD dwAttr;
  27. TCHAR ch;
  28. } FileAttr;
  29. // MyGetBinaryType exe type defines
  30. #define NE_UNKNOWN 0x0 /* Unknown (any "new-format" OS) */
  31. #define NE_OS2 0x1 /* Microsoft/IBM OS/2 (default) */
  32. #define NE_WINDOWS 0x2 /* Microsoft Windows */
  33. #define NE_DOS4 0x3 /* Microsoft MS-DOS 4.x */
  34. #define NE_DEV386 0x4 /* Microsoft Windows 386 */
  35. // MyGetBinaryType return values
  36. enum {
  37. // SCS_32BIT_BINARY,
  38. // SCS_DOS_BINARY,
  39. // SCS_WOW_BINARY,
  40. // SCS_PIF_BINARY,
  41. // SCS_POSIX_BINARY,
  42. // SCS_OS216_BINARY,
  43. SCS_32BIT_BINARY_INTEL = SCS_OS216_BINARY + 1,
  44. SCS_32BIT_BINARY_MIPS,
  45. SCS_32BIT_BINARY_ALPHA,
  46. SCS_32BIT_BINARY_PPC,
  47. SCS_32BIT_BINARY_AXP64,
  48. SCS_32BIT_BINARY_IA64
  49. };
  50. #define SCS_UNKOWN (DWORD)-1
  51. static const TCHAR *szType[] = {
  52. "W32 ",
  53. "DOS ",
  54. "W16 ",
  55. "PIF ",
  56. "PSX ",
  57. "OS2 ",
  58. "W32i ",
  59. "W32m ",
  60. "W32a ",
  61. "W32p ",
  62. "W32a64 ",
  63. "W32i64 ",
  64. };
  65. CONST static TCHAR *VersionKeys[] =
  66. {
  67. TEXT("CompanyName"),
  68. TEXT("FileDescription"),
  69. TEXT("InternalName"),
  70. TEXT("OriginalFilename"),
  71. TEXT("ProductName"),
  72. TEXT("ProductVersion"),
  73. TEXT("FileVersion"),
  74. TEXT("LegalCopyright"),
  75. TEXT("LegalTrademarks"),
  76. TEXT("PrivateBuild"),
  77. TEXT("SpecialBuild"),
  78. TEXT("Comments")
  79. };
  80. // languages map
  81. typedef struct _LangTag {
  82. WORD wLangId;
  83. LPSTR szName;
  84. LPSTR szDesc;
  85. LPSTR szKey;
  86. } LangTag;
  87. CONST static LangTag ltLang[] =
  88. {
  89. {0x0406,"Danish","Danish","DAN"},
  90. {0x0413,"Dutch","Dutch (Standard)","NLD"},
  91. {0x0813,"Dutch","Belgian (Flemish)","NLB"},
  92. {0x0409,"English","American","ENU"},
  93. {0x0809,"English","British","ENG"},
  94. {0x0c09,"English","Australian","ENA"},
  95. {0x1009,"English","Canadian","ENC"},
  96. {0x1409,"English","New Zealand","ENZ"},
  97. {0x1809,"English","Ireland","ENI"},
  98. {0x040b,"Finnish","Finnish","FIN"},
  99. {0x040c,"French","French (Standard)","FRA"},
  100. {0x080c,"French","Belgian","FRB"},
  101. {0x0c0c,"French","Canadian","FRC"},
  102. {0x100c,"French","Swiss","FRS"},
  103. {0x0407,"German","German (Standard)","DEU"},
  104. {0x0807,"German","Swiss","DES"},
  105. {0x0c07,"German","Austrian","DEA"},
  106. {0x040f,"Icelandic","Icelandic","ISL"},
  107. {0x0410,"Italian","Italian (Standard)","ITA"},
  108. {0x0810,"Italian","Swiss","ITS"},
  109. {0x0414,"Norwegian","Norwegian (Bokmal)","NOR"},
  110. {0x0814,"Norwegian","Norwegian (Nynorsk)","NON"},
  111. {0x0416,"Portuguese","Portuguese (Brazilian)","PTB"},
  112. {0x0816,"Portuguese","Portuguese (Standard)","PTG"},
  113. {0x041D,"Swedish","Swedish","SVE"},
  114. {0x040a,"Spanish","Spanish (Standard/Traditional)","ESP"},
  115. {0x080a,"Spanish","Mexican","ESM"},
  116. {0x0c0a,"Spanish","Spanish (Modern)","ESN"},
  117. {0x041f,"Turkish","TRK","TRK"},
  118. {0x0415,"Polish","PLK","PLK"},
  119. {0x0405,"Czech","CSY","CSY"},
  120. {0x041b,"Slovak","SKY","SKY"},
  121. {0x040e,"Hungarian","HUN","HUN"},
  122. {0x0419,"Russian","RUS","RUS"},
  123. {0x0408,"Greek","ELL","ELL"},
  124. {0x0804,"Chinese","CHS","CHS"},
  125. {0x0404,"Taiwan","CHT","CHT"},
  126. {0x0411,"Japan","JPN","JPN"},
  127. {0x0412,"Korea","KOR","KOR"}
  128. };
  129. // languages map
  130. typedef struct _CharSetTag {
  131. WORD wCharSetId;
  132. LPSTR szDesc;
  133. } CharSetTag;
  134. CONST static CharSetTag ltCharSet[] =
  135. {
  136. {0, "7-bit ASCII"},
  137. {932, "Windows, Japan (Shift � JIS X-0208)"},
  138. {949, "Windows, Korea (Shift � KSC 5601)"},
  139. {950, "Windows, Taiwan (GB5)"},
  140. {1200, "Unicode"},
  141. {1250, "Windows, Latin-2 (Eastern European)"},
  142. {1251, "Windows, Cyrillic"},
  143. {1252, "Windows, Multilingual"},
  144. {1253, "Windows, Greek"},
  145. {1254, "Windows, Turkish"},
  146. {1255, "Windows, Hebrew"},
  147. {1256, "Windows, Arabic"}
  148. };
  149. typedef struct _ffTypeTag {
  150. DWORD dwTypeMask;
  151. LPSTR szTypeStr;
  152. LPSTR szFullStr;
  153. } TypeTag;
  154. // file flags map
  155. TypeTag ttFileFlags[]= {
  156. { VS_FF_DEBUG, "D", "debug"},
  157. { VS_FF_PRERELEASE, "P", "prerelease"},
  158. { VS_FF_PATCHED, "A", "patched"},
  159. { VS_FF_PRIVATEBUILD,"I", "private"},
  160. { VS_FF_INFOINFERRED,"F", "infoInferred"},
  161. { VS_FF_SPECIALBUILD,"S", "special"}
  162. };
  163. // file OS map
  164. TypeTag ttFileOsHi[] = {
  165. { VOS_DOS, "DOS", "MS-DOS"},
  166. { VOS_OS216, "O16", "OS2/16"},
  167. { VOS_OS232, "O32", "OS2/32"},
  168. { VOS_NT, "NT", "NT"},
  169. };
  170. TypeTag ttFileOsLo[] = {
  171. { VOS__WINDOWS16, "Win16","Win16"},
  172. { VOS__PM16, "PM16", "PM16"},
  173. { VOS__PM32, "PM32", "PM32"},
  174. { VOS__WINDOWS32, "Win32","Win32"}
  175. };
  176. // type map
  177. TypeTag ttFType[] = {
  178. { VFT_APP, "APP", "App"},
  179. { VFT_DLL, "DLL", "Dll"},
  180. { VFT_DRV, "DRV", "Driver"},
  181. { VFT_FONT, "FNT", "Font"},
  182. { VFT_VXD, "VXD", "VXD"},
  183. { VFT_STATIC_LIB, "LIB", "lib"}
  184. };
  185. /* ----- VS_VERSION.dwFileSubtype for VFT_WINDOWS_DRV ----- */
  186. TypeTag ttFTypeDrv[] = {
  187. { VFT2_DRV_PRINTER, "", "PrinterDrv"},
  188. { VFT2_DRV_KEYBOARD, "", "KeyBoardDrv"},
  189. { VFT2_DRV_LANGUAGE, "", "LangDrv"},
  190. { VFT2_DRV_DISPLAY, "", "DisplayDrv"},
  191. { VFT2_DRV_MOUSE, "", "MouseDrv"},
  192. { VFT2_DRV_NETWORK, "", "NetworkDrv"},
  193. { VFT2_DRV_SYSTEM, "", "SystemDrv"},
  194. { VFT2_DRV_INSTALLABLE, "", "InstallableDrv"},
  195. { VFT2_DRV_SOUND, "", "SoundDrv"},
  196. { VFT2_DRV_COMM, "", "CommDrv"}
  197. };
  198. /* ----- VS_VERSION.dwFileSubtype for VFT_WINDOWS_FONT ----- */
  199. TypeTag ttFTypeFont[] = {
  200. { VFT2_FONT_RASTER, "", "Raster"},
  201. { VFT2_FONT_VECTOR, "", "Vectore"},
  202. { VFT2_FONT_TRUETYPE, "", "Truetype"}
  203. };