DumpLog in Unicode script
So I needed to save the log in my unicode in the same way I did in ANSI one. I used the code from nsis web site:
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1016
StrCmp $0 0 exit
SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
DetailPrint "Item count: $6"
DetailPrint ${NSIS_MAX_STRLEN}
System::Alloc ${NSIS_MAX_STRLEN}
Pop $3
StrCpy $2 0
System::Call "*(i, i, i, i, i, i, i, i, i) i \
(0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
loop: StrCmp $2 $6 done
System::Call "User32::SendMessageA(i, i, i, i) i \
($0, ${LVM_GETITEMTEXT}, $2, r1)"
System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
DetailPrint "Here's the string: $4"
IntOp $2 $2 + 1
Goto loop
done:
System::Free $1
System::Free $3
exit:
I edited it to the following:
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1016
StrCmp $0 0 exit
SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
DetailPrint "Item count: $6"
DetailPrint ${NSIS_MAX_STRLEN}
System::StrAlloc ${NSIS_MAX_STRLEN}
Pop $3
StrCpy $2 0
System::Call "*(i, i, i, i, i, i, i, i, i) i \
(0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
loop: StrCmp $2 $6 done
System::Call "User32::SendMessageA(i, i, i, i) i \
($0, ${LVM_GETITEMTEXTW}, $2, r1)"
System::Call "*$3(&w${NSIS_MAX_STRLEN} .r4)"
DetailPrint "Here's the string: $4"
IntOp $2 $2 + 1
Goto loop
done:
System::Free $1
System::Free $3
exit:
Surprisingly, the code works. Surprisingly, because I have no idea why if I'm creating the szString member of the structure as type "i":
System::Call "*(i, i, i, i, i, i, i, i, i) i \
(0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
the thing still works. My understanding was that the type should be 'w' or 't'. But alas, specifying any of these types doesn't work at all. Just an empty string is returned...
Can anyone explain me why?