aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcfuchs <cfuchs@140774ce-b5e7-0310-ab8b-a85725594a96>2012-12-05 10:14:28 +0000
committercfuchs <cfuchs@140774ce-b5e7-0310-ab8b-a85725594a96>2012-12-05 10:14:28 +0000
commit5006f5ddfc7759d5957b78a579982be1bb71815c (patch)
treedf8d99e43b336544587b922ada70df45d1693298
parent40e608bdbcaf9f382eb1bc0866374da45c3cc74d (diff)
added teardown functionality for deconstructing the interface created by
the win32 vpn-helper. git-svn-id: https://gnunet.org/svn/gnunet@25249 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r--src/vpn/gnunet-helper-vpn-windows.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/vpn/gnunet-helper-vpn-windows.c b/src/vpn/gnunet-helper-vpn-windows.c
index b805811f6c..93bf290c86 100644
--- a/src/vpn/gnunet-helper-vpn-windows.c
+++ b/src/vpn/gnunet-helper-vpn-windows.c
@@ -210,7 +210,7 @@ setup_interface ()
*
* TODO: Finde a more sane way to do this!
*/
-
+
InfFilePath = calloc (MAX_PATH, sizeof (TCHAR));
if (InfFilePath == NULL)
{
@@ -263,7 +263,7 @@ setup_interface ()
{
goto cleanup3;
}
-
+
/* Deploy all the information collected into the registry */
if (!SetupDiSetDeviceRegistryProperty (DeviceInfo,
&DeviceNode,
@@ -274,15 +274,13 @@ setup_interface ()
goto cleanup3;
}
/* Install our new class(=device) into the system */
- if (!SetupDiCallClassInstaller (DIF_REGISTERDEVICE,
- DeviceInfo,
- &DeviceNode))
+ if (SetupDiCallClassInstaller (DIF_REGISTERDEVICE,
+ DeviceInfo,
+ &DeviceNode))
{
- goto cleanup3;
+ return TRUE;
}
- return TRUE;
-
//disabled for debug-reasons...
cleanup3:
//GNUNET_free(DeviceInfo);
@@ -297,6 +295,34 @@ cleanup1:
}
+static boolean
+remove_interface ()
+{
+ SP_REMOVEDEVICE_PARAMS remove;
+
+ remove.ClassInstallHeader.cbSize = sizeof (SP_CLASSINSTALL_HEADER);
+ remove.HwProfile = 0;
+ remove.Scope = DI_REMOVEDEVICE_GLOBAL;
+ remove.ClassInstallHeader.InstallFunction = DIF_REMOVE;
+
+
+ if (SetupDiSetClassInstallParams (DeviceInfo,
+ (PSP_DEVINFO_DATA) &DeviceNode,
+ &remove.ClassInstallHeader,
+ sizeof (remove)))
+ {
+ if (SetupDiCallClassInstaller (DIF_REMOVE,
+ DeviceInfo,
+ (PSP_DEVINFO_DATA) &DeviceNode))
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+
+}
+
/**
* Start forwarding to and from the tunnel.
*