Changeset 9411 for trunk/src/kernel32/winimagelx.cpp
- Timestamp:
- Nov 18, 2002, 2:54:12 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/winimagelx.cpp
r8887 r9411 1 /* $Id: winimagelx.cpp,v 1.1 7 2002-07-18 12:01:34 achimhaExp $ */1 /* $Id: winimagelx.cpp,v 1.18 2002-11-18 13:53:54 sandervl Exp $ */ 2 2 3 3 /* … … 73 73 if(lpszCustomDllName) { 74 74 name = lpszCustomDllName; 75 this->dwOrdinalBase = ::dwOrdinalBase; 75 this->dwOrdinalBase = ::dwOrdinalBase; 76 77 if(lpszCustomExportPrefix) { 78 this->lpszExportPrefix = strdup(::lpszCustomExportPrefix); 79 } 76 80 } 77 81 else { 78 82 name = OSLibGetDllName(hinstance); 79 this->dwOrdinalBase = 0; 83 this->dwOrdinalBase = 0; 84 this->lpszExportPrefix = NULL; 80 85 } 81 86 … … 97 102 Win32LxImage::~Win32LxImage() 98 103 { 104 if(lpszExportPrefix) free(lpszExportPrefix); 105 99 106 if(header) { 100 107 DosFreeMem(header); … … 108 115 ULONG apiaddr; 109 116 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 } 110 133 rc = DosQueryProcAddr(hinstanceOS2, 0, name, (PFN *)&apiaddr); 111 134 if(rc) 112 135 { 113 114 136 dprintf(("Win32LxImage::getApi %x %s -> rc = %d", hinstanceOS2, name, rc)); 137 return(0); 115 138 } 116 139 return(apiaddr); … … 123 146 ULONG apiaddr; 124 147 125 rc = DosQueryProcAddr(hinstanceOS2, dwOrdinalBase +ordinal, NULL, (PFN *)&apiaddr);148 rc = DosQueryProcAddr(hinstanceOS2, dwOrdinalBase+ordinal, NULL, (PFN *)&apiaddr); 126 149 if(rc) { 127 150 dprintf(("Win32LxImage::getApi %x %d -> rc = %d", hinstanceOS2, ordinal, rc)); … … 131 154 } 132 155 //****************************************************************************** 133 // here we build a fake PE header for an LX module. In Windows, HINSTANCE handles134 // actually contain the virtual address of of the PE header. We try to fill in135 // sensible values as much as possible...136 156 //****************************************************************************** 137 157 LPVOID Win32LxImage::buildHeader(DWORD MajorImageVersion, DWORD MinorImageVersion, … … 144 164 DWORD *ntsig; 145 165 146 // AH TODO: we are wasting 60k address space here!!!! (at least without PAG_ANY)147 166 rc = DosAllocMem(&header, 4096, PAG_READ | PAG_WRITE | PAG_COMMIT | flAllocMem); 148 167 if(rc) { 149 168 dprintf(("ERROR: buildHeader DosAllocMem failed!! (rc=%x)", rc)); 150 169 DebugInt3(); 151 170 return NULL; 152 171 } 153 172 memcpy(header, dosHeader, sizeof(dosHeader));
Note:
See TracChangeset
for help on using the changeset viewer.