From 2b7e36b0426713031691f5a6f10711055a2c0505 Mon Sep 17 00:00:00 2001 From: jsteube Date: Sun, 17 Jul 2016 20:32:47 +0200 Subject: [PATCH] Output cracked hashes on Windows using \r\n and not \n Replace RegGetValue() with RegQueryValueEx() to enable Windows XP 32 bit compatibility This fixes https://github.com/hashcat/hashcat/issues/418 --- docs/changes.txt | 2 ++ src/ext_nvml.c | 30 ++++++++++++++++++++++++++++-- src/shared.c | 2 +- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index d0c8e43..ed760af 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -16,6 +16,8 @@ - Get rid of exit() calls in OpenCL wrapper library with the goal to have a better control which error can be ignored under special circumstances - Do not error and exit if an OpenCL platform has no devices, just print a warning and continue with the next platform - Workaround OpenCL runtimes that do not accept -I parameter in the OpenCL kernel build options even if this is an OpenCL standard option +- Output cracked hashes on Windows using \r\n and not \n +- Replace RegGetValue() with RegQueryValueEx() to enable Windows XP 32 bit compatibility ## ## Bugs diff --git a/src/ext_nvml.c b/src/ext_nvml.c index 8431354..6c3b6b4 100644 --- a/src/ext_nvml.c +++ b/src/ext_nvml.c @@ -20,9 +20,35 @@ int nvml_init (NVML_PTR *nvml) { DWORD BufferSize = 1024; - char *Buffer = (char *) mymalloc (BufferSize); + DWORD Type = REG_SZ; - RegGetValue (HKEY_LOCAL_MACHINE, "SOFTWARE\\NVIDIA Corporation\\Global\\NVSMI", "NVSMIPATH", RRF_RT_ANY, NULL, (PVOID) Buffer, &BufferSize); + char *Buffer = (char *) mymalloc (BufferSize + 1); + + HKEY hKey = 0; + + if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\NVIDIA Corporation\\Global\\NVSMI"), 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) + { + if (RegQueryValueEx (hKey, TEXT("NVSMIPATH"), NULL, &Type, (PVOID) Buffer, &BufferSize) == ERROR_SUCCESS) + { + Buffer[BufferSize] = 0; + } + else + { + if (data.quiet == 0) + log_info ("WARNING: NVML library load failed, proceed without NVML HWMon enabled."); + + return -1; + } + + RegCloseKey (hKey); + } + else + { + if (data.quiet == 0) + log_info ("WARNING: NVML library load failed, proceed without NVML HWMon enabled."); + + return -1; + } strcat (Buffer, "\\nvml.dll"); diff --git a/src/shared.c b/src/shared.c index 85accce..0bb70b7 100644 --- a/src/shared.c +++ b/src/shared.c @@ -5227,7 +5227,7 @@ void format_output (FILE *out_fp, char *out_buf, unsigned char *plain_ptr, const #endif } - fputc ('\n', out_fp); + fputs (EOL, out_fp); } void handle_show_request (pot_t *pot, uint pot_cnt, char *input_buf, int input_len, hash_t *hashes_buf, int (*sort_by_pot) (const void *, const void *), FILE *out_fp) -- 2.25.1