USBUninstall.cpp revision c58f1213e628a545081c70e26c6b67a841cff880
/** @file
*
* VBox host drivers - USB drivers - Filter & driver uninstallation
*
* Installation code
*
* Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <windows.h>
#include <setupapi.h>
#include <newdev.h>
#include <VBox/VBoxDrvCfg-win.h>
#include <stdio.h>
int usblibOsStopService(void);
int usblibOsDeleteService(void);
static DECLCALLBACK(void) vboxUsbLog(VBOXDRVCFG_LOG_SEVERITY enmSeverity, char * msg, void * pvContext)
{
switch (enmSeverity)
{
break;
break;
default:
break;
}
}
{
AssertFailed();
}
{
printf("USB uninstallation\n");
{
return 1;
}
printf("USB uninstallation succeeded!\n");
return 0;
}
/** The support service name. */
#define SERVICE_NAME "VBoxUSBMon"
/** Win32 Device name. */
#define DEVICE_NAME "\\\\.\\VBoxUSBMon"
/** NT Device name. */
#define DEVICE_NAME_NT L"\\Device\\VBoxUSBMon"
/** Win32 Symlink name. */
#define DEVICE_NAME_DOS L"\\DosDevices\\VBoxUSBMon"
/**
* Stops a possibly running service.
*
* @returns 0 on success.
* @returns -1 on failure.
*/
int usblibOsStopService(void)
{
/*
* Assume it didn't exist, so we'll create the service.
*/
int rc = -1;
if (hSMgr)
{
if (hService)
{
/*
* Stop the service.
*/
rc = 0;
{
int iWait = 100;
{
Sleep(100);
}
rc = 0;
else
}
else
{
AssertMsgFailed(("ControlService failed with LastError=%Rwa. status=%d\n", LastError, Status.dwCurrentState));
}
}
else if (GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
rc = 0;
else
{
}
}
return rc;
}
/**
* Deletes the service.
*
* @returns 0 on success.
* @returns -1 on failure.
*/
int usblibOsDeleteService(void)
{
/*
* Assume it didn't exist, so we'll create the service.
*/
int rc = -1;
if (hSMgr)
{
if (hService)
{
/*
* Delete the service.
*/
if (DeleteService(hService))
rc = 0;
else
{
}
}
else if (GetLastError() == ERROR_SERVICE_DOES_NOT_EXIST)
rc = 0;
else
{
}
}
return rc;
}