Ignore:
Timestamp:
Jul 29, 2001, 9:02:35 PM (24 years ago)
Author:
sandervl
Message:

custom build updates

File:
1 edited

Legend:

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

    r6015 r6401  
    1 /* $Id: windlllx.cpp,v 1.20 2001-06-15 09:42:48 bird Exp $ */
     1/* $Id: windlllx.cpp,v 1.21 2001-07-29 19:00:32 sandervl Exp $ */
    22
    33/*
     
    4040#include "dbglocal.h"
    4141
     42char *lpszCustomDllName = NULL;
     43
     44//******************************************************************************
     45//******************************************************************************
     46void WIN32API SetCustomBuildName(char *lpszName)
     47{
     48    lpszCustomDllName = lpszName;
     49}
    4250//******************************************************************************
    4351//Create LX Dll object and send process attach message
     
    6573 char          szFileName[CCHMAXPATH], szErrName[CCHMAXPATH];
    6674
    67    if(OSLibGetDllName(hInstance, szFileName, sizeof(szFileName)) == FALSE) {
    68     dprintf(("ERROR: RegisterLxDll: OSLibGetDllName %x failed!!", hInstance));
    69     return 0;
    70    }
    71    dprintf(("RegisterLxDll %x %s", hInstance, szFileName));
    72    //Make sure DosLoadModule is called at least once for a dll (to make sure
    73    //OS/2 doesn't unload the dll when it's still needed)
    74    rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hInstance);
    75    if(rc != 0) {
    76     dprintf(("ERROR: RegisterLxDll: DosLoadModule %s failed (rc=%d)!!", szFileName, rc));
    77     return 0;
    78    }
    79 
     75   if(!lpszCustomDllName) {
     76       if(OSLibGetDllName(hInstance, szFileName, sizeof(szFileName)) == FALSE) {
     77           dprintf(("ERROR: RegisterLxDll: OSLibGetDllName %x failed!!", hInstance));
     78           return 0;
     79       }
     80       dprintf(("RegisterLxDll %x %s", hInstance, szFileName));
     81       //Make sure DosLoadModule is called at least once for a dll (to make sure
     82       //OS/2 doesn't unload the dll when it's still needed)
     83       rc = DosLoadModule(szErrName, sizeof(szErrName), szFileName, &hInstance);
     84       if(rc != 0) {
     85           dprintf(("ERROR: RegisterLxDll: DosLoadModule %s failed (rc=%d)!!", szFileName, rc));
     86           return 0;
     87       }
     88   }
    8089   windll = new Win32LxDll(hInstance, EntryPoint, pResData, MajorImageVersion,
    8190                           MinorImageVersion, Subsystem);
    8291   if(windll == NULL) {
    83     dprintf(("RegisterLxDll: windll == NULL!!!"));
    84     return 0;
     92       dprintf(("RegisterLxDll: windll == NULL!!!"));
     93       return 0;
    8594   }
    8695   if(!fPeLoader) {
    87     windll->AddRef();
    88 
    89     if(windll->attachProcess() == 0)
    90         return 0;
    91 
    92     return windll->getInstanceHandle();
     96       windll->AddRef();
     97
     98       if(windll->attachProcess() == 0)
     99           return 0;
     100
     101       return windll->getInstanceHandle();
    93102   }
    94103   IMAGE_DOS_HEADER doshdr;
     
    105114   rc = DosQueryHeaderInfo(hInstance, 0, &doshdr, sizeof(IMAGE_DOS_HEADER), QHINF_READFILE);
    106115   if(rc) {
    107     goto hdrerror;
     116       goto hdrerror;
    108117   }
    109118   rc = DosQueryHeaderInfo(hInstance, doshdr.e_lfanew, &lxhdr, sizeof(e32_exe), QHINF_READFILE);
    110119   if(rc) {
    111     goto hdrerror;
     120       goto hdrerror;
    112121   }
    113122   offset = doshdr.e_lfanew + lxhdr.e32_impmod;
    114123   for(i=0;i<lxhdr.e32_impmodcnt;i++) {
    115     rc = DosQueryHeaderInfo(hInstance, offset, &modsize, 1, QHINF_READFILE);
    116     if(rc) {
    117         goto hdrerror;
    118     }
    119     rc = DosQueryHeaderInfo(hInstance, offset+1, &modulename, min(modsize, sizeof(modulename)), QHINF_READFILE);
    120     if(rc) {
    121         goto hdrerror;
    122     }
    123     modulename[modsize] = 0;
    124     windlldep = Win32DllBase::findModule(modulename, TRUE);
    125     if(windlldep && strcmp(windlldep->getModuleName(), windll->getModuleName())) {
    126         dprintf(("RegisterLxDll: Add dependency %s -> %s", windll->getModuleName(), modulename));
    127         windll->addDependency(windlldep);
    128     }
    129         else    dprintf(("HARMLESS WARNING: Can't find dll %s referenced by %s", modulename, windll->getModuleName()));
    130     offset += modsize + 1;
     124       rc = DosQueryHeaderInfo(hInstance, offset, &modsize, 1, QHINF_READFILE);
     125       if(rc) {
     126           goto hdrerror;
     127       }
     128       rc = DosQueryHeaderInfo(hInstance, offset+1, &modulename, min(modsize, sizeof(modulename)), QHINF_READFILE);
     129       if(rc) {
     130           goto hdrerror;
     131       }
     132       modulename[modsize] = 0;
     133       windlldep = Win32DllBase::findModule(modulename, TRUE);
     134       if(windlldep && strcmp(windlldep->getModuleName(), windll->getModuleName())) {
     135            dprintf(("RegisterLxDll: Add dependency %s -> %s", windll->getModuleName(), modulename));
     136            windll->addDependency(windlldep);
     137       }
     138       else dprintf(("HARMLESS WARNING: Can't find dll %s referenced by %s", modulename, windll->getModuleName()));
     139
     140       offset += modsize + 1;
    131141   }
    132142   return windll->getInstanceHandle();
Note: See TracChangeset for help on using the changeset viewer.