Solved

VB Translation of PSSHUTDOWN.EXE

Posted on 2006-11-08
8
1,976 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
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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

776 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