Changeset 4347 for trunk/src/win32k/test


Ignore:
Timestamp:
Oct 1, 2000, 4:58:21 AM (25 years ago)
Author:
bird
Message:

Implemented tool for generating calltab for kernel imports. (mkcalltab)
Implemented API for accessing memory in another process. (*ProcessReadWrite)
Added kernel imports needed to implemented ProcessReadWrite.
Removed unused kernel imports.

Location:
trunk/src/win32k/test
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/test

    • Property svn:ignore set to
      TstFaker.c
  • trunk/src/win32k/test/fake.c

    r4227 r4347  
    1 /* $Id: fake.c,v 1.3 2000-09-08 21:34:12 bird Exp $
     1/* $Id: fake.c,v 1.4 2000-10-01 02:58:21 bird Exp $
    22 *
    33 * Fake stubs for the ldr and kernel functions we imports or overloads.
     
    6262 * Pointer to the loader semaphore.
    6363 */
    64 KSEMMTX         fakeLDRSem;
     64KSEMMTX         fakeLdrSem;
    6565
    6666CHAR            szBeginLibPath[1024];
     
    144144     * Loader semaphore
    145145     */
    146     fakeKSEMInit((PKSEM)(void*)&fakeLDRSem, KSEM_MUTEX, KSEM_DEFAULT);
     146    fakeKSEMInit((PKSEM)(void*)&fakeLdrSem, KSEM_MUTEX, KSEM_DEFAULT);
    147147
    148148    /*
     
    335335    flObj = flObj;
    336336    pMTE = pMTE;
     337    return 0;
    337338}
    338339
     
    583584    DUMMY();
    584585    printf("fakeVMAllocMem:                 cbSize = 0x%08x, cbCommit = 0x%08x, flFlags1 = 0x%08x, hPTDA = 0x%04x, usVMOwnerId = 0x%04x, hMTE = 0x%04x, flFlags2 = 0x%08x, SomeArg2 = 0x%08x, pvmac = %p, rc = %d\n",
    585            cbSize, cbCommit, flFlags1, hPTDA, usVMOwnerId, hMTE, flFlags2, SomeArg2, pvmac, 0);
     586           cbSize, cbCommit, flFlags1, hPTDA, usVMOwnerId, hMTE, flFlags2, SomeArg2, pvmac, ERROR_NOT_SUPPORTED);
     587
     588    return ERROR_NOT_SUPPORTED;
     589}
     590
     591
     592/**
     593 * @status    stub
     594 */
     595APIRET KRNLCALL fakeVMFreeMem(
     596    PVOID   pv,
     597    USHORT  hPTDA,
     598    ULONG   flFlags
     599    )
     600{
     601    DUMMY();
     602    printf("fakeVMFreeMem:                  pv = %p, hPTDA = 0x%04x, flFlags = %08x, rc = %d\n",
     603           pv, hPTDA, flFlags, ERROR_NOT_SUPPORTED);
    586604
    587605    return ERROR_NOT_SUPPORTED;
     
    628646
    629647
     648APIRET KRNLCALL fakeVMMapDebugAlias(
     649    ULONG   flVMFlags,
     650    ULONG   ulAddress,
     651    ULONG   cbSize,
     652    HPTDA   hPTDA,
     653    PVMAC   pvmac)
     654{
     655    printf("fakeVMMapDebugAlias:            flVMFlags = 0x%08x, ulAddress = 0x%08, cbSize = 0x%08x, hPTDA = 0x%04x, pvmac = %p - not implemented\n",
     656           flVMFlags,
     657           ulAddress,
     658           cbSize,
     659           hPTDA,
     660           pvmac);
     661
     662    return ERROR_NOT_SUPPORTED;
     663}
     664
     665
     666
     667/**
     668 * ldrOpenPath - ldrOpenPath for build 14053 and above.
     669 * kernel 14053 and above.
     670 *
     671 * @returns   OS2 return code.
     672 *            plv->lv_sfn  is set to filename handle.
     673 * @param     pachFilename  Pointer to modulename. Not zero terminated!
     674 * @param     cchFilename   Modulename length.
     675 * @param     plv           Loader local variables? (Struct from KERNEL.SDF)
     676 * @param     pful          Pointer to flags which are passed on to ldrOpen.
     677 * @param     lLibPath      New parameter in build 14053.
     678 *                          ldrGetMte calls with 1
     679 *                          ldrOpenNewExe calls with 3
     680 *                          This is compared to the initial libpath index.
     681 *                              The libpath index is:
     682 *                                  BEGINLIBPATH    1
     683 *                                  LIBPATH         2
     684 *                                  ENDLIBPATH      3
     685 *                              The initial libpath index is either 1 or 2.
     686 *                          - ignored -
     687 *
     688 */
     689ULONG LDRCALL fakeldrOpenPath_new( /* retd  0x14 */
     690    PCHAR       pachFilename,      /* ebp + 0x08 */
     691    USHORT      cchFilename,       /* ebp + 0x0c */
     692    ldrlv_t *   plv,               /* ebp + 0x10 */
     693    PULONG      pful,              /* ebp + 0x14 */
     694    ULONG       lLibPath           /* ebp + 0x18 */
     695    )
     696 {
     697     NOREF(lLibPath);
     698     return fakeldrOpenPath_old(pachFilename, cchFilename, plv, pful);
     699 }
     700
     701
    630702/**
    631703 * myldrOpenPath - opens file eventually searching loader specific paths
     704 * Pre kernel 14053.
    632705 *
    633706 * @returns   OS2 return code.
     
    639712 * @status    stub
    640713 */
    641 ULONG LDRCALL fakeldrOpenPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *plv, PULONG pful)
     714ULONG LDRCALL fakeldrOpenPath_old(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *plv, PULONG pful)
    642715{
    643716    static char     szPath[1024];       /* Path buffer. Used to store pathlists. 1024 should be enough */
     
    784857ULONG LDRCALL fakeLDRClearSem(void)
    785858{
    786     return fakeKSEMReleaseMutex(&fakeLDRSem);
     859    return fakeKSEMReleaseMutex(&fakeLdrSem);
    787860}
    788861
     
    10331106
    10341107/**
     1108 * Copy user memory to user memory.
     1109 * @returns   OS/2 return code. (NO_ERROR is success)
     1110 * @param     pvUsr  Pointer to target (user) data area.
     1111 * @param     pv     Pointer to source (user) data area.
     1112 * @param     cb     Count of bytes to copy.
     1113 * @param     fl     Flags.
     1114 * @status  Partially implemented.
     1115 * @remark  Ignores fl. Crashes on error.
     1116 */
     1117ULONG KRNLCALL   fakeTKSuFuBuff(PVOID pvTarget, PVOID pvSource, ULONG cb, ULONG fl)
     1118{
     1119    memcpy(pvTarget, pvSource, cb);
     1120
     1121    printf("fakeTKSuFuBuff:                   pvTarget = %p, pvSource = %p, cb = 0x%08x, fl = 0x%08x, rc = %d\n",
     1122           pvTarget, pvSource, cb, fl, NO_ERROR);
     1123
     1124    return NO_ERROR;
     1125}
     1126
     1127
     1128/**
    10351129 * Validates an hMTE and gets the MTE pointer - FAKE.
    10361130 * @returns Pointer to MTE on success.
     
    10741168     * Take loader semaphore.
    10751169     */
    1076     rc = KSEMRequestMutex(&fakeLDRSem, KSEM_INDEFINITE_WAIT);
     1170    rc = KSEMRequestMutex(&fakeLdrSem, KSEM_INDEFINITE_WAIT);
    10771171    if (rc != NO_ERROR)
    10781172    {
     
    13901484           cchFilename, pachFilename, cchFilename, plv, pus);
    13911485
    1392     rc = fakeldrOpenPath(pachFilename, cchFilename, plv, SSToDS(&ful));
     1486    rc = fakeldrOpenPath(pachFilename, cchFilename, plv, SSToDS(&ful), 1);
    13931487    if (rc != NO_ERROR)
    13941488    {
     
    18071901PSZ SECCALL fakeSecPathFromSFN(SFN hFile)
    18081902{
    1809     APIRET  rc;
    18101903    BOOL    f32Stack = ((int)&hFile > 0x10000);
    18111904
    18121905    if (!f32Stack) ThunkStack16To32();
    18131906
    1814     rc = ERROR_NOT_SUPPORTED;
    18151907
    18161908    if (!f32Stack) ThunkStack32To16();
    18171909
    1818     printf("fakeSecPathFromSFN:                    - not implemented - hFile = 0x%04x, rc = %d\n", hFile, rc);
    1819 
    1820     return rc;
    1821 }
    1822 
     1910    printf("fakeSecPathFromSFN:                    - not implemented - hFile = 0x%04x\n", hFile);
     1911
     1912    return NULL;
     1913}
     1914
     1915/**
     1916 * PID to PTDA pointer.
     1917 * @returns     OS/2 return code.
     1918 * @param       pid     Process Identifier.
     1919 * @param       ppPTDA  Pointer to the PTDA-pointer variabel which is to receive
     1920 *                      the PTDA pointer on successful return.
     1921 */
     1922ULONG KRNLCALL  fakeTKPidToPTDA(PID pid, PPPTDA ppPTDA)
     1923{
     1924    DUMMY();
     1925    printf("fakeTKPidToPTDA:                       - not implemented - pid = 0x%04x, ppPTDA=%p\n", pid, ppPTDA);
     1926    return ERROR_NOT_SUPPORTED;
     1927}
     1928
  • trunk/src/win32k/test/fakea.asm

    r4164 r4347  
    1 ; $Id: fakea.asm,v 1.2 2000-09-02 21:08:21 bird Exp $
     1; $Id: fakea.asm,v 1.3 2000-10-01 02:58:21 bird Exp $
    22;
    33; Fake assembly imports.
    44;
    5 ; Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
     5; Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    66;
    77; Project Odin Software License can be found in LICENSE.TXT
     
    2121    include devhlp.inc
    2222    include os2.inc
     23    include options.inc
    2324
    2425
     
    3031    public fakeptda_start
    3132    public fakeptda_environ
     33    public fakeptda_handle
    3234    public fakeptda_module
    3335    public fakeptda_ptdasem
     
    3739    public fakef_FuBuff
    3840    public fakeg_tkExecPgm
    39     public fake_tkStartProcess
     41    public faketkStartProcess
    4042    public CalltkExecPgm
     43    public _fakeldrOpenPath@20
    4144
    4245
     
    4750    extrn _fakeLDRClearSem@0:PROC       ; fake.c
    4851    extrn _fakeKSEMRequestMutex@8:PROC  ; fake.c
    49     extrn fakeLDRSem:BYTE               ; fake.c
     52    extrn _fakeldrOpenPath_old@16:PROC  ; fake.c
     53    extrn _fakeldrOpenPath_new@20:PROC  ; fake.c
     54    extrn _options:options              ; d16globl.c
     55
    5056
    5157DATA16 SEGMENT
     
    6369fakeptda_environ            dw      1   ; 1 is the hardcoded HOB of the win32ktst.exe's environment.
    6470fakeptda_ptdasem            db  20  dup (0) ; PTDA semaphore - Intra-Process serialisation mutex KSEM (sg244640).
     71fakeptda_handle             dw      2   ; 2 is the hardcoded HPTDA of the current process.
    6572fakeptda_module             dw      1   ; 1 is the hardcoded HMTE of the current executable module.
    6673fakeptda_pBeginLIBPATH      dd      0   ; BEGINLIBPATH not implemented.
     
    261268;;
    262269; Faker of which simply clears the loader semaphore.
    263 ; @cproto    none! (void _Optlink   fake_tkStartProcess(void))
     270; @cproto    none! (void _Optlink   faketkStartProcess(void))
    264271; @returns
    265272; @param
     
    269276; @sketch
    270277; @status
    271 ; @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
     278; @author    knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    272279; @remark
    273 fake_tkStartProcess PROC NEAR
     280faketkStartProcess PROC NEAR
    274281    push    ebp
    275282    mov     ebp, esp
     
    286293    leave
    287294    ret
    288 fake_tkStartProcess ENDP
     295faketkStartProcess ENDP
    289296
    290297
     
    302309;            a PE-file started by pe.exe.
    303310; @status    completely implemented.
    304 ; @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
     311; @author    knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    305312;
    306313;
     
    344351    or      eax, eax
    345352    jnz     ftkep_ret
    346     call    fake_tkStartProcess         ; If succesfully so far. call start process.
     353    call    faketkStartProcess          ; If succesfully so far. call start process.
    347354    jmp     ftkep_ret2                  ; <Currently no parameters are implemented.>
    348355
     
    372379; @uses     eax, ecx, edx
    373380; @status   completely implemented.
    374 ; @author   knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
     381; @author   knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    375382; @remark
    376383CalltkExecPgm PROC NEAR
     
    491498
    492499
     500;;
     501; Wrapper for fakeldrOpenPath.
     502; @cproto       ULONG LDRCALL   fakeldrOpenPath(PCHAR pachFilename, USHORT cchFilename, ldrlv_t *plv, PULONG pful, ULONG lLibPath);
     503; @returns      Return of the current fakeldrOpenPath
     504; @param        pachFilename  Pointer to modulename. Not zero terminated!
     505; @param        cchFilename   Modulename length.
     506; @param        plv           Loader local variables? (Struct from KERNEL.SDF)
     507; @param        pful          Pointer to flags which are passed on to ldrOpen.
     508; @param        lLibPath      New parameter in build 14053.
     509;                             ldrGetMte calls with 1
     510;                             ldrOpenNewExe calls with 3
     511;                             This is compared to the initial libpath index.
     512;                                 The libpath index is:
     513;                                     BEGINLIBPATH    1
     514;                                     LIBPATH         2
     515;                                     ENDLIBPATH      3
     516;                                 The initial libpath index is either 1 or 2.
     517;                             - ignored -
     518; @uses         ecx, eax, edx
     519; @sketch
     520; @status
     521; @author       knut st. osmundsen (knut.stange.osmundsen@mynd.no)
     522; @remark
     523_fakeldrOpenPath@20 PROC NEAR
     524    ASSUME ds:FLAT
     525    ; dummy prolog.
     526    push    ebp
     527    mov     ebp, esp
     528    sub     esp, 10h
     529    add     esp, 10h
     530    pop     ebp
     531    ; real code
     532    cmp     FLAT:DATA16:_options.ulBuild, 14053
     533    jge     new
     534    jmp     near ptr FLAT:CODE32:_fakeldrOpenPath_old@16
     535new:
     536    jmp     near ptr FLAT:CODE32:_fakeldrOpenPath_new@20
     537_fakeldrOpenPath@20 ENDP
     538
    493539
    494540CODE32 ENDS
Note: See TracChangeset for help on using the changeset viewer.