| 585 | } |
| 586 | |
| 587 | static void GetAppleWinVersion(void) |
| 588 | { |
| 589 | char szPath[_MAX_PATH]; |
| 590 | |
| 591 | if (0 == GetModuleFileName(NULL, szPath, sizeof(szPath))) |
| 592 | strcpy_s(szPath, sizeof(szPath), __argv[0]); |
| 593 | |
| 594 | // Extract application version and store in a global variable |
| 595 | DWORD dwHandle, dwVerInfoSize; |
| 596 | |
| 597 | dwVerInfoSize = GetFileVersionInfoSize(szPath, &dwHandle); |
| 598 | |
| 599 | if (dwVerInfoSize > 0) |
| 600 | { |
| 601 | char* pVerInfoBlock = new char[dwVerInfoSize]; |
| 602 | |
| 603 | if (GetFileVersionInfo(szPath, NULL, dwVerInfoSize, pVerInfoBlock)) |
| 604 | { |
| 605 | VS_FIXEDFILEINFO* pFixedFileInfo; |
| 606 | UINT pFixedFileInfoLen; |
| 607 | |
| 608 | VerQueryValue(pVerInfoBlock, "\\", (LPVOID*) &pFixedFileInfo, (PUINT) &pFixedFileInfoLen); |
| 609 | |
| 610 | // Construct version string from fixed file info block |
| 611 | |
| 612 | UINT16 major = pFixedFileInfo->dwFileVersionMS >> 16; |
| 613 | UINT16 minor = pFixedFileInfo->dwFileVersionMS & 0xffff; |
| 614 | UINT16 fix = pFixedFileInfo->dwFileVersionLS >> 16; |
| 615 | UINT16 fix_minor = pFixedFileInfo->dwFileVersionLS & 0xffff; |
| 616 | SetAppleWinVersion(major, minor, fix, fix_minor); |
| 617 | } |
| 618 | |
| 619 | delete [] pVerInfoBlock; |
| 620 | } |
| 621 | |
| 622 | LogFileOutput("%s\n", GetAppleWinVersionAndBuild().c_str()); |
| 623 | } |
| 624 | |
| 625 | // DO ONE-TIME INITIALIZATION |
| 626 | static void OneTimeInitialization(HINSTANCE passinstance) |
no test coverage detected