- NSIS Discussion
- New System documentation
Archive: New System documentation
kichik
22nd May 2004 16:22 UTC
New System documentation
As I've promised Brainsucker I would do, too long ago, I have finally rewritten the System plug-in documentation. It is now in HTML with lots of examples. It is not yet complete, but it's ready for reading. You can find it at:
http://nsis.sourceforge.net/System.html
Comments are welcome.
pompo500
22nd May 2004 20:05 UTC
Good job, kichik.
I have one quick question though, can you get the primary ISO language code with NSIS?
edit: nevermind (HKEY_CURRENT_USER\Control Panel\International\sLanguage)
deguix
22nd May 2004 23:24 UTC
kichik, try to make as I did with some of my Archive pages. Because if I would read by the first impression the [/SIZE] parameter of System::Copy, I would think it's an optional, fixed parameter. Try to put as this structure below:
String - Required fixed parameter, can't be changed.
"String" - Required changeable parameter, generally you put as said by its name.
(String|String2) - Required, one choice fixed parameters.
("String"|"String2") - Required, one choice changeable parameters.
[String] - Optional, fixed parameter.
["String"] - Optional, changeable parameter.
[String|String2] - Optinal, one choice fixed parameters.
["String"|"String2"] - Optinal, one choice changeable parameters.
kichik
25th May 2004 11:23 UTC
But it is, as the text just below it says, optional. As for fixed parameter, the examples and the text says it's not. I prefer having the meaning on the syntax line and not the type.
kichik
4th June 2004 13:54 UTC
FAQ section added. Currently it only has a question about handling structures. What other questions would you like see?
brainsucker
4th June 2004 15:56 UTC
Finally :)
btw, FAQ section rocks. Now the callbacks section will rock too (your example works fine, Kichik :)
bug-fix-release, 4.06.2004
1. System::Copy /SIZE fixed (Kichik).
2. System::Copy with destination auto-allocation now pushes destination
address on stack.
3. Callbacks fixed (Kichik's kick is awesome).
kichik
4th June 2004 16:23 UTC
Thanks! :)
Uploaded. New documentation will be uploaded once the callback information is updated.
kichik
4th June 2004 17:27 UTC
OK, new documentation is up on CVS. A copy is still available at the above address.
brainsucker
4th June 2004 22:38 UTC
4. Bug with proc call parts redefinition, # for example (pointed by Kichik).
5. Bug with memory protection during callback processing (Kichik).
fredtheman
8th June 2004 17:19 UTC
BTW, I haven't checked the latest and greatest, but it'd be very nice if someone added a section on how to call COM servers using the System plug-in.
Fred.
kichik
10th June 2004 19:01 UTC
What would you add on top of what's already there?
fredtheman
11th June 2004 09:01 UTC
>>What would you add on top of what's already there?
I just took a look, and all there is to read is a tiny example with no comment in the "Usage Examples" of the document. I guess I'm not the only one coming from the VB world, so I could use a bit more info on how to call COM servers from NSIS :-)
Fred.
kichik
11th June 2004 10:20 UTC
Have you read the notes? Have you read the possible PROC values?
fredtheman
14th June 2004 15:53 UTC
>>Have you read the notes? Have you read the possible PROC values?
I'm sorry, you lost me. I looked for a bit of explanation on how to use the System plug-in to work with COM servers at the following locations, but found nothing usable for someone who is only use to COM through VB. Should I look elsewhere on the site?
1. system_bugfix.zip
2. 10.zip
3. http://nsis.sourceforge.net/System.html
(scroll down to Calling Functions -> Notes and Usage Examples)
If that all there is, I guess I'll have to read on how to work with COM servers from a C++ point of view, since this is just too short an example when coming from the VB world. Nice work anyway :-)
Thx
Fred.
kichik
17th June 2004 17:51 UTC
Notes contains:
To find out the index of a member in a COM interface, you need to search for the definition of this COM interface in the header files that come with Visual C/C++ or the Platform SDK. Remember the index is zero based.
Possible PROC values and Meanings contains:
IPTR->IDX -- Member indexed IDX from interface pointed by IPTR -- see below (example link)
Do you think it deserves more than that, like callbacks?
fredtheman
18th June 2004 21:21 UTC
I guess it makes perfect sense for people quite knowledgeable with COM and C++, but I doubt any VB user for instance can figure out how to call any COM server from NSIS without a bit more infos on how those things work at that level, eg. how to find the list of interfaces from a non-MS server, eg.
Don't get me wrong, the System plug-in is very very useful, but it's just a bit cryptic for those not familiar with Win32 :-)
Fred.
kichik
18th June 2004 22:07 UTC
I assume you're refering to stuff like:
s = GetObject("Something.Something")
s.something()
Took me a while to find it, but it's done with CLSIDFromProgID. It takes a string and returns a CLSID which can then be used with CoCreateInstance as in the example. Getting a bit complicated I guess... I better create a section for it, after I learn some more about it :)
kichik
18th June 2004 23:51 UTC
Ouch...
# defines
!define CLSCTX_ALL 23
!define IID_IUnknown {00000000-0000-0000-C000-000000000046}
!define IID_IDispatch {00020400-0000-0000-C000-000000000046}
!define IID_NULL {00000000-0000-0000-0000-000000000000}
!define DISPATCH_METHOD 1
!define DISPATCH_PROPERTYGET 2
!define DISPATCH_PROPERTYPUT 4
!define DISPATCH_PROPERTYPUTREF 8
!define DISPPARAMS (i,i,i,i)
# get CLSID
System::Call "ole32::CLSIDFromProgID(w 'Shell.Application', \
g .r0) i.r1"
DetailPrint "Shell.Application CLSID - $0"
DetailPrint "CLSIDFromProgID - $1"
# create IActiveDesktop interface
System::Call "ole32::CoCreateInstance(g r0, i 0, \
i ${CLSCTX_ALL}, g '${IID_IDispatch}', *i .r0) i.r1"
DetailPrint "IDispatch - $0"
DetailPrint "CoCreateInstance - $1"
# call IUnknown->QueryInterface, get IDispatch
#System::Call "$0->0(g ${IID_IDispatch}, *i r2) i.r1"
#DetailPrint $2
#DetailPrint $1
# call IDispatch->GetIDsOfNames
System::Call "$0->5(g ${IID_NULL}, *w 'MinimizeAll', \
i 1, i 0, *i r2r2) i.r1"
DetailPrint "MinimizeAll - $2"
DetailPrint "GetIDsOfNames - $1"
# create arguments
System::Call "*${DISPPARAMS}(0, 0, 0, 0)i.R0"
DetailPrint "Allocate DISPPARMS - $R0"
# call IDispatch->Invoke
System::Call "$0->6(i r2, g ${IID_NULL}, i 0, \
i ${DISPATCH_METHOD}, i R0, i 0, i 0, i 0) i.r1"
DetailPrint "Invoke - $1"
# call IDispatch->Release
System::Call "$0->2() i.r1"
DetailPrint "Release - $1"
And that's without any parameters passed to the method...
Wasn't as simple as I thought it'd be :)
gfm688
7th January 2011 09:26 UTC
!define CLSID_Shell {13709620-C279-11CE-A49E-444553540000}
!define IID_IShellDispatch {D8F015C0-C278-11CE-A49E-444553540000}
Section
System::Call Ole32::CoCreateInstance(g'${CLSID_Shell}',i0,i1,g'${IID_IShellDispatch}',*i.r0)i.r1
StrCmp $1 0 0 end
# call IShellDispatch->MinimizeAll
System::Call "$0->14()"
# call IShellDispatch->Release
System::Call "$0->2()"
end:
SectionEnd