REPOST: Re: COM Registration Attributes

Bill Bell bill-bell at bill-bell.hamilton.on.ca
Fri Dec 28 09:45:39 EST 2001


I have been wondering again about the best way of handling a
collection of Windows registry key additions, deletions or changes as
part of registering a Python COM server.

I can think of a few options:

1. Just use RegCreateKey, etc in the available library.
2. Create a wrapper for atl.dll to provide an automation interface
useable by Python so that the Python coder can simply embed
instructions as .rgs scripts in his/her Python scripts.
3. Write a module (probably using 'shlex') that parses .rgs scripts
and makes the necesssary calls to RegCreateKey, etc.
4. Wrap atl.dll and make it part of the standard Windows distribution.

I find doing it the first way makes for code that it hard to read and,
therefore, hard to maintain. Option 2 ain't too bad; however, to
implement it for general use by the Python community makes it
necessary to store an additional DLL somewhere with all the attendant
security issues. Option 3 makes it possible to use already available
modules with wide distribution; however, it entails maintenance if MS
changes the specs for .rgs scripts. (Mind you, isn't this stuff meant
to become less of an issue?) Option 4 looks nicest to me.

What do others think?

Bill

bill-bell at bill-bell.hamilton.on.ca (Bill Bell) wrote in message news:<5edaf477.0112141237.3f1471b2 at posting.google.com>...
> Mark Hammond <MarkH at ActiveState.com> wrote, in part:
> > > Thanks, Gordon. I just prototyped a simple COM that needs to 
> > > declare itself safe for Internet Explorer. Looks like I need to continue 
> > > to do that in the good old-fashioned way, with 'RegOpenKey', etc. 
> > > Would seem more elegant to be able to use '_reg_options_'.
> > A patch to allow _reg_options_ to do this sort of thing (assuming it did 
> > not break what it does now) would be welcome :)
> 
> I haven't extended _reg_options_. However, since ATL.Registrar lacks
> an automation interface I have whipped up a wrapper that provides
> access to two of Registrar's methods.
> 
> The following fragment is a typical usage:
> 
>     UseCommandLine ( WebPASSCOMServer )
>     from win32com.client import Dispatch
>     from sys import argv
>     registrar = Dispatch ( 'RegistrarCOMWrapper.Register' ) 
>     regString = \
> '''
> HKCR
> {
>     NoRemove 'CLSID'
>     {
>         ForceRemove '{D471BE26-C3C8-4773-B438-041BA612C563}'
>         {
>             'Implemented Categories'
>             {
>                 '{7DD95801-9882-11CF-9FA9-00AA006C42C4}'
>                 '{7DD95802-9882-11CF-9FA9-00AA006C42C4}'
>             }
>         }
>     }
>     NoRemove 'Component Categories'
>     {
>         NoRemove '{7DD95801-9882-11CF-9FA9-00AA006C42C4}'
>         NoRemove '{7DD95802-9882-11CF-9FA9-00AA006C42C4}'
>     }
> }
> '''
>     // following lines parallel the way 'UseCommandLine' works
>     if '--unregister' in argv: registrar . StringUnregister (
> regString )
>     else: registrar . StringRegister ( regString )
> 
> To me, the nice thing about this approach is that it involves the use
> of the '.rgs' scripts that are familiar to people who work with MSVC.
> 
> I have done only very limited trials, on Win2K at that. Would welcome
> comment, including a suggestion of where I might put this ugly thing
> in case someone else might consider using it.
> 
> BIll

========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-milwwi.newsops.execpc.com!newsfeeds.sol.net!newspump.sol.net!newsfeed.direct.ca!look.ca!newsfeed.dacom.co.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: bill-bell at bill-bell.hamilton.on.ca (Bill Bell)
Newsgroups: comp.lang.python
Subject: cmsg cancel <5edaf477.0112280645.246f7229 at posting.google.com>
Control: cancel <5edaf477.0112280645.246f7229 at posting.google.com>
Date: Mon, 31 Dec 2001 05:09:25 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.5edaf477.0112280645.246f7229 at posting.google.com>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009775374 27193 211.57.49.2 (31 Dec 2001 05:09:34 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:09:34 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.



More information about the Python-list mailing list