[python-win32] Registering 64-bit Shell Extension using 32-bit Python

Adam Pletcher adam.pletcher at gmail.com
Wed Jun 23 04:40:53 CEST 2010


Sorry, I should have included more info.  I'm not registering a DLL,
at least not directly.  The extension I'm registering is a class in a
Python script, much like the "context_menu.py" example.  I was under
the impression that it gets registered to run via pythonw.exe when the
context menu command is used, and wouldn't have the 32/64-bit DLL
issue.  I could definitely be mistaken.

I took a closer look at the registry entries created by registering it
for 32-bit Explorer.  It has a CLSID registry key called
InprocServer32 with a value of "pythoncom26.dll".  Suggesting I need
to use the 64-bit build of that DLL, perhaps?

On the other hand, it also has a LocalServer32 entry with a value of:
C:\Python26\pythonw.exe
"C:\Python26\lib\site-packages\win32com\server\localserver.py"
{d6d38fd0-77fb-11df-93f2-0800200c9a66}

I've looked through the python code for
win32com.server.register.RegisterServer, and it appears as if I may
need to use Python x64 + pywin32 x64 if I want to add a Python-based
contextmenu for Explorer x64.  But I'd be very happy to learn how to
register it on Exp64 using the 32-bit stuff...

Thanks.

- Adam

> -----Original Message-----
> From: python-win32-bounces+adam=volition-inc.com at python.org
> [mailto:python-win32-bounces+adam=volition-inc.com at python.org] On
> Behalf Of Tim Roberts
> Sent: Tuesday, June 22, 2010 5:20 PM
> To: Python-Win32 List
> Subject: Re: [python-win32] Registering 64-bit Shell Extension using
> 32-bit Python
>
> Adam Pletcher wrote:
> > I have Python 2.6.2 (32-bit) and pywin32 212, on Vista 64.
> >
> > Using the “context_menu” sample script as reference, I made a script
> > that registers a shell extension, adding a couple right-click
> commands
> > to 32-bit Explorer.  I now need to register it for use in 64-bit
> > Explorer, but can’t seem to work it out (short of manually adding
> keys
> > in regedit).  I actually have the ContextMenuHandlers registry keys
> in
> > both 32 and 64 hives, it’s the CLSID entry in the 64 hive that
> appears
> > to be the missing piece.  Basically whatever RegisterClasses does?
> >
> > Is there an example somewhere showing how to register a shell
> > extension for 64-bit Explorer when running 32-bit Python?  I haven’t
> > been able to turn one up in my searching.
> >
>
> Do you actually have a 64-bit build of your extension DLL?  You can't
> load a 32-bit DLL into a 64-bit process.
>
> There is an API to turn off the file system redirection (which makes
> all
> of your 32-bit process's requests for System32 instead go to SysWow64),
> but I'm not aware of an API to turn off the registry redirection.  You
> need to specify KEY_WOW64_64KEY in the permission field of RegOpenKeyEx
> to access the 64-bit hive from a 32-bit application.
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32


More information about the python-win32 mailing list