-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvcversion.dpr
65 lines (55 loc) · 1.59 KB
/
vcversion.dpr
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
library vcversion;
uses
Windows,
uVerAdjust in 'uVerAdjust.pas';
{$R *.res}
{ Types }
type
TGTAVersion = (verUnknown, verGTAVC_US_10, verGTAVC_US_11, verGTAVC_AUS_10,
verGTAVC_GER_10, verGTAVC_GER_11);
{ Functions }
function AdjustOffset(Offset: LongWord;
TargetVersion: TGTAVersion): LongWord; stdcall;
begin
case TargetVersion of
verGTAVC_US_10: Result := Offset;
verGTAVC_US_11: Result := AdjustOffsetUS11(Offset);
verGTAVC_AUS_10: Result := AdjustOffsetAUS10(Offset);
verGTAVC_GER_10: Result := AdjustOffsetGER10(Offset);
verGTAVC_GER_11: Result := AdjustOffsetGER11(Offset);
else
Result := Offset;
end;
end;
function DetectVersion(Process: THandle): TGTAVersion; stdcall;
var
p: PLongWord;
protect1, protect2: LongWord;
Buffer, BytesRead: LongWord;
begin
Result := verUnknown;
p := PLongWord($6339D0);
if VirtualProtectEx(Process, p, $10, PAGE_READWRITE, protect1) then
begin
ReadProcessMemory(Process, p, @Buffer, SizeOf(Buffer), BytesRead);
if BytesRead = SizeOf(Buffer) then
begin
if Buffer = $FFE8874C then
Result := verGTAVC_US_10
else if Buffer = $0000CC24 then
Result := verGTAVC_US_11
else if Buffer = $FFE8885C then
Result := verGTAVC_AUS_10
else if Buffer = $FFE8875C then
Result := verGTAVC_GER_10
else if Buffer = $0000DC24 then
Result := verGTAVC_GER_11;
end;
VirtualProtectEx(Process, p, $10, protect1, protect2);
end;
end;
{ DLL Specific }
exports
AdjustOffset, DetectVersion;
begin
end.