Package elisa :: Package core :: Package utils :: Package mswin32 :: Module tools

Module tools

source code

win32 specific helpers.

Classes
  RegKey
  ElisaRegKey
  ShortcutResolver
Helper class that resolves windows shortcuts.
Functions
 
get_multimedia_dir()
return in a dict the multimedia directories in UTF8
source code
bool
should_install_recommended_plugins()
Read the key in the registry set by the installer to define whether to install the recommended plugins upon first startup, and return its value.
source code
 
get_process_id(name) source code
 
get_process_id_xp(name) source code
 
kill_process_pid(pid) source code
 
kill_process_pids(pid_list) source code
 
kill_process(name) source code
subprocess.Popen
exit(delay=1, relaunch=False)
Exit Elisa using an external executable that makes sure no zombie processes are left over.
source code
 
run_with_privilege(program, params) source code
 
register_com_dll(filename, register=True)
Register a COM dll.
source code
 
unregister_com_dll(filename) source code

Imports: win32con, win32api, win32pdh, win32process, win32event, winerror, pywintypes, pythoncom, ShellExecuteEx, shell, shellcon, win32com, os, subprocess, tempfile, time, sys, ctypes, locale_helper, CONFIG_DIR


Function Details

should_install_recommended_plugins()

source code 

Read the key in the registry set by the installer to define whether to install the recommended plugins upon first startup, and return its value.

Once read, the key in the registry is deleted because the recommended plugins should be installed only upon first run.

Returns: bool
whether to install the recommended plugins

exit(delay=1, relaunch=False)

source code 

Exit Elisa using an external executable that makes sure no zombie processes are left over. If needed and after a given delay, remaining processes are killed.

Parameters:
  • delay (int) - the delay in seconds before checking whether Elisa correctly exited, and eventually kill all remaining processes (default: 1 second)
  • relaunch (bool) - whether to relaunch elisa after it successfully exited (default: False)
Returns: subprocess.Popen
the subprocess object running the external executable
Raises:
  • AssertionError - when trying to exit from an uninstalled version of Elisa
  • ValueError - if the delay passed is not strictly greater than zero

register_com_dll(filename, register=True)

source code 

Register a COM dll.

Parameters:
  • filename (str) - the full path to the dll to register
  • register (bool) - whether we want to register (True) or unregister (False) the dll
Raises:
  • pywintypes.error - if the Dll[Un]RegisterServer() function of the dll returned an error
  • WindowsError - if the library cannot be loaded