WriteRegBin HKLM "SOFTWARE\Ofof" "path" 0100bef2725a369bc05307000a0000000100000043\
3a5c50726f6772616d2046696c65732028783836295c456172\
74685669657700000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
000000000000000000433a5c55736572735c5a65726f5c4170\
70446174615c526f616d696e675c4465736b536f66745c4561\
72746856696577000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000687474703a2f\
2f7777772e6465736b736f66742e636f6d2f45617274685669\
65775f50757263686173652e68746d00000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000\
00000000
I’ve been struggling with this issue for several days, and unfortunately, the official documentation doesn’t provide a clear solution. After a lot of searching, I finally found this forum, and I’m really hoping for your help. The problem lies in writing large binary data to the registry using NSIS.
If anyone has experience with this or can provide an example that works, it would mean a lot to me. I just need a reliable way to split and write large binary data to the registry without losing any part of it.
Thank you very much in advance! Your help would really be appreciated!
WriteRegBin How to write long data
11 posts
There is probably some kind of length limit there, yes. Does the compiler give you an error?
You can also do ExecWait '"$windir\regedit.exe" /s "$temp\myfile.reg"' to import a .reg file.
You can also do ExecWait '"$windir\regedit.exe" /s "$temp\myfile.reg"' to import a .reg file.
Due to special reasons, WriteRegBin must be used.Originally Posted by Anders View PostThere is probably some kind of length limit there, yes. Does the compiler give you an error?
You can also do ExecWait '"$windir\regedit.exe" /s "$temp\myfile.reg"' to import a .reg file.
The WriteRegBin instruction you have here works just fine for me.
Use "SetRegView 64" if you need to write to the 64-bit part of the registry.
You need "RequestExecutionLevel Admin" in your script to write to HKLM...
Use "SetRegView 64" if you need to write to the 64-bit part of the registry.
You need "RequestExecutionLevel Admin" in your script to write to HKLM...
WriteRegBin HKLM "SOFTWARE\Ofof" "path" 0100bef2725a369bc05307000a0000000100000043
This write operation works fine, but it fails when the data size increases.
This write operation works fine, but it fails when the data size increases.
Could someone please help me?
Post the compile error message if you get one. Post the actual code that fails if you want me to help you...
The actual code is like this; you can test it. Such data cannot be fully written. I couldn't find any information in the official documentation on how to handle such long data.Originally Posted by Anders View PostPost the compile error message if you get one. Post the actual code that fails if you want me to help you...
WriteRegBin HKLM "SOFTWARE\Ofof" "path" 0100bef2725a369bc05307000a00000001000000433a5c50726f6772616d2046696c65732028783836295c45617274685669657700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000
It works just fine, you just don't understand how the registry redirector works.
RequestExecutionLevel Admin
!include x64.nsh
!include LogicLib.nsh
Section
; On 64-bit Windows, this ends up in the 32-bit registry: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Ofof in Regedit
WriteRegBin HKLM "SOFTWARE\Ofof" "path" 0100bef2725a369bc05307000a00000001000000433a5c50726f6772616d2046696c65732028783836295c456172746856696577000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
${If} ${RunningX64}
SetRegView 64
${EndIf}
; HKEY_LOCAL_MACHINE\SOFTWARE\Ofof on all Windows versions
WriteRegBin HKLM "SOFTWARE\Ofof" "path" 0100bef2725a369bc05307000a00000001000000433a5c50726f6772616d2046696c65732028783836295c456172746856696577000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
${If} ${RunningX64}
SetRegView LastUsed
${EndIf}
SectionEnd I have tested with both standard build and large strings build of v3.10. Error occur if:
WriteRegBin: 24576 bytes of data exceeded
It is about 32 times the length in first post.
WriteRegBin: 24576 bytes of data exceeded
It is about 32 times the length in first post.
The NSIS WriteRegBin limit is maybe NSIS_MAX_STRLEN * 3. The maximum size recommended by Microsoft is 2048 bytes.
Please try to understand the difference between WriteRegBin failing with a compiler error and an assumed failure at run-time.
Please try to understand the difference between WriteRegBin failing with a compiler error and an assumed failure at run-time.