Annotation of q_a/samples/bob/readme.txt, revision 1.1.1.1

1.1       root        1:  Sample: BOB (Big Orange Button)
                      2: 
                      3: Summary:
                      4: 
                      5: The BOB sample demonstrates the steps necessary to reboot
                      6: or shutdown the machine in Win32/NT and Win32s/MS-DOS
                      7: programmatically. A very similar method can be used to log
                      8: a user off. Basically the steps necessary are as follows
                      9: 
                     10: 1) Check to see if the machine is running Win32/NT; if so
                     11: 
                     12: a) first get the security token.
                     13: b) Fetch the LUID for the SeShutdownPrivilege; this is only
                     14:    required for rebooting and shutting down the machine.
                     15: c) Enable the shut down privilege.
                     16: 
                     17: 2) Use ExitWindowsEx() to log off, shut down or reboot the
                     18:    machine.
                     19: 
                     20: More Information:
                     21: 
                     22: Obviously one should use this API with care *and* with plenty
                     23: of warning so a user is not rudely surprised.
                     24: 
                     25: There are two methods of preventing the system from shutting
                     26: down one is at the App level and the other the System level.
                     27: At the application level what one needs to process is the
                     28: WM_QUERYENDSESSION so it can ask the user if they wish to save
                     29: any data which has not been back up to disk. Finally return
                     30: TRUE assuming the process can shut down safely or FALSE if
                     31: it can not (NOTE this will not keep one from dying if the
                     32: parameter to ExitWindowsEx() was or'ed with EXW_FORCE).
                     33: At the system level one is able to remove the rights of
                     34: certain users/groups to reboot the machine. This is done
                     35: via the UserManager applet.
                     36: 
                     37: Enjoy

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.