Solved

VB Translation of PSSHUTDOWN.EXE

Posted on 2006-11-08
8
1,984 Views
Last Modified: 2008-01-09
Hello Experts!

Does anybody know of a VB translation of Mark Russinovich's PSSHUTDOWN.EXE program?

I want to incorporate this program's functionality into my own VB application.  I've found the VB translation of his another utility program PSLOGGEDON.EXE at http://www.mvps.org/access/api/api0062.htm, in which the original source code (in C/C++) was available for download from www.sysinternals.com.  So, I'm wondering if the aforementioned program (written in C/C++) has been translated into VB.

In short, I want my VB app to do exactly the same thing.  That is, be able to support all following 4 types of operation on a remote machine:

 1. Logoff
 2. Shutdown
 3. Reboot
 4. Poweroff

I already knew and have tried both following Win32 APIs:

 1. ExitWindowsEx - this supports all 4 above types of operation, except that it ONLY apples to the LOCAL machine.
 2. InitiateSystemShutdownEx - this seems to be the one I wanted, except that it DOES NOT have or support the "logoff" method.

I could include the PSSHUTDOWN.EXE and create a MSI installation package to be distributed along with my compiled app so that I can use the "shell" function, but I just want my app to be a pure, stand-alone application.

Any help would be greatly appreciated.
0
Comment
Question by:jkaios
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 17902944
0
 
LVL 12

Author Comment

by:jkaios
ID: 17903400
Thanks gecko.  That uses the InitiateSystemShutdown API, which DOES NOT support the "Logoff" operation.

In fact, somebody (shijusn) already provided this link to my previous question at: http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_22038122.html
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 17913658
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:gecko_au2003
ID: 17916127
I did mention wmi above but I havent had much of a chance lately to have a look around for examples on how to remotely restart, shutdown, log off etc using wmi but will have a look tommorow , so if that wmiRescue zip does not help then post back and I will post back with some wmi examples :)
0
 
LVL 12

Author Comment

by:jkaios
ID: 17926667
Thanks EDDYKT, but what I preferred was to use API instead due to the fact that when using the WMI's "Win32Shutdown" method of the "Win32_OperatingSystem" class on Windows XP Service Pack 2, it really slows down the process, and most of the time fails when the Firewall is turned on.

In fact, I've already developed a fully functional app (using WMI) that does this, but the problem started when Windows XP SP2 was released.  Until now it still works, however, it is REALLY slow as a result of the heavy security in XP SP2.  Note that this problem does not apply to W2K machines.

The reason why I wanted a translation of the PSSHUTDOWN.EXE is because it bypasses those XP security.  The built-in utility (Shutdown.exe) that came with XP and Server 2003 is great, except that it does not support the "logoff" method.

I've been wondering what sort of or combination of API's did Mark Russinovich use in his wonderful PSSHUTDOWN.EXE program?
0
 
LVL 12

Author Comment

by:jkaios
ID: 18120643
I just found out the trick that PSSHUTDOWN.EXE uses is that it quietly copies a file named PSSDNSVC.EXE to the hidden ADMIN$ share on the target machine (either in "C:\Windows" or "C:\WinNT" depending on target machine's OS).

This file is then installed on the target machine as a service, and clearly, runs as a client/server application.  After the requested action has been performed on the target machine, then calling program (PSSHUTDOWN.EXE) then deletes PSSDNSVC.EXE from the target machine.  The Event Viewer shows all the traces when this service was installed and removed.

I thought there were some other fancy (undocumented) API's that support remote logoff other than the InititateSystemShutdown.  Perhaps, Mark could be using a different technique other than what I assumed, who knows.  The guy is a genius and he even has a very good article on Win32 APIs versus Native APIs.

Therefore, I 'm gonna ask the Moderator to close this question.
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 18193183
Closed, 500 points refunded.
PashaMod
Community Support Moderator
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question