# NVDA is not running.\r
sys.exit(1)\r
\r
+UOI_NAME = 2\r
+def getInputDesktopName():\r
+ desktop = ctypes.windll.user32.OpenInputDesktop(0, False, 0)\r
+ name = ctypes.create_unicode_buffer(256)\r
+ ctypes.windll.user32.GetUserObjectInformationW(desktop, UOI_NAME, ctypes.byref(name), ctypes.sizeof(name), None)\r
+ ctypes.windll.user32.CloseDesktop(desktop)\r
+ return name.value\r
+\r
#Ensure multiple instances are not fully started by using a mutex\r
-from nvda_service import getInputDesktopName\r
ERROR_ALREADY_EXISTS=0XB7\r
-desktopName=getInputDesktopName().split("\\")[1]\r
+desktopName=getInputDesktopName()\r
mutex=ctypes.windll.kernel32.CreateMutexW(None,True,u"Local\\NVDA_%s"%desktopName)\r
if not mutex or ctypes.windll.kernel32.GetLastError()==ERROR_ALREADY_EXISTS:\r
if mutex: ctypes.windll.kernel32.CloseHandle(mutex)\r