1
mirror of https://github.com/hashcat/hashcat synced 2024-12-27 05:13:45 +01:00

Fix compilation for native Cygwin

This commit is contained in:
Rosen Penev 2016-11-29 13:39:22 -08:00
parent 72d0b272c2
commit 96783ed7a3
13 changed files with 24 additions and 12 deletions

View File

@ -11,7 +11,9 @@
#if defined (_POSIX) #if defined (_POSIX)
#include <pthread.h> #include <pthread.h>
#if defined (__linux__)
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif // __linux__
#endif // _POSIX #endif // _POSIX
#if defined (__APPLE__) #if defined (__APPLE__)

View File

@ -8,7 +8,7 @@
#define PROGNAME "hashcat" #define PROGNAME "hashcat"
#if defined (__linux__) #if defined (__linux__) || defined (__CYGWIN__)
#define _POSIX #define _POSIX
#elif defined (__APPLE__) #elif defined (__APPLE__)
#define _POSIX #define _POSIX
@ -38,7 +38,7 @@
#if defined (__MSC_VER) #if defined (__MSC_VER)
#define HC_API_CALL __cdecl #define HC_API_CALL __cdecl
#elif defined (_WIN32) || defined (__WIN32__) || defined (__CYGWIN__) #elif defined (_WIN32) || defined (__WIN32__)
#define HC_API_CALL __stdcall #define HC_API_CALL __stdcall
#else #else
#define HC_API_CALL #define HC_API_CALL

View File

@ -252,7 +252,7 @@ typedef struct ADLOD6PowerControlInfo
#if defined (__MSC_VER) #if defined (__MSC_VER)
#define ADL_API_CALL __cdecl #define ADL_API_CALL __cdecl
#elif defined (_WIN32) || defined (__WIN32__) || defined (__CYGWIN__) #elif defined (_WIN32) || defined (__WIN32__)
#define ADL_API_CALL __stdcall #define ADL_API_CALL __stdcall
#else #else
#define ADL_API_CALL #define ADL_API_CALL

View File

@ -25,6 +25,10 @@
#include <CL/cl.h> #include <CL/cl.h>
#endif #endif
#if defined (__CYGWIN__)
#include <CL/cl.h>
#endif
// NVIDIA extras // NVIDIA extras
#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000

View File

@ -215,7 +215,7 @@ NVAPI_INTERFACE NvAPI_GPU_RestoreCoolerSettings (NvPhysicalGpuHandle hPhysicalGp
typedef NvPhysicalGpuHandle HM_ADAPTER_NVAPI; typedef NvPhysicalGpuHandle HM_ADAPTER_NVAPI;
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__WIN32__)
#define NVAPI_API_CALL __stdcall #define NVAPI_API_CALL __stdcall
#else #else
#define NVAPI_API_CALL #define NVAPI_API_CALL

View File

@ -159,7 +159,7 @@ typedef enum nvmlGom_enum
typedef nvmlDevice_t HM_ADAPTER_NVML; typedef nvmlDevice_t HM_ADAPTER_NVML;
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__WIN32__)
#define NVML_API_CALL __stdcall #define NVML_API_CALL __stdcall
#else #else
#define NVML_API_CALL #define NVML_API_CALL

View File

@ -40,7 +40,7 @@ typedef int (*XCLOSEDISPLAY) (void *);
typedef int HM_ADAPTER_XNVCTRL; typedef int HM_ADAPTER_XNVCTRL;
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__WIN32__)
#define XNVCTRL_API_CALL __stdcall #define XNVCTRL_API_CALL __stdcall
#else #else
#define XNVCTRL_API_CALL #define XNVCTRL_API_CALL

View File

@ -28,7 +28,7 @@ Slightly modified to work with hashcat to no falsly detect _SORT_R_LINUX with mi
defined __FreeBSD__ || defined __DragonFly__) defined __FreeBSD__ || defined __DragonFly__)
# define _SORT_R_BSD # define _SORT_R_BSD
# define _SORT_R_INLINE inline # define _SORT_R_INLINE inline
#elif (defined __linux__) #elif (defined __linux__) || defined (__CYGWIN__)
# define _SORT_R_LINUX # define _SORT_R_LINUX
# define _SORT_R_INLINE inline # define _SORT_R_INLINE inline
#elif (defined _WIN32 || defined _WIN64 || defined __WINDOWS__) #elif (defined _WIN32 || defined _WIN64 || defined __WINDOWS__)

View File

@ -45,8 +45,11 @@ static int pthread_setaffinity_np (pthread_t thread, size_t cpu_size, cpu_set_t
typedef cpuset_t cpu_set_t; typedef cpuset_t cpu_set_t;
#endif #endif
int set_cpu_affinity (hashcat_ctx_t *hashcat_ctx) int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
{ {
#if defined (__CYGWIN__)
return 0;
#else
const user_options_t *user_options = hashcat_ctx->user_options; const user_options_t *user_options = hashcat_ctx->user_options;
if (user_options->cpu_affinity == NULL) return 0; if (user_options->cpu_affinity == NULL) return 0;
@ -121,4 +124,5 @@ int set_cpu_affinity (hashcat_ctx_t *hashcat_ctx)
#endif #endif
return 0; return 0;
#endif
} }

View File

@ -15,7 +15,7 @@ int sort_by_dictstat (const void *s1, const void *s2)
dictstat_t *d1 = (dictstat_t *) s1; dictstat_t *d1 = (dictstat_t *) s1;
dictstat_t *d2 = (dictstat_t *) s2; dictstat_t *d2 = (dictstat_t *) s2;
#if defined (__linux__) #if defined (__linux__) || defined (__CYGWIN__)
d2->stat.st_atim = d1->stat.st_atim; d2->stat.st_atim = d1->stat.st_atim;
#else #else
d2->stat.st_atime = d1->stat.st_atime; d2->stat.st_atime = d1->stat.st_atime;

View File

@ -24,7 +24,7 @@ int sort_by_stringptr (const void *p1, const void *p2)
static int get_exec_path (char *exec_path, const size_t exec_path_sz) static int get_exec_path (char *exec_path, const size_t exec_path_sz)
{ {
#if defined (__linux__) #if defined (__linux__) || defined (__CYGWIN__)
char tmp[32] = { 0 }; char tmp[32] = { 0 };
@ -302,7 +302,7 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins
return -1; return -1;
} }
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined (__CYGWIN__)
static const char SLASH[] = "/"; static const char SLASH[] = "/";

View File

@ -369,6 +369,8 @@ int ocl_init (hashcat_ctx_t *hashcat_ctx)
ocl->lib = hc_dlopen ("OpenCL"); ocl->lib = hc_dlopen ("OpenCL");
#elif defined(__APPLE__) #elif defined(__APPLE__)
ocl->lib = hc_dlopen ("/System/Library/Frameworks/OpenCL.framework/OpenCL", RTLD_NOW); ocl->lib = hc_dlopen ("/System/Library/Frameworks/OpenCL.framework/OpenCL", RTLD_NOW);
#elif defined (__CYGWIN__)
ocl->lib = hc_dlopen ("cygOpenCL-1.dll", RTLD_NOW);
#else #else
ocl->lib = hc_dlopen ("libOpenCL.so", RTLD_NOW); ocl->lib = hc_dlopen ("libOpenCL.so", RTLD_NOW);

View File

@ -294,7 +294,7 @@ void SetConsoleWindowSize (const int x)
} }
#endif #endif
#if defined (__linux__) #if defined (__linux__) || defined (__CYGWIN__)
static struct termios savemodes; static struct termios savemodes;
static int havemodes = 0; static int havemodes = 0;