Add mangle to mode 60 attack 3
[hashcat.git] / include / ext_nvapi.h
index f38cba2..0258dad 100644 (file)
 
 #include <common.h>
 
-/*
+/**
  * Declarations from nvapi.h and subheaders
- **/
-
-#ifndef __success
-    #define __nvapi_success
-    #define __success(epxr)
-#endif
-
-//#define NVAPI_INTERFACE extern __success(return == NVAPI_OK) NvAPI_Status __cdecl
-#define NVAPI_INTERFACE extern __success(return == NVAPI_OK) NvAPI_Status
-
-/*
- * Definitions from nvapi_lite_common.h
  */
 
-// mac os 32-bit still needs this
-#if (defined(macintosh) || defined(__APPLE__)) && !defined(__LP64__)
-typedef signed long        NvS32; /* -2147483648 to 2147483647  */
-#else
-typedef signed int         NvS32; /* -2147483648 to 2147483647 */
-#endif
+#define NVAPI_INTERFACE extern NvAPI_Status
 
-// mac os 32-bit still needs this
-#if ( (defined(macintosh) && defined(__LP64__) && (__NVAPI_RESERVED0__)) || \
-      (!defined(macintosh) && defined(__NVAPI_RESERVED0__)) )
-typedef unsigned int       NvU32; /* 0 to 4294967295                         */
-#else
-typedef unsigned long      NvU32; /* 0 to 4294967295                         */
-#endif
+typedef unsigned long NvU32;
+typedef   signed long NvS32;
 
 #define NV_DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
 
@@ -56,10 +34,11 @@ typedef char NvAPI_LongString[NVAPI_LONG_STRING_MAX];
 typedef char NvAPI_ShortString[NVAPI_SHORT_STRING_MAX];
 
 #define MAKE_NVAPI_VERSION(typeName,ver) (NvU32)(sizeof(typeName) | ((ver)<<16))
-#define GET_NVAPI_VERSION(ver) (NvU32)((ver)>>16)
-#define GET_NVAPI_SIZE(ver) (NvU32)((ver) & 0xffff)
 
-#define NVAPI_MAX_PHYSICAL_GPUS             64
+#define NVAPI_MAX_PHYSICAL_GPUS     64
+#define NVAPI_MAX_COOLER_PER_GPU    20
+
+#define GPU_COOLER_LEVELS_VER    0x10000
 
 typedef enum _NvAPI_Status
 {
@@ -212,6 +191,20 @@ typedef struct
 
 } NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1;
 
+typedef struct
+{
+  NvS32 Level;
+  NvS32 Policy;
+
+} NvLevel;
+
+typedef struct
+{
+  NvU32    Version;
+  NvLevel  Levels[NVAPI_MAX_COOLER_PER_GPU];
+
+} NV_GPU_COOLER_LEVELS;
+
 NVAPI_INTERFACE NvAPI_QueryInterface (uint offset);
 NVAPI_INTERFACE NvAPI_Initialize ();
 NVAPI_INTERFACE NvAPI_Unload ();
@@ -219,72 +212,32 @@ NVAPI_INTERFACE NvAPI_GetErrorMessage (NvAPI_Status nr,NvAPI_ShortString szDesc)
 NVAPI_INTERFACE NvAPI_EnumPhysicalGPUs (NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
 NVAPI_INTERFACE NvAPI_GPU_GetPerfPoliciesInfo (NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 *perfPolicies_info);
 NVAPI_INTERFACE NvAPI_GPU_GetPerfPoliciesStatus (NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *perfPolicies_status);
-
-#ifdef __nvapi_success
-    #undef __success
-    #undef __nvapi_success
-#endif
+NVAPI_INTERFACE NvAPI_GPU_SetCoolerLevels (NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_LEVELS *pCoolerLevels);
+NVAPI_INTERFACE NvAPI_GPU_RestoreCoolerSettings (NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex);
 
 /*
  * End of declarations from nvapi.h and subheaders
  **/
 
-// Just annotations (they do nothing special)
-
-#ifndef __success
-#define __success(x)
-#endif
-#ifndef __in
-#define __in
-#endif
-#ifndef __out
-#define __out
-#endif
-#ifndef __in_ecount
-#define __in_ecount(x)
-#endif
-#ifndef __out_ecount
-#define __out_ecount(x)
-#endif
-#ifndef __in_opt
-#define __in_opt
-#endif
-#ifndef __out_opt
-#define __out_opt
-#endif
-#ifndef __inout
-#define __inout
-#endif
-#ifndef __inout_opt
-#define __inout_opt
-#endif
-#ifndef __inout_ecount
-#define __inout_ecount(x)
-#endif
-#ifndef __inout_ecount_full
-#define __inout_ecount_full(x)
-#endif
-#ifndef __inout_ecount_part_opt
-#define __inout_ecount_part_opt(x,y)
-#endif
-#ifndef __inout_ecount_full_opt
-#define __inout_ecount_full_opt(x,y)
-#endif
-#ifndef __out_ecount_full_opt
-#define __out_ecount_full_opt(x)
-#endif
-
 typedef NvPhysicalGpuHandle HM_ADAPTER_NVAPI;
 
 #include <shared.h>
 
-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 int (*NVAPI_API_CALL NVAPI_GPU_SETCOOLERLEVELS) (NvPhysicalGpuHandle, NvU32, NV_GPU_COOLER_LEVELS *);
+typedef int (*NVAPI_API_CALL NVAPI_GPU_RESTORECOOLERSETTINGS) (NvPhysicalGpuHandle, NvU32);
 
 typedef struct
 {
@@ -297,6 +250,8 @@ typedef struct
   NVAPI_ENUMPHYSICALGPUS NvAPI_EnumPhysicalGPUs;
   NVAPI_GPU_GETPERFPOLICIESINFO NvAPI_GPU_GetPerfPoliciesInfo;
   NVAPI_GPU_GETPERFPOLICIESSTATUS NvAPI_GPU_GetPerfPoliciesStatus;
+  NVAPI_GPU_SETCOOLERLEVELS NvAPI_GPU_SetCoolerLevels;
+  NVAPI_GPU_RESTORECOOLERSETTINGS NvAPI_GPU_RestoreCoolerSettings;
 
 } hm_nvapi_lib_t;
 
@@ -312,6 +267,8 @@ int hm_NvAPI_GetErrorMessage (NVAPI_PTR *nvapi, NvAPI_Status nr, NvAPI_ShortStri
 int hm_NvAPI_EnumPhysicalGPUs (NVAPI_PTR *nvapi, NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
 int hm_NvAPI_GPU_GetPerfPoliciesInfo (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 *perfPolicies_info);
 int hm_NvAPI_GPU_GetPerfPoliciesStatus (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 *perfPolicies_status);
+int hm_NvAPI_GPU_SetCoolerLevels (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_LEVELS *pCoolerLevels);
+int hm_NvAPI_GPU_RestoreCoolerSettings (NVAPI_PTR *nvapi, NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex);
 
 #endif // HAVE_HWMON