kernel32: Add a builtin 16-bit winhelp.exe.

This should be moved to winhlp32.exe once we support 16-bit modules in executables.
This commit is contained in:
Alexandre Julliard 2008-05-13 18:50:50 +02:00
parent a795f36af7
commit 4d1cf9c8c4
4 changed files with 65 additions and 2 deletions

1
.gitignore vendored
View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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 );
}