StuartWhelan Posted March 12, 2003 Report Posted March 12, 2003 Hi Folks, I have 7 PC's in my flight sim network, and I have been tryign tget wideFS to shut them all down. I have set the AllowShutdown=Yes in all the INI files, but when I send 0xABCD to the address in FSUIPC (or use the PM CDU) to shutdown, all the PC's just log off and sit at a login prompt. I am using Windows 98SE... Any ideas?
Pete Dowson Posted March 12, 2003 Report Posted March 12, 2003 Hi Stuart, >> I have set the AllowShutdown=Yes in all the INI files, but when I send 0xABCD to the address in FSUIPC (or use the PM CDU) to shutdown, all the PC's just log off and sit at a login prompt. << That was a problem with an older version of WideClient, it used a "ShutDown" call to Windows (which I thought would do -- the PM CDU actually uses it) -- but in fact the "POWEROFF" call is the one which works. It should therefore be okay with WideFS 5.41 -- provided, of course, your Win98SE mobos do allow shutdown completely too. If the PC does power down from the "Shutdown" options. then it should work. Regards, Pete
StuartWhelan Posted March 13, 2003 Author Report Posted March 13, 2003 It should therefore be okay with WideFS 5.41 -- Great stuff, I just checked and we are using 5.408, I will do an update this weekend. Many Thanks! Stuart.
StuartWhelan Posted March 20, 2003 Author Report Posted March 20, 2003 Hi Pete, I upgraded WideFS and WideClient to 5.41.. I am still getting the same effect though, when I choose shutdown all pc's all the WideClient logs show: 4357730 Shutdown request received! 4357730 Running on Win95/98/ME, no need for Privilege and then they just log out and stay at the login prompt. All the PC's normally start up without that login prompt being shown.. The PC's all shutdown properly and completely when the 'Shutdown' option is chosen off the start menu... Very puzzling! Attached is the WideServer ini and log, and a Wideclient ini and log Cheers, Stuart. StuartShutdownFiles.zip
Pete Dowson Posted March 20, 2003 Report Posted March 20, 2003 I am still getting the same effect though, when I choose shutdown all pc's all the WideClient logs show: 4357730 Shutdown request received! 4357730 Running on Win95/98/ME, no need for Privilege and then they just log out and stay at the login prompt. The second comment simply means that it is by-passing NT/2K/XP-only code which I found I had to add to make it work at all on those operating systems. That code isn't even valid on win98. All the shutdown code is doing, and this is immediately after the message above, is calling ExitWindowsEx(EWX_POWEROFF, 0); According to the Microsoft MSDN reference this does the following: "EWX_POWEROFF Shuts down the system and turns off the power. The system must support the power-off feature. Windows NT/2000: The calling process must have the SE_SHUTDOWN_NAME privilege." HOWEVER, I have just found another note in the same source, one I'd not seen before: "Windows 95/98: Because of the design of the shell, calling ExitWindowsEx with EWX_FORCE fails to completely log off the user (the system terminates the applications and displays the Enter Windows Password dialog box, however, the user's desktop remains.) To log off the user forcibly, terminate the Explorer process before calling ExitWindowsEx with EWX_LOGOFF and EWX_FORCE." Now I'd not noticed this before because I am not using "EWX_FORCE" -- it warns me specifically NOT to use this by the statement "This can cause the applications to lose data. Therefore, you should only use this flag in an emergency." So, I'm in a bit of a quandary. Seems I need to somehow terminate the Explorer processI'm not sure how to do that. I'll see if I can fit time in to experiment. Regards, Pete
Pete Dowson Posted March 20, 2003 Report Posted March 20, 2003 Hi again Stuart, Well, I found a way of ennumerating all the Processes (using ToolHelp), and having found the EXPLORER process, obtaining its Process Handle and using this to Terminate it before trying to shut down forcibly, and ... ... it made no difference! So much for Microsoft knowing their own programming! Sorry, I can't find any way at all of actually shutting down a Win98/Me system from a program. If any other readers know how to do this, please let me know. Meanwhile I'm afraid I'll just have to change the WideFS documentation to say that the shut down option can only be used to shut down the PC on Win2K or XP. Regards, Pete
StuartWhelan Posted March 20, 2003 Author Report Posted March 20, 2003 Hi Pete, Thanks for taking the time to look, I will throw this problem to my development team today and see what they can come up with. What language are you developing in? Cheers, Stuart.
StuartWhelan Posted March 20, 2003 Author Report Posted March 20, 2003 Actually, it just occured to me that the Project Magenta CDU 'ShutDown This PC' option works and shuts down the local PC.. It is a Win98_SE PC.. Perhaps Katy or Enrico could provide a pointer/code segment? Of course it will be in Visual Basic, but you can't have everything. :) :) :) Cheers, Stuart.
Pete Dowson Posted March 20, 2003 Report Posted March 20, 2003 Actually, it just occured to me that the Project Magenta CDU 'ShutDown This PC' option works and shuts down the local PC.. It is a Win98_SE PC. But it doesn't do a thing on Win2000 or WinXP. I sent Enrico the code amendment to get it to work on XP. Both his code and mine were once the same. This should mean that WideFS 5.30 or earlier would have shut down your PC -- but that uses the "SHUTDOWN" call, not the "POWER OFF" call, and folks complained that it didn't power off, only went to the place where Windows said "you can now turn your PC off". I'll try reverting the code to the way it was (and, I think, PM still is) and check it on my one remaining Win98 PC. It is VERY confusing! Regards, Pete
Pete Dowson Posted March 21, 2003 Report Posted March 21, 2003 Hi again Stuart, RightI reverted my code to the way it used to be before I made it work on XP, and it DOES shut down Windows 98 okay. The problem seems to be that on Win98 the "SHUTDOWN" keyword is needed to power off the PC, whereas on WinXP the POWEROFF keyword is needed. If I use the POWEROFF keyword on Win98, it merely logs off the user (AND, I notice, leaves a WideClient process running in the background!). So much for Microsoft reference documentation! Sorry about that. It'll be fixed in version 5.50 of WideFS which I'll release soon, maybe over this weekend. I've changed the default to TCP/IP and made a few other tidy-up/cosmetic improvements too. Regards, Pete
StuartWhelan Posted March 23, 2003 Author Report Posted March 23, 2003 Morning Pete, Fantastic news, I will look forward to seeing it. :) It will certainly make shutting down our pit much easier. Many thanks for all your time! Cheers, Stuart.
guru Posted March 30, 2003 Report Posted March 30, 2003 Hi Pete (hopefully you're reading this AFTER your holiday), I wonder if you can introduce a new option for wideclient.ini that lets the user choose which system call to use for shutting down: Either SHUTDOWN or POWEROFF or whatever. Would be very helpful especially in a mixed environment (like mine :wink: ). Maybe this is a stupid question, but I'm not really a windows programmer (only U**X). Just wanted to know it 8) Best regards! Michael
StuartWhelan Posted March 30, 2003 Author Report Posted March 30, 2003 I imagine that Pete will implement the shutdown in such a way that it uses SHUTDOWN on Win9X and POWEROFF on NT. In fact, if I am not mistaken that code to perform this check is already in place, as on NT and above a user privilege escalation has to take place before the shutdown can be initiated.
Pete Dowson Posted April 14, 2003 Report Posted April 14, 2003 I imagine that Pete will implement the shutdown in such a way that it uses SHUTDOWN on Win9X and POWEROFF on NT. Yes. In fact I got this working okay just before I went on holiday, but didn't have time to make a release with it included. I'll try to get an interim update out soon, before I plough back into FS9 work. Regards, Pete
Pete Dowson Posted April 14, 2003 Report Posted April 14, 2003 I imagine that Pete will implement the shutdown in such a way that it uses SHUTDOWN on Win9X and POWEROFF on NT. Yes. In fact I got this working okay just before I went on holiday, but didn't have time to make a release with it included. I'll try to get an interim update out soon, before I plough back into FS9 work. Regards, Pete
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