Old 17th January 2007, 11:00   #1
ontrack16
Junior Member
 
Join Date: Dec 2006
Posts: 4
Question 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.
Attached Files
File Type: nsi runastest.nsi (355 Bytes, 200 views)
ontrack16 is offline   Reply With Quote
Old 19th January 2007, 13:21   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.
code:
InitPluginsDir
SetOutPath $PLUGINSDIR
File runas.dll
System::Call "runas..."


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 20th January 2007, 09:22   #3
ontrack16
Junior Member
 
Join Date: Dec 2006
Posts: 4
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.
ontrack16 is offline   Reply With Quote
Old 20th January 2007, 11:42   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

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
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

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