home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
REXXBOOT.ZIP
/
REXXBOOT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-12
|
3KB
|
103 lines
/* rexxboot.c */
#define INCL_REXXSAA
#define _DLL
#define _MT
#define INCL_DOS
#define INCL_NOPM
#include <os2.h>
#include <rexxsaa.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
RexxFunctionHandler SysReboot;
RexxFunctionHandler SysSyncDisk;
/*********************************************************************/
/* Numeric Return calls */
/*********************************************************************/
#define INVALID_ROUTINE 40 /* Raise Rexx error */
#define VALID_ROUTINE 0 /* Successful completion */
/*********************************************************************/
/* Some useful macros */
/*********************************************************************/
#define REXXRET(val) { \
itoa( val, prxRet->strptr, 10 ); \
prxRet->strlength = strlen( prxRet->strptr ); \
}
#define REXXENTRY(f) \
ULONG f( PSZ pszName, /* name func invoked as */ \
ULONG cArgs, /* number of arguments */ \
RXSTRING argv[], /* argument array */ \
PSZ pszQueue, /* name of current queue*/ \
PRXSTRING prxRet ) /* string for func res */
#define BUILDRXSTRING(t, s) { \
strcpy((t)->strptr,(s));\
(t)->strlength = strlen((s)); \
}
/*************************************************************************
* Function: SysReboot *
* *
* Syntax: *
* *
* Return: *
*************************************************************************/
REXXENTRY(SysReboot)
{
HFILE hf;
APIRET rc;
ULONG dummy;
if (cArgs)
return INVALID_ROUTINE;
if (!(rc = DosOpen( "DOS$", &hf, &dummy, 0L, FILE_NORMAL, FILE_OPEN,
OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYNONE |
OPEN_FLAGS_FAIL_ON_ERROR, 0L )))
{
ULONG ulParmLength = 0;
ULONG ulDataLength = 0;
DosShutdown( 0L );
// DosDevIOCtl( NULL, NULL, 0xab, 0xd5, hf ); /* 1.3 reboot */
DosDevIOCtl( hf, 0xd5, 0xab, /* 2.0 reboot */
NULL, 0L, &ulParmLength,
NULL, 0L, &ulDataLength );
DosClose( hf );
}
REXXRET(rc);
return VALID_ROUTINE;
}
/*************************************************************************
* Function: SysSyncDisk *
* *
* Syntax: *
* *
* Return: *
*************************************************************************/
REXXENTRY(SysSyncDisk)
{
if (cArgs)
return INVALID_ROUTINE;
DosShutdown( 1L );
REXXRET(0);
return VALID_ROUTINE;
}
/* $Log$
*/