- I need 1) a very simple .SYS driver, and 2) a very simple .EXE program demonstrating how to call/use the driver.
- They're extremely simple - the SYS driver is basically just a skeleton that only exports one main function (apart from the obvious required load, unload etc functions), and the exe program calls that function, as if it were calling an exported function from a DLL but from the SYS driver instead.
- I need an x86(32-bit) and x64(64-bit) version of each, although they both only use 32-bit dwords/registers so the same source (or thereabouts) should compile for both 32 and 64bit versions.
- I need this written in _any C compiler as long as it's FREE_.
(Im assuming gcc, possibly with mingw/mingw64 is the way to go, but it doesn't really matter as long as it's free, im flexible!)
Because of the simplistic nature of the driver (_it's essentially just a driver skeleton_) im assuming only bare minimal DDK support would be required for compile.
- Needs to work under Windows 10 but given its bare-bones nature im assuming it'll run on all Windows though, so if you dont have Win10 but can still compile it under XP or Win7 or 8 im happy to test it under Win10
- Dont worry about signed drivers obviously, i'll be testing with driver signing disabled
Here is the pseudocode for both the [login to view URL] and [login to view URL]
DRIVER'S EXPORTED FUNCTION:
Function SysDemoFunc (Dword1, Dword2, Dword3) As Dword
On Error Goto ErrHandler // definitely need to catch any errors!
mov Dword1, eax // for the sake of this demo we simply set the Dwords to whatever the eax/ebx regs happen to be, to demonstrate using some inline asm
mov Dword2, ebx
Dword3 = Dword3 * 3 // demonstrates I/O of a variable
0x90 // Also please include a 0x90 byte (for NOP) simply to demonstrate using a raw bytecode
Function = 0 // returns "success"
Function = ErrNum (if an error number is known, otherwise -1)
SetVariables Dword1, Dword2, Dword3, dwResult As Dword
If LoadDriver = False Then Exit("Error")
Dword3 = 123
Call SysDemoFunc(Dword1, Dword2, Dword3) To dwResult
If dwResult = 0 Then
Print "RESULT: eax="+Dword1 + " ebx="+Dword2 + " 123x3="+Dword3
Print "ERROR #"+dwResult
If UnloadDriver = False Then Print("Failed to unload driver")
- Please include instructions on how to compile the driver, and .BAT file(s) that automate the compilation process
- (Optional) If you can also develop the same project (32&64bits kernel driver + calling program) in either Linux (32&64bit) and/or Mac OSX (64bit only), please let me know and we can extend the project, but if you only want to do this for Windows that's fine too