Solved

VB Translation of PSSHUTDOWN.EXE

Posted on 2006-11-08
8
1,968 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now