Archive: How to see why runas plugin returns error


How to see why runas plugin returns error
I use the runas plugin.

Every time I get an error as return.

I am very sure that the provided user, password and program to execute are right.

Can someone tell me why it fails or how I can see where it fails ?

Does somebody have an example of another way to "RunAs" ?
I looked at the API CreateProcessWithLogon but can't get it working either.

I can't use DosExec plugin because the program to start is a Win program.


It's not really a plug-in, so you must extract it first. You must also extract it to somewhere the System plug-in can find it.

InitPluginsDir
SetOutPath $PLUGINSDIR
File runas.dll
System::Call "runas..."

Isn't that how to get the plugin installed ?

If so, then sorry, It looks like I have expressed me wrong.
I think the runas plugin is installed and at the right place.
I did it manually by decompressing the zip file and copying the dll in %programfiles%\nsis\plugin.
The compiler recognizes the functions inside the dll (DLLMain, DLLMain12, GetAdministrators, GetAdministrators@8, RunAsW, RunAsW@16)

The problem in fact is that every time I use the runas, it returns a fail status.
The value returned from the function (r0) is always 0.


As I said, it's not really a plug-in, so that's not how you install it. It's a DLL that you can call with the System plug-in. Therefore, NSIS won't automatically package it for you and you must extract it yourself. Your script doesn't do that and if the DLL is in the Plugins directory, it can't find it. Your script tests that $0 is not 1, it doesn't test that it is 0. If you add a MessageBox there, you'll probably see it's actually "error" as you've stated yourself in the first post.