--- os2sdk/demos/examples/session/session.c 2018/08/09 12:25:13 1.1 +++ os2sdk/demos/examples/session/session.c 2018/08/09 12:26:15 1.1.1.2 @@ -1,13 +1,15 @@ /* * This example demonstrates some of the session manager API + * + * Created by Microsoft Corp. 1987 */ -#include /* defines FP_SEG and FP_OFF */ +#define INCL_DOSSESMGR + +#include /* defines SELECTOROF and OFFSETOF */ #include #include -#include -#include - +#include #define TOTAL_COLMS 80 /* screen size in colms */ #define TOTAL_ROWS 24 /* screen size in rows */ @@ -21,8 +23,8 @@ extern unsigned _aenvseg; extern unsigned _acmdln; -short KidSID; /* Array of session IDs */ -short KidPID; +USHORT KidSID; /* Array of session IDs */ +USHORT KidPID; short Instance; char spbuf[80], pbuf[128], Inputs[10]; char Title[100] = "SESSION.EXE"; @@ -38,8 +40,8 @@ main(ac,av) * Grab the full path name of this program (the one used by EXECPGM()) * for use in creating child sessions. */ - FP_SEG(progname) = _aenvseg; /* This is standard C runtime stuff */ - FP_OFF(progname) = _acmdln-1; /* The Path name comes just prior to */ + SELECTOROF(progname) = _aenvseg; /* This is standard C runtime stuff */ + OFFSETOF(progname) = _acmdln-1; /* The Path name comes just prior to */ /* AV[0] - but remember this is in a */ while(*--progname) /* different segment than the rest of */ ; /* the program, thus the copy (below) */ @@ -102,8 +104,8 @@ void StartChild() { int rc; - struct StartData SDbuf; - unsigned SessionID, ProcessID; + STARTDATA SDbuf; + USHORT SessionID, ProcessID; if (KidSID != -1) { printf("Sorry, only one child at a time.\n"); @@ -115,16 +117,16 @@ StartChild() printf("Starting Child...\n"); - SDbuf.Length = sizeof(SDbuf); + SDbuf.cb = sizeof(SDbuf); SDbuf.Related = 1; /* Yes */ SDbuf.FgBg = 0; /* Start in the foreground */ SDbuf.TraceOpt = 0; /* Run the child synchronously, why? I dunno */ SDbuf.PgmTitle = spbuf; /* Title in session manager box */ SDbuf.PgmName = pbuf; /* Exec path (see main) */ SDbuf.PgmInputs = Inputs; /* Any command line arguments */ - SDbuf.TermQ = 0L; /* No notification queue */ + SDbuf.TermQ = 0; /* No notification queue */ - rc = DOSSTARTSESSION(&SDbuf, &SessionID, &ProcessID); + rc = DosStartSession(&SDbuf, &SessionID, &ProcessID); if (rc) printf("Failed, %d no more screens available\n", rc); @@ -146,7 +148,7 @@ KillChild() printf("Sorry, must start session before you can stop it.\n"); return; } - rc = DOSSTOPSESSION(0, KidSID, 0l); + rc = DosStopSession(0, KidSID, 0l); #ifdef DEBUG printf("Screen ID: %d\n", KidSID); #endif