[python-win32] Setting UserInitials in Office

Mike Driscoll mdriscoll at co.marshall.ia.us
Wed Apr 28 15:23:36 CEST 2010

On 1:59 PM, Tim Golden wrote:
> On 27/04/2010 22:43, Tim Roberts wrote:
>> Tim Golden wrote:
>>> On 26/04/2010 23:56, Tim Roberts wrote:
>>>> Mike Driscoll wrote:
>>>>> ...
>>>>> HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo
>>>>> I tried to use the base64 module to decode it, but I must be doing
>>>>> something wrong. Does anyone know of a good way to get and set this
>>>>> information? I am dealing with users on Windows XP and Python 2.4
>>>> ???  The strings in there are not encoded in any way.  They are
>>>> plaintext Unicode strings.  They happen to be identified as 
>>>> but that's just a silly accident.
>>> On my (WinXP SP3, Office 2003) machine, they look to be utf16-encoded
>>> strings (null-terminated):
>> Exactly.  They are really just REG_SZ, although they set the type as
>> REG_BINARY for their own inscrutable reasons.
> Ah. Amazing how I managed to read your explanation and then internally
> translate it into meaning something rather different.
> Hopefully my code will have helped the OP out at any rate... I seem to be
> having a bad week for offering help :)

Sorry for the delay in checking this out. I was out of the office 
yesterday. Your code almost worked for reading the key, but I get a 
tuple back:

('m\x00l\x00d\x00\x00\x00', 3)

So I had to change your last line to: print repr (res[0].decode ("utf16"))

I'll try setting the value later today since that's the main goal of 
this little project. I suppose I'll need to encode it in utf16 too. 
Thanks for the assist!

- Mike

More information about the python-win32 mailing list