mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 01:04:57 +08:00
feature(sysman): Add pmt support in windows
Related-To: NEO-8804 Signed-off-by: shubham kumar <shubham.kumar@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6a02927d52
commit
6a55bbe6cd
@@ -18,4 +18,4 @@ if(WIN32)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zes_os_sysman_driver_imp.h
|
||||
)
|
||||
add_subdirectories()
|
||||
endif()
|
||||
endif()
|
||||
17
level_zero/sysman/source/shared/windows/pmt/CMakeLists.txt
Normal file
17
level_zero/sysman/source/shared/windows/pmt/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(WIN32)
|
||||
target_sources(${L0_STATIC_LIB_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sysman_pmt_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sysman_pmt.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sysman_pmt.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}/sysman_pmt_helper.cpp
|
||||
)
|
||||
endif()
|
||||
add_subdirectories()
|
||||
213
level_zero/sysman/source/shared/windows/pmt/sysman_pmt.cpp
Normal file
213
level_zero/sysman/source/shared/windows/pmt/sysman_pmt.cpp
Normal file
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/sysman/source/shared/windows/pmt/sysman_pmt.h"
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/debug_helpers.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
ze_result_t PlatformMonitoringTech::readValue(const std::string key, uint32_t &value) {
|
||||
|
||||
auto offset = keyOffsetMap.find(key);
|
||||
if (offset == keyOffsetMap.end()) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Key %s has not been defined in key offset map.\n", key.c_str());
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
PmtSysman::PmtTelemetryRead readRequest = {0};
|
||||
readRequest.version = 0;
|
||||
readRequest.index = (offset->second).second;
|
||||
readRequest.offset = baseOffset + (offset->second).first;
|
||||
readRequest.count = 1;
|
||||
|
||||
uint32_t bytesReturned = 0;
|
||||
|
||||
auto res = ioctlReadWriteData(deviceInterface, PmtSysman::IoctlPmtGetTelemtryDword, (void *)&readRequest, sizeof(PmtSysman::PmtTelemetryRead), &value, sizeof(uint32_t), &bytesReturned);
|
||||
|
||||
if (res == ZE_RESULT_SUCCESS && value != NULL && bytesReturned != 0) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Ioctl call could not return a valid value for register key %s\n", key.c_str());
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
ze_result_t PlatformMonitoringTech::readValue(const std::string key, uint64_t &value) {
|
||||
auto offset = keyOffsetMap.find(key);
|
||||
if (offset == keyOffsetMap.end()) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Key %s has not been defined in key offset map.\n", key.c_str());
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
PmtSysman::PmtTelemetryRead readRequest = {0};
|
||||
readRequest.version = 0;
|
||||
readRequest.index = (offset->second).second;
|
||||
readRequest.offset = baseOffset + (offset->second).first;
|
||||
readRequest.count = 1;
|
||||
|
||||
uint32_t bytesReturned = 0;
|
||||
|
||||
auto res = ioctlReadWriteData(deviceInterface, PmtSysman::IoctlPmtGetTelemtryQword, (void *)&readRequest, sizeof(PmtSysman::PmtTelemetryRead), &value, sizeof(uint64_t), &bytesReturned);
|
||||
|
||||
if (res == ZE_RESULT_SUCCESS && value != NULL && bytesReturned != 0) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Ioctl call could not return a valid value for register key %s\n", key.c_str());
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
ze_result_t PlatformMonitoringTech::getGuid() {
|
||||
int status;
|
||||
unsigned long sizeNeeded;
|
||||
PmtSysman::PmtTelemetryDiscovery *telemetryDiscovery;
|
||||
|
||||
// Get Telmetry Discovery size
|
||||
status = ioctlReadWriteData(deviceInterface, PmtSysman::IoctlPmtGetTelemetryDiscoverySize, NULL, 0, (void *)&sizeNeeded, sizeof(sizeNeeded), NULL);
|
||||
|
||||
if (status != ZE_RESULT_SUCCESS || sizeNeeded == 0) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Ioctl call could not return a valid value for the PMT interface telemetry size needed\n");
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
telemetryDiscovery = (PmtSysman::PmtTelemetryDiscovery *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeNeeded);
|
||||
|
||||
// Get Telmetry Discovery Structure
|
||||
status = ioctlReadWriteData(deviceInterface, PmtSysman::IoctlPmtGetTelemetryDiscovery, NULL, 0, (void *)telemetryDiscovery, sizeNeeded, NULL);
|
||||
|
||||
if (status != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Ioctl call could not return a valid value for the PMT telemetry structure which provides the guids supported.\n");
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
for (uint32_t x = 0; x < telemetryDiscovery->count; x++) {
|
||||
guidToIndexList[telemetryDiscovery->telemetry[x].index] = telemetryDiscovery->telemetry[x].guid;
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t PlatformMonitoringTech::init() {
|
||||
ze_result_t result = getGuid();
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
result = getKeyOffsetMap(keyOffsetMap);
|
||||
return result;
|
||||
}
|
||||
|
||||
std::unique_ptr<PlatformMonitoringTech> PlatformMonitoringTech::create() {
|
||||
std::vector<wchar_t> deviceInterface;
|
||||
if (enumeratePMTInterface(&PmtSysman::GuidIntefacePmtTelemetry, deviceInterface) == ZE_RESULT_SUCCESS) {
|
||||
std::unique_ptr<PlatformMonitoringTech> pPmt;
|
||||
pPmt = std::make_unique<PlatformMonitoringTech>(deviceInterface);
|
||||
UNRECOVERABLE_IF(nullptr == pPmt);
|
||||
if (pPmt->init() != ZE_RESULT_SUCCESS) {
|
||||
pPmt.reset(nullptr);
|
||||
}
|
||||
return pPmt;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PlatformMonitoringTech::~PlatformMonitoringTech() {
|
||||
}
|
||||
|
||||
ze_result_t PlatformMonitoringTech::enumeratePMTInterface(const GUID *guid, std::vector<wchar_t> &deviceInterface) {
|
||||
|
||||
unsigned long cmListCharCount = 0;
|
||||
CONFIGRET status = CR_SUCCESS;
|
||||
|
||||
do {
|
||||
// Get the total size of list of all instances
|
||||
// N.B. Size returned is total length in "characters"
|
||||
status = NEO::SysCalls::cmGetDeviceInterfaceListSize(&cmListCharCount, (LPGUID)guid, NULL, CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
|
||||
|
||||
if (status != CR_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
// Free previous allocation if present.
|
||||
if (!deviceInterface.empty()) {
|
||||
deviceInterface.clear();
|
||||
}
|
||||
// Allocate buffer
|
||||
deviceInterface.resize(cmListCharCount);
|
||||
|
||||
if (deviceInterface.empty()) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Could not allocate memory to store the PMT device interface path.\n");
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
// N.B. cmListCharCount is length in characters
|
||||
status = NEO::SysCalls::cmGetDeviceInterfaceList((LPGUID)guid, NULL, &deviceInterface[0], cmListCharCount, CM_GET_DEVICE_INTERFACE_LIST_PRESENT);
|
||||
|
||||
} while (status == CR_BUFFER_SMALL);
|
||||
|
||||
if (status != CR_SUCCESS) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Could not find and store the PMT device inteface path.\n");
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t PlatformMonitoringTech::ioctlReadWriteData(std::vector<wchar_t> path, uint32_t ioctl, void *bufferIn, uint32_t inSize, void *bufferOut, uint32_t outSize, uint32_t *sizeReturned) {
|
||||
|
||||
void *handle;
|
||||
int32_t status = FALSE;
|
||||
|
||||
if (path.empty()) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"PMT interface path is empty.\n");
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
// Open handle to driver
|
||||
handle = this->pcreateFile(&path[0], GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"Could not open the pmt interface path %s.\n", &path[0]);
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
// Call DeviceIoControl
|
||||
status = this->pdeviceIoControl(handle, ioctl, bufferIn, inSize, bufferOut, outSize, reinterpret_cast<unsigned long *>(sizeReturned), NULL);
|
||||
|
||||
if (status == FALSE) {
|
||||
NEO::printDebugString(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"deviceIoControl call failed\n");
|
||||
DEBUG_BREAK_IF(true);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
this->pcloseHandle(handle);
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
53
level_zero/sysman/source/shared/windows/pmt/sysman_pmt.h
Normal file
53
level_zero/sysman/source/shared/windows/pmt/sysman_pmt.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/non_copyable_or_moveable.h"
|
||||
#include "shared/source/os_interface/windows/sys_calls.h"
|
||||
|
||||
#include "level_zero/sysman/source/shared/windows/pmt/sysman_pmt_helper.h"
|
||||
#include "level_zero/zes_api.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
class PlatformMonitoringTech : NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
PlatformMonitoringTech() = delete;
|
||||
PlatformMonitoringTech(std::vector<wchar_t> deviceInterface) : deviceInterface(deviceInterface) {}
|
||||
virtual ~PlatformMonitoringTech();
|
||||
|
||||
virtual ze_result_t readValue(const std::string key, uint32_t &value);
|
||||
virtual ze_result_t readValue(const std::string key, uint64_t &value);
|
||||
ze_result_t getKeyOffsetMap(std::map<std::string, std::pair<uint32_t, uint32_t>> &keyOffsetMap);
|
||||
static std::unique_ptr<PlatformMonitoringTech> create();
|
||||
static ze_result_t enumeratePMTInterface(const GUID *Guid, std::vector<wchar_t> &deviceInterface);
|
||||
|
||||
protected:
|
||||
std::map<std::string, std::pair<uint32_t, uint32_t>> keyOffsetMap;
|
||||
unsigned long guidToIndexList[PmtSysman::PmtMaxInterfaces] = {0};
|
||||
ze_result_t ioctlReadWriteData(std::vector<wchar_t> path, uint32_t ioctl, void *bufferIn, uint32_t inSize, void *bufferOut, uint32_t outSize, uint32_t *sizeReturned);
|
||||
virtual ze_result_t init();
|
||||
ze_result_t getGuid();
|
||||
decltype(&NEO::SysCalls::deviceIoControl) pdeviceIoControl = NEO::SysCalls::deviceIoControl;
|
||||
decltype(&NEO::SysCalls::createFile) pcreateFile = NEO::SysCalls::createFile;
|
||||
decltype(&NEO::SysCalls::closeHandle) pcloseHandle = NEO::SysCalls::closeHandle;
|
||||
|
||||
private:
|
||||
std::vector<wchar_t> deviceInterface;
|
||||
uint32_t baseOffset = 0;
|
||||
};
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/sysman/source/shared/windows/pmt/sysman_pmt.h"
|
||||
#include "level_zero/sysman/source/shared/windows/pmt/sysman_pmt_xml_offsets.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
ze_result_t PlatformMonitoringTech::getKeyOffsetMap(std::map<std::string, std::pair<uint32_t, uint32_t>> &keyOffsetMap) {
|
||||
int indexCount = 0;
|
||||
for (uint32_t index = 0; index < PmtSysman::PmtMaxInterfaces; index++) {
|
||||
auto keyOffsetMapEntry = guidToKeyOffsetMap.find(guidToIndexList[index]);
|
||||
if (keyOffsetMapEntry == guidToKeyOffsetMap.end()) {
|
||||
continue;
|
||||
} else {
|
||||
indexCount++;
|
||||
std::map<std::string, uint32_t> tempKeyOffsetMap = keyOffsetMapEntry->second;
|
||||
std::map<std::string, uint32_t>::iterator it;
|
||||
for (it = tempKeyOffsetMap.begin(); it != tempKeyOffsetMap.end(); it++) {
|
||||
keyOffsetMap.insert(std::make_pair(it->first, std::make_pair(it->second, index)));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (indexCount == 0) {
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <initguid.h>
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
namespace PmtSysman {
|
||||
|
||||
constexpr uint32_t FileDeviceIntelPmt = 0x9998;
|
||||
constexpr uint32_t PmtMaxInterfaces = 2;
|
||||
constexpr uint32_t AnySizeArray = 1;
|
||||
constexpr uint32_t MethodBuffered = 0;
|
||||
constexpr uint32_t FileReadAccess = 0x0001;
|
||||
|
||||
// Intel PMT Telemetry Interface GUID {3dfb2563-5c44-4c59-8d80-baea7d06e6b8}
|
||||
constexpr GUID GuidIntefacePmtTelemetry = {0x3dfb2563, 0x5c44, 0x4c59, {0x8d, 0x80, 0xba, 0xea, 0x7d, 0x06, 0xe6, 0xb8}};
|
||||
|
||||
inline constexpr uint32_t getCtlCode(uint32_t code) {
|
||||
return CTL_CODE(FileDeviceIntelPmt, code, MethodBuffered, FileReadAccess);
|
||||
}
|
||||
|
||||
// IOCTL commands for PMT interface access
|
||||
constexpr uint32_t IoctlPmtGetTelemetryDiscoverySize = getCtlCode(0x0);
|
||||
constexpr uint32_t IoctlPmtGetTelemetryDiscovery = getCtlCode(0x1);
|
||||
constexpr uint32_t IoctlPmtGetTelemtryDword = getCtlCode(0x2);
|
||||
constexpr uint32_t IoctlPmtGetTelemtryQword = getCtlCode(0x3);
|
||||
|
||||
// Data structures used by PMT driver
|
||||
struct PmtTelemetryEntry {
|
||||
unsigned long version; // Structure version
|
||||
unsigned long index; // Array index within parent structure
|
||||
unsigned long guid; // Globally Unique Id for XML definitions
|
||||
unsigned long dWordCount; // Count of DWORDs
|
||||
};
|
||||
|
||||
struct PmtTelemetryDiscovery {
|
||||
unsigned long version; // Structure version
|
||||
unsigned long count; // Count of telemetry interfaces
|
||||
PmtTelemetryEntry telemetry[AnySizeArray]; // Array to hold enries for each inteface.
|
||||
};
|
||||
|
||||
struct PmtTelemetryRead {
|
||||
unsigned long version; // Structure version
|
||||
unsigned long index; // index of telemetry region returned by GetTelemetryDiscovery
|
||||
unsigned long offset; // Starting DWORD or QWORD index within telemetry region
|
||||
unsigned long count; // Count of DWORD or QWORD to read
|
||||
};
|
||||
|
||||
} // namespace PmtSysman
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
// Each entry of this map corresponds to one particular graphics card type. GUID string will help in identify the card type.
|
||||
const std::map<unsigned long, std::map<std::string, uint32_t>> guidToKeyOffsetMap;
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -19,6 +19,7 @@ namespace L0 {
|
||||
namespace Sysman {
|
||||
|
||||
ze_result_t WddmSysmanImp::init() {
|
||||
|
||||
NEO::OSInterface &osInterface = *(pParentSysmanDeviceImp->getRootDeviceEnvironment()).osInterface;
|
||||
auto driverModel = osInterface.getDriverModel();
|
||||
|
||||
@@ -31,6 +32,8 @@ ze_result_t WddmSysmanImp::init() {
|
||||
pKmdSysManager = KmdSysManager::create(pWddm);
|
||||
UNRECOVERABLE_IF(nullptr == pKmdSysManager);
|
||||
|
||||
pPmt = PlatformMonitoringTech::create();
|
||||
|
||||
subDeviceCount = NEO::GfxCoreHelper::getSubDevicesCount(&pParentSysmanDeviceImp->getHardwareInfo());
|
||||
if (subDeviceCount == 1) {
|
||||
subDeviceCount = 0;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "level_zero/sysman/source/device/sysman_device.h"
|
||||
#include "level_zero/sysman/source/device/sysman_device_imp.h"
|
||||
#include "level_zero/sysman/source/shared/firmware_util/sysman_firmware_util.h"
|
||||
#include "level_zero/sysman/source/shared/windows/pmt/sysman_pmt.h"
|
||||
#include "level_zero/sysman/source/shared/windows/sysman_kmd_sys_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
@@ -44,6 +45,7 @@ class WddmSysmanImp : public OsSysman, NEO::NonCopyableOrMovableClass {
|
||||
FirmwareUtil *pFwUtilInterface = nullptr;
|
||||
KmdSysManager *pKmdSysManager = nullptr;
|
||||
SysmanDevice *pDevice = nullptr;
|
||||
std::unique_ptr<PlatformMonitoringTech> pPmt;
|
||||
std::unique_ptr<SysmanProductHelper> pSysmanProductHelper;
|
||||
|
||||
private:
|
||||
|
||||
@@ -15,5 +15,5 @@ if(WIN32)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sysman_driver.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_sysman_manager.cpp
|
||||
)
|
||||
add_subdirectories()
|
||||
endif()
|
||||
add_subdirectories()
|
||||
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# Copyright (C) 2024 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(WIN32)
|
||||
target_sources(${TARGET_NAME}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_pmt.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mock_pmt.h
|
||||
)
|
||||
endif()
|
||||
add_subdirectories()
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/test/common/os_interface/windows/mock_sys_calls.h"
|
||||
|
||||
#include "level_zero/sysman/source/shared/windows/pmt/sysman_pmt.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
namespace ult {
|
||||
|
||||
class PublicPlatformMonitoringTech : public L0::Sysman::PlatformMonitoringTech {
|
||||
public:
|
||||
PublicPlatformMonitoringTech(std::vector<wchar_t> deviceInterfaceList) : PlatformMonitoringTech(deviceInterfaceList) {}
|
||||
using PlatformMonitoringTech::keyOffsetMap;
|
||||
using PlatformMonitoringTech::pcreateFile;
|
||||
using PlatformMonitoringTech::pdeviceIoControl;
|
||||
};
|
||||
|
||||
} // namespace ult
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
|
||||
#include "level_zero/sysman/test/unit_tests/sources/windows/mock_sysman_fixture.h"
|
||||
#include "level_zero/sysman/test/unit_tests/sources/windows/pmt/mock_pmt.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace Sysman {
|
||||
namespace ult {
|
||||
|
||||
const std::wstring interfaceName = L"TEST\0";
|
||||
std::vector<wchar_t> deviceInterface(interfaceName.begin(), interfaceName.end());
|
||||
|
||||
const std::map<std::string, std::pair<uint32_t, uint32_t>> dummyKeyOffsetMap = {
|
||||
{"DUMMY_KEY", {0x0, 1}}};
|
||||
|
||||
inline static HANDLE mockCreateFileSuccess(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) {
|
||||
return reinterpret_cast<HANDLE>(static_cast<uintptr_t>(0x7));
|
||||
}
|
||||
|
||||
inline static BOOL mockDeviceIoControlSuccess(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) {
|
||||
*lpBytesReturned = 4;
|
||||
*(int *)lpOutBuffer = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
class SysmanDevicePmtFixture : public SysmanDeviceFixture {
|
||||
protected:
|
||||
std::unique_ptr<PublicPlatformMonitoringTech> pPmt;
|
||||
void SetUp() override {
|
||||
SysmanDeviceFixture::SetUp();
|
||||
std::vector<wchar_t> deviceInterface;
|
||||
pPmt = std::make_unique<PublicPlatformMonitoringTech>(deviceInterface);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
SysmanDeviceFixture::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenWrongKeyWhenCallingReadValueWithUint32TypeThenCallFails) {
|
||||
|
||||
uint32_t val = 0;
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pPmt->readValue("SOMETHING", val));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenWrongKeyWhenCallingReadValueWithUint64TypeThenCallFails) {
|
||||
|
||||
uint64_t val = 0;
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pPmt->readValue("SOMETHING", val));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenNullPmtHandleWhenCallingReadValueWithUint32CallFails) {
|
||||
uint32_t val = 0;
|
||||
pPmt->keyOffsetMap = dummyKeyOffsetMap;
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pPmt->readValue("DUMMY_KEY", val));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenInvalidPmtHandleWhenCallingReadValue32CallFails) {
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsCreateFile)> psysCallsCreateFile(&NEO::SysCalls::sysCallsCreateFile, [](LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) -> HANDLE {
|
||||
return INVALID_HANDLE_VALUE;
|
||||
});
|
||||
pPmt = std::make_unique<PublicPlatformMonitoringTech>(deviceInterface);
|
||||
uint32_t val = 0;
|
||||
pPmt->keyOffsetMap = dummyKeyOffsetMap;
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pPmt->readValue("DUMMY_KEY", val));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenInvalidPmtHandleWhenCallingReadValue64CallFails) {
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsCreateFile)> psysCallsCreateFile(&NEO::SysCalls::sysCallsCreateFile, [](LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) -> HANDLE {
|
||||
return INVALID_HANDLE_VALUE;
|
||||
});
|
||||
pPmt = std::make_unique<PublicPlatformMonitoringTech>(deviceInterface);
|
||||
uint64_t val = 0;
|
||||
pPmt->keyOffsetMap = dummyKeyOffsetMap;
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pPmt->readValue("DUMMY_KEY", val));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenValidPmtHandleWhenCallingReadValueWithUint32WhenIoctlCallFailsThenProperErrorIsReturned) {
|
||||
pPmt = std::make_unique<PublicPlatformMonitoringTech>(deviceInterface);
|
||||
pPmt->pcreateFile = mockCreateFileSuccess;
|
||||
uint32_t val = 0;
|
||||
pPmt->keyOffsetMap = dummyKeyOffsetMap;
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pPmt->readValue("DUMMY_KEY", val));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenValidPmtHandleWhenCallingReadValueWithUint32TypeWhenIoctlCallSucceedsThenreadValueReturned) {
|
||||
pPmt = std::make_unique<PublicPlatformMonitoringTech>(deviceInterface);
|
||||
pPmt->pcreateFile = mockCreateFileSuccess;
|
||||
pPmt->pdeviceIoControl = mockDeviceIoControlSuccess;
|
||||
|
||||
uint32_t val = 0;
|
||||
pPmt->keyOffsetMap = dummyKeyOffsetMap;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, pPmt->readValue("DUMMY_KEY", val));
|
||||
EXPECT_NE(0u, val);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenValidPmtHandleWhenCallingReadValueWithUint32WithNullValueReturnedFromIoctlCallThenreadValueFails) {
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsDeviceIoControl)> psysCallsDeviceIoControl(&NEO::SysCalls::sysCallsDeviceIoControl, [](HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) -> BOOL {
|
||||
*lpBytesReturned = 4;
|
||||
*(int *)lpOutBuffer = 0;
|
||||
return true;
|
||||
});
|
||||
pPmt = std::make_unique<PublicPlatformMonitoringTech>(deviceInterface);
|
||||
pPmt->pcreateFile = mockCreateFileSuccess;
|
||||
|
||||
uint32_t val = 0;
|
||||
pPmt->keyOffsetMap = dummyKeyOffsetMap;
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pPmt->readValue("DUMMY_KEY", val));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenValidPmtHandleWhenCallingReadValueWithUint32WithNullBytesCountReturnedFromIoctlCallThenreadValueFails) {
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsDeviceIoControl)> psysCallsDeviceIoControl(&NEO::SysCalls::sysCallsDeviceIoControl, [](HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) -> BOOL {
|
||||
*lpBytesReturned = 0;
|
||||
*(int *)lpOutBuffer = 4;
|
||||
return true;
|
||||
});
|
||||
pPmt = std::make_unique<PublicPlatformMonitoringTech>(deviceInterface);
|
||||
pPmt->pcreateFile = mockCreateFileSuccess;
|
||||
|
||||
uint32_t val = 0;
|
||||
pPmt->keyOffsetMap = dummyKeyOffsetMap;
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pPmt->readValue("DUMMY_KEY", val));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenValidPmtHandleWhenCallingReadValueWithUint64WithNullValueReturnedFromIoctlCallThenreadValueFails) {
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsDeviceIoControl)> psysCallsDeviceIoControl(&NEO::SysCalls::sysCallsDeviceIoControl, [](HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) -> BOOL {
|
||||
*lpBytesReturned = 4;
|
||||
*(int *)lpOutBuffer = 0;
|
||||
return true;
|
||||
});
|
||||
pPmt = std::make_unique<PublicPlatformMonitoringTech>(deviceInterface);
|
||||
pPmt->pcreateFile = mockCreateFileSuccess;
|
||||
|
||||
uint64_t val = 0;
|
||||
pPmt->keyOffsetMap = dummyKeyOffsetMap;
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pPmt->readValue("DUMMY_KEY", val));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenValidPmtHandleWhenCallingReadValueWithUint64WithNullBytesCountReturnedFromIoctlCallThenreadValueFails) {
|
||||
VariableBackup<decltype(NEO::SysCalls::sysCallsDeviceIoControl)> psysCallsDeviceIoControl(&NEO::SysCalls::sysCallsDeviceIoControl, [](HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) -> BOOL {
|
||||
*lpBytesReturned = 0;
|
||||
*(int *)lpOutBuffer = 4;
|
||||
return true;
|
||||
});
|
||||
pPmt = std::make_unique<PublicPlatformMonitoringTech>(deviceInterface);
|
||||
pPmt->pcreateFile = mockCreateFileSuccess;
|
||||
|
||||
uint64_t val = 0;
|
||||
pPmt->keyOffsetMap = dummyKeyOffsetMap;
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pPmt->readValue("DUMMY_KEY", val));
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenValidPmtHandleWhenCallingreadValueWithUint64TypeAndIoctlCallSucceedsThenreadValueReturned) {
|
||||
pPmt = std::make_unique<PublicPlatformMonitoringTech>(deviceInterface);
|
||||
pPmt->pcreateFile = mockCreateFileSuccess;
|
||||
pPmt->pdeviceIoControl = mockDeviceIoControlSuccess;
|
||||
uint64_t val = 0;
|
||||
pPmt->keyOffsetMap = dummyKeyOffsetMap;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, pPmt->readValue("DUMMY_KEY", val));
|
||||
EXPECT_NE(0u, val);
|
||||
}
|
||||
|
||||
TEST_F(SysmanDevicePmtFixture, GivenInvalidPmtInterfaceWhenCallingCreateThenCallReturnsNullPtr) {
|
||||
std::unique_ptr<PlatformMonitoringTech> pPmt = PublicPlatformMonitoringTech::create();
|
||||
EXPECT_EQ(nullptr, pPmt);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace Sysman
|
||||
} // namespace L0
|
||||
@@ -158,6 +158,22 @@ LSTATUS regOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDes
|
||||
LSTATUS regQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData) {
|
||||
return RegQueryValueExA(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData);
|
||||
}
|
||||
} // namespace SysCalls
|
||||
|
||||
HANDLE createFile(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) {
|
||||
return CreateFile(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
|
||||
}
|
||||
|
||||
BOOL deviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) {
|
||||
return DeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped);
|
||||
}
|
||||
|
||||
CONFIGRET cmGetDeviceInterfaceListSize(PULONG pulLen, LPGUID interfaceClassGuid, DEVINSTID_W pDeviceID, ULONG ulFlags) {
|
||||
return CM_Get_Device_Interface_List_Size(pulLen, interfaceClassGuid, pDeviceID, ulFlags);
|
||||
}
|
||||
|
||||
CONFIGRET cmGetDeviceInterfaceList(LPGUID interfaceClassGuid, DEVINSTID_W pDeviceID, PZZWSTR buffer, ULONG bufferLen, ULONG ulFlags) {
|
||||
return CM_Get_Device_Interface_List(interfaceClassGuid, pDeviceID, buffer, bufferLen, ulFlags);
|
||||
}
|
||||
|
||||
} // namespace SysCalls
|
||||
} // namespace NEO
|
||||
|
||||
@@ -52,6 +52,10 @@ void coTaskMemFree(LPVOID pv);
|
||||
|
||||
LSTATUS regOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult);
|
||||
LSTATUS regQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
|
||||
HANDLE createFile(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
|
||||
BOOL deviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);
|
||||
CONFIGRET cmGetDeviceInterfaceListSize(PULONG pulLen, LPGUID interfaceClassGuid, DEVINSTID_W pDeviceID, ULONG ulFlags);
|
||||
CONFIGRET cmGetDeviceInterfaceList(LPGUID interfaceClassGuid, DEVINSTID_W pDeviceID, PZZWSTR buffer, ULONG bufferLen, ULONG ulFlags);
|
||||
|
||||
} // namespace SysCalls
|
||||
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
#include <Windows.h>
|
||||
|
||||
#include <ShlObj.h>
|
||||
#include <cfgmgr32.h>
|
||||
#include <winternl.h>
|
||||
#pragma comment(lib, "cfgmgr32.lib")
|
||||
|
||||
#if __clang__
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@@ -56,3 +56,15 @@ MockGlobalSysCallRestorer<CallbackT> changeSysCallMock(CallbackT &globalClb, voi
|
||||
globalClbData = mockCallbackData;
|
||||
return ret;
|
||||
}
|
||||
|
||||
namespace NEO {
|
||||
|
||||
namespace SysCalls {
|
||||
|
||||
extern HANDLE (*sysCallsCreateFile)(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
|
||||
extern BOOL (*sysCallsDeviceIoControl)(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);
|
||||
extern CONFIGRET (*sysCallsCmGetDeviceInterfaceListSize)(PULONG pulLen, LPGUID interfaceClassGuid, DEVINSTID_W pDeviceID, ULONG ulFlags);
|
||||
extern CONFIGRET (*sysCallsCmGetDeviceInterfaceList)(LPGUID interfaceClassGuid, DEVINSTID_W pDeviceID, PZZWSTR buffer, ULONG bufferLen, ULONG ulFlags);
|
||||
|
||||
} // namespace SysCalls
|
||||
} // namespace NEO
|
||||
|
||||
@@ -99,6 +99,18 @@ ProcessPowerThrottlingState setProcessPowerThrottlingStateLastValue{};
|
||||
size_t setThreadPriorityCalled = 0u;
|
||||
ThreadPriority setThreadPriorityLastValue{};
|
||||
|
||||
HANDLE(*sysCallsCreateFile)
|
||||
(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) = nullptr;
|
||||
|
||||
BOOL(*sysCallsDeviceIoControl)
|
||||
(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) = nullptr;
|
||||
|
||||
CONFIGRET(*sysCallsCmGetDeviceInterfaceListSize)
|
||||
(PULONG pulLen, LPGUID interfaceClassGuid, DEVINSTID_W pDeviceID, ULONG ulFlags) = nullptr;
|
||||
|
||||
CONFIGRET(*sysCallsCmGetDeviceInterfaceList)
|
||||
(LPGUID interfaceClassGuid, DEVINSTID_W pDeviceID, PZZWSTR buffer, ULONG bufferLen, ULONG ulFlags) = nullptr;
|
||||
|
||||
bool pathExists(const std::string &path) {
|
||||
std::string tempP1 = path;
|
||||
if (!path.empty() && path.back() == PATH_SEPARATOR) {
|
||||
@@ -289,6 +301,34 @@ void setThreadPriority(ThreadPriority priority) {
|
||||
setThreadPriorityLastValue = priority;
|
||||
}
|
||||
|
||||
HANDLE createFile(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) {
|
||||
if (sysCallsCreateFile != nullptr) {
|
||||
return sysCallsCreateFile(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BOOL deviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) {
|
||||
if (sysCallsDeviceIoControl != nullptr) {
|
||||
return sysCallsDeviceIoControl(hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CONFIGRET cmGetDeviceInterfaceListSize(PULONG pulLen, LPGUID interfaceClassGuid, DEVINSTID_W pDeviceID, ULONG ulFlags) {
|
||||
if (sysCallsCmGetDeviceInterfaceListSize != nullptr) {
|
||||
return sysCallsCmGetDeviceInterfaceListSize(pulLen, interfaceClassGuid, pDeviceID, ulFlags);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
CONFIGRET cmGetDeviceInterfaceList(LPGUID interfaceClassGuid, DEVINSTID_W pDeviceID, PZZWSTR buffer, ULONG bufferLen, ULONG ulFlags) {
|
||||
if (sysCallsCmGetDeviceInterfaceList != nullptr) {
|
||||
return sysCallsCmGetDeviceInterfaceList(interfaceClassGuid, pDeviceID, buffer, bufferLen, ulFlags);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
LSTATUS regOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult) {
|
||||
if (regOpenKeySuccessCount > 0) {
|
||||
regOpenKeySuccessCount--;
|
||||
|
||||
Reference in New Issue
Block a user