Changeset 4167 for trunk/src


Ignore:
Timestamp:
Sep 2, 2000, 11:14:50 PM (25 years ago)
Author:
bird
Message:

Optimizations for Win32k.sys.

Location:
trunk/src/kernel32
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/initterm.cpp

    r3993 r4167  
    1 /* $Id: initterm.cpp,v 1.44 2000-08-11 10:56:16 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.45 2000-09-02 21:14:50 bird Exp $ */
    22
    33/*
     
    5151#include "oslibdos.h"
    5252#include <cpuhlp.h>
    53 
    54 #define DBG_LOCALLOG    DBG_initterm
     53#include <Win32k.h>
     54
     55#define DBG_LOCALLOG    DBG_initterm
    5556#include "dbglocal.h"
     57
    5658
    5759/*-------------------------------------------------------------------*/
     
    107109    {
    108110        case 0 :
    109         {
    110             ParseLogStatus();
     111        {
     112            libWin32kInit();
     113
     114            ParseLogStatus();
    111115
    112116            loadNr = globLoadNr++;
    113117
    114             strcpy(kernel32Path, OSLibGetDllName(hModule));
    115             char *endofpath = strrchr(kernel32Path, '\\');
    116             *(endofpath+1) = 0;
     118            strcpy(kernel32Path, OSLibGetDllName(hModule));
     119            char *endofpath = strrchr(kernel32Path, '\\');
     120            *(endofpath+1) = 0;
    117121            dprintf(("kernel32 init\n"));
    118122            _ctordtorInit();
     
    120124            CheckVersionFromHMOD(PE2LX_VERSION, hModule); /*PLF Wed  98-03-18 05:28:48*/
    121125
    122             OpenPrivateLogFiles();
    123 
    124             if(InitializeSharedHeap() == FALSE)
    125                 return 0UL;
    126 
    127             if(InitializeCodeHeap() == FALSE)
     126            OpenPrivateLogFiles();
     127
     128            if (InitializeSharedHeap() == FALSE)
     129                return 0UL;
     130
     131            if (InitializeCodeHeap() == FALSE)
    128132                return 0UL;
    129133
    130134            PROFILE_LoadOdinIni();
    131135            dllHandle = RegisterLxDll(hModule, 0, (PVOID)&_Resource_PEResTab);
    132             if(dllHandle == 0)
    133                 return 0UL;
    134 
    135             //SvL: Kernel32 is a special case; pe.exe loads it, so increase
     136            if (dllHandle == 0)
     137                return 0UL;
     138
     139            //SvL: Kernel32 is a special case; pe.exe loads it, so increase
    136140            //     the reference count here
    137             Win32DllBase *module = Win32DllBase::findModule(dllHandle);
    138             if(module) {
    139                 module->AddRef();
    140                 module->DisableUnload();
    141             }
     141            Win32DllBase *module = Win32DllBase::findModule(dllHandle);
     142            if (module)
     143            {
     144                module->AddRef();
     145                module->DisableUnload();
     146            }
    142147
    143148            /*******************************************************************/
     
    156161                flAllocMem = PAG_ANY;      // high memory support. Let's use it!
    157162                ulMaxAddr = ulSysinfo * (1024*1024);
    158                 OSLibInitWSeBFileIO();
     163                OSLibInitWSeBFileIO();
    159164            }
    160165            else
    161166                flAllocMem = 0;        // no high memory support
    162167
    163             OSLibDosSetInitialMaxFileHandles(ODIN_DEFAULT_MAX_FILEHANDLES);
     168            OSLibDosSetInitialMaxFileHandles(ODIN_DEFAULT_MAX_FILEHANDLES);
    164169
    165170            //SvL: Do it here instead of during the exe object creation
    166171            //(std handles can be used in win32 dll initialization routines
    167172            HMInitialize();             /* store standard handles within HandleManager */
    168             InitializeTIB(TRUE);        //MUST be done after HMInitialize!
     173            InitializeTIB(TRUE);    //MUST be done after HMInitialize!
    169174            InitDirectories();
    170175            RegisterDevices();
    171             Win32DllBase::setDefaultRenaming();
     176            Win32DllBase::setDefaultRenaming();
    172177            rc = DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, &ulSysinfo, sizeof(ulSysinfo));
    173             if (rc != 0) 
    174                 ulSysinfo = 1;
     178            if (rc != 0)
     179                ulSysinfo = 1;
    175180
    176181            InitSystemInfo(ulSysinfo);
    177             //Set up environment as found in NT
     182            //Set up environment as found in NT
    178183            InitEnvironment(ulSysinfo);
    179184            break;
    180         }
     185        }
     186
    181187        case 1 :
    182             if(dllHandle) {
    183                 UnregisterLxDll(dllHandle);
    184             }
    185             break;
     188        if (dllHandle)
     189        {
     190            UnregisterLxDll(dllHandle);
     191        }
     192        break;
     193
    186194        default  :
    187195            return 0UL;
  • trunk/src/kernel32/makefile

    r3864 r4167  
    1 # $Id: makefile,v 1.97 2000-07-19 19:05:09 sandervl Exp $
     1# $Id: makefile,v 1.98 2000-09-02 21:14:50 bird Exp $
    22
    33#
     
    151151                          $(OBJDIR)\console.res
    152152    $(LD2) $(LD2FLAGS) @$(OBJDIR)\$(TARGET).lrf
    153     $(OS2RC) $(OBJDIR)\console.res $@
     153    $(OS2RC) $(OS2RCLFLAGS) $(OBJDIR)\console.res $@
    154154
    155155
     
    164164$(PDWIN32_LIB)\LIBULS.LIB
    165165$(PDWIN32_LIB)\LIBCONV.LIB
     166$(PDWIN32_LIB)\WIN32K.LIB
    166167OS2386.LIB
    167168$(RTLLIB_O)
  • trunk/src/kernel32/winimagepe2lx.cpp

    r4097 r4167  
    1 /* $Id: winimagepe2lx.cpp,v 1.13 2000-08-27 03:20:37 bird Exp $ */
     1/* $Id: winimagepe2lx.cpp,v 1.14 2000-09-02 21:14:50 bird Exp $ */
    22
    33/*
     
    3333#include <win32type.h>
    3434#include <misc.h>
    35 #include <winimagebase.h>
    36 #include <winimagepe2lx.h>
     35#include "winimagebase.h"
     36#include "winimagepe2lx.h"
     37#include "Win32k.h"
    3738
    3839#define DBG_LOCALLOG    DBG_winimagepe2lx
     
    386387{
    387388    APIRET rc = NO_ERROR;
     389
     390    /*
     391     * If Win32k.sys is installed we'll use it.
     392     */
     393    if (libWin32kInstalled())
     394    {
     395        ULONG           cbQte = sizeof(QOTEBUFFER) + sizeof(QOTE)*20;
     396        PQOTEBUFFER     pQOte = (PQOTEBUFFER)malloc(sizeof(QOTEBUFFER) + sizeof(QOTE)*20);
     397        if (pQOte != NULL)
     398        {
     399            /*
     400             * Get the query OTEs for this module.
     401             * If there is a buffer overflow we'll allocate more storage and retry.
     402             */
     403            rc = W32kQueryOTEs(hinstance, pQOte, cbQte);
     404            while (rc == ERROR_BUFFER_OVERFLOW && cbQte < 32000);
     405            {
     406                PVOID pvOld = pQOte;
     407                cbQte += sizeof(QOTE) * 20;
     408                pQOte = (PQOTEBUFFER)realloc(pQOte, cbQte);
     409                if (pQOte == NULL)
     410                {
     411                    free(pvOld);
     412                    return ERROR_NOT_ENOUGH_MEMORY;
     413                }
     414
     415                rc = W32kQueryOTEs(hinstance, pQOte, cbQte);
     416            }
     417
     418            /*
     419             * If successfully got the OTEs then allocate and set paSections structs.
     420             */
     421            if (rc == NO_ERROR)
     422            {
     423                /* Allocate memory for paSections */
     424                paSections = (PSECTION)malloc(pQOte->cOTEs * sizeof(SECTION));
     425                if (paSections != NULL)
     426                {
     427                    /* objects -> section array */
     428                    for (int i = 0; i < pQOte->cOTEs; i++)
     429                    {
     430                        paSections[i].ulRVA = ~0UL;
     431                        paSections[i].cbVirtual = pQOte->aOTE[i].ote_size;
     432                        paSections[i].ulAddress = pQOte->aOTE[i].ote_base;
     433                    }
     434                    cSections = pQOte->cOTEs;
     435                }
     436                else
     437                    rc = ERROR_NOT_ENOUGH_MEMORY;
     438            }
     439            else
     440            {
     441                dprintf(("Win32Pe2LxImage::getSections: libW32kQueryOTEs failed with rc=%d."
     442                         " Falls back on the DosQuerySysState method.\n", rc));
     443            }
     444        }
     445        else
     446        {   /* server error, no use in trying the fallback method. */
     447            dprintf(("Win32Pe2LxImage::getSections: malloc failed\n"));
     448            return ERROR_NOT_ENOUGH_MEMORY;
     449        }
     450
     451        if (rc == NO_ERROR)
     452            return rc;
     453    }
     454
     455
     456    /*
     457     * Fallback method, using DosQuerySysState.
     458     */
    388459    qsPtrRec_t *    pPtrRec;
    389460    ULONG           cbBuf = 65536;
Note: See TracChangeset for help on using the changeset viewer.