Jump to content
The simFlight Network Forums

Recommended Posts

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?

Link to post
Share on other sites

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

Link to post
Share on other sites

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

Link to post
Share on other sites
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

Link to post
Share on other sites

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

Link to post
Share on other sites

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.

Link to post
Share on other sites
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

Link to post
Share on other sites

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

Link to post
Share on other sites

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

Link to post
Share on other sites

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.

Link to post
Share on other sites
  • 2 weeks later...
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

Link to post
Share on other sites
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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.