diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-07-29 14:45:03 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-07-29 14:45:03 +0000 |
commit | 217247f74ab1b11dd111717545847f8901462950 (patch) | |
tree | 6693bb43aa349e655f345adb13f36cde8aa84e1b | |
parent | 7450bd283f0082fe1b3499142ad5273067db70c6 (diff) | |
download | xine-lib-217247f74ab1b11dd111717545847f8901462950.tar.gz xine-lib-217247f74ab1b11dd111717545847f8901462950.tar.bz2 |
fix from Casper Boemann to reuse the stubs for unresolved symbols
CVS patchset: 6860
CVS date: 2004/07/29 14:45:03
-rw-r--r-- | src/libw32dll/wine/win32.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/libw32dll/wine/win32.c b/src/libw32dll/wine/win32.c index 6bf7341c0..db7c06402 100644 --- a/src/libw32dll/wine/win32.c +++ b/src/libw32dll/wine/win32.c @@ -5065,6 +5065,15 @@ static void* add_stub(void) { // generated code in runtime! char* answ = (char*)extcode+pos*0x30; + int i; + + /* xine: check if stub for this export was created before */ + for(i = 0; i < pos; i++) + { + if(strcmp(export_names[pos], export_names[i])==0) + return extcode+i*0x30; /* return existing stub */ + } + #if 0 memcpy(answ, &unk_exp1, 0x64); *(int*)(answ+9)=pos; @@ -5079,7 +5088,15 @@ static void* add_stub(void) *((long*) (answ + 18)) = (long)export_names; //answ[23] = 0x68; // pushl $0 (0x68 0x00000000) *((long*) (answ + 24)) = (long)called_unk; - pos++; + + /* xine: don't overflow the stub tables */ + if( (pos+1) < sizeof(extcode) / 0x30 && + (pos+1) < sizeof(export_names) / sizeof(export_names[0]) ) { + pos++; + } else { + strcpy(export_names[pos], "too many unresolved exports"); + } + return (void*)answ; } @@ -5139,7 +5156,9 @@ void* LookupExternal(const char* library, int ordinal) no_dll: #endif +/* xine: pos is now tested inside add_stub() if(pos>150)return 0; +*/ sprintf(export_names[pos], "%s:%d", library, ordinal); return add_stub(); } @@ -5172,7 +5191,9 @@ void* LookupExternalByName(const char* library, const char* name) return libraries[i].exps[j].func; } } +/* xine: pos is now tested inside add_stub() if(pos>150)return 0;// to many symbols +*/ strcpy(export_names[pos], name); return add_stub(); } |