'Create a Windows process.
cmd:     command to run
login:   run as user \'Domain
User
Password\'
hStdin, hStdout, hStderr:
handles for process I/O; default is caller\'s stdin,
stdout & stderr
show:    wShowWindow (0=SW_HIDE, 1=SW_NORMAL, ...)
xy:      window offset (x, y) of upper left corner in pixels
xySize:  window size (width, height) in pixels
desktop: lpDesktop - name of desktop e.g. \'winsta0\default\'
None = inherit current desktop
\'\' = create new desktop if necessary
User calling login requires additional privileges:
Act as part of the operating system [not needed on Windows XP]
Increase quotas
Replace a process level token
Login string must EITHER be an administrator\'s account
(ordinary user can\'t access current desktop - see Microsoft
Q165194) OR use desktop=\'\' to run another desktop invisibly
(may be very slow to startup & finalize).'

def __init__(self, cmd, login=None, hStdin=None, hStdout=None, hStderr=None, show=1, xy=None, xySize=None, desktop=None):

    si = win32process.STARTUPINFO()
    si.dwFlags = (win32con.STARTF_USESTDHANDLES ^ win32con.STARTF_USESHOWWINDOW)
    if (hStdin is None):
        si.hStdInput = win32api.GetStdHandle(win32api.STD_INPUT_HANDLE)
    else:
        si.hStdInput = hStdin
    if (hStdout is None):
        si.hStdOutput = win32api.GetStdHandle(win32api.STD_OUTPUT_HANDLE)
    else:
        si.hStdOutput = hStdout
    if (hStderr is None):
        si.hStdError = win32api.GetStdHandle(win32api.STD_ERROR_HANDLE)
    else:
        si.hStdError = hStderr
    si.wShowWindow = show
    if (xy is not None):
        (si.dwX, si.dwY) = xy
        si.dwFlags ^= win32con.STARTF_USEPOSITION
    if (xySize is not None):
        (si.dwXSize, si.dwYSize) = xySize
        si.dwFlags ^= win32con.STARTF_USESIZE
    if (desktop is not None):
        si.lpDesktop = desktop
    procArgs = (None, cmd, None, None, 1, win32process.CREATE_NEW_CONSOLE, None, None, si)
    if (login is not None):
        hUser = logonUser(login)
        win32security.ImpersonateLoggedOnUser(hUser)
        procHandles = win32process.CreateProcessAsUser(hUser, *procArgs)
        win32security.RevertToSelf()
    else:
        procHandles = win32process.CreateProcess(*procArgs)
    (self.hProcess, self.hThread, self.PId, self.TId) = procHandles
