mirror of
https://github.com/microsoft/DirectXTex.git
synced 2026-02-07 13:26:13 +01:00
Added version info to tex tool logo output
This commit is contained in:
@@ -697,7 +697,33 @@ namespace
|
||||
|
||||
void PrintLogo()
|
||||
{
|
||||
wprintf(L"Microsoft (R) DirectX Texture Converter (DirectXTex version)\n");
|
||||
wchar_t version[32] = {};
|
||||
|
||||
wchar_t appName[_MAX_PATH] = {};
|
||||
if (GetModuleFileNameW(nullptr, appName, _countof(appName)))
|
||||
{
|
||||
DWORD size = GetFileVersionInfoSizeW(appName, nullptr);
|
||||
if (size > 0)
|
||||
{
|
||||
auto verInfo = std::make_unique<uint8_t[]>(size);
|
||||
if (GetFileVersionInfoW(appName, 0, size, verInfo.get()))
|
||||
{
|
||||
LPVOID lpstr = nullptr;
|
||||
UINT strLen = 0;
|
||||
if (VerQueryValueW(verInfo.get(), L"\\StringFileInfo\\040904B0\\ProductVersion", &lpstr, &strLen))
|
||||
{
|
||||
wcsncpy_s(version, reinterpret_cast<const wchar_t*>(lpstr), strLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!*version || wcscmp(version, L"1.0.0.0") == 0)
|
||||
{
|
||||
swprintf_s(version, L"%03d (library)", DIRECTX_TEX_VERSION);
|
||||
}
|
||||
|
||||
wprintf(L"Microsoft (R) DirectX Texture Converter [DirectXTex] Version %ls\n", version);
|
||||
wprintf(L"Copyright (C) Microsoft Corp. All rights reserved.\n");
|
||||
#ifdef _DEBUG
|
||||
wprintf(L"*** Debug build ***\n");
|
||||
|
||||
Reference in New Issue
Block a user