Ich habe von WinDDK installiert (7600.16385.1) und habe vor, einen Legacytreiber zu bauen. Beim Bauen geht es aber derzeit schief.
Der Treiber siehst wie folgt aus:
Als ich das Dateihandle geschrieben habe, habe ich bemerkt, dass ich die windows.h-Datei einbinden muss, was ich dann auch durch ein entsprechendes include-Statement getan habe. Dies hatte zur Folge, dass ihm etwas in der winbase.h nicht gefällt. Um was könnte es sich bei diesem Problem handeln, ist es eventuell ein Versionsproblem?
Der Treiber siehst wie folgt aus:
Code:
#include "ntddk.h" #include "windows.h" NTSTATUS MyOpen(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { //Do something. return STATUS_SUCCESS; } NTSTATUS MyClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { //Do something. return STATUS_SUCCESS; } NTSTATUS MyRead(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { //Do something. return STATUS_SUCCESS; } NTSTATUS MyIOControl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { PIO_STACK_LOCATION IrpSp; ULONG FunctionCode; IrpSp=IoGetCurrentIrpStackLocation(Irp); FunctionCode=IrpSp->Parameters.DeviceIoControl.IoControlCode; //swith(FunctionCode) //{ //Do something. //} return STATUS_SUCCESS; } NTSTATUS OnStubDispatch(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { Irp->IoStatus.Status=STATUS_SUCCESS; IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_SUCCESS; } VOID OnUnload(IN PDRIVER_OBJECT DriverObject) { DbgPrint("OnUnload called.\n"); } const WCHAR deviceNameBuffer[]= L"\\Device\\MyDevice"; UNICODE_STRING deviceNameUnicodeString; PDEVICE_OBJECT g_RootkitDevice; NTSTATUS ntStatus; HANDLE hDevice; NTSTATUS DriverEntry(IN PDRIVER_OBJECT theDriverObject, IN PUNICODE_STRING theRegistryPath) { int i; theDriverObject->DriverUnload=OnUnload; for(i=0;i<IRP_MJ_MAXIMUM_FUNCTION;i++) { theDriverObject->MajorFunction[i]=OnStubDispatch; } RtlInitUnicodeString(&deviceNameUnicodeString,deviceNameBuffer); ntStatus=IoCreateDevice(theDriverObject, 0, &deviceNameUnicodeString, 0x00001234, 0, TRUE, &g_RootkitDevice); hDevice=CreateFile(deviceNameBuffer, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if(hDevice==((HANDLE)-1)) { return FALSE; } return STATUS_SUCCESS; }
1>errors in directory c:\winddk\7600.16385.1\mydriver
1>c:\winddk\7600.16385.1\inc\api\winbase.h(318) : error C2061: syntax error : identifier 'CRITICAL_SECTION'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(318) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(319) : error C2061: syntax error : identifier 'PCRITICAL_SECTION'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(319) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(320) : error C2061: syntax error : identifier 'LPCRITICAL_SECTION'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(320) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(322) : error C2061: syntax error : identifier 'CRITICAL_SECTION_DEBUG'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(322) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(323) : error C2061: syntax error : identifier 'PCRITICAL_SECTION_DEBUG'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(323) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(324) : error C2061: syntax error : identifier 'LPCRITICAL_SECTION_DEBUG'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(324) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(410) : error C2061: syntax error : identifier 'SRWLOCK'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(410) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(410) : error C2059: syntax error : ','
1>c:\winddk\7600.16385.1\inc\api\winbase.h(418) : error C2146: syntax error : missing ')' before identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(418) : error C2061: syntax error : identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(418) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(419) : error C2059: syntax error : ')'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(425) : error C2146: syntax error : missing ')' before identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(425) : error C2061: syntax error : identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(425) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(426) : error C2059: syntax error : ')'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(432) : error C2146: syntax error : missing ')' before identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(432) : error C2061: syntax error : identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(432) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(433) : error C2059: syntax error : ')'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(318) : error C2061: syntax error : identifier 'CRITICAL_SECTION'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(318) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(319) : error C2061: syntax error : identifier 'PCRITICAL_SECTION'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(319) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(320) : error C2061: syntax error : identifier 'LPCRITICAL_SECTION'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(320) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(322) : error C2061: syntax error : identifier 'CRITICAL_SECTION_DEBUG'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(322) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(323) : error C2061: syntax error : identifier 'PCRITICAL_SECTION_DEBUG'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(323) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(324) : error C2061: syntax error : identifier 'LPCRITICAL_SECTION_DEBUG'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(324) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(410) : error C2061: syntax error : identifier 'SRWLOCK'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(410) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(410) : error C2059: syntax error : ','
1>c:\winddk\7600.16385.1\inc\api\winbase.h(418) : error C2146: syntax error : missing ')' before identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(418) : error C2061: syntax error : identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(418) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(419) : error C2059: syntax error : ')'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(425) : error C2146: syntax error : missing ')' before identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(425) : error C2061: syntax error : identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(425) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(426) : error C2059: syntax error : ')'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(432) : error C2146: syntax error : missing ')' before identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(432) : error C2061: syntax error : identifier 'SRWLock'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(432) : error C2059: syntax error : ';'
1>c:\winddk\7600.16385.1\inc\api\winbase.h(433) : error C2059: syntax error : ')'