I am using the KMD kit to write a simple driver that displays a logo.
I get all kinds of errors when I try to compile this.
In looking at the examples, it looks like drivers need to be procs.
Where do I begin to look to fix this?
Thanks.
I get all kinds of errors when I try to compile this.
In looking at the examples, it looks like drivers need to be procs.
Where do I begin to look to fix this?
Thanks.
;@echo off
;goto make
.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\advapi32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\advapi32.lib
include C:\masm32\include\w2k\ntstatus.inc
include c:\masm32\include\w2k\ntddk.inc
include c:\masm32\include\w2k\hal.inc
.data
; Console strings
szConTitle db "A.S.T. installed--A.K.", 0
szConAbout db "Copyright ", 13,10, 0
szNewLine db 13, 10, 0
.data?
hOutput dd ?
hWritten dd ?
hInput dd ?
.code
start:
Logo proc
local STD_INPUT_HANDLE:HANDLE
local STD_OUTPUT_HANDLE:HANDLE
invoke GetStdHandle, STD_INPUT_HANDLE
mov hInput, eax
invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hOutput, eax
invoke SetConsoleTitle, addr szConTitle
; blue text on black background
invoke CPut, addr szNewLine
invoke SetConsoleTextAttribute, hOutput, FOREGROUND_RED
invoke CPut, addr szConTitle
invoke ExitProcess, 0
Logo endp
end start
; DriverEntry
DriverEntry proc pDriverObject:PDRIVER_OBJECT, pusRegistryPath:PUNICODE_STRING
invoke Logo;
mov eax, STATUS_DEVICE_CONFIGURATION_ERROR
ret
DriverEntry endp
end DriverEntry
:make
set drv=Logo
\masm32\bin\ml /nologo /c /coff %drv%.bat
\masm32\bin\link /nologo /driver /base:0x10000 /align:32 /out:%drv%.sys /subsystem:native %drv%.obj
del %drv%.obj
echo.
pause
you can't use win32 api in drivers and you get compile errors probably cos you include windows.inc and ntddk.inc (which includes ntdef.inc)
you can't use win32 api in drivers and you get compile errors probably cos you include windows.inc and ntddk.inc (which includes ntdef.inc)
Thanks.
So, does that mean I need to use the BIOS functions or Interrupts?
Andy
So, does that mean I need to use the BIOS functions or Interrupts?
When in doubt, RTFM. Kernel-mode programming is quite different from user-mode in many aspects. You can't just change included headers/libraries and — voilà! — same code works in Ring 0.
MS Windows DDK is a must have. "Inside MS Windows 2000" by Solomon & Russinovich, "Undocumented Windows 2000 Secrets: A Programmer's Cookbook" by Schreiber are a must read.
KMD was accompanied with a short series of tutorials, did you read them?