4 * Copyright 1993 Robert J. Amstadt
5 * Copyright 1995 Martin von Loewis
6 * Copyright 1995, 1996, 1997 Alexandre Julliard
7 * Copyright 1997 Eric Youngdale
8 * Copyright 1999 Ulrich Weigand
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/port.h"
34 //#include "wine/exception.h"
38 /* check if entry point needs a relay thunk */
39 static inline int needs_relay( const ORDDEF
*odp
)
41 /* skip nonexistent entry points */
43 /* skip non-functions */
44 if ((odp
->type
!= TYPE_STDCALL
) && (odp
->type
!= TYPE_CDECL
)) return 0;
45 /* skip norelay and forward entry points */
46 if (odp
->flags
& (FLAG_NORELAY
|FLAG_FORWARD
)) return 0;
50 /* check if dll will output relay thunks */
51 int has_relays( DLLSPEC
*spec
)
55 if (target_cpu
!= CPU_x86
) return 0;
57 for (i
= spec
->base
; i
<= spec
->limit
; i
++)
59 ORDDEF
*odp
= spec
->ordinals
[i
];
60 if (needs_relay( odp
)) return 1;
65 /*******************************************************************
68 * Generate an internal name for an entry point. Used for stubs etc.
70 static const char *make_internal_name( const ORDDEF
*odp
, DLLSPEC
*spec
, const char *prefix
)
72 static char buffer
[256];
73 if (odp
->name
|| odp
->export_name
)
76 sprintf( buffer
, "__wine_%s_%s_%s", prefix
, spec
->file_name
,
77 odp
->name
? odp
->name
: odp
->export_name
);
78 /* make sure name is a legal C identifier */
79 for (p
= buffer
; *p
; p
++) if (!isalnum(*p
) && *p
!= '_') break;
80 if (!*p
) return buffer
;
82 sprintf( buffer
, "__wine_%s_%s_%d", prefix
, make_c_identifier(spec
->file_name
), odp
->ordinal
);
87 /*******************************************************************
90 * Output entry points for relay debugging
92 static void output_relay_debug( DLLSPEC
*spec
)
95 unsigned int j
, args
, flags
;
97 /* first the table of entry point offsets */
99 output( "\t%s\n", get_asm_rodata_section() );
100 output( "\t.align %d\n", get_alignment(4) );
101 output( ".L__wine_spec_relay_entry_point_offsets:\n" );
103 for (i
= spec
->base
; i
<= spec
->limit
; i
++)
105 ORDDEF
*odp
= spec
->ordinals
[i
];
107 if (needs_relay( odp
))
108 output( "\t.long .L__wine_spec_relay_entry_point_%d-__wine_spec_relay_entry_points\n", i
);
110 output( "\t.long 0\n" );
113 /* then the table of argument types */
115 output( "\t.align %d\n", get_alignment(4) );
116 output( ".L__wine_spec_relay_arg_types:\n" );
118 for (i
= spec
->base
; i
<= spec
->limit
; i
++)
120 ORDDEF
*odp
= spec
->ordinals
[i
];
121 unsigned int mask
= 0;
123 if (needs_relay( odp
))
125 for (j
= 0; j
< 16 && odp
->u
.func
.arg_types
[j
]; j
++)
127 if (odp
->u
.func
.arg_types
[j
] == 't') mask
|= 1<< (j
*2);
128 if (odp
->u
.func
.arg_types
[j
] == 'W') mask
|= 2<< (j
*2);
131 output( "\t.long 0x%08x\n", mask
);
134 /* then the relay thunks */
136 output( "\t.text\n" );
137 output( "__wine_spec_relay_entry_points:\n" );
138 output( "\tnop\n" ); /* to avoid 0 offset */
140 for (i
= spec
->base
; i
<= spec
->limit
; i
++)
142 ORDDEF
*odp
= spec
->ordinals
[i
];
144 if (!needs_relay( odp
)) continue;
146 output( "\t.align %d\n", get_alignment(4) );
147 output( ".L__wine_spec_relay_entry_point_%d:\n", i
);
149 if (odp
->flags
& FLAG_REGISTER
)
150 output( "\tpushl %%eax\n" );
152 output( "\tpushl %%esp\n" );
154 args
= strlen(odp
->u
.func
.arg_types
);
156 if (odp
->flags
& FLAG_RET64
) flags
|= 1;
157 if (odp
->type
== TYPE_STDCALL
) flags
|= 2;
158 output( "\tpushl $%u\n", (flags
<< 24) | (args
<< 16) | (i
- spec
->base
) );
162 output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") );
163 output( "1:\tleal .L__wine_spec_relay_descr-1b(%%eax),%%eax\n" );
165 else output( "\tmovl $.L__wine_spec_relay_descr,%%eax\n" );
166 output( "\tpushl %%eax\n" );
168 if (odp
->flags
& FLAG_REGISTER
)
170 output( "\tcall *8(%%eax)\n" );
174 output( "\tcall *4(%%eax)\n" );
175 if (odp
->type
== TYPE_STDCALL
)
176 output( "\tret $%u\n", args
* get_ptr_size() );
183 /*******************************************************************
186 * Output the export table for a Win32 module.
188 static void output_exports( DLLSPEC
*spec
)
191 int nr_exports
= spec
->base
<= spec
->limit
? spec
->limit
- spec
->base
+ 1 : 0;
193 if (!nr_exports
) return;
195 output( "\n/* export table */\n\n" );
196 output( "\t.data\n" );
197 output( "\t.align %d\n", get_alignment(4) );
198 output( ".L__wine_spec_exports:\n" );
200 /* export directory header */
202 output( "\t.long 0\n" ); /* Characteristics */
203 output( "\t.long 0\n" ); /* TimeDateStamp */
204 output( "\t.long 0\n" ); /* MajorVersion/MinorVersion */
205 output( "\t.long .L__wine_spec_exp_names-.L__wine_spec_rva_base\n" ); /* Name */
206 output( "\t.long %u\n", spec
->base
); /* Base */
207 output( "\t.long %u\n", nr_exports
); /* NumberOfFunctions */
208 output( "\t.long %u\n", spec
->nb_names
); /* NumberOfNames */
209 output( "\t.long .L__wine_spec_exports_funcs-.L__wine_spec_rva_base\n" ); /* AddressOfFunctions */
212 output( "\t.long .L__wine_spec_exp_name_ptrs-.L__wine_spec_rva_base\n" ); /* AddressOfNames */
213 output( "\t.long .L__wine_spec_exp_ordinals-.L__wine_spec_rva_base\n" ); /* AddressOfNameOrdinals */
217 output( "\t.long 0\n" ); /* AddressOfNames */
218 output( "\t.long 0\n" ); /* AddressOfNameOrdinals */
221 /* output the function pointers */
223 output( "\n.L__wine_spec_exports_funcs:\n" );
224 for (i
= spec
->base
; i
<= spec
->limit
; i
++)
226 ORDDEF
*odp
= spec
->ordinals
[i
];
227 if (!odp
) output( "\t%s 0\n", get_asm_ptr_keyword() );
228 else switch(odp
->type
)
234 if (odp
->flags
& FLAG_FORWARD
)
236 output( "\t%s .L__wine_spec_forwards+%u\n", get_asm_ptr_keyword(), fwd_size
);
237 fwd_size
+= strlen(odp
->link_name
) + 1;
239 else if (odp
->flags
& FLAG_EXT_LINK
)
241 output( "\t%s %s_%s\n",
242 get_asm_ptr_keyword(), asm_name("__wine_spec_ext_link"), odp
->link_name
);
246 output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name(odp
->link_name
) );
250 output( "\t%s %s\n", get_asm_ptr_keyword(),
251 asm_name( get_stub_name( odp
, spec
)) );
260 /* output the function name pointers */
262 int namepos
= strlen(spec
->file_name
) + 1;
264 output( "\n.L__wine_spec_exp_name_ptrs:\n" );
265 for (i
= 0; i
< spec
->nb_names
; i
++)
267 output( "\t.long .L__wine_spec_exp_names+%u-.L__wine_spec_rva_base\n", namepos
);
268 namepos
+= strlen(spec
->names
[i
]->name
) + 1;
271 /* output the function ordinals */
273 output( "\n.L__wine_spec_exp_ordinals:\n" );
274 for (i
= 0; i
< spec
->nb_names
; i
++)
277 get_asm_short_keyword(), spec
->names
[i
]->ordinal
- spec
->base
);
279 if (spec
->nb_names
% 2)
281 output( "\t%s 0\n", get_asm_short_keyword() );
285 /* output the export name strings */
287 output( "\n.L__wine_spec_exp_names:\n" );
288 output( "\t%s \"%s\"\n", get_asm_string_keyword(), spec
->file_name
);
289 for (i
= 0; i
< spec
->nb_names
; i
++)
290 output( "\t%s \"%s\"\n",
291 get_asm_string_keyword(), spec
->names
[i
]->name
);
293 /* output forward strings */
297 output( "\n.L__wine_spec_forwards:\n" );
298 for (i
= spec
->base
; i
<= spec
->limit
; i
++)
300 ORDDEF
*odp
= spec
->ordinals
[i
];
301 if (odp
&& (odp
->flags
& FLAG_FORWARD
))
302 output( "\t%s \"%s\"\n", get_asm_string_keyword(), odp
->link_name
);
305 output( "\t.align %d\n", get_alignment(get_ptr_size()) );
306 output( ".L__wine_spec_exports_end:\n" );
310 /* we only support relay debugging on i386 */
311 if (target_cpu
!= CPU_x86
)
313 output( "\t%s 0\n", get_asm_ptr_keyword() );
317 output( ".L__wine_spec_relay_descr:\n" );
318 output( "\t%s 0xdeb90001\n", get_asm_ptr_keyword() ); /* magic */
319 output( "\t%s 0,0\n", get_asm_ptr_keyword() ); /* relay funcs */
320 output( "\t%s 0\n", get_asm_ptr_keyword() ); /* private data */
321 output( "\t%s __wine_spec_relay_entry_points\n", get_asm_ptr_keyword() );
322 output( "\t%s .L__wine_spec_relay_entry_point_offsets\n", get_asm_ptr_keyword() );
323 output( "\t%s .L__wine_spec_relay_arg_types\n", get_asm_ptr_keyword() );
325 output_relay_debug( spec
);
329 /*******************************************************************
332 * Output the functions for stub entry points
334 static void output_stub_funcs( DLLSPEC
*spec
)
339 for (i
= 0; i
< spec
->nb_entry_points
; i
++)
341 ORDDEF
*odp
= &spec
->entry_points
[i
];
342 if (odp
->type
!= TYPE_STUB
) continue;
343 fprintf( outfile
, "#ifdef __GNUC__\n" );
344 fprintf( outfile
, "extern void __wine_spec_unimplemented_stub( const char *module, const char *func ) __attribute__((noreturn));\n" );
345 fprintf( outfile
, "#else\n" );
346 fprintf( outfile
, "extern void __wine_spec_unimplemented_stub( const char *module, const char *func );\n" );
347 fprintf( outfile
, "#endif\n\n" );
352 for (i
= 0; i
< spec
->nb_entry_points
; i
++)
354 const ORDDEF
*odp
= &spec
->entry_points
[i
];
355 if (odp
->type
!= TYPE_STUB
) continue;
356 output( "void %s(void) ", make_internal_name( odp
, spec
, "stub" ) );
358 output( "{ __wine_spec_unimplemented_stub(__wine_spec_file_name, \"%s\"); }\n", odp
->name
);
359 else if (odp
->export_name
)
360 output( "{ __wine_spec_unimplemented_stub(__wine_spec_file_name, \"%s\"); }\n", odp
->export_name
);
362 output( "{ __wine_spec_unimplemented_stub(__wine_spec_file_name, \"%d\"); }\n", odp
->ordinal
);
367 /*******************************************************************
368 * output_asm_constructor
370 * Output code for calling a dll constructor.
372 static void output_asm_constructor( const char *constructor
)
374 if (target_platform
== PLATFORM_APPLE
)
376 /* Mach-O doesn't have an init section */
377 output( "\n\t.mod_init_func\n" );
378 output( "\t.align %d\n", get_alignment(4) );
379 output( "\t.long %s\n", asm_name(constructor
) );
383 output( "\n\t.section \".init\",\"ax\"\n" );
388 output( "\tcall %s\n", asm_name(constructor
) );
391 output( "\tcall %s\n", asm_name(constructor
) );
395 output( "\tjsr $26,%s\n", asm_name(constructor
) );
398 output( "\tbl %s\n", asm_name(constructor
) );
405 /*******************************************************************
408 * Build a Win32 C file from a spec file.
410 void BuildSpec32File( DLLSPEC
*spec
)
413 unsigned int page_size
= get_page_size();
415 resolve_imports( spec
);
416 output_standard_file_header();
418 /* Reserve some space for the PE header */
420 switch (target_platform
)
423 output( "\t.text\n" );
424 output( "\t.align %d\n", get_alignment(page_size
) );
425 output( "__wine_spec_pe_header:\n" );
426 output( "\t.space 65536\n" );
428 case PLATFORM_SOLARIS
:
429 output( "\n\t.section \".text\",\"ax\"\n" );
430 output( "__wine_spec_pe_header:\n" );
431 output( "\t.skip %u\n", 65536 + page_size
);
434 output( "\n\t.section \".init\",\"ax\"\n" );
441 output( "\tjmp 1f\n" );
444 output( "\tb 1f\n" );
447 output( "__wine_spec_pe_header:\n" );
448 output( "\t.skip %u\n", 65536 + page_size
);
453 /* Output the NT header */
455 output( "\n\t.data\n" );
456 output( "\t.align %d\n", get_alignment(get_ptr_size()) );
457 output( "%s\n", asm_globl("__wine_spec_nt_header") );
458 output( ".L__wine_spec_rva_base:\n" );
460 output( "\t.long 0x%04x\n", IMAGE_NT_SIGNATURE
); /* Signature */
463 case CPU_x86
: machine
= IMAGE_FILE_MACHINE_I386
; break;
464 case CPU_x86_64
: machine
= IMAGE_FILE_MACHINE_AMD64
; break;
465 case CPU_POWERPC
: machine
= IMAGE_FILE_MACHINE_POWERPC
; break;
466 case CPU_ALPHA
: machine
= IMAGE_FILE_MACHINE_ALPHA
; break;
467 case CPU_SPARC
: machine
= IMAGE_FILE_MACHINE_UNKNOWN
; break;
469 output( "\t%s 0x%04x\n", /* Machine */
470 get_asm_short_keyword(), machine
);
471 output( "\t%s 0\n", /* NumberOfSections */
472 get_asm_short_keyword() );
473 output( "\t.long 0\n" ); /* TimeDateStamp */
474 output( "\t.long 0\n" ); /* PointerToSymbolTable */
475 output( "\t.long 0\n" ); /* NumberOfSymbols */
476 output( "\t%s %d\n", /* SizeOfOptionalHeader */
477 get_asm_short_keyword(),
478 get_ptr_size() == 8 ? IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
: IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
);
479 output( "\t%s 0x%04x\n", /* Characteristics */
480 get_asm_short_keyword(), spec
->characteristics
);
481 output( "\t%s 0x%04x\n", /* Magic */
482 get_asm_short_keyword(),
483 get_ptr_size() == 8 ? IMAGE_NT_OPTIONAL_HDR64_MAGIC
: IMAGE_NT_OPTIONAL_HDR32_MAGIC
);
484 output( "\t.byte 0\n" ); /* MajorLinkerVersion */
485 output( "\t.byte 0\n" ); /* MinorLinkerVersion */
486 output( "\t.long 0\n" ); /* SizeOfCode */
487 output( "\t.long 0\n" ); /* SizeOfInitializedData */
488 output( "\t.long 0\n" ); /* SizeOfUninitializedData */
489 /* note: we expand the AddressOfEntryPoint field on 64-bit by overwriting the BaseOfCode field */
490 output( "\t%s %s\n", /* AddressOfEntryPoint */
491 get_asm_ptr_keyword(), asm_name(spec
->init_func
) );
492 if (get_ptr_size() == 4)
494 output( "\t.long 0\n" ); /* BaseOfCode */
495 output( "\t.long 0\n" ); /* BaseOfData */
497 output( "\t%s __wine_spec_pe_header\n", /* ImageBase */
498 get_asm_ptr_keyword() );
499 output( "\t.long %u\n", page_size
); /* SectionAlignment */
500 output( "\t.long %u\n", page_size
); /* FileAlignment */
501 output( "\t%s 1,0\n", /* Major/MinorOperatingSystemVersion */
502 get_asm_short_keyword() );
503 output( "\t%s 0,0\n", /* Major/MinorImageVersion */
504 get_asm_short_keyword() );
505 output( "\t%s %u,%u\n", /* Major/MinorSubsystemVersion */
506 get_asm_short_keyword(), spec
->subsystem_major
, spec
->subsystem_minor
);
507 output( "\t.long 0\n" ); /* Win32VersionValue */
508 output( "\t.long %s-.L__wine_spec_rva_base\n", /* SizeOfImage */
510 output( "\t.long %u\n", page_size
); /* SizeOfHeaders */
511 output( "\t.long 0\n" ); /* CheckSum */
512 output( "\t%s 0x%04x\n", /* Subsystem */
513 get_asm_short_keyword(), spec
->subsystem
);
514 output( "\t%s 0x%04x\n", /* DllCharacteristics */
515 get_asm_short_keyword(), spec
->dll_characteristics
);
516 output( "\t%s %u,%u\n", /* SizeOfStackReserve/Commit */
517 get_asm_ptr_keyword(), (spec
->stack_size
? spec
->stack_size
: 1024) * 1024, page_size
);
518 output( "\t%s %u,%u\n", /* SizeOfHeapReserve/Commit */
519 get_asm_ptr_keyword(), (spec
->heap_size
? spec
->heap_size
: 1024) * 1024, page_size
);
520 output( "\t.long 0\n" ); /* LoaderFlags */
521 output( "\t.long 16\n" ); /* NumberOfRvaAndSizes */
523 if (spec
->base
<= spec
->limit
) /* DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT] */
524 output( "\t.long .L__wine_spec_exports-.L__wine_spec_rva_base,"
525 ".L__wine_spec_exports_end-.L__wine_spec_exports\n" );
527 output( "\t.long 0,0\n" );
529 if (has_imports()) /* DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] */
530 output( "\t.long .L__wine_spec_imports-.L__wine_spec_rva_base,"
531 ".L__wine_spec_imports_end-.L__wine_spec_imports\n" );
533 output( "\t.long 0,0\n" );
535 if (spec
->nb_resources
) /* DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE] */
536 output( "\t.long .L__wine_spec_resources-.L__wine_spec_rva_base,"
537 ".L__wine_spec_resources_end-.L__wine_spec_resources\n" );
539 output( "\t.long 0,0\n" );
541 output( "\t.long 0,0\n" ); /* DataDirectory[3] */
542 output( "\t.long 0,0\n" ); /* DataDirectory[4] */
543 output( "\t.long 0,0\n" ); /* DataDirectory[5] */
544 output( "\t.long 0,0\n" ); /* DataDirectory[6] */
545 output( "\t.long 0,0\n" ); /* DataDirectory[7] */
546 output( "\t.long 0,0\n" ); /* DataDirectory[8] */
547 output( "\t.long 0,0\n" ); /* DataDirectory[9] */
548 output( "\t.long 0,0\n" ); /* DataDirectory[10] */
549 output( "\t.long 0,0\n" ); /* DataDirectory[11] */
550 output( "\t.long 0,0\n" ); /* DataDirectory[12] */
551 output( "\t.long 0,0\n" ); /* DataDirectory[13] */
552 output( "\t.long 0,0\n" ); /* DataDirectory[14] */
553 output( "\t.long 0,0\n" ); /* DataDirectory[15] */
555 output( "\n\t%s\n", get_asm_string_section() );
556 output( "%s\n", asm_globl("__wine_spec_file_name") );
557 output( ".L__wine_spec_file_name:\n" );
558 output( "\t%s \"%s\"\n", get_asm_string_keyword(), spec
->file_name
);
559 if (target_platform
== PLATFORM_APPLE
)
560 output( "\t.lcomm %s,4\n", asm_name("_end") );
562 output_stubs( spec
);
563 output_exports( spec
);
564 output_imports( spec
);
565 output_resources( spec
);
566 output_asm_constructor( "__wine_spec_init_ctor" );
567 output_gnu_stack_note();
571 /*******************************************************************
574 * Build a Win32 def file from a spec file.
576 void BuildDef32File( DLLSPEC
*spec
)
582 output( "; File generated automatically from %s; do not edit!\n\n",
585 output( "; File generated automatically; do not edit!\n\n" );
587 output( "LIBRARY %s\n\n", spec
->file_name
);
588 output( "EXPORTS\n");
590 /* Output the exports and relay entry points */
592 for (i
= total
= 0; i
< spec
->nb_entry_points
; i
++)
594 const ORDDEF
*odp
= &spec
->entry_points
[i
];
599 if (odp
->name
) name
= odp
->name
;
600 else if (odp
->export_name
) name
= odp
->export_name
;
603 if (!(odp
->flags
& FLAG_PRIVATE
)) total
++;
608 output( " %s", name
);
610 if(strcmp(name
, odp
->link_name
) || (odp
->flags
& FLAG_FORWARD
))
611 output( "=%s", odp
->link_name
);
615 /* try to reduce output */
616 output( " %s", name
);
617 if(strcmp(name
, odp
->link_name
) || (odp
->flags
& FLAG_FORWARD
))
618 output( "=%s", odp
->link_name
);
622 int at_param
= strlen(odp
->u
.func
.arg_types
) * get_ptr_size();
623 output( " %s", name
);
624 if (!kill_at
) output( "@%d", at_param
);
625 if (odp
->flags
& FLAG_FORWARD
)
627 output( "=%s", odp
->link_name
);
629 else if (strcmp(name
, odp
->link_name
)) /* try to reduce output */
631 output( "=%s", odp
->link_name
);
632 if (!kill_at
) output( "@%d", at_param
);
638 int at_param
= strlen(odp
->u
.func
.arg_types
) * get_ptr_size();
640 if (!kill_at
) output( "@" );
641 output( "%s", name
);
642 if (!kill_at
) output( "@%d", at_param
);
643 if (odp
->flags
& FLAG_FORWARD
)
646 if (!kill_at
) output( "@" );
647 output( "%s", odp
->link_name
);
649 else if (strcmp(name
, odp
->link_name
)) /* try to reduce output */
652 if (!kill_at
) output( "@" );
653 output( "%s", odp
->link_name
);
654 if (!kill_at
) output( "@%d", at_param
);
660 output( " %s", name
);
663 const char *check
= name
+ strlen(name
);
664 while (name
!= check
&&
665 '0' <= check
[-1] && check
[-1] <= '9')
669 if (name
!= check
&& check
!= name
+ strlen(name
) &&
672 output("%s", check
- 1);
675 if (odp
->name
|| odp
->export_name
)
677 output("=%s", make_internal_name( odp
, spec
, "stub" ));
684 output( " @%d", odp
->ordinal
);
685 if (!odp
->name
|| (odp
->flags
& FLAG_ORDINAL
)) output( " NONAME" );
686 if (is_data
) output( " DATA" );
687 if (odp
->flags
& FLAG_PRIVATE
) output( " PRIVATE" );
690 if (!total
) warning( "%s: Import library doesn't export anything\n", spec
->file_name
);
694 /*******************************************************************
697 * Build a PE DLL C file from a spec file.
699 void BuildPedllFile( DLLSPEC
*spec
)
701 int i
, has_stubs
= 0;
703 output_standard_file_header();
705 for (i
= 0; i
< spec
->nb_entry_points
; i
++)
707 const ORDDEF
*odp
= &spec
->entry_points
[i
];
708 if (odp
->type
== TYPE_STUB
)
717 output( "/* This file is intentionally left blank */\n");
721 output( "#include <stdarg.h>\n");
722 output( "#include \"windef.h\"\n");
723 output( "#include \"winbase.h\"\n");
724 output( "#include \"wine/config.h\"\n");
725 output( "#include \"wine/exception.h\"\n\n");
727 output( "void __wine_spec_unimplemented_stub( const char *module, const char *function )\n");
729 output( " ULONG_PTR args[2];\n");
731 output( " args[0] = (ULONG_PTR)module;\n");
732 output( " args[1] = (ULONG_PTR)function;\n");
733 output( " RaiseException( EXCEPTION_WINE_STUB, EH_NONCONTINUABLE, 2, args );\n");
736 output( "static const char __wine_spec_file_name[] = \"%s\";\n\n", spec
->file_name
);
738 /* Output the stub functions */
739 output_stub_funcs( spec
);