I'm writing a very long registry Key name (it's a list of programs for a combined uni开发者_开发知识库nstall) and I think it's too big.
What's the max size the key can be (in characters) ? (The smallest maximum among Win xp, vista, 7 since it'll need to work on all of them)
Key Name: 255 characters
Value name: 16,383 characters
Value: Available memory (latest format)
or 1 MB (standard format)
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724872%28v=vs.85%29.aspx
According to this support article, it is 255 characters.
here's a key that's longer than 255:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\DeviceClasses{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}##?#STORAGE#VOLUME#_??_USBSTOR#DISK&VEN_LEXAR&PROD_USB_FLASH_DRIVE&REV_1100#AANL1B891R5GCDV6&0#{53F56307-B6BF-11D0-94F2-00A0C91EFB8B}#{53f5630d-b6bf-11d0-94f2-00a0c91efb8b}#
I found this when I was writing a tool to search all keys in the registry. I created a buffer that was 256 which caused a stack corruption exception.
When I tried to view this key using regedit I noticed it shows an arrow indicating there are subkeys but won't respond when clicked on. I only guess at the final '#' key because other keys in that area end with it.
When I doubled the buffer everything went smoothly.
精彩评论