Changeset 1708 for trunk/src/kernel32


Ignore:
Timestamp:
Nov 11, 1999, 8:10:09 PM (26 years ago)
Author:
sandervl
Message:

version loading fixes + heap corruption fix

Location:
trunk/src/kernel32
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/KERNEL32.CPP

    r1670 r1708  
    1 /* $Id: KERNEL32.CPP,v 1.29 1999-11-09 19:22:31 sandervl Exp $ */
     1/* $Id: KERNEL32.CPP,v 1.30 1999-11-11 19:10:08 sandervl Exp $ */
    22
    33/*
     
    367367    dprintf(("KERNEL32:  OS2GetEnvironmentVariableW\n"));
    368368    asciibuffer = (char *)malloc(nSize+1);
     369    *asciibuffer = 0;
    369370    astring     = UnicodeToAsciiString((LPWSTR)lpName);
    370371
  • trunk/src/kernel32/directory.cpp

    r1646 r1708  
    1 /* $Id: directory.cpp,v 1.10 1999-11-08 21:24:24 sandervl Exp $ */
     1/* $Id: directory.cpp,v 1.11 1999-11-11 19:10:08 sandervl Exp $ */
    22
    33/*
     
    105105
    106106
    107 ODINFUNCTION1(BOOL,SetCurrentDirectoryA,LPCSTR,lpPathName)
     107ODINFUNCTIONNODBG1(BOOL,SetCurrentDirectoryA,LPCSTR,lpPathName)
    108108{
    109109  int len = strlen(lpPathName);
     
    113113  if(tmp[len -1] == '\\')
    114114    tmp[len -1] = 0;
     115
     116  dprintf(("SetCurrentDirectoryA %s", tmp));
    115117  return O32_SetCurrentDirectory((LPSTR)tmp);
    116118}
     
    325327
    326328  rc = GetWindowsDirectoryA(asciibuffer, uSize);
    327   AsciiToUnicode(asciibuffer, lpBuffer);
     329  if(rc)
     330    AsciiToUnicode(asciibuffer, lpBuffer);
    328331  free(asciibuffer);
    329332  return(rc);
  • trunk/src/kernel32/disk.cpp

    r1651 r1708  
    1 /* $Id: disk.cpp,v 1.6 1999-11-09 01:22:32 phaller Exp $ */
     1/* $Id: disk.cpp,v 1.7 1999-11-11 19:10:09 sandervl Exp $ */
    22
    33/*
     
    8282 char *astring;
    8383
    84     dprintf(("KERNEL32:  OS2GetDriveTypeW\n"));
    8584    astring = UnicodeToAsciiString((LPWSTR)arg1);
     85    dprintf(("KERNEL32:  OS2GetDriveTypeW %s", astring));
    8686    rc = O32_GetDriveType(astring);
    8787    FreeAsciiString(astring);
     
    100100              DWORD,   nFileSystemNameSize)
    101101{
     102   dprintf(("GetVolumeInformationA %s", lpRootPathName));
    102103   return O32_GetVolumeInformation(lpRootPathName,
    103104                                   lpVolumeNameBuffer,
  • trunk/src/kernel32/lang.cpp

    r1458 r1708  
    2727BOOL WIN32API IsValidCodePage(UINT CodePage)
    2828{
    29   dprintf(("KERNEL32:  IsValidCodePage not implemented\n"));
     29  dprintf(("KERNEL32:  IsValidCodePage %d not implemented", CodePage));
    3030  return(TRUE);
    3131}
  • trunk/src/kernel32/makefile

    r1670 r1708  
    1 # $Id: makefile,v 1.55 1999-11-09 19:22:32 sandervl Exp $
     1# $Id: makefile,v 1.56 1999-11-11 19:10:09 sandervl Exp $
    22
    33#
     
    1818CFLAGS = $(CFLAGS) -I$(PDWIN32_INCLUDE) /Tm+
    1919CXXFLAGS = $(CXXFLAGS) -I$(PDWIN32_INCLUDE) /Tm+
     20
     21!ifdef NODEBUGINFO
     22CFLAGS = $(CFLAGS) -DDEFAULT_LOGGING_OFF
     23CXXFLAGS = $(CXXFLAGS) -DDEFAULT_LOGGING_OFF
     24!endif
    2025
    2126!ifdef DEBUGALL
  • trunk/src/kernel32/misc.cpp

    r1448 r1708  
    1 /* $Id: misc.cpp,v 1.13 1999-10-25 21:38:50 phaller Exp $ */
     1/* $Id: misc.cpp,v 1.14 1999-11-11 19:10:09 sandervl Exp $ */
    22
    33/*
     
    252252    init = TRUE;
    253253
     254#ifdef DEFAULT_LOGGING_OFF
     255    if(getenv("WIN32LOG_ENABLED")) {
     256#else
    254257    if(!getenv("NOWIN32LOG")) {
     258#endif
    255259        char logname[CCHMAXPATH];
    256260
  • trunk/src/kernel32/winimagepeldr.cpp

    r1663 r1708  
    1 /* $Id: winimagepeldr.cpp,v 1.11 1999-11-09 14:19:47 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.12 1999-11-11 19:10:09 sandervl Exp $ */
    22
    33/*
     
    7373    imageVirtBase(-1), realBaseAddress(0), imageVirtEnd(0),
    7474    nrNameExports(0), nrOrdExports(0), nameexports(NULL), ordexports(NULL),
    75     pResSection(NULL), fImgMapping(0)
     75    fImgMapping(0)
    7676{
    7777 HFILE  dllfile;
     
    140140 ULONG  filesize, ulRead;
    141141 PIMAGE_SECTION_HEADER psh;
     142 IMAGE_SECTION_HEADER sh;
    142143 IMAGE_TLS_DIRECTORY *tlsDir = NULL;
    143144 int    nSections, i;
     
    315316     }
    316317   }
    317    fout << "*************************PE SECTIONS END **************************" << endl;
    318    imageSize += imageVirtBase - oh.ImageBase;
    319    fout << "Total size of Image " << imageSize << endl;
    320    fout << "imageVirtBase       " << imageVirtBase << endl;
    321    fout << "imageVirtEnd        " << imageVirtEnd << endl;
    322 
    323    //In case there are any gaps between sections, adjust size
    324    if(imageSize != imageVirtEnd - oh.ImageBase) {
     318  }
     319  else {
     320        if(GetSectionHdrByName (win32file, &sh, ".rsrc"))
     321        {
     322            addSection(SECTION_RESOURCE, (char *)win32file+sh.PointerToRawData,
     323                       sh.SizeOfRawData, sh.VirtualAddress + oh.ImageBase,
     324                       sh.Misc.VirtualSize);
     325        }
     326  }
     327  fout << "*************************PE SECTIONS END **************************" << endl;
     328  imageSize += imageVirtBase - oh.ImageBase;
     329  fout << "Total size of Image " << imageSize << endl;
     330  fout << "imageVirtBase       " << imageVirtBase << endl;
     331  fout << "imageVirtEnd        " << imageVirtEnd << endl;
     332
     333  //In case there are any gaps between sections, adjust size
     334  if(imageSize != imageVirtEnd - oh.ImageBase) {
    325335        fout << "imageSize != imageVirtEnd - oh.ImageBase!" << endl;
    326336        imageSize = imageVirtEnd - oh.ImageBase;
    327    }
    328    if(allocSections(reservedMem) == FALSE) {
     337  }
     338  if(allocSections(reservedMem) == FALSE) {
    329339        fout << "Failed to allocate image memory, rc " << errorState << endl;
    330340        goto failure;
    331    }
    332    fout << "OS/2 base address " << realBaseAddress << endl;
    333    if(storeSections((char *)win32file) == FALSE) {
     341  }
     342  fout << "OS/2 base address " << realBaseAddress << endl;
     343  if(storeSections((char *)win32file) == FALSE) {
    334344        fout << "Failed to store sections, rc " << errorState << endl;
    335345        goto failure;
    336    }
    337    if(oh.AddressOfEntryPoint) {
     346  }
     347  if(oh.AddressOfEntryPoint) {
    338348        entryPoint = realBaseAddress + oh.AddressOfEntryPoint;
    339    }
    340    else {
     349  }
     350  else {
    341351        fout << "EntryPoint == NULL" << endl;
    342352        entryPoint = NULL;
    343    }
    344 
     353  }
     354
     355  if(loadType == REAL_LOAD)
     356  {
    345357   if(tlsDir != NULL) {
    346358    Section *sect = findSection(SECTION_TLS);
     
    381393        }
    382394   }
    383 
    384    //SvL: Use pointer to image header as module handle now. Some apps needs this
    385    hinstance = (HINSTANCE)realBaseAddress;
    386   }
     395  }
     396
     397  //SvL: Use pointer to image header as module handle now. Some apps needs this
     398  hinstance = (HINSTANCE)realBaseAddress;
    387399
    388400  //PH: get pResDir pointer correct first, since processImports may
    389401  //    implicitly call functions depending on it.
    390   IMAGE_SECTION_HEADER sh;
    391402  if(GetSectionHdrByName (win32file, &sh, ".rsrc")) {
    392403        //get offset in resource object of directory entry
    393404        pResDir = (PIMAGE_RESOURCE_DIRECTORY)(sh.VirtualAddress + realBaseAddress);
    394         pResourceSectionStart = (ULONG)pResSection->virtaddr - oh.ImageBase;
     405        pResourceSectionStart = sh.VirtualAddress;
    395406  }
    396407
     
    401412        goto failure;
    402413   }
    403 
    404    //set final memory protection flags (storeSections sets them to read/write)
    405    if(setMemFlags() == FALSE) {
     414  }
     415 
     416  //set final memory protection flags (storeSections sets them to read/write)
     417  if(setMemFlags() == FALSE) {
    406418        fout << "Failed to set memory protection" << endl;
    407419        goto failure;
    408    }
    409    CloseHandle(fImgMapping);
    410    fImgMapping = 0;
    411   }
     420  }
     421  CloseHandle(fImgMapping);
     422  fImgMapping = 0;
     423
    412424  return(TRUE);
    413425failure:
     
    428440  section[nrsections].virtaddr       = virtaddress;
    429441
    430   if(type == SECTION_RESOURCE) {
    431         pResSection = &section[nrsections];
    432   }
    433442  virtsize   = ((virtsize - 1) & ~0xFFF) + PAGE_SIZE;
    434443  imageSize += virtsize;
  • trunk/src/kernel32/wprocess.cpp

    r1691 r1708  
    1 /* $Id: wprocess.cpp,v 1.48 1999-11-10 16:38:36 phaller Exp $ */
     1/* $Id: wprocess.cpp,v 1.49 1999-11-11 19:10:09 sandervl Exp $ */
    22
    33/*
     
    809809                        return(FALSE);
    810810                }
    811                 rsrcimg->init(0);
    812811                int size = rsrcimg->getVersionSize();
    813812                delete rsrcimg;
Note: See TracChangeset for help on using the changeset viewer.