Registering COM python based components when not admin

T

tooper

Hello,

I'm failing to register a python based COM component without having
admin rights...

Using the usual hello world COM server that exist in many
books/tutorial, and works perfecty when tested as admin, I first faced
problems to write in registry as normal user.

Some inspection of win32com.server.register shows a default argument I
missed in the documentation "base=win32con.HKEY_CLASSES_ROOT" for most
calls to set things in registry.

Forcing it to HKEY_CURRENT_USER seems to help for most of the initial
complaining _set_subkeys (and I've checked with regedit that
declaration in registry was effectively started), but a little after I
fail on the following :
File "C:\...\register.py", line 269, in RegisterServer
regCat.RegisterClassImplCategories(clsid, catids)
pywintypes.com_error: (-2147024891, 'Acc\xe8s refus\xe9.', None, None)

Unfortunately for me, regCat is a PyICatRegister object returned by
_cat_registrar, coming from a call to pythoncom.CoCreateInstance and
there's no source code I've found for pythoncom (looks it's a compiled
DLL). I tried to add base=win32con.HKEY_CURRENT_USER to
CoCreateInstance call but it complains there are no names args.

Any chance pythoncom is bluntly trying to write in HKEY_CLASSES_ROOT
tree just like register does ?
Any ideas or known workaround ?

Thanks in advance !
 
R

Roger Upole

To register the com server for only the current user,
your base key should be
HKEY_CURRENT_USER\SOFTWARE\Classes
instead of just HKCU.

However, I don't know if this will solve your problem
or not. The ICatRegister interface is supplied by the
system, so nobody but MS has the source code to the
RegisterClassImplCategories method. I don't see
anything in the SDK docs indicating how it determines
whether it should write to HKCU or HKLM.

hth
Roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
Martindap

Latest Threads

Top