comparison loader/win32.c @ 22475:9edc4cfaeaed

Allow declaring special undefined functions that will return NULL instead of a pointer to a stub.
author reimar
date Thu, 08 Mar 2007 22:25:13 +0000
parents 9977fe541c4d
children 50225df605b5
comparison
equal deleted inserted replaced
22474:f5c234c87e5f 22475:9edc4cfaeaed
4856 struct exports* exps; 4856 struct exports* exps;
4857 }; 4857 };
4858 4858
4859 #define FF(X,Y) \ 4859 #define FF(X,Y) \
4860 {#X, Y, (void*)exp##X}, 4860 {#X, Y, (void*)exp##X},
4861
4862 #define UNDEFF(X, Y) \
4863 {#X, Y, (void*)-1},
4861 4864
4862 struct exports exp_kernel32[]= 4865 struct exports exp_kernel32[]=
4863 { 4866 {
4864 FF(GetVolumeInformationA,-1) 4867 FF(GetVolumeInformationA,-1)
4865 FF(GetDriveTypeA,-1) 4868 FF(GetDriveTypeA,-1)
5013 FF(SetThreadPriority,-1) 5016 FF(SetThreadPriority,-1)
5014 FF(ExitProcess,-1) 5017 FF(ExitProcess,-1)
5015 {"LoadLibraryExA", -1, (void*)&LoadLibraryExA}, 5018 {"LoadLibraryExA", -1, (void*)&LoadLibraryExA},
5016 FF(SetThreadIdealProcessor,-1) 5019 FF(SetThreadIdealProcessor,-1)
5017 FF(SetProcessAffinityMask, -1) 5020 FF(SetProcessAffinityMask, -1)
5021 UNDEFF(FlsAlloc, -1)
5022 UNDEFF(FlsGetValue, -1)
5023 UNDEFF(FlsSetValue, -1)
5024 UNDEFF(FlsFree, -1)
5018 }; 5025 };
5019 5026
5020 struct exports exp_msvcrt[]={ 5027 struct exports exp_msvcrt[]={
5021 FF(malloc, -1) 5028 FF(malloc, -1)
5022 FF(_initterm, -1) 5029 FF(_initterm, -1)
5424 continue; 5431 continue;
5425 for(j=0; j<libraries[i].length; j++) 5432 for(j=0; j<libraries[i].length; j++)
5426 { 5433 {
5427 if(strcmp(name, libraries[i].exps[j].name)) 5434 if(strcmp(name, libraries[i].exps[j].name))
5428 continue; 5435 continue;
5436 if((unsigned int)(libraries[i].exps[j].func) == -1)
5437 return NULL; //undefined func
5429 // printf("Hit: 0x%08X\n", libraries[i].exps[j].func); 5438 // printf("Hit: 0x%08X\n", libraries[i].exps[j].func);
5430 return libraries[i].exps[j].func; 5439 return libraries[i].exps[j].func;
5431 } 5440 }
5432 } 5441 }
5433 5442