kernel32: Added a winoldap.mod 16-bit exe to launch 32-bit processes.

Based on a patch by Dmitry Timoshkov.
This commit is contained in:
Alexandre Julliard 2008-03-03 15:22:35 +01:00
parent 0c214a7091
commit c52d921f34
7 changed files with 80 additions and 6 deletions

1
.gitignore vendored
View File

@ -559,6 +559,7 @@ dlls/winmm/tests/winmm_crosstest.exe
dlls/winmm/winmm_res.res dlls/winmm/winmm_res.res
dlls/winnls.dll16 dlls/winnls.dll16
dlls/winnls32/libwinnls32.def dlls/winnls32/libwinnls32.def
dlls/winoldap.mod16
dlls/winscard/libwinscard.def dlls/winscard/libwinscard.def
dlls/winscard/rsrc.res dlls/winscard/rsrc.res
dlls/winsock.dll16 dlls/winsock.dll16

View File

@ -419,6 +419,7 @@ WIN16_FILES = \
wineps16.drv16 \ wineps16.drv16 \
wing.dll16 \ wing.dll16 \
winnls.dll16 \ winnls.dll16 \
winoldap.mod16 \
winsock.dll16 \ winsock.dll16 \
wintab.dll16 \ wintab.dll16 \
wprocs.dll16 wprocs.dll16
@ -446,7 +447,7 @@ dispdib.dll16 gdi.exe16 wing.dll16:
imm.dll16: imm.dll16:
echo "imm32.dll" >$@ echo "imm32.dll" >$@
comm.drv16 krnl386.exe16 stress.dll16 system.drv16 toolhelp.dll16 win87em.dll16 windebug.dll16: comm.drv16 krnl386.exe16 stress.dll16 system.drv16 toolhelp.dll16 win87em.dll16 windebug.dll16 winoldap.mod16:
echo "kernel32.dll" >$@ echo "kernel32.dll" >$@
lzexpand.dll16: lzexpand.dll16:

View File

@ -96,6 +96,7 @@ MC_SRCS = \
nls/winerr_kor.mc nls/winerr_kor.mc
EXTRA_OBJS = relay16asm.o EXTRA_OBJS = relay16asm.o
EXTRA_OBJS16 = winoldap.mod.o
EXTRASUBDIRS = nls EXTRASUBDIRS = nls
@ -106,6 +107,9 @@ kernel.res: $(MC_SRCS:.mc=.mc.rc)
relay16asm.o: $(WINEBUILD) relay16asm.o: $(WINEBUILD)
$(WINEBUILD) $(WINEBUILDFLAGS) -o $@ --relay16 $(WINEBUILD) $(WINEBUILDFLAGS) -o $@ --relay16
winoldap.mod.o: $(WINEBUILD)
$(WINEBUILD) $(WINEBUILDFLAGS) --exe -o $@ --main-module $(MODULE) --entry WINOLDAP_EntryPoint
# Special rules for 16-bit resource and spec files # Special rules for 16-bit resource and spec files
krnl386.exe.spec.o: krnl386.exe.spec version16.res krnl386.exe.spec.o: krnl386.exe.spec version16.res

View File

@ -28,6 +28,9 @@
#include "toolhelp.h" #include "toolhelp.h"
#include "kernel_private.h" #include "kernel_private.h"
#include "kernel16_private.h" #include "kernel16_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(module);
/************************************************************************** /**************************************************************************
* DllEntryPoint (KERNEL.669) * DllEntryPoint (KERNEL.669)
@ -130,3 +133,44 @@ HANDLE WINAPI CreateThread16( SECURITY_ATTRIBUTES *sa, DWORD stack,
args->param = param; args->param = param;
return CreateThread( sa, stack, start_thread16, args, flags, id ); return CreateThread( sa, stack, start_thread16, args, flags, id );
} }
/**************************************************************************
* WINOLDAP entry point
*/
void WINAPI WINOLDAP_EntryPoint( CONTEXT86 *context )
{
PDB16 *psp;
INT len;
LPSTR cmdline;
PROCESS_INFORMATION info;
STARTUPINFOA 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 = psp->cmdLine[0];
cmdline = HeapAlloc( GetProcessHeap(), 0, len + 1 );
memcpy( cmdline, psp->cmdLine + 1, len );
cmdline[len] = 0;
ReleaseThunkLock( &count );
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof(startup);
/* FIXME: Should this be WinExec instead of CreateProcess? */
if (CreateProcessA( NULL, cmdline, NULL, NULL, FALSE,
0, NULL, NULL, &startup, &info ))
{
WaitForSingleObject( info.hProcess, INFINITE );
GetExitCodeProcess( info.hProcess, &exit_code );
CloseHandle( info.hThread );
CloseHandle( info.hProcess );
}
HeapFree( GetProcessHeap(), 0, cmdline );
ExitThread( exit_code );
}

