diff --git a/include/ext_ADL.h b/include/ext_ADL.h index 880f829b5..9a80628ba 100644 --- a/include/ext_ADL.h +++ b/include/ext_ADL.h @@ -250,20 +250,13 @@ typedef struct ADLOD6PowerControlInfo int iExtMask; } ADLOD6PowerControlInfo; -/* __stdcall definition, platform-dependent: - * - Already defined on Windows compilers - * - GCC has a suitable equivalent on 32-bit platforms - * - Leave it blank for other platforms/compilers - */ -#if !(defined (_WIN32) || defined (_WIN64)) -#if (defined(__GNUC__) && defined(__i386__)) -#define __stdcall __attribute__((stdcall)) +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +#define ADL_API_CALL __stdcall #else -#define __stdcall -#endif /* GCC 32-bit */ -#endif /* Not windows */ +#define ADL_API_CALL +#endif -typedef void* (__stdcall *ADL_MAIN_MALLOC_CALLBACK )( int ); +typedef void* (ADL_API_CALL *ADL_MAIN_MALLOC_CALLBACK )( int ); /* * End of declarations from adl_sdk.h and subheaders @@ -280,39 +273,39 @@ typedef struct } ADLOD6MemClockState; -typedef int (*ADL_MAIN_CONTROL_DESTROY) (); -typedef int (*ADL_MAIN_CONTROL_CREATE) (ADL_MAIN_MALLOC_CALLBACK, int); -typedef int (*ADL_ADAPTER_NUMBEROFADAPTERS_GET) (int *); -typedef int (*ADL_ADAPTER_ADAPTERINFO_GET) (LPAdapterInfo, int); -typedef int (*ADL_DISPLAY_DISPLAYINFO_GET) (int, int *, ADLDisplayInfo **, int); -typedef int (*ADL_OVERDRIVE5_TEMPERATURE_GET) (int, int, ADLTemperature *); -typedef int (*ADL_OVERDRIVE6_TEMPERATURE_GET) (int, int *); -typedef int (*ADL_OVERDRIVE5_CURRENTACTIVITY_GET) (int, ADLPMActivity *); -typedef int (*ADL_OVERDRIVE5_THERMALDEVICES_ENUM) (int, int, ADLThermalControllerInfo *); -typedef int (*ADL_ADAPTER_ID_GET) (int, int *); -typedef int (*ADL_ADAPTER_VIDEOBIOSINFO_GET) (int, ADLBiosInfo *); -typedef int (*ADL_OVERDRIVE5_FANSPEEDINFO_GET) (int, int, ADLFanSpeedInfo *); -typedef int (*ADL_OVERDRIVE5_FANSPEED_GET) (int, int, ADLFanSpeedValue *); -typedef int (*ADL_OVERDRIVE6_FANSPEED_GET) (int, ADLOD6FanSpeedInfo *); -typedef int (*ADL_OVERDRIVE5_FANSPEED_SET) (int, int, ADLFanSpeedValue *); -typedef int (*ADL_OVERDRIVE6_FANSPEED_SET) (int, ADLOD6FanSpeedValue *); -typedef int (*ADL_OVERDRIVE5_FANSPEEDTODEFAULT_SET) (int, int); -typedef int (*ADL_OVERDRIVE5_ODPARAMETERS_GET) (int, ADLODParameters *); -typedef int (*ADL_OVERDRIVE5_ODPERFORMANCELEVELS_GET) (int, int, ADLODPerformanceLevels *); -typedef int (*ADL_OVERDRIVE5_ODPERFORMANCELEVELS_SET) (int, ADLODPerformanceLevels *); -typedef int (*ADL_OVERDRIVE6_POWERCONTROL_SET) (int, int); -typedef int (*ADL_OVERDRIVE6_POWERCONTROL_GET) (int, int *, int *); -typedef int (*ADL_OVERDRIVE6_POWERCONTROLINFO_GET) (int, ADLOD6PowerControlInfo *); -typedef int (*ADL_ADAPTER_ACTIVE_GET) (int, int *); -typedef int (*ADL_DISPLAYENABLE_SET) (int, int *, int, int); -typedef int (*ADL_OVERDRIVE_CAPS) (int, int *, int *, int *); -typedef int (*ADL_OVERDRIVE6_CURRENTSTATUS_GET) (int, ADLOD6CurrentStatus *); -typedef int (*ADL_OVERDRIVE6_STATEINFO_GET) (int, int, ADLOD6MemClockState *); -typedef int (*ADL_OVERDRIVE6_CAPABILITIES_GET) (int, ADLOD6Capabilities *); -typedef int (*ADL_OVERDRIVE6_STATE_SET) (int, int, ADLOD6StateInfo *); -typedef int (*ADL_OVERDRIVE6_POWERCONTROL_CAPS) (int, int *); -typedef int (*ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET) (int, int *, int *); -typedef int (*ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET) (int, ADLOD6ParameterRange *); +typedef int (ADL_API_CALL *ADL_MAIN_CONTROL_DESTROY) (); +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_FANSPEED_SET) (int, int, ADLFanSpeedValue *); +typedef int (ADL_API_CALL *ADL_OVERDRIVE6_FANSPEED_SET) (int, ADLOD6FanSpeedValue *); +typedef int (ADL_API_CALL *ADL_OVERDRIVE5_FANSPEEDTODEFAULT_SET) (int, int); +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_OVERDRIVE5_ODPERFORMANCELEVELS_SET) (int, ADLODPerformanceLevels *); +typedef int (ADL_API_CALL *ADL_OVERDRIVE6_POWERCONTROL_SET) (int, int); +typedef int (ADL_API_CALL *ADL_OVERDRIVE6_POWERCONTROL_GET) (int, int *, int *); +typedef int (ADL_API_CALL *ADL_OVERDRIVE6_POWERCONTROLINFO_GET) (int, ADLOD6PowerControlInfo *); +typedef int (ADL_API_CALL *ADL_ADAPTER_ACTIVE_GET) (int, int *); +typedef int (ADL_API_CALL *ADL_DISPLAYENABLE_SET) (int, int *, 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_STATE_SET) (int, int, ADLOD6StateInfo *); +typedef int (ADL_API_CALL *ADL_OVERDRIVE6_POWERCONTROL_CAPS) (int, int *); +typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATUREDATA_GET) (int, int *, int *); +typedef int (ADL_API_CALL *ADL_OVERDRIVE6_TARGETTEMPERATURERANGEINFO_GET) (int, ADLOD6ParameterRange *); typedef struct { diff --git a/include/ext_OpenCL.h b/include/ext_OpenCL.h index d550c9f8e..d175fccc0 100644 --- a/include/ext_OpenCL.h +++ b/include/ext_OpenCL.h @@ -29,39 +29,39 @@ #include -typedef cl_mem (*OCL_CLCREATEBUFFER) (cl_context, cl_mem_flags, size_t, void *, cl_int *); -typedef cl_command_queue (*OCL_CLCREATECOMMANDQUEUE) (cl_context, cl_device_id, cl_command_queue_properties, cl_int *); -typedef cl_context (*OCL_CLCREATECONTEXT) (const cl_context_properties *, cl_uint, const cl_device_id *, void (CL_CALLBACK *)(const char *, const void *, size_t, void *), void *, cl_int *); -typedef cl_kernel (*OCL_CLCREATEKERNEL) (cl_program, const char *, cl_int *); -typedef cl_program (*OCL_CLCREATEPROGRAMWITHSOURCE) (cl_context, cl_uint, const char **, const size_t *, cl_int *); -typedef cl_program (*OCL_CLCREATEPROGRAMWITHBINARY) (cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int *); -typedef cl_int (*OCL_CLBUILDPROGRAM) (cl_program, cl_uint, const cl_device_id *, const char *, void (CL_CALLBACK *)(cl_program, void *), void *); -typedef cl_int (*OCL_CLENQUEUENDRANGEKERNEL) (cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *); -typedef cl_int (*OCL_CLENQUEUEREADBUFFER) (cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *); -typedef cl_int (*OCL_CLENQUEUEWRITEBUFFER) (cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *); -typedef cl_int (*OCL_CLENQUEUECOPYBUFFER) (cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *); -typedef cl_int (*OCL_CLFLUSH) (cl_command_queue); -typedef cl_int (*OCL_CLFINISH) (cl_command_queue); -typedef cl_int (*OCL_CLGETDEVICEIDS) (cl_platform_id, cl_device_type, cl_uint, cl_device_id *, cl_uint *); -typedef cl_int (*OCL_CLGETDEVICEINFO) (cl_device_id, cl_device_info, size_t, void *, size_t *); -typedef cl_int (*OCL_CLGETPLATFORMIDS) (cl_uint, cl_platform_id *, cl_uint *); -typedef cl_int (*OCL_CLGETPLATFORMINFO) (cl_platform_id, cl_platform_info, size_t, void *, size_t *); -typedef cl_int (*OCL_CLRELEASECOMMANDQUEUE) (cl_command_queue); -typedef cl_int (*OCL_CLRELEASECONTEXT) (cl_context); -typedef cl_int (*OCL_CLRELEASEKERNEL) (cl_kernel); -typedef cl_int (*OCL_CLRELEASEMEMOBJECT) (cl_mem); -typedef cl_int (*OCL_CLRELEASEPROGRAM) (cl_program); -typedef cl_int (*OCL_CLSETKERNELARG) (cl_kernel, cl_uint, size_t, const void *); -typedef void * (*OCL_CLENQUEUEMAPBUFFER) (cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event *, cl_event *, cl_int *); -typedef cl_int (*OCL_CLENQUEUEUNMAPMEMOBJECT) (cl_command_queue, cl_mem, void *, cl_uint, const cl_event *, cl_event *); -typedef cl_int (*OCL_CLENQUEUEFILLBUFFER) (cl_command_queue, cl_mem, const void *, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *); -typedef cl_int (*OCL_CLGETKERNELWORKGROUPINFO) (cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void *, size_t *); -typedef cl_int (*OCL_CLGETPROGRAMBUILDINFO) (cl_program, cl_device_id, cl_program_build_info, size_t, void *, size_t *); -typedef cl_int (*OCL_CLGETPROGRAMINFO) (cl_program, cl_program_info, size_t, void *, size_t *); -typedef cl_int (*OCL_CLGETEVENTINFO) (cl_event, cl_event_info, size_t, void *, size_t *); -typedef cl_int (*OCL_CLWAITFOREVENTS) (cl_uint, const cl_event *); -typedef cl_int (*OCL_CLGETEVENTPROFILINGINFO) (cl_event, cl_profiling_info, size_t, void *, size_t *); -typedef cl_int (*CLRELEASEEVENT) (cl_event); +typedef cl_mem (CL_API_CALL *OCL_CLCREATEBUFFER) (cl_context, cl_mem_flags, size_t, void *, cl_int *); +typedef cl_command_queue (CL_API_CALL *OCL_CLCREATECOMMANDQUEUE) (cl_context, cl_device_id, cl_command_queue_properties, cl_int *); +typedef cl_context (CL_API_CALL *OCL_CLCREATECONTEXT) (const cl_context_properties *, cl_uint, const cl_device_id *, void (CL_CALLBACK *)(const char *, const void *, size_t, void *), void *, cl_int *); +typedef cl_kernel (CL_API_CALL *OCL_CLCREATEKERNEL) (cl_program, const char *, cl_int *); +typedef cl_program (CL_API_CALL *OCL_CLCREATEPROGRAMWITHSOURCE) (cl_context, cl_uint, const char **, const size_t *, cl_int *); +typedef cl_program (CL_API_CALL *OCL_CLCREATEPROGRAMWITHBINARY) (cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int *); +typedef cl_int (CL_API_CALL *OCL_CLBUILDPROGRAM) (cl_program, cl_uint, const cl_device_id *, const char *, void (CL_CALLBACK *)(cl_program, void *), void *); +typedef cl_int (CL_API_CALL *OCL_CLENQUEUENDRANGEKERNEL) (cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *); +typedef cl_int (CL_API_CALL *OCL_CLENQUEUEREADBUFFER) (cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *); +typedef cl_int (CL_API_CALL *OCL_CLENQUEUEWRITEBUFFER) (cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *); +typedef cl_int (CL_API_CALL *OCL_CLENQUEUECOPYBUFFER) (cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *); +typedef cl_int (CL_API_CALL *OCL_CLFLUSH) (cl_command_queue); +typedef cl_int (CL_API_CALL *OCL_CLFINISH) (cl_command_queue); +typedef cl_int (CL_API_CALL *OCL_CLGETDEVICEIDS) (cl_platform_id, cl_device_type, cl_uint, cl_device_id *, cl_uint *); +typedef cl_int (CL_API_CALL *OCL_CLGETDEVICEINFO) (cl_device_id, cl_device_info, size_t, void *, size_t *); +typedef cl_int (CL_API_CALL *OCL_CLGETPLATFORMIDS) (cl_uint, cl_platform_id *, cl_uint *); +typedef cl_int (CL_API_CALL *OCL_CLGETPLATFORMINFO) (cl_platform_id, cl_platform_info, size_t, void *, size_t *); +typedef cl_int (CL_API_CALL *OCL_CLRELEASECOMMANDQUEUE) (cl_command_queue); +typedef cl_int (CL_API_CALL *OCL_CLRELEASECONTEXT) (cl_context); +typedef cl_int (CL_API_CALL *OCL_CLRELEASEKERNEL) (cl_kernel); +typedef cl_int (CL_API_CALL *OCL_CLRELEASEMEMOBJECT) (cl_mem); +typedef cl_int (CL_API_CALL *OCL_CLRELEASEPROGRAM) (cl_program); +typedef cl_int (CL_API_CALL *OCL_CLSETKERNELARG) (cl_kernel, cl_uint, size_t, const void *); +typedef void * (CL_API_CALL *OCL_CLENQUEUEMAPBUFFER) (cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event *, cl_event *, cl_int *); +typedef cl_int (CL_API_CALL *OCL_CLENQUEUEUNMAPMEMOBJECT) (cl_command_queue, cl_mem, void *, cl_uint, const cl_event *, cl_event *); +typedef cl_int (CL_API_CALL *OCL_CLENQUEUEFILLBUFFER) (cl_command_queue, cl_mem, const void *, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *); +typedef cl_int (CL_API_CALL *OCL_CLGETKERNELWORKGROUPINFO) (cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void *, size_t *); +typedef cl_int (CL_API_CALL *OCL_CLGETPROGRAMBUILDINFO) (cl_program, cl_device_id, cl_program_build_info, size_t, void *, size_t *); +typedef cl_int (CL_API_CALL *OCL_CLGETPROGRAMINFO) (cl_program, cl_program_info, size_t, void *, size_t *); +typedef cl_int (CL_API_CALL *OCL_CLGETEVENTINFO) (cl_event, cl_event_info, size_t, void *, size_t *); +typedef cl_int (CL_API_CALL *OCL_CLWAITFOREVENTS) (cl_uint, const cl_event *); +typedef cl_int (CL_API_CALL *OCL_CLGETEVENTPROFILINGINFO) (cl_event, cl_profiling_info, size_t, void *, size_t *); +typedef cl_int (CL_API_CALL *OCL_CLRELEASEEVENT) (cl_event); typedef struct { @@ -99,7 +99,7 @@ typedef struct OCL_CLSETKERNELARG clSetKernelArg; OCL_CLWAITFOREVENTS clWaitForEvents; OCL_CLGETEVENTPROFILINGINFO clGetEventProfilingInfo; - CLRELEASEEVENT clReleaseEvent; + OCL_CLRELEASEEVENT clReleaseEvent; } hc_opencl_lib_t; diff --git a/include/ext_nvapi.h b/include/ext_nvapi.h index 0d9439efc..ccf7dad45 100644 --- a/include/ext_nvapi.h +++ b/include/ext_nvapi.h @@ -203,13 +203,19 @@ typedef NvPhysicalGpuHandle HM_ADAPTER_NVAPI; #include -typedef int *(*NVAPI_QUERYINTERFACE) (uint); -typedef int (*NVAPI_INITIALIZE) (void); -typedef int (*NVAPI_UNLOAD) (void); -typedef int (*NVAPI_GETERRORMESSAGE) (NvAPI_Status, NvAPI_ShortString); -typedef int (*NVAPI_ENUMPHYSICALGPUS) (NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *); -typedef int (*NVAPI_GPU_GETPERFPOLICIESINFO) (NvPhysicalGpuHandle, NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 *); -typedef int (*NVAPI_GPU_GETPERFPOLICIESSTATUS) (NvPhysicalGpuHandle, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *); +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +#define NVAPI_API_CALL __stdcall +#else +#define NVAPI_API_CALL +#endif + +typedef int *(*NVAPI_API_CALL NVAPI_QUERYINTERFACE) (uint); +typedef int (*NVAPI_API_CALL NVAPI_INITIALIZE) (void); +typedef int (*NVAPI_API_CALL NVAPI_UNLOAD) (void); +typedef int (*NVAPI_API_CALL NVAPI_GETERRORMESSAGE) (NvAPI_Status, NvAPI_ShortString); +typedef int (*NVAPI_API_CALL NVAPI_ENUMPHYSICALGPUS) (NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *); +typedef int (*NVAPI_API_CALL NVAPI_GPU_GETPERFPOLICIESINFO) (NvPhysicalGpuHandle, NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 *); +typedef int (*NVAPI_API_CALL NVAPI_GPU_GETPERFPOLICIESSTATUS) (NvPhysicalGpuHandle, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *); typedef struct { diff --git a/include/ext_nvml.h b/include/ext_nvml.h index b33e2abc7..07425b3ef 100644 --- a/include/ext_nvml.h +++ b/include/ext_nvml.h @@ -168,26 +168,32 @@ typedef nvmlDevice_t HM_ADAPTER_NVML; #include -typedef const char * (*NVML_ERROR_STRING) (nvmlReturn_t); -typedef int (*NVML_INIT) (void); -typedef int (*NVML_SHUTDOWN) (void); -typedef nvmlReturn_t (*NVML_DEVICE_GET_NAME) (nvmlDevice_t, char *, unsigned int); -typedef nvmlReturn_t (*NVML_DEVICE_GET_HANDLE_BY_INDEX) (unsigned int, nvmlDevice_t *); -typedef nvmlReturn_t (*NVML_DEVICE_GET_TEMPERATURE) (nvmlDevice_t, nvmlTemperatureSensors_t, unsigned int *); -typedef nvmlReturn_t (*NVML_DEVICE_GET_FAN_SPEED) (nvmlDevice_t, unsigned int *); -typedef nvmlReturn_t (*NVML_DEVICE_GET_POWER_USAGE) (nvmlDevice_t, unsigned int *); -typedef nvmlReturn_t (*NVML_DEVICE_GET_UTILIZATION_RATES) (nvmlDevice_t, nvmlUtilization_t *); -typedef nvmlReturn_t (*NVML_DEVICE_GET_CLOCKINFO) (nvmlDevice_t, nvmlClockType_t, unsigned int *); -typedef nvmlReturn_t (*NVML_DEVICE_GET_THRESHOLD) (nvmlDevice_t, nvmlTemperatureThresholds_t, unsigned int *); -typedef nvmlReturn_t (*NVML_DEVICE_GET_CURRPCIELINKGENERATION) (nvmlDevice_t, unsigned int *); -typedef nvmlReturn_t (*NVML_DEVICE_GET_CURRPCIELINKWIDTH) (nvmlDevice_t, unsigned int *); -typedef nvmlReturn_t (*NVML_DEVICE_GET_CURRENTCLOCKSTHROTTLEREASONS) (nvmlDevice_t, unsigned long long *); -typedef nvmlReturn_t (*NVML_DEVICE_GET_SUPPORTEDCLOCKSTHROTTLEREASONS) (nvmlDevice_t, unsigned long long *); -typedef nvmlReturn_t (*NVML_DEVICE_SET_COMPUTEMODE) (nvmlDevice_t, nvmlComputeMode_t); -typedef nvmlReturn_t (*NVML_DEVICE_SET_OPERATIONMODE) (nvmlDevice_t, nvmlGpuOperationMode_t); -typedef nvmlReturn_t (*NVML_DEVICE_GET_POWERMANAGEMENTLIMITCONSTRAINTS) (nvmlDevice_t, unsigned int *, unsigned int *); -typedef nvmlReturn_t (*NVML_DEVICE_SET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsigned int); -typedef nvmlReturn_t (*NVML_DEVICE_GET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsigned int *); +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +#define NVML_API_CALL __stdcall +#else +#define NVML_API_CALL +#endif + +typedef const char * (*NVML_API_CALL NVML_ERROR_STRING) (nvmlReturn_t); +typedef int (*NVML_API_CALL NVML_INIT) (void); +typedef int (*NVML_API_CALL NVML_SHUTDOWN) (void); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_NAME) (nvmlDevice_t, char *, unsigned int); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_HANDLE_BY_INDEX) (unsigned int, nvmlDevice_t *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_TEMPERATURE) (nvmlDevice_t, nvmlTemperatureSensors_t, unsigned int *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_FAN_SPEED) (nvmlDevice_t, unsigned int *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_POWER_USAGE) (nvmlDevice_t, unsigned int *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_UTILIZATION_RATES) (nvmlDevice_t, nvmlUtilization_t *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_CLOCKINFO) (nvmlDevice_t, nvmlClockType_t, unsigned int *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_THRESHOLD) (nvmlDevice_t, nvmlTemperatureThresholds_t, unsigned int *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_CURRPCIELINKGENERATION) (nvmlDevice_t, unsigned int *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_CURRPCIELINKWIDTH) (nvmlDevice_t, unsigned int *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_CURRENTCLOCKSTHROTTLEREASONS) (nvmlDevice_t, unsigned long long *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_SUPPORTEDCLOCKSTHROTTLEREASONS) (nvmlDevice_t, unsigned long long *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_SET_COMPUTEMODE) (nvmlDevice_t, nvmlComputeMode_t); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_SET_OPERATIONMODE) (nvmlDevice_t, nvmlGpuOperationMode_t); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_POWERMANAGEMENTLIMITCONSTRAINTS) (nvmlDevice_t, unsigned int *, unsigned int *); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_SET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsigned int); +typedef nvmlReturn_t (*NVML_API_CALL NVML_DEVICE_GET_POWERMANAGEMENTLIMIT) (nvmlDevice_t, unsigned int *); typedef struct { diff --git a/src/Makefile b/src/Makefile index 0a0ae6acf..8da8b1f66 100644 --- a/src/Makefile +++ b/src/Makefile @@ -234,25 +234,25 @@ hashcat: src/hashcat.c $(NATIVE_OBJS) ## obj/%.LINUX.32.o: src/%.c - $(CC_LINUX_32) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_32) -c -o $@ $< + $(CC_LINUX_32) -D_LINUX32 $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_32) -c -o $@ $< obj/%.LINUX.64.o: src/%.c - $(CC_LINUX_64) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_64) -c -o $@ $< + $(CC_LINUX_64) -D_LINUX64 $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_64) -c -o $@ $< obj/%.WIN.32.o: src/%.c - $(CC_WIN_32) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_32) -c -o $@ $< + $(CC_WIN_32) -D_WIN32 $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_32) -c -o $@ $< obj/%.WIN.64.o: src/%.c - $(CC_WIN_64) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_64) -c -o $@ $< + $(CC_WIN_64) -D_WIN64 $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_64) -c -o $@ $< hashcat32.bin: src/hashcat.c $(LINUX_32_OBJS) - $(CC_LINUX_32) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_32) -o $@ $^ $(LFLAGS_CROSS_LINUX) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" + $(CC_LINUX_32) -D_LINUX32 $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_32) -o $@ $^ $(LFLAGS_CROSS_LINUX) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" hashcat64.bin: src/hashcat.c $(LINUX_64_OBJS) - $(CC_LINUX_64) $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_64) -o $@ $^ $(LFLAGS_CROSS_LINUX) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" + $(CC_LINUX_64) -D_LINUX64 $(CFLAGS_CROSS_LINUX) $(CFLAGS_CROSS_64) -o $@ $^ $(LFLAGS_CROSS_LINUX) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -DINSTALL_FOLDER=\"$(INSTALL_FOLDER)\" -DSHARED_FOLDER=\"$(SHARED_FOLDER)\" -DDOCUMENT_FOLDER=\"$(DOCUMENT_FOLDER)\" hashcat32.exe: src/hashcat.c $(WIN_32_OBJS) - $(CC_WIN_32) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_32) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -static-libgcc + $(CC_WIN_32) -D_WIN32 $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_32) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -static-libgcc hashcat64.exe: src/hashcat.c $(WIN_64_OBJS) - $(CC_WIN_64) $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_64) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -static-libgcc + $(CC_WIN_64) -D_WIN64 $(CFLAGS_CROSS_WIN) $(CFLAGS_CROSS_64) -o $@ $^ $(LFLAGS_CROSS_WIN) -DCOMPTIME=$(COMPTIME) -DVERSION_TAG=\"$(VERSION_TAG)\" -static-libgcc diff --git a/src/ext_OpenCL.c b/src/ext_OpenCL.c index d6fa48650..becf484af 100644 --- a/src/ext_OpenCL.c +++ b/src/ext_OpenCL.c @@ -129,7 +129,7 @@ int ocl_init (OCL_PTR *ocl) HC_LOAD_FUNC(ocl, clSetKernelArg, OCL_CLSETKERNELARG, OpenCL, 1) HC_LOAD_FUNC(ocl, clWaitForEvents, OCL_CLWAITFOREVENTS, OpenCL, 1) HC_LOAD_FUNC(ocl, clGetEventProfilingInfo, OCL_CLGETEVENTPROFILINGINFO, OpenCL, 1) - HC_LOAD_FUNC(ocl, clReleaseEvent, CLRELEASEEVENT, OpenCL, 1) + HC_LOAD_FUNC(ocl, clReleaseEvent, OCL_CLRELEASEEVENT, OpenCL, 1) return 0; } diff --git a/src/hashcat.c b/src/hashcat.c index 3ab4f991f..14e217021 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -164,6 +164,12 @@ double TARGET_MS_PROFILE[4] = { 2, 12, 96, 480 }; attr = NULL; \ } +#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +#define HC_API_CALL __stdcall +#else +#define HC_API_CALL +#endif + static uint default_benchmark_algorithms[NUM_DEFAULT_BENCHMARK_ALGORITHMS] = { 900, @@ -5372,7 +5378,7 @@ static uint hlfmt_detect (FILE *fp, uint max_check) // wrapper around mymalloc for ADL #if defined(HAVE_HWMON) -void *__stdcall ADL_Main_Memory_Alloc (const int iSize) +void *HC_API_CALL ADL_Main_Memory_Alloc (const int iSize) { return mymalloc (iSize); } @@ -17557,35 +17563,12 @@ int main (int argc, char **argv) } } - data.devices_status = STATUS_RUNNING; - - if (initial_restore_done == 0) - { - if (data.restore_disable == 0) cycle_restore (); - - initial_restore_done = 1; - } - - hc_timer_set (&data.timer_running); - - if ((wordlist_mode == WL_MODE_FILE) || (wordlist_mode == WL_MODE_MASK)) - { - if ((quiet == 0) && (status == 0) && (benchmark == 0)) - { - if (quiet == 0) fprintf (stdout, "%s", PROMPT); - if (quiet == 0) fflush (stdout); - } - } - else if (wordlist_mode == WL_MODE_STDIN) - { - if (data.quiet == 0) log_info ("Starting attack in stdin mode..."); - if (data.quiet == 0) log_info (""); - } - /** * create autotune threads */ + data.devices_status = STATUS_AUTOTUNE; + hc_thread_t *c_threads = (hc_thread_t *) mycalloc (data.devices_cnt, sizeof (hc_thread_t)); for (uint device_id = 0; device_id < data.devices_cnt; device_id++) @@ -17632,6 +17615,31 @@ int main (int argc, char **argv) * create cracker threads */ + data.devices_status = STATUS_RUNNING; + + if (initial_restore_done == 0) + { + if (data.restore_disable == 0) cycle_restore (); + + initial_restore_done = 1; + } + + hc_timer_set (&data.timer_running); + + if ((wordlist_mode == WL_MODE_FILE) || (wordlist_mode == WL_MODE_MASK)) + { + if ((quiet == 0) && (status == 0) && (benchmark == 0)) + { + if (quiet == 0) fprintf (stdout, "%s", PROMPT); + if (quiet == 0) fflush (stdout); + } + } + else if (wordlist_mode == WL_MODE_STDIN) + { + if (data.quiet == 0) log_info ("Starting attack in stdin mode..."); + if (data.quiet == 0) log_info (""); + } + time_t runtime_start; time (&runtime_start);