mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:54:05 +00:00
kernelbase: Avoid calling RtlInitUnicodeString on a static constant.
This commit is contained in:
parent
1798bcd540
commit
9cbbcb409c
|
@ -205,12 +205,11 @@ static COORD get_console_font_size( HANDLE handle, DWORD index )
|
|||
static HANDLE create_console_server( void )
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr = {sizeof(attr)};
|
||||
UNICODE_STRING string;
|
||||
UNICODE_STRING string = RTL_CONSTANT_STRING( L"\\Device\\ConDrv\\Server" );
|
||||
IO_STATUS_BLOCK iosb;
|
||||
HANDLE handle;
|
||||
NTSTATUS status;
|
||||
|
||||
RtlInitUnicodeString( &string, L"\\Device\\ConDrv\\Server" );
|
||||
attr.ObjectName = &string;
|
||||
attr.Attributes = OBJ_INHERIT;
|
||||
status = NtCreateFile( &handle, FILE_WRITE_PROPERTIES | FILE_READ_PROPERTIES | SYNCHRONIZE,
|
||||
|
@ -222,12 +221,11 @@ static HANDLE create_console_server( void )
|
|||
static HANDLE create_console_reference( HANDLE root )
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr = {sizeof(attr)};
|
||||
UNICODE_STRING string;
|
||||
UNICODE_STRING string = RTL_CONSTANT_STRING( L"Reference" );
|
||||
IO_STATUS_BLOCK iosb;
|
||||
HANDLE handle;
|
||||
NTSTATUS status;
|
||||
|
||||
RtlInitUnicodeString( &string, L"Reference" );
|
||||
attr.RootDirectory = root;
|
||||
attr.ObjectName = &string;
|
||||
status = NtCreateFile( &handle, FILE_READ_DATA | FILE_WRITE_DATA | FILE_WRITE_PROPERTIES |
|
||||
|
@ -466,7 +464,7 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateConsoleScreenBuffer( DWORD access, DWORD s
|
|||
{
|
||||
OBJECT_ATTRIBUTES attr = {sizeof(attr)};
|
||||
IO_STATUS_BLOCK iosb;
|
||||
UNICODE_STRING name;
|
||||
UNICODE_STRING name = RTL_CONSTANT_STRING( L"\\Device\\ConDrv\\ScreenBuffer" );
|
||||
HANDLE handle;
|
||||
NTSTATUS status;
|
||||
|
||||
|
@ -478,7 +476,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH CreateConsoleScreenBuffer( DWORD access, DWORD s
|
|||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
RtlInitUnicodeString( &name, L"\\Device\\ConDrv\\ScreenBuffer" );
|
||||
attr.ObjectName = &name;
|
||||
attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL;
|
||||
if (sa && sa->bInheritHandle) attr.Attributes |= OBJ_INHERIT;
|
||||
|
|
|
@ -398,7 +398,7 @@ static void format_exception_msg( const EXCEPTION_POINTERS *ptr, char *buffer, i
|
|||
static BOOL start_debugger( EXCEPTION_POINTERS *epointers, HANDLE event )
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
UNICODE_STRING nameW = RTL_CONSTANT_STRING( L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug" );
|
||||
WCHAR *cmdline, *env, *p, *format = NULL;
|
||||
HANDLE dbg_key;
|
||||
DWORD autostart = TRUE;
|
||||
|
@ -416,7 +416,6 @@ static BOOL start_debugger( EXCEPTION_POINTERS *epointers, HANDLE event )
|
|||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug" );
|
||||
|
||||
if (!NtOpenKey( &dbg_key, KEY_READ, &attr ))
|
||||
{
|
||||
|
|
|
@ -148,7 +148,9 @@ static BOOL add_boot_rename_entry( LPCWSTR source, LPCWSTR dest, DWORD flags )
|
|||
static const int info_size = FIELD_OFFSET( KEY_VALUE_PARTIAL_INFORMATION, Data );
|
||||
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW, source_name, dest_name;
|
||||
UNICODE_STRING session_manager = RTL_CONSTANT_STRING( L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager" );
|
||||
UNICODE_STRING pending_file_rename_operations = RTL_CONSTANT_STRING( L"PendingFileRenameOperations" );
|
||||
UNICODE_STRING source_name, dest_name;
|
||||
KEY_VALUE_PARTIAL_INFORMATION *info;
|
||||
BOOL rc = FALSE;
|
||||
HANDLE key = 0;
|
||||
|
@ -172,11 +174,10 @@ static BOOL add_boot_rename_entry( LPCWSTR source, LPCWSTR dest, DWORD flags )
|
|||
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nameW;
|
||||
attr.ObjectName = &session_manager;
|
||||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager" );
|
||||
|
||||
if (NtCreateKey( &key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ) != STATUS_SUCCESS)
|
||||
{
|
||||
|
@ -194,14 +195,12 @@ static BOOL add_boot_rename_entry( LPCWSTR source, LPCWSTR dest, DWORD flags )
|
|||
}
|
||||
else len2 = sizeof(WCHAR); /* minimum is the 0 characters for the empty second string */
|
||||
|
||||
RtlInitUnicodeString( &nameW, L"PendingFileRenameOperations" );
|
||||
|
||||
/* First we check if the key exists and if so how many bytes it already contains. */
|
||||
if (NtQueryValueKey( key, &nameW, KeyValuePartialInformation,
|
||||
if (NtQueryValueKey( key, &pending_file_rename_operations, KeyValuePartialInformation,
|
||||
NULL, 0, &size ) == STATUS_BUFFER_TOO_SMALL)
|
||||
{
|
||||
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size + len1 + len2 + sizeof(WCHAR) ))) goto done;
|
||||
if (NtQueryValueKey( key, &nameW, KeyValuePartialInformation, buffer, size, &size )) goto done;
|
||||
if (NtQueryValueKey( key, &pending_file_rename_operations, KeyValuePartialInformation, buffer, size, &size )) goto done;
|
||||
info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer;
|
||||
if (info->Type != REG_MULTI_SZ) goto done;
|
||||
if (size > sizeof(info)) size -= sizeof(WCHAR); /* remove terminating null (will be added back later) */
|
||||
|
@ -231,7 +230,7 @@ static BOOL add_boot_rename_entry( LPCWSTR source, LPCWSTR dest, DWORD flags )
|
|||
p = (WCHAR *)(buffer + size);
|
||||
*p = 0;
|
||||
size += sizeof(WCHAR);
|
||||
rc = !NtSetValueKey( key, &nameW, 0, REG_MULTI_SZ, buffer + info_size, size - info_size );
|
||||
rc = !NtSetValueKey( key, &pending_file_rename_operations, 0, REG_MULTI_SZ, buffer + info_size, size - info_size );
|
||||
|
||||
done:
|
||||
RtlFreeUnicodeString( &source_name );
|
||||
|
|
|
@ -107,7 +107,7 @@ static BOOL is_wow6432node( const UNICODE_STRING *name )
|
|||
static HANDLE open_wow6432node( HANDLE key )
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nameW;
|
||||
UNICODE_STRING nameW = RTL_CONSTANT_STRING( L"Wow6432Node" );
|
||||
HANDLE ret;
|
||||
|
||||
attr.Length = sizeof(attr);
|
||||
|
@ -116,7 +116,6 @@ static HANDLE open_wow6432node( HANDLE key )
|
|||
attr.Attributes = 0;
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
RtlInitUnicodeString( &nameW, L"Wow6432Node" );
|
||||
if (NtOpenKeyEx( &ret, MAXIMUM_ALLOWED, &attr, 0 )) ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
@ -2312,7 +2311,7 @@ LSTATUS WINAPI RegLoadKeyW( HKEY hkey, LPCWSTR subkey, LPCWSTR filename )
|
|||
*/
|
||||
LSTATUS WINAPI RegLoadKeyA( HKEY hkey, LPCSTR subkey, LPCSTR filename )
|
||||
{
|
||||
UNICODE_STRING subkeyW, filenameW;
|
||||
UNICODE_STRING subkeyW = { 0, 0, NULL }, filenameW = { 0, 0, NULL };
|
||||
STRING subkeyA, filenameA;
|
||||
NTSTATUS status;
|
||||
LONG ret;
|
||||
|
@ -2320,8 +2319,6 @@ LSTATUS WINAPI RegLoadKeyA( HKEY hkey, LPCSTR subkey, LPCSTR filename )
|
|||
RtlInitAnsiString(&subkeyA, subkey);
|
||||
RtlInitAnsiString(&filenameA, filename);
|
||||
|
||||
RtlInitUnicodeString(&subkeyW, NULL);
|
||||
RtlInitUnicodeString(&filenameW, NULL);
|
||||
if (!(status = RtlAnsiStringToUnicodeString(&subkeyW, &subkeyA, TRUE)) &&
|
||||
!(status = RtlAnsiStringToUnicodeString(&filenameW, &filenameA, TRUE)))
|
||||
{
|
||||
|
|
|
@ -433,7 +433,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH DefineDosDeviceW( DWORD flags, const WCHAR *device
|
|||
*/
|
||||
DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize )
|
||||
{
|
||||
UNICODE_STRING nt_name;
|
||||
NTSTATUS status;
|
||||
|
||||
if (!bufsize)
|
||||
|
@ -471,12 +470,11 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize )
|
|||
}
|
||||
else /* return a list of all devices */
|
||||
{
|
||||
UNICODE_STRING nt_name = RTL_CONSTANT_STRING( L"\\DosDevices" );
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
HANDLE handle;
|
||||
WCHAR *p = target;
|
||||
|
||||
RtlInitUnicodeString( &nt_name, L"\\DosDevices\\" );
|
||||
nt_name.Length -= sizeof(WCHAR); /* without trailing slash */
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
attr.ObjectName = &nt_name;
|
||||
|
@ -517,12 +515,11 @@ DWORD WINAPI QueryDosDeviceW( LPCWSTR devname, LPWSTR target, DWORD bufsize )
|
|||
DWORD WINAPI DECLSPEC_HOTPATCH GetLogicalDrives(void)
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING nt_name;
|
||||
UNICODE_STRING nt_name = RTL_CONSTANT_STRING( L"\\DosDevices\\" );
|
||||
DWORD bitmask = 0;
|
||||
NTSTATUS status;
|
||||
HANDLE handle;
|
||||
|
||||
RtlInitUnicodeString( &nt_name, L"\\DosDevices\\" );
|
||||
nt_name.Length -= sizeof(WCHAR); /* without trailing slash */
|
||||
attr.Length = sizeof(attr);
|
||||
attr.RootDirectory = 0;
|
||||
|
|
Loading…
Reference in a new issue