View File

@ -1197,6 +1197,8 @@ HINSTANCE16 WINAPI LoadModule16( LPCSTR name, LPVOID paramBlock )
if (name == NULL) return 0; if (name == NULL) return 0;
TRACE("name %s, paramBlock %p\n", name, paramBlock);
/* Load module */ /* Load module */
if ( (hModule = NE_GetModuleByFilename(name) ) != 0 ) if ( (hModule = NE_GetModuleByFilename(name) ) != 0 )
@ -1707,10 +1709,24 @@ HINSTANCE16 WINAPI WinExec16( LPCSTR lpCmdLine, UINT16 nCmdShow )
if (ret == 21 || ret == ERROR_BAD_FORMAT) /* 32-bit module or unknown executable*/ if (ret == 21 || ret == ERROR_BAD_FORMAT) /* 32-bit module or unknown executable*/
{ {
DWORD count; LOADPARAMS16 params;
ReleaseThunkLock( &count ); WORD showCmd[2];
ret = LOWORD( WinExec( lpCmdLine, nCmdShow ) ); showCmd[0] = 2;
RestoreThunkLock( count ); showCmd[1] = nCmdShow;
arglen = strlen( lpCmdLine );
cmdline = HeapAlloc( GetProcessHeap(), 0, arglen + 1 );
cmdline[0] = (BYTE)arglen;
memcpy( cmdline + 1, lpCmdLine, arglen );
params.hEnvironment = 0;
params.cmdLine = MapLS( cmdline );
params.showCmd = MapLS( showCmd );
params.reserved = 0;
ret = LoadModule16( "winoldap.mod", &params );
UnMapLS( params.cmdLine );
UnMapLS( params.showCmd );
} }
return ret; return ret;
} }

View File

@ -452,6 +452,7 @@ BOOL16 WINAPI GlobalUnlock16(HGLOBAL16);
BOOL16 WINAPI GlobalUnWire16(HGLOBAL16); BOOL16 WINAPI GlobalUnWire16(HGLOBAL16);
SEGPTR WINAPI GlobalWire16(HGLOBAL16); SEGPTR WINAPI GlobalWire16(HGLOBAL16);
WORD WINAPI InitAtomTable16(WORD); WORD WINAPI InitAtomTable16(WORD);
void WINAPI InitTask16(CONTEXT86*);
BOOL16 WINAPI IsBadCodePtr16(SEGPTR); BOOL16 WINAPI IsBadCodePtr16(SEGPTR);
BOOL16 WINAPI IsBadHugeReadPtr16(SEGPTR,DWORD); BOOL16 WINAPI IsBadHugeReadPtr16(SEGPTR,DWORD);
BOOL16 WINAPI IsBadHugeWritePtr16(SEGPTR,DWORD); BOOL16 WINAPI IsBadHugeWritePtr16(SEGPTR,DWORD);

View File

@ -225,7 +225,7 @@ sub parse_makefile($)
$make{$1} = $2; $make{$1} = $2;
next; next;
} }
if (/^(BISON_SRCS|LEX_SRCS|IDL_[CHIPS]_SRCS|IDL_TLB_SRCS|IMPLIB_SRCS|MC_SRCS|RC_SRCS|RC_SRCS16|RC_BINARIES|SPEC_SRCS16|MANPAGES|PROGRAMS)\s*=\s*(.*)/) if (/^(BISON_SRCS|LEX_SRCS|IDL_[CHIPS]_SRCS|IDL_TLB_SRCS|IMPLIB_SRCS|MC_SRCS|RC_SRCS|RC_SRCS16|RC_BINARIES|SPEC_SRCS16|EXTRA_OBJS16|MANPAGES|PROGRAMS)\s*=\s*(.*)/)
{ {
my @list = split(/\s+/, $2); my @list = split(/\s+/, $2);
$make{$1} = \@list; $make{$1} = \@list;
@ -422,6 +422,13 @@ sub update_dlls(@)
my @list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @{$makefile{"SPEC_SRCS16"}}; my @list = map { $_ =~ s/\.spec$//; $_ .= ".dll" unless $_ =~ /\./; $_; } @{$makefile{"SPEC_SRCS16"}};
$altnames{$module} = \@list; $altnames{$module} = \@list;
} }
if (defined $makefile{"EXTRA_OBJS16"})
{
foreach my $obj (@{$makefile{"EXTRA_OBJS16"}})
{
if ($obj =~ /^(.*\.(exe|mod))\.o/) { push @{$altnames{$module}}, $1; }
}
}
} }
# output special dlls configure definitions # output special dlls configure definitions