return ret;
}
+#ifdef __REACTOS__
+static BOOL winsock_initialized = FALSE;
+BOOL netconn_init_winsock()
+{
+ WSADATA wsaData;
+ int error;
+ if (!winsock_initialized)
+ {
+ error = WSAStartup(MAKEWORD(1, 1), &wsaData);
+ if (error)
+ {
+ ERR("WSAStartup failed: %d\n", error);
+ return FALSE;
+ }
+ else
+ winsock_initialized = TRUE;
+ }
+ return winsock_initialized;
+}
+
+#endif
+
BOOL netconn_init( netconn_t *conn )
{
memset(conn, 0, sizeof(*conn));
#ifndef HAVE_GETADDRINFO
DeleteCriticalSection(&cs_gethostbyname);
#endif
+#ifdef __REACTOS__
+ if(winsock_initialized)
+ WSACleanup();
+#endif
}
BOOL netconn_connected( netconn_t *conn )
heap_free( session->proxy_username );
heap_free( session->proxy_password );
heap_free( session );
-#ifdef __REACTOS__
- WSACleanup();
-#endif
}
static BOOL session_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen )
session_set_option
};
+#ifdef __REACTOS__
+BOOL netconn_init_winsock();
+#endif /* __REACTOS__ */
/***********************************************************************
* WinHttpOpen (winhttp.@)
*/
session_t *session;
HINTERNET handle = NULL;
#ifdef __REACTOS__
- WSADATA wsaData;
- int error = WSAStartup(MAKEWORD(2, 2), &wsaData);
- if (error) ERR("WSAStartup failed: %d\n", error);
+ if (!netconn_init_winsock()) return NULL;
#endif
TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags);