VirtualBox

source: vbox/trunk/src/VBox/HostDrivers/VBoxNetFlt/win/tools/VBoxNetAdpUninstall.cpp@ 44528

Last change on this file since 44528 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1/* $Id: VBoxNetAdpUninstall.cpp 44528 2013-02-04 14:27:54Z vboxsync $ */
2/** @file
3 * NetAdpUninstall - VBoxNetAdp uninstaller command line tool
4 */
5
6/*
7 * Copyright (C) 2011 Oracle Corporation
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
18#include <VBox/VBoxNetCfg-win.h>
19#include <VBox/VBoxDrvCfg-win.h>
20#include <stdio.h>
21
22#include <devguid.h>
23
24
25static VOID winNetCfgLogger (LPCSTR szString)
26{
27 printf("%s", szString);
28}
29
30static int VBoxNetAdpUninstall()
31{
32 int r = 1;
33 VBoxNetCfgWinSetLogging(winNetCfgLogger);
34
35 printf("uninstalling all Host-Only interfaces..\n");
36
37 HRESULT hr = CoInitialize(NULL);
38 if(hr == S_OK)
39 {
40 hr = VBoxNetCfgWinRemoveAllNetDevicesOfId(L"sun_VBoxNetAdp");
41 if(hr == S_OK)
42 {
43 hr = VBoxDrvCfgInfUninstallAllSetupDi(&GUID_DEVCLASS_NET, L"Net", L"sun_VBoxNetAdp", 0/* could be SUOI_FORCEDELETE */);
44 if(hr == S_OK)
45 {
46 printf("uninstalled successfully\n");
47 }
48 else
49 {
50 printf("uninstalled successfully, but failed to remove infs\n");
51 }
52 r = 0;
53 }
54 else
55 {
56 printf("uninstall failed, hr = 0x%x\n", hr);
57 }
58
59 CoUninitialize();
60 }
61 else
62 {
63 wprintf(L"Error initializing COM (0x%x)\n", hr);
64 }
65
66 VBoxNetCfgWinSetLogging(NULL);
67
68 return r;
69}
70
71int __cdecl main(int argc, char **argv)
72{
73 return VBoxNetAdpUninstall();
74}
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