- Timestamp:
- Jan 5, 2003, 1:31:26 PM (23 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.DEF
r9537 r9617 1 ; $Id: KERNEL32.DEF,v 1.14 7 2002-12-20 11:39:40sandervl Exp $1 ; $Id: KERNEL32.DEF,v 1.148 2003-01-05 12:31:22 sandervl Exp $ 2 2 3 3 ;Basis is Windows95 KERNEL32 … … 1210 1210 OSLibDosDevIOCtl @2026 NONAME 1211 1211 1212 ; custom dll hook installer 1213 _ODIN_SetDllLoadCallback@4 @2100 NONAME 1214 ; override export 1215 _ODIN_SetProcAddress@12 @2101 NONAME 1216 1212 1217 GetDisplayCodepage @3000 NONAME 1213 1218 GetWindowsCodepage @3001 NONAME -
trunk/src/kernel32/kernel32dbg.def
r9537 r9617 1 ; $Id: kernel32dbg.def,v 1.2 2 2002-12-20 11:39:41sandervl Exp $1 ; $Id: kernel32dbg.def,v 1.23 2003-01-05 12:31:23 sandervl Exp $ 2 2 3 3 ;Basis is Windows95 KERNEL32 … … 1210 1210 OSLibDosDevIOCtl @2026 NONAME 1211 1211 1212 ; custom dll hook installer 1213 _ODIN_SetDllLoadCallback@4 @2100 NONAME 1214 ; override export 1215 _ODIN_SetProcAddress@12 @2101 NONAME 1216 1212 1217 GetDisplayCodepage @3000 NONAME 1213 1218 GetWindowsCodepage @3001 NONAME -
trunk/src/kernel32/oslibdebug.h
r8504 r9617 1 /* $Id: oslibdebug.h,v 1. 2 2002-05-28 09:53:34sandervl Exp $ */1 /* $Id: oslibdebug.h,v 1.3 2003-01-05 12:31:23 sandervl Exp $ */ 2 2 3 3 /* … … 13 13 #define __OSLIBDEBUG_H__ 14 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 15 19 #ifndef PAGE_SIZE 16 20 #define PAGE_SIZE 4096 … … 23 27 VOID OSLibDebugReadMemory(LPCVOID lpBaseAddress,LPVOID lpBuffer, DWORD cbRead, LPDWORD lpNumberOfBytesRead); 24 28 BOOL OSLibAddWin32Event(LPDEBUG_EVENT lpde); 29 30 #ifdef __cplusplus 31 } 32 #endif 33 25 34 #endif //__OSLIBDEBUG_H__ -
trunk/src/kernel32/oslibdos.h
r9530 r9617 1 /* $Id: oslibdos.h,v 1. 49 2002-12-19 12:55:27sandervl Exp $ */1 /* $Id: oslibdos.h,v 1.50 2003-01-05 12:31:24 sandervl Exp $ */ 2 2 3 3 /* … … 13 13 #define __OSLIBDOS_H__ 14 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 15 18 16 19 #ifdef OS2_INCLUDED … … 358 361 DWORD OSLibDosGetNumPhysDrives(); 359 362 363 #ifdef __cplusplus 364 } 365 #endif 366 360 367 #endif //__OSLIBDOS_H__ 361 368 -
trunk/src/kernel32/oslibexcept.h
r4224 r9617 1 /* $Id: oslibexcept.h,v 1. 2 2000-09-08 18:07:50sandervl Exp $ */1 /* $Id: oslibexcept.h,v 1.3 2003-01-05 12:31:24 sandervl Exp $ */ 2 2 /* 3 3 * Exception handler util. procedures … … 8 8 #ifndef __OSLIBEXCEPT_H__ 9 9 #define __OSLIBEXCEPT_H__ 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 10 14 11 15 //****************************************************************************** … … 18 22 PCONTEXTRECORD pContextRec, PVOID p); 19 23 24 #ifdef __cplusplus 25 } 20 26 #endif 27 28 #endif -
trunk/src/kernel32/osliblvm.h
r9304 r9617 1 /* $Id: osliblvm.h,v 1. 4 2002-09-27 14:35:56sandervl Exp $ */1 /* $Id: osliblvm.h,v 1.5 2003-01-05 12:31:24 sandervl Exp $ */ 2 2 /* 3 3 * OS/2 LVM (Logical Volume Management) functions … … 10 10 #ifndef __OSLIBLVM_H__ 11 11 #define __OSLIBLVM_H__ 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 12 16 13 17 #include <win\winioctl.h> … … 345 349 BOOL OSLibLVMGetDiskGeometry(DWORD dwDiskNr, PDISK_GEOMETRY pGeom); 346 350 351 #ifdef __cplusplus 352 } 353 #endif 354 347 355 #endif //__OSLIBLVM_H__ -
trunk/src/kernel32/oslibmem.h
r8882 r9617 1 /* $Id: oslibmem.h,v 1. 2 2002-07-16 08:16:48sandervl Exp $ */1 /* $Id: oslibmem.h,v 1.3 2003-01-05 12:31:24 sandervl Exp $ */ 2 2 /* 3 3 * OS/2 Memory management procedures … … 8 8 #ifndef __OSLIBMEM_H__ 9 9 #define __OSLIBMISC_H__ 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 10 14 11 15 #ifndef __OS2_H__ … … 50 54 PVOID OSLibDosFindMemBase(LPVOID lpMemAddr); 51 55 56 #ifdef __cplusplus 57 } 58 #endif 52 59 53 60 #endif -
trunk/src/kernel32/oslibmisc.h
r9582 r9617 1 /* $Id: oslibmisc.h,v 1.1 0 2003-01-02 11:50:46sandervl Exp $ */1 /* $Id: oslibmisc.h,v 1.11 2003-01-05 12:31:24 sandervl Exp $ */ 2 2 /* 3 3 * Misc util. procedures … … 13 13 char *OSLibGetDllName(ULONG hModule); 14 14 BOOL OSLibGetDllName(ULONG hModule, char *name, int length); 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 15 19 16 20 char *OSLibStripPath(char *path); … … 90 94 ULONG OSLibQueryCountry(); 91 95 96 #ifdef __cplusplus 97 } 92 98 #endif 99 100 #endif -
trunk/src/kernel32/oslibtime.h
r8775 r9617 1 /* $Id: oslibtime.h,v 1. 1 2002-06-26 07:14:18sandervl Exp $ */1 /* $Id: oslibtime.h,v 1.2 2003-01-05 12:31:24 sandervl Exp $ */ 2 2 /* 3 3 * OS/2 time procedures … … 11 11 #define __OSLIBTIME_H__ 12 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 13 17 ULONG OSLibDosGetTickCount(); 14 18 19 #ifdef __cplusplus 20 } 21 #endif 22 15 23 #endif //__OSLIBTIME_H__ -
trunk/src/kernel32/windllbase.cpp
r9533 r9617 1 /* $Id: windllbase.cpp,v 1.3 1 2002-12-20 10:38:57sandervl Exp $ */1 /* $Id: windllbase.cpp,v 1.32 2003-01-05 12:31:25 sandervl Exp $ */ 2 2 3 3 /* -
trunk/src/kernel32/winimagebase.cpp
r8327 r9617 1 /* $Id: winimagebase.cpp,v 1.3 5 2002-04-29 17:05:30sandervl Exp $ */1 /* $Id: winimagebase.cpp,v 1.36 2003-01-05 12:31:25 sandervl Exp $ */ 2 2 3 3 /* … … 151 151 //dummy 152 152 return 0; 153 } 154 //****************************************************************************** 155 //****************************************************************************** 156 ULONG Win32ImageBase::setApi(char *name, ULONG pfnNewProc) 157 { 158 return -1; //only implemented for PE modules 159 } 160 //****************************************************************************** 161 //****************************************************************************** 162 ULONG Win32ImageBase::setApi(int ordinal, ULONG pfnNewProc) 163 { 164 return -1; //only implemented for PE modules 153 165 } 154 166 //****************************************************************************** -
trunk/src/kernel32/winimagebase.h
r9537 r9617 1 /* $Id: winimagebase.h,v 1.2 2 2002-12-20 11:39:41sandervl Exp $ */1 /* $Id: winimagebase.h,v 1.23 2003-01-05 12:31:25 sandervl Exp $ */ 2 2 3 3 /* … … 113 113 virtual ULONG getApi(int ordinal) = 0; 114 114 115 virtual ULONG setApi(char *name, ULONG pfnNewProc); 116 virtual ULONG setApi(int ordinal, ULONG pfnNewProc); 117 115 118 virtual ULONG getImageSize(); 116 119 -
trunk/src/kernel32/winimagepeldr.cpp
r9537 r9617 1 /* $Id: winimagepeldr.cpp,v 1.10 2 2002-12-20 11:39:42sandervl Exp $ */1 /* $Id: winimagepeldr.cpp,v 1.103 2003-01-05 12:31:25 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 #include <win32api.h> 45 45 #include <heapcode.h> 46 #include <custombuild.h> 46 47 #include "winimagebase.h" 47 48 #include "winimagepeldr.h" … … 1372 1373 } 1373 1374 //****************************************************************************** 1375 //Install a hook that gets called when the exports have been processed 1376 //****************************************************************************** 1377 static ODINPROC_DLLLOAD pfnDllLoad = NULL; 1378 //****************************************************************************** 1379 BOOL WIN32API ODIN_SetDllLoadCallback(ODINPROC_DLLLOAD pfnMyDllLoad) 1380 { 1381 pfnDllLoad = pfnMyDllLoad; 1382 return TRUE; 1383 } 1384 //****************************************************************************** 1374 1385 //****************************************************************************** 1375 1386 BOOL Win32PeLdrImage::processExports(char *win32file) … … 1437 1448 } 1438 1449 } 1450 } 1451 1452 //Call the dll load hook; must be done here so noone has the opportunity 1453 //to use this dll (get exports) 1454 if(pfnDllLoad) { 1455 pfnDllLoad(hinstance); 1439 1456 } 1440 1457 … … 1915 1932 //****************************************************************************** 1916 1933 //****************************************************************************** 1917 ULONG Win32PeLdrImage::getApi(char *name)1934 NameExport *Win32PeLdrImage::findApi(char *name) 1918 1935 { 1919 1936 ULONG apiaddr, i, apilen; … … 1940 1957 { 1941 1958 if(strcmp(curexport->name, apiname) == 0) 1942 return (curexport->virtaddr);1959 return curexport; 1943 1960 } 1944 1961 curexport = (NameExport *)((ULONG)curexport->name + curexport->nlength); 1945 1962 } 1946 return(0); 1947 } 1948 //****************************************************************************** 1949 //****************************************************************************** 1950 ULONG Win32PeLdrImage::getApi(int ordinal) 1963 return NULL; 1964 } 1965 //****************************************************************************** 1966 //****************************************************************************** 1967 ULONG Win32PeLdrImage::getApi(char *name) 1968 { 1969 NameExport *curexport; 1970 1971 curexport = findApi(name); 1972 if(curexport) { 1973 return(curexport->virtaddr); 1974 } 1975 return 0; 1976 } 1977 //****************************************************************************** 1978 //Override a name export 1979 //****************************************************************************** 1980 ULONG Win32PeLdrImage::setApi(char *name, ULONG pfnNewProc) 1981 { 1982 NameExport *curexport; 1983 1984 curexport = findApi(name); 1985 if(curexport) { 1986 ULONG pfnOldProc = curexport->virtaddr; 1987 1988 curexport->virtaddr = pfnNewProc; 1989 return pfnOldProc; 1990 } 1991 return -1; 1992 } 1993 //****************************************************************************** 1994 //****************************************************************************** 1995 OrdExport *Win32PeLdrImage::findApi(int ordinal) 1951 1996 { 1952 1997 ULONG apiaddr, i; 1953 1998 OrdExport *curexport; 1954 NameExport *nexport;1955 1999 1956 2000 curexport = ordexports; … … 1978 2022 else 1979 2023 if (iThisExport == ordinal) // found the export? 1980 return curexport[i].virtaddr;2024 return &curexport[i]; 1981 2025 else 1982 2026 i -= min(iStep, (iThisExport-ordinal)); // move farther up the list … … 2003 2047 iThisExport = curexport[i].ordinal; 2004 2048 if(iThisExport == ordinal) 2005 return (curexport[i].virtaddr);2049 return &curexport[i]; 2006 2050 else 2007 2051 if (iThisExport > ordinal) … … 2018 2062 iThisExport = curexport[i].ordinal; 2019 2063 if(curexport[i].ordinal == ordinal) 2020 return (curexport[i].virtaddr);2064 return &curexport[i]; 2021 2065 else 2022 2066 if (iThisExport < ordinal) … … 2030 2074 } 2031 2075 } 2076 return NULL; 2077 } 2078 //****************************************************************************** 2079 //****************************************************************************** 2080 ULONG Win32PeLdrImage::getApi(int ordinal) 2081 { 2082 OrdExport *curexport; 2083 NameExport *nexport; 2084 2085 curexport = findApi(ordinal); 2086 if(curexport) { 2087 return curexport->virtaddr; 2088 } 2032 2089 2033 2090 //Name exports also contain an ordinal, so check this 2034 2091 nexport = nameexports; 2035 for(i =0;i<nrNameExports;i++) {2092 for(int i=0;i<nrNameExports;i++) { 2036 2093 if(nexport->ordinal == ordinal) 2037 2094 return(nexport->virtaddr); … … 2040 2097 } 2041 2098 return(0); 2099 } 2100 //****************************************************************************** 2101 //Override an ordinal export 2102 //****************************************************************************** 2103 ULONG Win32PeLdrImage::setApi(int ordinal, ULONG pfnNewProc) 2104 { 2105 OrdExport *curexport; 2106 NameExport *nexport; 2107 2108 curexport = findApi(ordinal); 2109 if(curexport) { 2110 ULONG pfnOldProc = curexport->virtaddr; 2111 2112 curexport->virtaddr = pfnNewProc; 2113 return pfnOldProc; 2114 } 2115 2116 //Name exports also contain an ordinal, so check this 2117 nexport = nameexports; 2118 for(int i=0;i<nrNameExports;i++) 2119 { 2120 if(nexport->ordinal == ordinal) { 2121 ULONG pfnOldProc = nexport->virtaddr; 2122 2123 nexport->virtaddr = pfnNewProc; 2124 return pfnOldProc; 2125 } 2126 2127 nexport = (NameExport *)((ULONG)nexport->name + nexport->nlength); 2128 } 2129 return -1; 2042 2130 } 2043 2131 //****************************************************************************** -
trunk/src/kernel32/winimagepeldr.h
r9537 r9617 1 /* $Id: winimagepeldr.h,v 1.1 8 2002-12-20 11:39:43sandervl Exp $ */1 /* $Id: winimagepeldr.h,v 1.19 2003-01-05 12:31:26 sandervl Exp $ */ 2 2 3 3 /* … … 87 87 virtual ULONG getApi(char *name); 88 88 virtual ULONG getApi(int ordinal); 89 virtual ULONG setApi(char *name, ULONG pfnNewProc); 90 virtual ULONG setApi(int ordinal, ULONG pfnNewProc); 89 91 90 92 virtual ULONG getImageSize(); … … 111 113 Section *findSectionByOS2Addr(ULONG addr); 112 114 Section *findPreviousSectionByOS2Addr(ULONG addr); 115 116 OrdExport *findApi(int ordinal); 117 NameExport *findApi(char *name); 113 118 114 119 BOOL setMemFlags(); -
trunk/src/kernel32/wprocess.cpp
r9540 r9617 1 /* $Id: wprocess.cpp,v 1.16 8 2002-12-20 12:40:44sandervl Exp $ */1 /* $Id: wprocess.cpp,v 1.169 2003-01-05 12:31:26 sandervl Exp $ */ 2 2 3 3 /* … … 2286 2286 } 2287 2287 //****************************************************************************** 2288 // ODIN_SetProcAddress: Override a dll export 2289 // 2290 // Parameters: 2291 // HMODULE hModule Module handle 2292 // LPCSTR lpszProc Export name or ordinal 2293 // FARPROC pfnNewProc New export function address 2294 // 2295 // Returns: Success -> old address of export 2296 // Failure -> -1 2297 // 2298 //****************************************************************************** 2299 FARPROC WIN32API ODIN_SetProcAddress(HMODULE hModule, LPCSTR lpszProc, 2300 FARPROC pfnNewProc) 2301 { 2302 Win32ImageBase *winmod; 2303 FARPROC proc; 2304 ULONG ulAPIOrdinal; 2305 2306 if(hModule == 0 || hModule == -1 || (WinExe && hModule == WinExe->getInstanceHandle())) { 2307 winmod = WinExe; 2308 } 2309 else winmod = (Win32ImageBase *)Win32DllBase::findModule((HINSTANCE)hModule); 2310 2311 if(winmod) { 2312 ulAPIOrdinal = (ULONG)lpszProc; 2313 if (ulAPIOrdinal <= 0x0000FFFF) { 2314 proc = (FARPROC)winmod->setApi((int)ulAPIOrdinal, (ULONG)pfnNewProc); 2315 } 2316 else proc = (FARPROC)winmod->setApi((char *)lpszProc, (ULONG)pfnNewProc); 2317 if(proc == 0) { 2318 #ifdef DEBUG 2319 if(ulAPIOrdinal <= 0x0000FFFF) { 2320 dprintf(("ODIN_SetProcAddress %x %x not found!", hModule, ulAPIOrdinal)); 2321 } 2322 else dprintf(("ODIN_SetProcAddress %x %s not found!", hModule, lpszProc)); 2323 #endif 2324 SetLastError(ERROR_PROC_NOT_FOUND); 2325 } 2326 if(HIWORD(lpszProc)) 2327 dprintf(("KERNEL32: ODIN_SetProcAddress %s from %X returned %X\n", lpszProc, hModule, proc)); 2328 else dprintf(("KERNEL32: ODIN_SetProcAddress %x from %X returned %X\n", lpszProc, hModule, proc)); 2329 2330 SetLastError(ERROR_SUCCESS); 2331 return proc; 2332 } 2333 SetLastError(ERROR_INVALID_HANDLE); 2334 return (FARPROC)-1; 2335 } 2336 //****************************************************************************** 2288 2337 //Retrieve the version 2289 2338 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.