[Python-Dev] 3.2.1 encoding surprise

Glenn Linderman v+python at g.nevcal.com
Tue Jul 19 05:27:15 CEST 2011


On 7/18/2011 7:03 PM, Glenn Linderman wrote:
> Wonder if there is a third party command line tool which augments them 
> for reading/setting HCU Classes?  Will search.  I know there is a 
> command line registry tool somewhere, but specifying the paths 
> correctly would be onerous.

XP+ has REG and REGINI commands which can manipulate the registry from 
the command line, without resorting to third party applications.  So a 
batch file could wrap them, to avoid mistyping keys, and one could make 
an FTYPE.CMD and ASSOC.CMD (I haven't, at least not yet).

Also <http://vim.wikia.com/wiki/Windows_file_associations> although 
specific to Vim, is addressing the general problem, and comments by 
readers on that page seem relevant:

> The following is a "for reader's information" comment; not a 
> suggestion that the tip be changed. In classic Microsoft style, using 
> HKEY_CLASSES_ROOT is ambiguous. I do not know the details, but on at 
> least some systems (after Windows 9x), I think the following is correct:
>
>     HKEY_LOCAL_MACHINE\Software\Classes : for all users 
>     HKEY_CURRENT_USER\Software\Classes : for interactive user 
>     HKEY_CLASSES_ROOT : merged view of above (and is used by Win9x
>     apps <http://vim.wikia.com/wiki/Windows_file_associations#>) 
>
> I don't know what happens if you write to HKEY_CLASSES_ROOT (which 
> does not exist). Perhaps (like installing some apps), if you are in 
> the Administrators group, you will write to HKLM, otherwise you will 
> write to HKCU. JohnBeckett 
> <http://vim.wikia.com/wiki/User:JohnBeckett> 08:24, 2 July 2009 (UTC)
>
> ------------------------------------------------------------------------
>
> This is correct as far as I know. I wanted to include some information 
> about how HKCR is a merged view of HKLM/Software/Classes and 
> HKCU/Software/Classes, but doing so would beg information such as 
> "what happens when I edit an entry that actually exists in HKCU?" etc. 
> From experimentation, it seems that creating /new/ keys in this area 
> will always create it in HKLM (system-wide), and ftype and assoc 
> certainly do that, but I don't really have any documentation of that 
> fact, and I don't know what it will do for limited-privilege accounts. 
> I also don't know what happens when you edit an existing key, but I 
> imagine it will "do the right thing" and keep the original where it 
> was. I don't know this for a fact though. For these reasons, I left 
> out that tidbit. But if we can answer some of these questions, it 
> would be a good thing to include.
>

So attempts by applications to use the HKEY_CLASSES_ROOT directly may 
result in variant behavior depending on the privilege of the 
application.  My overall opinion? It is sad that M$ even invented the 
registry.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20110718/d19d3eeb/attachment.html>


More information about the Python-Dev mailing list