Old 15th January 2009, 18:43   #1
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
SHBrowseForFolder problem

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!

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

wraithdu is offline   Reply With Quote
Old 15th January 2009, 19:25   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
I always use SHGetFileInfo to get a icon/iconindex, did not even know that BROWSEINFO had it. But the docs say icon index for folder, not file or drive (it failed on my documents also, so who knows) Do you even need the icon index? or just the HICON?

You also really should add a HWND to BROWSEINFO...

I played around with it a bit and the iconindex is 0 for me also every time. (XP SP2)

code:

Section
System::Call /NOUNLOAD '*(&t261)i .r0' ; $0 = address to namebuff
; BROWSEINFO struct
System::Call /NOUNLOAD '*(i $hwndparent,i, i r0, t "Folder Dialog Title", i 0x40|0x4000,i,i,i)i.R0'

System::Call /NOUNLOAD 'shell32::SHBrowseForFolderA(i R0)i .r5'

System::Call /NOUNLOAD '*$0(&t260 .r3)' ; read namebuff
DetailPrint "ret = $5, Selected folder: $3"

System::Call /NOUNLOAD 'shell32::SHGetPathFromIDListA(i r5, i $0)i'
System::Call /NOUNLOAD '*$0(&t260 .r3)' ; read namebuff
DetailPrint "Selected folder path: $3"

System::Call /NOUNLOAD '*$R0(i,i,i,i,i,i,i,i.r2)' ; read icon index
DetailPrint "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

DetailPrint "done-----------------"
/*typedef struct _SHFILEINFO {
HICON hIcon;
int iIcon;
DWORD dwAttributes;
TCHAR szDisplayName[MAX_PATH];
TCHAR szTypeName[80];
} SHFILEINFO;*/
!define STRUCTSIZE_SHFILEINFOA 352
#DEFINE SHGFI_ICON 0x000000100
System::Call '*(i,i,i,&t260,&t80)i.r0'
System::Call 'shell32::SHGetFileInfoA(t "$3",i,i $0,i 352,i 0x100)i.r9'
DetailPrint ret=$9,inpath=$3
System::Call '*$0(i.r1,i.r2)'
DetailPrint hIco=$1,icoIdx=$2
System::Free $0
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 0x407
SendMessage $0 ${STM_SETICON} $1 0

SectionEnd



note that it is also possible to use a PIDL with SHGetFileInfo (you did not specify the filesystemonly flag, so you could get virtual paths)

Also, I'm using 2.42 so I don't have to bother with /NOUNLOAD

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th January 2009, 19:58   #3
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
I don't need the icon index for the folder, but was just curious why it wasn't working.

The bigger issue is why it's crashing consistently on exit on Vista. I'm assuming that it's not crashing on XP since you've tried it...
wraithdu is offline   Reply With Quote
Old 15th January 2009, 20:09   #4
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
I just checked with 2.42 and removing /NOUNLOAD, still crashes most of the time.
wraithdu is offline   Reply With Quote
Old 15th January 2009, 20:26   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
and if you don't call CoTaskMemFree or free the buffers?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 16th January 2009, 03:40   #6
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
Still crashes unfortunately. And I've seen the faulting module as both ole32.dll and ntdll.dll.
wraithdu is offline   Reply With Quote
Old 16th January 2009, 09:03   #7
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You have a space between &t and 260. The buffer you allocate is therefore sized 1 bytes and the initial value of that string is "260".

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th January 2009, 14:20   #8
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
Wow. Thanks kickik, that did it. I can't believe that was the problem. So it was a buffer overrun type of crash then?

Well, since I have a topic already here instead of starting a new one, can you briefly explain how the &l is used for structure size? The manual doesn't have an example of usage, and I don't see the N for N bytes after it like the others. Thanks again!
wraithdu is offline   Reply With Quote
Old 16th January 2009, 14:29   #9
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Yes, it caused a heap overflow.

&l is used to get the structure size. It doesn't really set a struct member but only gets the size.
code:
System::Call "*${stBITMAP} (_, &l0 .R7) .R9"
System::Call "${sysGetObject} (r6, R7, R9)"


NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th January 2009, 14:57   #10
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
Ok. So in the above example, the _ character 'skips' all the params and lets you add one to the end of the struct?
wraithdu is offline   Reply With Quote
Old 16th January 2009, 15:06   #11
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Indeed.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th January 2009, 15:47   #12
wraithdu
Junior Member
 
Join Date: Sep 2002
Posts: 39
Thanks for all the help!

Maybe add those few tips about &l and _ to the System Plugin Documentation when you have an opportunity.

Keep up the great work!
wraithdu is offline   Reply With Quote
Old 16th January 2009, 16:53   #13
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
DOH, not sure how I missed this one, copy&paste without checking is baaad mmmkay

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th September 2016, 11:02   #14
PPeti66x
Junior Member
 
Join Date: Jul 2014
Posts: 15
I need some help with SHBrowseForFolder API call in NSIS. I need 2 things to implement:
1.) browse for folders in selected root folder (so other folders outside of defined root folder are not dislpayed at all)
2.) preselect an existing folder.

My problem is that root folder must be served as pointer to PIDL, but ParseDisplayName API call always fails for me. The second problem, that the preselected folder parameter is ignored.

The code:
code:

Function BrowseFolderByRoot
;Input1: A handle to the owner window for the dialog box on top of the stacks.
;Input2: The location of the root folder from which to start browsing
; as 2nd element of stacks. Only the specified folder and its
; subfolders in the namespace hierarchy appear in the dialog box.
; This member can be NULL; in that case, a default location is used.
;Input3: Initially selected folder as 3rd element of stacks
;Input4: Text above the tree view control in the dialog box as 4th element of stacks.
;Output: Selected path on top of the stacks.
;
Exch $0
Exch
Exch $1
Exch 2
Exch $2
Exch 1
Exch 3
Exch $3
Push $4
Push $5
Push $6
Push $7
Push $8
Push $9
IntOp $4 $1 + 0
StrCpy $7 "$2"
!define MAX_PATH 260 ;Windows shell is limited to 260 characters(with null terminating char.)


System::Call /NoUnload "ole32::CoInitialize(*i.r8) i.r5"
StrCmp $5 "error" +3 +4 ;error means error
IntCmp $5 0 +3 0 0 ; 0 means success, other values means error
messageBox MB_ICONEXCLAMATION "DEBUG: CoInitialize error!"
Goto Error

System::Call /NoUnload "shell32::SHGetMalloc(*i.r9) i.r5"
StrCmp $5 "error" +3 +4 ;error means error
IntCmp $5 0 +3 0 0 ; 0 means success, other values means error
messageBox MB_ICONEXCLAMATION "DEBUG: SHGetMalloc error!"
Goto Error

System::Call /NoUnload "shell32::SHGetDesktopFolder(*i.r6) i.r5"
StrCmp $5 "error" +3 +4 ;error means error
IntCmp $5 0 +3 0 0 ; 0 means success, other values means error
messageBox MB_ICONEXCLAMATION "DEBUG: SHGetDesktopFolder error!"
Goto Error

System::Call /NoUnload "*(&w${MAX_PATH}) i.r2" ;Buffer allocation for unicode path
;Path string must be converted to Unicode
;CodePage=0 (CP_ACP), dwFlags=0, string-to-convert, length=-1(null terminated),
System::Call /NoUnload "kernel32::MultiByteToWideChar(i 0, i 0, t r1, i -1, i r2, i ${MAX_PATH}) i.r5"
IntCmp $5 0 0 0 +3 ; Larger value than 0 indicates success
messageBox MB_ICONEXCLAMATION "DEBUG: MultiByteToWideChar error!"
Goto Error

;Convert Unicode path string to PIDL
System::Call /NoUnload "shell32::ParseDisplayName(i n, i n, i r2, i.n, *i.r1, i n) i.r5"
messageBox MB_ICONEXCLAMATION "DEBUG: 1=$1; 2=$2; 5=$5; 7=$7"
IntCmp $1 0 +3 +6 +6 ;0 means error
StrCmp $5 "error" +2 +5 ;error means error
IntCmp $5 0 +4 0 0 ;0 means success, other values means error
messageBox MB_ICONEXCLAMATION "DEBUG: ParseDisplayName error!"
StrCpy $1 ""
; Goto Error
Nop

