Commit 7ac931ac authored by Alexandre Julliard's avatar Alexandre Julliard

ntoskrnl.exe: Added implementation for IoCreateDriver and IoDeleteDriver.

parent c69468dd
......@@ -268,6 +268,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.@)
*/
NTSTATUS WINAPI IoCreateDevice( DRIVER_OBJECT *driver, ULONG ext_size,
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment