ntoskrnl.exe: Added implementation for IoCreateDriver and IoDeleteDriver.

This commit is contained in:
Alexandre Julliard 2007-12-18 19:46:06 +01:00
parent c69468ddcc
commit 7ac931acf2
3 changed files with 51 additions and 2 deletions

View File

@ -267,6 +267,53 @@ PIO_WORKITEM WINAPI IoAllocateWorkItem( PDEVICE_OBJECT DeviceObject )
}
/***********************************************************************
* IoCreateDriver (NTOSKRNL.EXE.@)
*/
NTSTATUS WINAPI IoCreateDriver( UNICODE_STRING *name, PDRIVER_INITIALIZE init )
{
DRIVER_OBJECT *driver;
DRIVER_EXTENSION *extension;
NTSTATUS status;
if (!(driver = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*driver) + sizeof(*extension) )))
return STATUS_NO_MEMORY;
if ((status = RtlDuplicateUnicodeString( 1, name, &driver->DriverName )))
{
RtlFreeHeap( GetProcessHeap(), 0, driver );
return status;
}
extension = (DRIVER_EXTENSION *)(driver + 1);
driver->Size = sizeof(*driver);
driver->DriverInit = init;
driver->DriverExtension = extension;
extension->DriverObject = driver;
extension->ServiceKeyName = driver->DriverName;
status = driver->DriverInit( driver, name );
if (status)
{
RtlFreeUnicodeString( &driver->DriverName );
RtlFreeHeap( GetProcessHeap(), 0, driver );
}
return status;
}
/***********************************************************************
* IoDeleteDriver (NTOSKRNL.EXE.@)
*/
void WINAPI IoDeleteDriver( DRIVER_OBJECT *driver )
{
RtlFreeUnicodeString( &driver->DriverName );
RtlFreeHeap( GetProcessHeap(), 0, driver );
}
/***********************************************************************
* IoCreateDevice (NTOSKRNL.EXE.@)
*/

View File

@ -338,7 +338,7 @@
@ stub IoCreateController
@ stdcall IoCreateDevice(ptr long ptr long long long ptr)
@ stub IoCreateDisk
@ stub IoCreateDriver
@ stdcall IoCreateDriver(ptr ptr)
@ stub IoCreateFile
@ stub IoCreateFileSpecifyDeviceObjectHint
@ stub IoCreateNotificationEvent
@ -354,7 +354,7 @@
@ stub IoCsqRemoveNextIrp
@ stub IoDeleteController
@ stdcall IoDeleteDevice(ptr)
@ stub IoDeleteDriver
@ stdcall IoDeleteDriver(ptr)
@ stub IoDeleteSymbolicLink
@ stub IoDetachDevice
@ stub IoDeviceHandlerObjectSize

View File

@ -878,8 +878,10 @@ void WINAPI ExFreePool(PVOID);
void WINAPI ExFreePoolWithTag(PVOID,ULONG);
NTSTATUS WINAPI IoCreateDevice(DRIVER_OBJECT*,ULONG,UNICODE_STRING*,DEVICE_TYPE,ULONG,BOOLEAN,DEVICE_OBJECT**);
NTSTATUS WINAPI IoCreateDriver(UNICODE_STRING*,PDRIVER_INITIALIZE);
NTSTATUS WINAPI IoCreateSymbolicLink(UNICODE_STRING*,UNICODE_STRING*);
void WINAPI IoDeleteDevice(DEVICE_OBJECT*);
void WINAPI IoDeleteDriver(DRIVER_OBJECT*);
NTSTATUS WINAPI IoDeleteSymbolicLink(UNICODE_STRING*);
PEPROCESS WINAPI IoGetCurrentProcess(void);