Jump to content
Tuts 4 You

[asm] problem with opening a file


Yoshi

Recommended Posts

Posted (edited)

i want to open a .exe file using ZwOpenFile. No i dont want to use OpenFile or other winapi's, just ZwOpenFile.


 


I created a simple project based upon the link down, but when i try to open calc.exe nt-status error = C0000008 == STATUS_INVALID_HANDLE.


my code is almost the same as



http://www.asmcommunity.net/forums/topic/?id=15345

Edited by Yoshi
Posted

Your variable names are really really confusing!


mov oa.ObjectName,offset ntpath 

This doesn't look right. I believe it should be "offset dospath".


 


See also http://eretik.omegahg.com/art/04.html (Google Translate, if you don't read Russian). ;)

  • Like 1
Posted (edited)

thank you for the reply.


 


not only my variable names are confusing, also the RtlDosPathNameToNtPathName_U structure. The link you gave, the link beneath this line, and some other links are defining the structure of this api all different.



http://assarbad.net/stuff/!export/apis_revealed.txt

Edited by Yoshi
Posted (edited)

the initialization of the OBJECT_ATTRIBUTES strc is done right after the ntpath


Edited by Yoshi
Posted (edited)

After these 2 small fixes, it seems to work for me:



xor eax, eax ; provide null ptr, not dospath here!
mov oa.RootDirectory,eax  
mov oa.ObjectName,offset dospath  ; already mentioned in my post #2

Edited by kao
  • Like 1
Posted (edited)

You are da hero kao!  :thanks:


 


So the file can be openend without any problem. However, this was just an demo project. Now i should open the file itself, thus base.exe. but a acces_denied error pops up


Edited by Yoshi
Posted (edited)

Catch working project. password is the same.


 


Attachment was removed at topic author's request.


Edited by huntingspace
Posted

huntingspace, you are incredible! it seems to work, so     :worthy:   thank you, i knew you could fix it :)


 


also kao very greatfull for your help :thumbs:


 


you guys are amazing


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...