Some cleanups
[hashcat.git] / include / shared.h
index 72cefde..c10c7d2 100644 (file)
   ptr->name = (type) hc_dlsym (ptr->lib, #name); \
   if (!ptr->name) { \
     if (noerr == 1) { \
-      log_error ("ERROR: #name is missing from #libname shared library."); \
+      log_error ("ERROR: %s is missing from %s shared library.", #name, #libname); \
       exit (-1); \
     } else { \
-      log_info ("WARNING: #name is missing from #libname shared library."); \
+      log_info ("WARNING: %s is missing from %s shared library.", #name, #libname); \
+      return (-1); \
+    } \
+  }
+
+#define HC_LOAD_ADDR(ptr,name,type,func,addr,libname,noerr) \
+  ptr->name = (type) (*ptr->func) (addr); \
+  if (!ptr->name) { \
+    if (noerr == 1) { \
+      log_error ("ERROR: %s at address %08x is missing from %s shared library.", #name, addr, #libname); \
+      exit (-1); \
+    } else { \
+      log_error ("WARNING: %s at address %08x is missing from %s shared library.", #name, addr, #libname); \
       return (-1); \
     } \
   }
  * temperature management
  */
 
-#ifdef _POSIX
+#if _WIN
 #include <ext_ADL.h>
-#endif
-
-#ifdef LINUX
-#include <ext_nvml.h>
-#elif WIN
 #include <ext_nvapi.h>
-#endif
-
-#ifdef OSX
-#include <ext_smi.h>
-#include <ext_dummy.h>
+#else
+#include <ext_ADL.h>
+#include <ext_nvml.h>
 #endif
 
 /**
@@ -177,22 +182,22 @@ extern hc_thread_mutex_t mux_display;
  * password lengths supported
  */
 
-#define PW_LENGTH_MIN_0       0
-#define PW_LENGTH_MAX_0       55
-#define PW_LENGTH_MIN_400     0
-#define PW_LENGTH_MAX_400     40
-#define PW_LENGTH_MIN_500     0
-#define PW_LENGTH_MAX_500     15
-#define PW_LENGTH_MIN_1600    0
-#define PW_LENGTH_MAX_1600    15
-#define PW_LENGTH_MIN_1800    0
-#define PW_LENGTH_MAX_1800    15
-#define PW_LENGTH_MIN_2500    0
-#define PW_LENGTH_MAX_2500    64
-#define PW_LENGTH_MIN_6300    0
-#define PW_LENGTH_MAX_6300    15
-#define PW_LENGTH_MIN_7400    0
-#define PW_LENGTH_MAX_7400    15
+#define PW_LENGTH_MIN_0      0
+#define PW_LENGTH_MAX_0      55
+#define PW_LENGTH_MIN_400    0
+#define PW_LENGTH_MAX_400    40
+#define PW_LENGTH_MIN_500    0
+#define PW_LENGTH_MAX_500    15
+#define PW_LENGTH_MIN_1600   0
+#define PW_LENGTH_MAX_1600   15
+#define PW_LENGTH_MIN_1800   0
+#define PW_LENGTH_MAX_1800   15
+#define PW_LENGTH_MIN_2500   0
+#define PW_LENGTH_MAX_2500   64
+#define PW_LENGTH_MIN_6300   0
+#define PW_LENGTH_MAX_6300   15
+#define PW_LENGTH_MIN_7400   0
+#define PW_LENGTH_MAX_7400   15
 
 /**
  * device accel macro
@@ -206,6 +211,7 @@ extern hc_thread_mutex_t mux_display;
 #define KERNEL_ACCEL_6211    2
 #define KERNEL_ACCEL_6231    1
 #define KERNEL_ACCEL_6241    4
+#define KERNEL_ACCEL_6800    2
 #define KERNEL_ACCEL_7100    1
 #define KERNEL_ACCEL_7200    1
 #define KERNEL_ACCEL_7900    1
@@ -235,6 +241,7 @@ extern hc_thread_mutex_t mux_display;
 #define KERNEL_ACCEL_6211    16
 #define KERNEL_ACCEL_6231    4
 #define KERNEL_ACCEL_6241    32
+#define KERNEL_ACCEL_6800    8
 #define KERNEL_ACCEL_7100    2
 #define KERNEL_ACCEL_7200    2
 #define KERNEL_ACCEL_7900    2
@@ -361,7 +368,6 @@ extern hc_thread_mutex_t mux_display;
 #define KERNEL_ACCEL_6500    8
 #define KERNEL_ACCEL_6600    8
 #define KERNEL_ACCEL_6700    8
-#define KERNEL_ACCEL_6800    8
 #define KERNEL_ACCEL_6900    16
 #define KERNEL_ACCEL_7300    64
 #define KERNEL_ACCEL_7400    2
@@ -1874,10 +1880,6 @@ void fsync (int fd);
 int hm_get_adapter_index_nv (HM_ADAPTER_NV nvGPUHandle[DEVICES_MAX]);
 #endif
 
-// int hm_get_device_num (HM_LIB hm_dll_amd, HM_ADAPTER_AMD hm_adapter_index, int *hm_device_num);
-
-// void hm_get_opencl_busid_devid (hm_attrs_t *hm_device, uint opencl_num_devices, cl_device_id *devices);
-
 #ifdef HAVE_ADL
 int get_adapters_num_amd (void *adl, int *iNumberAdapters);
 
@@ -1889,13 +1891,10 @@ u32 *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adapters,
 
 int hm_get_overdrive_version  (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
 int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
-#endif // HAVE_ADL
-
-#if defined(HAVE_ADL) || defined(HAVE_NVML)
-void hm_close (HM_LIB hm_dll);
 
-HM_LIB hm_init (const cl_uint vendor_id);
-#endif
+// int hm_get_device_num (void *adl, HM_ADAPTER_AMD hm_adapter_index, int *hm_device_num);
+// void hm_get_opencl_busid_devid (hm_attrs_t *hm_device, uint opencl_num_devices, cl_device_id *devices);
+#endif // HAVE_ADL
 
 int hm_get_temperature_with_device_id (const uint device_id);
 int hm_get_fanspeed_with_device_id    (const uint device_id);