[python-win32] COM registration/unregistration and elevation on Vista
Mark Hammond
mhammond at skippinet.com.au
Fri Jan 18 05:09:39 CET 2008
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.
Thanks!
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: register_uac.patch
Type: application/octet-stream
Size: 2267 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-win32/attachments/20080118/c95f71e7/attachment.obj
More information about the python-win32
mailing list