Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 2003 of file driver.c.
Referenced by InstallAdditionalServices(), and ScmLoadDriver().
{ UNICODE_STRING CapturedDriverServiceName = { 0, 0, NULL }; KPROCESSOR_MODE PreviousMode; LOAD_UNLOAD_PARAMS LoadParams; NTSTATUS Status; PAGED_CODE(); PreviousMode = KeGetPreviousMode(); /* * Check security privileges */ /* FIXME: Uncomment when privileges will be correctly implemented. */ #if 0 if (!SeSinglePrivilegeCheck(SeLoadDriverPrivilege, PreviousMode)) { DPRINT("Privilege not held\n"); return STATUS_PRIVILEGE_NOT_HELD; } #endif Status = ProbeAndCaptureUnicodeString(&CapturedDriverServiceName, PreviousMode, DriverServiceName); if (!NT_SUCCESS(Status)) { return Status; } DPRINT("NtLoadDriver('%wZ')\n", &CapturedDriverServiceName); LoadParams.ServiceName = &CapturedDriverServiceName; LoadParams.DriverObject = NULL; KeInitializeEvent(&LoadParams.Event, NotificationEvent, FALSE); /* Call the load/unload routine, depending on current process */ if (PsGetCurrentProcess() == PsInitialSystemProcess) { /* Just call right away */ IopLoadUnloadDriver(&LoadParams); } else { /* Load/Unload must be called from system process */ ExInitializeWorkItem(&LoadParams.WorkItem, (PWORKER_THREAD_ROUTINE)IopLoadUnloadDriver, (PVOID)&LoadParams); /* Queue it */ ExQueueWorkItem(&LoadParams.WorkItem, DelayedWorkQueue); /* And wait when it completes */ KeWaitForSingleObject(&LoadParams.Event, UserRequest, KernelMode, FALSE, NULL); } ReleaseCapturedUnicodeString(&CapturedDriverServiceName, PreviousMode); return LoadParams.Status; }