mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
Add NVML and NVAPI support to Cygwin
This commit is contained in:
parent
65d5921eda
commit
ee0911c26e
@ -12,8 +12,8 @@
|
||||
|
||||
#define NVAPI_INTERFACE extern NvAPI_Status
|
||||
|
||||
typedef unsigned long NvU32;
|
||||
typedef signed long NvS32;
|
||||
typedef unsigned int NvU32;
|
||||
typedef signed int NvS32;
|
||||
|
||||
#define NV_DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
|
||||
|
||||
|
@ -4,6 +4,9 @@
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#if defined (__CYGWIN__)
|
||||
#include <sys/cygwin.h>
|
||||
#endif
|
||||
|
||||
#ifndef _HWMON_H
|
||||
#define _HWMON_H
|
||||
|
57
src/hwmon.c
57
src/hwmon.c
@ -549,6 +549,49 @@ static int nvml_init (hashcat_ctx_t *hashcat_ctx)
|
||||
hcfree (Buffer);
|
||||
}
|
||||
|
||||
#elif defined (__CYGWIN__)
|
||||
|
||||
nvml->lib = hc_dlopen("nvml.dll", RTLD_NOW);
|
||||
|
||||
if (!nvml->lib)
|
||||
{
|
||||
FILE *nvml_lib = fopen ("/proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/NVIDIA Corporation/Global/NVSMI/NVSMIPATH", "rb");
|
||||
|
||||
if (nvml_lib == NULL)
|
||||
{
|
||||
//if (user_options->quiet == false)
|
||||
// event_log_error (hashcat_ctx, "NVML library load failed: %m, proceed without NVML HWMon enabled");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
char *nvml_winpath, *nvml_cygpath;
|
||||
|
||||
nvml_winpath = (char *) hcmalloc (100);
|
||||
|
||||
fread (nvml_winpath, 100, 1, nvml_lib);
|
||||
|
||||
ssize_t size = cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_PROC_CYGDRIVE, nvml_winpath, NULL, 0);
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
nvml_cygpath = (char *) hcmalloc (size + 9);
|
||||
|
||||
cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_PROC_CYGDRIVE, nvml_winpath, nvml_cygpath, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
//if (user_options->quiet == false)
|
||||
// event_log_error (hashcat_ctx, "Could not find NVML in the system, proceed without NVML HWMon enabled");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
strcat (nvml_cygpath, "/nvml.dll");
|
||||
|
||||
nvml->lib = hc_dlopen (nvml_cygpath, RTLD_NOW);
|
||||
}
|
||||
|
||||
#elif defined (_POSIX)
|
||||
nvml->lib = hc_dlopen ("libnvidia-ml.so", RTLD_NOW);
|
||||
#endif
|
||||
@ -1052,15 +1095,29 @@ static int nvapi_init (hashcat_ctx_t *hashcat_ctx)
|
||||
memset (nvapi, 0, sizeof (NVAPI_PTR));
|
||||
|
||||
#if defined (_WIN)
|
||||
|
||||
#if defined (_WIN64)
|
||||
nvapi->lib = hc_dlopen ("nvapi64.dll");
|
||||
#else
|
||||
nvapi->lib = hc_dlopen ("nvapi.dll");
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#if defined (__CYGWIN__)
|
||||
|
||||
#if defined (__x86_x64__)
|
||||
nvapi->lib = hc_dlopen ("nvapi64.dll", RTLD_NOW);
|
||||
#else
|
||||
nvapi->lib = hc_dlopen ("nvapi.dll", RTLD_NOW);
|
||||
#endif
|
||||
|
||||
#else
|
||||
nvapi->lib = hc_dlopen ("nvapi.so", RTLD_NOW); // uhm yes, but .. yeah
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (!nvapi->lib)
|
||||
{
|
||||
//if (user_options->quiet == false)
|
||||
|
@ -2884,6 +2884,10 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
|
||||
#if defined (_WIN)
|
||||
need_nvapi = true;
|
||||
#endif
|
||||
|
||||
#if defined (__CYGWIN__)
|
||||
need_nvapi = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user