thepip3r Posted March 28, 2008 Share Posted March 28, 2008 (edited) I wrote a script that I converted to an exe. The program itself does a number of things but specific to this problem, kicks off the Control Panel applet using the following code: Func __menuControlPanelClick() Run(@ComSpec & " /c " & 'RunDll32.exe shell32.dll,Control_RunDLL', "", @SW_HIDE) EndFunc When I just dbl-click the program and click the button that runs this function, it works great. My problem is when I shift+right-click my executable, runas the exe as a user with admin credentials, and then try to click the button that kicks off the Control Panel, the same function that previously worked, now only opens windows explorer at the root of C: with no Control Panel. These results are duplicated by seeding my admin credentials with runasset() instead of doing shift+right-click runas. Can anyone offer any guidance on this issue pls?? It would be greatly appreciated. I've also tried JUST using the Run() and get the same results... EDIT: I also tried changing my Run statement to Run("control.exe") and I get the same results. Edited March 28, 2008 by thepip3r My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
thepip3r Posted March 28, 2008 Author Share Posted March 28, 2008 bump My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
Developers Jos Posted March 28, 2008 Developers Share Posted March 28, 2008 try specifying a workdir that is also accessible for the RunAs credentials... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
thepip3r Posted March 30, 2008 Author Share Posted March 30, 2008 I tried, Run("control.exe", "c:\") and it still didn't work. Any other suggestions? My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
d4rk Posted March 30, 2008 Share Posted March 30, 2008 with run, i alway do like this Run("c:\control.exe") have a try [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
thepip3r Posted March 30, 2008 Author Share Posted March 30, 2008 tried: Func __menuControlPanelClick() Run("C:\WINDOWS\system32\control.exe") EndFunc Same thing... works on normal account, right-click runas the same program and it comes up ok, but the control panel button and a couple others that use the rundll32.dll don't work. Any other suggestions? My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
thepip3r Posted March 30, 2008 Author Share Posted March 30, 2008 tried: Func __menuControlPanelClick() Run("C:\WINDOWS\system32\control.exe") EndFunc Same thing... works on normal account, right-click runas the same program and it comes up ok, but the control panel button and a couple others that use the rundll32.dll don't work. Any other suggestions? My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
thepip3r Posted March 31, 2008 Author Share Posted March 31, 2008 bump. My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
thepip3r Posted March 31, 2008 Author Share Posted March 31, 2008 kk... i did a bit more to illustrate my point in case someone would graciously take the liberty of compiling and replicating my problem. here is a gui to illustrate my point: expandcollapse popup#include <GUIConstants.au3> #include <file.au3> #include <array.au3> #include <Constants.au3> #include <GuiEdit.au3> #NoTrayIcon Opt("GuiOnEventMode", 1) Opt("RunErrorsFatal", 0) ; ---------- GUI CREATION ----------- $mainWindow = GUICreate("Test - " & @UserName,400,325) Global $mainFormStatusDefault = "Ready" Global $mainFormStatus ; ---------- MENU ----------- $menuFileParent = GUICtrlCreateMenu("&File") $menuFileOpen = GUICtrlCreateMenuitem("Open",$menuFileParent) GUICtrlSetState(-1,$GUI_DEFBUTTON) GUICtrlSetOnEvent(-1,"__menuFileOpen") $menuFileRecent = GUICtrlCreateMenu("Recent Files",$menuFileParent,1) $menuFileExit = GUICtrlCreateMenuItem("Exit",$menuFileParent) GUICtrlSetOnEvent(-1,"__Exit") $menuViewParent = GUICtrlCreateMenu("View",-1,1) $menuViewStatusBar = GUICtrlCreateMenuitem ("Status Bar",$menuViewParent) GUICtrlSetState(-1,$GUI_CHECKED) $menuRunParent = GUICtrlCreateMenu("Run...",-1,2) $menuControlPanelParent = GUICtrlCreateMenuItem("Control Panel1",$menuRunParent) GUICtrlSetOnEvent(-1,"__menuControlPanelRun1") $menuControlPanelParent = GUICtrlCreateMenuItem("Control Panel2",$menuRunParent) GUICtrlSetOnEvent(-1,"__menuControlPanelRun2") $menuControlPanelParent = GUICtrlCreateMenuItem("Control Panel3",$menuRunParent) GUICtrlSetOnEvent(-1,"__menuControlPanelRun3") $menuControlPanelParent = GUICtrlCreateMenuItem("Control Panel4",$menuRunParent) GUICtrlSetOnEvent(-1,"__menuControlPanelRun4") $menuControlPanelParent = GUICtrlCreateMenuItem("Control Panel5",$menuRunParent) GUICtrlSetOnEvent(-1,"__menuControlPanelRun5") $menuControlPanelParent = GUICtrlCreateMenuItem("Control Panel6",$menuRunParent) GUICtrlSetOnEvent(-1,"__menuControlPanelRun6") $menuControlPanelParent = GUICtrlCreateMenuItem("Control Panel7",$menuRunParent) GUICtrlSetOnEvent(-1,"__menuControlPanelRun7") $menuControlPanelParent = GUICtrlCreateMenuItem("Control Panel8",$menuRunParent) GUICtrlSetOnEvent(-1,"__menuControlPanelRun8") GUISetOnEvent($GUI_EVENT_CLOSE, "__Exit") GUISetState(@SW_SHOW) GUISetState() While 1 Sleep(100) WEnd Func __menuFileOpen() Global $sMenuItem,$menuFileRecent Local $sMenuItem Local $openFile = FileOpenDialog("Choose file...","C:\","All (*.*)",1+2+4+8) If $openFile <> "" Then __ExecuteTryAll($openFile) If @error <> 1 Then $sMenuItem = GUICtrlCreateMenuitem ($openFile,$menuFileRecent) GUICtrlSetOnEvent(-1,"__ExePath") EndIf EndIf EndFunc Func __Exit() Exit EndFunc Func __menuControlPanelRun1() Run("C:\WINDOWS\system32\control.exe", "C:\WINDOWS\system32\") EndFunc Func __menuControlPanelRun2() Run("C:\WINDOWS\system32\control.exe") EndFunc Func __menuControlPanelRun3() Run("control.exe", "C:\WINDOWS\system32\") EndFunc Func __menuControlPanelRun4() Run("C:\WINDOWS\system32\control.exe", "C:\") EndFunc Func __menuControlPanelRun5() Run("RunDll32.exe shell32.dll,Control_RunDLL") EndFunc Func __menuControlPanelRun6() Run("RunDll32.exe shell32.dll,Control_RunDLL", "c:\") EndFunc Func __menuControlPanelRun7() Run("RunDll32.exe shell32.dll,Control_RunDLL", "C:\WINDOWS\system32\") EndFunc Func __menuControlPanelRun8() Run(@ComSpec & " /c " & 'RunDll32.exe shell32.dll,Control_RunDLL', "", @SW_HIDE) EndFunc in the above... all Control Panel "runs" work fine. Now compile it, right-click and run the exe as a different user and pls let me know if the Control Panel buttons still work or not. If they don't, can anyone see or tell me why not? I'm at a total loss... =/ My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
thepip3r Posted March 31, 2008 Author Share Posted March 31, 2008 Also tested the runas with the local computer admin account instead of an account with admin rights on the domain and i get the same result -- i'm guessing it's a syntax issue but don't know how to trap it. I've tried reading any errors through the recommended methods listed in the following link and nothing ends up popping up:http://www.autoitscript.com/autoit3/docs/f.../StderrRead.htmany guidance or direction would be greatly appreciated. My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
someone Posted March 31, 2008 Share Posted March 31, 2008 Are you only getting this problem when trying to run control panel as an admin? I believe there is some reason why you can't simply run the control panel as another user (I'm pretty sure its not just you). Try this code; RunAsSet('USER', @Computername, 'PASSWORD') Run("C:\Program Files\Internet Explorer\iexplore.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}") RunAsSet() I took this from a bat file I always use, it should work fine for you. While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
ResNullius Posted March 31, 2008 Share Posted March 31, 2008 Are you only getting this problem when trying to run control panel as an admin? I believe there is some reason why you can't simply run the control panel as another user (I'm pretty sure its not just you). Try this code; RunAsSet('USER', @Computername, 'PASSWORD') Run("C:\Program Files\Internet Explorer\iexplore.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{21EC2020-3AEA-1069-A2DD-08002B30309D}") RunAsSet() I took this from a bat file I always use, it should work fine for you.I think someone is on the right track. It's a Windows thing not just AutoIt. If I take your first post and compile make it into a batch file, then run it from the command prompt with Windows' RunAs command, nothing happens. More details can be found here: http://blogs.msdn.com/aaron_margosis/archi.../07/175488.aspx It's got to do with Windows' namespaces, etc, I think... Link to comment Share on other sites More sharing options...
thepip3r Posted April 1, 2008 Author Share Posted April 1, 2008 HOLY RETARDED WINDOWS!!! Basically what it boiled down to is Windows user switching sux and sux bad. It was Aaron Margosis' blog that finally cracked the code for me. Straight up name space addresses didn't work but doing some registry tweaking and spawning separate explorer processes in their own namespace is what finally did it. Someone: Ty for the attempt but it didn't work. Btw, is that a nintendo cartridge in ur sig? if so... love it. Resnullius: Ty so much for the article link, after perusing all of the different links it spawns you to and evaluating/testing the recommended deals, I finally got this to work. Ty for all your help guys. p.s. windows runas sux (if i haven't already mentioned that) =P My Additions:- RunAs AdminDeviant Fun:- Variable Sound Volume Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now