-
Notifications
You must be signed in to change notification settings - Fork 7
/
Notes.txt
208 lines (196 loc) · 6.59 KB
/
Notes.txt
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
Îáùèå êàòàëîãè:
- C:\Windows\Temp
- C:\Windows\*.log\*.tmp
- C:\Users\AppData\Local\Temp
- C:\Users\<User>\AppData\Local\Microsoft\Windows\Temporary Internet Files\
- C:\D&S\<User>\Local Settings\Temp
- C:\D&S\<User>\Local Settings\Temporary Internet Files\
- C:\Windows\Prefetch\*.pf
C:Windows\Software\Distribution
‚ ïàïêå õðàíßòñß ïàïêè è ôàéëû, çàêà÷àííûå ñ ïîìîùüþ àâòîìàòè÷åñêîãî îáíîâëåíèß.
-----------------------------------------------------------------
uses Windows, SysUtils;
type // òèï - ñïèñîê èçâåñòíûõ ìíå òåãîâ èíôîðìàöèè î âåðñèè ôàéëà (MSDN 6.0)
TFviTags = (
fviComments,
fviCompanyName,
fviFileDescription,
fviFileVersion,
fviInternalName,
fviLegalCopyright,
fviLegalTrademarks,
fviOriginalFilename,
fviPrivateBuild,
fviProductName,
fviProductVersion,
fviSpecialBuild
);
const // ˆìåíà ïîëåé (òåãîâ) ïî-àíãëèéñêè:
cFviFieldsDef : array[TFviTags] of String = (
'Comments',
'CompanyName',
'FileDescription',
'FileVersion',
'InternalName',
'LegalCopyright',
'LegalTrademarks',
'OriginalFilename',
'PrivateBuild',
'ProductName',
'ProductVersion',
'SpecialBuild'
);
const // ˆìåíà ïîëåé (òåãîâ) ïî-ðóññêè:
cFviFieldsRus : array[TFviTags] of String = (
'Šîììåíòàðèé',
'ðîèçâîäèòåëü',
'Žïèñàíèå',
'‚åðñèß ôàéëà',
'‚íóòðåííåå èìß',
'€âòîðñêèå ïðàâà',
'’îðãîâûå çíàêè',
'ˆñõîäíîå èìß ôàéëà',
'ðèâàòíàß âåðñèß',
'àçâàíèå ïðîäóêòà',
'‚åðñèß ïðîäóêòà',
'Žñîáàß âåðñèß'
);
const
RusLangID = $0419;
type
TFileVersionInfoRecord = record
LangID: Word; // Windows language identifier
LangCP: Word; // Code page for the language
LangName: array[0..255] of Char; // Žòîáðàæàåìîå Windows èìß ßçûêà
FieldDef: array[TFviTags] of String; // èìß ïàðàìåòðà ïî-àíãëèéñêè
FieldRus: array[TFviTags] of String; // èìß ïàðàìåòðà ïî-ðóññêè
Value: array[TFviTags] of String; // çíà÷åíèå ïàðàìåòðà
FileVer: String; // ßçûêî-íåçàâèñèìîå çíà÷åíèå âåðñèè ôàéëà
ProductVer: String; // ßçûêî-íåçàâèñèìîå çíà÷åíèå âåðñèè ïðîäóêòà
BuildType: String; // ßçûêî-íåçàâèñèìîå - òèï ñáîðêè
FileType: String; // ßçûêî-íåçàâèñèìîå - òèï ïðîäóêòà
end;
procedure
GetFileVersionInfoRecord(
const FileName: String;
out InfoRecord: TFileVersionInfoRecord;
out FieldsCount: Integer
);
var
AppFileInfo: TFileVersionInfoRecord;
AppInfoFound: Boolean;
////////////////////////////////////////////////////////////////////////////////
implementation
procedure
GetFileVersionInfoRecord(
const FileName: String;
out InfoRecord: TFileVersionInfoRecord;
out FieldsCount: Integer
);
type
TLangRec = array[0..1] of Word;
var
InfoSize, zero: Cardinal;
pbuff: Pointer;
pk: Pointer;
nk: Cardinal;
pffi: ^VS_FIXEDFILEINFO;
lang_hex_str: String;
i: TFviTags;
begin
FieldsCount := 0;
pbuff := Nil;
InfoSize := GetFileVersionInfoSize(PChar(FileName),zero);
if InfoSize<>0 then
try
GetMem(pbuff,InfoSize);
if GetFileVersionInfo(PChar(FileName),0,InfoSize,pbuff) then
begin
// root information - ßçûêî-íåçàâèñèìàß èíôîðìàöèß:
if VerQueryValue(pbuff,'\',Pointer(pffi),nk) then
with InfoRecord do begin
// ßçûê - íåèçâåñòíûé:
LangID := 0;
INC(FieldsCount);
LangCP := 0;
INC(FieldsCount);
VerLanguageName(LangID,@LangName,256);
INC(FieldsCount);
// ßçûêî-íåçàâèñèìîå - âåðñèß ôàéëà:
FileVer :=
IntToStr(pffi^.dwFileVersionMS shr 16) + '.' +
IntToStr(pffi^.dwFileVersionMS shl 16 shr 16) + '.' +
IntToStr(pffi^.dwFileVersionLS shr 16) + '.' +
IntToStr(pffi^.dwFileVersionLS shl 16 shr 16);
INC(FieldsCount);
// ßçûêî-íåçàâèñèìîå - âåðñèß ïðîäóêòà:
ProductVer :=
IntToStr(pffi^.dwProductVersionMS shr 16) + '.' +
IntToStr(pffi^.dwProductVersionMS shl 16 shr 16) + '.' +
IntToStr(pffi^.dwProductVersionLS shr 16) + '.' +
IntToStr(pffi^.dwProductVersionLS shl 16 shr 16);
INC(FieldsCount);
// ßçûêî-íåçàâèñèìîå - òèï ñáîðêè:
if (pffi^.dwFileFlags and VS_FF_DEBUG)<>0 then
BuildType := BuildType + 'debug, ';
if (pffi^.dwFileFlags and VS_FF_INFOINFERRED)<>0 then
BuildType := BuildType + 'info inferred, ';
if (pffi^.dwFileFlags and VS_FF_PATCHED)<>0 then
BuildType := BuildType + 'patched, ';
if (pffi^.dwFileFlags and VS_FF_PRERELEASE)<>0 then
BuildType := BuildType + 'prerelease, ';
if (pffi^.dwFileFlags and VS_FF_PRIVATEBUILD)<>0 then
BuildType := BuildType + 'private build, ';
if (pffi^.dwFileFlags and VS_FF_SPECIALBUILD)<>0 then
BuildType := BuildType + 'special build, ';
if BuildType<>EmptyStr then
Delete(BuildType,Length(BuildType)-1,2);
INC(FieldsCount);
// ßçûêî-íåçàâèñèìîå - òèï èñïîëíèìîãî ôàéëà:
if (pffi^.dwFileType and VFT_UNKNOWN)<>0 then
FileType := 'unknown'
else if (pffi^.dwFileType and VFT_APP)<>0 then
FileType := 'application'
else if (pffi^.dwFileType and VFT_DLL)<>0 then
FileType := 'DLL'
else if (pffi^.dwFileType and VFT_DRV)<>0 then
FileType := 'driver'
else if (pffi^.dwFileType and VFT_FONT)<>0 then
FileType := 'font'
else if (pffi^.dwFileType and VFT_VXD)<>0 then
FileType := 'VXD'
else if (pffi^.dwFileType and VFT_STATIC_LIB)<>0 then
FileType := 'static lib';
INC(FieldsCount);
end;
// string and var information - locale depended:
if VerQueryValue(pbuff,'\VarFileInfo\Translation',pk,nk) then
with InfoRecord do begin
// language and codepage information:
LangID := TLangRec(pk^)[0];
INC(FieldsCount);
LangCP := TLangRec(pk^)[1];
INC(FieldsCount);
VerLanguageName(LangID,@LangName,256);
INC(FieldsCount);
lang_hex_str := Format('%.4x',[LangID]) + Format('%.4x',[LangCP]);
// string information - çàâèñèìàß îò ßçûêà èíôîðìàöèß:
for i := Low(TFviTags) to High(TFviTags) do
if VerQueryValue(pbuff,PChar('\\StringFileInfo\\'+lang_hex_str+'\\'+
cFviFieldsDef[i]),pk,nk) then
begin
FieldDef[i] := cFviFieldsDef[i];
if LangId = RusLangID then
FieldRus[i] := cFviFieldsRus[i]
else
FieldRus[i] := '';
Value[i] := String(PChar(pk));
INC(FieldsCount);
end;
end;
end;
finally
if pbuff<>Nil then
FreeMem(pbuff);
end
end;