#NEWLINE# def _is_gui_available( ) : #NEWLINE# #INDENT# UOI_FLAGS = 1 #NEWLINE# WSF_VISIBLE = 1 #NEWLINE# class USEROBJECTFLAGS ( ctypes . Structure ) : #NEWLINE# #INDENT# _fields_ = [ ( 'fInherit' , ctypes . wintypes . BOOL ) , ( 'fReserved' , ctypes . wintypes . BOOL ) , ( 'dwFlags' , ctypes . wintypes . DWORD ) ] #NEWLINE# #UNINDENT# dll = ctypes . windll . user32 #NEWLINE# h = dll . GetProcessWindowStation ( ) #NEWLINE# if ( not h ) : #NEWLINE# #INDENT# raise ctypes . WinError ( ) #NEWLINE# #UNINDENT# uof = USEROBJECTFLAGS ( ) #NEWLINE# needed = ctypes . wintypes . DWORD ( ) #NEWLINE# res = dll . GetUserObjectInformationW ( h , UOI_FLAGS , ctypes . byref ( uof ) , ctypes . sizeof ( uof ) , ctypes . byref ( needed ) ) #NEWLINE# if ( not res ) : #NEWLINE# #INDENT# raise ctypes . WinError ( ) #NEWLINE# #UNINDENT# return bool ( ( uof . dwFlags & uof ) )