OSDN Git Service

Rename cygWFMO to cygwait throughout and use the magic of polymorphism to "wait
[pf3gnuchains/pf3gnuchains4x.git] / winsup / cygwin / registry.h
1 /* registry.h: shared info for cygwin
2
3    Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
4    2010, 2011 Red Hat, Inc.
5
6 This file is part of Cygwin.
7
8 This software is a copyrighted work licensed under the terms of the
9 Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
10 details. */
11
12 class reg_key
13 {
14 private:
15
16   HANDLE key;
17   NTSTATUS key_is_invalid;
18   DWORD _disposition;
19
20 public:
21
22   reg_key (HKEY toplev, REGSAM access, ...);
23   reg_key (bool isHKLM, REGSAM access, ...);
24
25   void *operator new (size_t, void *p) {return p;}
26   void build_reg (HKEY key, REGSAM access, va_list av);
27
28   bool error () {return key == NULL;}
29
30   DWORD get_dword (PCWSTR, DWORD);
31   NTSTATUS get_string (PCWSTR, PWCHAR, size_t, PCWSTR);
32
33   NTSTATUS set_dword (PCWSTR, DWORD);
34   NTSTATUS set_string (PCWSTR, PCWSTR);
35
36   bool created () const {return _disposition & REG_CREATED_NEW_KEY;}
37
38   ~reg_key ();
39 };
40
41 /* Evaluates path to the directory of the local user registry hive */
42 PWCHAR __stdcall get_registry_hive_path (PCWSTR name, PWCHAR path);
43 void __stdcall load_registry_hive (PCWSTR name);