;Struct to handle the select folder dialog.
IntOp $4 0 + 1 ;0x01=BIF_RETURNONLYFSDIRS; 0x04=BIF_STATUSTEXT
System::Call /NoUnload "*(i $0, i r1, t r7, t '$3', i $4, i n, i n, i n) i.r5"

;Display the dialog window
System::Call /NoUnload "shell32::SHBrowseForFolder(i r5) i.r4"
IntCmp $4 0 0 +2 +2 ;0 means user cancelled, other values means success
Goto Canceled
;Read out the selected path
System::Call /NoUnload "shell32::SHGetPathFromIDList(i r4, t.r0) i.r6"
System::Call /NoUnload "ole32::CoTaskMemFree(i r4)" ;Free up the memory assigned for the output PIDL
IntCmp $6 0 0 +3 +3 ;0 means error, other values means success
messageBox MB_ICONEXCLAMATION "DEBUG: SHGetPathFromIDList error!"
Goto Error
Error:
StrCpy $0 "error"
Goto Finish
Canceled:
StrCpy $0 ""
Finish:
System::Free $6
System::Free $9
System::Call /NoUnload "ole32::CoUninitialize()"
System::Free $1
System::Free $2
System::Free $5
System::Free $6
System::Free $7
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Exch $0
FunctionEnd



The compilable script is in attachement.

PS: Sorry, my english is bad.
Attached Files
File Type: nsi test01.nsi (22.7 KB, 107 views)
PPeti66x is offline   Reply With Quote
Old 15th September 2016, 11:50   #15
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
Quote:
Originally Posted by PPeti66x View Post
I need some help with SHBrowseForFolder API call in NSIS...
What is shell32::ParseDisplayName? You can also just let the system plug-in convert to/from wide strings for you with the 'w' string type.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th September 2016, 13:48   #16
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
I tried to create something for you @ http://nsis.sourceforge.net/Browse_for_Folder but the selection code is not going to work all the time because Windows is buggy.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th September 2016, 15:57   #17
PPeti66x
Junior Member
 
Join Date: Jul 2014
Posts: 15
Thanks for a short reply.
1.) The lines "${If} $2 P= 0", "${AndIf} $R3 <> 0" and "${If} $9 Z<> 0" are correct? I get an error on these lines. (NSIS 2.46) The error message: "Error in macro _If on macroline 9".
2.) For me the Windows 2000 support is required (I sometimes must work on a very old systems, with DOS and Win2000), but would be better to work on all Win9x versions.
3.) shell32::ParseDisplayName converts absolute path to PIDL.
PPeti66x is offline   Reply With Quote
Old 15th September 2016, 18:05   #18
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
1) Did you not see the NSIS 2.51+ note on each function? If you absolutely need to use 2.46 then you need to change every 'p' type to 'i' and change 'Z=' to '=' etc.

2) I did not test a lot but it should work on most versions. It is clearly not going to work on DOS since this is Windows code LOL.

3) Please show me a link on MSDN for this function. Or are you talking about shell32::SHParseDisplayName?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th September 2016, 19:50   #19
PPeti66x
Junior Member
 
Join Date: Jul 2014
Posts: 15
1.) "Did you not see the NSIS 2.51+" - now it is clear.

2.) Yes, it is SHParseDisplayName, but I tried near everything, and I forget to revert it back.
After a many-many hour of reading and trying, now it works - the function calling was wrong (see bellow).
The folder preselection still not works.

Function BrowseFolderByRoot
;Input1: A handle to the owner window for the dialog box on top of the stacks.
;Input2: The location of the root folder from which to start browsing
; as 2nd element of stacks. Only the specified folder and its
; subfolders in the namespace hierarchy appear in the dialog box.
; This member can be NULL; in that case, a default location is used.
;Input3: Initially selected folder as 3rd element of stacks
;Input4: Text above the tree view control in the dialog box as 4th element of stacks.
;Output: Selected path on top of the stacks.
;
Exch $0
Exch
Exch $1
Exch 2
Exch $2
Exch 1
Exch 3
Exch $3
Push $4
Push $5
Push $6
Push $7
Push $8
Push $9
IntOp $4 $1 + 0
StrCpy $7 "$2"
!define MAX_PATH 260 ;Windows shell is limited to 260 characters(with null terminating char.)


