[python-win32] writing DWORD values > 0x7ffffff

Tim Roberts timr at probo.com
Mon Mar 26 21:20:48 CEST 2012


Scott Leerssen wrote:
> I'm trying to write a DWORD value to the registry using _winreg.SetValueEx and anything greater than 0x7fffffff yields a "ValueError: Could not convert the data to the specified type."  I've seen a few posts saying that taking the complement of the large integer (basically making it a negative value) satisfies the API and fools it into storing the value, but that has the same result in my experiments.  Any hints as to how to write large integers int a DWORD?

Ugly but functional:
   dw = struct.unpack('l',struct.pack('L', 0x80102030))[0]

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list