"Fossies" - the Fresh Open Source Software archive

Member "gpg4win-2.1.0/patches/scute-1.3.0/01-wsastartup.patch" of archive gpg4win-2.1.0.tar.gz:


#! /bin/sh
patch -p0 -f $* < $0
exit $?


Index: src/p11-finalize.c
===================================================================
--- src/p11-finalize.c	(revision 98)
+++ src/p11-finalize.c	(working copy)
@@ -30,6 +30,10 @@
 #if HAVE_CONFIG_H
 #include <config.h>
 #endif
+#ifdef HAVE_W32_SYSTEM
+#define __USE_W32_SOCKETS 1
+#include <windows.h>
+#endif
 
 #include "cryptoki.h"
 
@@ -50,5 +54,9 @@
   scute_agent_finalize ();
   scute_locking_finalize ();
 
+#ifdef HAVE_W32_SYSTEM
+  WSACleanup ();
+#endif
+
   return CKR_OK;
 }
Index: src/p11-initialize.c
===================================================================
--- src/p11-initialize.c	(revision 98)
+++ src/p11-initialize.c	(working copy)
@@ -33,6 +33,11 @@
 
 #include <stdbool.h>
 
+#ifdef HAVE_W32_SYSTEM
+#define __USE_W32_SOCKETS 1
+#include <windows.h>
+#endif
+
 #include <assuan.h>
 #include <gpg-error.h>
 
@@ -49,6 +54,11 @@
 CK_DEFINE_FUNCTION(CK_RV, C_Initialize) (CK_VOID_PTR pInitArgs)
 {
   CK_RV err;
+  WSADATA wsadat;
+	
+#ifdef HAVE_W32_SYSTEM
+  WSAStartup (0x202, &wsadat);
+#endif
 
   /* This is one of the few functions which do not need to take the
      global lock.  */