50 |
/* End */ |
/* End */ |
51 |
|
|
52 |
|
|
53 |
|
/* Retrieve the product verion of the given file @fname. |
54 |
|
Format: MAJOR.MINOR.PATCH1.PATCH2 |
55 |
|
Return value: 0 on success. */ |
56 |
|
int |
57 |
|
get_file_version (const char *fname, WORD *major, WORD *minor, WORD *patch1, WORD *patch2) |
58 |
|
{ |
59 |
|
VS_FIXEDFILEINFO *inf; |
60 |
|
char file[MAX_PATH+1] = {0}; |
61 |
|
LPVOID buf, data; |
62 |
|
DWORD size; |
63 |
|
UINT qlen; |
64 |
|
int err = 0; |
65 |
|
|
66 |
|
strncpy (file, fname, MAX_PATH); |
67 |
|
size = GetFileVersionInfoSize (file, NULL); |
68 |
|
if (!size) |
69 |
|
return -1; |
70 |
|
|
71 |
|
buf = (LPVOID)new char[size]; |
72 |
|
if (!buf) |
73 |
|
BUG (NULL); |
74 |
|
if (!GetFileVersionInfo (file, 0, size, buf)) { |
75 |
|
err = -1; |
76 |
|
goto fail; |
77 |
|
} |
78 |
|
|
79 |
|
qlen = 0; |
80 |
|
VerQueryValue (buf, (char*)"\\", &data, &qlen); |
81 |
|
if (!qlen) { |
82 |
|
err = -1; |
83 |
|
goto fail; |
84 |
|
} |
85 |
|
|
86 |
|
inf = (VS_FIXEDFILEINFO*)data; |
87 |
|
*major = HIWORD (inf->dwProductVersionMS); |
88 |
|
*minor = LOWORD (inf->dwProductVersionMS); |
89 |
|
*patch1 = HIWORD (inf->dwProductVersionLS); |
90 |
|
*patch2 = LOWORD (inf->dwProductVersionLS); |
91 |
|
|
92 |
|
fail: |
93 |
|
delete [](char*)buf; |
94 |
|
return err; |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
/* Load the key cache and rebuild the signature cache. */ |
/* Load the key cache and rebuild the signature cache. */ |
99 |
int |
int |
100 |
update_keycache (HWND hwnd) |
update_keycache (HWND hwnd) |