forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscoped_sc_handle_win.h
42 lines (30 loc) · 994 Bytes
/
scoped_sc_handle_win.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef REMOTING_BASE_SCOPED_SC_HANDLE_WIN_H_
#define REMOTING_BASE_SCOPED_SC_HANDLE_WIN_H_
#include <windows.h>
#include "base/win/scoped_handle.h"
namespace remoting {
class ScHandleTraits {
public:
typedef SC_HANDLE Handle;
// Closes the handle.
static bool CloseHandle(SC_HANDLE handle) {
return ::CloseServiceHandle(handle) != FALSE;
}
// Returns true if the handle value is valid.
static bool IsHandleValid(SC_HANDLE handle) {
return handle != NULL;
}
// Returns NULL handle value.
static SC_HANDLE NullHandle() {
return NULL;
}
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ScHandleTraits);
};
typedef base::win::GenericScopedHandle<
ScHandleTraits, base::win::DummyVerifierTraits> ScopedScHandle;
} // namespace remoting
#endif // REMOTING_BASE_SCOPED_SC_HANDLE_WIN_H_