[python-win32] COM registration/unregistration and elevation onVista

Mark Hammond mhammond at skippinet.com.au
Sat Jan 19 00:30:35 CET 2008



> -----Original Message-----
> From: MACKEITH Andrew [mailto:Andrew.MACKEITH at 3ds.com]
> Sent: Saturday, 19 January 2008 1:00 AM
> To: Mark Hammond; Python-Win32 List
> Subject: RE: [python-win32] COM registration/unregistration and
> elevation onVista
> 
> > -----Original Message-----
> > From: python-win32-bounces at python.org
> > [mailto:python-win32-bounces at python.org] On Behalf Of Mark Hammond
> > Sent: Thursday, January 17, 2008 11:10 PM
> > To: 'Python-Win32 List'
> > Subject: [python-win32] COM registration/unregistration and
> > elevation onVista
> >
> > On Vista, it's necessary to register python COM objects from
> > an "elevated"
> > process.  In practice, this means I tend to keep a
> > command-prompt open started with "run as administrator", do
> > registration and unregistration there, then switch back to
> > the normal command-prompt to do testing etc.  I finally got
> > annoyed at this, and came up with a patch that catches this
> > error, then retries the command after prompting for elevation
> > (the infamous Vista "Allow" dialog).
> >
> > However, it's not perfect;
> > * a new process is created to perform the actual
> > registration, and the output from this process is lost.  The
> > normal ways of getting child process will not work, as the
> > child must be executed via ShellExecuteEx for the elevation
> > to happen.  We can get the exit code of the process, but no output.
> > * The elevation prompt simply says "python.exe" wants
> > big-bad-scary access to your computer.  AFAIK, there is no
> > way to have windows use a different string (ie, to indicate a
> > com object is being registered)
> > * It might be too magic - should this just be left as the
> > responsibility of the packager?  Will it interfere with
> > "frozen" servers?
> >
> > As a result, I'd like some feedback on my approach - both the
> > specific implementation and the general idea, or anything
> > else you can think of.
> > I've attached the patch.
> >
> 
> Does this mean that a user needs administrator access to use Python COM
> on Vista, or is this only for registering a Python COM object for use
> as a COM server?

The latter - only when registering the object.  Once registered, it can be
used by normal users.

Mark



More information about the python-win32 mailing list