Ignore:
Timestamp:
Aug 11, 2000, 12:56:27 PM (25 years ago)
Author:
sandervl
Message:

Updates for fake system dll headers

File:
1 edited

Legend:

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

    r3948 r3993  
    1 /* $Id: winimagepeldr.cpp,v 1.51 2000-08-04 21:12:10 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.52 2000-08-11 10:56:19 sandervl Exp $ */
    22
    33/*
     
    4242#include "winimagepeldr.h"
    4343#include "windllpeldr.h"
     44#include "windlllx.h"
    4445#include <pefile.h>
    4546#include <unicode.h>
     
    12181219 ULONG  ulCurFixup;
    12191220 int    Size;
    1220  Win32PeLdrDll *WinDll;
     1221 Win32DllBase *WinDll;
    12211222 Section *section;
    12221223
     
    13351336    dprintf((LOG, "************** Import Module %s ", pszCurModule ));
    13361337    dprintf((LOG, "**********************************************************************" ));
    1337     WinDll = (Win32PeLdrDll *)Win32DllBase::findModule(pszCurModule);
     1338    WinDll = Win32DllBase::findModule(pszCurModule);
    13381339
    13391340    if(WinDll == NULL)
     
    13501351                char   szModuleFailure[CCHMAXPATH] = "";
    13511352                ULONG  hInstanceNewDll;
     1353                Win32LxDll *lxdll;
    13521354
    13531355                char *dot = strchr(modname, '.');
     
    13631365                        return(FALSE);
    13641366                }
    1365                 WinDll = (Win32PeLdrDll *)Win32DllBase::findModule(hInstanceNewDll);
    1366                 if(WinDll == NULL) {//shouldn't happen!
     1367                lxdll = Win32LxDll::findModuleByOS2Handle(hInstanceNewDll);
     1368                if(lxdll == NULL) {//shouldn't happen!
    13671369                        dprintf((LOG, "Just loaded the dll, but can't find it anywhere?!!?"));
    13681370                        errorState = ERROR_INTERNAL;
    13691371                        return(FALSE);
    13701372                }
    1371                 //Mark this dll as loaded by DosLoadModule
    1372                 WinDll->setLoadLibrary();
    1373                 WinDll->AddRef();
     1373                lxdll->setDllHandleOS2(hInstanceNewDll);
     1374                lxdll->AddRef();
     1375                WinDll = (Win32DllBase*)lxdll;
    13741376        }
    13751377        else {
    1376                 WinDll = new Win32PeLdrDll(modname, this);
    1377 
    1378                 if(WinDll == NULL) {
    1379                     dprintf((LOG, "WinDll: Error allocating memory" ));
     1378         Win32PeLdrDll *pedll;
     1379
     1380                pedll = new Win32PeLdrDll(modname, this);
     1381                if(pedll == NULL) {
     1382                    dprintf((LOG, "pedll: Error allocating memory" ));
    13801383                    WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, szMemErrorMsg, szErrorTitle, 0, MB_OK | MB_ERROR | MB_MOVEABLE);
    13811384                    errorState = ERROR_INTERNAL;
     
    13851388                dprintf((LOG, "**********************     Loading Module        *********************" ));
    13861389                dprintf((LOG, "**********************************************************************" ));
    1387                 if(WinDll->init(0) == FALSE) {
    1388                     dprintf((LOG, "Internal WinDll error ", WinDll->getError() ));
     1390                if(pedll->init(0) == FALSE) {
     1391                    dprintf((LOG, "Internal WinDll error ", pedll->getError() ));
    13891392                    return(FALSE);
    13901393                }
    13911394#ifdef DEBUG
    1392                 WinDll->AddRef(getModuleName());
     1395                pedll->AddRef(getModuleName());
    13931396#else
    1394                 WinDll->AddRef();
     1397                pedll->AddRef();
    13951398#endif
    1396                 if(WinDll->attachProcess() == FALSE) {
     1399                if(pedll->attachProcess() == FALSE) {
    13971400                    dprintf((LOG, "attachProcess failed!" ));
    1398                     delete WinDll;
     1401                    delete pedll;
    13991402                    errorState = ERROR_INTERNAL;
    14001403                    return(FALSE);
    14011404                }
     1405                WinDll = (Win32DllBase*)pedll;
    14021406        }
    14031407
     
    14071411    }
    14081412    else {
    1409         if(WinDll->isLxDll() && !WinDll->isLoaded()) {
    1410                 //can happen with i.e. wininet
    1411                 //wininet depends on wsock32; when the app loads wsock32 afterwards
    1412                 //with LoadLibrary or as a child of another dll, we need to make
    1413                 //sure it's loaded once with DosLoadModule
    1414                 WinDll->loadLibrary();
    1415         }
    14161413        WinDll->AddRef();
    14171414       
     
    14191416    }
    14201417    //add the dll we just loaded to dependency list for this image
    1421     addDependency((Win32DllBase *)WinDll);
     1418    addDependency(WinDll);
    14221419
    14231420    //Make sure the dependency list is correct (already done
Note: See TracChangeset for help on using the changeset viewer.