From e611b132f9b8abe35b362e5870b74bce94a1e58e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 16 May 2020 20:51:50 -0700 Subject: initial commit --- private/os2/client/os2test.c | 117 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 private/os2/client/os2test.c (limited to 'private/os2/client/os2test.c') diff --git a/private/os2/client/os2test.c b/private/os2/client/os2test.c new file mode 100644 index 000000000..690e9273b --- /dev/null +++ b/private/os2/client/os2test.c @@ -0,0 +1,117 @@ +/*++ + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + os2test.c + +Abstract: + + This is a test OS/2 application + +Author: + + Steve Wood (stevewo) 22-Aug-1989 + +Environment: + + User Mode Only + +Revision History: + +--*/ + +#define OS2_API32 +#define INCL_OS2V20_ERRORS +#define INCL_OS2V20_MEMORY +#define INCL_OS2V20_TASKING +#include + +VOID +CloneTest( PPID ChildPid ); + +BOOLEAN +IsClonedTest( VOID ); + +VOID +CloneTest( + PPID ChildPid + ) +{ + PPIB Pib; + PNT_TIB NtTib; + APIRET rc; + PCH src, Variables, ImageFileName, CommandLine; + CHAR ErrorBuffer[ 32 ]; + RESULTCODES ResultCodes; + + rc = DosGetThreadInfo( &NtTib, &Pib ); + if (rc != NO_ERROR) { + DbgPrint( "*** DosGetThreadInfo failed - rc == %ld\n", rc ); + return; + } + + src = Pib->Environment; + Variables = src; + while (*src) { + while (*src) { + src++; + } + src++; + } + src++; + ImageFileName = src; + CommandLine = "CLONETEST\000"; + rc = DosExecPgm( ErrorBuffer, + sizeof( ErrorBuffer ), + ChildPid == NULL ? EXEC_SYNC : EXEC_ASYNC, + CommandLine, + Variables, + &ResultCodes, + ImageFileName + ); + if (rc != NO_ERROR) { + DbgPrint( "*** DosExecPgm( %s, %s failed - rc == %ld\n", + ImageFileName, CommandLine, rc + ); + } + else { + if (ChildPid != NULL) { + *ChildPid = (PID)ResultCodes.ExitReason; + } + } +} + + +BOOLEAN +IsClonedTest( VOID ) +{ + PPIB Pib; + PNT_TIB NtTib; + APIRET rc; + + rc = DosGetThreadInfo( &NtTib, &Pib ); + if (rc != NO_ERROR) { + DbgPrint( "*** DosGetThreadInfo failed - rc == %ld\n", rc ); + return( FALSE ); + } + + if (!strcmp( Pib->CommandLine, "CLONETEST" )) { + return( TRUE ); + } + else { + return( FALSE ); + } +} + + +int +main( + int argc, + char *argv[], + char *envp[] + ) +{ + return( 0 ); +} -- cgit v1.2.3