diff --git a/dlls/gdi/Makefile.in b/dlls/gdi/Makefile.in index 5d1e68b7114..93a92a75d0d 100644 --- a/dlls/gdi/Makefile.in +++ b/dlls/gdi/Makefile.in @@ -84,7 +84,7 @@ EXTRASUBDIRS = \ # Special rules for 16-bit resource and spec files gdi.exe.spec.c: gdi.exe.spec version16.res - $(LDPATH) $(WINEBUILD) $(DEFS) -H 65520 -o $@ -M $(MODULE) -spec $(SRCDIR)/gdi.exe.spec + $(LDPATH) $(WINEBUILD) $(DEFS) -H 65520 -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/gdi.exe.spec version16.res: version16.rc $(LDPATH) $(WRC) $(DIVINCL) -o $@ -w16 -m -r $(SRCDIR)/version16.rc diff --git a/dlls/gdi/gdi.exe.spec b/dlls/gdi/gdi.exe.spec index a4628c2db5b..f15d836b6d8 100644 --- a/dlls/gdi/gdi.exe.spec +++ b/dlls/gdi/gdi.exe.spec @@ -1,5 +1,3 @@ -rsrc version16.res - 1 pascal SetBkColor(word long) SetBkColor16 2 pascal16 SetBkMode(word word) SetBkMode16 3 pascal16 SetMapMode(word word) SetMapMode16 diff --git a/dlls/kernel/Makefile.in b/dlls/kernel/Makefile.in index e979141aff5..53c1455244c 100644 --- a/dlls/kernel/Makefile.in +++ b/dlls/kernel/Makefile.in @@ -52,8 +52,8 @@ kernel.res: $(MC_SRCS:.mc=.mc.rc) # Special rules for 16-bit resource and spec files -krnl386.exe.spec.c: krnl386.exe.spec version16.res $(WINEBUILD) - $(LDPATH) $(WINEBUILD) $(DEFS) -N kernel -o $@ -M $(MODULE) --spec $(SRCDIR)/krnl386.exe.spec +krnl386.exe.spec.c: krnl386.exe.spec version16.res + $(LDPATH) $(WINEBUILD) $(DEFS) -N kernel -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/krnl386.exe.spec version16.res: version16.rc $(LDPATH) $(WRC) $(DIVINCL) -o $@ -w16 -m -r $(SRCDIR)/version16.rc diff --git a/dlls/kernel/krnl386.exe.spec b/dlls/kernel/krnl386.exe.spec index c90fd949394..0b58a0c39f6 100644 --- a/dlls/kernel/krnl386.exe.spec +++ b/dlls/kernel/krnl386.exe.spec @@ -1,5 +1,3 @@ -rsrc version16.res - # 1-207 are the basic functions, those are (with minor variations) # present in win31, win95 and nt351 diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in index 286b03646f9..826c21a7cef 100644 --- a/dlls/shell32/Makefile.in +++ b/dlls/shell32/Makefile.in @@ -67,6 +67,7 @@ uninstall:: version16.res: version16.rc $(LDPATH) $(WRC) $(DIVINCL) -o $@ -w16 -m -r $(SRCDIR)/version16.rc -shell.spec.c: version16.res +shell.spec.c: shell.spec version16.res + $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/shell.spec ### Dependencies: diff --git a/dlls/shell32/shell.spec b/dlls/shell32/shell.spec index e2b0e54c0bd..6c53356700a 100644 --- a/dlls/shell32/shell.spec +++ b/dlls/shell32/shell.spec @@ -1,5 +1,3 @@ -rsrc version16.res - 1 pascal RegOpenKey(long str ptr) RegOpenKey16 2 pascal RegCreateKey(long str ptr) RegCreateKey16 3 pascal RegCloseKey(long) RegCloseKey16 diff --git a/dlls/user/Makefile.in b/dlls/user/Makefile.in index eb0f4e878c6..d03aa369555 100644 --- a/dlls/user/Makefile.in +++ b/dlls/user/Makefile.in @@ -105,7 +105,13 @@ EXTRASUBDIRS = \ # Special rules for 16-bit resource and spec files user.exe.spec.c: user.exe.spec resources/version16.res - $(LDPATH) $(WINEBUILD) $(DEFS) -H 65520 -o $@ -M $(MODULE) --spec $(SRCDIR)/user.exe.spec + $(LDPATH) $(WINEBUILD) $(DEFS) -H 65520 -o $@ -M $(MODULE) -r resources/version16.res --spec $(SRCDIR)/user.exe.spec + +display.spec.c: display.spec resources/display.res + $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r resources/display.res --spec $(SRCDIR)/display.spec + +mouse.spec.c: mouse.spec resources/mouse.res + $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r resources/mouse.res --spec $(SRCDIR)/mouse.spec resources/display.res: resources/display.rc $(LDPATH) $(WRC) $(DIVINCL) -o $@ -w16 -m -r $(SRCDIR)/resources/display.rc @@ -116,8 +122,4 @@ resources/mouse.res: resources/mouse.rc resources/version16.res: resources/version16.rc $(LDPATH) $(WRC) $(DIVINCL) -o $@ -w16 -m -r $(SRCDIR)/resources/version16.rc -display.spec.c: resources/display.res - -mouse.spec.c: resources/mouse.res - ### Dependencies: diff --git a/dlls/user/display.spec b/dlls/user/display.spec index 9e0f926352d..4e8792a2583 100644 --- a/dlls/user/display.spec +++ b/dlls/user/display.spec @@ -1,5 +1,3 @@ -rsrc resources/display.res - 1 stub BitBlt 2 stub ColorInfo 3 stub Control diff --git a/dlls/user/mouse.spec b/dlls/user/mouse.spec index c028a7a053e..9c4997948f8 100644 --- a/dlls/user/mouse.spec +++ b/dlls/user/mouse.spec @@ -1,5 +1,3 @@ -rsrc resources/mouse.res - 1 pascal16 Inquire(ptr) MOUSE_Inquire 2 pascal16 Enable(segptr) MOUSE_Enable 3 pascal16 Disable() MOUSE_Disable diff --git a/dlls/user/user.exe.spec b/dlls/user/user.exe.spec index bf533e5344e..4c57d2cee13 100644 --- a/dlls/user/user.exe.spec +++ b/dlls/user/user.exe.spec @@ -1,5 +1,3 @@ -rsrc resources/version16.res - 1 pascal16 MessageBox(word str str word) MessageBox16 2 stub OldExitWindows 3 stub EnableOEMLayer diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index ab52cec48bc..d7785f16f19 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -166,7 +166,7 @@ extern void BuildSpec16File( FILE *outfile ); extern void BuildSpec32File( FILE *outfile ); extern void BuildDef32File( FILE *outfile ); extern void BuildDebugFile( FILE *outfile, const char *srcdir, char **argv ); -extern SPEC_TYPE ParseTopLevel( FILE *file, int def_only ); +extern void ParseTopLevel( FILE *file ); /* global variables */ @@ -196,5 +196,6 @@ extern ORDDEF *EntryPoints[MAX_ORDINALS]; extern ORDDEF *Ordinals[MAX_ORDINALS]; extern ORDDEF *Names[MAX_ORDINALS]; extern SPEC_MODE SpecMode; +extern SPEC_TYPE SpecType; #endif /* __WINE_BUILD_H */ diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c index e5733632335..9dcd7df73f7 100644 --- a/tools/winebuild/main.c +++ b/tools/winebuild/main.c @@ -38,6 +38,8 @@ ORDDEF *Ordinals[MAX_ORDINALS]; ORDDEF *Names[MAX_ORDINALS]; SPEC_MODE SpecMode = SPEC_MODE_DLL; +SPEC_TYPE SpecType = SPEC_WIN32; + int Base = MAX_ORDINALS; int Limit = 0; int DLLHeapSize = 0; @@ -69,6 +71,8 @@ const char *output_file_name = NULL; static FILE *input_file; static FILE *output_file; static const char *current_src_dir; +static int nb_res_files; +static char **res_files; /* execution mode */ static enum @@ -285,6 +289,7 @@ static void do_exe_mode( const char *arg ) static void do_module( const char *arg ) { strcpy( owner_name, arg ); + SpecType = SPEC_WIN16; } static void do_glue(void) @@ -334,7 +339,8 @@ static void do_dimport( const char *arg ) static void do_rsrc( const char *arg ) { - load_res32_file( arg ); + res_files = xrealloc( res_files, (nb_res_files+1) * sizeof(*res_files) ); + res_files[nb_res_files++] = xstrdup( arg ); } /* parse options from the argv array and remove all the recognized ones */ @@ -387,6 +393,22 @@ static void parse_options( char *argv[] ) } +/* load all specified resource files */ +static void load_resources(void) +{ + int i; + + switch (SpecType) + { + case SPEC_WIN16: + for (i = 0; i < nb_res_files; i++) load_res16_file( res_files[i] ); + break; + case SPEC_WIN32: + for (i = 0; i < nb_res_files; i++) load_res32_file( res_files[i] ); + break; + } +} + /******************************************************************* * main */ @@ -398,7 +420,9 @@ int main(int argc, char **argv) switch(exec_mode) { case MODE_SPEC: - switch (ParseTopLevel( input_file, 0 )) + load_resources(); + ParseTopLevel( input_file ); + switch (SpecType) { case SPEC_WIN16: if (argv[1]) @@ -413,21 +437,17 @@ int main(int argc, char **argv) } break; case MODE_EXE: + if (SpecType == SPEC_WIN16) fatal_error( "Cannot build 16-bit exe files\n" ); + load_resources(); read_undef_symbols( argv + 1 ); BuildSpec32File( output_file ); break; case MODE_DEF: if (argv[1]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[1] ); - switch (ParseTopLevel( input_file, 1 )) - { - case SPEC_WIN16: - fatal_error( "Cannot yet build .def file for 16-bit dlls\n" ); - break; - case SPEC_WIN32: - BuildDef32File( output_file ); - break; - default: assert(0); - } + if (SpecType == SPEC_WIN16) fatal_error( "Cannot yet build .def file for 16-bit dlls\n" ); + load_resources(); + ParseTopLevel( input_file ); + BuildDef32File( output_file ); break; case MODE_DEBUG: BuildDebugFile( output_file, current_src_dir, argv + 1 ); diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c index 325f37c891f..44690dfcdd1 100644 --- a/tools/winebuild/parser.c +++ b/tools/winebuild/parser.c @@ -36,8 +36,6 @@ int current_line = 0; -static SPEC_TYPE SpecType = SPEC_WIN32; - static char ParseBuffer[512]; static char TokenBuffer[512]; static char *ParseNext = ParseBuffer; @@ -494,26 +492,16 @@ static void sort_names(void) * * Parse a spec file. */ -SPEC_TYPE ParseTopLevel( FILE *file, int def_only ) +void ParseTopLevel( FILE *file ) { const char *token; input_file = file; current_line = 0; - if (owner_name[0]) SpecType = SPEC_WIN16; while ((token = GetToken(1)) != NULL) { - if (strcmp(token, "rsrc") == 0) - { - if (!def_only) - { - if (SpecType != SPEC_WIN16) load_res32_file( GetToken(0) ); - else load_res16_file( GetToken(0) ); - } - else GetToken(0); /* skip it */ - } - else if (strcmp(token, "ignore") == 0) + if (strcmp(token, "ignore") == 0) { if (SpecType != SPEC_WIN32) fatal_error( "'ignore' only supported for Win32 spec files\n" ); @@ -533,12 +521,8 @@ SPEC_TYPE ParseTopLevel( FILE *file, int def_only ) fatal_error( "Expected ordinal declaration\n" ); } - if (SpecType == SPEC_WIN16 && !owner_name[0]) - fatal_error( "'owner' not specified for Win16 dll\n" ); - current_line = 0; /* no longer parsing the input file */ sort_names(); - return SpecType; } diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in index af7a03a3a36..bebf686a791 100644 --- a/tools/winebuild/winebuild.man.in +++ b/tools/winebuild/winebuild.man.in @@ -167,8 +167,6 @@ Turn on warnings. A spec file should contain a number of optional directives, and then a list of ordinal declarations. The general syntax is the following: .PP -.RB [ rsrc\ \fIresfile\fR] -.br .RB [ ignore\ (\ [ \fIsymbols...\fR ]\ )\ ] .br .BI #\ comments @@ -191,9 +189,6 @@ list of ordinal declarations. The general syntax is the following: .IB ordinal\ forward .RI [ flags ]\ exportname\ forwardname .SS "Optional directives" -.B rsrc -specifies the path of the compiled resource file. -.PP .B ignore specifies a list of symbols that should be ignored when resolving undefined symbols against the imported libraries.