22nd February 2011

Windows DDK Reference

sources Cookbook

Driver / Library

Library:

TARGETNAME=mylib
TARGETPATH=obj
TARGETTYPE=DRIVER_LIBRARY

C_DEFINES=$(C_DEFINES) -DWHATEVER

INCLUDES=.\inc

SOURCES=\
    mylib1.c \
    mylib2.c

Driver linking against the library:

TARGETNAME=mydriver
TARGETPATH=obj
TARGETTYPE=DRIVER

C_DEFINES=$(C_DEFINES) -DWHATEVER

TARGETLIBS=$(DDK_LIB_PATH)\ndis.lib ..\mylib\obj$(BUILD_ALT_DIR)\*\mylib.lib

INCLUDES=.\inc

SOURCES=\
    main.c \
    main.rc \
    drv1.c \
    drv2.c

Userspace Executables

Builds myprog.exe from myprog.c linking to local psapi.lib and DDK ntdll.lib and oldnames.lib. Can also link to SDK .lib files from here, but must fix environment vars in order to do so.

TARGETNAME=myprog
TARGETPATH=obj
TARGETTYPE=PROGRAM
TARGETLIBS=.\lib\psapi.lib $(DDK_LIB_PATH)\ntdll.lib $(DDK_LIB_PATH)\oldnames.lib

INCLUDES=.\inc

UMTYPE=console
UMBASE=0x04000000

SOURCES=$(TARGETNAME).c

USE_MSVCRT=1

Back to Knowledge Base.