way simpler REG_MULTI_SZ reader with pointers

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5189 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-07-06 09:20:47 +00:00
parent 035579824d
commit c7a03b18b1

View file

@ -309,8 +309,8 @@ I wrote this script to help rpetges in \W{http://forums.winamp.com/showthread.ph
\c !define REG_LINK 6
\c !define REG_MULTI_SZ 7
\c
\c !define RegOpenKeyEx "Advapi32::RegOpenKeyExA(i, t, i, i, i) i"
\c !define RegQueryValueEx "Advapi32::RegQueryValueExA(i, t, i, i, i, i) i"
\c !define RegOpenKeyEx "Advapi32::RegOpenKeyExA(i, t, i, i, *i) i"
\c !define RegQueryValueEx "Advapi32::RegQueryValueExA(i, t, i, *i, i, *i) i"
\c !define RegCloseKey "Advapi32::RegCloseKeyA(i) i"
\c
\c ####### Edit this!
@ -327,64 +327,55 @@ I wrote this script to help rpetges in \W{http://forums.winamp.com/showthread.ph
\c StrCpy $2 ""
\c StrCpy $3 ""
\c SetPluginUnload alwaysoff
\c System::Call "*(i) i (0) .r0"
\c System::Call "*(i) i (0) .r1"
\c System::Call "*(i) i (0) .r2"
\c System::Call "${RegOpenKeyEx}(${ROOT_KEY}, '${SUB_KEY}', \
\c 0, ${KEY_QUERY_VALUE}|${KEY_ENUMERATE_SUB_KEYS}, r0) .r3"
\c
\c 0, ${KEY_QUERY_VALUE}|${KEY_ENUMERATE_SUB_KEYS}, .r0) .r3"
\c
\c StrCmp $3 0 goon
\c MessageBox MB_OK|MB_ICONSTOP "Can't open registry key! ($3)"
\c Goto done
\c goon:
\c
\c System::Call "*$0(&i4 .r4)"
\c System::Call "${RegQueryValueEx}(r4, '${VALUE}', 0, r1, 0, r2) .r3"
\c
\c
\c System::Call "${RegQueryValueEx}(r0, '${VALUE}', 0, .r1, 0, .r2) .r3"
\c
\c StrCmp $3 0 read
\c MessageBox MB_OK|MB_ICONSTOP "Can't query registry value! ($3)"
\c MessageBox MB_OK|MB_ICONSTOP "Can't query registry value size! ($3)"
\c Goto done
\c
\c
\c read:
\c
\c System::Call "*$1(&i4 .r3)"
\c
\c StrCmp $3 ${REG_MULTI_SZ} multisz
\c MessageBox MB_OK|MB_ICONSTOP "Registry value no SZ_MULTI_SZ! ($3)"
\c
\c StrCmp $1 ${REG_MULTI_SZ} multisz
\c MessageBox MB_OK|MB_ICONSTOP "Registry value no REG_MULTI_SZ! ($3)"
\c Goto done
\c
\c
\c multisz:
\c
\c System::Call "*$2(&i4 .r3)"
\c
\c StrCmp $3 0 0 multiszalloc
\c
\c StrCmp $2 0 0 multiszalloc
\c MessageBox MB_OK|MB_ICONSTOP "Registry value empty! ($3)"
\c Goto done
\c
\c
\c multiszalloc:
\c
\c System::Free $1
\c System::Alloc $3
\c
\c System::Alloc $2
\c Pop $1
\c
\c
\c StrCmp $1 0 0 multiszget
\c MessageBox MB_OK|MB_ICONSTOP "Can't allocate enough memory! ($3)"
\c Goto done
\c
\c
\c multiszget:
\c
\c System::Call "${RegQueryValueEx}(r4, '${VALUE}', 0, 0, r1, r2) .r3"
\c
\c
\c System::Call "${RegQueryValueEx}(r0, '${VALUE}', 0, n, r1, r2) .r3"
\c
\c StrCmp $3 0 multiszprocess
\c MessageBox MB_OK|MB_ICONSTOP "Can't query registry value! ($3)[2]"
\c MessageBox MB_OK|MB_ICONSTOP "Can't query registry value data! ($3)"
\c Goto done
\c
\c
\c multiszprocess:
\c
\c
\c StrCpy $4 $1
\c
\c
\c loop:
\c
\c
\c System::Call "*$4(&t${NSIS_MAX_STRLEN} .r3)"
\c StrCmp $3 "" done
\c DetailPrint $3
@ -392,19 +383,17 @@ I wrote this script to help rpetges in \W{http://forums.winamp.com/showthread.ph
\c IntOp $4 $4 + $5
\c IntOp $4 $4 + 1
\c Goto loop
\c
\c
\c done:
\c
\c System::Free $2
\c
\c System::Free $1
\c
\c
\c StrCmp $0 0 noClose
\c System::Call "${RegCloseKey}(r0)"
\c
\c
\c noClose:
\c
\c
\c SetPluginUnload manual
\c System::Free $0
\c SectionEnd
written by KiCHiK