Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Driver Question

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
haha01haha01
Grandmaster Cheater Supreme
Reputation: 0

Joined: 15 Jun 2007
Posts: 1233
Location: http://www.SaviourFagFails.com/

PostPosted: Fri Apr 10, 2009 1:13 pm    Post subject: Driver Question Reply with quote

I made a simple driver (based on an example code i saw) that prints everything inputted to it (using CreateFile->WriteFile), but i seem to get a BSoD when calling MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority) to determine the input buffer's address. this is the IRP_MJ_WRITE function (where the BSoD occures) and this is the whole application's code.

anyone know what is the problem or can tell me a different method to read the data sent with WriteFile?
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Fri Apr 10, 2009 8:29 pm    Post subject: Reply with quote

Code:
 if(pIoStackIrp)


check Irp->MdlAddress also

Code:
    if(pIoStackIrp && Irp->MdlAddress)

_________________
Back to top
View user's profile Send private message
haha01haha01
Grandmaster Cheater Supreme
Reputation: 0

Joined: 15 Jun 2007
Posts: 1233
Location: http://www.SaviourFagFails.com/

PostPosted: Sat Apr 11, 2009 2:13 am    Post subject: Reply with quote

blankrider wrote:
Code:
 if(pIoStackIrp)


check Irp->MdlAddress also

Code:
    if(pIoStackIrp && Irp->MdlAddress)
oh, i see...
now it doesnt crash, but every time i call WriteFile it skips it because MdlAddress is null. what should i do to get it to work? im using this code:
Code:
    HANDLE h;
   DWORD result;
   h = CreateFile(L"\\\\.\\Example",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
   WriteFile(h,"Test",sizeof("Test"),&result,NULL);
   CloseHandle(h);
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sat Apr 11, 2009 8:13 am    Post subject: Reply with quote

haha01haha01 wrote:
blankrider wrote:
Code:
 if(pIoStackIrp)


check Irp->MdlAddress also

Code:
    if(pIoStackIrp && Irp->MdlAddress)
oh, i see...
now it doesnt crash, but every time i call WriteFile it skips it because MdlAddress is null. what should i do to get it to work? im using this code:
Code:
    HANDLE h;
   DWORD result;
   h = CreateFile(L"\\\\.\\Example",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
   WriteFile(h,"Test",sizeof("Test"),&result,NULL);
   CloseHandle(h);


does DeviceCreate's message come up? If it doesn't then it isn't creating the file. Check to see if h is valid. Call getlasterror after CreateFile and after WriteFile.

edit:
Also use
Code:
IoCompleteRequest(Irp, IO_NO_INCREMENT);

Everytime the Irp is used as a parameter to the function

_________________
Back to top
View user's profile Send private message
haha01haha01
Grandmaster Cheater Supreme
Reputation: 0

Joined: 15 Jun 2007
Posts: 1233
Location: http://www.SaviourFagFails.com/

PostPosted: Sat Apr 11, 2009 11:24 am    Post subject: Reply with quote

blankrider wrote:
haha01haha01 wrote:
blankrider wrote:
Code:
 if(pIoStackIrp)


check Irp->MdlAddress also

Code:
    if(pIoStackIrp && Irp->MdlAddress)
oh, i see...
now it doesnt crash, but every time i call WriteFile it skips it because MdlAddress is null. what should i do to get it to work? im using this code:
Code:
    HANDLE h;
   DWORD result;
   h = CreateFile(L"\\\\.\\Example",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
   WriteFile(h,"Test",sizeof("Test"),&result,NULL);
   CloseHandle(h);


does DeviceCreate's message come up? If it doesn't then it isn't creating the file. Check to see if h is valid. Call getlasterror after CreateFile and after WriteFile.

edit:
Also use
Code:
IoCompleteRequest(Irp, IO_NO_INCREMENT);

Everytime the Irp is used as a parameter to the function

CreateFile and CloseHandle succeeds, and the handle is valid (around 0x160). also, this happens from the first time Irp is used, so i doubt the problem is the request not completed.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Sat Apr 11, 2009 5:42 pm    Post subject: Reply with quote

haha01haha01 wrote:
blankrider wrote:
haha01haha01 wrote:
blankrider wrote:
Code:
 if(pIoStackIrp)


check Irp->MdlAddress also

Code:
    if(pIoStackIrp && Irp->MdlAddress)
oh, i see...
now it doesnt crash, but every time i call WriteFile it skips it because MdlAddress is null. what should i do to get it to work? im using this code:
Code:
    HANDLE h;
   DWORD result;
   h = CreateFile(L"\\\\.\\Example",GENERIC_READ | GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
   WriteFile(h,"Test",sizeof("Test"),&result,NULL);
   CloseHandle(h);


does DeviceCreate's message come up? If it doesn't then it isn't creating the file. Check to see if h is valid. Call getlasterror after CreateFile and after WriteFile.

edit:
Also use
Code:
IoCompleteRequest(Irp, IO_NO_INCREMENT);

Everytime the Irp is used as a parameter to the function

CreateFile and CloseHandle succeeds, and the handle is valid (around 0x160). also, this happens from the first time Irp is used, so i doubt the problem is the request not completed.


When you call CreateDevice the IRP is being used. Just try it. I really can't find out what the issue is. Upload your current source & other files so i can load it and try it out. Upload them as a rar folder so i can just compile and run


FOUND ERROR:

Tested this and it works
You have to specify the input type. Just put this code in the entry before creating the symbolic link.

Code:
pDeviceObject->Flags |= DO_DIRECT_IO;

_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites