Archive: Best way to script plugin that works together with another exe?


Best way to script plugin that works together with another exe?
  Hello,

I have a header file with macro that reads cookies of Internet Explorer Protected Mode (Low). It uses an executable that runs as a low integrity user, reads the cookie and write it somewhere. Then the macro reads it and return the cookie value.

I'm looking for the best way a script writer can use this macro with minimal coding, like only !including the associated header file of the plugin.

Also, I want writers to be able to use my macro inside a Function, so I can't add a File instruction there.

I thought of somehow make nsis extract the auxiliary exe to the $PLUGINSDIR, but I don't know how.

Here is the header file. "ExecLow" is a plugin I wrote for executing as low integrity user.


macro GetIeCookieLow Answer Domain CookieName

Push${CookieName}
Push ${Domain}
Call GetIeCookieLow
Pop${Answer}
!macroend


>Function GetIeCookieLow
Exch $R0;Domain
Exch
Exch $R1;CookieName
Push$0 ;Answer
Exch 2
Exch
Push $R2;Local

${GetParent} $APPDATA $R2
StrCpy $R2 "$R2\LocalLow"
GetTempFileName $R2 $R2
ExecLow
::ExecLow "GetIeCookieBroker.exe" "-domain=$R0 -cookieName=$R1 -answerFile='$R2'"
ReadINIStr $0 $R2 "General" "cookie"

Pop $R2
Pop $R1
Pop $R0
Exch$0
FunctionEnd
>
GetIeCookieBroker.exe should exist somewhere on destination computer, and I don't know how to do it in the header file only.

Any suggestions?

Why not use File inside a function? You could create a function that would do all the magic and call that in your macro. Have it InitPluginsDir and then extract the executable, if it doesn't already exist, to $PLUGINSDIR.