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:
parent
72d0b272c2
commit
96783ed7a3
@ -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__)
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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__)
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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[] = "/";
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user