We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to unload this driver? NtUnloadDriver() can't
NtUnloadDriver()
LSTATUS UnloadDriver(CONST LPSTR aService) { LSTATUS ret{ -1 }; HMODULE hNtdll{ 0 }; LPSTR aDriverKey{ 0 }; LSTATUS l{ 0 }; UNICODE_STRING uDriver{ 0 }; ANSI_STRING asDriverKey{ 0 }; _NtUnloadDriver NtUnloadDriver = nullptr; hNtdll = GetModuleHandleA("Ntdll.dll"); if (hNtdll == 0) { goto CLEANUP; } NtUnloadDriver = (_NtUnloadDriver)GetProcAddress(hNtdll, "NtUnloadDriver"); if (NtUnloadDriver == nullptr) { goto CLEANUP; } aDriverKey = (LPSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_PATH); if (aDriverKey == NULL) { goto CLEANUP; } _snprintf_s(aDriverKey, MAX_PATH, MAX_PATH, "\\Registry\\Machine\\System\\CurrentControlSet\\Services\\%s", aService); RtlInitAnsiString(&asDriverKey, aDriverKey); l = RtlAnsiStringToUnicodeString(&uDriver, &asDriverKey, TRUE); if (l) { goto CLEANUP; } ret = NtUnloadDriver(&uDriver); CLEANUP: if (uDriver.Length != 0) { RtlFreeUnicodeString(&uDriver); } if (aDriverKey) HeapFree(GetProcessHeap(), NULL, aDriverKey); return ret; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
how to unload this driver?
NtUnloadDriver()
can'tThe text was updated successfully, but these errors were encountered: