summaryrefslogtreecommitdiffstats
path: root/remoting/base/scoped_reg_key_win.h
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/base/scoped_reg_key_win.h')
-rw-r--r--remoting/base/scoped_reg_key_win.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/remoting/base/scoped_reg_key_win.h b/remoting/base/scoped_reg_key_win.h
new file mode 100644
index 0000000..c68b99f
--- /dev/null
+++ b/remoting/base/scoped_reg_key_win.h
@@ -0,0 +1,42 @@
+// Copyright 2013 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_REG_KEY_WIN_H_
+#define REMOTING_BASE_SCOPED_REG_KEY_WIN_H_
+
+#include <windows.h>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/win/scoped_handle.h"
+
+namespace remoting {
+
+// The traits class for Win32 registry handles.
+class RegKeyTraits {
+ public:
+ typedef HKEY Handle;
+
+ static bool CloseHandle(HKEY handle) {
+ return RegCloseKey(handle) == ERROR_SUCCESS;
+ }
+
+ static bool IsHandleValid(HKEY handle) {
+ return handle != NULL;
+ }
+
+ static HKEY NullHandle() {
+ return NULL;
+ }
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(RegKeyTraits);
+};
+
+typedef base::win::GenericScopedHandle<
+ RegKeyTraits, base::win::DummyVerifierTraits> ScopedRegKey;
+
+} // namespace remoting
+
+#endif // REMOTING_BASE_SCOPED_REG_KEY_WIN_H_