I have mixed function UnloadDriver from two examples:
1-st C:\WinDDK\7600.16385.1\src\general\ioctl\wdm\sys\sioctl.c
2-nd C:\WinDDK\7600.16385.1\src\network\trans\inspect\sys\TL_drv.c
Both sample are compiled separatly, but mixed failed.
Using Windows 7 x86 Checked Build Environment.
Please take a look to code below:
VOID
DriverUnload(
IN PDRIVER_OBJECT driverObject
)
{
//code from 1-st sample
UNICODE_STRING userApplicationName;
PAGED_CODE();
RtlInitUnicodeString(&userApplicationName,DOS_DEVICE_NAME);
IoDeleteSymbolicLink( &userApplicationName );
//code from 2-nd sample
KLOCK_QUEUE_HANDLE connListLockHandle;
KLOCK_QUEUE_HANDLE packetQueueLockHandle;
UNREFERENCED_PARAMETER(driverObject);
KeAcquireInStackQueuedSpinLock(
&gConnListLock,
&connListLockHandle
);
KeAcquireInStackQueuedSpinLock(
&gPacketQueueLock,
&packetQueueLockHandle
);
gDriverUnloading = TRUE;
KeReleaseInStackQueuedSpinLock(&packetQueueLockHandle);
KeReleaseInStackQueuedSpinLock(&connListLockHandle);
if (IsListEmpty(&gConnList) && IsListEmpty(&gPacketQueue))
{
KeSetEvent(
&gWorkerEvent,
IO_NO_INCREMENT,
FALSE
);
}
ASSERT(gThreadObj != NULL);
KeWaitForSingleObject(
gThreadObj,
Executive,
KernelMode,
FALSE,
NULL
);
ObDereferenceObject(gThreadObj);
InspectUnregisterCallouts();
FwpsInjectionHandleDestroy0(gInjectionHandle);
IoDeleteDevice(gDeviceObject);
}
I have an error on “KLOCK_QUEUE_HANDLE connListLockHandle” line with following message “error C2275: ‘KLOCK_QUEUE_HANDLE’ : illegal use of this type as an expression”.
Any help appreciated