IT researcher
IT researcher

Reputation: 3304

WriteReg function gives error for large registry values

In NSIS i am using WriteRegBin. But if the length of value is large(about more than 15000 characters) then while compiling nsi code it will not work and compiling stops. For example(Below code has if has about more than 1500 characters then error comes)

WriteRegBin HKEY_LOCAL_MACHINE "SOFTWARE\nnn\qwrtt\B4CA2970-DD2B-11D0-9DFA-00AA00AF3494020000000000500002000000000000003070693300000000000000000400000000.....etc etc etc..

So how it can be solved. I know i can use importing registry file as shown below.

ExecWait '"regedit.exe" /s "$TEMP\registryfile.reg"'

But how i can i manage in WriteRegBin function

Upvotes: 0

Views: 477

Answers (1)

Anders
Anders

Reputation: 101736

Your current example has a long key name and those are documented to have a limit of 255 characters.

MSDN also tells you:

Long values (more than 2,048 bytes) should be stored in a file, and the location of the file should be stored in the registry. This helps the registry perform efficiently.

I don't know the exact NSIS REG_BINARY limit but if you want to bypass it you could call the registry functions directly with the system plugin...

Upvotes: 1

Related Questions