Ai
1 Star 0 Fork 0

phy0292/cheat-engine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
first.pas 2.26 KB
一键复制 编辑 原始数据 按行查看 历史
cheat-engine 提交于 2019-12-20 00:49 +08:00 . Fix registry issues
unit first;
{$mode objfpc}{$H+}
interface
{$ifdef windows}
uses
betterDLLSearchPath, Classes, SysUtils;
{$endif}
implementation
{$ifdef windows}
uses windows, registry, Win32Int;
procedure setDPIAware; //won't work in windows 10 anymore
type
PROCESS_DPI_AWARENESS=(PROCESS_DPI_UNAWARE=0, PROCESS_SYSTEM_DPI_AWARE=1, PROCESS_PER_MONITOR_DPI_AWARE=2);
var
SetProcessDpiAwareness:function(value: PROCESS_DPI_AWARENESS):HRESULT; stdcall;
SetProcessDPIAware:function: BOOL; stdcall;
l: HModule;
begin
OutputDebugString('setDPIAware');
l:=LoadLibrary('Shcore.dll');
if l<>0 then
begin
farproc(SetProcessDpiAwareness):=GetProcAddress(l,'SetProcessDpiAwareness');
if assigned(SetProcessDpiAwareness) then
begin
// OutputDebugString('p1');
SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE);
exit;
end;
end;
//still here, probably win8.0 or 7
l:=LoadLibrary('user32.dll');
if l<>0 then
begin
// OutputDebugString('p2');
farproc(SetProcessDPIAware):=GetProcAddress(l,'SetProcessDPIAware');
if assigned(SetProcessDPIAware) then
SetProcessDPIAware;
end;
OutputDebugString('p3');
end;
var
i: integer;
istrainer: boolean;
r: TRegistry;
hassetdpiaware: boolean;
initialization
//todo, check registry if not a trainer
istrainer:=false;
hassetdpiaware:=false;
for i:=1 to Paramcount do
begin
if ParamStr(i)='DPIAWARE' then
begin
setDPIAware;
hassetdpiaware:=true;
end;
if pos('.CETRAINER', uppercase(ParamStr(i)))>0 then
istrainer:=true;
end;
if not (istrainer or hassetdpiaware) then
begin
//check the registry
r := TRegistry.Create;
r.RootKey := HKEY_CURRENT_USER;
if r.OpenKey('\Software\Cheat Engine',false) then
begin
if (r.ValueExists('DPI Aware')=false) or r.ReadBool('DPI Aware') then
setDPIAware;
end
else
begin
//first time CE is ran, and not a trainer.
if r.OpenKey('\Software\Cheat Engine',true) then
begin
//I do have access
setDPIAware; //default config is enabled
r.WriteBool('DPI Aware', true);
end;
end;
r.free;
r:=nil;
end;
{$endif}
end.
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/phy0292/cheat-engine.git
git@gitee.com:phy0292/cheat-engine.git
phy0292
cheat-engine
cheat-engine
master

搜索帮助