WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Reboot and Shutdown Topics

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Watch for Shutdown, Do a Series of Things, and Reboot - Discussion from Webboard BBS

Keywords:  shutdown reboot Intcontrol(67 Incontrol 67  IntControl 1005

Help! After MANY hours of trying, I can't find a solution to this problem. I have an application that I
disable for SOME users. However this program then displays a large window that can't be minimized.

For this there are 2 easy solutions. 1) Exit the program. 2) Hide it with WinHide.

Now for the hard part and I'll try to simplify what I have tried.

If I exit the program I MUST force the user to either "Shutdown" or "Reboot". After much looking I can
not find any registry settings or API call that will 'gray out' the "Logoff" and "MS-DOS" options.

The WWW database has a solution, but it doesn't work. It calls for using 2 scripts. One using InControl
1005 and the other using IntControl 67. But these 2 absolutely REFUSE to work together (and I've tried
a couple dozen combinations!)

On the WinHide solution I can use IntControl 1005 to un-hide the window. The problem here, as it turns
out, is that the window must be unhide BEFORE the logoff starts or it remains inactive when the next user
logs on, no matter who they are! I could stop the logoff and then unhide the window, but that calls for the
same 2 script solution (above) that doesn't work.

What I need is a IntControl 67 that doesn't kill the IntControl 1005.

Can you fix it or devise a new IntControl?

--Don 

