VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/VBoxNetFlt/win/NetAdpUninstall.cpp@ 25439

Last change on this file since 25439 was 22491, checked in by vboxsync, 15 years ago

netadp/win: actual inf deletion with NetAdpUninstall, (not yet added to win installer)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1/* $Id: NetAdpUninstall.cpp 22491 2009-08-26 21:44:20Z vboxsync $ */
2/** @file
3 * NetAdpUninstall - VBoxNetAdp uninstaller command line tool
4 */
5
6/*
7 * Copyright (C) 2009 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22#include <vbox/WinNetConfig.h>
23#include <stdio.h>
24
25#include <devguid.h>
26
27
28static VOID winNetCfgLogger (LPCWSTR szString)
29{
30 wprintf(L"%s", szString);
31}
32
33static int UninstallNetAdp()
34{
35 int r = 1;
36 VBoxNetCfgWinSetLogging(winNetCfgLogger);
37
38 printf("uninstalling all Host-Only interfaces..\n");
39
40 HRESULT hr = CoInitialize(NULL);
41 if(hr == S_OK)
42 {
43 hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(L"sun_VBoxNetAdp");
44 if(hr == S_OK)
45 {
46 hr = VBoxNetCfgWinUninstallInfs (&GUID_DEVCLASS_NET, L"sun_VBoxNetAdp", 0/* could be SUOI_FORCEDELETE */);
47 if(hr == S_OK)
48 {
49 printf("uninstalled successfully\n");
50 }
51 else
52 {
53 printf("uninstalled successfully, but failed to remove infs\n");
54 }
55 r = 0;
56 }
57 else
58 {
59 printf("uninstall failed, hr = 0x%x\n", hr);
60 }
61
62 CoUninitialize();
63 }
64 else
65 {
66 wprintf(L"Error initializing COM (0x%x)\n", hr);
67 }
68
69 VBoxNetCfgWinSetLogging(NULL);
70
71 return r;
72}
73
74int __cdecl main(int argc, char **argv)
75{
76 return UninstallNetAdp();
77}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette