On 5/29/19 6:31 PM, Huw Davies wrote:
On Tue, May 28, 2019 at 03:19:24PM +0800, Zhiyi Zhang wrote:
Display device handlers are used to initialize the display device registry data. Different handlers can be implemented according to the defined interface, for example, via Xinerama or XRandR. With those registry data, EnumDisplayDevices, EnumDisplayMonitors and GetMonitorInfo can be built on top of it.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
v2: Supersede 162308~162314, fix xinerama primary adapter reporting, fix registry data reinit failure. v3: Rebase v4: Merge patches. Rebase. Supersede 164594~164599, 164612~164613 v5: Fix explorer patch triggered user32 test failures. Supersede 165122~165128. v6: Restructure patches. Supersede 165134~165140 v7: Supersede 165307~165313. Add mutex to avoid init race. Remove old adapter keys during reinit. Add fallback monitor data in explorer. Simplify code.
dlls/winex11.drv/Makefile.in | 1 + dlls/winex11.drv/display.c | 82 ++++++++++++++++++++++++++++++++++ dlls/winex11.drv/x11drv.h | 15 +++++++ dlls/winex11.drv/x11drv_main.c | 1 + dlls/winex11.drv/xinerama.c | 7 +++ 5 files changed, 106 insertions(+) create mode 100644 dlls/winex11.drv/display.c
diff --git a/dlls/winex11.drv/display.c b/dlls/winex11.drv/display.c new file mode 100644 index 0000000000..a82975bfb9 --- /dev/null +++ b/dlls/winex11.drv/display.c +void X11DRV_DisplayDevices_Init(void) +{
- static const WCHAR init_mutexW[] =
{'_','_','x','1','1','_','d','i','s','p','l','a','y','_','d','e','v','i','c','e','_','i','n','i','t',0};
- HANDLE mutex;
- HKEY video_hkey = NULL;
- DWORD disposition = 0;
- BOOL success = FALSE;
- mutex = CreateMutexW(NULL, FALSE, init_mutexW);
- WaitForSingleObject(mutex, INFINITE);
- if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, video_keyW, 0, NULL, REG_OPTION_VOLATILE, KEY_ALL_ACCESS, NULL, &video_hkey,
&disposition))
goto fail;
- /* Avoid unnecessary reinit */
- if (disposition != REG_CREATED_NEW_KEY)
- {
success = TRUE;
goto fail;
I think you need to change the label name (to e.g. "end") ;-)
Sure.
Also, the success variable is unnecessary, issue the ERR() if RegCreateKeyExW fails and then goto end.
What's going to happen with two seats running on the same wineserver?
What do you mean by "two seats"? do you mean processes? The mutex should be able to protect against threads on different processes racing.
What mechanism would you use?
Thanks, Zhiyi
Huw.