System::Call /NoUnload "ole32::CoInitialize(*i.r8) i.r5"
StrCmp $5 "error" +3 +4 ;error means error
IntCmp $5 0 +3 0 0 ; 0 means success, other values means error
messageBox MB_ICONEXCLAMATION "DEBUG: CoInitialize error!"
Goto Error

System::Call /NoUnload "shell32::SHGetMalloc(*i.r9) i.r5"
StrCmp $5 "error" +3 +4 ;error means error
IntCmp $5 0 +3 0 0 ; 0 means success, other values means error
messageBox MB_ICONEXCLAMATION "DEBUG: SHGetMalloc error!"
Goto Error

System::Call /NoUnload "shell32::SHGetDesktopFolder(*i.r6) i.r5"
StrCmp $5 "error" +3 +4 ;error means error
IntCmp $5 0 +3 0 0 ; 0 means success, other values means error
messageBox MB_ICONEXCLAMATION "DEBUG: SHGetDesktopFolder error!"
Goto Error

System::Call /NoUnload "*(&w${MAX_PATH}) i.r2" ;Buffer allocation for unicode path
;Path string must be converted to Unicode
;CodePage=0 (CP_ACP), dwFlags=0, string-to-convert, length=-1(null terminated),
System::Call /NoUnload "kernel32::MultiByteToWideChar(i 0, i 0, t r1, i -1, i r2, i ${MAX_PATH}) i.r5"
IntCmp $5 0 0 0 +3 ; Larger value than 0 indicates success
messageBox MB_ICONEXCLAMATION "DEBUG: MultiByteToWideChar error!"
Goto Error

;Convert Unicode path string to PIDL: $6 contains the pointer to the
;IShellFolder interface, index of the ParseDisplayName method is 3.
System::Call /NoUnload "$6->3(i n, i n, i r2, i.n, *i.r1, i n) i.r5"
IntCmp $1 0 +3 +6 +6 ;0 means error
StrCmp $5 "error" +2 +5 ;error means error
IntCmp $5 0 +4 0 0 ;0 means success, other values means error
messageBox MB_ICONEXCLAMATION "DEBUG: ParseDisplayName error!"
StrCpy $1 ""
; Goto Error
Nop

;Struct to handle the select folder dialog.
IntOp $4 0 + 1 ;0x01=BIF_RETURNONLYFSDIRS; 0x04=BIF_STATUSTEXT
System::Call /NoUnload "*(i $0, i r1, t r7, t '$3', i $4, i n, i n, i n) i.r5"

;Display the dialog window
System::Call /NoUnload "shell32::SHBrowseForFolder(i r5) i.r4"
IntCmp $4 0 0 +2 +2 ;0 means user cancelled, other values means success
Goto Canceled
;Read out the selected path - buffer must be at least MAX_PATH (260 bytes) length!
System::Call /NoUnload "shell32::SHGetPathFromIDList(i r4, t.r2) i.r6"
Push $2

System::Call /NoUnload "ole32::CoTaskMemFree(i r4)" ;Free up the memory assigned for the output PIDL
IntCmp $6 0 0 +3 +3 ;0 means error, other values means success
messageBox MB_ICONEXCLAMATION "DEBUG: SHGetPathFromIDList error!"
Goto Error
Error:
StrCpy $0 "error"
Goto Finish
Canceled:
StrCpy $0 ""
Finish:
System::Free $6
System::Free $9
System::Call /NoUnload "ole32::CoUninitialize()"
Pop $0
System::Free $1
System::Free $2
System::Free $5
System::Free $6
System::Free $7
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Exch $0
;messageBox MB_ICONEXCLAMATION "DEBUG: par0=$0; par1=$1; par2=$2; par3=$3; par4=$4; par5=$5"
FunctionEnd
PPeti66x is offline   Reply With Quote
Old 15th September 2016, 21:34   #20
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
Why can't you just use my code?

