Menu

[e89469]: / setup / about.c  Maximize  Restore  History

Download this file

80 lines (61 with data), 2.1 kB

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Copyright (c) 2003, Sergey Zorin. All rights reserved.
*
* This software is distributable under the BSD license. See the terms
* of the BSD license in the LICENSE file provided with this software.
*
*/
#include <windows.h>
#include "diff_ext_setup.rh"
static BOOL CALLBACK about_dialog_func(HWND dialog, UINT msg, WPARAM w_param, LPARAM l_param);
void
about(HANDLE resource, HWND parent) {
DialogBoxParam(resource, MAKEINTRESOURCE(IDD_ABOUT), parent, about_dialog_func, (LPARAM)resource);
}
static void
init(HWND dialog, WPARAM not_used_1, LPARAM l_param) {
DWORD file_versioninfo_size;
DWORD version_handle;
TCHAR path[MAX_PATH];
HANDLE resource = (HANDLE)l_param;
GetModuleFileName(resource, path, sizeof(path)/sizeof(path[0]));
file_versioninfo_size = GetFileVersionInfoSize(path, &version_handle);
if(file_versioninfo_size > 0) {
void* file_versioninfo = malloc(file_versioninfo_size);
struct {WORD language; WORD codepage;}* translations;
UINT length = 0;
TCHAR version_block[] = TEXT("\\StringFileInfo\\12341234\\ProductVersion");
TCHAR* product_version;
GetFileVersionInfo(path, 0, file_versioninfo_size, file_versioninfo);
VerQueryValue(file_versioninfo, "\\VarFileInfo\\Translation", (void**)&translations, &length);
if(length > 0) {
wsprintf(version_block, TEXT("\\StringFileInfo\\%04x%04x\\ProductVersion"), translations[0].language, translations[0].codepage);
VerQueryValue(file_versioninfo, version_block, (void**)&product_version, &length);
if(length > 0) {
SetDlgItemText(dialog, ID_VERSION, product_version);
}
}
free(file_versioninfo);
}
}
static BOOL CALLBACK
about_dialog_func(HWND dialog, UINT msg, WPARAM w_param, LPARAM l_param) {
BOOL ret = FALSE;
switch (msg) {
case WM_INITDIALOG:
init(dialog, w_param, l_param);
ret = TRUE;
break;
case WM_CLOSE:
EndDialog(dialog, 1);
ret = TRUE;
break;
case WM_COMMAND:
if(LOWORD(w_param) == IDOK) {
EndDialog(dialog, 1);
ret = TRUE;
}
break;
}
return ret;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.