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.

800 lines
21 KiB

  1. #include "acFileAttr.h"
  2. #include "attr.h"
  3. #include "version.h"
  4. #include <assert.h>
  5. #include <imagehlp.h>
  6. #include <stdio.h>
  7. // the global array with all the file attributes
  8. FILEATTR g_arrFileAttr[] =
  9. {
  10. {VTID_FILESIZE, "File Size", "SIZE", QueryFileSize, BlobToStringLong, DumpDWORD},
  11. {VTID_EXETYPE, "Module Type", "MODULETYPE*", QueryModuleType, BlobToStringDWORD, DumpDWORD},
  12. {VTID_BINFILEVER, "Binary File Version", "BIN_FILE_VERSION", QueryBinFileVer, BlobToStringBinVer, DumpBinVer},
  13. {VTID_BINPRODUCTVER, "Binary Product Version", "BIN_PRODUCT_VERSION", QueryBinProductVer, BlobToStringBinVer, DumpBinVer},
  14. {VTID_FILEDATEHI, "File Date (HI)", "VERFILEDATEHI", QueryFileDateHi, BlobToStringDWORD, DumpDWORD},
  15. {VTID_FILEDATELO, "File Date (LO)", "VERFILEDATELO", QueryFileDateLo, BlobToStringDWORD, DumpDWORD},
  16. {VTID_FILEVEROS, "File OS Version", "VERFILEOS", QueryFileVerOs, BlobToStringDWORD, DumpDWORD},
  17. {VTID_FILEVERTYPE, "File Type", "VERFILETYPE", QueryFileVerType, BlobToStringDWORD, DumpDWORD},
  18. {VTID_CHECKSUM, "File CheckSum", "CHECKSUM", QueryFileCheckSum, BlobToStringDWORD, DumpDWORD},
  19. {VTID_PECHECKSUM, "File Header CheckSum", "PECHECKSUM", QueryFilePECheckSum, BlobToStringDWORD, DumpDWORD},
  20. {VTID_COMPANYNAME, "Company Name", "COMPANY_NAME", QueryCompanyName, BlobToStringString, DumpString},
  21. {VTID_PRODUCTVERSION, "Product Version", "PRODUCT_VERSION", QueryProductVersion, BlobToStringString, DumpString},
  22. {VTID_PRODUCTNAME, "Product Name", "PRODUCT_NAME", QueryProductName, BlobToStringString, DumpString},
  23. {VTID_FILEDESCRIPTION, "File Description", "FILE_DESCRIPTION", QueryFileDescription, BlobToStringString, DumpString},
  24. {VTID_FILEVERSION, "File Version", "FILEVERSION", QueryFileVersion, BlobToStringString, DumpString},
  25. {VTID_ORIGINALFILENAME, "Original File Name", "ORIGINALFILENAME", QueryOriginalFileName, BlobToStringString, DumpString},
  26. {VTID_INTERNALNAME, "Internal Name", "INTERNALNAME", QueryInternalName, BlobToStringString, DumpString},
  27. {VTID_LEGALCOPYRIGHT, "Legal Copyright", "LEGALCOPYRIGHT", QueryLegalCopyright, BlobToStringString, DumpString},
  28. {VTID_16BITDESCRIPTION, "16 Bit Description", "S16BITDESCRIPTION", Query16BitDescription, BlobToStringString, DumpString},
  29. {VTID_UPTOBINPRODUCTVER,"Up To Binary Product Version", "UPTO_BIN_PRODUCT_VERSION", QueryBinProductVer, BlobToStringUpToBinVer, DumpUpToBinVer}
  30. };
  31. #define FAIL_IF_NO_VERSION() \
  32. { \
  33. if (pMgr->ver.FixedInfoSize < sizeof(VS_FIXEDFILEINFO)) { \
  34. LogMsg("No version info\n"); \
  35. return FALSE; \
  36. } \
  37. }
  38. #define ALLOC_VALUE_AND_RETURN() \
  39. { \
  40. pFileAttr->pszValue = (PSTR)Alloc(lstrlen(szBuffer) + 1); \
  41. \
  42. if (pFileAttr->pszValue == NULL) { \
  43. LogMsg("QueryAttr: memory allocation error\n"); \
  44. return FALSE; \
  45. } \
  46. \
  47. lstrcpy(pFileAttr->pszValue, szBuffer); \
  48. \
  49. pFileAttr->dwFlags = ATTR_FLAG_AVAILABLE; \
  50. \
  51. return TRUE; \
  52. }
  53. #define QUERYENTRY(szEntryName) \
  54. { \
  55. pFileAttr->pszValue = QueryVersionEntry(&pMgr->ver, szEntryName); \
  56. \
  57. if (pFileAttr->pszValue == NULL) { \
  58. LogMsg("QueryEntry: attribute %s N/A\n", szEntryName); \
  59. return FALSE; \
  60. } \
  61. pFileAttr->dwFlags = ATTR_FLAG_AVAILABLE; \
  62. \
  63. return TRUE; \
  64. }
  65. #if DBG
  66. void LogMsgDbg(
  67. LPSTR pszFmt, ... )
  68. {
  69. CHAR gszT[1024];
  70. va_list arglist;
  71. va_start(arglist, pszFmt);
  72. _vsnprintf(gszT, 1023, pszFmt, arglist);
  73. gszT[1023] = 0;
  74. va_end(arglist);
  75. OutputDebugString(gszT);
  76. }
  77. #endif // DBG
  78. // dump to blob functions
  79. int
  80. DumpDWORD(
  81. DWORD dwId,
  82. PFILEATTRVALUE pFileAttr,
  83. BYTE* pBlob)
  84. {
  85. *(DWORD*)pBlob = dwId;
  86. pBlob += sizeof(DWORD);
  87. *(DWORD*)pBlob = sizeof(DWORD);
  88. pBlob += sizeof(DWORD);
  89. *(DWORD*)pBlob = pFileAttr->dwValue;
  90. return (3 * sizeof(DWORD));
  91. }
  92. int
  93. DumpString(
  94. DWORD dwId,
  95. PFILEATTRVALUE pFileAttr,
  96. BYTE* pBlob)
  97. {
  98. int strLen, nWideChars;
  99. WCHAR wszOut[256];
  100. strLen = lstrlen(pFileAttr->pszValue);
  101. nWideChars = MultiByteToWideChar(
  102. CP_ACP,
  103. 0,
  104. pFileAttr->pszValue,
  105. strLen,
  106. wszOut,
  107. 256);
  108. wszOut[nWideChars] = 0;
  109. *(DWORD*)pBlob = dwId;
  110. pBlob += sizeof(DWORD);
  111. *(DWORD*)pBlob = (nWideChars + 1) * sizeof(WCHAR);
  112. pBlob += sizeof(DWORD);
  113. CopyMemory(pBlob, wszOut, (nWideChars + 1) * sizeof(WCHAR));
  114. return (2 * sizeof(DWORD) + (nWideChars + 1) * sizeof(WCHAR));
  115. }
  116. int
  117. DumpBinVer(
  118. DWORD dwId,
  119. PFILEATTRVALUE pFileAttr,
  120. BYTE* pBlob)
  121. {
  122. *(DWORD*)pBlob = dwId;
  123. pBlob += sizeof(DWORD);
  124. *(DWORD*)pBlob = 8 * sizeof(WORD);
  125. pBlob += sizeof(DWORD);
  126. CopyMemory(pBlob, pFileAttr->wValue, 4 * sizeof(WORD));
  127. pBlob += (4 * sizeof(WORD));
  128. CopyMemory(pBlob, pFileAttr->wMask, 4 * sizeof(WORD));
  129. return (8 * sizeof(WORD) + 2 * sizeof(DWORD));
  130. }
  131. int
  132. DumpUpToBinVer(
  133. DWORD dwId,
  134. PFILEATTRVALUE pFileAttr,
  135. BYTE* pBlob)
  136. {
  137. *(DWORD*)pBlob = dwId;
  138. pBlob += sizeof(DWORD);
  139. *(DWORD*)pBlob = 4 * sizeof(WORD);
  140. pBlob += sizeof(DWORD);
  141. CopyMemory(pBlob, pFileAttr->wValue, 4 * sizeof(WORD));
  142. return (4 * sizeof(WORD) + 2 * sizeof(DWORD));
  143. }
  144. // blob to string functions
  145. int
  146. BlobToStringBinVer(
  147. BYTE* pBlob,
  148. char* pszOut)
  149. {
  150. DWORD dwSize;
  151. // read the size first
  152. dwSize = *(DWORD*)pBlob;
  153. if (dwSize != 8 * sizeof(WORD)) {
  154. LogMsg("BlobToStringBinVer: invalid blob\n");
  155. return -1;
  156. }
  157. pBlob += sizeof(DWORD);
  158. wsprintf(pszOut, "Ver %d.%d.%d.%d Mask %04X.%04X.%04X.%04X\r\n",
  159. *((WORD*)pBlob + 3),
  160. *((WORD*)pBlob + 2),
  161. *((WORD*)pBlob + 1),
  162. *((WORD*)pBlob + 0),
  163. *((WORD*)pBlob + 7),
  164. *((WORD*)pBlob + 6),
  165. *((WORD*)pBlob + 5),
  166. *((WORD*)pBlob + 4));
  167. return sizeof(DWORD) + 8 * sizeof(WORD);
  168. }
  169. int
  170. BlobToStringUpToBinVer(
  171. BYTE* pBlob,
  172. char* pszOut)
  173. {
  174. DWORD dwSize;
  175. // read the size first
  176. dwSize = *(DWORD*)pBlob;
  177. if (dwSize != 4 * sizeof(WORD)) {
  178. LogMsg("BlobToStringUpToBinVer: invalid blob\n");
  179. return -1;
  180. }
  181. pBlob += sizeof(DWORD);
  182. wsprintf(pszOut, "Ver %d.%d.%d.%d\r\n",
  183. *((WORD*)pBlob + 3),
  184. *((WORD*)pBlob + 2),
  185. *((WORD*)pBlob + 1),
  186. *((WORD*)pBlob + 0));
  187. return sizeof(DWORD) + 4 * sizeof(WORD);
  188. }
  189. int
  190. BlobToStringDWORD(
  191. BYTE* pBlob,
  192. char* pszOut)
  193. {
  194. DWORD dwSize;
  195. // read the size first
  196. dwSize = *(DWORD*)pBlob;
  197. if (dwSize != sizeof(DWORD)) {
  198. LogMsg("BlobToStringDWORD: invalid blob\n");
  199. return -1;
  200. }
  201. pBlob += sizeof(DWORD);
  202. wsprintf(pszOut, "0x%X\r\n", *(DWORD*)pBlob);
  203. return 2 * sizeof(DWORD);
  204. }
  205. int
  206. BlobToStringLong(
  207. BYTE* pBlob,
  208. char* pszOut)
  209. {
  210. DWORD dwSize;
  211. // read the size first
  212. dwSize = *(DWORD*)pBlob;
  213. if (dwSize != sizeof(DWORD)) {
  214. LogMsg("BlobToStringLong: invalid blob\n");
  215. return -1;
  216. }
  217. pBlob += sizeof(DWORD);
  218. wsprintf(pszOut, "%d\r\n", *(ULONG*)pBlob);
  219. return 2 * sizeof(DWORD);
  220. }
  221. int
  222. BlobToStringString(
  223. BYTE* pBlob,
  224. char* pszOut)
  225. {
  226. DWORD dwSize;
  227. // read the size first
  228. dwSize = *(DWORD*)pBlob;
  229. pBlob += sizeof(DWORD);
  230. WideCharToMultiByte(
  231. CP_ACP,
  232. 0,
  233. (LPCWSTR)pBlob,
  234. (int)dwSize,
  235. pszOut,
  236. (int)dwSize,
  237. NULL,
  238. NULL);
  239. lstrcat(pszOut, "\r\n");
  240. return sizeof(DWORD) + (int)dwSize;
  241. }
  242. // query functions
  243. BOOL
  244. QueryFileSize(
  245. PFILEATTRMGR pMgr,
  246. PFILEATTRVALUE pFileAttr)
  247. {
  248. char szBuffer[64];
  249. HANDLE findHandle;
  250. WIN32_FIND_DATA findData;
  251. findHandle = FindFirstFile(pMgr->ver.pszFile, &findData);
  252. if (findHandle == INVALID_HANDLE_VALUE) {
  253. LogMsg("QueryFileSize: file not found\n");
  254. return FALSE;
  255. }
  256. pFileAttr->dwValue = findData.nFileSizeLow;
  257. FindClose(findHandle);
  258. wsprintf(szBuffer, "%d", pFileAttr->dwValue);
  259. ALLOC_VALUE_AND_RETURN();
  260. }
  261. BOOL
  262. QueryModuleType(
  263. PFILEATTRMGR pMgr,
  264. PFILEATTRVALUE pFileAttr)
  265. {
  266. // not implemented
  267. return FALSE;
  268. }
  269. BOOL
  270. QueryBinFileVer(
  271. PFILEATTRMGR pMgr,
  272. PFILEATTRVALUE pFileAttr)
  273. {
  274. ULONGLONG binFileVer;
  275. char szBuffer[64];
  276. FAIL_IF_NO_VERSION();
  277. *((PDWORD)(&binFileVer)) = pMgr->ver.FixedInfo->dwFileVersionLS;
  278. *(((PDWORD)(&binFileVer)) + 1) = pMgr->ver.FixedInfo->dwFileVersionMS;
  279. CopyMemory(pFileAttr->wValue, &binFileVer, 4 * sizeof(WORD));
  280. wsprintf(szBuffer, "%d.%d.%d.%d",
  281. pFileAttr->wValue[3],
  282. pFileAttr->wValue[2],
  283. pFileAttr->wValue[1],
  284. pFileAttr->wValue[0]);
  285. pFileAttr->wMask[0] = pFileAttr->wMask[1] = pFileAttr->wMask[2] = pFileAttr->wMask[3] = 0xFFFF;
  286. ALLOC_VALUE_AND_RETURN();
  287. }
  288. BOOL
  289. QueryBinProductVer(
  290. PFILEATTRMGR pMgr,
  291. PFILEATTRVALUE pFileAttr)
  292. {
  293. ULONGLONG binProdVer;
  294. char szBuffer[64];
  295. FAIL_IF_NO_VERSION();
  296. *((PDWORD)(&binProdVer)) = pMgr->ver.FixedInfo->dwProductVersionLS;
  297. *(((PDWORD)(&binProdVer)) + 1) = pMgr->ver.FixedInfo->dwProductVersionMS;
  298. CopyMemory(pFileAttr->wValue, &binProdVer, 4 * sizeof(WORD));
  299. wsprintf(szBuffer, "%d.%d.%d.%d",
  300. pFileAttr->wValue[3],
  301. pFileAttr->wValue[2],
  302. pFileAttr->wValue[1],
  303. pFileAttr->wValue[0]);
  304. pFileAttr->wMask[0] = pFileAttr->wMask[1] = pFileAttr->wMask[2] = pFileAttr->wMask[3] = 0xFFFF;
  305. ALLOC_VALUE_AND_RETURN();
  306. }
  307. BOOL
  308. QueryFileDateHi(
  309. PFILEATTRMGR pMgr,
  310. PFILEATTRVALUE pFileAttr)
  311. {
  312. char szBuffer[64];
  313. FAIL_IF_NO_VERSION();
  314. pFileAttr->dwValue = pMgr->ver.FixedInfo->dwFileDateMS;
  315. wsprintf(szBuffer, "0x%X", pFileAttr->dwValue);
  316. ALLOC_VALUE_AND_RETURN();
  317. }
  318. BOOL
  319. QueryFileDateLo(
  320. PFILEATTRMGR pMgr,
  321. PFILEATTRVALUE pFileAttr)
  322. {
  323. char szBuffer[64];
  324. FAIL_IF_NO_VERSION();
  325. pFileAttr->dwValue = pMgr->ver.FixedInfo->dwFileDateLS;
  326. wsprintf(szBuffer, "0x%X", pFileAttr->dwValue);
  327. ALLOC_VALUE_AND_RETURN();
  328. }
  329. BOOL
  330. QueryFileVerOs(
  331. PFILEATTRMGR pMgr,
  332. PFILEATTRVALUE pFileAttr)
  333. {
  334. char szBuffer[64];
  335. FAIL_IF_NO_VERSION();
  336. pFileAttr->dwValue = pMgr->ver.FixedInfo->dwFileOS;
  337. wsprintf(szBuffer, "0x%X", pFileAttr->dwValue);
  338. ALLOC_VALUE_AND_RETURN();
  339. }
  340. BOOL QueryFileVerType(
  341. PFILEATTRMGR pMgr,
  342. PFILEATTRVALUE pFileAttr)
  343. {
  344. char szBuffer[64];
  345. FAIL_IF_NO_VERSION();
  346. pFileAttr->dwValue = pMgr->ver.FixedInfo->dwFileType;
  347. wsprintf(szBuffer, "0x%X", pFileAttr->dwValue);
  348. ALLOC_VALUE_AND_RETURN();
  349. }
  350. // ComputeFileCheckSum
  351. //
  352. // computes the check sum for 4096 bytes starting at offset 512.
  353. // The offset and the size of the chunk are modified if the
  354. // file size is too small.
  355. DWORD
  356. ComputeFileCheckSum(
  357. PSTR pszFile,
  358. WIN32_FIND_DATA* pFindData)
  359. {
  360. INT i,size = 4096;
  361. DWORD startAddr = 512;
  362. HANDLE fileHandle = INVALID_HANDLE_VALUE;
  363. PCHAR buffer = NULL;
  364. DWORD checkSum = 0;
  365. DWORD dontCare;
  366. if (pFindData->nFileSizeLow < (ULONG)size) {
  367. //
  368. // File size is less than 4096. We set the start address to 0 and set the size for the checksum
  369. // to the actual file size.
  370. //
  371. startAddr = 0;
  372. size = pFindData->nFileSizeLow;
  373. } else if (startAddr + size > pFindData->nFileSizeLow) {
  374. //
  375. // File size is too small. We set the start address so that size of checksum can be 4096 bytes
  376. //
  377. startAddr = pFindData->nFileSizeLow - size;
  378. }
  379. if (size <= 3) {
  380. //
  381. // we need at least 3 bytes to be able to do something here.
  382. //
  383. return 0;
  384. }
  385. __try {
  386. buffer = (PCHAR)HeapAlloc(GetProcessHeap(), 0, size);
  387. if (buffer == NULL) {
  388. __leave;
  389. }
  390. fileHandle = CreateFile(pszFile,
  391. GENERIC_READ,
  392. FILE_SHARE_READ,
  393. NULL,
  394. OPEN_EXISTING,
  395. 0,
  396. NULL);
  397. if (fileHandle == INVALID_HANDLE_VALUE) {
  398. __leave;
  399. }
  400. if (SetFilePointer(fileHandle, startAddr, NULL, FILE_BEGIN) != startAddr) {
  401. __leave;
  402. }
  403. if (!ReadFile(fileHandle, buffer, size, &dontCare, NULL)) {
  404. __leave;
  405. }
  406. for (i = 0; i<(size - 3); i+=4) {
  407. checkSum += *((PDWORD) (buffer + i));
  408. checkSum = _rotr(checkSum ,1);
  409. }
  410. }
  411. __finally {
  412. if (fileHandle != INVALID_HANDLE_VALUE) {
  413. CloseHandle (fileHandle);
  414. }
  415. if (buffer != NULL) {
  416. HeapFree(GetProcessHeap(), 0, buffer);
  417. }
  418. }
  419. return checkSum;
  420. }
  421. BOOL QueryFileCheckSum(
  422. PFILEATTRMGR pMgr,
  423. PFILEATTRVALUE pFileAttr)
  424. {
  425. WIN32_FIND_DATA findData;
  426. HANDLE findHandle;
  427. char szBuffer[64];
  428. findHandle = FindFirstFile(pMgr->ver.pszFile, &findData);
  429. if (findHandle == INVALID_HANDLE_VALUE) {
  430. LogMsg("QueryFileCheckSum: Cannot find file %s\n",
  431. pMgr->ver.pszFile);
  432. return FALSE;
  433. }
  434. pFileAttr->dwValue = ComputeFileCheckSum(pMgr->ver.pszFile, &findData);
  435. FindClose(findHandle);
  436. wsprintf(szBuffer, "0x%X", pFileAttr->dwValue);
  437. ALLOC_VALUE_AND_RETURN();
  438. }
  439. // GetImageNtHeader
  440. //
  441. // This function returns the address of the NT Header.
  442. // Returns the address of the NT Header.
  443. PIMAGE_NT_HEADERS
  444. GetImageNtHeader(
  445. IN PVOID Base)
  446. {
  447. PIMAGE_NT_HEADERS NtHeaders;
  448. if (Base != NULL && Base != (PVOID)-1) {
  449. if (((PIMAGE_DOS_HEADER)Base)->e_magic == IMAGE_DOS_SIGNATURE) {
  450. NtHeaders = (PIMAGE_NT_HEADERS)((PCHAR)Base + ((PIMAGE_DOS_HEADER)Base)->e_lfanew);
  451. if (NtHeaders->Signature == IMAGE_NT_SIGNATURE) {
  452. return NtHeaders;
  453. }
  454. }
  455. }
  456. return NULL;
  457. }
  458. BOOL
  459. GetHeaderCheckSum(
  460. PFILEATTRMGR pMgr,
  461. DWORD* pdwCheckSum)
  462. {
  463. HANDLE fileHandle;
  464. DWORD bytesRead;
  465. IMAGE_DOS_HEADER dh;
  466. LOADED_IMAGE image;
  467. DWORD sign;
  468. PWORD signNE = (PWORD)&sign;
  469. BOOL result = FALSE;
  470. *pdwCheckSum = 0;
  471. fileHandle = CreateFile(pMgr->ver.pszFile,
  472. GENERIC_READ,
  473. FILE_SHARE_READ,
  474. NULL,
  475. OPEN_EXISTING,
  476. 0,
  477. NULL);
  478. if (fileHandle == INVALID_HANDLE_VALUE) {
  479. return FALSE;
  480. }
  481. __try {
  482. __try {
  483. if (!ReadFile(fileHandle, &dh, sizeof(IMAGE_DOS_HEADER), &bytesRead, NULL) ||
  484. bytesRead != sizeof (IMAGE_DOS_HEADER)) {
  485. __leave;
  486. }
  487. if (dh.e_magic != IMAGE_DOS_SIGNATURE) {
  488. __leave;
  489. }
  490. if (SetFilePointer(fileHandle, dh.e_lfanew, NULL, FILE_BEGIN) != (DWORD)dh.e_lfanew) {
  491. __leave;
  492. }
  493. if (!ReadFile(fileHandle, &sign, sizeof(DWORD), &bytesRead, NULL) ||
  494. bytesRead != sizeof (DWORD)) {
  495. __leave;
  496. }
  497. CloseHandle(fileHandle);
  498. fileHandle = INVALID_HANDLE_VALUE;
  499. if (sign == IMAGE_NT_SIGNATURE) {
  500. if (MapAndLoad(pMgr->ver.pszFile, NULL, &image, FALSE, TRUE)) {
  501. PIMAGE_NT_HEADERS NtHeaders;
  502. __try {
  503. NtHeaders = GetImageNtHeader(image.MappedAddress);
  504. if (NtHeaders != NULL) {
  505. if (NtHeaders->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
  506. *pdwCheckSum = ((PIMAGE_NT_HEADERS32)NtHeaders)->OptionalHeader.CheckSum;
  507. } else if (NtHeaders->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
  508. *pdwCheckSum = ((PIMAGE_NT_HEADERS64)NtHeaders)->OptionalHeader.CheckSum;
  509. }
  510. result = TRUE;
  511. }
  512. }
  513. __except (1) {
  514. LogMsg("Access violation while examining %s\n", pMgr->ver.pszFile);
  515. }
  516. UnMapAndLoad(&image);
  517. }
  518. }
  519. }
  520. __finally {
  521. if (fileHandle != INVALID_HANDLE_VALUE) {
  522. CloseHandle(fileHandle);
  523. }
  524. }
  525. }
  526. __except (EXCEPTION_EXECUTE_HANDLER) {
  527. CloseHandle(fileHandle);
  528. result = FALSE;
  529. }
  530. return result;
  531. }
  532. BOOL
  533. QueryFilePECheckSum(
  534. PFILEATTRMGR pMgr,
  535. PFILEATTRVALUE pFileAttr)
  536. {
  537. char szBuffer[64];
  538. if (!GetHeaderCheckSum(pMgr, &pFileAttr->dwValue) || pFileAttr->dwValue == 0) {
  539. LogMsg("QueryFilePECheckSum: Cannot get the header check sum for %s\n",
  540. pMgr->ver.pszFile);
  541. return FALSE;
  542. }
  543. wsprintf(szBuffer, "0x%X", pFileAttr->dwValue);
  544. ALLOC_VALUE_AND_RETURN();
  545. }
  546. BOOL
  547. QueryCompanyName(
  548. PFILEATTRMGR pMgr,
  549. PFILEATTRVALUE pFileAttr)
  550. {
  551. FAIL_IF_NO_VERSION();
  552. QUERYENTRY("COMPANYNAME");
  553. }
  554. BOOL
  555. QueryProductVersion(
  556. PFILEATTRMGR pMgr,
  557. PFILEATTRVALUE pFileAttr)
  558. {
  559. FAIL_IF_NO_VERSION();
  560. QUERYENTRY("PRODUCTVERSION");
  561. }
  562. BOOL
  563. QueryProductName(
  564. PFILEATTRMGR pMgr,
  565. PFILEATTRVALUE pFileAttr)
  566. {
  567. FAIL_IF_NO_VERSION();
  568. QUERYENTRY("PRODUCTNAME");
  569. }
  570. BOOL
  571. QueryFileDescription(
  572. PFILEATTRMGR pMgr,
  573. PFILEATTRVALUE pFileAttr)
  574. {
  575. FAIL_IF_NO_VERSION();
  576. QUERYENTRY("FILEDESCRIPTION");
  577. }
  578. BOOL
  579. QueryFileVersion(
  580. PFILEATTRMGR pMgr,
  581. PFILEATTRVALUE pFileAttr)
  582. {
  583. FAIL_IF_NO_VERSION();
  584. QUERYENTRY("FILEVERSION");
  585. }
  586. BOOL
  587. QueryOriginalFileName(
  588. PFILEATTRMGR pMgr,
  589. PFILEATTRVALUE pFileAttr)
  590. {
  591. FAIL_IF_NO_VERSION();
  592. QUERYENTRY("ORIGINALFILENAME");
  593. }
  594. BOOL
  595. QueryInternalName(
  596. PFILEATTRMGR pMgr,
  597. PFILEATTRVALUE pFileAttr)
  598. {
  599. FAIL_IF_NO_VERSION();
  600. QUERYENTRY("INTERNALNAME");
  601. }
  602. BOOL
  603. QueryLegalCopyright(
  604. PFILEATTRMGR pMgr,
  605. PFILEATTRVALUE pFileAttr)
  606. {
  607. FAIL_IF_NO_VERSION();
  608. QUERYENTRY("LEGALCOPYRIGHT");
  609. }
  610. BOOL
  611. Query16BitDescription(
  612. PFILEATTRMGR pMgr,
  613. PFILEATTRVALUE pFileAttr)
  614. {
  615. //char szBuffer[64];
  616. pFileAttr->dwValue = 0;
  617. //wsprintf(szBuffer, "0x%X", pFileAttr->dwValue);
  618. return FALSE;
  619. //ALLOC_VALUE_AND_RETURN();
  620. }