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
c6e328c2
Commit
c6e328c2
authored
Feb 27, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Split writing adapter to registry to a separate helper.
parent
2546468b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
29 deletions
+41
-29
sysparams.c
dlls/win32u/sysparams.c
+41
-29
No files found.
dlls/win32u/sysparams.c
View file @
c6e328c2
...
...
@@ -1257,14 +1257,45 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param )
ctx
->
gpu_count
++
;
}
static
void
add_adapter
(
const
struct
gdi_adapter
*
adapter
,
void
*
param
)
static
BOOL
write_adapter_to_registry
(
const
struct
adapter
*
adapter
,
HKEY
*
adapter_key
)
{
struct
device_manager_ctx
*
ctx
=
param
;
unsigned
int
adapter_index
,
len
;
struct
gpu
*
gpu
=
adapter
->
gpu
;
unsigned
int
len
,
adapter_index
=
gpu
->
adapter_count
;
char
name
[
64
],
buffer
[
MAX_PATH
];
WCHAR
bufferW
[
MAX_PATH
];
HKEY
hkey
;
sprintf
(
buffer
,
"%s
\\
Video
\\
%s
\\
%04x"
,
control_keyA
,
gpu
->
guid
,
adapter_index
);
len
=
asciiz_to_unicode
(
bufferW
,
buffer
)
-
sizeof
(
WCHAR
);
hkey
=
reg_create_ascii_key
(
NULL
,
buffer
,
REG_OPTION_VOLATILE
|
REG_OPTION_CREATE_LINK
,
NULL
);
if
(
!
hkey
)
hkey
=
reg_create_ascii_key
(
NULL
,
buffer
,
REG_OPTION_VOLATILE
|
REG_OPTION_OPEN_LINK
,
NULL
);
sprintf
(
name
,
"
\\
Device
\\
Video%u"
,
adapter
->
id
);
set_reg_ascii_value
(
video_key
,
name
,
buffer
);
if
(
!
hkey
)
return
FALSE
;
sprintf
(
buffer
,
"%s
\\
Class
\\
%s
\\
%04X"
,
control_keyA
,
guid_devclass_displayA
,
gpu
->
index
);
len
=
asciiz_to_unicode
(
bufferW
,
buffer
)
-
sizeof
(
WCHAR
);
set_reg_value
(
hkey
,
symbolic_link_valueW
,
REG_LINK
,
bufferW
,
len
);
NtClose
(
hkey
);
/* Following information is Wine specific, it doesn't really exist on Windows. */
sprintf
(
buffer
,
"System
\\
CurrentControlSet
\\
Control
\\
Video
\\
%s
\\
%04x"
,
gpu
->
guid
,
adapter_index
);
*
adapter_key
=
reg_create_ascii_key
(
config_key
,
buffer
,
REG_OPTION_VOLATILE
,
NULL
);
set_reg_ascii_value
(
*
adapter_key
,
"GPUID"
,
gpu
->
path
);
set_reg_value
(
*
adapter_key
,
state_flagsW
,
REG_DWORD
,
&
adapter
->
state_flags
,
sizeof
(
adapter
->
state_flags
)
);
return
TRUE
;
}
static
void
add_adapter
(
const
struct
gdi_adapter
*
adapter
,
void
*
param
)
{
struct
device_manager_ctx
*
ctx
=
param
;
TRACE
(
"
\n
"
);
if
(
ctx
->
adapter_key
)
...
...
@@ -1273,37 +1304,18 @@ static void add_adapter( const struct gdi_adapter *adapter, void *param )
ctx
->
adapter_key
=
NULL
;
}
adapter_index
=
ctx
->
gpu
.
adapter_count
++
;
memset
(
&
ctx
->
adapter
,
0
,
sizeof
(
ctx
->
adapter
)
);
ctx
->
adapter
.
gpu
=
&
ctx
->
gpu
;
ctx
->
adapter
.
id
=
ctx
->
adapter_count
++
;
snprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
"%s
\\
Video
\\
%s
\\
%04x"
,
control_keyA
,
ctx
->
gpu
.
guid
,
adapter_index
);
len
=
asciiz_to_unicode
(
bufferW
,
buffer
)
-
sizeof
(
WCHAR
);
ctx
->
adapter
.
id
=
ctx
->
adapter_count
;
ctx
->
adapter
.
state_flags
=
adapter
->
state_flags
;
hkey
=
reg_create_ascii_key
(
NULL
,
buffer
,
REG_OPTION_VOLATILE
|
REG_OPTION_CREATE_LINK
,
NULL
);
if
(
!
hkey
)
hkey
=
reg_create_ascii_key
(
NULL
,
buffer
,
REG_OPTION_VOLATILE
|
REG_OPTION_OPEN_LINK
,
NULL
);
sprintf
(
name
,
"
\\
Device
\\
Video%u"
,
ctx
->
adapter
.
id
);
set_reg_ascii_value
(
video_key
,
name
,
buffer
);
if
(
hkey
)
if
(
!
write_adapter_to_registry
(
&
ctx
->
adapter
,
&
ctx
->
adapter_key
))
WARN
(
"Failed to write adapter to registry
\n
"
);
else
{
sprintf
(
buffer
,
"%s
\\
Class
\\
%s
\\
%04X"
,
control_keyA
,
guid_devclass_displayA
,
ctx
->
gpu
.
index
);
len
=
asciiz_to_unicode
(
bufferW
,
buffer
)
-
sizeof
(
WCHAR
);
set_reg_value
(
hkey
,
symbolic_link_valueW
,
REG_LINK
,
bufferW
,
len
);
NtClose
(
hkey
);
ctx
->
gpu
.
adapter_count
++
;
ctx
->
adapter_count
++
;
}
else
ERR
(
"failed to create link key
\n
"
);
/* Following information is Wine specific, it doesn't really exist on Windows. */
snprintf
(
buffer
,
ARRAY_SIZE
(
buffer
),
"System
\\
CurrentControlSet
\\
Control
\\
Video
\\
%s
\\
%04x"
,
ctx
->
gpu
.
guid
,
adapter_index
);
ctx
->
adapter_key
=
reg_create_ascii_key
(
config_key
,
buffer
,
REG_OPTION_VOLATILE
,
NULL
);
set_reg_ascii_value
(
ctx
->
adapter_key
,
"GPUID"
,
ctx
->
gpu
.
path
);
set_reg_value
(
ctx
->
adapter_key
,
state_flagsW
,
REG_DWORD
,
&
adapter
->
state_flags
,
sizeof
(
adapter
->
state_flags
)
);
}
static
BOOL
write_monitor_to_registry
(
struct
monitor
*
monitor
,
const
BYTE
*
edid
,
UINT
edid_len
)
...
...
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