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
533b3def
Commit
533b3def
authored
Aug 17, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Aug 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Only read/write valid mode fields from/to the registry.
parent
eaeef1de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
sysparams.c
dlls/win32u/sysparams.c
+15
-12
No files found.
dlls/win32u/sysparams.c
View file @
533b3def
...
...
@@ -429,16 +429,20 @@ static BOOL write_adapter_mode( HKEY adapter_key, DWORD index, const DEVMODEW *m
{
WCHAR
bufferW
[
MAX_PATH
];
char
buffer
[
MAX_PATH
];
BOOL
ret
=
TRUE
;
HKEY
hkey
;
BOOL
ret
;
sprintf
(
buffer
,
"Modes
\\
%08X"
,
index
);
reg_delete_tree
(
adapter_key
,
bufferW
,
asciiz_to_unicode
(
bufferW
,
buffer
)
-
sizeof
(
WCHAR
)
);
if
(
!
(
hkey
=
reg_create_key
(
adapter_key
,
bufferW
,
asciiz_to_unicode
(
bufferW
,
buffer
)
-
sizeof
(
WCHAR
),
REG_OPTION_VOLATILE
,
NULL
)))
return
FALSE
;
#define set_mode_field( name, field, flag ) \
if (!(ret = set_reg_value( hkey, (name), REG_DWORD, &mode->field, sizeof(mode->field) ))) goto done;
#define set_mode_field( name, field, flag ) \
if ((mode->dmFields & (flag)) && \
!(ret = set_reg_value( hkey, (name), REG_DWORD, &mode->field, \
sizeof(mode->field) ))) \
goto done
set_mode_field
(
bits_per_pelW
,
dmBitsPerPel
,
DM_BITSPERPEL
);
set_mode_field
(
x_resolutionW
,
dmPelsWidth
,
DM_PELSWIDTH
);
...
...
@@ -467,7 +471,6 @@ static BOOL read_adapter_mode( HKEY adapter_key, DWORD index, DEVMODEW *mode )
WCHAR
bufferW
[
MAX_PATH
];
char
buffer
[
MAX_PATH
];
HKEY
hkey
;
BOOL
ret
;
sprintf
(
buffer
,
"Modes
\\
%08X"
,
index
);
if
(
!
(
hkey
=
reg_open_key
(
adapter_key
,
bufferW
,
asciiz_to_unicode
(
bufferW
,
buffer
)
-
sizeof
(
WCHAR
)
)))
...
...
@@ -476,11 +479,12 @@ static BOOL read_adapter_mode( HKEY adapter_key, DWORD index, DEVMODEW *mode )
#define query_mode_field( name, field, flag ) \
do \
{ \
ret = query_reg_value( hkey, (name), value, sizeof(value_buf) ) && \
value->Type == REG_DWORD; \
if (!ret) goto done; \
mode->field = *(const DWORD *)value->Data; \
mode->dmFields |= (flag); \
if (query_reg_value( hkey, (name), value, sizeof(value_buf) ) && \
value->Type == REG_DWORD) \
{ \
mode->field = *(const DWORD *)value->Data; \
mode->dmFields |= (flag); \
} \
} while (0)
query_mode_field
(
bits_per_pelW
,
dmBitsPerPel
,
DM_BITSPERPEL
);
...
...
@@ -488,17 +492,16 @@ static BOOL read_adapter_mode( HKEY adapter_key, DWORD index, DEVMODEW *mode )
query_mode_field
(
y_resolutionW
,
dmPelsHeight
,
DM_PELSHEIGHT
);
query_mode_field
(
v_refreshW
,
dmDisplayFrequency
,
DM_DISPLAYFREQUENCY
);
query_mode_field
(
flagsW
,
dmDisplayFlags
,
DM_DISPLAYFLAGS
);
query_mode_field
(
orientationW
,
dmDisplayOrientation
,
DM_DISPLAYORIENTATION
);
query_mode_field
(
fixed_outputW
,
dmDisplayFixedOutput
,
DM_DISPLAYFIXEDOUTPUT
);
if
(
index
==
ENUM_CURRENT_SETTINGS
||
index
==
ENUM_REGISTRY_SETTINGS
)
{
query_mode_field
(
x_panningW
,
dmPosition
.
x
,
DM_POSITION
);
query_mode_field
(
y_panningW
,
dmPosition
.
y
,
DM_POSITION
);
}
query_mode_field
(
orientationW
,
dmDisplayOrientation
,
DM_DISPLAYORIENTATION
);
query_mode_field
(
fixed_outputW
,
dmDisplayFixedOutput
,
0
);
#undef query_mode_field
done:
NtClose
(
hkey
);
return
TRUE
;
}
...
...
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