UsbDkHelper: Make service manager class use generic handle holder
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
This commit is contained in:
parent
e44cbe7a96
commit
56590de5de
4 changed files with 4 additions and 24 deletions
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include "Exception.h"
|
||||
#include "WdfCoinstaller.h"
|
||||
#include "ServiceManager.h"
|
||||
#include "UsbDkHelper.h"
|
||||
#include "RegAccess.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@
|
|||
**********************************************************************/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ServiceManager.h"
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------------
|
||||
#define SERVICE_MANAGER_EXCEPTION_STRING TEXT("ServiceManager throw the exception. ")
|
||||
|
||||
|
|
@ -38,27 +37,6 @@ public:
|
|||
};
|
||||
//-----------------------------------------------------------------------------------
|
||||
|
||||
class SCMHandleHolder
|
||||
{
|
||||
public:
|
||||
SCMHandleHolder(SC_HANDLE Handle)
|
||||
: m_Handle(Handle)
|
||||
{}
|
||||
|
||||
~SCMHandleHolder()
|
||||
{
|
||||
if (m_Handle != nullptr)
|
||||
{
|
||||
CloseServiceHandle(m_Handle);
|
||||
}
|
||||
}
|
||||
|
||||
operator bool() const { return m_Handle != nullptr; }
|
||||
operator SC_HANDLE() const { return m_Handle; }
|
||||
private:
|
||||
SC_HANDLE m_Handle;
|
||||
};
|
||||
|
||||
class ServiceManager
|
||||
{
|
||||
public:
|
||||
|
|
@ -68,6 +46,8 @@ public:
|
|||
void DeleteServiceObject(const tstring &ServiceName);
|
||||
|
||||
private:
|
||||
typedef UsbDkHandleHolder<SC_HANDLE> SCMHandleHolder;
|
||||
|
||||
static void WaitForServiceStop(const SCMHandleHolder &schService);
|
||||
|
||||
SCMHandleHolder m_schSCManager;
|
||||
|
|
|
|||
|
|
@ -43,5 +43,7 @@
|
|||
|
||||
#include "tstrings.h"
|
||||
#include "Exception.h"
|
||||
#include "Utils.h"
|
||||
#include "ServiceManager.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue