/* If we're running on OS/2 2.x and it's an LX style file, spawn off the OS/2 2.x sampler to collect things */ bool VersionCheck( void ) { USHORT env_sel; USHORT cmd_off; RESULTCODES res; DosGetVersion( &OSVer ); if( OSVer >= 0x1400 && IsLX() ) { if( DosSearchPath( 0x0003, "PATH", OS22SAMPLER, (unsigned char *)UtilBuff, sizeof( UtilBuff ) ) ) { InternalError( MsgArray[MSG_SAMPLE_8 - ERR_FIRST_MESSAGE] ); } DosGetEnv( &env_sel, &cmd_off ); if( DosExecPgm( NULL, 0, EXEC_ASYNC, MK_FP( env_sel, cmd_off ), NULL, &res, UtilBuff ) != 0 ) { InternalError( MsgArray[MSG_SAMPLE_9 - ERR_FIRST_MESSAGE] ); } _exit( 0 ); } return( OSVer >= 0x0a14 ); }
static char _WCFAR *OS_GET_CMD_LINE( void ) { unsigned short envseg, cmdoff; char _WCFAR *cmd; if( DosGetEnv( &envseg, &cmdoff) ) return( NULL ); cmd = MK_FP( envseg, 0 ); if( !*cmd ) ++cmd; /* adjust if null environment space */ while( *cmd ) { /* skip over environment space */ while( *cmd ) ++cmd; ++cmd; } ++cmd; while( *cmd ) ++cmd; /* skip over first copy of program name */ ++cmd; while( *cmd ) ++cmd; /* skip over second copy of program name */ ++cmd; return( cmd ); }