41f77e25f1
(LoadUserProfileW): Import. * registry.cc (get_registry_hive_path): Move to sec_auth.cc. (load_registry_hive): Remove. * registry.h (get_registry_hive_path): Drop declaration. (load_registry_hive): Ditto. * sec_auth.cc (get_user_profile_directory): Moved from registry.cc and renamed. Take third parameter with buffer length. (load_user_profile): New function taking over for load_registry_hive. Use official functions to load profile. If profile is missing, create it on Vista and later. * security.h (get_user_profile_directory): Declare. (load_user_profile): Declare. * syscalls.cc (seteuid32): Replace call to load_registry_hive with call to load_user_profile. * uinfo.cc (cygheap_user::env_userprofile): Replace call to get_registry_hive_path with call to get_user_profile_directory.
40 lines
922 B
C++
40 lines
922 B
C++
/* registry.h: shared info for cygwin
|
|
|
|
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
|
2011, 2012, 2014 Red Hat, Inc.
|
|
|
|
This file is part of Cygwin.
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
details. */
|
|
|
|
class reg_key
|
|
{
|
|
private:
|
|
|
|
HANDLE key;
|
|
NTSTATUS key_is_invalid;
|
|
DWORD _disposition;
|
|
|
|
public:
|
|
|
|
reg_key (HKEY toplev, REGSAM access, ...);
|
|
reg_key (bool isHKLM, REGSAM access, ...);
|
|
|
|
void *operator new (size_t, void *p) {return p;}
|
|
void build_reg (HKEY key, REGSAM access, va_list av);
|
|
|
|
bool error () {return key == NULL;}
|
|
|
|
DWORD get_dword (PCWSTR, DWORD);
|
|
NTSTATUS get_string (PCWSTR, PWCHAR, size_t, PCWSTR);
|
|
|
|
NTSTATUS set_dword (PCWSTR, DWORD);
|
|
NTSTATUS set_string (PCWSTR, PCWSTR);
|
|
|
|
bool created () const {return _disposition & REG_CREATED_NEW_KEY;}
|
|
|
|
~reg_key ();
|
|
};
|