USBUninstall.cpp revision 59190ecd61435d19ba3515b876272aee7bd12298
/** @file
*
* VBox host drivers - USB drivers - Filter & driver uninstallation
*
* Installation code
*
* Copyright (C) 2006-2007 Oracle Corporation
*
* Oracle Corporation confidential
* All rights reserved
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include <windows.h>
#include <setupapi.h>
#include <newdev.h>
#include <stdio.h>
int usblibOsStopService(void);
int usblibOsDeleteService(void);
{
int len;
printf("USB uninstallation\n");
/* Remove the inf plus all associated files. */
{
return 1;
}
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;
}