Changeset 4164 for trunk/src/win32k/test
- Timestamp:
- Sep 2, 2000, 11:08:23 PM (25 years ago)
- Location:
- trunk/src/win32k/test
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/test/dos.c
r3829 r4164 1 /* $Id: dos.c,v 1. 1 2000-07-16 22:18:14bird Exp $1 /* $Id: dos.c,v 1.2 2000-09-02 21:08:20 bird Exp $ 2 2 * 3 3 * Thunkers for OS/2 APIs. … … 22 22 *******************************************************************************/ 23 23 #include <os2.h> 24 25 #include "devSegDf.h" /* Win32k segment definitions. */ 24 26 25 27 #include "test.h" -
trunk/src/win32k/test/fake.c
r3829 r4164 1 /* $Id: fake.c,v 1. 1 2000-07-16 22:18:14bird Exp $1 /* $Id: fake.c,v 1.2 2000-09-02 21:08:20 bird Exp $ 2 2 * 3 3 * Fake stubs for the ldr and kernel functions we imports or overloads. … … 29 29 #include <string.h> 30 30 31 #include "devSegDf.h" /* Win32k segment definitions. */ 32 31 33 #include "log.h" 32 34 #include "OS2Krnl.h" … … 60 62 * Pointer to the loader semaphore. 61 63 */ 62 static LONG lfakeLDRSem = 0; /* Used as a counter. */ 63 HKMTX fakeLDRSem = (HKMTX)&lfakeLDRSem; 64 KSEMMTX fakeLDRSem; 65 66 CHAR szBeginLibPath[1024]; 67 CHAR szEndLibPath[1024]; 68 CHAR szLibPath[1024]; 69 PSZ fakeLDRLibPath = &szLibPath[0]; 70 71 CHAR szldrpFileNameBuf[CCHMAXPATH]; 72 PSZ fakeldrpFileNameBuf = &szldrpFileNameBuf[0]; 64 73 65 74 static CHAR achHeaderBuffer[256]; /* Buffer to read exe header into. */ 66 75 PVOID pheaderbuf = &achHeaderBuffer[0]; 76 67 77 68 78 /* … … 112 122 VOID LDRCALL fakeldrUCaseString(PCHAR pachString, USHORT cchString); 113 123 ULONG LDRCALL fakeldrMTEValidatePtrs(PSMTE psmte, ULONG ulMaxAddr, ULONG off); 124 unsigned short getSlot(void); 125 126 127 128 /** 129 * Initiate workers (imported kernel functions / vars) 130 * @status partially implemented. 131 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 132 */ 133 void workersinit(void) 134 { 135 APIRET rc; 136 137 /* 138 * Make code writable. 139 */ 140 DosSetMem(&CODE16START, &CODE16END - &CODE16START, PAG_WRITE | PAG_READ); 141 DosSetMem(&CODE32START, &CODE32END - &CODE32START, PAG_WRITE | PAG_READ); 142 143 /* 144 * Loader semaphore 145 */ 146 fakeKSEMInit((PKSEM)(void*)&fakeLDRSem, KSEM_MUTEX, KSEM_DEFAULT); 147 148 /* 149 * Intra process semaphore. 150 */ 151 fakeKSEMInit((PKSEM)(void*)&fakeptda_ptdasem, KSEM_MUTEX, KSEM_DEFAULT); 152 153 /* 154 * LIBPaths 155 */ 156 rc = DosQueryExtLIBPATH(szBeginLibPath, BEGIN_LIBPATH); 157 rc = DosQueryHeaderInfo(NULLHANDLE, 0, szLibPath, sizeof(szLibPath), QHINF_LIBPATH); 158 rc = DosQueryExtLIBPATH(szEndLibPath, END_LIBPATH); 159 160 rc = rc; 161 } 114 162 115 163 … … 169 217 if (pfl != NULL) 170 218 *pfl = 0; 219 rc = DosQueryPathInfo(pszFilename, FIL_QUERYFULLNAME, fakeldrpFileNameBuf, CCHMAXPATH); 220 rc = NO_ERROR; 171 221 } 172 222 … … 712 762 ULONG LDRCALL fakeLDRClearSem(void) 713 763 { 714 if (lfakeLDRSem == 0) 715 kprintf(("fakeLDRClearSem: lfakeLDRSem is 0 allready\n")); 716 else 717 lfakeLDRSem--; 718 719 printf("fakeLDRClearSem: usage count = %d, rc = %d\n", lfakeLDRSem, NO_ERROR); 720 721 return NO_ERROR; 764 return fakeKSEMReleaseMutex(&fakeLDRSem); 722 765 } 723 766 … … 730 773 * @remark 731 774 */ 732 ULONG KRNLCALL fakeKSEMRequestMutex(HKMTX hkmtx, ULONG ulTimeout) 733 { 734 (*(PLONG)hkmtx)++; 735 736 printf("fakeKSEMRequestMutex: hkmtx = %p, ulTimeout = 0x%x, usage count = %d, rc = %d\n", 737 hkmtx, ulTimeout, *(PLONG)hkmtx, NO_ERROR); 738 739 return NO_ERROR; 775 ULONG KRNLCALL fakeKSEMRequestMutex(HKSEMMTX hkmtx, ULONG ulTimeout) 776 { 777 unsigned short usSlot = getSlot(); 778 ULONG rc = NO_ERROR; 779 780 if (memcmp(&hkmtx->debug.ksem_achSignature[0], "KSEM", 4) != 0) 781 { 782 printf("fakeKSEMQueryMutex: hkmtx = %p, invalid signature (%.4s)\n", hkmtx, hkmtx->debug.ksem_achSignature); 783 return FALSE; 784 } 785 786 if (hkmtx->debug.ksem_Owner == 0) 787 { 788 hkmtx->debug.ksem_Owner = usSlot; 789 hkmtx->debug.ksem_cusNest = 1; 790 } 791 else if (hkmtx->debug.ksem_Owner == usSlot) 792 hkmtx->debug.ksem_cusNest++; 793 else 794 rc = ERROR_SEM_BUSY; 795 796 printf("fakeKSEMRequestMutex: hkmtx = %p, ulTimeout = 0x%x, owner = %d, usage count = %d, rc = %d\n", 797 hkmtx, ulTimeout, hkmtx->debug.ksem_cusNest, hkmtx->debug.ksem_Owner, ERROR_SEM_BUSY); 798 799 return rc; 800 } 801 802 803 /** 804 * KSEMReleaseMutex faker. 805 * @returns NO_ERROR 806 * @param hkmtx 807 * @param ulTimeout 808 * @status completely implemented. 809 * @remark 810 */ 811 ULONG KRNLCALL fakeKSEMReleaseMutex(HKSEMMTX hkmtx) 812 { 813 unsigned int usSlot = getSlot(); 814 int rc = NO_ERROR; 815 816 if (memcmp(&hkmtx->debug.ksem_achSignature[0], "KSEM", 4) != 0) 817 { 818 printf("fakeKSEMQueryMutex: hkmtx = %p, invalid signature (%.4s)\n", hkmtx, hkmtx->debug.ksem_achSignature); 819 return FALSE; 820 } 821 822 if (hkmtx->debug.ksem_Owner == usSlot) 823 { 824 if (--hkmtx->debug.ksem_cusNest == 0) 825 hkmtx->debug.ksem_Owner = 0; 826 } 827 else 828 rc = ERROR_NOT_OWNER; 829 830 printf("fakeKSEMReleaseMutex: hkmtx = %p, usage count = %d, owner = %d, rc = %d\n", 831 hkmtx, hkmtx->debug.ksem_cusNest, hkmtx->debug.ksem_Owner, rc); 832 833 return rc; 834 } 835 836 837 838 /** 839 * KSEMQueryMutex faker. 840 * @returns TRUE if owner or clear. Clear if *pcusNest is 0. 841 * FALSE if other owner. 842 * @param hkmtx Handle to kernel mutex. 843 * @param pcusNest Pointer to variable which is to receive the nesting count. 844 * (ie. the number of times we have taken this semaphore.) 845 * @status completely implemented. 846 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 847 */ 848 BOOL KRNLCALL fakeKSEMQueryMutex(HKSEMMTX hkmtx, PUSHORT pcusNest) 849 { 850 unsigned int usSlot = getSlot(); 851 BOOL fRc = TRUE; 852 853 if (memcmp(&hkmtx->debug.ksem_achSignature[0], "KSEM", 4) != 0) 854 { 855 printf("fakeKSEMQueryMutex: hkmtx = %p, invalid signature (%.4s)\n", hkmtx, hkmtx->debug.ksem_achSignature); 856 return FALSE; 857 } 858 859 if (hkmtx->debug.ksem_Owner == 0) 860 { 861 if (pcusNest) 862 *pcusNest = 0; 863 fRc = FALSE; 864 } 865 else 866 { 867 fRc = (hkmtx->debug.ksem_Owner == usSlot); 868 if (pcusNest) 869 *pcusNest = hkmtx->debug.ksem_cusNest; 870 } 871 872 printf("fakeKSEMQueryMutex: hkmtx = %p, usage count = %d, owner = %d, *pcusNest = %d, rc = %d\n", 873 hkmtx, hkmtx->debug.ksem_cusNest, hkmtx->debug.ksem_Owner, pcusNest ? *pcusNest : -1, fRc); 874 875 return fRc; 876 } 877 878 879 /** 880 * KSEMInit faker. 881 * @param pksem Pointer to the semaphore struct to initiate. 882 * @param fulType Semaphore type. (only KSEM_MUTEX is supported) 883 * @param fulFlags Semaphore flags. (not validated) 884 * @status partially implemented. 885 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 886 */ 887 VOID KRNLCALL fakeKSEMInit(PKSEM pksem, ULONG fulType, ULONG fulFlags) 888 { 889 if (fulType != KSEM_MUTEX) 890 { 891 printf("fakeKSEMInit: Invalid fulType parameter (%d).\n", fulType); 892 return; /*ERROR_INVALID_PARAMETER;*/ 893 } 894 895 memcpy(pksem->mtx.debug.ksem_achSignature, "KSEM", 4); 896 pksem->mtx.debug.ksem_bFlags = (char)fulFlags; 897 pksem->mtx.debug.ksem_bType = KSEM_MUTEX; 898 pksem->mtx.debug.ksem_cusNest = 0; 899 pksem->mtx.debug.ksem_cusPendingWriters = 0; 900 pksem->mtx.debug.ksem_Owner = 0; 901 902 printf("fakeKSEMInit: pksem=%p, fulType=%d, fulFlags=0x%x.\n", pksem, fulType, fulFlags); 903 } 904 905 906 /** 907 * Gets the thread slot number. 908 * @returns Thread slot number. 909 * @status completely implemented. 910 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 911 */ 912 unsigned short getSlot(void) 913 { 914 PPIB ppib; 915 PTIB ptib; 916 BOOL f32Stack = ((int)&ppib > 0x10000); 917 918 if (!f32Stack) ThunkStack16To32(); 919 920 DosGetInfoBlocks(&ptib, &ppib); 921 922 if (!f32Stack) ThunkStack32To16(); 923 924 return (unsigned short)ptib->tib_ordinal; 740 925 } 741 926 … … 863 1048 864 1049 printf("tkExecPgmWorker: execFlag = %d, pArg = %p, pEnv = %p, pszFilename = %s\n", execFlag, pArg, pEnv, pszFilename); 1050 1051 /* 1052 * Take loader semaphore. 1053 */ 1054 rc = KSEMRequestMutex(&fakeLDRSem, KSEM_INDEFINITE_WAIT); 1055 if (rc != NO_ERROR) 1056 { 1057 return rc; 1058 } 865 1059 866 1060 /* … … 1479 1673 i++, psz += 1 + *psz) 1480 1674 { 1481 if ( !memcmp(psz+1, "DOSCALLS", *psz))1675 if (*psz == 8 && !strnicmp(psz+1, "DOSCALLS", 8)) 1482 1676 continue; 1483 1677 … … 1563 1757 } 1564 1758 1759 1760 PMTE KRNLCALL fakeldrASMpMTEFromHandle(HMTE hMTE) 1761 { 1762 PMTE pMte = (PMTE)hMTE; 1763 1764 pMte += 10; //just do something! 1765 1766 return NULL; 1767 } 1768 1769 ULONG LDRCALL fakeldrFindModule(PCHAR pachFilename, USHORT cchFilename, USHORT usClass, PPMTE ppMTE) 1770 { 1771 APIRET rc = NO_ERROR; 1772 usClass = usClass; 1773 cchFilename = cchFilename; 1774 pachFilename = pachFilename; 1775 *ppMTE = NULL; 1776 return rc; 1777 } 1778 1779 1780 /** 1781 * Gets the path (name with fully qualified path) from a SFN. 1782 * @returns Pointer to the path of hFile. 1783 * @param hFile SFN filehandle. 1784 */ 1785 PSZ SECCALL fakeSecPathFromSFN(SFN hFile) 1786 { 1787 APIRET rc; 1788 BOOL f32Stack = ((int)&hFile > 0x10000); 1789 1790 if (!f32Stack) ThunkStack16To32(); 1791 1792 rc = ERROR_NOT_SUPPORTED; 1793 1794 if (!f32Stack) ThunkStack32To16(); 1795 1796 printf("fakeSecPathFromSFN: - not implemented - hFile = 0x%04x, rc = %d\n", hFile, rc); 1797 1798 return rc; 1799 } 1800 -
trunk/src/win32k/test/fakea.asm
r3829 r4164 1 ; $Id: fakea.asm,v 1. 1 2000-07-16 22:18:15bird Exp $1 ; $Id: fakea.asm,v 1.2 2000-09-02 21:08:21 bird Exp $ 2 2 ; 3 3 ; Fake assembly imports. … … 30 30 public fakeptda_start 31 31 public fakeptda_environ 32 public fakeptda_module 33 public fakeptda_ptdasem 34 public fakeptda_pBeginLIBPATH 32 35 public fakef_FuStrLenZ 33 36 public fakef_FuStrLen 34 37 public fakef_FuBuff 35 38 public fakeg_tkExecPgm 39 public fake_tkStartProcess 36 40 public CalltkExecPgm 37 41 38 42 39 43 ; 40 ; Imported Functions 44 ; Imported Functions and Variables. 41 45 ; 42 46 extrn tkExecPgmWorker:PROC ; fake.c 43 47 extrn _fakeLDRClearSem@0:PROC ; fake.c 48 extrn _fakeKSEMRequestMutex@8:PROC ; fake.c 49 extrn fakeLDRSem:BYTE ; fake.c 44 50 45 51 DATA16 SEGMENT … … 56 62 fakeptda_dummy db 123 dup (0) 57 63 fakeptda_environ dw 1 ; 1 is the hardcoded HOB of the win32ktst.exe's environment. 64 fakeptda_ptdasem db 20 dup (0) ; PTDA semaphore - Intra-Process serialisation mutex KSEM (sg244640). 65 fakeptda_module dw 1 ; 1 is the hardcoded HMTE of the current executable module. 66 fakeptda_pBeginLIBPATH dd 0 ; BEGINLIBPATH not implemented. 67 dd 0 ; ENDLIBPATH not implemented. 58 68 59 69 … … 249 259 250 260 CODE32 SEGMENT 261 ;; 262 ; Faker of which simply clears the loader semaphore. 263 ; @cproto none! (void _Optlink fake_tkStartProcess(void)) 264 ; @returns 265 ; @param 266 ; @uses 267 ; @equiv 268 ; @time 269 ; @sketch 270 ; @status 271 ; @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 272 ; @remark 273 fake_tkStartProcess PROC NEAR 274 push ebp 275 mov ebp, esp 276 277 push ebx 278 push ecx 279 280 call _fakeLDRClearSem@0 281 282 pop ecx 283 pop ebx 284 285 xor eax, eax 286 leave 287 ret 288 fake_tkStartProcess ENDP 289 290 251 291 ;; 252 292 ; Fake g_tkExecPgm implementation. … … 270 310 271 311 ; 272 ; We just have to make some common code...312 ; Call C worker 273 313 ; 274 314 sub esp, 10h … … 302 342 ; ebp+8, ebp+c, ebp+10, ebp+14 303 343 ; esp+0, esp+4, esp+08, esp+0c 304 344 or eax, eax 345 jnz ftkep_ret 346 call fake_tkStartProcess ; If succesfully so far. call start process. 347 jmp ftkep_ret2 ; <Currently no parameters are implemented.> 348 349 ftkep_ret: 350 push eax 351 call _fakeLDRClearSem@0 ; clear the semaphore. 352 pop eax 353 354 ftkep_ret2: 305 355 leave 306 356 ret -
trunk/src/win32k/test/win32ktst.c
r3829 r4164 1 /* $Id: win32ktst.c,v 1. 1 2000-07-16 22:18:16bird Exp $1 /* $Id: win32ktst.c,v 1.2 2000-09-02 21:08:21 bird Exp $ 2 2 * 3 3 * Win32k test module. … … 26 26 (PVOID)( ( (((unsigned)(flataddr) << 3) & 0xfff80000) | (SEL_LDT_RPL3 << 16) ) | ((unsigned)(flataddr) & 0xffff) ) 27 27 28 #define DWORD ULONG 29 #define WORD USHORT 30 28 31 /******************************************************************************* 29 32 * Internal Functions * 30 33 *******************************************************************************/ 31 34 #include <os2.h> 35 #include <exe386.h> 36 37 #include "devSegDf.h" /* Win32k segment definitions. */ 32 38 33 39 #include "malloc.h" … … 42 48 #include "devcmd.h" 43 49 #include "os2krnl.h" 50 #include "avl.h" 51 #include "ldr.h" 44 52 #include "ldrCalls.h" 45 53 #include "test.h" … … 47 55 #include "macros.h" 48 56 #include "log.h" 57 58 59 49 60 50 61 … … 133 144 134 145 /******************************************************************************* 146 * Structures and Typedefs * 147 *******************************************************************************/ 148 #ifndef QS_MTE 149 /* From OS/2 Toolkit v4.5 (BSEDOS.H) */ 150 151 /* Global Record structure 152 * Holds all global system information. Placed first in user buffer 153 */ 154 typedef struct qsGrec_s { /* qsGrec */ 155 ULONG cThrds; 156 ULONG c32SSem; 157 ULONG cMFTNodes; 158 }qsGrec_t; 159 160 /* 161 * System wide MTE information 162 * ________________________________ 163 * | pNextRec |----| 164 * |-------------------------------| | 165 * | hmte | | 166 * |-------------------------------| | 167 * | ctImpMod | | 168 * |-------------------------------| | 169 * | ctObj | | 170 * |-------------------------------| | 171 * | pObjInfo |----|----------| 172 * |-------------------------------| | | 173 * | pName |----|----| | 174 * |-------------------------------| | | | 175 * | imported module handles | | | | 176 * | . | | | | 177 * | . | | | | 178 * | . | | | | 179 * |-------------------------------| <--|----| | 180 * | "pathname" | | | 181 * |-------------------------------| <--|----------| 182 * | Object records | | 183 * | (if requested) | | 184 * |_______________________________| | 185 * <----- 186 * NOTE that if the level bit is set to QS_MTE, the base Lib record will be followed 187 * by a series of object records (qsLObj_t); one for each object of the 188 * module. 189 */ 190 191 typedef struct qsLObjrec_s { /* qsLOrec */ 192 ULONG oaddr; /* object address */ 193 ULONG osize; /* object size */ 194 ULONG oflags; /* object flags */ 195 } qsLObjrec_t; 196 197 typedef struct qsLrec_s { /* qsLrec */ 198 void FAR *pNextRec; /* pointer to next record in buffer */ 199 USHORT hmte; /* handle for this mte */ 200 USHORT fFlat; /* true if 32 bit module */ 201 ULONG ctImpMod; /* # of imported modules in table */ 202 ULONG ctObj; /* # of objects in module (mte_objcnt)*/ 203 qsLObjrec_t FAR *pObjInfo; /* pointer to per object info if any */ 204 UCHAR FAR *pName; /* -> name string following struc */ 205 } qsLrec_t; 206 207 208 209 /* Pointer Record Structure 210 * This structure is the first in the user buffer. 211 * It contains pointers to heads of record types that are loaded 212 * into the buffer. 213 */ 214 215 typedef struct qsPtrRec_s { /* qsPRec */ 216 qsGrec_t *pGlobalRec; 217 void *pProcRec; /* ptr to head of process records */ 218 void *p16SemRec; /* ptr to head of 16 bit sem recds */ 219 void *p32SemRec; /* ptr to head of 32 bit sem recds */ 220 void *pMemRec; /* ptr to head of shared mem recs */ 221 qsLrec_t *pLibRec; /* ptr to head of mte records */ 222 void *pShrMemRec; /* ptr to head of shared mem records */ 223 void *pFSRec; /* ptr to head of file sys records */ 224 } qsPtrRec_t; 225 226 #endif 227 228 229 /******************************************************************************* 230 * Global Variables * 231 *******************************************************************************/ 232 extern BOOL fInited; /* malloc.c */ 233 int cObjectsFake = 14; 234 OTE aKrnlOTE[24]; 235 236 237 /******************************************************************************* 238 * External Functions * 239 *******************************************************************************/ 240 #ifndef QS_MTE 241 /* from OS/2 Toolkit v4.5 */ 242 243 APIRET APIENTRY DosQuerySysState(ULONG EntityList, ULONG EntityLevel, PID pid, 244 TID tid, PVOID pDataBuf, ULONG cbBuf); 245 #define QS_MTE 0x0004 246 #endif 247 248 249 /******************************************************************************* 135 250 * Internal Functions * 136 251 *******************************************************************************/ 137 252 void syntax(void); 253 int kernelInit(int iTest, int argc, char **argv); 138 254 void workersinit(void); 139 255 void initRPInit(RP32INIT *pRpInit, char *pszInitArgs); 140 256 int tests(int iTest, int argc, char **argv); 141 int TestCase1( void);257 int TestCase1(int argc, char **argv); 142 258 int TestCase2(void); 143 259 int TestCase3(void); 144 260 int TestCase4(void); 145 261 int TestCase5(void); 262 int TestCase6(void); 146 263 int CompareOptions(struct options *pOpt); 147 int TestCaseExeLoad1(void); 148 149 150 /******************************************************************************* 151 * Global Variables * 152 *******************************************************************************/ 153 extern BOOL fInited; /* malloc.c */ 154 const char * pszInternalRevision = "\r\nInternal revision 14.040_W4"; 155 int cObjectsFake = 14; 156 264 int TestCaseExeLoad2(void); 157 265 158 266 … … 186 294 workersinit(); 187 295 296 /* 297 * Init Kernel 298 */ 299 if (!kernelInit(iTest, argc, argv)) 300 return -2; 188 301 189 302 /* … … 219 332 { 220 333 printf( 221 "Win32kTst.exe v%d.%d.%d - Ring 3 testing of win32k.sys\n"222 "syntax: Win32kTst.exe <testcase number> [optional arguments]\n",223 0,0,4334 "Win32kTst.exe v%d.%d.%d - Ring 3 testing of win32k.sys\n" 335 "syntax: Win32kTst.exe <testcase number> [optional arguments]\n", 336 0,0,4 224 337 ); 225 338 } … … 227 340 228 341 /** 229 * Initiate workers (imported kernel functions / vars) 230 * @status partially implemented. 231 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 232 */ 233 void workersinit(void) 342 * test case 1: Load the specified kernel 343 * other cases: Load running kernel. 344 * @returns Success indicator. (true/false) 345 * @param iTest Testcase number. 346 * @param argc main argc 347 * @param argv main argv 348 * @status completely implemented. 349 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 350 */ 351 int kernelInit(int iTest, int argc, char **argv) 234 352 { 235 DosSetMem(&CODE16START, &CODE16END - &CODE16START, PAG_WRITE | PAG_READ); 236 DosSetMem(&CODE32START, &CODE32END - &CODE32START, PAG_WRITE | PAG_READ); 353 static char achBuffer[1024*256]; 354 char szError[256]; 355 HMODULE hmod = NULLHANDLE; 356 int rc; 357 char szName[CCHMAXPATH]; 358 char * pszSrcName; 359 char * pszTmp; 360 ULONG ulAction; 361 HFILE hFile; 362 struct e32_exe* pe32 = (struct e32_exe*)(void*)&achBuffer[0]; 363 qsPtrRec_t * pPtrRec = (qsPtrRec_t*)(void*)&achBuffer[0]; 364 qsLrec_t * pLrec; 365 int i; 366 FILESTATUS3 fsts3; 367 368 /* 369 * If not testcase 1, use the running kernel. 370 */ 371 if (iTest != 1) 372 { 373 ULONG ulBootDrv = 3; 374 pszSrcName = "c:\\os2krnl"; 375 DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, SSToDS(&ulBootDrv), sizeof(ulBootDrv)); 376 pszSrcName[0] = (char)(ulBootDrv + 'a' - 1); 377 } 378 else 379 { 380 if (argc < 3) 381 { 382 printf("Missing parameter!\n"); 383 return FALSE; 384 } 385 pszSrcName = argv[2]; 386 } 387 388 /* 389 * Make a temporary copy of the kernel. 390 */ 391 if (DosScanEnv("TMP", &pszTmp) != NO_ERROR || pszTmp == NULL) 392 { 393 printf("Environment variable TMP is not set.\n"); 394 return FALSE; 395 } 396 strcpy(szName, pszTmp); 397 if (szName[strlen(pszTmp) - 1] != '\\' && szName[strlen(pszTmp) - 1] != '/') 398 strcat(szName, "\\"); 399 strcat(szName, "os2krnl"); 400 rc = DosCopy(pszSrcName, szName, DCPY_EXISTING); 401 if (rc != NO_ERROR) 402 { 403 printf("Failed to copy %s to %s.\n", pszSrcName, szName); 404 return FALSE; 405 } 406 if (DosQueryPathInfo(szName, FIL_STANDARD, &fsts3, sizeof(fsts3)) != NO_ERROR 407 || !(fsts3.attrFile = FILE_ARCHIVED) 408 || DosSetPathInfo(szName, FIL_STANDARD, &fsts3, sizeof(fsts3), 0) != NO_ERROR 409 ) 410 { 411 printf("Failed to set attributes for %s.\n", szName); 412 return FALSE; 413 } 414 415 /* 416 * Patch the kernel. 417 * Remove the entrypoint. 418 */ 419 ulAction = 0; 420 rc = DosOpen(szName, &hFile, &ulAction, 0, FILE_NORMAL, 421 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, 422 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE, 423 NULL); 424 if (rc != NO_ERROR) 425 { 426 printf("Failed to open temporary kernel file. rc = %d\n", rc); 427 return FALSE; 428 } 429 rc = DosRead(hFile, &achBuffer[0], 0x200, &ulAction); 430 if (rc != NO_ERROR) 431 { 432 DosClose(hFile); 433 printf("Failed to read LX header from temporary kernel file.\n"); 434 return FALSE; 435 } 436 pe32 = (struct e32_exe*)(void*)&achBuffer[*(unsigned long*)(void*)&achBuffer[0x3c]]; 437 if (*(PUSHORT)pe32->e32_magic != E32MAGIC) 438 { 439 DosClose(hFile); 440 printf("Failed to read LX header from temporary kernel file (2).\n"); 441 return FALSE; 442 } 443 pe32->e32_eip = 0; 444 pe32->e32_startobj = 0; 445 pe32->e32_mflags &= ~(E32LIBTERM | E32LIBINIT); 446 if ((rc = DosSetFilePtr(hFile, *(unsigned long*)(void*)&achBuffer[0x3c], FILE_BEGIN, &ulAction)) != NO_ERROR 447 || (rc = DosWrite(hFile, pe32, sizeof(struct e32_exe), &ulAction)) != NO_ERROR) 448 { 449 DosClose(hFile); 450 printf("Failed to write patched LX header to temporary kernel file.\n"); 451 return FALSE; 452 } 453 DosClose(hFile); 454 455 /* 456 * Load the module. 457 */ 458 rc = DosLoadModule(szError, sizeof(szError), szName, SSToDS(&hmod)); 459 if (rc != NO_ERROR && (rc != ERROR_INVALID_PARAMETER && hmod == NULLHANDLE)) 460 { 461 printf("Failed to load OS/2 kernel image %s."); 462 return FALSE; 463 } 464 465 /* 466 * Get object information. 467 */ 468 rc = DosQuerySysState(QS_MTE, QS_MTE, 0L, 0L, pPtrRec, sizeof(achBuffer)); 469 if (rc != NO_ERROR) 470 { 471 printf("DosQuerySysState failed with rc=%d.\n", rc); 472 return FALSE; 473 } 474 475 pLrec = pPtrRec->pLibRec; 476 while (pLrec != NULL) 477 { 478 /* 479 * Bug detected in OS/2 FP13. Probably a problem which occurs 480 * in _LDRSysMteInfo when qsCheckCache is calle before writing 481 * object info. The result is that the cache flushed and the 482 * attempt of updating the qsLrec_t next and object pointer is 483 * not done. This used to work earlier and on Aurora AFAIK. 484 * 485 * The fix for this problem is to check if the pObjInfo is NULL 486 * while the number of objects isn't 0 and correct this. pNextRec 487 * will also be NULL at this time. This will be have to corrected 488 * before we exit the loop or moves to the next record. 489 * There is also a nasty alignment of the object info... Hope 490 * I got it right. (This aligment seems new to FP13.) 491 */ 492 if (pLrec->pObjInfo == NULL /*&& pLrec->pNextRec == NULL*/ && pLrec->ctObj > 0) 493 { 494 pLrec->pObjInfo = (qsLObjrec_t*)(void*)( 495 (char*)(void*)pLrec 496 + ((sizeof(qsLrec_t) /* size of the lib record */ 497 + pLrec->ctImpMod * sizeof(short) /* size of the array of imported modules */ 498 + strlen((char*)(void*)pLrec->pName) + 1 /* size of the filename */ 499 + 3) & ~3)); /* the size is align on 4 bytes boundrary */ 500 pLrec->pNextRec = (qsLrec_t*)(void*)((char*)(void*)pLrec->pObjInfo 501 + sizeof(qsLObjrec_t) * pLrec->ctObj); 502 } 503 if (pLrec->hmte == hmod) 504 break; 505 506 /* 507 * Next record 508 */ 509 pLrec = (qsLrec_t*)pLrec->pNextRec; 510 } 511 512 if (pLrec == NULL) 513 { 514 printf("DosQuerySysState(os2krnl): not found\n"); 515 return FALSE; 516 } 517 if (pLrec->pObjInfo == NULL) 518 { 519 printf("DosQuerySysState(os2krnl): no object info\n"); 520 return FALSE; 521 } 522 523 /* 524 * Fill the aKrnlOTE array. 525 */ 526 for (i = 0; i < pLrec->ctObj; i++) 527 { 528 aKrnlOTE[i].ote_size = pLrec->pObjInfo[i].osize; 529 aKrnlOTE[i].ote_base = pLrec->pObjInfo[i].oaddr; 530 aKrnlOTE[i].ote_flags = pLrec->pObjInfo[i].oflags; 531 aKrnlOTE[i].ote_pagemap = i > 0 ? aKrnlOTE[i-1].ote_pagemap + aKrnlOTE[i-1].ote_mapsize : 0; 532 aKrnlOTE[i].ote_mapsize = (pLrec->pObjInfo[i].osize + 0x0FFF) / 0x1000; 533 aKrnlOTE[i].ote_sel = (USHORT)FlatToSel(pLrec->pObjInfo[i].oaddr); 534 aKrnlOTE[i].ote_hob = 0; 535 } 536 cObjectsFake = pLrec->ctObj; 537 538 return TRUE; 237 539 } 238 540 … … 273 575 switch (iTest) 274 576 { 275 case 1: rc = TestCase1( ); break;577 case 1: rc = TestCase1(argc, argv); break; 276 578 case 2: rc = TestCase2(); break; 277 579 case 3: rc = TestCase3(); break; 278 case 4: rc = TestCase4(); break;279 case 5: rc = TestCase5(); break;280 580 281 581 default: … … 294 594 /** 295 595 * Test case 1. 296 * Checks that default initiation works fine for Aurora SMP kernels. 596 * Checks that default initiation works fine for a given kernel. 597 * 598 * Syntax: win32ktst.exe 1 <os2krnl> <majorver> <minorver> <build> <kerneltype: S|U|4> <buildtype: A|H|R> [os2krnl.sym] 297 599 * 298 600 * @sketch Create init packet with no arguments. … … 305 607 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 306 608 */ 307 int TestCase1( void)609 int TestCase1(int argc, char **argv) 308 610 { 611 static char szInitArgs[CCHMAXPATH + 10]; 309 612 int rc = 1; 310 613 RP32INIT rpinit; 311 614 615 /* verify argument count */ 616 if (argc < 8 || argc > 9) 617 { 618 printf("Invalid parameter count for testcase 1.\n"); 619 return ERROR_INVALID_PARAMETER; 620 } 621 312 622 /* init fake variabels */ 313 pszInternalRevision ="\r\nInternal revision 14.040_SMP"; 314 cObjectsFake = 15; 315 _usFakeVerMajor = 20; 316 _usFakeVerMinor = 45; 623 _usFakeVerMajor = (USHORT)atoi(argv[3]); 624 _usFakeVerMinor = (USHORT)atoi(argv[4]); 625 626 /* make init string */ 627 strcpy(szInitArgs, "-w3"); 628 if (argc >= 9) 629 strcat(strcat(szInitArgs, " -S:"), argv[8]); 317 630 318 631 /* $elf */ 319 initRPInit(SSToDS(&rpinit), "-w3");632 initRPInit(SSToDS(&rpinit), szInitArgs); 320 633 rc = InitElf(&rpinit); /* no SSToDS! */ 321 634 printf("InitElf returned status=0x%04x\n", rpinit.rph.Status); … … 323 636 { 324 637 /* $win32k */ 325 initRPInit(SSToDS(&rpinit), "-w3");638 initRPInit(SSToDS(&rpinit), szInitArgs); 326 639 rc = InitWin32k(&rpinit); /* no SSToDS! */ 327 640 printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status); … … 329 642 { 330 643 struct options opt = DEFAULT_OPTION_ASSIGMENTS; 331 opt.fKernel = KF_SMP;332 opt.ulBuild = 14040;333 opt.usVerMajor = 20;334 opt.usVerMinor = 45;335 644 opt.ulInfoLevel = 3; 645 opt.fKernel = (argv[6][0] == 'S' ? KF_SMP : (argv[6][0] == '4' ? KF_W4 | KF_UNI : KF_UNI)) 646 | (argv[7][0] == 'A' || argv[7][0] == 'H' ? KF_DEBUG : 0); 647 opt.ulBuild = atoi(argv[5]); 648 opt.usVerMajor = (USHORT)atoi(argv[3]); 649 opt.usVerMinor = (USHORT)atoi(argv[4]); 336 650 337 651 rc = CompareOptions(SSToDS(&opt)); 338 if (rc == NO_ERROR)339 {340 rc = TestCaseExeLoad1();341 }342 652 } 343 653 else … … 350 660 } 351 661 352 353 662 /** 354 663 * Test case 2. 355 * Checks that default initiation works fine for Aurora UNI kernels.664 * Checks that all parameters are read correctly (1). 356 665 * 357 666 * @sketch Create init packet with no arguments. … … 368 677 int rc = 1; 369 678 RP32INIT rpinit; 370 371 /* init fake variabels */ 372 pszInternalRevision ="\r\nInternal revision 14.040_UNI"; 373 cObjectsFake = 14; 374 _usFakeVerMajor = 20; 375 _usFakeVerMinor = 45; 679 char * pszInitArgs = "-C1 -L:E -Verbose -Elf:Yes -Pe:Mixed -Script:Yes -W4 -Heap:512000 -ResHeap:0256000 -HeapMax:4096000 -ResHeapMax:0x100000"; 680 681 options.fLogging = TRUE; 376 682 377 683 /* $elf */ 378 initRPInit(SSToDS(&rpinit), "");684 initRPInit(SSToDS(&rpinit), pszInitArgs); 379 685 rc = InitElf(&rpinit); /* no SSToDS! */ 380 686 printf("InitElf returned status=0x%04x\n", rpinit.rph.Status); … … 382 688 { 383 689 /* $win32k */ 384 initRPInit(SSToDS(&rpinit), "");690 initRPInit(SSToDS(&rpinit), pszInitArgs); 385 691 rc = InitWin32k(&rpinit); /* no SSToDS! */ 386 692 printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status); … … 388 694 { 389 695 struct options opt = DEFAULT_OPTION_ASSIGMENTS; 390 opt.fKernel = KF_UNI; 391 opt.ulBuild = 14040; 392 opt.usVerMajor = 20; 393 opt.usVerMinor = 45; 696 opt.cbSwpHeapInit = 512000; 697 opt.cbSwpHeapMax = 4096000; 698 opt.cbResHeapInit = 0256000; 699 opt.cbResHeapMax = 0x100000; 700 opt.fElf = TRUE; 701 opt.fUNIXScript = TRUE; 702 opt.fPE = FLAGS_PE_MIXED; 703 opt.fQuiet = FALSE; 704 opt.fLogging = TRUE; 705 opt.usCom = OUTPUT_COM1; 706 opt.ulInfoLevel = INFOLEVEL_INFOALL; 394 707 395 708 rc = CompareOptions(SSToDS(&opt)); 709 if (rc == NO_ERROR) 710 { 711 rc = TestCaseExeLoad2(); 712 } 396 713 } 397 714 else … … 404 721 } 405 722 406 407 723 /** 408 724 * Test case 3. 409 * Checks that default initiation works fine for Warp FP13 kernel.725 * Checks that all parameters are read correctly (1). 410 726 * 411 727 * @sketch Create init packet with no arguments. … … 422 738 int rc = 1; 423 739 RP32INIT rpinit; 424 425 /* init fake variabels */ 426 pszInternalRevision ="\r\nInternal revision 14.040_W4"; 427 cObjectsFake = 14; 428 _usFakeVerMajor = 20; 429 _usFakeVerMinor = 45; 430 431 /* $elf */ 432 initRPInit(SSToDS(&rpinit), ""); 433 rc = InitElf(&rpinit); /* no SSToDS! */ 434 printf("InitElf returned status=0x%04x\n", rpinit.rph.Status); 435 if ((rpinit.rph.Status & (STDON | STERR)) == STDON) 436 { 437 /* $win32k */ 438 initRPInit(SSToDS(&rpinit), ""); 439 rc = InitWin32k(&rpinit); /* no SSToDS! */ 440 printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status); 441 if ((rpinit.rph.Status & (STDON | STERR)) == STDON) 442 { 443 struct options opt = DEFAULT_OPTION_ASSIGMENTS; 444 opt.fKernel = KF_UNI | KF_W4; 445 opt.ulBuild = 14040; 446 opt.usVerMajor = 20; 447 opt.usVerMinor = 45; 448 449 rc = CompareOptions(SSToDS(&opt)); 450 } 451 else 452 printf("!failed!\n"); 453 } 454 else 455 printf("!failed!\n"); 456 457 return rc; 458 } 459 460 461 /** 462 * Test case 4. 463 * Checks that default initiation works fine for Aurora SMP kernels. 464 * 465 * @sketch Create init packet with no arguments. 466 * Initiate elf$ 467 * Create init packet with no arguments. 468 * Initiate win32k$ 469 * @returns 0 on success. 470 * 1 on failure. 471 * @status completely implemented. 472 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 473 */ 474 int TestCase4(void) 475 { 476 int rc = 1; 477 RP32INIT rpinit; 478 479 /* init fake variabels */ 480 pszInternalRevision ="\r\nInternal revision 9.036"; 481 cObjectsFake = 14; 482 _usFakeVerMajor = 20; 483 _usFakeVerMinor = 40; 484 485 /* $elf */ 486 initRPInit(SSToDS(&rpinit), ""); 487 rc = InitElf(&rpinit); /* no SSToDS! */ 488 printf("InitElf returned status=0x%04x\n", rpinit.rph.Status); 489 if ((rpinit.rph.Status & (STDON | STERR)) == STDON) 490 { 491 /* $win32k */ 492 initRPInit(SSToDS(&rpinit), ""); 493 rc = InitWin32k(&rpinit); /* no SSToDS! */ 494 printf("InitWin32k returned status=0x%04x\n", rpinit.rph.Status); 495 if ((rpinit.rph.Status & (STDON | STERR)) == STDON) 496 { 497 struct options opt = DEFAULT_OPTION_ASSIGMENTS; 498 opt.fKernel = KF_UNI; 499 opt.ulBuild = 9036; 500 opt.usVerMajor = 20; 501 opt.usVerMinor = 40; 502 503 rc = CompareOptions(SSToDS(&opt)); 504 } 505 else 506 printf("!failed!\n"); 507 } 508 else 509 printf("!failed!\n"); 510 511 return rc; 512 } 513 514 515 /** 516 * Test case 5. 517 * Checks that all parameters are read correctly (1) (Warp FP13 kernel). 518 * 519 * @sketch Create init packet with no arguments. 520 * Initiate elf$ 521 * Create init packet with no arguments. 522 * Initiate win32k$ 523 * @returns 0 on success. 524 * 1 on failure. 525 * @status completely implemented. 526 * @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no) 527 */ 528 int TestCase5(void) 529 { 530 int rc = 1; 531 RP32INIT rpinit; 532 char * pszInitArgs = "-C1 -L:N -Verbose -Quiet -Elf:Yes -Pe:Mixed -Script:No -W4 -Heap:512000 -ResHeap:0256000 -HeapMax:4096000 -ResHeapMax:0x100000"; 533 534 /* init fake variabels */ 535 pszInternalRevision ="\r\nInternal revision 14.040_W4"; 536 cObjectsFake = 14; 537 _usFakeVerMajor = 20; 538 _usFakeVerMinor = 45; 740 char * pszInitArgs = "-C1 -L:N -Verbose -Quiet -Elf:Yes -Pe:PE -Script:Yes -Rexx:NES -Java:NYes -W4 -Heap:512000 -ResHeap:0256000 -HeapMax:4096000 -ResHeapMax:0x100000"; 539 741 540 742 /* $elf */ … … 551 753 { 552 754 struct options opt = DEFAULT_OPTION_ASSIGMENTS; 553 opt.fKernel = KF_UNI | KF_W4;554 opt.ulBuild = 14040;555 opt.usVerMajor = 20;556 opt.usVerMinor = 45;557 755 opt.cbSwpHeapInit = 512000; 558 756 opt.cbSwpHeapMax = 4096000; … … 560 758 opt.cbResHeapMax = 0x100000; 561 759 opt.fElf = TRUE; 562 opt.fUNIXScript = FALSE; 563 opt.fPE = FLAGS_PE_MIXED; 760 opt.fUNIXScript = TRUE; 761 opt.fJava = FALSE; 762 opt.fREXXScript = FALSE; 763 opt.fPE = FLAGS_PE_PE; 564 764 opt.fQuiet = TRUE; 565 765 opt.fLogging = FALSE; … … 568 768 569 769 rc = CompareOptions(SSToDS(&opt)); 770 if (rc == NO_ERROR) 771 { 772 rc = TestCaseExeLoad2(); 773 } 570 774 } 571 775 else … … 577 781 return rc; 578 782 } 783 579 784 580 785 /** … … 598 803 if (options.fLogging != pOpt->fLogging) 599 804 printf("fLogging = %d - should be %d\n", options.fLogging, pOpt->fLogging, rc++); 600 if (options.fKernel != pOpt->fKernel) 601 printf("fKernel = %d - should be %d\n", options.fKernel, pOpt->fKernel, rc++); 602 if (options.ulBuild != pOpt->ulBuild) 603 printf("ulBuild = %d - should be %d\n", options.ulBuild, pOpt->ulBuild, rc++); 604 if (options.usVerMajor != pOpt->usVerMajor) 605 printf("usVerMajor = %d - should be %d\n", options.usVerMajor, pOpt->usVerMajor, rc++); 606 if (options.usVerMinor != pOpt->usVerMinor) 607 printf("usVerMinor = %d - should be %d\n", options.usVerMinor, pOpt->usVerMinor, rc++); 805 if (pOpt->ulBuild != ~0UL) 806 { 807 if (options.fKernel != pOpt->fKernel) 808 printf("fKernel = %d - should be %d\n", options.fKernel, pOpt->fKernel, rc++); 809 if (options.ulBuild != pOpt->ulBuild) 810 printf("ulBuild = %d - should be %d\n", options.ulBuild, pOpt->ulBuild, rc++); 811 if (options.usVerMajor != pOpt->usVerMajor) 812 printf("usVerMajor = %d - should be %d\n", options.usVerMajor, pOpt->usVerMajor, rc++); 813 if (options.usVerMinor != pOpt->usVerMinor) 814 printf("usVerMinor = %d - should be %d\n", options.usVerMinor, pOpt->usVerMinor, rc++); 815 } 608 816 if (options.fPE != pOpt->fPE) 609 817 printf("fPE = %d - should be %d\n", options.fPE, pOpt->fPE, rc++); … … 633 841 634 842 635 636 637 843 /** 638 844 * Simulates a executable loading (no errors). … … 647 853 * @remark 648 854 */ 649 int TestCaseExeLoad 1(void)855 int TestCaseExeLoad2(void) 650 856 { 651 857 APIRET rc; 858 int cch; 859 char * psz; 652 860 653 861 /* … … 658 866 * Do the real execution. 659 867 */ 660 printf("--- TestcaseExeLoad 1- loading win32ktst.exe (LX image) ----\n");868 printf("--- TestcaseExeLoad2 - loading win32ktst.exe (LX image) ----\n"); 661 869 rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "win32ktst.exe"); 662 870 if (rc == NO_ERROR) 663 871 { 664 printf("--- TestcaseExeLoad1 - loading libconv.exe (LX image) ----\n"); 872 psz = "BIN\\DEBUG\\LIBCONV.EXE\0"; 873 printf("--- TestcaseExeLoad2 - loading libconv.exe (LX image) ----\n"); 665 874 rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "bin\\debug\\libconv.exe"); 875 if (rc == NO_ERROR) 876 { 877 #if 0 //not implemented by CalltkExecPgm...??? 878 /* check result */ 879 if (memcmp(achTkExecPgmArguments, psz, strlen(psz) + 1) != 0) 880 { 881 rc = ERROR_BAD_ARGUMENTS; 882 printf("Bad Arguments! (%s)\n", achTkExecPgmArguments); 883 } 884 #else 885 psz = psz; 886 #endif 887 } 666 888 } 667 889 668 890 if (rc == NO_ERROR) 669 891 { 670 printf("--- TestcaseExeLoad1 - loading rexx\\tst.cmd (REXX script) ----\n"); 671 rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "rexx\\tst.cmd"); 892 psz = "REXX\\TST.RX\0OriginalArgument1 OriginalArgument2\0OriginalArgument3\0"; 893 printf("--- TestcaseExeLoad2 - loading rexx\\tst.rx (REXX script) ----\n"); 894 rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "rexx\\tst.rx"); 895 if (rc == NO_ERROR) 896 { 897 /* check result */ 898 psz = "REXX\\TST.RX OriginalArgument1 OriginalArgument2\0OriginalArgument3\0"; 899 cch = strlen(psz); 900 if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0) 901 { 902 rc = ERROR_BAD_ARGUMENTS; 903 printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1); 904 } 905 } 672 906 } 673 907 674 908 if (rc == NO_ERROR) 675 909 { 676 printf("--- TestcaseExeLoad1 - loading SOL.EXE (PE image) ----\n"); 677 rc = CalltkExecPgm(EXEC_LOAD, NULL, NULL, "e:\\Win32Prog\\Sol\\Sol.exe"); 910 psz = "TEST\\TST.SH\0OrgArg1 OrgArg2\0OrgArg3\0"; 911 printf("--- TestcaseExeLoad2 - loading test\\tst.sh (UNIX shell script) ----\n"); 912 rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "test\\tst.sh"); 913 if (rc == NO_ERROR) 914 { 915 /* check result */ 916 psz = "TEST\\TST.SH OrgArg1 OrgArg2\0OrgArg3\0"; 917 cch = strlen(psz); 918 if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0) 919 { 920 rc = ERROR_BAD_ARGUMENTS; 921 printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1); 922 } 923 } 924 } 925 926 if (rc == NO_ERROR) 927 { 928 psz = "TEST\\TST2.SH\0OrgArg1 OrgArg2\0OrgArg3\0"; 929 printf("--- TestcaseExeLoad2 - loading test\\tst2.sh (UNIX shell script) ----\n"); 930 rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "test\\tst2.sh"); 931 if (rc == NO_ERROR) 932 { 933 /* check result */ 934 psz = "-arg1 -arg2 -arg3 TEST\\TST2.SH OrgArg1 OrgArg2\0OrgArg3\0"; 935 cch = strlen(psz) + 1; 936 if (memcmp(achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1, psz, cch) != 0) 937 { 938 rc = ERROR_BAD_ARGUMENTS; 939 printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1); 940 } 941 } 942 } 943 944 if (rc == NO_ERROR) 945 { 946 psz = "E:\\WIN32PROG\\SOL\\SOL.EXE\0"; 947 printf("--- TestcaseExeLoad2 - loading SOL.EXE (PE image) ----\n"); 948 rc = CalltkExecPgm(EXEC_LOAD, psz, NULL, "e:\\Win32Prog\\Sol\\Sol.exe"); 949 if (rc == NO_ERROR) 950 { 951 /* check result */ 952 cch = strlen(psz) + 1 + 1; 953 if (memcmp(achTkExecPgmArguments, psz, cch) != 0) 954 { 955 rc = ERROR_BAD_ARGUMENTS; 956 printf("Bad Arguments! (achTkExecPgmArguments=%s).\n", achTkExecPgmArguments + strlen(achTkExecPgmArguments) + 1); 957 } 958 } 678 959 } 679 960 … … 683 964 return rc; 684 965 } 966
Note:
See TracChangeset
for help on using the changeset viewer.