Test and make the secondary driver loader more userfriendly

This commit is contained in:
cheatengine@gmail.com 2012-04-27 17:06:20 +00:00
parent a73a632b39
commit 08368213a1
6 changed files with 44 additions and 7 deletions

View File

@ -77,9 +77,13 @@ begin
part:=0;
result:=INVALID_HANDLE_VALUE;
try
//ShowMessage('SecondaryDriverLoad');
try
part:=1;
// ShowMessage('Part 1');
//load the 64 bit driver
if dbvmversion=0 then
begin
@ -88,10 +92,12 @@ begin
end;
part:=2;
//ShowMessage('Part 2');
ml:=TModuleLoader.create(CheatEngineDir+'dbk64.sys');
part:=3;
// ShowMessage('Part 3');
if ml.loaded then
begin
part:=4;
@ -102,7 +108,7 @@ begin
begin
result:=$fff00fff;
part:=6;
ShowMessage('success');
ShowMessage('Success. The driver has been loaded thanks to dbvm');
end
else
showMessage('The driver failed to initialize');

View File

@ -2869,7 +2869,7 @@ begin
parameters:=lua_gettop(L);
if parameters=1 then
begin
control:=lua_touserdata(L,-1);
control:=lua_touserdata(L,1);
if assigned(control.onclick) then
control.OnClick(control);
end;
@ -2879,6 +2879,9 @@ end;
function strings_add(L: Plua_State): integer; cdecl;
var parameters: integer;
strings: TStrings;

View File

@ -359,7 +359,6 @@ object MainForm: TMainForm
Width = 43
Caption = 'Test cap'
ParentColor = False
Visible = False
OnClick = Label59Click
end
object Label61: TLabel

View File

@ -21,7 +21,7 @@ uses
luafile, xmplayer_server, sharedMemory{$ifdef windows}, win32proc{$endif},
vmxfunctions, FileUtil, networkInterfaceApi, networkconfig, d3dhookUnit, PNGcomn,
FPimage, byteinterpreter, frmgroupscanalgoritmgeneratorunit, vartypestrings,
groupscancommandparser, GraphType, IntfGraphics, RemoteMemoryManager;
groupscancommandparser, GraphType, IntfGraphics, RemoteMemoryManager, DBK64SecondaryLoader;
//the following are just for compatibility
@ -7278,7 +7278,17 @@ var t: TD3DHook_Texture;
tc: TD3Dhook_TextContainer;
p2: TPicture;
i: integer;
begin
ShowMessage('going to call dbvm_testSwitchToKernelmode');
i:=dbvm_testSwitchToKernelmode;
ShowMessage('Still alive. I='+inttostr(i));
if i=123 then
SecondaryDriverLoad;
{
safed3dhook;
if d3dhook=nil then raise exception.create('d3dhook failed');
while d3dhook.getWidth=0 do CheckSynchronize;
@ -7306,7 +7316,7 @@ begin
tc:=d3dhook.createTextContainer(fm,100,100,'This is a test');
}
// d3dhook.createConsole(0);
end;

View File

@ -2003,7 +2003,8 @@ begin
begin
if getlasterror=577 then
begin
messagebox(0,'Please reboot and press F8 during boot. Then choose "allow unsigned drivers". '+#13#10+'Alternatively you could sign the driver yourself.'+#13#10+'Just buy yourself a class 3 business signing certificate and sign the driver. Then you''ll never have to reboot again to use this driver','DBK32 error',MB_ICONERROR or mb_ok);
if dbvm_version=0 then
messagebox(0,'Please reboot and press F8 during boot. Then choose "allow unsigned drivers". '+#13#10+'Alternatively you could sign the driver yourself.'+#13#10+'Just buy yourself a class 3 business signing certificate and sign the driver. Then you''ll never have to reboot again to use this driver','DBK32 error',MB_ICONERROR or mb_ok);
failedduetodriversigning:=true;
end; //else could already be started
end;

View File

@ -93,6 +93,7 @@ function dbvm_executeDriverEntry(driverentry: pointer; DriverObject: pointer; Re
function dbvm_executeDispatchIoctl(DispatchIoctl: pointer; DriverObject: pointer; dwIoControlCode: DWORD; lpInBuffer: pointer; nInBufferSize:integer; lpOutBuffer: pointer; nOutBufferSize: integer; lpBytesReturned: pdword): BOOL;
function dbvm_testSwitchToKernelmode: integer; //returns 123 on success
function dbvm_getProcAddress(functionname: string): pointer;
@ -704,6 +705,7 @@ begin
//kernelmode. IRQL=passive
c:=x;
case c.command of
$FFFFFFFF: pinteger(c.result)^:=123; //test
0: pptruint(c.result)^:=ptruint(ExAllocatePool(0, c.param1)); //Allocate memory
1: //copy memory
begin
@ -717,6 +719,8 @@ begin
3: //Dipatch IOCTL
PBOOL(c.result)^:=executeDispatchIOCTL_fromKernelMode(TDispatchIOCTL(c.param1), pointer(c.param2), dword(c.param3), pointer(c.param4), dword(c.param5), pointer(c.param6), dword(c.param7), pointer(c.param8));
end;
end;
@ -781,6 +785,7 @@ asm
end;
{$else}
asm
sub rsp,4096
mov [rsp+$00],rax
@ -854,11 +859,24 @@ asm
mov rax,[rsp+$00]
add rsp,4096
add rsp,8 //undo errorcode (64-bit ALWAYS pushes an errorcode, in this emulation)
db $48, $cf //iretq
end;
{$endif}
function dbvm_testSwitchToKernelmode: integer;
var command: TCommand;
begin
setupKernelFunctionList;
command.command:=$ffffffff;
command.result:=@result;
dbvm_switchToKernelMode($10, @dbvm_localIntHandler_entry, @command);
end;
function dbvm_executeDispatchIoctl(DispatchIoctl: pointer; DriverObject: pointer; dwIoControlCode: DWORD; lpInBuffer: pointer; nInBufferSize:integer; lpOutBuffer: pointer; nOutBufferSize: integer; lpBytesReturned: pdword): BOOL;
var command: TCommand;
begin