forked from cheat-engine/cheat-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AccessCheck.pas
executable file
·62 lines (47 loc) · 1.48 KB
/
AccessCheck.pas
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
unit AccessCheck;
{obsolete, all files are now in the user or temp folder}
{$MODE Delphi}
{
This unit will contain routines to be used for testing and verifying that ce has
the required access needed.
FileAccessTest is the main routine
}
interface
uses LCLIntf, SysUtils, classes, forms, CEFuncProc, NewKernelHandler;
procedure FileAccessTest;
implementation
uses Globals;
resourcestring
rsNoFileCreationRightsOrNoFileOverwriteRights = 'No file creation rights or no file overwrite rights';
rsNoFileModificationRights = 'No file modification rights';
rsNoFileDeletionRights = 'No file deletion rights';
rsNoDeleteRights = 'No delete rights';
rsButYouDoHaveModifyRights = 'But you do have modify rights';
procedure FileAccessTest;
var f: tfilestream;
begin
try
f:=TFilestream.Create(CheatEngineDir+'accesscheck.tmp', fmCreate);
try
f.WriteBuffer(rsNoDeleteRights+#13#10,18);
finally
f.Free;
end;
except
raise exception.Create(rsNoFileCreationRightsOrNoFileOverwriteRights);
end;
try
f:=TFilestream.Create(CheatEngineDir+'accesscheck.tmp', fmOpenReadWrite);
try
f.Seek(0,soFromEnd);
f.WriteBuffer(rsButYouDoHaveModifyRights+#13#10,31);
finally
f.free;
end;
except
raise exception.Create(rsNoFileModificationRights);
end;
if not deletefile(CheatEngineDir+'accesscheck.tmp') then
raise exception.Create(rsNoFileDeletionRights);
end;
end.