Vista SP1 32-bit
NSIS 2.41 (ANSI)
I have 2 problems with this script fragment, and I'm stumped.
1) The icon index always returns 0. I don't think my code is wrong.
2) 9 times out of 10 the script crashes on exit. This is AFTER the System plugin is unloaded. The crash is either in ole32.dll or ntdll.dll. Again, I have no idea why.
Any insight is appreciated!
NSIS 2.41 (ANSI)
I have 2 problems with this script fragment, and I'm stumped.
1) The icon index always returns 0. I don't think my code is wrong.
2) 9 times out of 10 the script crashes on exit. This is AFTER the System plugin is unloaded. The crash is either in ole32.dll or ntdll.dll. Again, I have no idea why.
Any insight is appreciated!
code:
;=== Program Details
Name "Folder Test"
OutFile "foldertest.exe"
Caption "Folder Test"
;=== Runtime Switches
CRCCheck On
WindowIcon off
SilentInstall Silent
AutoCloseWindow True
RequestExecutionLevel user
XPStyle on
; Best Compression
SetCompress Auto
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize On
Section
System::Call /NOUNLOAD '*(&t 260)i .r0' ; $0 = address to namebuff
; BROWSEINFO struct
System::Call /NOUNLOAD '*(i n, i n, i r0, t "Folder Dialog Title", i 0x40, i n, i n, i n)i .R0' ; $R0 = address of struct
System::Call /NOUNLOAD 'shell32::SHBrowseForFolderA(i R0)i .r5'
System::Call /NOUNLOAD '*$0(&t260 .r3)' ; read namebuff
MessageBox MB_OK "Selected folder: $3"
System::Call /NOUNLOAD 'shell32::SHGetPathFromIDListA(i r5, i $0)i'
System::Call /NOUNLOAD '*$0(&t260 .r3)' ; read namebuff
MessageBox MB_OK "Selected folder path: $3"
System::Call /NOUNLOAD '*$R0(i,i,i,t,i,i,i, i .r2)' ; read icon index
MessageBox MB_OK "Icon index: $2"
; cleanup
System::Call /NOUNLOAD 'ole32::CoTaskMemFree(i r5)v' ; free returned PIDL
System::Free /NOUNLOAD $0 ; free namebuff
System::Free $R0 ; free BROWSEINFO
MessageBox MB_OK "done"
SectionEnd
Comment