Why is IntControl 1005 getting involved? --Marty
>Why is IntControl 1005 getting >involved? See the answer at http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/How~To/Reboot~and~Shutdown~Topics+Prevent~Automatic~Reboot~after~20~Second~Shutdown.txt FYI This is a Win95B computer running compiled 99G scripts from a network share. --Don
And you are trying to prevent a reboot? Or copy files? or? --Marty
???!!!??? I know it's been a busy day and I'm more than a little bit frustrated, so take a brake and when you're rested go to post #1 and slowly read through the thread. --Don
>I have an application that I >disable for SOME users. Pehaps the name of this application? Word? Excel? Some other third party app? A Winbatch script you wrote? >However this program then >displays a large window that >can't be minimized. So somehow the application runs, but you want to restrict the users who can actually use it - and you cannot prevent it from running in the first place? > >For this there are 2 easy >solutions. >1) Exit the >program. > 2) Hide it with WinHide. > >Now for the hard part and I'll >try to simplify what I have >tried. > >If I exit the program I MUST >force the user to either >"Shutdown" or "Reboot". After >much looking I can not find >any registry settings or API >call that will 'gray out' the >"Logoff" and "MS-DOS" options. > So, assuming it is some third pary application that somehow managed to get itself launched by an unauthorized user. You have a script that detects that it was launched. You want the program to exit. Presumably you send it keystrokes to exit, or use IntControl 56 to shoot it. Then do an IntControl(67,0,1,0,0) to force a reboot. >The WWW database has a >solution, but it doesn't work. >It calls for using 2 scripts. >One using InControl 1005 and >the other using IntControl 67. >But these 2 absolutely REFUSE >to work together (and I've >tried a couple dozen >combinations!) The post-referenced article seems to discuss preventing a shutdown. Its not clear how or why it got involved in this problem. > >On the WinHide solution I can >use IntControl 1005 to un-hide >the window. The problem here, >as it turns out, is that the >window must be unhide BEFORE >the logoff starts or it >remains inactive when the next >user logs on, no matter who >they are! I could stop the >logoff and then unhide the >window, but that calls for the >same 2 script solution >(above) that doesn't work. The window survives a logoff? It sounds like some kind of service interacting with the desktop. Is this a 95 or NT workstation. If NT maybe the service control functions can shut it down. Maybe the script with the IntControl 67 can shoort the script with the 1005 and unhide the window itself right before it shuts down? Or get rid of the 1005 script entirely, and the shutdwon script does the unhide before the intcontrol 67? > >What I need is a IntControl >67 that doesn't kill the >IntControl 1005. > Its not clear what "kill" means. >Can you fix it or devise a new >InControl? Before I can ask the developers to make a change I have to have better understanding of what it is that is required. --Marty
A new day. Lets forget about the open app. It's really irrelevant to the solution I'm looking for. I only added it for context. What I want to do is control a user's shutdown options. Let them work as long as they like but when they go to logoff or shutdown they only have 1 or 2 options available to them, the others being grayed out. A networked Win95 system has 4 shutdown options. I'd like to be able to gray out any combination of them. These options should be grayed out only while the script is running. Much like incontrol 12 only works while running. This is my wish list control. Short term is the clever idea in the database. Have 2 scripts running, each set to react to a Windows shutdown request. One script use intcontrol 12 to stop any type of shutdown request. The other script using intcontrol 1005, then kills the first (intcontrol 47) and proceeds to reboot (intcontrol 67) or whatever. It's not as elegant or as flexible, but it would get the job done. However, in 99G, I can not get any combination of intcontrol 12 and intcontrol 1005 to work. They appear to be mutually exclusive. --Don
And it gets worse. the 95/98 shutdown sequence is different from the NT shutdown sequence. I think you are referring to 95/98 First Windows 95 asks all the apps "OK to shutdown". The IntControl 12 says NO. And thats that. It ain't gonna shutdown. Under windows NT, it picks one app (almost at random) and asks it "OK to shut you down". If the app says Yes, the app is shutdwon and it goes on to the next app. 1) Isn;t there a policy editor that can do that sort of stuff? Otherwise any solutions I can come up with involved hopeless kludges involving monitoring for the presence of the shutdwon box and immediately graying out options with the Control Manager extender. Kind of a high-cpu option. --Marty
hmm. How about a service, that if someone logs off, shuts down the computer? It's not quite what you want, but it might work and be easier to boot. Sounds easier than rewriting the win api, not to mention NT's native api ;-) --James
95/98 policies will allow you to prevent a shutdown. 98 can remove logoff from start menu. And I think that's it. I only like to use policies when there is no other option. They're to inflexable. The folks a Fortus Grand have figured out a way to gray out options on the shutdown page while their product is running. Seems like IE4 caused a problem on one of the options. Still, it must be possiable if they did it. In the 2 script scenario, why not rewrite intcontrol 12 so that after it stops a shutdown it sends a message to any waiting intcontrol 1005 to go ahead and do its thing? --Don
Not that easy. I'll think about it some more. --Marty
Or maybe a new switch for IntControl 12 that allows it to process some code or fire off a script? --Don
I have been giving this some thought and have a machine searching all the DLLs on a machine to find where the text is. I thought maybe if you could even change what the options said that might be an answer. At WinMag.com there is woman that writes the Power Tools or something like that column. I remember her coding a program that would give a systray icon with several options - one of which was to process EXEs in a folder called C:\Windows\ShutDown, when a shutdown the system request was received. Maybe? I don't know. Hmmm. Also maybe see... http://www.wmsoftware.com/shutdownplus/ I am heading out for the evening, but unless someone beats me to it - I will "discover" this program in the morning and find out what files it hits to change the shutdown box... --Todd
A free utility to run programs at shutdown, the name is "Shutup": http://hotfiles.zdnet.com/cgi-bin/texis/swlib/hotfiles/pcmag_info.html?fcode=000OHU&b=pcm --Joe
Thanks guys! I'll take a look and report back. --Don
Don, we had a not dissimmilar problem a year or so ago. We wanted users not be be able to change the time, but to allow them to change time zone. In the end, the simple answer was using Visual c++, or specifically the resource editor in here. From within here, you can open the dll as a resource, edit the dialog box and delete the buttons that you don't want. So you're Winbatch program would copy over the real resource dll with your one when its running, and then copy the correct one back on exit. Not ideal, but worked a treat for us! The resource editor is very easy, just install vc++, open a file, and open 'as resource'. The rest is straightforward, though do take care! --Mark
I kind of like the idea about modifying the resources attached to whatever DLL file supplies the dialog box. However, this might drive some virus checkers crazy if the modified copy of the DLL file gets left in place due to a crash and the virus checker is one of the ones that innoculates files. Also, you run into supportability issues with Microsoft - any alterations to MS supplied DLL's sort of makes them shun you more than they normally do when it comes to support. I was not able to find any references to "Fortus Grand" on DejaNews, so I cannot say anything further about how their product might work. I have, however, worked with a product that is used to "secure" Win95 and it is called FoolProof 95. This product installs itself as a VXD and puts hooks in place to intercept many of the Win32 API calls. By doing this it more or less takes a lot of control over what can be done even through Win32 API calls. However, it had many stability problems when I worked with it about 18 months ago. I don't know if the product was improved at all after I stopped working with it. One of its features, as I recall, was the ability to alter the shutdown/restart/logout options on the shutdown dialog box. This leads me to believe that this can be safely done if only the correct registry settings or API calls can be determined. One other option exists that I know of and it may be only slightly kludgy. Here it is... Use the 'NoClose' registry entry (refer to the Win95 policy editor ADMIN template) to completely disable the 'Shutdown' option on the Start Menu. Then put your own shortcut directly on the 'Start Menu' that runs your own shutdown utility (perhaps a WinBatch script). The 'NoClose' registry entry only affects the Windows Explorer's ability to display the shutdown dialog box but it does not disable the Win32 API function that actually performs a shutdown, thus you can initiate your own shutdown via the IntControl() function. --Chuck
Mark, Chuck, Thanks for your ideas. While I have taken a semester of C++, I don't think my current skill level is up to the task. I'll have to wait and see what the great minds at WindowWare come up with. Chuck, Fortres 101 is at http://www.fortres.com I believe you can download a trail version. They have since moved to version 4, which I have not seen. Near the end of version 3 they gave up using their own shutdown window and found a way to gray out options on the MS shutdown. Mark, Thanks for the tip! I've had a chance to check it out. It may not solve my problem but, oh the possibilities! Maybe I'll add a caption under the owl on the WB Studio splash screen--"The Original Marty Pants"...:-) --Don
I used a utility program called "RegMon.EXE" to spy on all registry API calls that occur while initiating a system shutdown. What I was able to determine is that only the "NoClose" registry value is looked for under the current user's explorer policy settings. This leads me to believe that greying out some of the other options on the shutdown dialog box for Win9x is done either via registry entries that are only read when the explorer is initialized or is not done via the registry at all. --Chuck

Article ID:   W14154
Filename:   Shutdown Discussion.txt
File Created: 2017:08:29:11:58:52
Last Updated: 2017:08:29:11:58:52