Ignore:
Timestamp:
Oct 27, 1999, 4:03:01 AM (26 years ago)
Author:
bird
Message:

Corrections to make win32k work.
(And now it does work, at least at my test machine...)

Location:
trunk/src/win32k/dev16
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/dev16/d16init.c

    r847 r1467  
    1 /* $Id: d16init.c,v 1.1 1999-09-06 02:19:55 bird Exp $
     1/* $Id: d16init.c,v 1.2 1999-10-27 02:02:53 bird Exp $
    22 *
    33 * d16init - init routines for both drivers.
     
    3333#include <memory.h>
    3434
     35#include "probkrnl.h"
    3536#include "dev1632.h"
    3637#include "dev16.h"
    37 
    3838
    3939/**
     
    6161/**
    6262 * init function - device 1.
    63  * We will send an IOCtl request to the win32i$ (device 0) which will
     63 * We will send an IOCtl request to the elf$ (device 0) which will
    6464 * perform the Ring-0 initiation of the driver.
    6565 * @returns   Status word.
     
    7777    NPSZ            npszErrMsg = NULL;
    7878
    79     rc = DosOpen("\\dev\\win32i$", &hDev0, &usAction, 0UL, FILE_NORMAL,
    80                  OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
    81                  OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY,
    82                  0UL);
     79    rc = ProbeKernel(pRpIn);
    8380    if (rc == NO_ERROR)
    8481    {
    85         param.pRpInitIn = pRpIn;
    86         rc = DosDevIOCtl(&data, &param, D16_IOCTL_RING0INIT, D16_IOCTL_CAT, hDev0);
    87 /*        _asm int 3; */
     82        rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL,
     83                     OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
     84                     OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY,
     85                     0UL);
    8886        if (rc == NO_ERROR)
    8987        {
    90             if (data.Status != STATUS_DONE)
    91                 npszErrMsg = "Ring-0 initiation failed\n\r";
     88            param.pRpInitIn = pRpIn;
     89            rc = DosDevIOCtl(&data, &param, D16_IOCTL_RING0INIT, D16_IOCTL_CAT, hDev0);
     90            if (rc == NO_ERROR)
     91            {
     92                if (data.Status != STATUS_DONE)
     93                    npszErrMsg = "Ring-0 initiation failed\n\r";
     94                else
     95                {
     96                    register NPSZ npsz = "Win32k.sys succesfully initiated!\n\r";
     97                    DosPutMessage(1, strlen(npsz)+1, npsz);
     98                    pRpOut->Status = data.Status;
     99                }
     100            }
    92101            else
    93             {
    94                 register NPSZ npsz = "Test.sys succesfully initiated!\n\r";
    95                 DosPutMessage(1, strlen(npsz)+1, npsz);
    96                 pRpOut->Status = data.Status;
    97             }
     102                npszErrMsg = "DosDevIOCtl failed.\n\r";
     103            DosClose(hDev0);
    98104        }
    99105        else
    100             npszErrMsg = "DosDevIOCtl failed\n\r";
    101         DosClose(hDev0);
     106            npszErrMsg = "DosOpen failed.\n\r";
    102107    }
    103108    else
    104         npszErrMsg = "DosOpen failed\n\r";
    105 
     109        npszErrMsg = "ProbeKernel failed.\n\r";
    106110    pRpOut->BPBArray = NULL;
    107111    pRpOut->CodeEnd = (USHORT)&CODE16END;
     
    144148
    145149        pDT2 = (PDOSTABLE2)((char FAR *)pDT + pDT->cul*4 + 1);
    146         TKSSBase16 = pDT2->TKSSBase;
     150        TKSSBase16 = (ULONG)pDT2->pTKSSBase;
    147151        R0FlatCS16 = (USHORT)pDT2->R0FlatCS;
    148152        R0FlatDS16 = (USHORT)pDT2->R0FlatDS;
     
    169173                   )
    170174                {
    171                     /*_asm int 3;*/
    172175                    usRc = CallR0Init32(SSToDS_16(&rp32init));
    173                     /*_asm int 3;*/
    174176                }
    175177                else
    176178                    usRc |= ERROR_I24_INVALID_PARAMETER;
    177179
    178              ((PD16R0INITDATA)pRp->DataPacket)->Status = usRc;
     180                ((PD16R0INITDATA)pRp->DataPacket)->Status = usRc;
    179181
    180182                /* finished - unlock data and parm */
  • trunk/src/win32k/dev16/d16strat.c

    r847 r1467  
    1 /* $Id: d16strat.c,v 1.1 1999-09-06 02:19:55 bird Exp $
     1/* $Id: d16strat.c,v 1.2 1999-10-27 02:02:53 bird Exp $
    22 *
    33 * d16strat.c - 16-bit strategy routine, device headers, device_helper (ptr)
     
    3636{
    3737    {
    38         (unsigned long)(void _far *)(&aDevHdrs[1]),    /* NextHeader */
     38        (unsigned long)(void _far *)(&aDevHdrs[1]), /* NextHeader */
    3939        DEVLEV_3 | DEV_30 | DEV_CHAR_DEV,           /* SDevAtt */
    4040        (unsigned short)(void _near *)strategyAsm0, /* StrategyEP */
    4141        0,                                          /* InterruptEP */
    42         "win32i$ ", /* Later: elf ?*/               /* DevName */
     42        "elf$    ",                                 /* DevName */
    4343        0,                                          /* SDevProtCS */
    4444        0,                                          /* SDevProtDS */
     
    6767USHORT  R0FlatCS16  = 0;
    6868USHORT  R0FlatDS16  = 0;
     69BOOL    fInitTime   = TRUE;
    6970
    7071
     
    7980 * Strategy routine.
    8081 * @returns   Status word.
    81  * @param     pRpH   Pointer to request packed header.
     82 * @param     pRpH   Pointer to request packed header. (Do not change the pointer!)
    8283 * @parma     usDev  Device number.
    8384 * @remark    This function is called from the entrypoint in dev1st.asm
     
    8586USHORT NEAR strategy(PRPH pRpH, unsigned short usDev)
    8687{
     88
    8789    switch (pRpH->Cmd)
    8890    {
    8991        case CMDInit:                   /* INIT command */
    90             if (usDev == 0)
    91                 return dev0Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH);
    92             else
    93                 return dev1Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH);
     92            if (fInitTime)
     93            {
     94                if (usDev == 0)
     95                    return dev0Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH);
     96                else
     97                    return dev1Init((PRPINITIN)pRpH, (PRPINITOUT)pRpH);
     98            }
     99            break;
    94100
    95101        case CMDGenIOCTL:               /* Generic IOCTL */
     
    104110        case CMDShutdown:
    105111            return STATUS_DONE;
     112    }
    106113
    107         default:
    108             return STATUS_DONE | STATUS_ERR_UNKCMD;
    109     }
     114    return STATUS_DONE | STATUS_ERR_UNKCMD;
    110115}
    111116
     
    121126USHORT dev0GenIOCtl(PRP_GENIOCTL pRp)
    122127{
    123 /*    _asm int 3;*/
    124     if (pRp->Category == D16_IOCTL_CAT && pRp->Function == D16_IOCTL_RING0INIT)
    125         return R0Init16(pRp);
     128    USHORT rc;
     129    if (pRp->Category == D16_IOCTL_CAT)
     130    {
     131        switch (pRp->Function)
     132        {
     133            case D16_IOCTL_RING0INIT:
     134                if (fInitTime)
     135                {
     136                    rc = R0Init16(pRp);
     137                    fInitTime = FALSE;
     138                    return rc;
     139                }
     140                break;
     141
     142            case D16_IOCTL_GETKRNLOTES:
     143            {
     144                ULONG ulLin;
     145                if (DevHelp_VirtToLin(SELECTOROF(pRp->DataPacket), OFFSETOF(pRp->DataPacket), &ulLin) != NO_ERROR)
     146                    return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER;
     147                return CallGetOTEs32(ulLin);
     148            }
     149
     150            case D16_IOCTL_VERIFYPROCTAB:
     151                if (fInitTime)
     152                    return CallVerifyProcTab32();
     153                break;
     154        }
     155    }
    126156
    127157    return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER;
  • trunk/src/win32k/dev16/probkrnl.c

    r847 r1467  
    1 /* $Id: probkrnl.c,v 1.1 1999-09-06 02:19:55 bird Exp $
     1/* $Id: probkrnl.c,v 1.2 1999-10-27 02:02:53 bird Exp $
    22 *
    33 * Description:   Autoprobes the os2krnl file and os2krnl[*].sym files.
     
    1313 *                How this works:
    1414 *                1. parses the device-line parameters and collects some "SysInfo".
    15  *                2. gets the kernel object table. (win32i$)
     15 *                2. gets the kernel object table. (elf$)
    1616 *                3. finds the kernel image and scans it for a build number.
    1717 *                4. locates and scans the symbol-file(s) for the entrypoints which are wanted.
    18  *                5. the entry points are verified. (win32i$)
     18 *                5. the entry points are verified. (elf$)
    1919 *                6. finished.
    2020 *
     
    2929#ifdef DEBUGR3
    3030    #if 1
     31        int printf(const char *, ...);
    3132        #define dprintf(a) printf a
    3233    #else
     
    3536#else
    3637    #define dprintf(a)
     38    #define static
    3739#endif
    3840
     
    125127static char szMsg1[]     = "\n\r\tFound kernel: ";
    126128static char szMsg1a[]    = "\n\r\tBuild: ";
    127 static char szMsg2[]     = "\n\r\n\r\tFound symbolfile: ";
     129static char szMsg2[]     = "\n\r\tFound symbolfile: ";
    128130static char szMsg4[]     = "\n\r\tFailed to find symbolfile!\n\r";
    129131static char szMsgfailed[]= "failed!";
     
    311313
    312314/**
    313  * kstrlen - String length
    314  * @returns   length of string
    315  * @param     p  Pointer to string
    316  */
    317 static int kstrlen(const char * p)
    318 {
    319     int len = 0;
    320     while ( p[len++] != '\0');
    321     return len-1;
     315 * kstrlen - String length.
     316 * @returns   Length of the string.
     317 * @param     psz  Pointer to string.
     318 * @status    completely implemented and tested.
     319 * @author    knut st. osmundsen
     320 */
     321static int kstrlen(const char * psz)
     322{
     323    int cch = 0;
     324    while (psz[cch] != '\0')
     325        cch++;
     326    return cch;
    322327}
    323328
     
    381386    USHORT          usAction = 0;
    382387
    383     rc = DosOpen("\\dev\\win32i$", &hDev0, &usAction, 0UL, FILE_NORMAL,
     388    rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL,
    384389                 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
    385390                 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY,
     
    430435    /* read header and display it */
    431436    rc = fread(&MapDef, sizeof(MAPDEF), 1, SymFile);
    432     if ( rc )
     437    if (rc)
    433438    {
    434439        Buffer[0] = MapDef.achModName[0];
     
    591596}
    592597
    593 /* Worker function for ReadOS2Krnl */
     598/**
     599 * Worker function for ReadOS2Krnl
     600 * @returns   0 on success.
     601 *            errorcodes on failure. (-1 >= rc >= -14)
     602 * @param
     603 * @equiv
     604 * @time
     605 * @sketch
     606 * @status
     607 * @author    knut st. osmundsen
     608 * @remark
     609 */
    594610static int ReadOS2Krnl2(HFILE krnl, unsigned long  cbKrnl)
    595611{
     
    722738            if (pObj->o32_size < KrnlOTEs.aObjects[i].ote_size)
    723739                return -12;
     740
     741            #if 0 /* don't work! */
    724742            if ((pObj->o32_flags & 0xffffUL) != (KrnlOTEs.aObjects[i].ote_flags & 0xffffUL))
    725743                return -14;
     744            #endif
    726745        }
    727746    }
     
    764783    USHORT          usAction = 0;
    765784
    766     rc = DosOpen("\\dev\\win32i$", &hDev0, &usAction, 0UL, FILE_NORMAL,
     785    rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL,
    767786                 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
    768787                 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY,
     
    779798    return rc;
    780799#else
     800    KrnlOTEs.cObjects = 23;
    781801    return 0;
    782802#endif
     
    857877
    858878        /* functions */
    859         if (rc > -50)
     879        if (rc == 0)
    860880        {
    861881            puts(szMsg2);
Note: See TracChangeset for help on using the changeset viewer.