Problem with unloading a driver

Hi,

I wrote a simple driver to allocate memory and reclaim memory when I try to use stop service to stop the drivers it is saying “The requested control is not valid”. I am posting the source below.

NTSTATUS DriverEntry (PDRIVER_OBJECT DriverObject,PUNICODE_STRING RegistryPath)
{

DbgPrint(“Allocating Memory… \n”);
buffer = ExAllocatePoolWithTag(PagedPool,MAX_BUF,‘1GAT’);
if(!buffer)
{
DbgPrint(“ExAllocatePoolWithTag Failed \n”);
return STATUS_INSUFFICIENT_RESOURCES;
}
DbgPrint(“Allocated Memory. \n”);

DriverObject->DriverUnload = DriverUnload;
return STATUS_SUCCESS;

}

void DriverUnload(PDRIVER_OBJECT pDriverObject)

{
DbgPrint(“Freeing Memory… \n”);
ExFreePoolWithTag(buffer,‘1GAT’);
DbgPrint(“Freed Memory… \n”);

DbgPrint(“Driver unloading\n”);

}

solved the problem myself. Thank you very much

xxxxx@gmail.com wrote:

solved the problem myself. Thank you very much

What was the solution? Your lesson might help the next guy.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.