1
mirror of https://github.com/hashcat/hashcat synced 2024-12-23 14:13:43 +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)
#include <pthread.h>
#if defined (__linux__)
#include <sys/sysctl.h>
#endif // __linux__
#endif // _POSIX
#if defined (__APPLE__)

View File

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

View File

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

View File

@ -25,6 +25,10 @@
#include <CL/cl.h>
#endif
#if defined (__CYGWIN__)
#include <CL/cl.h>
#endif
// NVIDIA extras
#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;
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#if defined(_WIN32) || defined(__WIN32__)
#define NVAPI_API_CALL __stdcall
#else
#define NVAPI_API_CALL

View File

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

View File

@ -40,7 +40,7 @@ typedef int (*XCLOSEDISPLAY) (void *);
typedef int HM_ADAPTER_XNVCTRL;
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
#if defined(_WIN32) || defined(__WIN32__)
#define XNVCTRL_API_CALL __stdcall
#else
#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__)
# define _SORT_R_BSD
# define _SORT_R_INLINE inline
#elif (defined __linux__)
#elif (defined __linux__) || defined (__CYGWIN__)
# define _SORT_R_LINUX
# define _SORT_R_INLINE inline
#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;
#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;
if (user_options->cpu_affinity == NULL) return 0;
@ -121,4 +124,5 @@ int set_cpu_affinity (hashcat_ctx_t *hashcat_ctx)
#endif
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 *d2 = (dictstat_t *) s2;
#if defined (__linux__)
#if defined (__linux__) || defined (__CYGWIN__)
d2->stat.st_atim = d1->stat.st_atim;
#else
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)
{
#if defined (__linux__)
#if defined (__linux__) || defined (__CYGWIN__)
char tmp[32] = { 0 };
@ -302,7 +302,7 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins
return -1;
}
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined (__CYGWIN__)
static const char SLASH[] = "/";

View File

@ -369,6 +369,8 @@ int ocl_init (hashcat_ctx_t *hashcat_ctx)
ocl->lib = hc_dlopen ("OpenCL");
#elif defined(__APPLE__)
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
ocl->lib = hc_dlopen ("libOpenCL.so", RTLD_NOW);

View File

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