Bug Fix
This commit is contained in:
parent
8e2db8c4ed
commit
3627e9ffc2
|
@ -23,8 +23,12 @@ portable_executable::vec_relocs portable_executable::GetRelocs(void* image_base)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
vec_relocs relocs;
|
vec_relocs relocs;
|
||||||
|
DWORD reloc_va = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress;
|
||||||
|
|
||||||
auto current_base_relocation = reinterpret_cast<PIMAGE_BASE_RELOCATION>(reinterpret_cast<uint64_t>(image_base) + nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress);
|
if (!reloc_va) //Fix from @greetmark of UnknownCheats Forum
|
||||||
|
return {};
|
||||||
|
|
||||||
|
auto current_base_relocation = reinterpret_cast<PIMAGE_BASE_RELOCATION>(reinterpret_cast<uint64_t>(image_base) + reloc_va);
|
||||||
const auto reloc_end = reinterpret_cast<uint64_t>(current_base_relocation) + nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
|
const auto reloc_end = reinterpret_cast<uint64_t>(current_base_relocation) + nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
|
||||||
|
|
||||||
while (current_base_relocation->VirtualAddress && current_base_relocation->VirtualAddress < reloc_end && current_base_relocation->SizeOfBlock)
|
while (current_base_relocation->VirtualAddress && current_base_relocation->VirtualAddress < reloc_end && current_base_relocation->SizeOfBlock)
|
||||||
|
|
|
@ -5,7 +5,7 @@ bool ExistOtherService(SC_HANDLE service_manager) {
|
||||||
DWORD spaceNeeded = 0;
|
DWORD spaceNeeded = 0;
|
||||||
DWORD numServices = 0;
|
DWORD numServices = 0;
|
||||||
if (!EnumServicesStatus(service_manager, SERVICE_DRIVER, SERVICE_STATE_ALL, NULL, 0, &spaceNeeded, &numServices, 0) && GetLastError() != ERROR_MORE_DATA) {
|
if (!EnumServicesStatus(service_manager, SERVICE_DRIVER, SERVICE_STATE_ALL, NULL, 0, &spaceNeeded, &numServices, 0) && GetLastError() != ERROR_MORE_DATA) {
|
||||||
printf("Can't enum service list error code: %d!!\n",GetLastError());
|
printf("[-] Can't enum service list error code: %d!!\n",GetLastError());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
spaceNeeded += sizeof(ENUM_SERVICE_STATUSA);
|
spaceNeeded += sizeof(ENUM_SERVICE_STATUSA);
|
||||||
|
@ -21,13 +21,13 @@ bool ExistOtherService(SC_HANDLE service_manager) {
|
||||||
if (QueryServiceConfig(service_handle, config, 8096, &needed)) {
|
if (QueryServiceConfig(service_handle, config, 8096, &needed)) {
|
||||||
if (strstr(config->lpBinaryPathName, intel_driver::driver_name)) {
|
if (strstr(config->lpBinaryPathName, intel_driver::driver_name)) {
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
printf("WARNING: Service called '%s' have same file name!!\n", config->lpDisplayName);
|
printf("[-] WARNING: Service called '%s' have same file name!!\n", config->lpDisplayName);
|
||||||
CloseServiceHandle(service_handle);
|
CloseServiceHandle(service_handle);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("Note: Error query service %s error code: %d\n", service.lpServiceName, GetLastError());
|
printf("[-] Note: Error query service %s error code: %d\n", service.lpServiceName, GetLastError());
|
||||||
}
|
}
|
||||||
CloseServiceHandle(service_handle);
|
CloseServiceHandle(service_handle);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ bool ExistOtherService(SC_HANDLE service_manager) {
|
||||||
return false; //no equal services we can continue
|
return false; //no equal services we can continue
|
||||||
}
|
}
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
printf("Can't enum service list!!\n");
|
printf("[-] Can't enum service list!!\n");
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ bool ExistsValorantService(SC_HANDLE service_manager) {
|
||||||
DWORD spaceNeeded = 0;
|
DWORD spaceNeeded = 0;
|
||||||
DWORD numServices = 0;
|
DWORD numServices = 0;
|
||||||
if (!EnumServicesStatus(service_manager, SERVICE_DRIVER, SERVICE_STATE_ALL, NULL, 0, &spaceNeeded, &numServices, 0) && GetLastError() != ERROR_MORE_DATA) {
|
if (!EnumServicesStatus(service_manager, SERVICE_DRIVER, SERVICE_STATE_ALL, NULL, 0, &spaceNeeded, &numServices, 0) && GetLastError() != ERROR_MORE_DATA) {
|
||||||
printf("Can't enum service list error code: %d!!\n", GetLastError());
|
printf("[-] Can't enum service list error code: %d!!\n", GetLastError());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
spaceNeeded += sizeof(ENUM_SERVICE_STATUSA);
|
spaceNeeded += sizeof(ENUM_SERVICE_STATUSA);
|
||||||
|
@ -57,7 +57,7 @@ bool ExistsValorantService(SC_HANDLE service_manager) {
|
||||||
ENUM_SERVICE_STATUSA service = buffer[i];
|
ENUM_SERVICE_STATUSA service = buffer[i];
|
||||||
if (strstr(service.lpServiceName,"vgk")) {
|
if (strstr(service.lpServiceName,"vgk")) {
|
||||||
if ((service.ServiceStatus.dwCurrentState == SERVICE_RUNNING || service.ServiceStatus.dwCurrentState == SERVICE_START_PENDING)) {
|
if ((service.ServiceStatus.dwCurrentState == SERVICE_RUNNING || service.ServiceStatus.dwCurrentState == SERVICE_START_PENDING)) {
|
||||||
printf("Valorant service running, kdmapper stoped to prevent BSOD!!\n");
|
printf("[-] Valorant service running, kdmapper stoped to prevent BSOD!!\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ bool ExistsValorantService(SC_HANDLE service_manager) {
|
||||||
return false; //no valorant service found
|
return false; //no valorant service found
|
||||||
}
|
}
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
printf("Can't enum service list!!\n");
|
printf("[-] Can't enum service list!!\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ bool service::RegisterAndStart(const std::string& driver_path)
|
||||||
const SC_HANDLE sc_manager_handle = OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS);
|
const SC_HANDLE sc_manager_handle = OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
if (!sc_manager_handle) {
|
if (!sc_manager_handle) {
|
||||||
printf("Can't open service manager\n");
|
printf("[-] Can't open service manager\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ExistOtherService(sc_manager_handle)) {
|
if (ExistOtherService(sc_manager_handle)) {
|
||||||
|
@ -96,7 +96,7 @@ bool service::RegisterAndStart(const std::string& driver_path)
|
||||||
|
|
||||||
if (!service_handle)
|
if (!service_handle)
|
||||||
{
|
{
|
||||||
printf("Can't create the vulnerable service, check your AV!!\n");
|
printf("[-] Can't create the vulnerable service, check your AV!!\n");
|
||||||
CloseServiceHandle(sc_manager_handle);
|
CloseServiceHandle(sc_manager_handle);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ bool service::RegisterAndStart(const std::string& driver_path)
|
||||||
CloseServiceHandle(service_handle);
|
CloseServiceHandle(service_handle);
|
||||||
CloseServiceHandle(sc_manager_handle);
|
CloseServiceHandle(sc_manager_handle);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
printf("Can't start the vulnerable service, check your AV!!\n");
|
printf("[-] Can't start the vulnerable service, check your AV!!\n");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue