From 92a111be74a861db8ef4bba48424b04d1762ed4c Mon Sep 17 00:00:00 2001 From: jsteube Date: Sat, 18 Jun 2016 21:56:19 +0200 Subject: [PATCH] Fixed some macros --- src/hashcat.c | 26 +++++++++++++------------- src/shared.c | 12 ++++++------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/hashcat.c b/src/hashcat.c index 23b91c5ee..3c816fed1 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -4235,11 +4235,11 @@ static void *thread_monitor (void *p) } else if (device_param->device_vendor_id == VENDOR_ID_NV) { - #ifdef _WIN + #ifdef WIN hm_set_fanspeed_with_device_id_nvapi (device_id, fan_speed_new, 1); #endif - #ifdef _LINUX + #ifdef LINUX hm_set_fanspeed_with_device_id_xnvctrl (device_id, fan_speed_new); #endif } @@ -14070,11 +14070,11 @@ int main (int argc, char **argv) { need_nvml = 1; - #ifdef _LINUX + #ifdef LINUX need_xnvctrl = 1; #endif - #ifdef _WIN + #ifdef WIN need_nvapi = 1; #endif } @@ -16184,12 +16184,12 @@ int main (int argc, char **argv) } else if (device_param->device_vendor_id == VENDOR_ID_NV) { - #ifdef _WIN - rc = hm_set_fanspeed_with_device_id_nvapi (device_id, fanspeed, 1); + #ifdef LINUX + rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE); #endif - #ifdef _LINUX - rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE); + #ifdef WIN + rc = hm_set_fanspeed_with_device_id_nvapi (device_id, fanspeed, 1); #endif } @@ -16199,7 +16199,7 @@ int main (int argc, char **argv) } else { - //log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id + 1); + log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id + 1); data.hm_device[device_id].fan_set_supported = 0; } @@ -18390,12 +18390,12 @@ int main (int argc, char **argv) } else if (device_param->device_vendor_id == VENDOR_ID_NV) { - #ifdef _WIN - rc = hm_set_fanspeed_with_device_id_nvapi (device_id, fanspeed, fanpolicy); + #ifdef LINUX + rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE); #endif - #ifdef _LINUX - rc = set_fan_control (data.hm_xnvctrl, data.hm_device[device_id].xnvctrl, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE); + #ifdef WIN + rc = hm_set_fanspeed_with_device_id_nvapi (device_id, fanspeed, fanpolicy); #endif } diff --git a/src/shared.c b/src/shared.c index 5f7f5fbdb..b70c7a9b9 100644 --- a/src/shared.c +++ b/src/shared.c @@ -2657,7 +2657,7 @@ void unlock_file (FILE *fp) } #endif // F_SETLKW -#ifdef _WIN +#ifdef WIN void fsync (int fd) { HANDLE h = (HANDLE) _get_osfhandle (fd); @@ -4474,7 +4474,7 @@ int pthread_setaffinity_np (pthread_t thread, size_t cpu_size, cpu_set_t *cpu_se void set_cpu_affinity (char *cpu_affinity) { - #ifdef WIN + #ifdef _WIN DWORD_PTR aff_mask = 0; #elif _POSIX cpu_set_t cpuset; @@ -4493,7 +4493,7 @@ void set_cpu_affinity (char *cpu_affinity) if (cpu_id == 0) { - #ifdef WIN + #ifdef _WIN aff_mask = 0; #elif _POSIX CPU_ZERO (&cpuset); @@ -4509,7 +4509,7 @@ void set_cpu_affinity (char *cpu_affinity) exit (-1); } - #ifdef WIN + #ifdef _WIN aff_mask |= 1 << (cpu_id - 1); #elif _POSIX CPU_SET ((cpu_id - 1), &cpuset); @@ -4520,7 +4520,7 @@ void set_cpu_affinity (char *cpu_affinity) free (devices); } - #ifdef WIN + #ifdef _WIN SetProcessAffinityMask (GetCurrentProcess (), aff_mask); SetThreadAffinityMask (GetCurrentThread (), aff_mask); #elif _POSIX @@ -4743,7 +4743,7 @@ int sort_by_dictstat (const void *s1, const void *s2) dictstat_t *d1 = (dictstat_t *) s1; dictstat_t *d2 = (dictstat_t *) s2; - #ifdef LINUX + #ifdef _POSIX d2->stat.st_atim = d1->stat.st_atim; #else d2->stat.st_atime = d1->stat.st_atime;