Changeset 9411 for trunk/src


Ignore:
Timestamp:
Nov 18, 2002, 2:54:12 PM (23 years ago)
Author:
sandervl
Message:

Added support for renaming of exported functions

Location:
trunk/src/kernel32
Files:
6 edited

Legend:

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

    r8938 r9411  
    1 ; $Id: KERNEL32.DEF,v 1.144 2002-07-30 12:55:04 sandervl Exp $
     1; $Id: KERNEL32.DEF,v 1.145 2002-11-18 13:53:53 sandervl Exp $
    22
    33;Basis is Windows95 KERNEL32
     
    11951195   
    11961196    _SetRegistryRootKey@8                                         @2013 NONAME
    1197     _SetCustomBuildName@8                                         @2014 NONAME
     1197    _SetCustomBuildName@12                                        @2014 NONAME
    11981198    _RegisterCustomDriver@36                                      @2015 NONAME
    11991199
  • trunk/src/kernel32/kernel32dbg.def

    r8938 r9411  
    1 ; $Id: kernel32dbg.def,v 1.19 2002-07-30 12:55:05 sandervl Exp $
     1; $Id: kernel32dbg.def,v 1.20 2002-11-18 13:53:54 sandervl Exp $
    22
    33;Basis is Windows95 KERNEL32
     
    11951195   
    11961196    _SetRegistryRootKey@8                                         @2013 NONAME
    1197     _SetCustomBuildName@8                                         @2014 NONAME
     1197    _SetCustomBuildName@12                                        @2014 NONAME
    11981198    _RegisterCustomDriver@36                                      @2015 NONAME
    11991199
  • trunk/src/kernel32/windlllx.cpp

    r8462 r9411  
    1 /* $Id: windlllx.cpp,v 1.25 2002-05-21 14:42:40 sandervl Exp $ */
     1/* $Id: windlllx.cpp,v 1.26 2002-11-18 13:53:54 sandervl Exp $ */
    22
    33/*
     
    4040#include "dbglocal.h"
    4141
    42 char *lpszCustomDllName = NULL;
    43 ULONG dwOrdinalBase = 0;
    44 
    45 //******************************************************************************
    46 //******************************************************************************
    47 void WIN32API SetCustomBuildName(char *lpszName, DWORD ordinalbase)
    48 {
    49     lpszCustomDllName = lpszName;
    50     dwOrdinalBase     = ordinalbase;
     42char *lpszCustomDllName      = NULL;
     43char *lpszCustomExportPrefix = NULL;
     44ULONG dwOrdinalBase          = 0;
     45
     46//******************************************************************************
     47//******************************************************************************
     48void WIN32API SetCustomBuildName(char *lpszName, DWORD ordinalbase,
     49                                 char *lpszExportPrefix)
     50{
     51    lpszCustomDllName      = lpszName;
     52    dwOrdinalBase          = ordinalbase;
     53    lpszCustomExportPrefix = lpszExportPrefix;
    5154}
    5255//******************************************************************************
  • trunk/src/kernel32/windlllx.h

    r8462 r9411  
    1 /* $Id: windlllx.h,v 1.7 2002-05-21 14:42:40 sandervl Exp $ */
     1/* $Id: windlllx.h,v 1.8 2002-11-18 13:53:54 sandervl Exp $ */
    22
    33/*
     
    4747};
    4848
    49 extern char *lpszCustomDllName;
     49extern char *lpszCustomDllName, *lpszCustomExportPrefix;
    5050extern DWORD dwOrdinalBase;
    5151
  • trunk/src/kernel32/winimagelx.cpp

    r8887 r9411  
    1 /* $Id: winimagelx.cpp,v 1.17 2002-07-18 12:01:34 achimha Exp $ */
     1/* $Id: winimagelx.cpp,v 1.18 2002-11-18 13:53:54 sandervl Exp $ */
    22
    33/*
     
    7373    if(lpszCustomDllName) {
    7474       name = lpszCustomDllName;
    75        this->dwOrdinalBase = ::dwOrdinalBase;
     75       this->dwOrdinalBase    = ::dwOrdinalBase;
     76     
     77       if(lpszCustomExportPrefix) {
     78           this->lpszExportPrefix = strdup(::lpszCustomExportPrefix);
     79       }
    7680    }
    7781    else {
    7882       name = OSLibGetDllName(hinstance);
    79        this->dwOrdinalBase = 0;
     83       this->dwOrdinalBase    = 0;
     84       this->lpszExportPrefix = NULL;
    8085    }
    8186
     
    97102Win32LxImage::~Win32LxImage()
    98103{
     104    if(lpszExportPrefix) free(lpszExportPrefix);
     105
    99106    if(header) {
    100107        DosFreeMem(header);
     
    108115    ULONG       apiaddr;
    109116
     117    if(lpszExportPrefix)
     118    {//if this dll exports by name with a prefix, then concatenate the prefix
     119     //with the export name to get the OS/2 export name
     120        char *lpszNewName = (char *)alloca(strlen(name) + strlen(lpszExportPrefix)+1);
     121        if(lpszNewName == NULL) {
     122            DebugInt3();
     123            return 0;
     124        }
     125        strcpy(lpszNewName, lpszExportPrefix);
     126        strcat(lpszNewName, name);
     127        rc = DosQueryProcAddr(hinstanceOS2, 0, lpszNewName, (PFN *)&apiaddr);
     128        if(rc == NO_ERROR) {
     129            return(apiaddr);
     130        }
     131        //else try with the normal name
     132    }
    110133    rc = DosQueryProcAddr(hinstanceOS2, 0, name, (PFN *)&apiaddr);
    111134    if(rc)
    112135    {
    113             dprintf(("Win32LxImage::getApi %x %s -> rc = %d", hinstanceOS2, name, rc));
    114             return(0);
     136        dprintf(("Win32LxImage::getApi %x %s -> rc = %d", hinstanceOS2, name, rc));
     137        return(0);
    115138    }
    116139    return(apiaddr);
     
    123146    ULONG       apiaddr;
    124147
    125     rc = DosQueryProcAddr(hinstanceOS2, dwOrdinalBase + ordinal, NULL, (PFN *)&apiaddr);
     148    rc = DosQueryProcAddr(hinstanceOS2, dwOrdinalBase+ordinal, NULL, (PFN *)&apiaddr);
    126149    if(rc) {
    127150        dprintf(("Win32LxImage::getApi %x %d -> rc = %d", hinstanceOS2, ordinal, rc));
     
    131154}
    132155//******************************************************************************
    133 // here we build a fake PE header for an LX module. In Windows, HINSTANCE handles
    134 // actually contain the virtual address of of the PE header. We try to fill in
    135 // sensible values as much as possible...
    136156//******************************************************************************
    137157LPVOID Win32LxImage::buildHeader(DWORD MajorImageVersion, DWORD MinorImageVersion,
     
    144164    DWORD *ntsig;
    145165
    146     // AH TODO: we are wasting 60k address space here!!!! (at least without PAG_ANY)
    147166    rc = DosAllocMem(&header, 4096, PAG_READ | PAG_WRITE | PAG_COMMIT | flAllocMem);
    148167    if(rc) {
    149168        dprintf(("ERROR: buildHeader DosAllocMem failed!! (rc=%x)", rc));
    150169        DebugInt3();
    151         return NULL;
     170            return NULL;
    152171    }
    153172    memcpy(header, dosHeader, sizeof(dosHeader));
  • trunk/src/kernel32/winimagelx.h

    r7797 r9411  
    1 /* $Id: winimagelx.h,v 1.6 2002-02-03 13:16:23 sandervl Exp $ */
     1/* $Id: winimagelx.h,v 1.7 2002-11-18 13:53:55 sandervl Exp $ */
    22
    33/*
     
    3030        HINSTANCE   getHMOD() const { return hinstanceOS2; }
    3131protected:
    32   LPVOID header;
     32  LPVOID    header;
    3333  HINSTANCE hinstanceOS2;
    34   DWORD  dwOrdinalBase;
     34  DWORD     dwOrdinalBase;
     35  LPSTR     lpszExportPrefix;
    3536private:
    3637};
Note: See TracChangeset for help on using the changeset viewer.