PDA

View Full Version : run services.msc ?



NewsArchive
06-08-2017, 03:44 AM
I'm attempting to open services.msc via a button (yes, the button
works<g>).

None of the "run" stuff I've tried has worked.

Any clues? Thanks.

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
06-08-2017, 04:19 AM
Hi Jeff,

Maybe run SC.EXE instead?

Graham

NewsArchive
06-08-2017, 04:20 AM
....

run('services.msc',1)

works from Clarion

Graham

NewsArchive
06-08-2017, 04:20 AM
Thanks. I'll try it from my SBUtil.dll instead.

Would be nice if I could do this inside SB, though. I'm sure there's a
trick. :)

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
06-08-2017, 04:21 AM
If I run it from my DLL, I get ErrorCode() 193 "Unknown Error Posted".

If I use the SB RUN, %SB_RETURN% is 0 the first time I call it, then
1. But no services.msc.

Could it be that it's an elevated process?

If I call services.msc from an elevated command prompt it works, just
like it does from a non-elevated command prompt.

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
06-08-2017, 04:21 AM
Jeff,

> If I run it from my DLL, I get ErrorCode() 193 "Unknown Error Posted".

From WinError.h

//
// MessageId: ERROR_BAD_EXE_FORMAT
//
// MessageText:
//
// %1 is not a valid Win32 application.
//
#define ERROR_BAD_EXE_FORMAT 193L

--
Lee White

RPM Report Viewer.: http://www.cwaddons.com/products/rpm/
Report Faxing.....: http://www.cwaddons.com/products/afe/
---Enroll Today---: http://CWaddons.com

Creative Reporting: http://www.CreativeReporting.com

Product Release & Update Notices
http://twitter.com/DeveloperPLUS

Windows 8 brings us "The Oval, Bumper Car, Roller Coaster of Wait!"
And, now, Windows 10 brings us "The Inch Worm, Bumper Car of Wait!"

NewsArchive
06-08-2017, 04:22 AM
Jeff,

> If I run it from my DLL, I get ErrorCode() 193 "Unknown Error Posted".

You'll need the MMC container, are you running MMC services.msc?

--
Lee White

RPM Report Viewer.: http://www.cwaddons.com/products/rpm/
Report Faxing.....: http://www.cwaddons.com/products/afe/
---Enroll Today---: http://CWaddons.com

Creative Reporting: http://www.CreativeReporting.com

Product Release & Update Notices
http://twitter.com/DeveloperPLUS

Windows 8 brings us "The Oval, Bumper Car, Roller Coaster of Wait!"
And, now, Windows 10 brings us "The Inch Worm, Bumper Car of Wait!"

NewsArchive
06-08-2017, 04:22 AM
Hi Lee, Jeff,

All I have in the Clarion 10 project I tested with is this...

PROGRAM

MAP
END

CODE
run('services.msc',1)

and it runs both from the IDE and standalone with no manifest, no
elevation nothing.
(Windows 8.1 Clairon 10 Build 12567)

Graham

NewsArchive
06-08-2017, 04:22 AM
What if you run your app elevated?

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
06-08-2017, 04:23 AM
Hi Jeff,

It runs and displays the service manager elevated or non-elevated.

Are you running this on a network maybe?

Graham

NewsArchive
06-08-2017, 04:23 AM
Win 8.1 desktop.

I'm glad it failed for me so I could "fix" it<g>

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
06-08-2017, 04:24 AM
Perfect. Thank you so much Lee. Now maybe I can get something done. :)

I owe you one.

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
06-08-2017, 04:24 AM
Jeff,

> Perfect. Thank you so much Lee. Now maybe I can get something done. :)
> I owe you one.

You already had more than one in the bank!<g>

Lee White

NewsArchive
06-08-2017, 04:25 AM
Hi Lee,

How come it works for me without MMC ?
Even if I create a Clarion DLL to RUN('services.msc',1) and then call
that DLL exported function from another Clarion EXE it still works?

Graham

NewsArchive
06-08-2017, 04:26 AM
If your app fails if you run it elevated, then I'm guessing there's no
associated application for .msc?

That doesn't explain why it works in an elevated prompt, though.

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
06-08-2017, 04:27 AM
Graham,

> How come it works for me without MMC ?

'cuz you're special or is that spatial?!<g>



I've always used the container by default so I suggested it.

--
Lee White

RPM Report Viewer.: http://www.cwaddons.com/products/rpm/
Report Faxing.....: http://www.cwaddons.com/products/afe/
---Enroll Today---: http://CWaddons.com

Creative Reporting: http://www.CreativeReporting.com

Product Release & Update Notices
http://twitter.com/DeveloperPLUS

Windows 8 brings us "The Oval, Bumper Car, Roller Coaster of Wait!"
And, now, Windows 10 brings us "The Inch Worm, Bumper Car of Wait!"

NewsArchive
06-08-2017, 04:27 AM
Hi Lee,

I'll accept that as a reason :-)

I've just uploaded the DLL and EXE I created to our work network
Windows 2012 R2 and I know I only have ordinary user rights there and
it still works !!!

Graham

NewsArchive
06-08-2017, 04:28 AM
Hi Jeff,

> I'm attempting to open services.msc via a button (yes, the button
> works<g>).
>
> None of the "run" stuff I've tried has worked.
>
> Any clues? Thanks.
>

See attached screenshots and the following demo project:

http://www.lindersoft.com/projects/services_msc.zip

Works fine on Win10.

Does this help?

Friedrich

NewsArchive
06-08-2017, 05:47 AM
> If I run it from my DLL, I get ErrorCode() 193 "Unknown Error Posted".
>
> If I use the SB RUN, %SB_RETURN% is 0 the first time I call it, then
> 1. But no services.msc.
>
> Could it be that it's an elevated process?
>
> If I call services.msc from an elevated command prompt it works, just
> like it does from a non-elevated command prompt.

The CreateProcess Windows API results in error 193 when trying to launch
services.msc from a non-elevated or elevated application. BTW, you have to
check %_SB_RETURNEX% in SB to get that error code.

Friedrich

NewsArchive
06-08-2017, 11:29 AM
Hi Friedrich -

Thank you very much. Yes it helps.

Now I know now to make it work 2 ways instead of no ways. :)

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
06-08-2017, 11:29 AM
> Thank you very much. Yes it helps.
>
> Now I know now to make it work 2 ways instead of no ways. :)

<G> ;-)

Friedrich