Changeset 1535 for trunk/src


Ignore:
Timestamp:
Nov 1, 1999, 12:57:09 AM (26 years ago)
Author:
bird
Message:

Updated option/argument handling.
Corrected a few bugs.

Location:
trunk/src/win32k
Files:
13 edited

Legend:

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

    r1467 r1535  
    1 /* $Id: d16init.c,v 1.2 1999-10-27 02:02:53 bird Exp $
     1/* $Id: d16init.c,v 1.3 1999-10-31 23:57:00 bird Exp $
    22 *
    33 * d16init - init routines for both drivers.
     
    9494                else
    9595                {
     96                    /* FIXME quiet test! */
    9697                    register NPSZ npsz = "Win32k.sys succesfully initiated!\n\r";
    9798                    DosPutMessage(1, strlen(npsz)+1, npsz);
  • trunk/src/win32k/dev16/probkrnl.c

    r1467 r1535  
    1 /* $Id: probkrnl.c,v 1.2 1999-10-27 02:02:53 bird Exp $
     1/* $Id: probkrnl.c,v 1.3 1999-10-31 23:57:01 bird Exp $
    22 *
    33 * Description:   Autoprobes the os2krnl file and os2krnl[*].sym files.
     
    66 *                16-bit inittime code.
    77 *
    8  *                All data has to be initiated because this file is to be compiled into assembly,
    9  *                automaticly modified and run thru an assembler to produce an object-file. This
    10  *                because there is no other known way to combine 32-bit and 16-bit C/C++ code into
    11  *                the same device driver which works.
     8 *                All data has to be initiated because this is 16-bit C code
     9 *                and is to be linked with 32-bit C/C++ code. Uninitiazlied
     10 *                data ends up in the BSS segment, and that segment can't
     11 *                both be 32-bit and 16-bit. I have not found any other way
     12 *                around this problem that initiating all data.
    1213 *
    1314 *                How this works:
     
    8687};
    8788
    88 unsigned long int   fInitSuccess = 0;
    8989unsigned long int   ulBuild      = 0;
    9090unsigned short      usVerMajor   = 0;
     
    9696 */
    9797static int      fQuiet = 0;
    98 
    9998static char     szUsrOS2Krnl[50] = {0};
    10099static char     szOS2Krnl[]      = {"c:\\os2krnl"};
     
    917916/**
    918917 * "main" function.
     918 * Note that the option -Noloader causes nothing to be done.
    919919 * @returns   0 on success, something else on error.
    920920 * @param     pReqPack  Pointer to init request packet
    921921 * @remark
    922  * @result    init_success
    923922 */
    924923int ProbeKernel(PRPINITIN pReqPack)
     
    943942            {
    944943                i++;
    945                 if (pReqPack->InitArgs[i] == 'V' || pReqPack->InitArgs[i] == 'v')
    946                     fQuiet = 0;
    947                 else if (pReqPack->InitArgs[i] == 'Q' || pReqPack->InitArgs[i] == 'q')
    948                     fQuiet = 1;
    949                 else if (pReqPack->InitArgs[i] == 'K' || pReqPack->InitArgs[i] == 'k')
    950                 {   /* kernel file */
    951                     i++;
    952                     i += kargncpy(szUsrOS2Krnl, &pReqPack->InitArgs[i], sizeof(szUsrOS2Krnl));
    953                 }
    954                 else if (pReqPack->InitArgs[i] == 'S' || pReqPack->InitArgs[i] == 's')
    955                 {   /* symbol file */
    956                     i++;
    957                     i += kargncpy(szUsrSym, &pReqPack->InitArgs[i], sizeof(szUsrSym));
     944                switch (pReqPack->InitArgs[i])
     945                {
     946                    case 'k':
     947                    case 'K': /* Kernel file */
     948                        i++;
     949                        i += kargncpy(szUsrOS2Krnl, &pReqPack->InitArgs[i], sizeof(szUsrOS2Krnl));
     950                        break;
     951
     952                    case 'n':
     953                    case 'N': /* NoLoader */
     954                        return 0;
     955
     956                    case 'q':
     957                    case 'Q': /* Quiet */
     958                        fQuiet = 1;
     959                        break;
     960
     961                    case 's':
     962                    case 'S': /* Symbol file */
     963                        i++;
     964                        i += kargncpy(szUsrSym, &pReqPack->InitArgs[i], sizeof(szUsrSym));
     965                        break;
     966
     967                    case 'v':
     968                    case 'V': /* Verbose */
     969                        fQuiet = 0;
     970                        break;
    958971                }
    959972            }
     
    10291042    dprintf(("rc=%d; i=%d\n", rc, i));
    10301043    ShowResult(rc, i);
    1031     fInitSuccess = rc = 0;
    10321044
    10331045    return rc;
  • trunk/src/win32k/dev32/d32hlp.asm

    r1467 r1535  
    1 ; $Id: d32hlp.asm,v 1.2 1999-10-27 02:02:54 bird Exp $
     1; $Id: d32hlp.asm,v 1.3 1999-10-31 23:57:02 bird Exp $
    22;
    33; d32hlp - 32-bit Device Driver Helper Function.
     
    3939CODE32 segment dword public 'CODE' use32
    4040    assume cs:CODE32, ds:flat, ss:nothing, es:nothing
    41 
     41    .386p
    4242
    4343;PVOID  D32HLPCALL D32Hlp_VirtToLin(ULONG  ulPtr16); /* eax */
     
    101101D32Hlp_GetDOSVar proc near
    102102    push    bx
    103 
    104     mov     cx, ax
    105     mov     al, dl
    106 
     103    mov     ecx, edx
    107104    mov     dl, DevHlp_GetDOSVar
    108105    jmp     far ptr CODE16:Thunk16_GetDOSVar
     
    116113
    117114Error:
    118     mov     ax, 87
     115    xor     eax, eax
    119116
    120117Finished:
  • trunk/src/win32k/dev32/d32init.c

    r1467 r1535  
    1 /* $Id: d32init.c,v 1.2 1999-10-27 02:02:54 bird Exp $
     1/* $Id: d32init.c,v 1.3 1999-10-31 23:57:02 bird Exp $
    22 *
    33 * d32init.c - 32-bits init routines.
     
    8989        switch (*pszTmp)
    9090        {
     91            case 'c':
    9192            case 'C': /* -C[1|2] - com-port no, def:-C2 */
    9293                switch (pszTmp[1])
     
    102103                break;
    103104
     105            case 'e':
     106            case 'E':/* ELF */
     107                pszTmp2 = strpbrk(pszTmp, ":=/- ");
     108                if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1
     109                    && (pszTmp2[1] == 'N' ||pszTmp2[1] == 'n' || pszTmp2[1] == 'D' || pszTmp2[1] == 'd')
     110                    )
     111                    options.fElf = FALSE;
     112                else
     113                    options.fElf = TRUE;
     114                break;
     115
     116            case 'l':
    104117            case 'L': /* -L[..]<:|=| >[<Y..|E..| > | <N..|D..>] */
    105118                pszTmp2 = strpbrk(pszTmp, ":=/- ");
     
    112125                break;
    113126
    114 
     127            case 'n':
     128            case 'N': /* NoLoader */
     129                options.fNoLoader = TRUE;
     130                break;
     131
     132            case 'p':
     133            case 'P': /* PE */
     134                pszTmp2 = strpbrk(pszTmp, ":=/- ");
     135                if (pszTmp2 != NULL && (*pszTmp == ':' || *pszTmp == '='))
     136                {
     137                    pszTmp++;
     138                    if (strnicmp(pszTmp, "pe2lx", 5) == 0)
     139                        options.fPE = FLAGS_PE_PE2LX;
     140                    else if (strnicmp(pszTmp, "pe", 2) == 0)
     141                        options.fPE = FLAGS_PE_PE;
     142                    else if (strnicmp(pszTmp, "mixed", 2) == 0)
     143                        options.fPE = FLAGS_PE_MIXED;
     144                    else if (strnicmp(pszTmp, "not", 2) == 0)
     145                        options.fPE = FLAGS_PE_NOT;
     146                    else
     147                        kprintf(("R0Init32: invalid parameter -PE:...\n"));
     148                }
     149                else
     150                    kprintf(("R0Init32: invalid parameter -PE...\n"));
     151                break;
     152
     153            case 'q':
    115154            case 'Q': /* quiet initialization */
    116155                options.fQuiet = TRUE;
    117156                break;
    118157
     158            case 's':
    119159            case 'S': /* SMP kernel */
    120160                options.fKernel = KF_SMP;
    121161                break;
    122162
     163            case 'v':
    123164            case 'V': /* verbose initialization */
    124165                options.fQuiet = FALSE;
    125166                break;
    126167
     168            case 'u':
    127169            case 'U': /* UNI kernel */
    128170                options.fKernel = KF_SMP;
     
    161203     */
    162204    /* heap */
    163     if (heapInit(HEAP_SIZE) != NO_ERROR)
     205    if (heapInit(options.cbHeap) != NO_ERROR)
    164206        return STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL;
    165207
    166208    /* loader */
    167     if (ldrInit() != NO_ERROR)
    168         return STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL;
     209    if (!options.fNoLoader)
     210        if (ldrInit() != NO_ERROR)
     211            return STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL;
    169212
    170213    /* functionoverrides */
    171     if (procInit() != NO_ERROR)
    172         return STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL;
     214    if (!options.fNoLoader)
     215        if (procInit() != NO_ERROR)
     216            return STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL;
    173217
    174218    return STATUS_DONE;
     
    296340     *  or
    297341     *     push ebp
    298      *     mov ecx, dword ptr [123407452]
     342     *     mov ecx, dword ptr [xxxxxxxx]
    299343     */
    300344
  • trunk/src/win32k/include/dev32hlp.h

    r847 r1535  
    1 /* $Id: dev32hlp.h,v 1.1 1999-09-06 02:19:58 bird Exp $
     1/* $Id: dev32hlp.h,v 1.2 1999-10-31 23:57:03 bird Exp $
    22 *
    33 * Dev32Hlp - 32-bit Device helpers.
     
    5353 * D32Hlp_GetDOSVar
    5454 */
    55 #define DHGETDOSV_SYSINFOSEG             1UL
    56 #define DHGETDOSV_LOCINFOSEG             2UL
    57 #define DHGETDOSV_VECTORSDF              4UL
    58 #define DHGETDOSV_VECTORREBOOT           5UL
    59 #define DHGETDOSV_YIELDFLAG              7UL
    60 #define DHGETDOSV_TCYIELDFLAG            8UL
    61 #define DHGETDOSV_DOSTABLES              9UL /* undocumented by IBM */
    62 #define DHGETDOSV_DOSCODEPAGE           11UL
    63 #define DHGETDOSV_INTERRUPTLEV          13UL
    64 #define DHGETDOSV_DEVICECLASSTABLE      14UL
    65 #define DHGETDOSV_DMQSSELECTOR          15UL
    66 #define DHGETDOSV_APMINFO               16UL
     55/*                                       0  reserved */
     56#define DHGETDOSV_SYSINFOSEG             1
     57#define DHGETDOSV_LOCINFOSEG             2
     58/*                                       3  reserved */
     59#define DHGETDOSV_VECTORSDF              4
     60#define DHGETDOSV_VECTORREBOOT           5
     61#define DHGETDOSV_YIELDFLAG              7
     62#define DHGETDOSV_TCYIELDFLAG            8
     63#define DHGETDOSV_DOSTABLES              9  /* undocumented */
     64#define DHGETDOSV_STRP_COMMON           10  /* undocumented */
     65#define DHGETDOSV_DOSCODEPAGE           11
     66#define DHGETDOSV_INTERRUPTLEV          13
     67#define DHGETDOSV_DEVICECLASSTABLE      14
     68#define DHGETDOSV_DMQSSELECTOR          15
     69#define DHGETDOSV_APMINFO               16
     70#define DHGETDOSV_APM_LENGTH            17  /* undocumented? */
    6771
    6872
     
    9498                                    ULONG  ulOffset,
    9599                                    PPVOID ppvLinAddress);
    96 PVOID  D32HLPCALL D32Hlp_GetDOSVar(ULONG ulVarNumber, ULONG ulVarMember);
     100PVOID  D32HLPCALL D32Hlp_GetDOSVar(USHORT ulVarNumber, USHORT ulVarMember);
    97101VOID   D32HLPCALL D32Hlp_Yield(VOID);
    98102PVOID  D32HLPCALL D32Hlp_VMAlloc(ULONG  flFlags,
  • trunk/src/win32k/include/malloc.h

    r1467 r1535  
    1 /* $Id: malloc.h,v 1.3 1999-10-27 02:02:57 bird Exp $
     1/* $Id: malloc.h,v 1.4 1999-10-31 23:57:04 bird Exp $
    22 *
    33 * Heap.
     
    4646#define MAXPTR _uHeapMaxPtr
    4747
    48 /*#define HEAP_SIZE 0x00600000U*/ /* 10MB of heap */
    49 #define HEAP_SIZE 0x100000U /* 1MB of heap */
    50 
    5148/* HeapPointer assert - old ones... */
    5249#define ltasserthp(a)         if (!_validptr((void*)(a))){ _ltasserthp((void*)(a), #a,__FILE__,__LINE__); return FALSE;}
  • trunk/src/win32k/include/options.h

    r1467 r1535  
    1 /* $Id: options.h,v 1.2 1999-10-27 02:02:57 bird Exp $
     1/* $Id: options.h,v 1.3 1999-10-31 23:57:04 bird Exp $
    22 *
    33 * Options.
     
    1919#define KF_SMP      0x00000001UL
    2020
     21/* fPE */
     22#define FLAGS_PE_NOT        0x00000000UL
     23#define FLAGS_PE_PE2LX      0x00000001UL
     24#define FLAGS_PE_PE         0x00000002UL
     25#define FLAGS_PE_MIXED      0x00000003UL
     26
     27/* ulInfoLevel */
     28#define INFOLEVEL_QUIET      0x00000000UL
     29#define INFOLEVEL_ERROR      0x00000001UL
     30#define INFOLEVEL_WARNING    0x00000002UL
     31#define INFOLEVEL_INFO       0x00000003UL
     32#define INFOLEVEL_INFOALL    0x00000004UL
     33
    2134/* Set defaults. */
    22 #define SET_OPTIONS_TO_DEFAULT(o)            \
    23             o.fQuiet         = 0;            \
    24             o.usCom          = OUTPUT_COM2;  \
    25             o.fLogging       = 0;            \
    26             o.ulBuild        = ~0;           \
    27             o.fKernel        = KF_UNI;       \
    28             o.usVerMajor     = ~0;           \
    29             o.usVerMinor     = ~0;
     35#define SET_OPTIONS_TO_DEFAULT(o)           \
     36            o.fQuiet      = FALSE;          \
     37            o.usCom       = OUTPUT_COM2;    \
     38            o.fLogging    = FALSE;          \
     39            o.fKernel     = KF_UNI;         \
     40            o.ulBuild     = ~0UL;           \
     41            o.usVerMajor  = ~0;             \
     42            o.usVerMinor  = ~0;             \
     43            o.fPE         = FLAGS_PE_PE2LX; \
     44            o.ulInfoLevel = INFOLEVEL_QUIET;\
     45            o.fElf        = FALSE;          \
     46            o.fScript     = FALSE;          \
     47            o.fNoLoader   = FALSE;          \
     48            o.cbHeap      = 0x100000; /* 1MB */
    3049
    3150
     
    3655struct options
    3756{
    38     //*************/
    3957    /** @cat misc */
    40     //*************/
    41     BOOL        fQuiet;              /* quiet initialization */
     58    BOOL        fQuiet;              /* Quiet initialization. */
     59
     60    /** @cat logging options */
    4261    USHORT      usCom;               /* Output port no. */
     62    BOOL        fLogging;            /* Logging. */
    4363
    44     //************************/
    45     /** @cat logging options */
    46     //************************/
    47     BOOL        fLogging;            /* logging */
    48 
    49     //*************************/
    5064    /** @cat kernel selection */
    51     //*************************/
    52     ULONG       fKernel;            /* smp or uni kernel */
    53     ULONG       ulBuild;            /* kernel build */
     65    ULONG       fKernel;            /* Smp or uni kernel. */
     66    ULONG       ulBuild;            /* Kernel build. */
    5467    USHORT      usVerMajor;         /* OS/2 major ver - 20 */
    5568    USHORT      usVerMinor;         /* OS/2 minor ver - 30,40 */
    5669
    57     //******************************************************/
    58     /** @cat Options affecting the generated LX executable */
    59     //******************************************************/
    60     /* none yet... */
     70    /** @cat Options affecting the generated LX executables */
     71    BOOL        fPE;                /* Flags set the type of conversion. */
     72    ULONG       ulInfoLevel;        /* Pe2Lx InfoLevel. */
     73
     74    /** @cat Options affecting the generated ELF executables */
     75    BOOL        fElf;               /* Elf flags. */
     76
     77    /** @cat Options affecting the script executables */
     78    BOOL        fScript;            /* Script flags. */
     79
     80    /** @cat Options affecting the script executables */
     81    BOOL        fNoLoader;          /* No loader stuff. */
     82
     83    /** @cat Options affecting the heap. */
     84    ULONG       cbHeap;             /* Initial heapsize. */
     85    #if 0
     86    ULONG       cbHeapMax;          /* Maximum heapsize. */
     87    ULONG       cbHeapResident;     /* Initial residentheapsize. */
     88    ULONG       cbHeapMaxResident;  /* Maxiumem residentheapsize. */
     89    #endif
    6190};
    6291
  • trunk/src/win32k/include/yield.h

    r847 r1535  
    1 /* $Id: yield.h,v 1.1 1999-09-06 02:20:00 bird Exp $
     1/* $Id: yield.h,v 1.2 1999-10-31 23:57:05 bird Exp $
     2 *
    23 * Yield - conversion may take some time. So it is necessary to
    34 *         check it's time to yield the processor to other processes.
     
    1314#endif
    1415
    15 void Yield(void);
     16
     17#ifdef RING0
     18    BOOL Yield(void);
     19#else
     20    #define Yield() FALSE
     21#endif
     22
    1623
    1724#ifdef __cplusplus
  • trunk/src/win32k/ldr/ldr.cpp

    r1512 r1535  
    1 /* $Id: ldr.cpp,v 1.4 1999-10-29 17:02:34 bird Exp $
     1/* $Id: ldr.cpp,v 1.5 1999-10-31 23:57:05 bird Exp $
    22 *
    33 * ldr.cpp - Loader helpers.
     
    248248    pMTERoot = NULL;
    249249
    250     /* set pe2lx according to quite/verbose */
    251     if (options.fQuiet)
    252         Pe2Lx::ulInfoLevel = Pe2Lx::Quiet;
    253     else
    254         Pe2Lx::ulInfoLevel = Pe2Lx::Info;
     250    /* Pe2Lx logging. */
     251    Pe2Lx::ulInfoLevel = options.ulInfoLevel;
    255252
    256253    return rc;
  • trunk/src/win32k/ldr/myldrOpen.cpp

    r1467 r1535  
    1 /* $Id: myldrOpen.cpp,v 1.3 1999-10-27 02:02:58 bird Exp $
     1/* $Id: myldrOpen.cpp,v 1.4 1999-10-31 23:57:06 bird Exp $
    22 *
    33 * myldrOpen - _ldrOpen.
     
    2323#include <stdlib.h>
    2424
    25 
    2625#include "log.h"
    2726#include <peexe.h>
     
    3332#include "ldr.h"
    3433#include "ldrCalls.h"
     34#include "options.h"
    3535
    3636
     
    5252        kprintf(("_ldrOpen:  phFile=%#.4x, flags=%#.8x, pszFn=%s\n", *phFile, param3, pszFilename));
    5353
    54     if (rc == NO_ERROR)
     54    if (rc == NO_ERROR && (options.fElf || options.fPE != FLAGS_PE_NOT || options.fScript))
    5555    {
    5656        static char achBuffer[sizeof(IMAGE_DOS_HEADER)];
    5757        PIMAGE_DOS_HEADER   pMzHdr = (PIMAGE_DOS_HEADER)&achBuffer[0];
     58        PIMAGE_NT_HEADERS   pNtHdrs = (PIMAGE_NT_HEADERS)&achBuffer[0]; /* oops. Last accessible field is OptionalHeader.FileAlignment */
    5859        char               *pach = &achBuffer[0];
    5960
     
    6263         * This costs up to two disk reads!
    6364         */
    64         rc = _ldrRead(*phFile, 0UL, pMzHdr, 0UL, sizeof(*pMzHdr), NULL);
     65        rc = _ldrRead(*phFile, 0UL, pMzHdr, 0UL, sizeof(IMAGE_DOS_HEADER), NULL);
    6566        if (rc == NO_ERROR)
    6667        {
    67             if (pMzHdr->e_magic == IMAGE_DOS_SIGNATURE &&
    68                 pMzHdr->e_lfanew > sizeof(IMAGE_DOS_HEADER) && pMzHdr->e_lfanew < 0x04000000UL) /* Larger than 64 bytes and less that 64MB. */
    69             {   /* MZ header found */
    70                 /* read */
    71                 rc = _ldrRead(*phFile, pMzHdr->e_lfanew, pMzHdr, 0UL, 4UL, NULL);
     68            if ((pMzHdr->e_magic == IMAGE_DOS_SIGNATURE &&
     69                 pMzHdr->e_lfanew > sizeof(IMAGE_DOS_HEADER) && pMzHdr->e_lfanew < 0x04000000UL) /* Larger than 64 bytes and less that 64MB. */
     70                || *(PULONG)pach == IMAGE_NT_SIGNATURE)
     71            {   /* MZ or PE header found */
     72                if (options.fPE == FLAGS_PE_NOT)
     73                    return NO_ERROR;
     74
     75                if (*(PULONG)pach != IMAGE_NT_SIGNATURE)
     76                    rc = _ldrRead(*phFile, pMzHdr->e_lfanew, pach, 0UL, sizeof(achBuffer), NULL);
     77
    7278                if (rc == NO_ERROR && *(PULONG)pach == IMAGE_NT_SIGNATURE)
    7379                {   /* PE signature found */
    74                     PMODULE pMod;
    75 
    7680                    kprintf(("_ldrOpen: PE executable...\n"));
    77                     #pragma info(none)
    78                     if (/* invoke pe.exe or do conversion now? */ 1)
    79                     {   /* pe2lx - win32k */
    80                     #pragma info(restore)
     81                    if (options.fPE == FLAGS_PE_PE2LX
     82                        || (options.fPE == FLAGS_PE_MIXED
     83                            && !((pNtHdrs->FileHeader.Characteristics & IMAGE_FILE_DLL == 0UL)
     84                                 && pNtHdrs->OptionalHeader.ImageBase >= 0x04000000UL /* 64MB */
     85                                 )
     86                            )
     87                        )
     88                    {   /* pe2lx */
    8189                        Pe2Lx * pPe2Lx = new Pe2Lx(*phFile);
    8290                        if (pPe2Lx != NULL)
     
    101109                    }
    102110                    else
    103                     {   /* pe.exe */
    104                         kprintf(("_ldrOpen: pe.exe - opening\n"));
    105                         _ldrClose(*phFile);
    106                         rc = _ldrOpen(phFile, "pe.exe", param3);  /* path....! problems! */
    107                         kprintf(("_ldrOpen: pe.exe - open returned with rc = %d\n", rc));
    108                     }
     111                        if (options.fPE == FLAGS_PE_PE || options.fPE == FLAGS_PE_MIXED)
     112                        {   /* pe.exe */
     113                            kprintf(("_ldrOpen: pe.exe - opening\n"));
     114                            _ldrClose(*phFile);
     115                            rc = _ldrOpen(phFile, "pe.exe", param3);  /* path....! problems! */
     116                            kprintf(("_ldrOpen: pe.exe - open returned with rc = %d\n", rc));
     117                            return rc;
     118                        }
    109119                }
    110120                rc = NO_ERROR;
     
    112122            else
    113123            {
    114                 if (*pach == '#')
    115                 {
    116                     /* unix styled script...? must be more than 64 bytes long.... */
    117                     char *pszStart = pach+1;
    118                     char *pszEnd;
    119                     kprintf(("_ldrOpen: unix script?\n"));
    120                     /* skip blanks */
    121                     while (*pszStart != '\0' && (*pszStart == ' ' || *pszStart == '\t'))
    122                         pszStart++;
    123                     if (*pszStart != '\0' && *pszStart != '\r' && *pszStart != '\n')
    124                     {   /* find end-of-word */
    125                         while (*pszEnd != '\0' && *pszEnd != '\n' && *pszEnd != '\r'
    126                                && *pszEnd != '\t' && *pszEnd != ' ')
    127                             pszEnd++;
    128                         *pszEnd = '\0';
    129                         kprintf(("_ldrOpen: unix script - opening %s\n", pszStart));
    130                         _ldrClose(*phFile);
    131                         rc = _ldrOpen(phFile, pszStart, param3);
    132                         kprintf(("_ldrOpen: unix script - open returned with rc = %d\n", rc));
    133                     }
    134                     else
    135                         kprintf(("_ldrOpen: unix script - unexpected end of line/file. (line: %.10s\n", pach));
    136                 }
    137                 else if (pach[0] == ELFMAG0 && pach[1] == ELFMAG1 && pach[2] == ELFMAG2 && pach[3] == ELFMAG3)
     124                if (pach[0] == ELFMAG0 && pach[1] == ELFMAG1 && pach[2] == ELFMAG2 && pach[3] == ELFMAG3)
    138125                {
    139126                    /* ELF signature found */
    140127                    kprintf(("_ldrOpen: ELF executable! - not implemented yet!\n"));
    141128                }
     129                else
     130                    if (*pach == '#')
     131                    {
     132                        /* unix styled script...? Must be more than 64 bytes long? No options. firstline < 64 bytes. */
     133                        char *pszStart = pach+1;
     134                        char *pszEnd;
     135                        kprintf(("_ldrOpen: unix script?\n"));
     136
     137                        achBuffer[sizeof(achBuffer)-1] = '\0'; /* just to make sure we don't read to much... */
     138
     139                        /* skip blanks */
     140                        while (*pszStart != '\0' && (*pszStart == ' ' || *pszStart == '\t'))
     141                            pszStart++;
     142                        if (*pszStart != '\0' && *pszStart != '\r' && *pszStart != '\n')
     143                        {   /* find end-of-word */
     144                            while (*pszEnd != '\0' && *pszEnd != '\n' && *pszEnd != '\r'
     145                                   && *pszEnd != '\t' && *pszEnd != ' ')
     146                                pszEnd++;
     147                            *pszEnd = '\0';
     148                            if (*pszEnd != '\0')
     149                            {
     150                                kprintf(("_ldrOpen: unix script - opening %s\n", pszStart));
     151                                _ldrClose(*phFile);
     152                                rc = _ldrOpen(phFile, pszStart, param3);
     153                                kprintf(("_ldrOpen: unix script - open returned with rc = %d\n", rc));
     154                            }
     155                        }
     156                        else
     157                            kprintf(("_ldrOpen: unix script - unexpected end of line/file. (line: %.10s\n", pach));
     158                    }
    142159            }
    143160        }
  • trunk/src/win32k/misc/vprintf.c

    r1467 r1535  
    1 /* $Id: vprintf.c,v 1.2 1999-10-27 02:03:00 bird Exp $
     1/* $Id: vprintf.c,v 1.3 1999-10-31 23:57:07 bird Exp $
    22 *
    33 * vprintf and printf
     
    3636    #include <builtin.h>
    3737    #include "options.h"
     38    #include "Yield.h"
    3839#endif
    3940
     
    215216{
    216217    #ifdef RING0
    217         if (options.fQuiet)
     218        if (!options.fLogging)
    218219            return 0;
    219220    #else
     
    413414
    414415    #ifdef RING0
    415         if (options.fQuiet)
     416        if (!options.fLogging)
    416417            return 0;
    417418    #endif
     
    432433
    433434    #ifdef RING0
    434         if (options.fQuiet)
     435        if (!options.fLogging)
    435436            return 0;
    436437    #endif
     
    450451
    451452    #ifdef RING0
    452         if (options.fQuiet)
     453        if (!options.fLogging)
    453454            return 0;
    454455    #endif
     
    490491            while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
    491492            _outp(options.usCom, ch);                   /* Put the char. */
     493            Yield();
    492494        #else
    493495            DosWrite(1, (void*)&ch, 1, &ulWrote);
     
    507509static char *strout(char *psz, signed cchMax)
    508510{
     511    int cchYield = 0;
    509512    while (cchMax > 0 && *psz != '\0')
    510513    {
     
    536539                while (!(_inp(options.usCom + 5) & 0x20));  /* Waits for the port to be ready. */
    537540                _outp(options.usCom, chNewLine);            /* Put the char. */
     541                cchYield ++;
    538542            #else
    539543                DosWrite(1, (void*)&chReturn, 1, &ul);
     
    550554        psz += cch;
    551555        cchMax -= cch;
     556        cchYield += cch;
     557        if (cchYield > 3)
     558            if (Yield())
     559                cchYield = 0;
    552560    }
    553561    return psz;
  • trunk/src/win32k/misc/yield.c

    r1272 r1535  
    1 /* $Id: yield.c,v 1.2 1999-10-14 01:20:34 bird Exp $
     1/* $Id: yield.c,v 1.3 1999-10-31 23:57:08 bird Exp $
    22 *
    33 * Yield - conversion may take some time. So it is necessary to
     
    2727 * Checks if we have to yield the CPU. Yield it if we must.
    2828 */
    29 void Yield(void)
     29BOOL Yield(void)
    3030{
    3131    PBYTE  pfbYield;
    3232
    3333    pfbYield = D32Hlp_GetDOSVar(DHGETDOSV_YIELDFLAG, 0UL);
     34    if (pfbYield != NULL && *pfbYield)
     35    {
     36        D32Hlp_Yield();
     37        return TRUE;
     38    }
    3439
    35     if (pfbYield != NULL && *pfbYield)
    36         D32Hlp_Yield();
     40    return FALSE;
    3741}
  • trunk/src/win32k/pe2lx/pe2lx.cpp

    r1467 r1535  
    1 /* $Id: pe2lx.cpp,v 1.5 1999-10-27 02:03:01 bird Exp $
     1/* $Id: pe2lx.cpp,v 1.6 1999-10-31 23:57:09 bird Exp $
    22 *
    33 * Pe2Lx class implementation. Ring 0 and Ring 3
     
    126126#include "pe2lx.h"                          /* Pe2Lx class definitions, ++. */
    127127#include <versionos2.h>                     /* Pe2Lx version. */
     128#include "yield.h"                          /* Yield CPU. */
    128129
    129130
     
    650651        return rc;
    651652    }
     653    Yield();
    652654
    653655    /* 14.Convert base relocations (fixups). Remember to add the fixup for RegisterPe2LxDll/Exe. */
     
    658660        return rc;
    659661    }
     662    Yield();
    660663
    661664    /* 15.Make object table. */
     
    674677        return rc;
    675678    }
     679    Yield();
    676680
    677681    /* 17.Completing the LX header. */
     
    732736    /* 20.Dump virtual LX-file */
    733737    dumpVirtualLxFile();
     738
     739    Yield();
    734740
    735741    return NO_ERROR;
     
    21572163        else /* page++ */
    21582164            ulRVAPage += PAGESIZE;
     2165        Yield();
    21592166    } /* The Loop! */
    21602167
     
    23222329            if (rc != NO_ERROR)
    23232330                printErr(("export --> entry loop failed! ul = %d rc = %d\n", ul, rc));
     2331            Yield();
    23242332
    23252333            /* Convert function names to resident names. */
     
    23492357                        rc = addResName(usOrdinal, psz, ~0UL);
    23502358                        free(psz);
     2359                        Yield();
    23512360                    }
    23522361                    if (rc != NO_ERROR)
Note: See TracChangeset for help on using the changeset viewer.