Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
6045ad5b
Commit
6045ad5b
authored
May 15, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
May 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Directly use ntdll for registry access in init_original_display_mode.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9b66a539
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
8 deletions
+94
-8
display.c
dlls/winemac.drv/display.c
+10
-8
macdrv.h
dlls/winemac.drv/macdrv.h
+5
-0
macdrv_main.c
dlls/winemac.drv/macdrv_main.c
+79
-0
No files found.
dlls/winemac.drv/display.c
View file @
6045ad5b
...
...
@@ -46,7 +46,8 @@ struct display_mode_descriptor
BOOL
macdrv_EnumDisplaySettingsEx
(
LPCWSTR
devname
,
DWORD
mode
,
LPDEVMODEW
devmode
,
DWORD
flags
);
static
const
char
initial_mode_key
[]
=
"Initial Display Mode"
;
static
const
WCHAR
initial_mode_keyW
[]
=
{
'I'
,
'n'
,
'i'
,
't'
,
'i'
,
'a'
,
'l'
,
' '
,
'D'
,
'i'
,
's'
,
'p'
,
'l'
,
'a'
,
'y'
,
' '
,
'M'
,
'o'
,
'd'
,
'e'
};
static
const
WCHAR
pixelencodingW
[]
=
{
'P'
,
'i'
,
'x'
,
'e'
,
'l'
,
'E'
,
'n'
,
'c'
,
'o'
,
'd'
,
'i'
,
'n'
,
'g'
,
0
};
static
CFArrayRef
modes
;
...
...
@@ -301,13 +302,14 @@ static void init_original_display_mode(void)
return
;
/* @@ Wine registry key: HKLM\Software\Wine\Mac Driver */
if
(
RegCreateKeyExA
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Wine
\\
Mac Driver"
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
mac_driver_hkey
,
NULL
))
mac_driver_hkey
=
reg_create_ascii_key
(
NULL
,
"
\\
Registry
\\
Machine
\\
Software
\\
Wine
\\
Mac Driver"
,
0
,
NULL
);
if
(
!
mac_driver_hkey
)
return
;
/* @@ Wine registry key: HKLM\Software\Wine\Mac Driver\Initial Display Mode */
if
(
RegCreateKeyExA
(
mac_driver_hkey
,
initial_mode_key
,
0
,
NULL
,
REG_OPTION_VOLATILE
,
KEY_WRITE
,
NULL
,
&
parent_hkey
,
&
disposition
))
if
(
!
(
parent_hkey
=
reg_create_key
(
mac_driver_hkey
,
initial_mode_keyW
,
sizeof
(
initial_mode_keyW
)
,
REG_OPTION_VOLATILE
,
&
disposition
)
))
{
parent_hkey
=
NULL
;
goto
fail
;
...
...
@@ -332,10 +334,10 @@ done:
fail:
macdrv_free_displays
(
displays
);
RegCloseKey
(
parent_hkey
);
NtClose
(
parent_hkey
);
if
(
!
success
&&
parent_hkey
)
RegDeleteTreeA
(
mac_driver_hkey
,
initial_mode_key
);
RegCloseKey
(
mac_driver_hkey
);
reg_delete_tree
(
mac_driver_hkey
,
initial_mode_keyW
,
sizeof
(
initial_mode_keyW
)
);
NtClose
(
mac_driver_hkey
);
if
(
success
)
inited_original_display_mode
=
TRUE
;
}
...
...
dlls/winemac.drv/macdrv.h
View file @
6045ad5b
...
...
@@ -297,6 +297,11 @@ extern BOOL query_ime_char_rect(macdrv_query* query) DECLSPEC_HIDDEN;
extern
ULONG
query_reg_value
(
HKEY
hkey
,
const
WCHAR
*
name
,
KEY_VALUE_PARTIAL_INFORMATION
*
info
,
ULONG
size
)
DECLSPEC_HIDDEN
;
extern
HKEY
reg_create_ascii_key
(
HKEY
root
,
const
char
*
name
,
DWORD
options
,
DWORD
*
disposition
)
DECLSPEC_HIDDEN
;
extern
HKEY
reg_create_key
(
HKEY
root
,
const
WCHAR
*
name
,
ULONG
name_len
,
DWORD
options
,
DWORD
*
disposition
)
DECLSPEC_HIDDEN
;
extern
BOOL
reg_delete_tree
(
HKEY
parent
,
const
WCHAR
*
name
,
ULONG
name_len
)
DECLSPEC_HIDDEN
;
extern
HKEY
reg_open_key
(
HKEY
root
,
const
WCHAR
*
name
,
ULONG
name_len
)
DECLSPEC_HIDDEN
;
/* string helpers */
...
...
dlls/winemac.drv/macdrv_main.c
View file @
6045ad5b
...
...
@@ -24,6 +24,8 @@
#include <Security/AuthSession.h>
#include <IOKit/pwr_mgt/IOPMLib.h>
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "macdrv.h"
#include "winuser.h"
#include "winreg.h"
...
...
@@ -152,6 +154,83 @@ static HKEY open_hkcu_key(const char *name)
}
/* wrapper for NtCreateKey that creates the key recursively if necessary */
HKEY
reg_create_key
(
HKEY
root
,
const
WCHAR
*
name
,
ULONG
name_len
,
DWORD
options
,
DWORD
*
disposition
)
{
UNICODE_STRING
nameW
=
{
name_len
,
name_len
,
(
WCHAR
*
)
name
};
OBJECT_ATTRIBUTES
attr
;
NTSTATUS
status
;
HANDLE
ret
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
root
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
0
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
status
=
NtCreateKey
(
&
ret
,
MAXIMUM_ALLOWED
,
&
attr
,
0
,
NULL
,
options
,
disposition
);
if
(
status
==
STATUS_OBJECT_NAME_NOT_FOUND
)
{
static
const
WCHAR
registry_rootW
[]
=
{
'\\'
,
'R'
,
'e'
,
'g'
,
'i'
,
's'
,
't'
,
'r'
,
'y'
,
'\\'
};
DWORD
pos
=
0
,
i
=
0
,
len
=
name_len
/
sizeof
(
WCHAR
);
/* don't try to create registry root */
if
(
!
root
&&
len
>
ARRAY_SIZE
(
registry_rootW
)
&&
!
memcmp
(
name
,
registry_rootW
,
sizeof
(
registry_rootW
)))
i
+=
ARRAY_SIZE
(
registry_rootW
);
while
(
i
<
len
&&
name
[
i
]
!=
'\\'
)
i
++
;
if
(
i
==
len
)
return
0
;
for
(;;)
{
unsigned
int
subkey_options
=
options
;
if
(
i
<
len
)
subkey_options
&=
~
(
REG_OPTION_CREATE_LINK
|
REG_OPTION_OPEN_LINK
);
nameW
.
Buffer
=
(
WCHAR
*
)
name
+
pos
;
nameW
.
Length
=
(
i
-
pos
)
*
sizeof
(
WCHAR
);
status
=
NtCreateKey
(
&
ret
,
MAXIMUM_ALLOWED
,
&
attr
,
0
,
NULL
,
subkey_options
,
disposition
);
if
(
attr
.
RootDirectory
!=
root
)
NtClose
(
attr
.
RootDirectory
);
if
(
!
NT_SUCCESS
(
status
))
return
0
;
if
(
i
==
len
)
break
;
attr
.
RootDirectory
=
ret
;
while
(
i
<
len
&&
name
[
i
]
==
'\\'
)
i
++
;
pos
=
i
;
while
(
i
<
len
&&
name
[
i
]
!=
'\\'
)
i
++
;
}
}
return
ret
;
}
HKEY
reg_create_ascii_key
(
HKEY
root
,
const
char
*
name
,
DWORD
options
,
DWORD
*
disposition
)
{
WCHAR
buf
[
256
];
return
reg_create_key
(
root
,
buf
,
asciiz_to_unicode
(
buf
,
name
)
-
sizeof
(
WCHAR
),
options
,
disposition
);
}
BOOL
reg_delete_tree
(
HKEY
parent
,
const
WCHAR
*
name
,
ULONG
name_len
)
{
char
buffer
[
4096
];
KEY_NODE_INFORMATION
*
key_info
=
(
KEY_NODE_INFORMATION
*
)
buffer
;
DWORD
size
;
HKEY
key
;
BOOL
ret
=
TRUE
;
if
(
!
(
key
=
reg_open_key
(
parent
,
name
,
name_len
)))
return
FALSE
;
while
(
ret
&&
!
NtEnumerateKey
(
key
,
0
,
KeyNodeInformation
,
key_info
,
sizeof
(
buffer
),
&
size
))
ret
=
reg_delete_tree
(
key
,
key_info
->
Name
,
key_info
->
NameLength
);
if
(
ret
)
ret
=
!
NtDeleteKey
(
key
);
NtClose
(
key
);
return
ret
;
}
ULONG
query_reg_value
(
HKEY
hkey
,
const
WCHAR
*
name
,
KEY_VALUE_PARTIAL_INFORMATION
*
info
,
ULONG
size
)
{
UNICODE_STRING
str
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment