winemac: Fail gracefully and early when run from a non-GUI session.

oldstable
Ken Thomases 2013-03-04 14:46:46 -06:00 committed by Alexandre Julliard
parent 7b21da56ec
commit c76f0beeab
2 changed files with 10 additions and 1 deletions

View File

@ -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 \

View File

@ -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);