Alexandre Julliard : kernel32: Add a builtin 16-bit winhelp.exe.
Alexandre Julliard
julliard at winehq.org
Tue May 13 14:10:32 CDT 2008
Module: wine
Branch: master
Commit: 4d1cf9c8c4f7d7e903b513b407f7b3e69afb328f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4d1cf9c8c4f7d7e903b513b407f7b3e69afb328f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue May 13 18:50:50 2008 +0200
kernel32: Add a builtin 16-bit winhelp.exe.
This should be moved to winhlp32.exe once we support 16-bit modules in executables.
---
.gitignore | 1 +
dlls/Makefile.in | 3 +-
dlls/kernel32/Makefile.in | 5 +++-
dlls/kernel32/kernel16.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index aaef463..9d9d24d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -446,6 +446,7 @@ dlls/wined3d/libwined3d.def
dlls/winedos/libwinedos.def
dlls/wineps16.drv16
dlls/wing.dll16
+dlls/winhelp.exe16
dlls/wininet/libwininet.def
dlls/wininet/tests/*.ok
dlls/wininet/tests/testlist.c
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index 755c75a..155db3b 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -426,6 +426,7 @@ WIN16_FILES = \
windebug.dll16 \
wineps16.drv16 \
wing.dll16 \
+ winhelp.exe16 \
winnls.dll16 \
winoldap.mod16 \
winsock.dll16 \
@@ -455,7 +456,7 @@ dispdib.dll16 gdi.exe16 wing.dll16:
imm.dll16:
echo "imm32.dll" >$@
-comm.drv16 krnl386.exe16 stress.dll16 system.drv16 toolhelp.dll16 win87em.dll16 windebug.dll16 winoldap.mod16:
+comm.drv16 krnl386.exe16 stress.dll16 system.drv16 toolhelp.dll16 win87em.dll16 windebug.dll16 winhelp.exe16 winoldap.mod16:
echo "kernel32.dll" >$@
lzexpand.dll16:
diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in
index 3ac2567..b317953 100644
--- a/dlls/kernel32/Makefile.in
+++ b/dlls/kernel32/Makefile.in
@@ -96,7 +96,7 @@ MC_SRCS = \
nls/winerr_kor.mc
EXTRA_OBJS = relay16asm.o
-EXTRA_OBJS16 = winoldap.mod.o
+EXTRA_OBJS16 = winhelp.exe.o winoldap.mod.o
EXTRASUBDIRS = nls
@@ -110,6 +110,9 @@ relay16asm.o: $(WINEBUILD)
winoldap.mod.o: $(WINEBUILD)
$(WINEBUILD) $(WINEBUILDFLAGS) --exe -o $@ --main-module $(MODULE) --entry WINOLDAP_EntryPoint
+winhelp.exe.o: $(WINEBUILD)
+ $(WINEBUILD) $(WINEBUILDFLAGS) --exe -o $@ --main-module $(MODULE) --entry WINHELP_EntryPoint
+
# Special rules for 16-bit resource and spec files
krnl386.exe.spec.o: krnl386.exe.spec version16.res
diff --git a/dlls/kernel32/kernel16.c b/dlls/kernel32/kernel16.c
index a330e57..01b5624 100644
--- a/dlls/kernel32/kernel16.c
+++ b/dlls/kernel32/kernel16.c
@@ -206,3 +206,61 @@ void WINAPI WINOLDAP_EntryPoint( CONTEXT86 *context )
HeapFree( GetProcessHeap(), 0, cmdline );
ExitThread( exit_code );
}
+
+
+/**************************************************************************
+ * WINHELP entry point
+ *
+ * FIXME: should go into winhlp32.exe, but we don't support 16-bit modules in executables yet.
+ */
+void WINAPI WINHELP_EntryPoint( CONTEXT86 *context )
+{
+ static const WCHAR winhlp32W[] = {'\\','w','i','n','h','l','p','3','2','.','e','x','e',0};
+ PDB16 *psp;
+ INT len, total;
+ WCHAR *cmdline, *p;
+ PROCESS_INFORMATION info;
+ STARTUPINFOW startup;
+ DWORD count, exit_code = 1;
+
+ InitTask16( context );
+
+ TRACE( "(ds=%x es=%x fs=%x gs=%x, bx=%04x cx=%04x di=%04x si=%x)\n",
+ context->SegDs, context->SegEs, context->SegFs, context->SegGs,
+ context->Ebx, context->Ecx, context->Edi, context->Esi );
+
+ psp = GlobalLock16( context->SegEs );
+ len = MultiByteToWideChar( CP_ACP, 0, (char *)psp->cmdLine + 1, psp->cmdLine[0], NULL, 0 );
+ total = (GetSystemDirectoryW( NULL, 0 ) + len + 1) * sizeof(WCHAR) + sizeof(winhlp32W);
+ cmdline = HeapAlloc( GetProcessHeap(), 0, total );
+ GetSystemDirectoryW( cmdline, total );
+ lstrcatW( cmdline, winhlp32W );
+ p = cmdline + lstrlenW(cmdline);
+ if (len)
+ {
+ *p++ = ' ';
+ MultiByteToWideChar( CP_ACP, 0, (char *)psp->cmdLine + 1, psp->cmdLine[0], p, len );
+ p[len] = 0;
+ }
+
+ memset( &startup, 0, sizeof(startup) );
+ startup.cb = sizeof(startup);
+
+ if (CreateProcessW( NULL, cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info ))
+ {
+ /* Give 10 seconds to the app to come up */
+ if (wait_input_idle( info.hProcess, 10000 ) == WAIT_FAILED)
+ WARN("WaitForInputIdle failed: Error %d\n", GetLastError() );
+ ReleaseThunkLock( &count );
+
+ WaitForSingleObject( info.hProcess, INFINITE );
+ GetExitCodeProcess( info.hProcess, &exit_code );
+ CloseHandle( info.hThread );
+ CloseHandle( info.hProcess );
+ }
+ else
+ ReleaseThunkLock( &count );
+
+ HeapFree( GetProcessHeap(), 0, cmdline );
+ ExitThread( exit_code );
+}
More information about the wine-cvs
mailing list