Ken Thomases : winemac: Fail gracefully and early when run from a non-GUI session.
Module: wine Branch: master Commit: c76f0beeab7e463841830843297af3734792f8ab URL: http://source.winehq.org/git/wine.git/?a=commit;h=c76f0beeab7e46384183084329... Author: Ken Thomases <ken(a)codeweavers.com> Date: Mon Mar 4 14:46:46 2013 -0600 winemac: Fail gracefully and early when run from a non-GUI session. --- dlls/winemac.drv/Makefile.in | 2 +- dlls/winemac.drv/macdrv_main.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/dlls/winemac.drv/Makefile.in b/dlls/winemac.drv/Makefile.in index 5b9def0..fcd41b4 100644 --- a/dlls/winemac.drv/Makefile.in +++ b/dlls/winemac.drv/Makefile.in @@ -1,6 +1,6 @@ MODULE = winemac.drv IMPORTS = user32 gdi32 advapi32 -EXTRALIBS = -framework AppKit -framework Carbon +EXTRALIBS = -framework AppKit -framework Carbon -framework Security C_SRCS = \ display.c \ diff --git a/dlls/winemac.drv/macdrv_main.c b/dlls/winemac.drv/macdrv_main.c index abd5522..cd1cc0c 100644 --- a/dlls/winemac.drv/macdrv_main.c +++ b/dlls/winemac.drv/macdrv_main.c @@ -21,6 +21,8 @@ */ #include "config.h" +#include <Security/AuthSession.h> + #include "macdrv.h" #include "wine/server.h" @@ -69,8 +71,15 @@ const char* debugstr_cf(CFTypeRef t) */ static BOOL process_attach(void) { + SessionAttributeBits attributes; + OSStatus status; + assert(NUM_EVENT_TYPES <= sizeof(macdrv_event_mask) * 8); + status = SessionGetInfo(callerSecuritySession, NULL, &attributes); + if (status != noErr || !(attributes & sessionHasGraphicAccess)) + return FALSE; + if ((thread_data_tls_index = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE; macdrv_err_on = ERR_ON(macdrv);
participants (1)
-
Alexandre Julliard