Ignore:
Timestamp:
Feb 20, 2000, 12:52:00 AM (26 years ago)
Author:
bird
Message:

Partly finished 16-bit import code++.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/dev32/d32init.c

    r2827 r2831  
    1 /* $Id: d32init.c,v 1.10 2000-02-19 08:40:29 bird Exp $
     1/* $Id: d32init.c,v 1.11 2000-02-19 23:51:59 bird Exp $
    22 *
    33 * d32init.c - 32-bits init routines.
     
    5454
    5555/* extern(s) located in calltab.asm */
    56 extern char     callTab[NUMBER_OF_PROCS][MAXSIZE_PROLOG];
     56extern char     callTab[NBR_OF_KRNLIMPORTS][MAXSIZE_PROLOG];
    5757
    5858/* extern(s) located in mytkExecPgm.asm  */
     
    342342
    343343/**
    344  * Verifies the aProcTab.
     344 * Verifies the aImportTab.
    345345 * @returns   0 if ok. !0 if not ok.
    346346 * @remark    Called from IOCtl.
     
    352352
    353353    /* verify */
    354     for (i = 0; i < NUMBER_OF_PROCS; i++)
     354    for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
    355355    {
    356356        /* verify that it is found */
    357         if (!_aProcTab[i].fFound)
     357        if (!_aImportTab[i].fFound)
    358358        {
    359359            kprintf(("VerifyProcTab32: procedure no.%d was not found!\n", i));
     
    362362
    363363        /* verify read/writeable. - FIXME */
    364         if (_aProcTab[i].ulAddress < 0xffe00000UL)
     364        if (_aImportTab[i].ulAddress < 0xffe00000UL)
    365365        {
    366366            kprintf(("VerifyProcTab32: procedure no.%d has an invlalid address, %#08x!\n",
    367                      i, _aProcTab[i].ulAddress));
     367                     i, _aImportTab[i].ulAddress));
    368368            return STATUS_DONE | STERR | 2;
    369369        }
    370370
    371         switch (_aProcTab[i].fType)
     371        switch (_aImportTab[i].fType)
    372372        {
    373373            case EPT_PROC:
    374374            case EPT_PROCIMPORT:
    375375                /* verify known function prolog. */
    376                 if ((cb = interpretFunctionProlog((char*)_aProcTab[i].ulAddress, _aProcTab[i].fType == EPT_PROC))
     376                if ((cb = interpretFunctionProlog((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC))
    377377                    <= 0 && cb + 5 >= MAXSIZE_PROLOG)
    378378                {
     
    534534     * verify proctable
    535535     */
    536     for (i = 0; i < NUMBER_OF_PROCS; i++)
    537     {
    538         if (_aProcTab[i].fType != EPT_PROC && _aProcTab[i].fType != EPT_PROCIMPORT)
     536    for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
     537    {
     538        if (_aImportTab[i].fType != EPT_PROC && _aImportTab[i].fType != EPT_PROCIMPORT)
    539539        {
    540540            kprintf(("procInit: EPT_VAR is not supported. (procedure no.%d, cb=%d)\n", i, cb));
    541541            return 1;
    542542        }
    543         cb = interpretFunctionProlog((char*)_aProcTab[i].ulAddress, _aProcTab[i].fType == EPT_PROC);
     543        cb = interpretFunctionProlog((char*)_aImportTab[i].ulAddress, _aImportTab[i].fType == EPT_PROC);
    544544        if (cb <= 0 || cb + 5 >= MAXSIZE_PROLOG)
    545545        {
     
    552552     * rehook / import
    553553     */
    554     for (i = 0; i < NUMBER_OF_PROCS; i++)
    555     {
    556         switch (_aProcTab[i].fType)
     554    for (i = 0; i < NBR_OF_KRNLIMPORTS; i++)
     555    {
     556        switch (_aImportTab[i].fType)
    557557        {
    558558            case EPT_PROC:
    559559            {
    560                 cb = interpretFunctionProlog((char*)_aProcTab[i].ulAddress, TRUE);
     560                cb = interpretFunctionProlog((char*)_aImportTab[i].ulAddress, TRUE);
    561561                if (cb > 0 && cb + 5 < MAXSIZE_PROLOG)
    562562                {
    563                     static unsigned auFuncs[NUMBER_OF_PROCS] = /* This table must be updated with the overloading functions. */
     563                    static unsigned auFuncs[NBR_OF_KRNLIMPORTS] = /* This table must be updated with the overloading functions. */
    564564                    {
    565565                        (unsigned)myldrRead,
     
    580580
    581581                    /* copy function prolog */
    582                     memcpy(callTab[i], (void*)_aProcTab[i].ulAddress, (size_t)cb);
     582                    memcpy(callTab[i], (void*)_aImportTab[i].ulAddress, (size_t)cb);
    583583
    584584                    /* jump from calltab to original function */
    585585                    callTab[i][cb] = 0xE9; /* jmp */
    586                     *(unsigned*)(void*)&callTab[i][cb+1] = _aProcTab[i].ulAddress + cb - (unsigned)&callTab[i][cb+5];
     586                    *(unsigned*)(void*)&callTab[i][cb+1] = _aImportTab[i].ulAddress + cb - (unsigned)&callTab[i][cb+5];
    587587
    588588
    589589                    /* jump from original function to my function - an cli(?) could be needed here */
    590                     *(char*)_aProcTab[i].ulAddress = 0xE9; /* jmp */
    591                     *(unsigned*)(_aProcTab[i].ulAddress + 1) = auFuncs[i] - (_aProcTab[i].ulAddress + 5);
     590                    *(char*)_aImportTab[i].ulAddress = 0xE9; /* jmp */
     591                    *(unsigned*)(_aImportTab[i].ulAddress + 1) = auFuncs[i] - (_aImportTab[i].ulAddress + 5);
    592592                }
    593593                else
     
    602602            case EPT_PROCIMPORT:
    603603            {
    604                 cb = interpretFunctionProlog((char*)_aProcTab[i].ulAddress, FALSE);
     604                cb = interpretFunctionProlog((char*)_aImportTab[i].ulAddress, FALSE);
    605605                if (cb > 0 && cb + 5 < MAXSIZE_PROLOG)
    606606                {
    607607                    /* jump from calltab to original function */
    608608                    callTab[i][0] = 0xE9; /* jmp */
    609                     *(unsigned*)(void*)&callTab[i][1] = _aProcTab[i].ulAddress - (unsigned)&callTab[i][cb+5];
     609                    *(unsigned*)(void*)&callTab[i][1] = _aImportTab[i].ulAddress - (unsigned)&callTab[i][cb+5];
    610610                }
    611611                else
Note: See TracChangeset for help on using the changeset viewer.