16

I came across a large string value (REG_SZ) in the Registry and I want to copy it. As I double clicked the value, the textbox was empty.

What is the largest REG_SZ value that Regedit can edit in its textbox?

Thomas Weller
  • 5,704
  • 11
  • 55
  • 100

2 Answers2

18

The largest string that can be displayed in the Regedit's textbox has a length of 43679. beginning with a length of 43680, the textbox will appear to be empty. (Windows 10 21H1, if that matters).

And I say "appear", because the value is actually still there. You can press Ctrl+A and Ctrl+C in order to copy it into the clipboard. And you can also copy a text into the clipboard and paste it back to Regedit and accept it.

Thomas Weller
  • 5,704
  • 11
  • 55
  • 100
  • 2
    +1 because I never knew I wanted to know this. xD Good question with great answer. :) – LPChip Dec 26 '21 at 18:25
  • 4
    43680/dec = 0xAAA0/hex, that is an odd limitation!? ;-) Are we in BCD-country? – Hannu Dec 26 '21 at 21:15
  • 3
    If the value is still there then it may be a display limitation on the width of the text passed to the API that the edit control uses to paint. – Neil Dec 27 '21 at 09:32
  • 3
    @Hannu 43680*3+32 = 2^17. Not sure why that might be the limit (perhaps something related to multi byte encodings with 3 bytes per character?), but feels closer to the truth than 0xAAA0. – CodesInChaos Dec 27 '21 at 18:59
  • That's a really odd limitation. The usual textbox limit on Windows is 65535 characters. – Mark Dec 27 '21 at 22:26
  • 1
    @Mark: yes, and typically that's a maximum. But in this case, it just becomes invisible. – Thomas Weller Dec 27 '21 at 23:49
  • @CodesInChaos Windows is almost exclusively UTF-16. A 3-byte encoding doesn’t make sense. Especially considering the registry was created at the time when everyone thought UCS-2 (UTF-16 with no surrogates) was as much as we needed. Something related to rendering cavas size would make more sense IMO. Especially if the width goes “negative” through overflow. – Cole Tobin Dec 30 '21 at 21:00
  • Looking at this again; three bytes per character -> stored as Two-byte strings with a NUL terminator as third byte? But then, at least some of 0100, 0200 and so on "unicodes" *has* actual characters, so would not be possible in such storage (second byte NUL). **Linux: Hold CTRL+SHIFT and hit u, then type the code and hit ENTER. Windows: Type the code, hold ALT and hit x.** (code in HEX!) – Hannu Jan 03 '22 at 22:34
0

I am sure Ctrl + A & Ctrl + V will not always work, since it does not work on this two keys:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\OneSettings\TargetingAttributes
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsSelfHost\OneSettings\TargetingAttributesVerified

Both values are multi-line very long texts (>60000 each), just like this small reduced sample pattern:

{
  "Version": ...
  "SchemaVersion": ...
  ...
}

But i can confirm that Ctrl + A & Ctrl + C works, it copy the very long multi-line value perfectly.

But any attempt to put a new multi-line value (for a simple edit of a small part) does not work, no matter how long or short it is, it will only take/accept (write) the first line of the text.

So using REGEDIT to edit such kind of values looks like it is not an option.

Also tried:

  • If i export the branch to a (.reg) file, edit the text inside the (.reg) file and try to re-import (double clicking) and refresh (with F5 key), such values are not updated.
  • If i export the branch to a (.reg) file, delete the key, try to re-import (double clicking) and refresh (with F5 key), such keys are not imported (but the message says all keys were imported).
  • I also had tested with a short multi-line value, same results, no way to paste it, only accepted first line, also ignored if inside a (.reg) file, etc.

The key type is somehow weird, it is REG_SZ, not REG_MULTI_SZ.

That is getting me really madness, how is it possible to put/edit such values when they are multi-line in a REG_SZ type key is something i do not know.

Thanks anyway, at least i can read/copy them.

DarkDiamond
  • 1,875
  • 11
  • 12
  • 19
Laura
  • 1
  • 1
    This looks like more of a comment to the existing answer than an answer in its own right. – Judith Apr 28 '22 at 10:58