Changeset 1663 for trunk/src


Ignore:
Timestamp:
Nov 9, 1999, 3:19:47 PM (26 years ago)
Author:
sandervl
Message:

heapstring fixes + dll renaming support added

Location:
trunk/src/kernel32
Files:
10 edited

Legend:

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

    r1605 r1663  
    1 ; $Id: KERNEL32.DEF,v 1.48 1999-11-05 09:16:56 sandervl Exp $
     1; $Id: KERNEL32.DEF,v 1.49 1999-11-09 14:19:45 sandervl Exp $
    22
    33;Created by BLAST for IBM's compiler
     
    10251025    LocalToWideChar            = _LocalToWideChar@12              @1250
    10261026
    1027     VIRTUAL_MapFileA           = _VIRTUAL_MapFileA@8              @1251
    1028     VIRTUAL_MapFileW           = _VIRTUAL_MapFileW@8              @1252
     1027    _VIRTUAL_MapFileA@8              @1251
     1028    _VIRTUAL_MapFileW@8              @1252
    10291029
    10301030    OS2SetExceptionHandler                                        @1253
     
    10331033; Odin ini management
    10341034
    1035     PROFILE_GetOdinIniString   = _PROFILE_GetOdinIniString@20     @1264
    1036     PROFILE_SetOdinIniString   = _PROFILE_SetOdinIniString@12     @1265
    1037     PROFILE_GetOdinIniInt      = _PROFILE_GetOdinIniInt@12        @1266
    1038     PROFILE_SetOdinIniInt      = _PROFILE_SetOdinIniInt@12        @1267
    1039     PROFILE_GetOdinIniBool     = _PROFILE_GetOdinIniBool@12       @1268
    1040     PROFILE_SetOdinIniBool     = _PROFILE_SetOdinIniBool@12       @1269
    1041     PROFILE_SaveOdinIni        = _PROFILE_SaveOdinIni@0           @1270
     1035    _PROFILE_GetOdinIniString@20     @1264
     1036    _PROFILE_SetOdinIniString@12     @1265
     1037    _PROFILE_GetOdinIniInt@12        @1266
     1038    _PROFILE_SetOdinIniInt@12        @1267
     1039    _PROFILE_GetOdinIniBool@12       @1268
     1040    _PROFILE_SetOdinIniBool@12       @1269
     1041    _PROFILE_SaveOdinIni@0           @1270
    10421042
    10431043;shared memory allocation
  • trunk/src/kernel32/heapstring.cpp

    r1605 r1663  
    1 /* $Id: heapstring.cpp,v 1.17 1999-11-05 09:16:57 sandervl Exp $ */
     1/* $Id: heapstring.cpp,v 1.18 1999-11-09 14:19:46 sandervl Exp $ */
    22
    33/*
     
    539539    }
    540540
    541     uni_chars_left = unilen-1; //elements
     541    //SvL: Determine length of unicode string
     542    uni_chars_left = UniStrlen((UniChar*)ustring)+1;
     543    uni_chars_left = min(uni_chars_left, unilen);
     544    unilen = uni_chars_left;
     545
    542546    out_bytes_left = uni_chars_left; //size in bytes == elements
    543547    in_buf  = (UniChar*)ustring;
     
    625629    //in_bytes_left = asciilen-1; //buffer size in bytes
    626630
    627     in_bytes_left = asciilen; //buffer size in bytes
     631    //SvL: Determine length of ascii string
     632    in_bytes_left = strlen(in_buf)+1;
     633    in_bytes_left = min(in_bytes_left, asciilen); //buffer size in bytes
     634   
    628635    out_buf = (UniChar*)unicode;
    629636
     
    637644    //@@@PH what's this?
    638645    //unicode[asciilen-1-in_bytes_left] = 0;
    639 
    640     //if (rc != ULS_SUCCESS && in_bytes_left > 0) //CB: never the case during my tests
    641     //   dprintf(("KERNEL32: AsciiToUnicode failed, %d bytes left!\n",in_bytes_left));
    642646
    643647    //@@@PH what's this?
  • trunk/src/kernel32/initterm.cpp

    r1640 r1663  
    1 /* $Id: initterm.cpp,v 1.22 1999-11-08 15:45:19 sandervl Exp $ */
     1/* $Id: initterm.cpp,v 1.23 1999-11-09 14:19:46 sandervl Exp $ */
    22
    33/*
     
    108108                return 0UL;
    109109
     110            PROFILE_LoadOdinIni();
    110111            if(RegisterLxDll(hModule, 0, 0) == FALSE)
    111112                return 0UL;
     
    131132            //(std handles can be used in win32 dll initialization routines
    132133            HMInitialize();             /* store standard handles within HandleManager */
    133             PROFILE_LoadOdinIni();
    134134            InitDirectories();
    135135            break;
  • trunk/src/kernel32/makefile

    r1641 r1663  
    1 # $Id: makefile,v 1.53 1999-11-08 20:53:24 sandervl Exp $
     1# $Id: makefile,v 1.54 1999-11-09 14:19:46 sandervl Exp $
    22
    33#
     
    334334pefile.OBJ:    pefile.cpp $(PDWIN32_INCLUDE)\pefile.h $(PDWIN32_INCLUDE)\winres.h
    335335
    336 winimagebase.obj:  winimagebase.cpp $(PDWIN32_INCLUDE)\winimagebase.h
    337 winimagepe2lx.obj: winimagepe2lx.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winimagepe2lx.h
    338 winimagepeldr.obj: winimagepeldr.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winimagepeldr.h
     336winimagebase.obj:  winimagebase.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\windllbase.h
     337winimagepe2lx.obj: winimagepe2lx.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winimagepe2lx.h $(PDWIN32_INCLUDE)\windllbase.h
     338winimagepeldr.obj: winimagepeldr.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winimagepeldr.h $(PDWIN32_INCLUDE)\windllbase.h
    339339winimagelx.obj:    winimagelx.cpp $(PDWIN32_INCLUDE)\winimagebase.h $(PDWIN32_INCLUDE)\winimagelx.h
    340 windllbase.obj:    windllbase.cpp $(PDWIN32_INCLUDE)\windllbase.h $(PDWIN32_INCLUDE)\winimagebase.h
     340windllbase.obj:    windllbase.cpp $(PDWIN32_INCLUDE)\windllbase.h $(PDWIN32_INCLUDE)\winimagebase.h profile.h
    341341windllpe2lx.obj:   windllpe2lx.cpp $(PDWIN32_INCLUDE)\windllbase.h $(PDWIN32_INCLUDE)\windllpe2lx.h \
    342342                   $(PDWIN32_INCLUDE)\winimagepe2lx.h $(PDWIN32_INCLUDE)\winimagebase.h
  • trunk/src/kernel32/profile.cpp

    r1370 r1663  
    1 /* $Id: profile.cpp,v 1.19 1999-10-20 08:09:05 sandervl Exp $ */
     1/* $Id: profile.cpp,v 1.20 1999-11-09 14:19:46 sandervl Exp $ */
    22
    33/*
     
    2929#include "winnls.h"
    3030
     31#include "profile.h"
    3132
    3233ODINDEBUGCHANNEL(PROFILE)
     
    8081/* ODIN.INI profile content */
    8182BOOL OdinProfileChanged = FALSE;
    82 static PROFILESECTION *PROFILE_OdinProfile;
     83static PROFILESECTION *PROFILE_OdinProfile = NULL;
    8384
    8485#define PROFILE_MAX_LINE_LEN   1024
    8586#define WINININAME "WIN.INI"
    86 
    87 /* Odin profile name in KERNEL32.DLL directory */
    88 #define ODINININAME "ODIN.INI"
    8987
    9088/* Odin profile: the profile file being used */
     
    699697  LPCSTR,key_name,
    700698  LPCSTR,def,
    701   LPCSTR,buffer,
    702   int,len)
     699  LPSTR,buffer,
     700  UINT,len)
    703701{
    704702    int  ret;
  • trunk/src/kernel32/profile.h

    r1370 r1663  
    1 /* $Id: profile.h,v 1.3 1999-10-20 08:09:05 sandervl Exp $ */
     1/* $Id: profile.h,v 1.4 1999-11-09 14:19:46 sandervl Exp $ */
    22/*
    33 * Profile header for initterm
     
    99#define __PROFILE_H__
    1010
     11#include <odinwrap.h>
     12
     13/* Odin profile name in KERNEL32.DLL directory */
     14#define ODINININAME "ODIN.INI"
     15
    1116void WINAPI WriteOutProfiles(void);
    12 void WINAPI PROFILE_LoadOdinIni(void);
     17int WINAPI PROFILE_LoadOdinIni(void);
    1318
     19INT ODIN_EXTERN(GetPrivateProfileStringA)(LPCSTR section, LPCSTR entry,
     20                                          LPCSTR def_val, LPSTR buffer,
     21                                          UINT len, LPCSTR filename);
     22
     23int ODIN_EXTERN(PROFILE_GetOdinIniString)(LPCSTR section, LPCSTR entry,
     24                                          LPCSTR def_val, LPSTR buffer,
     25                                          UINT len);
    1426#endif
  • trunk/src/kernel32/windllbase.cpp

    r1134 r1663  
    1 /* $Id: windllbase.cpp,v 1.2 1999-10-04 22:25:02 phaller Exp $ */
     1/* $Id: windllbase.cpp,v 1.3 1999-11-09 14:19:47 sandervl Exp $ */
    22
    33/*
     
    3333#include "oslibmisc.h"
    3434#include "oslibdos.h"
     35#include "profile.h"
    3536
    3637VMutex dlllistmutex;   //protects linked lists of heaps
     
    266267        delete Win32DllBase::head;
    267268  }
     269}
     270//******************************************************************************
     271//rename dll if necessary:
     272// Win32 to OS/2 : (i.e. OLE32 -> OLE32OS2)
     273// or
     274// OS/2 to Win32 : (i.e. OLE32OS2 -> OLE32)
     275//******************************************************************************
     276void Win32DllBase::renameDll(char *dllname, BOOL fWinToOS2)
     277{
     278 char modname[CCHMAXPATH];
     279 char renameddll[CCHMAXPATH];
     280 char *namestart;
     281 char *sectionname;
     282
     283  if(fWinToOS2) {
     284        sectionname = DLLRENAMEWIN_SECTION;
     285  }
     286  else {
     287        sectionname = DLLRENAMEOS2_SECTION;
     288  }
     289  namestart = OSLibStripPath(dllname);
     290  strcpy(modname, namestart);
     291  char *dot = strrchr(modname, '.');
     292  if(dot)
     293        *dot = 0;
     294  strupr(modname);
     295  if(ODIN_PROFILE_GetOdinIniString(sectionname, modname, "", renameddll,
     296                                   sizeof(renameddll)-1) > 1)
     297  {
     298        if(namestart == dllname) {
     299                strcpy(dllname, renameddll);
     300        }
     301        else {
     302                *namestart = 0;
     303                strcat(dllname, renameddll);
     304        }
     305        strcat(dllname, ".dll");
     306  }
     307  return;
    268308}
    269309//******************************************************************************
  • trunk/src/kernel32/winimagebase.cpp

    r1475 r1663  
    1 /* $Id: winimagebase.cpp,v 1.3 1999-10-27 10:35:42 sandervl Exp $ */
     1/* $Id: winimagebase.cpp,v 1.4 1999-11-09 14:19:47 sandervl Exp $ */
    22
    33/*
     
    5656        strcpy(szFileName, name);
    5757        strupr(szFileName);
     58
     59        //rename dll (os/2 -> win32) if necessary (i.e. OLE32OS2 -> OLE32)
     60        Win32DllBase::renameDll(szFileName, FALSE);
    5861
    5962        name = strrchr(szFileName, '\\')+1;
  • trunk/src/kernel32/winimagepeldr.cpp

    r1579 r1663  
    1 /* $Id: winimagepeldr.cpp,v 1.10 1999-11-03 20:18:22 sandervl Exp $ */
     1/* $Id: winimagepeldr.cpp,v 1.11 1999-11-09 14:19:47 sandervl Exp $ */
    22
    33/*
     
    10601060    if(WinDll == NULL)
    10611061    {  //not found, so load it
    1062         if(isPEImage(pszCurModule) == FALSE)
     1062        char modname[CCHMAXPATH];
     1063       
     1064        strcpy(modname, pszCurModule);
     1065        //rename dll if necessary (i.e. OLE32 -> OLE32OS2)
     1066        Win32DllBase::renameDll(modname);
     1067
     1068        if(isPEImage(modname) == FALSE)
    10631069        {//LX image, so let OS/2 do all the work for us
    10641070                APIRET rc;
    10651071                char   szModuleFailure[CCHMAXPATH] = "";
    1066                 char   szModuleName[CCHMAXPATH];
    10671072                ULONG  hInstanceNewDll;
    10681073
    1069                 strcpy(szModuleName, pszCurModule);
    1070                 char *dot = strchr(szModuleName, '.');
     1074                char *dot = strchr(modname, '.');
    10711075                if(dot) {
    10721076                        *dot = 0;
    10731077                }
    1074                 strcat(szModuleName, ".DLL");
    1075                 rc = DosLoadModule(szModuleFailure, sizeof(szModuleFailure), szModuleName, (HMODULE *)&hInstanceNewDll);
     1078                strcat(modname, ".DLL");
     1079                rc = DosLoadModule(szModuleFailure, sizeof(szModuleFailure), modname, (HMODULE *)&hInstanceNewDll);
    10761080                if(rc) {
    10771081                        dprintf(("DosLoadModule returned %X for %s\n", rc, szModuleFailure));
     
    10871091        }
    10881092        else {
    1089                 WinDll = new Win32PeLdrDll(pszCurModule, this);
     1093                WinDll = new Win32PeLdrDll(modname, this);
    10901094
    10911095                if(WinDll == NULL) {
  • trunk/src/kernel32/wprocess.cpp

    r1618 r1663  
    1 /* $Id: wprocess.cpp,v 1.44 1999-11-05 14:06:44 sandervl Exp $ */
     1/* $Id: wprocess.cpp,v 1.45 1999-11-09 14:19:47 sandervl Exp $ */
    22
    33/*
     
    311311  }
    312312
    313   hDll = O32_LoadLibrary(lpszLibFile);
     313  strcpy(modname, lpszLibFile);
     314  strupr(modname);
     315  //rename dll if necessary (i.e. OLE32 -> OLE32OS2)
     316  Win32DllBase::renameDll(modname);
     317
     318  hDll = O32_LoadLibrary(modname);
    314319  dprintf(("KERNEL32:  iLoadLibraryA %s returned %X (%d)\n",
    315320           lpszLibFile,
     
    321326  }
    322327
    323   strcpy(modname, lpszLibFile);
    324   strupr(modname);
    325328  if(!strstr(modname, ".")) {
    326329        strcat(modname,".DLL");
     
    696699//Retrieve the version
    697700//******************************************************************************
    698 BOOL SYSTEM GetVersionStruct(char *modname, char *verstruct, ULONG bufLength)
     701BOOL SYSTEM GetVersionStruct(char *lpszModName, char *verstruct, ULONG bufLength)
    699702{
    700703 Win32ImageBase *winimage;
    701704 Win32PeLdrRsrcImg *rsrcimg;
    702705
    703   dprintf(("GetVersionStruct"));
    704   if(WinExe && !stricmp(WinExe->getFullPath(), modname)) {
     706  dprintf(("GetVersionStruct of module %s", lpszModName));
     707  if(WinExe && !stricmp(WinExe->getFullPath(), lpszModName)) {
    705708        winimage = (Win32ImageBase *)WinExe;
    706709  }
    707710  else {
    708         winimage = (Win32ImageBase *)Win32DllBase::findModule(modname);
     711        winimage = (Win32ImageBase *)Win32DllBase::findModule(lpszModName);
    709712        if(winimage == NULL)
    710713        {
     714         char modname[CCHMAXPATH];
     715
     716                strcpy(modname, lpszModName);
     717                //rename dll if necessary (i.e. OLE32 -> OLE32OS2)
     718                Win32DllBase::renameDll(modname);
     719               
    711720                if(Win32ImageBase::isPEImage(modname) == FALSE)
    712721                {
     
    744753//******************************************************************************
    745754//******************************************************************************
    746 ULONG SYSTEM GetVersionSize(char *modname)
     755ULONG SYSTEM GetVersionSize(char *lpszModName)
    747756{
    748757 Win32ImageBase *winimage;
    749758 Win32PeLdrRsrcImg *rsrcimg;
    750759
    751   dprintf(("GetVersionSize of %s\n", modname));
    752 
    753   if(WinExe && !stricmp(WinExe->getFullPath(), modname)) {
     760  dprintf(("GetVersionSize of %s\n", lpszModName));
     761
     762  if(WinExe && !stricmp(WinExe->getFullPath(), lpszModName)) {
    754763        winimage = (Win32ImageBase *)WinExe;
    755764  }
    756765  else {
    757         winimage = (Win32ImageBase *)Win32DllBase::findModule(modname);
     766        winimage = (Win32ImageBase *)Win32DllBase::findModule(lpszModName);
    758767        if(winimage == NULL)
    759768        {
     769         char modname[CCHMAXPATH];
     770
     771                strcpy(modname, lpszModName);
     772                //rename dll if necessary (i.e. OLE32 -> OLE32OS2)
     773                Win32DllBase::renameDll(modname);
     774
    760775                if(Win32ImageBase::isPEImage(modname) == FALSE)
    761776                {
Note: See TracChangeset for help on using the changeset viewer.