home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl150a.zip / OCL / Source / OVioApp.cpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  2KB  |  90 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OVioApp.cpp
  5.  
  6. // OVioApp ia a base class for VIO-Applications
  7.  
  8.  
  9. /*
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  16.  *    endorse or promote products derived from this software
  17.  *    without specific prior written permission.
  18.  * 3. See OCL.INF for a detailed copyright notice.
  19.  *
  20.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  21.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  24.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  26.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  28.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  29.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30.  * SUCH DAMAGE.
  31.  */
  32.  
  33. // $Header: W:/Projects/OCL/Source/rcs/OVioApp.cpp 1.50 1996/08/11 23:49:35 B.STEIN Release $
  34.  
  35. #define __OCL_SOURCE__
  36.  
  37. #define OINCL_OSTRING
  38. #define OINCL_BASE
  39.  
  40. #include <ocl.hpp>
  41. #include <OVioApp.hpp>
  42.  
  43.  
  44. OVioApp::OVioApp()
  45.   {}
  46.  
  47. OVioApp::OVioApp(const ULONG num, CHAR *Parms[])
  48.   : OAppBase(num, Parms)
  49.   {}
  50.  
  51. OVioApp::~OVioApp()
  52.   {}
  53.  
  54. PSZ OVioApp::isOfType() const
  55.  return("OVioApp"); 
  56.  
  57. void OVioApp::Shutdown()
  58. {
  59.  DosShutdown(0L);
  60. }
  61.  
  62. void OVioApp::forceQuit()
  63. {
  64.  _exit(0);
  65. }
  66.  
  67.  
  68. void OVioApp::Reboot()
  69. {
  70.  HFILE  hf;
  71.  ULONG  dummy;
  72.  
  73.  if (!DosOpen("DOS$", &hf, &dummy, 0L, FILE_NORMAL, FILE_OPEN,
  74.               OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_FAIL_ON_ERROR, 0L))
  75.   {
  76.    ULONG ulParmLength = 0;
  77.    ULONG ulDataLength = 0;
  78.  
  79.    DosShutdown(0L);
  80.    DosDevIOCtl(hf, 0xd5, 0xab,           // Reboot
  81.                NULL, 0L, &ulParmLength,
  82.                NULL, 0L, &ulDataLength );
  83.    DosClose( hf );
  84.   }
  85. }
  86.  
  87. // end of source
  88.