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.

228 lines
6.4 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. SCS_32BIT_BINARY_AMD64
  50. };
  51. #define SCS_UNKOWN (DWORD)-1
  52. static const TCHAR *szType[] = {
  53. "W32 ",
  54. "DOS ",
  55. "W16 ",
  56. "PIF ",
  57. "PSX ",
  58. "OS2 ",
  59. "W32i ",
  60. "W32m ",
  61. "W32a ",
  62. "W32p ",
  63. "W32a64 ",
  64. "W32i64 ",
  65. "WAMD64 "
  66. };
  67. CONST static TCHAR *VersionKeys[] =
  68. {
  69. TEXT("CompanyName"),
  70. TEXT("FileDescription"),
  71. TEXT("InternalName"),
  72. TEXT("OriginalFilename"),
  73. TEXT("ProductName"),
  74. TEXT("ProductVersion"),
  75. TEXT("FileVersion"),
  76. TEXT("LegalCopyright"),
  77. TEXT("LegalTrademarks"),
  78. TEXT("PrivateBuild"),
  79. TEXT("SpecialBuild"),
  80. TEXT("Comments")
  81. };
  82. // languages map
  83. typedef struct _LangTag {
  84. WORD wLangId;
  85. LPSTR szName;
  86. LPSTR szDesc;
  87. LPSTR szKey;
  88. } LangTag;
  89. CONST static LangTag ltLang[] =
  90. {
  91. {0x0406,"Danish","Danish","DAN"},
  92. {0x0413,"Dutch","Dutch (Standard)","NLD"},
  93. {0x0813,"Dutch","Belgian (Flemish)","NLB"},
  94. {0x0409,"English","American","ENU"},
  95. {0x0809,"English","British","ENG"},
  96. {0x0c09,"English","Australian","ENA"},
  97. {0x1009,"English","Canadian","ENC"},
  98. {0x1409,"English","New Zealand","ENZ"},
  99. {0x1809,"English","Ireland","ENI"},
  100. {0x040b,"Finnish","Finnish","FIN"},
  101. {0x040c,"French","French (Standard)","FRA"},
  102. {0x080c,"French","Belgian","FRB"},
  103. {0x0c0c,"French","Canadian","FRC"},
  104. {0x100c,"French","Swiss","FRS"},
  105. {0x0407,"German","German (Standard)","DEU"},
  106. {0x0807,"German","Swiss","DES"},
  107. {0x0c07,"German","Austrian","DEA"},
  108. {0x040f,"Icelandic","Icelandic","ISL"},
  109. {0x0410,"Italian","Italian (Standard)","ITA"},
  110. {0x0810,"Italian","Swiss","ITS"},
  111. {0x0414,"Norwegian","Norwegian (Bokmal)","NOR"},
  112. {0x0814,"Norwegian","Norwegian (Nynorsk)","NON"},
  113. {0x0416,"Portuguese","Portuguese (Brazilian)","PTB"},
  114. {0x0816,"Portuguese","Portuguese (Portugal)","PTG"},
  115. {0x041D,"Swedish","Swedish","SVE"},
  116. {0x040a,"Spanish","Spanish (Standard/Traditional)","ESP"},
  117. {0x080a,"Spanish","Mexican","ESM"},
  118. {0x0c0a,"Spanish","Spanish","ESN"},
  119. {0x041f,"Turkish","TRK","TRK"},
  120. {0x0415,"Polish","PLK","PLK"},
  121. {0x0405,"Czech","CSY","CSY"},
  122. {0x041b,"Slovak","SKY","SKY"},
  123. {0x040e,"Hungarian","HUN","HUN"},
  124. {0x0419,"Russian","RUS","RUS"},
  125. {0x0408,"Greek","ELL","ELL"},
  126. {0x0804,"Chinese","CHS","CHS"},
  127. {0x0404,"Taiwan","CHT","CHT"},
  128. {0x0411,"Japan","JPN","JPN"},
  129. {0x0412,"Korea","KOR","KOR"}
  130. };
  131. // languages map
  132. typedef struct _CharSetTag {
  133. WORD wCharSetId;
  134. LPSTR szDesc;
  135. } CharSetTag;
  136. CONST static CharSetTag ltCharSet[] =
  137. {
  138. {0, "7-bit ASCII"},
  139. {932, "Windows, Japan (Shift � JIS X-0208)"},
  140. {949, "Windows, Korea (Shift � KSC 5601)"},
  141. {950, "Windows, Taiwan (GB5)"},
  142. {1200, "Unicode"},
  143. {1250, "Windows, Latin-2 (Eastern European)"},
  144. {1251, "Windows, Cyrillic"},
  145. {1252, "Windows, Multilingual"},
  146. {1253, "Windows, Greek"},
  147. {1254, "Windows, Turkish"},
  148. {1255, "Windows, Hebrew"},
  149. {1256, "Windows, Arabic"}
  150. };
  151. typedef struct _ffTypeTag {
  152. DWORD dwTypeMask;
  153. LPSTR szTypeStr;
  154. LPSTR szFullStr;
  155. } TypeTag;
  156. // file flags map
  157. TypeTag ttFileFlags[]= {
  158. { VS_FF_DEBUG, "D", "debug"},
  159. { VS_FF_PRERELEASE, "P", "prerelease"},
  160. { VS_FF_PATCHED, "A", "patched"},
  161. { VS_FF_PRIVATEBUILD,"I", "private"},
  162. { VS_FF_INFOINFERRED,"F", "infoInferred"},
  163. { VS_FF_SPECIALBUILD,"S", "special"}
  164. };
  165. // file OS map
  166. TypeTag ttFileOsHi[] = {
  167. { VOS_DOS, "DOS", "MS-DOS"},
  168. { VOS_OS216, "O16", "OS2/16"},
  169. { VOS_OS232, "O32", "OS2/32"},
  170. { VOS_NT, "NT", "NT"},
  171. };
  172. TypeTag ttFileOsLo[] = {
  173. { VOS__WINDOWS16, "Win16","Win16"},
  174. { VOS__PM16, "PM16", "PM16"},
  175. { VOS__PM32, "PM32", "PM32"},
  176. { VOS__WINDOWS32, "Win32","Win32"}
  177. };
  178. // type map
  179. TypeTag ttFType[] = {
  180. { VFT_APP, "APP", "App"},
  181. { VFT_DLL, "DLL", "Dll"},
  182. { VFT_DRV, "DRV", "Driver"},
  183. { VFT_FONT, "FNT", "Font"},
  184. { VFT_VXD, "VXD", "VXD"},
  185. { VFT_STATIC_LIB, "LIB", "lib"}
  186. };
  187. /* ----- VS_VERSION.dwFileSubtype for VFT_WINDOWS_DRV ----- */
  188. TypeTag ttFTypeDrv[] = {
  189. { VFT2_DRV_PRINTER, "", "PrinterDrv"},
  190. { VFT2_DRV_KEYBOARD, "", "KeyBoardDrv"},
  191. { VFT2_DRV_LANGUAGE, "", "LangDrv"},
  192. { VFT2_DRV_DISPLAY, "", "DisplayDrv"},
  193. { VFT2_DRV_MOUSE, "", "MouseDrv"},
  194. { VFT2_DRV_NETWORK, "", "NetworkDrv"},
  195. { VFT2_DRV_SYSTEM, "", "SystemDrv"},
  196. { VFT2_DRV_INSTALLABLE, "", "InstallableDrv"},
  197. { VFT2_DRV_SOUND, "", "SoundDrv"},
  198. { VFT2_DRV_COMM, "", "CommDrv"}
  199. };
  200. /* ----- VS_VERSION.dwFileSubtype for VFT_WINDOWS_FONT ----- */
  201. TypeTag ttFTypeFont[] = {
  202. { VFT2_FONT_RASTER, "", "Raster"},
  203. { VFT2_FONT_VECTOR, "", "Vectore"},
  204. { VFT2_FONT_TRUETYPE, "", "Truetype"}
  205. };