|
|
|
@ -48,8 +48,7 @@ namespace driver
|
|
|
|
|
®_handle
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
RegCloseKey(reg_handle);
|
|
|
|
|
return ERROR_SUCCESS == RegDeleteKeyA(reg_handle, service_name.data());
|
|
|
|
|
return ERROR_SUCCESS == RegDeleteKeyA(reg_handle, service_name.data()) && ERROR_SUCCESS == RegCloseKey(reg_handle);;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline bool create_service_entry(const std::string& drv_path, const std::string& service_name)
|
|
|
|
@ -171,9 +170,10 @@ namespace driver
|
|
|
|
|
|
|
|
|
|
result = RegGetValueA(
|
|
|
|
|
reg_handle,
|
|
|
|
|
"ImagePath",
|
|
|
|
|
service_name.c_str(),
|
|
|
|
|
REG_SZ, NULL,
|
|
|
|
|
"ImagePath",
|
|
|
|
|
REG_SZ,
|
|
|
|
|
NULL,
|
|
|
|
|
image_path,
|
|
|
|
|
&bytes_read
|
|
|
|
|
);
|
|
|
|
@ -266,7 +266,8 @@ namespace driver
|
|
|
|
|
RtlAnsiStringToUnicodeString(&driver_reg_path_unicode, &driver_rep_path_cstr, true);
|
|
|
|
|
|
|
|
|
|
const bool unload_drv = !reinterpret_cast<nt_unload_driver_t>(lp_nt_unload_drv)(&driver_reg_path_unicode);
|
|
|
|
|
const bool delete_drv = std::filesystem::remove(util::get_service_image_path(service_name));
|
|
|
|
|
const auto image_path = util::get_service_image_path(service_name);
|
|
|
|
|
const bool delete_drv = std::filesystem::remove(image_path);
|
|
|
|
|
const bool delete_reg = util::delete_service_entry(service_name);
|
|
|
|
|
|
|
|
|
|
return unload_drv && delete_drv && delete_reg;
|
|
|
|
|