If you are going to have any chance of making your code work you have to stop using relative goto's like +2 and switch to labels or the LogicLib.

To force a initial selection you have to use a callback like I did in my example so you can send a message while the browse dialog is open.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 15th September 2016, 22:37   #21
PPeti66x
Junior Member
 
Join Date: Jul 2014
Posts: 15
My code is not optimized, and contains some bugs (e.g. correct memory releasing needed for some calls). And I should learn more about NSIS scripting as well. I am not a programmer nor NSIS expert, so I need a little more time to do these thinks.

I updated my copy of NSIS compiler to 2.51 and tryed it. But if i click on browse button 2nd time, then program crashs. (Tested on Win7 SP1 x64.) Your code is very interesting, root folder selection and folder preselection works correctly. But I need some more time to understand how exactly works. I will have more time for experimenting with this in saturday.

Thanks for help, and good night!
PPeti66x is offline   Reply With Quote
Old 15th September 2016, 23:56   #22
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
Quote:
Originally Posted by PPeti66x View Post
I updated my copy of NSIS compiler to 2.51 and tryed it. But if i click on browse button 2nd time, then program crashs.
There is a problem with callbacks in v2.51 so I changed the wiki and they are disabled now used a little hack to make it work.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 17th September 2016, 23:56   #23
PPeti66x
Junior Member
 
Join Date: Jul 2014
Posts: 15
I tryed the new script. It worked fine on Win7 x64.
Then I tested on Win 95B and 98SE - it crashed if I clicked on browse button - OK, not a surprise.
The next was a Win2000-SP4 and XP-SP3. Folder preselection not worked, and if I clicked on browse button second time, it exited without any error message or crash notification.
If I commented out the "SendMessage $R1 ${BFFM_SETSELECTION} 0 $R3" line (or changed "$R3" to "0"), it worked correctly but without folder preselection.
PPeti66x is offline   Reply With Quote
Old 18th September 2016, 00:09   #24
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
It is possible that some of this stuff is not supported on 9x but Microsoft have removed all the information about these systems from MSDN so it needs a bit of detective work to get it working I guess.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th September 2016, 00:40   #25
PPeti66x
Junior Member
 
Join Date: Jul 2014
Posts: 15
By MSDN, at least Win2000 Server or WinXP required for BFFCALLBACK. Some other parts of your script also requires at least WinXP (e.g. SHELL32::SHParseDisplayName). But I not found any system calls that hurts WinXP compatibility - so on WinXP should work correctly.
PPeti66x is offline   Reply With Quote
Old 18th September 2016, 01:04   #26
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
Quote:
Originally Posted by PPeti66x View Post
By MSDN, at least Win2000 Server or WinXP required for BFFCALLBACK. Some other parts of your script also requires at least WinXP (e.g. SHELL32::SHParseDisplayName). But I not found any system calls that hurts WinXP compatibility - so on WinXP should work correctly.
But it tries an older function if SHParseDisplayName fails.

If support on these systems is so important you can try downloading a older SDK, Platform SDK2003 or older, it should contain some information about 9x but Win95 might be though, only a handful of shell functions exist and I don't know where you can download the SDK for Windows 95.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 18th September 2016, 10:28   #27
PPeti66x
Junior Member
 
Join Date: Jul 2014
Posts: 15
The compatibility was solved in my script by using IShellFolder->ParseDisplayName call (in post #19) - it is very similiar to SHParseDisplayName.
I copied/adapted the callback to my script. The callback works with some random crash on Win9x, but seems to be stable on Win2000/XP, if SendMessage line was removed. But with SendMessage failed even on WinXP.
PPeti66x is offline   Reply With Quote
Old 18th September 2016, 12:59   #28
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,153
I don't have time to investigate this now so I just disabled the callback on < Vista. Inside BFFM_SETSELECTION it calls back into the callback and this triggers a bug somewhere and corrupts the stack.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
shell, system.plug-in

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump