Archive: Help with this system plugin syntax


Help with this system plugin syntax


!define Browse '(i,i,t,t,i,i,i,i)'

Function ".onInit"
System::Call 'shell32.dll::SHBrowseForFolderA(*${Browse}) i .r0'
System::Call 'shell32.dll::SHGetPathFromIDListA(i $0, t .r1) i r2'
MessageBox MB_OK|MB_ICONINFORMATION "$1"
FunctionEnd


I'm trying to open the choose folder dialog...
A.K.A DirRequest...

What's wrong... :(

These forums actually have search function implemented ;)

Usage Example:
push "Select folder Demo"
push "d:\Program files"
call BrowseForFolder
pop $0
MessageBox MB_OK "Selected folder '$0'"

The code is coming here:

Function BrowseForFolder
System::Store "s r8r9"

; Get callback
System::Get '(i.s, i.s, i.s, i.s) i ss'
pop $0

; BrowseInfo structure
System::Call '*(i $HWNDPARENT, i 0, t "", t r9, i 0x45, k r0, i, i) i.r1'
System::Call 'shell32::SHBrowseForFolderA(i r1) i.s'
ShBrowse:
Pop $2
StrCmp $2 "callback1" 0 ExitBrowse

System::Store "s r3r4r5r6"
; BFMM_INITIALIZED ?
IntCmp $4 1 0 exit exit
; yes, set the starting dir
System::Call 'user32::SendMessageA(i $3, i 1126, i 1, t r8) i'
System::Store "r2r3r4r5r6"
System::Call "$0" 0
exit:
; Restore
System::Store "l"
System::Call "$0" 0
Goto ShBrowse

ExitBrowse:
; free used resources
System::Free $0
System::Free $1

; now we should determine folder name from given PIDL
System::Call 'shell32::SHGetPathFromIDListA(i $2, t "" r3)'

; IMalloc->Free work
System::Call 'shell32::SHGetMalloc(*i . r4)' ; Get the pointer to interface
System::Call '*$4(i.r7)' ; Get the pointer to interface VTABLE
System::Call '*$7(&t20, i.r5)' ; Get the pointer to IMalloc->Free
System::Call '::$5(i r2)' ; Call Free method

System::Store "p3 l"
FunctionEnd


btw, system supports no nested calls/declarations. :)


The same without starting folder (could be more stable):

push "Select folder Demo"
call BrowseForFolderNew
pop $0
MessageBox MB_OK "Selected folder '$0'"


Function BrowseForFolderNew
System::Store "s r9"

; BrowseInfo structure
System::Call '*(i $HWNDPARENT, i 0, t "", t r9, i 0x45, i 0, i, i) i.r1'
System::Call 'shell32::SHBrowseForFolderA(i r1) i.r2'
System::Free $1

; now we should determine folder name from given PIDL
System::Call 'shell32::SHGetPathFromIDListA(i $2, t "" r3)'

; IMalloc->Free work
System::Call 'shell32::SHGetMalloc(*i . r4)' ; Get the pointer to interface
System::Call '*$4(i.r7)' ; Get the pointer to interface VTABLE
System::Call '*$7(&t20, i.r5)' ; Get the pointer to IMalloc->Free
System::Call '::$5(i r2)' ; Call Free method

System::Store "p3 l"
FunctionEnd


you know what.... I forgot to search :igor:
Thanks... ;)


You know what, too..
this also works... :)


Function ".onInit"
System::Call '*(i $HWNDPARENT, i 0, t "", t "Búscame", i 0x45, i 0, i, i) i.r1'
System::Call 'shell32.dll::SHBrowseForFolderA(i $1) i .r2'
System::Call 'shell32.dll::SHGetPathFromIDListA(i $2, t .r1) i r3'
StrCmp $1 "" +1 +2
StrCpy $1 "None."
MessageBox MB_OK|MB_ICONINFORMATION "Your directory: $\r$\n$1"
Quit
FunctionEnd

MSDN: The calling application is responsible for freeing the returned PIDL by using the Shell allocator's IMalloc::Free method. To retrieve a handle to that IMalloc interface, call SHGetMalloc. For further discussion of the Shell allocator and PIDLs, see The Shell Namespace.

It wouldn't crash your installer anyway, but...


More or less like this, brainsucker:


Function ".onInit"
System::Call '*(i $HWNDPARENT, i 0, t "", t "Búscame", i 0x45, i 0, i, i) i.r1'
System::Call 'shell32.dll::SHBrowseForFolderA(i $1) i .r2'
System::Call 'shell32.dll::SHGetPathFromIDListA(i $2, t .r1) i r3'
System::Call 'ole32.dll::CoTaskMemFree(i $2)'
StrCmp $1 "" +1 +2
StrCpy $1 "None."
MessageBox MB_OK|MB_ICONINFORMATION "Your directory: $\r$\n$1"
Quit
FunctionEnd

Hi! Need one more push...
How can I make like an array with system plugin?
For example:


System::Call 'dll::Myfunc(i 1) i .r0'

this will make $0 = 10
but if you change as:

System::Call 'dll::Myfunc(i 2) i .r0'

this will make $0 = 45.
As you can see, is like an indexed value...
I wanna use one line:

System::Call 'dll::Myfunc(i ???) i .r(0..9)'

forum king :) 2174 (9.45 posts per day)

MSDN says no a single word about TaskMemFree :) IMalloc :)

About arrays. I don't understand what you want. What YourFunc actually takes and what returns?


forum king :) 2174 (9.45 posts per day)
MSDN says no a single word about TaskMemFree :) IMalloc :)
The function here in VB.

Also something about in MSDN.

About arrays. I don't understand what you want. What YourFunc actually takes and what returns?
Take the example in the GetSystemMetrics API, indexed:

System::Call 'user32::GetSystemMetrics(i x) i .r0'

X are a few integer values from 1 to 20 ( I think)

IMalloc & CoTaskMemFree: we are speaking different languages... :)

Arrays: I know no such call method as you proposed at any high level language, like C or VB :)