2015-12-04 14:47:52 +00:00
|
|
|
/**
|
2016-09-11 20:20:15 +00:00
|
|
|
* Author......: See docs/credits.txt
|
2015-12-04 14:47:52 +00:00
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
2016-09-06 16:44:05 +00:00
|
|
|
#ifndef _EXT_ADL_H
|
|
|
|
#define _EXT_ADL_H
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-09-05 19:47:26 +00:00
|
|
|
#include <string.h>
|
2016-10-10 09:03:11 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#if defined (_WIN)
|
|
|
|
#include <windows.h>
|
|
|
|
#endif // _WIN
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-01-27 12:47:19 +00:00
|
|
|
/**
|
|
|
|
* Declarations from adl_sdk.h and subheaders
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define ADL_OK 0
|
2016-01-31 22:48:38 +00:00
|
|
|
#define ADL_ERR -1
|
|
|
|
#define ADL_ERR_NOT_SUPPORTED -8
|
2016-01-27 12:47:19 +00:00
|
|
|
|
|
|
|
#define ADL_MAX_PATH 256
|
|
|
|
|
|
|
|
#define ADL_DL_FANCTRL_SPEED_TYPE_PERCENT 1
|
|
|
|
#define ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED 1
|
|
|
|
|
|
|
|
typedef struct AdapterInfo
|
|
|
|
{
|
|
|
|
int iSize;
|
|
|
|
int iAdapterIndex;
|
|
|
|
char strUDID[ADL_MAX_PATH];
|
|
|
|
int iBusNumber;
|
|
|
|
int iDeviceNumber;
|
|
|
|
int iFunctionNumber;
|
|
|
|
int iVendorID;
|
|
|
|
char strAdapterName[ADL_MAX_PATH];
|
|
|
|
char strDisplayName[ADL_MAX_PATH];
|
|
|
|
int iPresent;
|
|
|
|
|
2017-02-18 20:29:11 +00:00
|
|
|
#if defined (_WIN32) || defined (_WIN64) || defined (__CYGWIN__)
|
2016-01-27 12:47:19 +00:00
|
|
|
int iExist;
|
|
|
|
char strDriverPath[ADL_MAX_PATH];
|
|
|
|
char strDriverPathExt[ADL_MAX_PATH];
|
|
|
|
char strPNPString[ADL_MAX_PATH];
|
|
|
|
int iOSDisplayIndex;
|
2017-02-18 20:29:11 +00:00
|
|
|
#endif /* (_WIN32) || (_WIN64) || (__CYGWIN__) */
|
2016-01-27 12:47:19 +00:00
|
|
|
|
2016-01-31 22:48:38 +00:00
|
|
|
#if defined (__linux__)
|
2016-01-27 12:47:19 +00:00
|
|
|
int iXScreenNum;
|
|
|
|
int iDrvIndex;
|
|
|
|
char strXScreenConfigName[ADL_MAX_PATH];
|
2016-01-31 22:48:38 +00:00
|
|
|
#endif /* (__linux__) */
|
2016-01-27 12:47:19 +00:00
|
|
|
} AdapterInfo, *LPAdapterInfo;
|
|
|
|
|
|
|
|
typedef struct ADLThermalControllerInfo
|
|
|
|
{
|
|
|
|
int iSize;
|
|
|
|
int iThermalDomain;
|
|
|
|
int iDomainIndex;
|
|
|
|
int iFlags;
|
|
|
|
} ADLThermalControllerInfo;
|
|
|
|
|
|
|
|
typedef struct ADLTemperature
|
|
|
|
{
|
|
|
|
int iSize;
|
|
|
|
int iTemperature;
|
|
|
|
} ADLTemperature;
|
|
|
|
|
|
|
|
typedef struct ADLFanSpeedInfo
|
|
|
|
{
|
|
|
|
int iSize;
|
|
|
|
int iFlags;
|
|
|
|
int iMinPercent;
|
|
|
|
int iMaxPercent;
|
|
|
|
int iMinRPM;
|
|
|
|
int iMaxRPM;
|
|
|
|
} ADLFanSpeedInfo;
|
|
|
|
|
|
|
|
typedef struct ADLFanSpeedValue
|
|
|
|
{
|
|
|
|
int iSize;
|
|
|
|
int iSpeedType;
|
|
|
|
int iFanSpeed;
|
|
|
|
int iFlags;
|
|
|
|
} ADLFanSpeedValue;
|
|
|
|
|
|
|
|
typedef struct ADLDisplayID
|
|
|
|
{
|
|
|
|
int iDisplayLogicalIndex;
|
|
|
|
int iDisplayPhysicalIndex;
|
|
|
|
int iDisplayLogicalAdapterIndex;
|
|
|
|
int iDisplayPhysicalAdapterIndex;
|
|
|
|
} ADLDisplayID, *LPADLDisplayID;
|
|
|
|
|
|
|
|
typedef struct ADLDisplayInfo
|
|
|
|
{
|
|
|
|
ADLDisplayID displayID;
|
|
|
|
int iDisplayControllerIndex;
|
|
|
|
char strDisplayName[ADL_MAX_PATH];
|
|
|
|
char strDisplayManufacturerName[ADL_MAX_PATH];
|
|
|
|
int iDisplayType;
|
|
|
|
int iDisplayOutputType;
|
|
|
|
int iDisplayConnector;
|
|
|
|
int iDisplayInfoMask;
|
|
|
|
int iDisplayInfoValue;
|
|
|
|
} ADLDisplayInfo, *LPADLDisplayInfo;
|
|
|
|
|
|
|
|
typedef struct ADLBiosInfo
|
|
|
|
{
|
|
|
|
char strPartNumber[ADL_MAX_PATH];
|
|
|
|
char strVersion[ADL_MAX_PATH];
|
|
|
|
char strDate[ADL_MAX_PATH];
|
|
|
|
} ADLBiosInfo, *LPADLBiosInfo;
|
|
|
|
|
|
|
|
typedef struct ADLPMActivity
|
|
|
|
{
|
|
|
|
int iSize;
|
|
|
|
int iEngineClock;
|
|
|
|
int iMemoryClock;
|
|
|
|
int iVddc;
|
|
|
|
int iActivityPercent;
|
|
|
|
int iCurrentPerformanceLevel;
|
|
|
|
int iCurrentBusSpeed;
|
|
|
|
int iCurrentBusLanes;
|
|
|
|
int iMaximumBusLanes;
|
|
|
|
int iReserved;
|
|
|
|
} ADLPMActivity;
|
|
|
|
|
|
|
|
typedef struct ADLODParameterRange
|
|
|
|
{
|
|
|
|
int iMin;
|
|
|
|
int iMax;
|
|
|
|
int iStep;
|
|
|
|
} ADLODParameterRange;
|
|
|
|
|
|
|
|
typedef struct ADLODParameters
|
|
|
|
{
|
|
|
|
int iSize;
|
|
|
|
int iNumberOfPerformanceLevels;
|
|
|
|
int iActivityReportingSupported;
|
|
|
|
int iDiscretePerformanceLevels;
|
|
|
|
int iReserved;
|
|
|
|
ADLODParameterRange sEngineClock;
|
|
|
|
ADLODParameterRange sMemoryClock;
|
|
|
|
ADLODParameterRange sVddc;
|
|
|
|
} ADLODParameters;
|
|
|
|
|
|
|
|
typedef struct ADLODPerformanceLevel
|
|
|
|
{
|
|
|
|
int iEngineClock;
|
|
|
|
int iMemoryClock;
|
|
|
|
int iVddc;
|
|
|
|
} ADLODPerformanceLevel;
|
|
|
|
|
2016-03-06 12:31:12 +00:00
|
|
|
/*
|
|
|
|
* Attention: we had to change this struct due to an out-of-bound problem mentioned here:
|
2016-05-10 17:07:07 +00:00
|
|
|
* https://github.com/hashcat/hashcat/issues/244
|
2016-03-06 12:31:12 +00:00
|
|
|
* the change: ADLODPerformanceLevel aLevels [1] -> ADLODPerformanceLevel aLevels [2]
|
|
|
|
*/
|
|
|
|
|
2016-01-27 12:47:19 +00:00
|
|
|
typedef struct ADLODPerformanceLevels
|
|
|
|
{
|
|
|
|
int iSize;
|
|
|
|
int iReserved;
|
2016-03-06 12:31:12 +00:00
|
|
|
ADLODPerformanceLevel aLevels [2];
|
2016-01-27 12:47:19 +00:00
|
|
|
} ADLODPerformanceLevels;
|
|
|
|
|
|
|
|
typedef struct ADLOD6FanSpeedInfo
|
|
|
|
{
|
|
|
|
int iSpeedType;
|
|
|
|
int iFanSpeedPercent;
|
|
|
|
int iFanSpeedRPM;
|
|
|
|
int iExtValue;
|
|
|
|
int iExtMask;
|
|
|
|
} ADLOD6FanSpeedInfo;
|
|
|
|
|
|
|
|
typedef struct ADLOD6FanSpeedValue
|
|
|
|
{
|
|
|
|
int iSpeedType;
|
|
|
|
int iFanSpeed;
|
|
|
|
int iExtValue;
|
|
|
|
int iExtMask;
|
|
|
|
} ADLOD6FanSpeedValue;
|
|
|
|
|
|
|
|
typedef struct ADLOD6CurrentStatus
|
|
|
|
{
|
|
|
|
int iEngineClock;
|
|
|
|
int iMemoryClock;
|
|
|
|
int iActivityPercent;
|
|
|
|
int iCurrentPerformanceLevel;
|
|
|
|
int iCurrentBusSpeed;
|
|
|
|
int iCurrentBusLanes;
|
|
|
|
int iMaximumBusLanes;
|
|
|
|
int iExtValue;
|
|
|
|
int iExtMask;
|
|
|
|
} ADLOD6CurrentStatus;
|
|
|
|
|
|
|
|
typedef struct ADLOD6ParameterRange
|
|
|
|
{
|
|
|
|
int iMin;
|
|
|
|
int iMax;
|
|
|
|
int iStep;
|
|
|
|
} ADLOD6ParameterRange;
|
|
|
|
|
|
|
|
typedef struct ADLOD6Capabilities
|
|
|
|
{
|
|
|
|
int iCapabilities;
|
|
|
|
int iSupportedStates;
|
|
|
|
int iNumberOfPerformanceLevels;
|
|
|
|
ADLOD6ParameterRange sEngineClockRange;
|
|
|
|
ADLOD6ParameterRange sMemoryClockRange;
|
|
|
|
int iExtValue;
|
|
|
|
int iExtMask;
|
|
|
|
} ADLOD6Capabilities;
|
|
|
|
|
|
|
|
typedef struct ADLOD6PerformanceLevel
|
|
|
|
{
|
|
|
|
int iEngineClock;
|
|
|
|
int iMemoryClock;
|
|
|
|
} ADLOD6PerformanceLevel;
|
|
|
|
|
2016-03-06 12:31:12 +00:00
|
|
|
/*
|
|
|
|
* Attention: we had to change this struct due to an out-of-bound problem mentioned here:
|
2016-05-10 17:07:07 +00:00
|
|
|
* https://github.com/hashcat/hashcat/issues/244
|
2016-03-06 12:31:12 +00:00
|
|
|
* the change: ADLOD6PerformanceLevel aLevels [1] -> ADLOD6PerformanceLevel aLevels [2]
|
|
|
|
*/
|
|
|
|
|
2016-01-27 12:47:19 +00:00
|
|
|
typedef struct ADLOD6StateInfo
|
|
|
|
{
|
|
|
|
int iNumberOfPerformanceLevels;
|
|
|
|
int iExtValue;
|
|
|
|
int iExtMask;
|
2016-03-06 12:31:12 +00:00
|
|
|
ADLOD6PerformanceLevel aLevels [2];
|
2016-01-27 12:47:19 +00:00
|
|
|
} ADLOD6StateInfo;
|
|
|
|
|
2016-10-01 11:25:51 +00:00
|
|
|
#if defined (__MSC_VER)
|
|
|
|
#define ADL_API_CALL __cdecl
|
2016-11-29 21:39:22 +00:00
|
|
|
#elif defined (_WIN32) || defined (__WIN32__)
|
2016-06-03 22:54:28 +00:00
|
|
|
#define ADL_API_CALL __stdcall
|
2016-03-25 18:19:12 +00:00
|
|
|
#else
|
2016-06-03 22:54:28 +00:00
|
|
|
#define ADL_API_CALL
|
|
|
|
#endif
|
2016-01-27 12:47:19 +00:00
|
|
|
|
2016-06-03 22:54:28 +00:00
|
|
|
typedef void* (ADL_API_CALL *ADL_MAIN_MALLOC_CALLBACK )( int );
|
2016-01-27 12:47:19 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* End of declarations from adl_sdk.h and subheaders
|
|
|
|
**/
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-06-02 12:20:15 +00:00
|
|
|
typedef int HM_ADAPTER_ADL;
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-10-01 09:54:00 +00:00
|
|
|
typedef struct struct_ADLOD6MemClockState
|
2015-12-04 14:47:52 +00:00
|
|
|
{
|
|
|
|
ADLOD6StateInfo state;
|
|
|
|
ADLOD6PerformanceLevel level;
|
|
|
|
|
|
|
|
} ADLOD6MemClockState;
|
|
|
|
|
2016-10-30 19:45:44 +00:00
|
|
|
typedef int (ADL_API_CALL *ADL_MAIN_CONTROL_DESTROY) (void);
|
2016-06-03 22:54:28 +00:00
|
|
|
typedef int (ADL_API_CALL *ADL_MAIN_CONTROL_CREATE) (ADL_MAIN_MALLOC_CALLBACK, int);
|
|
|
|
typedef int (ADL_API_CALL *ADL_ADAPTER_NUMBEROFADAPTERS_GET) (int *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_ADAPTER_ADAPTERINFO_GET) (LPAdapterInfo, int);
|
|
|
|
typedef int (ADL_API_CALL *ADL_DISPLAY_DISPLAYINFO_GET) (int, int *, ADLDisplayInfo **, int);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_TEMPERATURE_GET) (int, int, ADLTemperature *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TEMPERATURE_GET) (int, int *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_CURRENTACTIVITY_GET) (int, ADLPMActivity *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_THERMALDEVICES_ENUM) (int, int, ADLThermalControllerInfo *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_ADAPTER_ID_GET) (int, int *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_ADAPTER_VIDEOBIOSINFO_GET) (int, ADLBiosInfo *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_FANSPEEDINFO_GET) (int, int, ADLFanSpeedInfo *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_FANSPEED_GET) (int, int, ADLFanSpeedValue *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_FANSPEED_GET) (int, ADLOD6FanSpeedInfo *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_ODPARAMETERS_GET) (int, ADLODParameters *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET) (int, int, ADLODPerformanceLevels *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_ADAPTER_ACTIVE_GET) (int, int *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE_CAPS) (int, int *, int *, int *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_CURRENTSTATUS_GET) (int, ADLOD6CurrentStatus *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_STATEINFO_GET) (int, int, ADLOD6MemClockState *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_CAPABILITIES_GET) (int, ADLOD6Capabilities *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET) (int, int *, int *);
|
|
|
|
typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET) (int, ADLOD6ParameterRange *);
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-10-01 09:54:00 +00:00
|
|
|
typedef struct hm_adl_lib
|
2016-01-31 22:48:38 +00:00
|
|
|
{
|
2019-01-14 09:11:23 +00:00
|
|
|
hc_dynlib_t lib;
|
2016-01-31 22:48:38 +00:00
|
|
|
|
|
|
|
ADL_MAIN_CONTROL_DESTROY ADL_Main_Control_Destroy;
|
|
|
|
ADL_MAIN_CONTROL_CREATE ADL_Main_Control_Create;
|
|
|
|
ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get;
|
|
|
|
ADL_ADAPTER_ADAPTERINFO_GET ADL_Adapter_AdapterInfo_Get;
|
|
|
|
ADL_DISPLAY_DISPLAYINFO_GET ADL_Display_DisplayInfo_Get;
|
|
|
|
ADL_ADAPTER_ID_GET ADL_Adapter_ID_Get;
|
|
|
|
ADL_ADAPTER_VIDEOBIOSINFO_GET ADL_Adapter_VideoBiosInfo_Get;
|
|
|
|
ADL_OVERDRIVE5_THERMALDEVICES_ENUM ADL_Overdrive5_ThermalDevices_Enum;
|
|
|
|
ADL_OVERDRIVE5_TEMPERATURE_GET ADL_Overdrive5_Temperature_Get;
|
|
|
|
ADL_OVERDRIVE6_TEMPERATURE_GET ADL_Overdrive6_Temperature_Get;
|
|
|
|
ADL_OVERDRIVE5_CURRENTACTIVITY_GET ADL_Overdrive5_CurrentActivity_Get;
|
|
|
|
ADL_OVERDRIVE5_FANSPEEDINFO_GET ADL_Overdrive5_FanSpeedInfo_Get;
|
|
|
|
ADL_OVERDRIVE5_FANSPEED_GET ADL_Overdrive5_FanSpeed_Get;
|
|
|
|
ADL_OVERDRIVE6_FANSPEED_GET ADL_Overdrive6_FanSpeed_Get;
|
|
|
|
ADL_ADAPTER_ACTIVE_GET ADL_Adapter_Active_Get;
|
|
|
|
ADL_OVERDRIVE_CAPS ADL_Overdrive_Caps;
|
|
|
|
ADL_OVERDRIVE6_CAPABILITIES_GET ADL_Overdrive6_Capabilities_Get;
|
|
|
|
ADL_OVERDRIVE6_STATEINFO_GET ADL_Overdrive6_StateInfo_Get;
|
|
|
|
ADL_OVERDRIVE6_CURRENTSTATUS_GET ADL_Overdrive6_CurrentStatus_Get;
|
|
|
|
ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET ADL_Overdrive6_TargetTemperatureData_Get;
|
2016-05-29 13:34:28 +00:00
|
|
|
ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET ADL_Overdrive6_TargetTemperatureRangeInfo_Get;
|
2016-01-31 22:48:38 +00:00
|
|
|
|
2016-02-02 00:14:33 +00:00
|
|
|
} hm_adl_lib_t;
|
2016-01-31 22:48:38 +00:00
|
|
|
|
2016-09-05 19:47:26 +00:00
|
|
|
typedef hm_adl_lib_t ADL_PTR;
|
2016-01-31 22:48:38 +00:00
|
|
|
|
2016-09-08 07:21:25 +00:00
|
|
|
void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize);
|
|
|
|
|
2016-09-06 16:44:05 +00:00
|
|
|
#endif // _EXT_ADL_H
|