Alexandre Julliard : ntdll: Make the open_hkcu_key() helper available globally.
Alexandre Julliard
julliard at winehq.org
Thu Mar 4 15:53:36 CST 2021
Module: wine
Branch: master
Commit: 16b099441264e155edc58885868cd0ebb1e193b7
URL: https://source.winehq.org/git/wine.git/?a=commit;h=16b099441264e155edc58885868cd0ebb1e193b7
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Mar 3 10:00:29 2021 +0100
ntdll: Make the open_hkcu_key() helper available globally.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/file.c | 29 -----------------------------
dlls/ntdll/unix/registry.c | 29 +++++++++++++++++++++++++++++
dlls/ntdll/unix/unix_private.h | 3 +--
3 files changed, 30 insertions(+), 31 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 315354be7aa..bcaf03a2d02 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -2727,35 +2727,6 @@ static int get_redirect_path( char *unix_name, int pos, const WCHAR *name, int l
#define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
-static NTSTATUS open_hkcu_key( const char *path, HANDLE *key )
-{
- NTSTATUS status;
- char buffer[256];
- WCHAR bufferW[256];
- DWORD_PTR sid_data[(sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE) / sizeof(DWORD_PTR)];
- DWORD i, len = sizeof(sid_data);
- SID *sid;
- UNICODE_STRING name;
- OBJECT_ATTRIBUTES attr;
-
- status = NtQueryInformationToken( GetCurrentThreadEffectiveToken(), TokenUser, sid_data, len, &len );
- if (status) return status;
-
- sid = ((TOKEN_USER *)sid_data)->User.Sid;
- len = sprintf( buffer, "\\Registry\\User\\S-%u-%u", sid->Revision,
- MAKELONG( MAKEWORD( sid->IdentifierAuthority.Value[5], sid->IdentifierAuthority.Value[4] ),
- MAKEWORD( sid->IdentifierAuthority.Value[3], sid->IdentifierAuthority.Value[2] )));
- for (i = 0; i < sid->SubAuthorityCount; i++)
- len += sprintf( buffer + len, "-%u", sid->SubAuthority[i] );
- len += sprintf( buffer + len, "\\%s", path );
-
- ascii_to_unicode( bufferW, buffer, len + 1 );
- init_unicode_string( &name, bufferW );
- InitializeObjectAttributes( &attr, &name, OBJ_CASE_INSENSITIVE, 0, NULL );
- return NtCreateKey( key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL );
-}
-
-
/***********************************************************************
* init_files
*/
diff --git a/dlls/ntdll/unix/registry.c b/dlls/ntdll/unix/registry.c
index b52811b05e7..9a572d7f44e 100644
--- a/dlls/ntdll/unix/registry.c
+++ b/dlls/ntdll/unix/registry.c
@@ -40,6 +40,35 @@ WINE_DEFAULT_DEBUG_CHANNEL(reg);
#define MAX_VALUE_LENGTH (16383 * sizeof(WCHAR))
+NTSTATUS open_hkcu_key( const char *path, HANDLE *key )
+{
+ NTSTATUS status;
+ char buffer[256];
+ WCHAR bufferW[256];
+ DWORD_PTR sid_data[(sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE) / sizeof(DWORD_PTR)];
+ DWORD i, len = sizeof(sid_data);
+ SID *sid;
+ UNICODE_STRING name;
+ OBJECT_ATTRIBUTES attr;
+
+ status = NtQueryInformationToken( GetCurrentThreadEffectiveToken(), TokenUser, sid_data, len, &len );
+ if (status) return status;
+
+ sid = ((TOKEN_USER *)sid_data)->User.Sid;
+ len = sprintf( buffer, "\\Registry\\User\\S-%u-%u", sid->Revision,
+ MAKELONG( MAKEWORD( sid->IdentifierAuthority.Value[5], sid->IdentifierAuthority.Value[4] ),
+ MAKEWORD( sid->IdentifierAuthority.Value[3], sid->IdentifierAuthority.Value[2] )));
+ for (i = 0; i < sid->SubAuthorityCount; i++)
+ len += sprintf( buffer + len, "-%u", sid->SubAuthority[i] );
+ len += sprintf( buffer + len, "\\%s", path );
+
+ ascii_to_unicode( bufferW, buffer, len + 1 );
+ init_unicode_string( &name, bufferW );
+ InitializeObjectAttributes( &attr, &name, OBJ_CASE_INSENSITIVE, 0, NULL );
+ return NtCreateKey( key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL );
+}
+
+
/******************************************************************************
* NtCreateKey (NTDLL.@)
*/
diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h
index c8156fbcb6b..b8b6619c0a9 100644
--- a/dlls/ntdll/unix/unix_private.h
+++ b/dlls/ntdll/unix/unix_private.h
@@ -105,8 +105,6 @@ extern void CDECL virtual_release_address_space(void) DECLSPEC_HIDDEN;
extern NTSTATUS CDECL unwind_builtin_dll( ULONG type, struct _DISPATCHER_CONTEXT *dispatch,
CONTEXT *context ) DECLSPEC_HIDDEN;
-extern void CDECL set_show_dot_files( BOOL enable ) DECLSPEC_HIDDEN;
-
extern const char *home_dir DECLSPEC_HIDDEN;
extern const char *data_dir DECLSPEC_HIDDEN;
extern const char *build_dir DECLSPEC_HIDDEN;
@@ -215,6 +213,7 @@ extern void DECLSPEC_NORETURN exec_process( NTSTATUS status ) DECLSPEC_HIDDEN;
extern void __wine_syscall_dispatcher(void) DECLSPEC_HIDDEN;
extern void signal_restore_full_cpu_context(void) DECLSPEC_HIDDEN;
extern void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) DECLSPEC_HIDDEN;
+extern NTSTATUS open_hkcu_key( const char *path, HANDLE *key ) DECLSPEC_HIDDEN;
extern NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user,
IO_STATUS_BLOCK *io, ULONG code, void *in_buffer,
More information about the wine-cvs
mailing list