首页 > 其他分享 >Delphi皮肤控件AlphaControls去NAG提示

Delphi皮肤控件AlphaControls去NAG提示

时间:2024-07-21 10:51:38浏览次数:10  
标签:AddressFound 控件 begin end NAG AlphaControls StartAddr ProcessHandle DWORD

国外知名皮肤控件AlphaControls,一些好看的皮肤会弹出对话框....

用查找句柄的方法去发消息关闭对话框,都不得行...,以为是屏敝了消息,自定义消息也失效。

后面用修改内存地址指令的方法,就可以有效的去掉NAG提示

function FindPattern(ProcessHandle: THandle; StartAddr, EndAddr: DWORD; const Pattern: array of Byte; PatternSize: Integer): DWORD;
var
  Buffer: array of Byte;
  BytesRead: Cardinal;
  CurrentAddr: DWORD;
  i: Integer;
begin
  SetLength(Buffer, EndAddr - StartAddr);
  // 读取整个内存区域
  if ReadProcessMemory(ProcessHandle, Pointer(StartAddr), @Buffer[0], Length(Buffer), BytesRead) then
  begin
    for CurrentAddr := StartAddr to EndAddr - PatternSize do
    begin
      for i := 0 to PatternSize - 1 do
      begin
        if Buffer[CurrentAddr - StartAddr + i] <> Pattern[i] then
          Break;
        if i = PatternSize - 1 then
        begin
          Result := CurrentAddr; // 找到目标地址,返回找到的地址
          Exit; // 退出函数
        end;
      end;
    end;
  end;
  Result := 0; // 没有找到
end;

procedure PatchMemory;
var
  ProcessID: DWORD;
  ProcessHandle: THandle;
  StartAddr, EndAddr: DWORD;
  AddressFound: DWORD;
  OldProtect: DWORD; // 用于保存旧的保护属性
  I: Integer;
const
  TARGET_INSTRUCTION: array[0..4] of Byte = ($68, $40, $00, $06, $00);  // 定义特征码
  PROCESS_READ_MEMORY = $0010; // 定义 PROCESS_READ_MEMORY 常量
begin
  ProcessHandle := 0; // 初始化进程句柄
  try
    ProcessID := GetCurrentProcessId; // 获取目标进程的ID
    // 打开目标进程
    ProcessHandle := OpenProcess(PROCESS_READ_MEMORY, False, ProcessID);
    if ProcessHandle = 0 then
    begin
      ShowMessage('无法打开进程: ' + SysErrorMessage(GetLastError));
      Exit;
    end;
    // 定义搜索内存的范围
    StartAddr := $0057D73D; // 搜索起始地址
    EndAddr := $0057D8AF;  // 结束地址
    // 查找目标地址
    AddressFound := FindPattern(ProcessHandle, StartAddr, EndAddr, TARGET_INSTRUCTION, Length(TARGET_INSTRUCTION));
    if AddressFound <> 0 then
    begin
     // ShowMessage('找到地址: ' + IntToHex(AddressFound, 8));
     //PatchMemory2(AddressFound); //  调用补丁函数

     // 修改内存保护为可读写执行
      if VirtualProtect(Pointer(AddressFound), 21, PAGE_EXECUTE_READWRITE, OldProtect) then
      begin
        try
          for I := 0 to 21 do  //修改22个基址
          begin
        // 写入 NOP 指令 (0x90)
            PByte(Pointer(AddressFound + I))^ := $90;
          end;
        finally
      // 还原原来的内存保护
          VirtualProtect(Pointer(AddressFound), 21, OldProtect, @OldProtect);
        end;
      end
      else
      begin
        ShowMessage('无法更改内存保护属性, 地址: ' + IntToHex(AddressFound, 8));
      end;
    end;
  except
    on E: Exception do
      ShowMessage('发生异常: ' + E.Message);
  end;
  // 关闭进程句柄
  if ProcessHandle <> 0 then
    CloseHandle(ProcessHandle);
