Ignore:
Timestamp:
Oct 23, 1999, 2:34:48 PM (26 years ago)
Author:
sandervl
Message:

Changes for logging & getversionsize/struct

File:
1 edited

Legend:

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

    r1403 r1410  
    1 /* $Id: wprocess.cpp,v 1.39 1999-10-22 18:07:24 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.40 1999-10-23 12:34:48 sandervl Exp $ */
    22
    33/*
     
    2424#include <winexebase.h>
    2525#include <windllpeldr.h>
     26#include <winfakepeldr.h>
    2627
    2728#ifdef __IBMCPP__
     
    605606         if(lpszCommandLine) {
    606607                cmdline = (char *)malloc(strlen(lpszImageName)+strlen(lpszCommandLine) + 16);
    607                 sprintf(cmdline, "%s %s", lpszImageName, lpszCommandLine);
     608                sprintf(cmdline, "PE.EXE %s %s", lpszImageName, lpszCommandLine);
    608609                fAllocStr = TRUE;
    609610         }
    610          else   cmdline = (char *)lpszImageName;
     611         else {
     612                cmdline = (char *)malloc(strlen(lpszImageName) + 16);
     613                sprintf(cmdline, "PE.EXE %s", lpszImageName);
     614                fAllocStr = TRUE;
     615         }
    611616    }
    612     else cmdline = (char *)lpszCommandLine;
    613 
     617    else {
     618        cmdline = (char *)malloc(strlen(lpszCommandLine) + 16);
     619        sprintf(cmdline, "PE.EXE %s", lpszCommandLine);
     620        fAllocStr = TRUE;
     621    }
    614622    dprintf(("KERNEL32:  CreateProcess %s\n", cmdline));
    615623    rc = O32_CreateProcess("PE.EXE", (LPCSTR)cmdline, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
    616624    if(fAllocStr)
    617     free(cmdline);
     625        free(cmdline);
    618626
    619627    dprintf(("KERNEL32:  CreateProcess returned %d\n", rc));
     
    674682{
    675683 Win32ImageBase *winimage;
     684 Win32PeLdrRsrcImg *rsrcimg;
    676685
    677686  dprintf(("GetVersionStruct"));
     
    681690  else {
    682691        winimage = (Win32ImageBase *)Win32DllBase::findModule(modname);
    683         if(winimage == NULL) {
    684                 dprintf(("GetVersionStruct can't find Win32Image for %s\n", modname));
    685                 return(FALSE);
     692        if(winimage == NULL)
     693        {
     694                if(Win32ImageBase::isPEImage(modname) == FALSE)
     695                {
     696                 HINSTANCE hInstance;
     697                 
     698                        //must be an LX dll, just load it (app will probably load it anyway)
     699                        hInstance = LoadLibraryA(modname);
     700                        if(hInstance == 0)
     701                                return 0;
     702                        winimage = (Win32ImageBase *)Win32DllBase::findModule(hInstance);
     703                        if(winimage) {
     704                                return winimage->getVersionStruct(verstruct, bufLength);
     705                        }
     706                        return 0;
     707                }
     708                //SvL: Try to load it
     709                rsrcimg = new Win32PeLdrRsrcImg(modname);
     710                if(rsrcimg == NULL)
     711                        return 0;
     712
     713                rsrcimg->init(0);
     714                if(rsrcimg->getError() != NO_ERROR)
     715                {
     716                        dprintf(("GetVersionStruct can't load %s\n", modname));
     717                        delete rsrcimg;
     718                        return(FALSE);
     719                }
     720                BOOL rc = rsrcimg->getVersionStruct(verstruct, bufLength);
     721                delete rsrcimg;
     722                return rc;
    686723        }
    687724  }
     
    693730{
    694731 Win32ImageBase *winimage;
     732 Win32PeLdrRsrcImg *rsrcimg;
    695733
    696734  dprintf(("GetVersionSize of %s\n", modname));
     
    701739  else {
    702740        winimage = (Win32ImageBase *)Win32DllBase::findModule(modname);
    703         if(winimage == NULL) {
    704                 dprintf(("GetVersionSize can't find Win32Image for %s\n", modname));
    705                 return(FALSE);
     741        if(winimage == NULL)
     742        {
     743                if(Win32ImageBase::isPEImage(modname) == FALSE)
     744                {
     745                 HINSTANCE hInstance;
     746                 
     747                        //must be an LX dll, just load it (app will probably load it anyway)
     748                        hInstance = LoadLibraryA(modname);
     749                        if(hInstance == 0)
     750                                return 0;
     751                        winimage = (Win32ImageBase *)Win32DllBase::findModule(hInstance);
     752                        if(winimage) {
     753                                return winimage->getVersionSize();
     754                        }
     755                        return 0;
     756                }
     757
     758                //SvL: Try to load it
     759                rsrcimg = new Win32PeLdrRsrcImg(modname);
     760                if(rsrcimg == NULL)
     761                        return 0;
     762
     763                rsrcimg->init(0);
     764                if(rsrcimg->getError() != NO_ERROR)
     765                {
     766                        dprintf(("GetVersionSize can't load %s\n", modname));
     767                        delete rsrcimg;
     768                        return(FALSE);
     769                }
     770                rsrcimg->init(0);
     771                int size = rsrcimg->getVersionSize();
     772                delete rsrcimg;
     773                return size;
    706774        }
    707775  }
Note: See TracChangeset for help on using the changeset viewer.