From 2fbd71149581e3169b6ca5faa13a106c7b752ddb Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Wed, 31 Oct 2018 11:14:21 +0100 Subject: [PATCH] Move WSAStartup() call back to user_options --- src/brain.c | 15 --------------- src/user_options.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/brain.c b/src/brain.c index 984fc3c40..13b2c97be 100644 --- a/src/brain.c +++ b/src/brain.c @@ -892,21 +892,6 @@ bool brain_client_connect (hc_device_param_t *device_param, const status_ctx_t * memset (&device_param->brain_link_recv_speed, 0, sizeof (link_speed_t)); memset (&device_param->brain_link_send_speed, 0, sizeof (link_speed_t)); - #if defined (_WIN) - WSADATA wsaData; - - WORD wVersionRequested = MAKEWORD (2,2); - - const int iResult = WSAStartup (wVersionRequested, &wsaData); - - if (iResult != NO_ERROR) - { - fprintf (stderr, "WSAStartup: %s\n", strerror (errno)); - - return -1; - } - #endif - const int brain_link_client_fd = socket (AF_INET, SOCK_STREAM, 0); if (brain_link_client_fd == -1) diff --git a/src/user_options.c b/src/user_options.c index a6118904e..dddc65ee9 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -1871,6 +1871,25 @@ int user_options_check_files (hashcat_ctx_t *hashcat_ctx) // brain #ifdef WITH_BRAIN + + #if defined (_WIN) + if (user_options->brain_client == true) + { + WSADATA wsaData; + + WORD wVersionRequested = MAKEWORD (2,2); + + const int iResult = WSAStartup (wVersionRequested, &wsaData); + + if (iResult != NO_ERROR) + { + fprintf (stderr, "WSAStartup: %s\n", strerror (errno)); + + return -1; + } + } + #endif + if (user_options->brain_host) { struct addrinfo hints;