end;

procedure TForm1.sSkinManager1BeforeChange(Sender: TObject);
begin 
   PatchMemory;
end;

 

标签:AddressFound,控件,begin,end,NAG,AlphaControls,StartAddr,ProcessHandle,DWORD
From: https://www.cnblogs.com/WilliamLv/p/18314245

相关文章

  • 我正在尝试将 Azure SQL 数据库连接到 Microsoft SQL Server Management Studio。收到
    这是完整的错误——标题:连接到服务器无法连接到adityapatil-server.database.windows.net。其他信息:建立与SQLServer的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确以及SQLServer是否配置为允许远程连接。(提供......
  • Anroid 11 关于NotificationManager && NotificationManagerService
    frameworks/base/core/java/android/app/NotificationManager.java几个比较重要的函数://移除mContext.getUser发送的通知publicvoidcancel(@NullableStringtag,intid){cancelAsUser(tag,id,mContext.getUser());}//移除所有通知publicvoidcanc......
  • C#.09 PictureBox图片控件
    usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;using_1.Properties;namespace_1{publicpartialclassForm1:F......
  • NAG Fortran Numerical Library帮助解决跨行业最复杂数学挑战
    NAGLIB库:NAGFortranNumericalLibrary帮助解决跨行业最复杂的数字挑战。NAG库算法本质上具有灵活性——它们可以从多种语言中调用,包括C和C++、VBA、Python、Java、.NET和Fortran。世界知名,专家支持世界上最大的商用库,包含强大、有文档记录且经过测试的数值和统计......
  • Qt实现仪表盘-自定义控件
            仪表盘在很多汽车和物联网相关的系统中很常用,本文就来介绍一下Qt 仪表盘的实现示例,文中通过示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。一、简述         使用Qt绘制一个仪表盘,用来显示当前的温度,绘制刻度、绘制数字......
  • Wpf和Winform使用devpress控件库导出Excel并调整报表样式
    Wpf和Winform使用devpress控件库导出Excel并调整报表样式背景客户需求经常需要出各种报表,部分客户对报表的样式有要求。包括颜色、字体、分页等等。代码使用Datagridview导出excel调整样式DevExpress.XtraGrid.Views.Grid.GridViewgdv#regionGridView属性设置//行号所......
  • 界面控件DevExpress Blazor UI v24.1 - 发布全新TreeList组件
    DevExpress BlazorUI组件使用了C#为BlazorServer和BlazorWebAssembly创建高影响力的用户体验,这个UI自建库提供了一套全面的原生BlazorUI组件(包括PivotGrid、调度程序、图表、数据编辑器和报表等)。DevExpress Blazor控件目前已经升级到v24.1版本了,此版本发布了全新的TreeLi......
  • python gradio 页面控件
    1、textbox的使用importgradioasgrimportrequestsdefmobile(mobilephone):url='https://api.oioweb.cn/api/common/teladress?mobile='+str(mobilephone)headers={}payload={}response=requests.request("GET",url,......
  • jpa报错 Failed to initialize JPA EntityManagerFactory: Unable to instantiate de
    报错2024-07-1711:18:57.558[][main]o.h.dialect.Dialect:HHH000400:Usingdialect:org.hibernate.dialect.MySQL5InnoDBDialect2024-07-1711:18:57.729[][main]tyManagerFactoryBean:FailedtoinitializeJPAEntityManagerFactory:......
  • ARC_069 D - Menagerie 题解
    atcoder一道很有意思的模拟题啊。思路很重要。首先,我们只要知道连续两只动物的身份,就可以根据\(s\)推出所有动物的身份。不妨假设我们知道第一只和第二只动物的身份,一共有几种情况呢?用\(1\)代表羊,\(0\)代表狼。那么,共有\(2^2=4\)种情况,分别为:00011011然后我......