gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r25802 - gnunet/src/vpn


From: gnunet
Subject: [GNUnet-SVN] r25802 - gnunet/src/vpn
Date: Tue, 15 Jan 2013 21:22:55 +0100

Author: cfuchs
Date: 2013-01-15 21:22:54 +0100 (Tue, 15 Jan 2013)
New Revision: 25802

Modified:
   gnunet/src/vpn/Makefile.am
   gnunet/src/vpn/gnunet-helper-vpn-windows.c
Log:
added calls for updating the driver in a for device. seems like this is 
mandatory when adding a new device node. unfortunately this is pretty 
slow...

added new required include+library to link against: newdev.h/dll



Modified: gnunet/src/vpn/Makefile.am
===================================================================
--- gnunet/src/vpn/Makefile.am  2013-01-15 19:15:11 UTC (rev 25801)
+++ gnunet/src/vpn/Makefile.am  2013-01-15 20:22:54 UTC (rev 25802)
@@ -43,7 +43,7 @@
     -no-undefined -Wl,--export-all-symbols 
    
   gnunet_helper_vpn_LDADD = \
-    -lsetupapi -lshell32 -liconv -lstdc++ \
+    -lsetupapi -lnewdev -lshell32 -liconv -lstdc++ \
     -lcomdlg32 -lgdi32 -liphlpapi
 
   gnunet_helper_vpn_SOURCES = \

Modified: gnunet/src/vpn/gnunet-helper-vpn-windows.c
===================================================================
--- gnunet/src/vpn/gnunet-helper-vpn-windows.c  2013-01-15 19:15:11 UTC (rev 
25801)
+++ gnunet/src/vpn/gnunet-helper-vpn-windows.c  2013-01-15 20:22:54 UTC (rev 
25802)
@@ -35,11 +35,11 @@
 #include <windows.h>
 #include <setupapi.h>
 #include <ddk/cfgmgr32.h>
+#include <ddk/newdev.h>
 #include <Winsock2.h>
 #include "platform.h"
 #include "tap-windows.h"
 
-
 /**
  * Need 'struct GNUNET_MessageHeader'.
  */
@@ -165,7 +165,9 @@
 #define IOSTATE_QUEUED           1 /* overlapped I/O has been queued */
 #define IOSTATE_WAITING          3 /* overlapped I/O has finished, but is 
waiting for it's write-partner */
 
-// ReOpenFile is only available as of XP SP2 and 2003 SP1
+/**
+ * ReOpenFile is only available as of XP SP2 and 2003 SP1
+ */ 
 WINBASEAPI HANDLE WINAPI ReOpenFile (HANDLE, DWORD, DWORD, DWORD);
 
 /**
@@ -401,7 +403,7 @@
                                  class_name,
                                  &class_guid,
                                  NULL,
-                                 NULL,
+                                 0,
                                  DICD_GENERATE_ID,
                                  &DeviceNode))
     return FALSE;
@@ -411,15 +413,22 @@
                                           &DeviceNode,
                                           SPDRP_HARDWAREID,
                                           (LPBYTE) hwidlist,
-                                          (strlen (hwidlist) + 2) * sizeof 
(char)))
+                                          (lstrlenA (hwidlist) + 2) * sizeof 
(char)))
     return FALSE;
   
   /* Install our new class(=device) into the system */
   if (!SetupDiCallClassInstaller (DIF_REGISTERDEVICE,
                                   DeviceInfo,
                                   &DeviceNode))
-    return FALSE;
- 
+      return FALSE;
+  
+  if(!UpdateDriverForPlugAndPlayDevicesA(NULL,
+                             HARDWARE_ID, // I can haz secondary HWID too?
+                             inf_file_path,
+                             INSTALLFLAG_FORCE | INSTALLFLAG_NONINTERACTIVE,
+                             NULL)) //reboot required? NEVER!
+      return FALSE;
+  
   return TRUE;
 }
 
@@ -651,7 +660,7 @@
       errno = ENODEV;
       return INVALID_HANDLE_VALUE;
     }
-
+  
   /* Open Windows TAP-Windows adapter */
   snprintf (device_path, sizeof (device_path), "%s%s%s",
             USERMODEDEVICEDIR,
@@ -673,14 +682,14 @@
       fprintf (stderr, "CreateFile failed on TAP device: %s\n", device_path);
       return handle;
     }
-
+  
   /* get driver version info */
   if (!check_tapw32_version (handle))
     {
       CloseHandle (handle);
       return INVALID_HANDLE_VALUE;
     }
-
+  
   /* TODO (opt?): get MTU-Size */
 
   return handle;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]