home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
SHUTDOWN.ZIP
/
SHUTDOWN.C
next >
Wrap
C/C++ Source or Header
|
1990-01-21
|
2KB
|
50 lines
/* for use with OS/2 1.2 */
/* compile with cl shutdown.c */
/* simple with the right #include files, darn difficult otherwise.
so here is the declaration for shutdown, very handy when using
alternate PROTSHELLs with High Performance File System */
extern unsigned int far pascal DosShutdown(unsigned long reserved);
extern unsigned int far pascal DosGetVersion(unsigned int far * version);
/* (high byte = major version number, low byte = minor version number ); */
/* now why can't MSC include files be so straightforward? */
char shutdownmessage[] = "\n\
DosShutdown is an OS/2 kernel function which closes down the file\n\
system and ends all processes. Proceed with shutdown? (y,n) ";
char shutdownmessage2[] = "\n\n\
When all disk activity has stopped turn the power off or reboot the\n\
computer with <ctl-alt-del> ";
main()
{
char c;
unsigned int Version;
unsigned char MajorVersionNumber;
unsigned char MinorVersionNumber;
DosGetVersion((unsigned int far *) &Version);
MajorVersionNumber = (Version >> 8) / 10;
MinorVersionNumber = (Version & 0x00FF) / 10;
printf("\nThe OS/2 version number is %d.%d\n",
MajorVersionNumber,MinorVersionNumber);
if(MinorVersionNumber < 2)
{
printf("Shutdown is not available with this version of OS/2");
exit(1);
}
printf("%s",shutdownmessage);
c = getch();
if(c == 'y' || c == 'Y')
{
printf("%s",shutdownmessage2);
DosShutdown(0L);
}
printf("\n\nFile system not shutdown");
}