Revert changes.

This commit is contained in:
XMRig 2019-12-16 02:17:57 +07:00
parent f24e4f6462
commit 8dbb83f99b
No known key found for this signature in database
GPG key ID: 446A53638BE94409

View file

@ -40,7 +40,9 @@
#include <array>
#include <string>
#include <thread>
#include <sstream>
#define SERVICE_NAME L"WinRing0_1_2_0"
namespace xmrig {
@ -130,20 +132,12 @@ static HANDLE wrmsr_install_driver()
std::wstring driverPath = dir.data();
driverPath += L"WinRing0x64.sys";
FILETIME curTime;
GetSystemTimeAsFileTime(&curTime);
std::wstringstream s;
s << L"xmrig_WinRing0_service_" << curTime.dwLowDateTime;
const std::wstring serviceName = s.str();
hService = OpenServiceW(hManager, serviceName.c_str(), SERVICE_ALL_ACCESS);
hService = OpenServiceW(hManager, SERVICE_NAME, SERVICE_ALL_ACCESS);
if (hService && !wrmsr_uninstall_driver()) {
return nullptr;
}
hService = CreateServiceW(hManager, serviceName.c_str(), serviceName.c_str(), SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, driverPath.c_str(), nullptr, nullptr, nullptr, nullptr, nullptr);
hService = CreateServiceW(hManager, SERVICE_NAME, SERVICE_NAME, SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER, SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL, driverPath.c_str(), nullptr, nullptr, nullptr, nullptr, nullptr);
if (!hService) {
LOG_ERR(CLEAR "%s" RED_S "failed to install WinRing0 driver, error %u", tag, GetLastError());
@ -162,7 +156,7 @@ static HANDLE wrmsr_install_driver()
}
}
HANDLE hDriver = CreateFileW(L"\\\\.\\WinRing0_1_2_0", GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
HANDLE hDriver = CreateFileW(L"\\\\.\\" SERVICE_NAME, GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (!hDriver) {
LOG_ERR(CLEAR "%s" RED_S "failed to connect to WinRing0 driver, error %u", tag, GetLastError());