2 * Win32 builtin functions
4 * Copyright 1997 Alexandre Julliard
11 #include "builtin32.h"
18 #include "debugtools.h"
20 DECLARE_DEBUG_CHANNEL(relay
)
21 DECLARE_DEBUG_CHANNEL(win32
)
22 DECLARE_DEBUG_CHANNEL(module
)
26 BYTE call
; /* 0xe8 call callfrom32 (relative) */
27 DWORD callfrom32 WINE_PACKED
; /* RELAY_CallFrom32 relative addr */
28 BYTE ret
; /* 0xc2 ret $n or 0xc3 ret */
29 WORD args
; /* nb of args to remove from the stack */
35 const DWORD nresources
;
36 const DWORD restabsize
;
37 const IMAGE_RESOURCE_DATA_ENTRY
*entries
;
42 const BUILTIN32_DESCRIPTOR
*descr
; /* DLL descriptor */
44 const BUILTIN32_RESOURCE
*rsc
;
47 #define BI32_INSTANTIATED 0x01
49 extern const BUILTIN32_DESCRIPTOR ADVAPI32_Descriptor
;
50 extern const BUILTIN32_DESCRIPTOR AVIFIL32_Descriptor
;
51 extern const BUILTIN32_DESCRIPTOR COMCTL32_Descriptor
;
52 extern const BUILTIN32_DESCRIPTOR COMDLG32_Descriptor
;
53 extern const BUILTIN32_DESCRIPTOR CRTDLL_Descriptor
;
54 extern const BUILTIN32_DESCRIPTOR DCIMAN32_Descriptor
;
55 extern const BUILTIN32_DESCRIPTOR DDRAW_Descriptor
;
56 extern const BUILTIN32_DESCRIPTOR DINPUT_Descriptor
;
57 extern const BUILTIN32_DESCRIPTOR DPLAY_Descriptor
;
58 extern const BUILTIN32_DESCRIPTOR DPLAYX_Descriptor
;
59 extern const BUILTIN32_DESCRIPTOR DSOUND_Descriptor
;
60 extern const BUILTIN32_DESCRIPTOR GDI32_Descriptor
;
61 extern const BUILTIN32_DESCRIPTOR IMAGEHLP_Descriptor
;
62 extern const BUILTIN32_DESCRIPTOR IMM32_Descriptor
;
63 extern const BUILTIN32_DESCRIPTOR KERNEL32_Descriptor
;
64 extern const BUILTIN32_DESCRIPTOR LZ32_Descriptor
;
65 extern const BUILTIN32_DESCRIPTOR MPR_Descriptor
;
66 extern const BUILTIN32_DESCRIPTOR MCIAVI_Descriptor
;
67 extern const BUILTIN32_DESCRIPTOR MCIANIM_Descriptor
;
68 extern const BUILTIN32_DESCRIPTOR MCICDA_Descriptor
;
69 extern const BUILTIN32_DESCRIPTOR MCISEQ_Descriptor
;
70 extern const BUILTIN32_DESCRIPTOR MCIWAVE_Descriptor
;
71 extern const BUILTIN32_DESCRIPTOR MSACM32_Descriptor
;
72 extern const BUILTIN32_DESCRIPTOR MSNET32_Descriptor
;
73 extern const BUILTIN32_DESCRIPTOR MSVFW32_Descriptor
;
74 extern const BUILTIN32_DESCRIPTOR NTDLL_Descriptor
;
75 extern const BUILTIN32_DESCRIPTOR OLE32_Descriptor
;
76 extern const BUILTIN32_DESCRIPTOR OLEAUT32_Descriptor
;
77 extern const BUILTIN32_DESCRIPTOR OLECLI32_Descriptor
;
78 extern const BUILTIN32_DESCRIPTOR OLEDLG_Descriptor
;
79 extern const BUILTIN32_DESCRIPTOR OLESVR32_Descriptor
;
80 extern const BUILTIN32_DESCRIPTOR PSAPI_Descriptor
;
81 extern const BUILTIN32_DESCRIPTOR RASAPI32_Descriptor
;
82 extern const BUILTIN32_DESCRIPTOR SHELL32_Descriptor
;
83 extern const BUILTIN32_DESCRIPTOR TAPI32_Descriptor
;
84 extern const BUILTIN32_DESCRIPTOR USER32_Descriptor
;
85 extern const BUILTIN32_DESCRIPTOR VERSION_Descriptor
;
86 extern const BUILTIN32_DESCRIPTOR W32SKRNL_Descriptor
;
87 extern const BUILTIN32_DESCRIPTOR WINMM_Descriptor
;
88 extern const BUILTIN32_DESCRIPTOR WINSPOOL_Descriptor
;
89 extern const BUILTIN32_DESCRIPTOR WNASPI32_Descriptor
;
90 extern const BUILTIN32_DESCRIPTOR WOW32_Descriptor
;
91 extern const BUILTIN32_DESCRIPTOR WSOCK32_Descriptor
;
93 extern const BUILTIN32_RESOURCE comctl32_ResourceDescriptor
;
94 extern const BUILTIN32_RESOURCE comdlg32_ResourceDescriptor
;
95 extern const BUILTIN32_RESOURCE shell32_ResourceDescriptor
;
96 extern const BUILTIN32_RESOURCE user32_ResourceDescriptor
;
98 static BUILTIN32_DLL BuiltinDLLs
[] =
100 { &ADVAPI32_Descriptor
, 0, NULL
},
101 { &AVIFIL32_Descriptor
, 0, NULL
},
102 { &COMCTL32_Descriptor
, 0, &comctl32_ResourceDescriptor
},
103 { &COMDLG32_Descriptor
, 0, &comdlg32_ResourceDescriptor
},
104 { &CRTDLL_Descriptor
, 0, NULL
},
105 { &DCIMAN32_Descriptor
, 0, NULL
},
106 { &DDRAW_Descriptor
, 0, NULL
},
107 { &DINPUT_Descriptor
, 0, NULL
},
108 { &DPLAY_Descriptor
, 0, NULL
},
109 { &DPLAYX_Descriptor
, 0, NULL
},
110 { &DSOUND_Descriptor
, 0, NULL
},
111 { &GDI32_Descriptor
, 0, NULL
},
112 { &IMAGEHLP_Descriptor
, 0, NULL
},
113 { &IMM32_Descriptor
, 0, NULL
},
114 { &KERNEL32_Descriptor
, 0, NULL
},
115 { &LZ32_Descriptor
, 0, NULL
},
116 { &MCIANIM_Descriptor
, 0, NULL
},
117 { &MCIAVI_Descriptor
, 0, NULL
},
118 { &MCICDA_Descriptor
, 0, NULL
},
119 { &MCISEQ_Descriptor
, 0, NULL
},
120 { &MCIWAVE_Descriptor
, 0, NULL
},
121 { &MPR_Descriptor
, 0, NULL
},
122 { &MSACM32_Descriptor
, 0, NULL
},
123 { &MSNET32_Descriptor
, 0, NULL
},
124 { &MSVFW32_Descriptor
, 0, NULL
},
125 { &NTDLL_Descriptor
, 0, NULL
},
126 { &OLE32_Descriptor
, 0, NULL
},
127 { &OLEAUT32_Descriptor
, 0, NULL
},
128 { &OLECLI32_Descriptor
, 0, NULL
},
129 { &OLEDLG_Descriptor
, 0, NULL
},
130 { &OLESVR32_Descriptor
, 0, NULL
},
131 { &PSAPI_Descriptor
, 0, NULL
},
132 { &RASAPI32_Descriptor
, 0, NULL
},
133 { &SHELL32_Descriptor
, 0, &shell32_ResourceDescriptor
},
134 { &TAPI32_Descriptor
, 0, NULL
},
135 { &USER32_Descriptor
, 0, &user32_ResourceDescriptor
},
136 { &VERSION_Descriptor
, 0, NULL
},
137 { &W32SKRNL_Descriptor
, 0, NULL
},
138 { &WINMM_Descriptor
, 0, NULL
},
139 { &WINSPOOL_Descriptor
, 0, NULL
},
140 { &WNASPI32_Descriptor
, 0, NULL
},
141 { &WOW32_Descriptor
, 0, NULL
},
142 { &WSOCK32_Descriptor
, 0, NULL
},
147 extern void RELAY_CallFrom32();
149 /***********************************************************************
150 * BUILTIN32_DoLoadImage
152 * Load a built-in Win32 module. Helper function for BUILTIN32_LoadImage.
154 static HMODULE
BUILTIN32_DoLoadImage( BUILTIN32_DLL
*dll
)
157 IMAGE_DATA_DIRECTORY
*dir
;
158 IMAGE_DOS_HEADER
*dos
;
159 IMAGE_NT_HEADERS
*nt
;
160 IMAGE_SECTION_HEADER
*sec
;
161 IMAGE_EXPORT_DIRECTORY
*exp
;
164 DEBUG_ENTRY_POINT
*debug
;
168 /* Allocate the module */
170 size
= (sizeof(IMAGE_DOS_HEADER
)
171 + sizeof(IMAGE_NT_HEADERS
)
172 + 2 * sizeof(IMAGE_SECTION_HEADER
)
173 + sizeof(IMAGE_EXPORT_DIRECTORY
)
174 + dll
->descr
->nb_funcs
* sizeof(LPVOID
)
175 + dll
->descr
->nb_names
* sizeof(LPSTR
));
177 if (WARN_ON(relay
) || TRACE_ON(relay
))
178 size
+= dll
->descr
->nb_funcs
* sizeof(DEBUG_ENTRY_POINT
);
180 addr
= VirtualAlloc( NULL
, size
, MEM_COMMIT
, PAGE_EXECUTE_READWRITE
);
182 dos
= (IMAGE_DOS_HEADER
*)addr
;
183 nt
= (IMAGE_NT_HEADERS
*)(dos
+ 1);
184 sec
= (IMAGE_SECTION_HEADER
*)(nt
+ 1);
185 exp
= (IMAGE_EXPORT_DIRECTORY
*)(sec
+ 2);
186 funcs
= (LPVOID
*)(exp
+ 1);
187 names
= (LPSTR
*)(funcs
+ dll
->descr
->nb_funcs
);
188 debug
= (DEBUG_ENTRY_POINT
*)(names
+ dll
->descr
->nb_names
);
190 /* Build the DOS and NT headers */
192 dos
->e_magic
= IMAGE_DOS_SIGNATURE
;
193 dos
->e_lfanew
= sizeof(*dos
);
195 nt
->Signature
= IMAGE_NT_SIGNATURE
;
196 nt
->FileHeader
.Machine
= IMAGE_FILE_MACHINE_I386
;
197 nt
->FileHeader
.NumberOfSections
= 2; /* exports + code */
198 nt
->FileHeader
.SizeOfOptionalHeader
= sizeof(nt
->OptionalHeader
);
199 nt
->FileHeader
.Characteristics
= IMAGE_FILE_DLL
;
201 nt
->OptionalHeader
.Magic
= IMAGE_NT_OPTIONAL_HDR_MAGIC
;
202 nt
->OptionalHeader
.SizeOfCode
= 0x1000;
203 nt
->OptionalHeader
.SizeOfInitializedData
= 0;
204 nt
->OptionalHeader
.SizeOfUninitializedData
= 0;
205 nt
->OptionalHeader
.ImageBase
= (DWORD
)addr
;
206 nt
->OptionalHeader
.SectionAlignment
= 0x1000;
207 nt
->OptionalHeader
.FileAlignment
= 0x1000;
208 nt
->OptionalHeader
.MajorOperatingSystemVersion
= 1;
209 nt
->OptionalHeader
.MinorOperatingSystemVersion
= 0;
210 nt
->OptionalHeader
.MajorSubsystemVersion
= 4;
211 nt
->OptionalHeader
.MinorSubsystemVersion
= 0;
212 nt
->OptionalHeader
.SizeOfImage
= size
;
213 nt
->OptionalHeader
.SizeOfHeaders
= (BYTE
*)exp
- addr
;
214 nt
->OptionalHeader
.NumberOfRvaAndSizes
= IMAGE_NUMBEROF_DIRECTORY_ENTRIES
;
215 if (dll
->descr
->dllentrypoint
)
216 nt
->OptionalHeader
.AddressOfEntryPoint
= (DWORD
)dll
->descr
->dllentrypoint
- (DWORD
)addr
;
218 /* Build the export directory */
220 dir
= &nt
->OptionalHeader
.DataDirectory
[IMAGE_FILE_EXPORT_DIRECTORY
];
221 dir
->VirtualAddress
= (BYTE
*)exp
- addr
;
222 dir
->Size
= sizeof(*exp
)
223 + dll
->descr
->nb_funcs
* sizeof(LPVOID
)
224 + dll
->descr
->nb_names
* sizeof(LPSTR
);
226 /* Build the exports section */
228 strcpy( sec
->Name
, ".edata" );
229 sec
->Misc
.VirtualSize
= dir
->Size
;
230 sec
->VirtualAddress
= (BYTE
*)exp
- addr
;
231 sec
->SizeOfRawData
= dir
->Size
;
232 sec
->PointerToRawData
= (BYTE
*)exp
- addr
;
233 sec
->Characteristics
= (IMAGE_SCN_CNT_INITIALIZED_DATA
|
234 IMAGE_SCN_MEM_EXECUTE
| IMAGE_SCN_MEM_READ
|
235 IMAGE_SCN_MEM_WRITE
);
237 /* Build the resource directory */
242 IMAGE_RESOURCE_DATA_ENTRY
*rdep
;
244 rtab
= HeapAlloc(GetProcessHeap(), 0, dll
->rsc
->restabsize
);
247 ERR_(module
)("Failed to get memory for resource directory\n");
248 VirtualFree(addr
, size
, MEM_RELEASE
);
253 * The resource directory has to be copied because it contains
254 * RVAs. These would be invalid if the dll is instantiated twice.
256 memcpy(rtab
, dll
->rsc
->restab
, dll
->rsc
->restabsize
);
258 dir
= &nt
->OptionalHeader
.DataDirectory
[IMAGE_FILE_RESOURCE_DIRECTORY
];
259 dir
->VirtualAddress
= (DWORD
)rtab
- (DWORD
)addr
;
260 dir
->Size
= dll
->rsc
->restabsize
;
261 rdep
= (IMAGE_RESOURCE_DATA_ENTRY
*)((DWORD
)rtab
+ (DWORD
)dll
->rsc
->entries
- (DWORD
)dll
->rsc
->restab
);
262 for(i
= 0; i
< dll
->rsc
->nresources
; i
++)
264 rdep
[i
].OffsetToData
+= (DWORD
)dll
->rsc
->restab
- (DWORD
)addr
;
268 /* Build the code section */
271 strcpy( sec
->Name
, ".code" );
272 sec
->SizeOfRawData
= 0;
274 if (WARN_ON(relay
) || TRACE_ON(relay
))
275 sec
->SizeOfRawData
+= dll
->descr
->nb_funcs
* sizeof(DEBUG_ENTRY_POINT
);
277 sec
->Misc
.VirtualSize
= sec
->SizeOfRawData
;
278 sec
->VirtualAddress
= (BYTE
*)debug
- addr
;
279 sec
->PointerToRawData
= (BYTE
*)debug
- addr
;
280 sec
->Characteristics
= (IMAGE_SCN_CNT_INITIALIZED_DATA
|
281 IMAGE_SCN_MEM_EXECUTE
| IMAGE_SCN_MEM_READ
);
283 /* Build the exports section data */
285 exp
->Name
= ((BYTE
*)dll
->descr
->name
) - addr
; /*??*/
286 exp
->Base
= dll
->descr
->base
;
287 exp
->NumberOfFunctions
= dll
->descr
->nb_funcs
;
288 exp
->NumberOfNames
= dll
->descr
->nb_names
;
289 exp
->AddressOfFunctions
= (LPDWORD
*)((BYTE
*)funcs
- addr
);
290 exp
->AddressOfNames
= (LPDWORD
*)((BYTE
*)names
- addr
);
291 exp
->AddressOfNameOrdinals
= (LPWORD
*)((BYTE
*)dll
->descr
->ordinals
- addr
);
293 /* Build the funcs table */
295 for (i
= 0; i
< dll
->descr
->nb_funcs
; i
++, funcs
++, debug
++)
297 BYTE args
= dll
->descr
->args
[i
];
300 if (!dll
->descr
->functions
[i
]) continue;
301 *funcs
= (LPVOID
)((BYTE
*)dll
->descr
->functions
[i
] - addr
);
303 if (!(WARN_ON(relay
) || TRACE_ON(relay
))) continue;
304 for (j
=0;j
<dll
->descr
->nb_names
;j
++)
305 if (dll
->descr
->ordinals
[j
] == i
)
307 if (j
<dll
->descr
->nb_names
) {
308 if (dll
->descr
->names
[j
]) {
310 sprintf(buffer
,"%s.%d: %s",dll
->descr
->name
,i
,dll
->descr
->names
[j
]);
311 if (!RELAY_ShowDebugmsgRelay(buffer
))
317 case 0xfe: /* register func */
319 debug
->callfrom32
= (DWORD
)dll
->descr
->functions
[i
] -
321 debug
->ret
= 0x90; /* nop */
323 *funcs
= (LPVOID
)((BYTE
*)debug
- addr
);
325 case 0xff: /* stub or extern */
327 default: /* normal function (stdcall or cdecl) */
328 if (TRACE_ON(relay
)) {
329 debug
->call
= 0xe8; /* lcall relative */
330 debug
->callfrom32
= (DWORD
)RELAY_CallFrom32
-
333 debug
->call
= 0xe9; /* ljmp relative */
334 debug
->callfrom32
= (DWORD
)dll
->descr
->functions
[i
] -
337 debug
->ret
= (args
& 0x80) ? 0xc3 : 0xc2; /*ret/ret $n*/
338 debug
->args
= (args
& 0x7f) * sizeof(int);
339 *funcs
= (LPVOID
)((BYTE
*)debug
- addr
);
342 #endif /* __i386__ */
345 /* Build the names table */
347 for (i
= 0; i
< exp
->NumberOfNames
; i
++, names
++)
348 if (dll
->descr
->names
[i
])
349 *names
= (LPSTR
)((BYTE
*)dll
->descr
->names
[i
] - addr
);
351 return (HMODULE
)addr
;
354 /***********************************************************************
355 * BUILTIN32_LoadImage
357 * Load a built-in module.
359 HMODULE
BUILTIN32_LoadImage( LPCSTR name
, OFSTRUCT
*ofs
)
361 BUILTIN32_DLL
*table
;
362 char dllname
[16], *p
;
365 /* Fix the name in case we have a full path and extension */
367 if ((p
= strrchr( name
, '\\' ))) name
= p
+ 1;
368 lstrcpynA( dllname
, name
, sizeof(dllname
) );
369 if ((p
= strrchr( dllname
, '.' ))) *p
= '\0';
371 for (table
= BuiltinDLLs
; table
->descr
; table
++)
372 if (!lstrcmpiA( table
->descr
->name
, dllname
)) break;
373 if (!table
->descr
) return 0;
375 if(table
->flags
& BI32_INSTANTIATED
)
377 ERR_(module
)("Attemp to instantiate built-in dll '%s' twice in the same address-space. Expect trouble!\n",
381 sprintf( ofs
->szPathName
, "%s.DLL", table
->descr
->name
);
382 hmod
= BUILTIN32_DoLoadImage( table
);
384 table
->flags
|= BI32_INSTANTIATED
;
390 /***********************************************************************
391 * BUILTIN32_LoadLibraryExA
393 * Partly copied from the original PE_ version.
395 * Note: This implementation is not very nice and should be one with
396 * the BUILTIN32_LoadImage function. But, we don't care too much
397 * because this code will obsolete itself shortly when we get the
398 * modularization of wine implemented (BS 05-Mar-1999).
400 WINE_MODREF
*BUILTIN32_LoadLibraryExA(LPCSTR path
, DWORD flags
, DWORD
*err
)
402 LPCSTR modName
= NULL
;
408 char dllname
[256], *p
;
410 /* Append .DLL to name if no extension present */
411 strcpy( dllname
, path
);
412 if (!(p
= strrchr( dllname
, '.')) || strchr( p
, '/' ) || strchr( p
, '\\'))
413 strcat( dllname
, ".DLL" );
415 hModule32
= BUILTIN32_LoadImage(path
, &ofs
);
418 *err
= ERROR_FILE_NOT_FOUND
;
422 /* Create 16-bit dummy module */
423 if ((hModule16
= MODULE_CreateDummyModule( &ofs
, modName
)) < 32)
425 *err
= (DWORD
)hModule16
;
426 return NULL
; /* FIXME: Should unload the builtin module */
429 pModule
= (NE_MODULE
*)GlobalLock16( hModule16
);
430 pModule
->flags
= NE_FFLAGS_LIBMODULE
| NE_FFLAGS_SINGLEDATA
| NE_FFLAGS_WIN32
| NE_FFLAGS_BUILTIN
;
431 pModule
->module32
= hModule32
;
433 /* Create 32-bit MODREF */
434 if ( !(wm
= PE_CreateModule( hModule32
, &ofs
, flags
, TRUE
)) )
436 ERR_(win32
)("can't load %s\n",ofs
.szPathName
);
437 FreeLibrary16( hModule16
); /* FIXME: Should unload the builtin module */
438 *err
= ERROR_OUTOFMEMORY
;
442 if (wm
->binfmt
.pe
.pe_export
)
443 SNOOP_RegisterDLL(wm
->module
,wm
->modname
,wm
->binfmt
.pe
.pe_export
->NumberOfFunctions
);
450 /***********************************************************************
451 * BUILTIN32_UnloadLibrary
453 * Unload the built-in library and free the modref.
455 void BUILTIN32_UnloadLibrary(WINE_MODREF
*wm
)
457 /* FIXME: do something here */
461 /***********************************************************************
462 * BUILTIN32_GetEntryPoint
464 * Return the name of the DLL entry point corresponding
465 * to a relay entry point address. This is used only by relay debugging.
467 * This function _must_ return the real entry point to call
468 * after the debug info is printed.
470 ENTRYPOINT32
BUILTIN32_GetEntryPoint( char *buffer
, void *relay
,
471 unsigned int *typemask
)
477 /* First find the module */
479 for (dll
= BuiltinDLLs
; dll
->descr
; dll
++)
480 if ((dll
->flags
& BI32_INSTANTIATED
)
481 && ((hModule
= GetModuleHandleA(dll
->descr
->name
)) != 0))
483 IMAGE_SECTION_HEADER
*sec
= PE_SECTIONS(hModule
);
484 DEBUG_ENTRY_POINT
*debug
=
485 (DEBUG_ENTRY_POINT
*)((DWORD
)hModule
+ sec
[1].VirtualAddress
);
486 DEBUG_ENTRY_POINT
*func
= (DEBUG_ENTRY_POINT
*)relay
;
488 if (debug
<= func
&& func
< debug
+ dll
->descr
->nb_funcs
)
490 ordinal
= func
- debug
;
496 return (ENTRYPOINT32
)NULL
;
498 /* Now find the function */
500 for (i
= 0; i
< dll
->descr
->nb_names
; i
++)
501 if (dll
->descr
->ordinals
[i
] == ordinal
) break;
502 assert( i
< dll
->descr
->nb_names
);
504 sprintf( buffer
, "%s.%d: %s", dll
->descr
->name
, ordinal
+ dll
->descr
->base
,
505 dll
->descr
->names
[i
] );
506 *typemask
= dll
->descr
->argtypes
[ordinal
];
507 return dll
->descr
->functions
[ordinal
];
510 /***********************************************************************
511 * BUILTIN32_SwitchRelayDebug
513 * FIXME: enhance to do it module relative.
515 void BUILTIN32_SwitchRelayDebug(BOOL onoff
) {
521 if (!(TRACE_ON(relay
) || WARN_ON(relay
)))
523 for (dll
= BuiltinDLLs
; dll
->descr
; dll
++) {
524 IMAGE_SECTION_HEADER
*sec
;
525 DEBUG_ENTRY_POINT
*debug
;
526 if (!(dll
->flags
& BI32_INSTANTIATED
) || !(hModule
= GetModuleHandleA(dll
->descr
->name
)))
529 sec
= PE_SECTIONS(hModule
);
530 debug
= (DEBUG_ENTRY_POINT
*)((DWORD
)hModule
+ sec
[1].VirtualAddress
);
531 for (i
= 0; i
< dll
->descr
->nb_funcs
; i
++,debug
++) {
532 if (!dll
->descr
->functions
[i
]) continue;
533 if ((dll
->descr
->args
[i
]==0xff) || (dll
->descr
->args
[i
]==0xfe))
536 debug
->call
= 0xe8; /* lcall relative */
537 debug
->callfrom32
= (DWORD
)RELAY_CallFrom32
-
540 debug
->call
= 0xe9; /* ljmp relative */
541 debug
->callfrom32
= (DWORD
)dll
->descr
->functions
[i
] -
546 #endif /* __i386__ */
550 /***********************************************************************
551 * BUILTIN32_Unimplemented
553 * This function is called for unimplemented 32-bit entry points (declared
554 * as 'stub' in the spec file).
556 void BUILTIN32_Unimplemented( const BUILTIN32_DESCRIPTOR
*descr
, int ordinal
)
558 const char *func_name
= "???";
561 __RESTORE_ES
; /* Just in case */
563 for (i
= 0; i
< descr
->nb_names
; i
++)
564 if (descr
->ordinals
[i
] + descr
->base
== ordinal
) break;
565 if (i
< descr
->nb_names
) func_name
= descr
->names
[i
];
567 MESSAGE( "No handler for Win32 routine %s.%d: %s",
568 descr
->name
, ordinal
, func_name
);
570 MESSAGE( " (called from %p)", __builtin_return_address(1) );