-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAboutMessage.cpp
More file actions
30 lines (23 loc) · 942 Bytes
/
AboutMessage.cpp
File metadata and controls
30 lines (23 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "stdafx.h"
void DisplayAboutMessage(HINSTANCE hInstance)
{
TCHAR* Product = TEXT("Unknown");
TCHAR* Version = TEXT("Unknown");
TCHAR FileName[MAX_PATH];
GetModuleFileName(hInstance, FileName, ARRAYSIZE(FileName));
DWORD Dummy;
DWORD Size = GetFileVersionInfoSize(FileName, &Dummy);
void* Info = nullptr;
if (Size > 0)
{
Info = malloc(Size);
// VS_VERSION_INFO VS_VERSIONINFO VS_FIXEDFILEINFO
GetFileVersionInfo(FileName, Dummy, Size, Info);
UINT Length;
VerQueryValue(Info, TEXT("\\StringFileInfo\\0c0904b0\\ProductName"), (LPVOID *) &Product, &Length);
VerQueryValue(Info, TEXT("\\StringFileInfo\\0c0904b0\\FileVersion"), (LPVOID *) &Version, &Length);
}
_tprintf(_T("%s Version %s\n"), Product, Version);
_tprintf(_T(" By Adam Gates (adamgates84+software@gmail.com) - http://is.gd/radsoft\n"));
free(Info);
}