flat assembler
Message board for the users of flat assembler.

Index > Windows > [request]Example of simple Win 32 Driver with Buffered I/O

Author
Thread Post new topic Reply to topic
Ivan_32



Joined: 13 Mar 2010
Posts: 5
Ivan_32
I've newer seen such example. Im trying to understand how drivers are working, but in C/C++ i've even have no idea what my compiler are doing with my code, so i just need to feel earth under my foot.
I need somthing like this but in assembly.
http://pastebin.org/111514

btw: i also need an includes pack, can someone tell what to use?
Post 13 Mar 2010, 05:26
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17252
Location: In your JS exploiting you and your system
revolution
There are a large number of examples of drivers already on this board. Have you tried searching for them yet?
Post 13 Mar 2010, 05:30
View user's profile Send private message Visit poster's website Reply with quote
Ivan_32



Joined: 13 Mar 2010
Posts: 5
Ivan_32
Yes i tryed, but i found just one topic about what i need:
http://board.flatassembler.net/topic.php?t=9041
Ive searched for IRP_MJ_READ
btw: i didnt sayed this, but i need an driver with IO by IRP_MJ_WRITE and IRP_MJ_READ
Post 13 Mar 2010, 12:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17252
Location: In your JS exploiting you and your system
revolution
The FAQ of this sub-forum has a section on drivers.
Post 13 Mar 2010, 12:11
View user's profile Send private message Visit poster's website Reply with quote
Ivan_32



Joined: 13 Mar 2010
Posts: 5
Ivan_32
I know, but theres no any sign of that like example. It's like hello world in drivers - so i guess i wont be diffcult to write this example, if its not too difficult, maybe you can write it ? I already know how it's basicaly works but i cant write it on FASM so i just need a bit of help with this. I'm not a lazy student or someone like these i just need a bit of help to start studing.

I just need to see code of FASM version of this source:
http://pastebin.org/111514


It so difficult to get some info on english forums... in russian(atleast i do that like) if someone request example - we write it and sometimes even explain all of its aspects of work. And TS usualy wont be asking it again - this method are very effective i guess.
Post 13 Mar 2010, 12:36
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
Ivan_32,

If it's so simple, you should be able to do it yourself. What part of rewriting it in FASM seems dufficult?

You may contact me by PM/ICQ/e-mail, I speak Russian.
Post 13 Mar 2010, 13:37
View user's profile Send private message Reply with quote
Ivan_32



Joined: 13 Mar 2010
Posts: 5
Ivan_32
Best way for me is to just see working code. When i was trying to learn how its works on C++ - i havent understand nothing until i saw working code(now i've understand how it works but i have some serious problems with offsets and byte-order so i decided to try it on assebmly. I have some little expirience in osdev, actualy i stoped in protected mode with working keyboard, so i think i would be able to understand this). Also i need some includes for kernel mode. Heard that the call's are diffrent than in user-mode, so i guess i also need an valid includes-pack(maybe only with it - i'll be able to rewrite code above in assembly but im no sure about this, actualy im not sure would it be working properly)
PS: Sorry for my english, i have an very little expirience off talking, 99% of time when i use it - i read docs and mans Smile
Post 14 Mar 2010, 13:52
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
Ivan_32,

Most C compilers are able to output mixed C/assembly listing. In it each C source line is followed by corresponding assembly language instructions.

Device drivers' development requires something like DDK, WDK or KMDKit. Separate machine/VM for debugging is also a must (unless you enjoy BSODs on development machine).

But first of all you'll need good understanding of kernel mode and KM driver architecture. MSDN is invaluable, there are several good books freely available ("Inside MS Windows 2000", "Undocumented Windows 2000 Secrets" – they're old, but still relevant).

Show some effort, translate short function (DefaultHandler(), for example) to FASM. "I request you to do it" posture won't get you far.
Post 14 Mar 2010, 14:32
View user's profile Send private message Reply with quote
a115433



Joined: 05 Mar 2010
Posts: 144
a115433
i request MmProbeAndLockPages() in asm. The exception handling to be exact.
Post 14 Mar 2010, 14:36
View user's profile Send private message Reply with quote
Ivan_32



Joined: 13 Mar 2010
Posts: 5
Ivan_32
I feel that it would be simpier to just show with what i have problem...
Driver:
http://pastebin.org/112701
Control Program:
http://pastebin.org/112703

Togethere it just crashed into BSOD. This was supposed to be something like my Hello world in drivers but it just crashes and i realy dont understand why...
Post 14 Mar 2010, 18:23
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
Ivan_32,

Use crash dump to find source of the fault. Also note that BSOD often contains relevant information about how and where the fault occurs.
Post 14 Mar 2010, 19:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.