Commit 21ec006f authored by Alexandre Julliard's avatar Alexandre Julliard

Build Win32 resources as .res files and dump them into the .spec.c file.

parent 003e24ca
......@@ -16,7 +16,6 @@
# GLUE : C sources for which glue code needs to be generated
# EXTRA_SRCS : extra source files for make depend
# EXTRA_OBJS : extra object files
# WRCEXTRA : extra wrc flags (e.g. '-p _SysRes')
# SUBDIRS : subdirectories that contain a Makefile
# EXTRASUBDIRS : subdirectories that do not contain a Makefile
......@@ -55,10 +54,9 @@ LINT = @LINT@
LINTFLAGS = @LINTFLAGS@
ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
BUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
WINEBUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
MAKEDEP = $(TOPOBJDIR)/tools/makedep
WRC = $(TOPOBJDIR)/tools/wrc/wrc
WRCFLAGS = -c -s -p $*
WMC = $(TOPOBJDIR)/tools/wmc/wmc
DLLDIR = $(TOPOBJDIR)/dlls
@SET_MAKE@
......@@ -81,7 +79,7 @@ CLEAN_FILES = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
*.flc *.spec.c *.glue.c y.tab.c y.tab.h lex.yy.c core
OBJS = $(SPEC_SRCS:.spec=.spec.o) $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
$(ASM_SRCS:.S=.o) $(RC_SRCS:.rc=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
$(ASM_SRCS:.S=.o) $(RC16_SRCS:.rc16=.o) $(GLUE:.c=.glue.o) $(EXTRA_OBJS)
LINTS = $(C_SRCS:.c=.ln)
......@@ -156,7 +154,7 @@ DLLS = \
# Implicit rules
.SUFFIXES: .mc .rc .res .spec .spec.c .spec.o .glue.c
.SUFFIXES: .mc .rc .rc16 .res .spec .spec.c .spec.o .glue.c
.c.o:
$(CC) -c $(ALLCFLAGS) -o $*.o $<
......@@ -173,26 +171,17 @@ DLLS = \
.mc.rc:
LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WMC) -i -H /dev/null -o $@ $<
.rc.s:
$(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) $<
.rc.h:
$(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -nh $<
.rc16.s:
LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 -m -c -p `basename $*` -s $<
.rc.res:
$(WRC) $(WRCFLAGS) $(WRCEXTRA) $(DIVINCL) -r $<
.res.s:
$(WRC) $(WRCFLAGS) $(WRCEXTRA) -b $<
.res.h:
$(WRC) $(WRCFLAGS) $(WRCEXTRA) -bnh $<
LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
.spec.spec.c:
$(BUILD) @DLLFLAGS@ -o $@ -spec $<
LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WINEBUILD) @DLLFLAGS@ -o $@ -spec $<
.c.glue.c:
$(BUILD) @DLLFLAGS@ -o $@ -glue $<
LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WINEBUILD) @DLLFLAGS@ -o $@ -glue $<
.c.ln:
$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
......@@ -205,24 +194,28 @@ all: Makefile
# Rule to rebuild the resource compiler
$(WRC) check_wrc:
$(WRC):
cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc
# Rule to rebuild the message compiler
$(WMC) check_wmc:
$(WMC):
cd $(TOPOBJDIR)/tools/wmc && $(MAKE) wmc
# Rule to rebuild the 'makedep' program
$(MAKEDEP) check_makedep:
$(MAKEDEP):
cd $(TOPOBJDIR)/tools && $(MAKE) makedep
# Rule to rebuild the 'winebuild' program
$(BUILD) check_winebuild:
$(WINEBUILD):
cd $(TOPOBJDIR)/tools/winebuild && $(MAKE) winebuild
# Rule for main module spec file
$(MODULE).spec.c: $(RC_SRCS:.rc=.res)
# Rules for makefile
Makefile: Makefile.in $(TOPSRCDIR)/configure
......@@ -260,8 +253,8 @@ winapi_check::
$(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
cd `dirname $@` && $(MAKE) depend
depend: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
$(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(EXTRA_SRCS) -C. $(GEN_C_SRCS)
depend: $(MAKEDEP) $(C_SRCS) $(RC_SRCS) $(RC16_SRCS) $(EXTRA_SRCS) $(GEN_C_SRCS) $(SUBDIRS:%=%/__depend__)
$(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(RC_SRCS) $(RC16_SRCS) $(EXTRA_SRCS) -C. $(GEN_C_SRCS)
# Rules for cleaning
......@@ -272,7 +265,7 @@ $(EXTRASUBDIRS:%=%/__clean__): dummy
-cd `dirname $@` && $(RM) $(CLEAN_FILES)
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.s) $(RC_SRCS:.rc=.h) $(MC_SRCS:.mc=.rc) $(PROGRAMS)
$(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC16_SRCS:.rc16=.s) $(MC_SRCS:.mc=.rc) $(PROGRAMS)
# Rules for installing
......@@ -284,11 +277,11 @@ $(SUBDIRS:%=%/__uninstall__): dummy
# Misc. rules
$(SPEC_SRCS:.spec=.spec.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h
$(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD) $(TOPSRCDIR)/include/builtin16.h
$(GLUE:.c=.glue.c): $(BUILD) $(TOPSRCDIR)/include/builtin16.h
$(GLUE:.c=.glue.c): $(WINEBUILD) $(TOPSRCDIR)/include/builtin16.h
$(RC_SRCS:.rc=.s): $(WRC)
$(RC_SRCS:.rc=.res) $(RC16_SRCS:.rc16=.s): $(WRC)
$(MC_SRCS:.mc=.rc): $(WMC)
......
......@@ -2,4 +2,4 @@
*.spec.glue.s
Makefile
libcomctl32.so.1.0
rsrc.s
rsrc.res
......@@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = comctl32
SOVERSION = 1.0
WRCEXTRA = -s -p$(MODULE)
IMPORTS = user32 gdi32 advapi32 kernel32
C_SRCS = \
......@@ -40,6 +39,4 @@ RC_SRCS= \
@MAKE_DLL_RULES@
all: check_wrc
### Dependencies:
name comctl32
type win32
init COMCTL32_LibMain
rsrc comctl32
rsrc rsrc.res
import user32.dll
import gdi32.dll
......
......@@ -2,4 +2,4 @@
*.spec.glue.s
Makefile
libcomdlg32.so.1.0
rsrc.s
rsrc.res
......@@ -6,7 +6,6 @@ MODULE = comdlg32
SOVERSION = 1.0
ALTNAMES = commdlg
IMPORTS = shell32 shlwapi comctl32 user32 winspool.drv gdi32 kernel32
WRCEXTRA = -s -pcomdlg32
C_SRCS = \
cdlg32.c \
......@@ -26,6 +25,4 @@ RC_SRCS= \
@MAKE_DLL_RULES@
all: check_wrc
### Dependencies:
name comdlg32
type win32
init COMDLG32_DllEntryPoint
rsrc comdlg32
rsrc rsrc.res
import shell32.dll
import shlwapi.dll
......
*.spec.c
Makefile
kernel.s
kernel.res
libkernel32.so.1.0
utthunk.glue.c
......@@ -34,6 +34,6 @@ EXTRASUBDIRS = \
@MAKE_DLL_RULES@
depend $(RC_SRCS:.rc=.s): $(MC_SRCS:.mc=.rc)
depend $(RC_SRCS:.rc=.res): $(MC_SRCS:.mc=.rc)
### Dependencies:
name kernel32
type win32
init MAIN_KernelInit
rsrc kernel
rsrc kernel.res
import ntdll.dll
......
......@@ -3,4 +3,4 @@
Makefile
libmsacm.so.1.0
libmsacm32.so.1.0
msacm.s
msacm.res
name msacm32
type win32
init MSACM32_LibMain
rsrc msacm
rsrc msacm.res
import winmm.dll
import user32.dll
......
Makefile
libserialui.so.1.0
serialui.spec.c
serialui_rc.s
serialui_rc.res
name serialui
type win32
init SERIALUI_LibMain
rsrc serialui_rc
rsrc serialui_rc.res
import user32.dll
import advapi32.dll
......
......@@ -2,4 +2,4 @@
*.spec.glue.s
Makefile
libshell32.so.1.0
shres.s
shres.res
......@@ -42,7 +42,5 @@ RC_SRCS= \
@MAKE_DLL_RULES@
all: check_wrc
### Dependencies:
name shell32
type win32
init Shell32LibMain
rsrc shres
rsrc shres.res
# fixme: avoid this import
import ole32.dll
......
......@@ -4,7 +4,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = user32
SOVERSION = 1.0
WRCEXTRA = -w16 -m
ALTNAMES = user keyboard ddeml display mouse
IMPORTS = gdi32 advapi32 kernel32
......@@ -23,26 +22,28 @@ C_SRCS = \
thunk.c \
user_main.c
RC_SRCS = \
disp.rc \
mouserc.rc
RC16_SRCS = \
resources/display.rc16 \
resources/mouse.rc16
RC_SRCS = resources/user32.rc
GLUE = thunk.c
EXTRA_OBJS = \
$(TOPOBJDIR)/controls/controls.o \
$(TOPOBJDIR)/resources/resources.o \
$(TOPOBJDIR)/windows/windows.o
SUBDIRS = \
$(TOPOBJDIR)/controls \
$(TOPOBJDIR)/resources \
$(TOPOBJDIR)/windows
EXTRASUBDIRS = \
resources
@MAKE_DLL_RULES@
$(EXTRA_OBJS): $(TOOLSUBDIRS) dummy
@cd `dirname $@` && $(MAKE) `basename $@`
### Dependencies:
name display
type win16
owner user32
rsrc disp
rsrc display
1 stub BitBlt
2 stub ColorInfo
......
name mouse
type win16
owner user32
rsrc mouserc
rsrc mouse
1 pascal16 Inquire(ptr) MOUSE_Inquire
2 pascal16 Enable(segptr) WIN16_MOUSE_Enable
......
display.s
mouse.s
user32.res
name user32
type win32
init USER_Init
rsrc user32
rsrc resources/user32.res
import gdi32.dll
import advapi32.dll
......
Makefile
libwineps.so.1.0
rsrc.s
rsrc.res
wineps.spec.c
wineps16.spec.c
......@@ -5,7 +5,6 @@ VPATH = @srcdir@
MODULE = wineps
SOVERSION = 1.0
ALTNAMES = wineps16
WRCEXTRA = -s -pwineps
IMPORTS = user32 gdi32 kernel32
C_SRCS = \
......
name wineps
type win32
init PSDRV_Init
rsrc wineps
rsrc rsrc.res
import user32.dll
import gdi32.dll
......
......@@ -3,4 +3,4 @@
*.spec.glue.s
Makefile
libwinmm.so.1.0
winmm_res.s
winmm_res.res
......@@ -36,6 +36,4 @@ SUBDIRS = \
@MAKE_DLL_RULES@
all: check_wrc
### Dependencies:
name winmm
type win32
init WINMM_LibMain
rsrc winmm_res
rsrc winmm_res.res
import user32.dll
import kernel32.dll
......
......@@ -23,7 +23,7 @@ all: $(MODULE).o
$(MODULE).o: $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
$(LDCOMBINE) $(OBJS) -o $@
asmrelay.s: $(BUILD)
$(BUILD) @DLLFLAGS@ -o $@ -relay
asmrelay.s: $(WINEBUILD)
LD_LIBRARY_PATH="$(TOPOBJDIR):$$LD_LIBRARY_PATH" $(WINEBUILD) @DLLFLAGS@ -o $@ -relay
### Dependencies:
......@@ -7,7 +7,7 @@ hello2
hello2.spec.c
hello3
hello3.spec.c
hello3res.s
hello3res.res
hello4
hello4.spec.c
hello5
......
......@@ -21,7 +21,7 @@ SPEC_SRCS = \
RC_SRCS = \
hello3res.rc
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
@MAKE_RULES@
......@@ -34,9 +34,11 @@ hello: hello.o hello.spec.o
hello2: hello2.o hello2.spec.o
$(CC) -o hello2 $+ -L$(DLLDIR) -lgdi32 -lkernel32 -luser32 $(DLL_LINK) $(LIBS)
hello3: hello3.o hello3.spec.o hello3res.o
hello3: hello3.o hello3.spec.o
$(CC) -o hello3 $+ -L$(DLLDIR) -ladvapi32 -lcomctl32 -lcomdlg32 -lgdi32 -lkernel32 -lole32 -lrpcrt4 -lshell32 -lshlwapi -luser32 -lwinspool.drv $(DLL_LINK) $(LIBS)
hello3.spec.c: hello3res.res
hello4: hello4.o hello4.spec.o
$(CC) -o hello4 $+ -L$(DLLDIR) -lgdi32 -lkernel32 -luser32 $(DLL_LINK) $(LIBS)
......
......@@ -2,4 +2,4 @@ name hello3
mode guiexe
type win32
init WinMain
rsrc hello3res
rsrc hello3res.res
......@@ -12,7 +12,7 @@ SPEC_SRCS = \
aviinfo.spec \
aviplay.spec
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
@MAKE_RULES@
......
Makefile
clock
clock.spec.c
rsrc.s
rsrc.res
......@@ -6,7 +6,6 @@ VPATH = @srcdir@
MODULE = none
PROGRAMS = clock
IMPORTS = advapi32 comctl32 shlwapi shell32 comdlg32 ole32 rpcrt4 winspool.drv user32 gdi32 kernel32
WRCEXTRA = -s -p clock
LICENSELANG = En
......@@ -21,14 +20,15 @@ SPEC_SRCS = clock.spec
RC_SRCS = rsrc.rc
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
@MAKE_RULES@
clock: $(OBJS)
$(CC) -o clock $(OBJS) $(DLL_LINK) $(LIBS)
$(SPEC_SRCS:.spec=.spec.c): $(RC_SRCS:.rc=.res)
install::
$(INSTALL_PROGRAM) clock $(bindir)/clock
......
......@@ -2,4 +2,4 @@ name clock
mode guiexe
type win32
init WinMain
rsrc clock
rsrc rsrc.res
Makefile
cmdlgr.s
cmdlgr.res
cmdlgtst
cmdlgtst.spec.c
......@@ -6,7 +6,6 @@ VPATH = @srcdir@
MODULE = none
PROGRAMS = cmdlgtst
IMPORTS = advapi32 comctl32 comdlg32 shell32 shlwapi ole32 rpcrt4 winspool.drv user32 gdi32 kernel32
WRCEXTRA = -s -p cmdlgtst
C_SRCS = \
cmdlgtst.c
......@@ -17,13 +16,15 @@ SPEC_SRCS = \
RC_SRCS = \
cmdlgr.rc
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
@MAKE_RULES@
cmdlgtst: $(OBJS)
$(CC) -o cmdlgtst $(OBJS) $(DLL_LINK) $(LIBS)
$(SPEC_SRCS:.spec=.spec.c): $(RC_SRCS:.rc=.res)
install::
$(INSTALL_PROGRAM) cmdlgtst $(bindir)/cmdlgtst
......
......@@ -2,5 +2,5 @@ name cmdlgtst
mode guiexe
type win32
init WinMain
rsrc cmdlgtst
rsrc cmdlgr.res
import comdlg32.dll
Makefile
notepad
notepad.spec.c
rsrc.s
rsrc.res
......@@ -6,7 +6,6 @@ VPATH = @srcdir@
MODULE = none
PROGRAMS = notepad
IMPORTS = advapi32 comctl32 shlwapi shell32 ole32 rpcrt4 comdlg32 winspool.drv user32 gdi32 kernel32
WRCEXTRA = -s -p notepad
LICENSELANG = En
......@@ -22,13 +21,15 @@ SPEC_SRCS = notepad.spec
RC_SRCS = rsrc.rc
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
@MAKE_RULES@
notepad: $(OBJS)
$(CC) -o notepad $(OBJS) $(DLL_LINK) $(LIBS)
$(SPEC_SRCS:.spec=.spec.c): $(RC_SRCS:.rc=.res)
install::
$(INSTALL_PROGRAM) notepad $(bindir)/notepad
......
......@@ -2,5 +2,5 @@ name notepad
mode guiexe
type win32
init WinMain
rsrc notepad
rsrc rsrc.res
import comdlg32.dll
Makefile
progman
progman.spec.c
rsrc.s
rsrc.res
......@@ -6,7 +6,6 @@ VPATH = @srcdir@
MODULE = none
PROGRAMS = progman
IMPORTS = shlwapi shell32 comdlg32 ole32 rpcrt4 winspool.drv user32 gdi32 kernel32
WRCEXTRA = -s -p progman
LICENSELANG = En
......@@ -24,13 +23,15 @@ SPEC_SRCS = progman.spec
RC_SRCS = rsrc.rc
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
@MAKE_RULES@
progman: $(OBJS)
$(CC) -o progman $(OBJS) $(DLL_LINK) $(LIBS)
$(SPEC_SRCS:.spec=.spec.c): $(RC_SRCS:.rc=.res)
install::
$(INSTALL_PROGRAM) progman $(bindir)/progman
......
......@@ -2,5 +2,5 @@ name progman
mode guiexe
type win32
init WinMain
rsrc progman
rsrc rsrc.res
import comdlg32.dll
Makefile
rsrc.s
rsrc.res
uninstaller
uninstaller.spec.c
......@@ -5,7 +5,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = uninstaller
WRCEXTRA = -s -p uninstaller
IMPORTS = user32 gdi32 kernel32
LICENSELANG = En
......@@ -17,13 +16,15 @@ SPEC_SRCS = uninstaller.spec
RC_SRCS = rsrc.rc
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
@MAKE_RULES@
uninstaller: $(OBJS)
$(CC) -o uninstaller $(OBJS) $(DLL_LINK) $(LIBS)
$(SPEC_SRCS:.spec=.spec.c): $(RC_SRCS:.rc=.res)
install::
$(INSTALL_PROGRAM) uninstaller $(bindir)/uninstaller
......
......@@ -2,4 +2,4 @@ name uninstaller
mode guiexe
type win32
init WinMain
rsrc uninstaller
rsrc rsrc.res
Makefile
view
view.spec.c
viewrc.s
viewrc.res
......@@ -6,7 +6,6 @@ VPATH = @srcdir@
MODULE = none
PROGRAMS = view
IMPORTS = advapi32 comctl32 comdlg32 shell32 shlwapi ole32 rpcrt4 winspool.drv user32 gdi32 kernel32
WRCEXTRA = -s -p view
C_SRCS = \
init.c \
......@@ -19,13 +18,15 @@ SPEC_SRCS = \
RC_SRCS = \
viewrc.rc
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
@MAKE_RULES@
view: $(OBJS)
$(CC) -o view $(OBJS) $(DLL_LINK) $(LIBS)
$(SPEC_SRCS:.spec=.spec.c): $(RC_SRCS:.rc=.res)
install::
$(INSTALL_PROGRAM) view $(bindir)/view
......
......@@ -2,4 +2,4 @@ name view
mode guiexe
type win32
init WinMain
rsrc view
rsrc viewrc.res
Makefile
wcmd
wcmd.spec.c
wcmdrc.s
wcmdrc.res
......@@ -6,7 +6,6 @@ VPATH = @srcdir@
MODULE = none
PROGRAMS = wcmd
IMPORTS = user32 gdi32 kernel32
WRCEXTRA = -s -p wcmd
C_SRCS = \
batch.c \
......@@ -20,10 +19,12 @@ SPEC_SRCS = \
RC_SRCS = \
wcmdrc.rc
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
@MAKE_RULES@
$(SPEC_SRCS:.spec=.spec.c): $(RC_SRCS:.rc=.res)
wcmd: $(OBJS)
$(CC) -o wcmd $(OBJS) $(DLL_LINK) $(LIBS)
......
name wcmd
mode cuiexe
type win32
rsrc wcmd
init wine_main
rsrc wcmdrc.res
Makefile
rsrc.s
rsrc.res
winemine
winemine.spec.c
......@@ -5,7 +5,6 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
PROGRAMS = winemine
WRCEXTRA = -s -p winemine
IMPORTS = user32 gdi32 kernel32
LICENSELANG = En
......@@ -14,18 +13,19 @@ C_SRCS = \
main.c \
dialog.c
SPEC_SRCS = winemine.spec
RC_SRCS = rsrc.rc
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
@MAKE_RULES@
winemine: $(OBJS)
$(CC) -o winemine $(OBJS) $(DLL_LINK) $(LIBS)
$(SPEC_SRCS:.spec=.spec.c): $(RC_SRCS:.rc=.res)
install::
$(INSTALL_PROGRAM) winemine $(bindir)/winemine
......
......@@ -2,4 +2,4 @@ name winemine
mode guiexe
type win32
init WinMain
rsrc winemine
rsrc rsrc.res
Makefile
hlp2sgml
lex.yy.c
rsrc.s
rsrc.res
winhelp
winhelp.spec.c
y.tab.c
......
......@@ -6,7 +6,6 @@ VPATH = @srcdir@
MODULE = none
PROGRAMS = winhelp hlp2sgml
IMPORTS = advapi32 comctl32 shlwapi shell32 ole32 rpcrt4 comdlg32 winspool.drv user32 gdi32 kernel32
WRCEXTRA = -s -p winhelp
C_SRCS = \
winhelp.c \
......@@ -21,12 +20,14 @@ EXTRA_OBJS = y.tab.o lex.yy.o
RC_SRCS = rsrc.rc
all: check_wrc $(PROGRAMS)
all: $(PROGRAMS)
depend: y.tab.h
@MAKE_RULES@
$(SPEC_SRCS:.spec=.spec.c): $(RC_SRCS:.rc=.res)
winhelp: $(OBJS)
$(CC) -o winhelp $(OBJS) $(DLL_LINK) $(LIBS)
......
......@@ -2,5 +2,5 @@ name winhelp
mode guiexe
type win32
init WinMain
rsrc winhelp
rsrc rsrc.res
import comdlg32.dll
......@@ -116,6 +116,28 @@ static inline void fixup_rva_ptrs( void *array, void *base, int count )
/***********************************************************************
* fixup_resources
*/
static void fixup_resources( IMAGE_RESOURCE_DIRECTORY *dir, char *root, void *base )
{
IMAGE_RESOURCE_DIRECTORY_ENTRY *entry;
int i;
entry = (IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1);
for (i = 0; i < dir->NumberOfNamedEntries + dir->NumberOfIdEntries; i++, entry++)
{
void *ptr = root + entry->u2.s.OffsetToDirectory;
if (entry->u2.s.DataIsDirectory) fixup_resources( ptr, root, base );
else
{
IMAGE_RESOURCE_DATA_ENTRY *data = ptr;
fixup_rva_ptrs( &data->OffsetToData, base, 1 );
}
}
}
/***********************************************************************
* BUILTIN32_DoLoadImage
*
* Load a built-in Win32 module. Helper function for BUILTIN32_LoadImage.
......@@ -126,7 +148,7 @@ static HMODULE BUILTIN32_DoLoadImage( const BUILTIN32_DESCRIPTOR *descr )
IMAGE_DOS_HEADER *dos;
IMAGE_NT_HEADERS *nt;
IMAGE_SECTION_HEADER *sec;
INT i, size, nb_sections;
INT size, nb_sections;
BYTE *addr, *code_start, *data_start;
int page_size = VIRTUAL_GetPageSize();
......@@ -213,13 +235,11 @@ static HMODULE BUILTIN32_DoLoadImage( const BUILTIN32_DESCRIPTOR *descr )
/* Build the resource directory */
dir = &nt->OptionalHeader.DataDirectory[IMAGE_FILE_RESOURCE_DIRECTORY];
if (dir->VirtualAddress)
if (dir->Size)
{
BUILTIN32_RESOURCE *rsrc = (BUILTIN32_RESOURCE *)dir->VirtualAddress;
IMAGE_RESOURCE_DATA_ENTRY *rdep = rsrc->entries;
dir->VirtualAddress = (BYTE *)rsrc->restab - addr;
dir->Size = rsrc->restabsize;
for (i = 0; i < rsrc->nresources; i++) rdep[i].OffsetToData += dir->VirtualAddress;
void *ptr = (void *)dir->VirtualAddress;
fixup_rva_ptrs( &dir->VirtualAddress, addr, 1 );
fixup_resources( ptr, ptr, addr );
}
/* Build the export directory */
......
......@@ -265,27 +265,26 @@ static void output_src( FILE *file, INCL_FILE *pFile, int *column )
char *ext = strrchr( obj, '.' );
if (ext)
{
if (!strcmp( ext, ".y" )) /* yacc file */
*ext++ = 0;
if (!strcmp( ext, "y" )) /* yacc file */
{
fprintf( file, "y.tab.o: y.tab.c" );
*column += 16;
*column += fprintf( file, "y.tab.o: y.tab.c" );
}
else if (!strcmp( ext, ".l" )) /* lex file */
else if (!strcmp( ext, "l" )) /* lex file */
{
fprintf( file, "lex.yy.o: lex.yy.c" );
*column += 18;
*column += fprintf( file, "lex.yy.o: lex.yy.c" );
}
else if (!strcmp( ext, ".rc" )) /* resource file */
else if (!strcmp( ext, "rc" )) /* resource file */
{
strcpy( ext, ".s" );
fprintf( file, "%s: %s", obj, pFile->filename );
*column += strlen(obj) + strlen(pFile->filename);
*column += fprintf( file, "%s.res: %s", obj, pFile->filename );
}
else if (!strcmp( ext, "rc16" )) /* Win16 resource file */
{
*column += fprintf( file, "%s.s: %s", obj, pFile->filename );
}
else
{
strcpy( ext, ".o" );
fprintf( file, "%s: %s", obj, pFile->filename );
*column += strlen(obj) + strlen(pFile->filename) + 2;
*column += fprintf( file, "%s.o: %s", obj, pFile->filename );
}
}
free( obj );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment