Commit a1cf6485 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Make winoldap.mod into a stand-alone 16-bit executable.

parent 825d7fda
......@@ -126,7 +126,6 @@ dlls/wineps16.drv16
dlls/wing.dll16
dlls/winhelp.exe16
dlls/winnls.dll16
dlls/winoldap.mod16
dlls/winsock.dll16
dlls/wintab.dll16
dlls/wprocs.dll16
......
......@@ -3909,6 +3909,7 @@ then
enable_w32skrnl=${enable_w32skrnl:-no}
enable_winedos=${enable_winedos:-no}
enable_winevdm=${enable_winevdm:-no}
enable_winoldap_mod16=${enable_winoldap_mod16:-no}
fi
{ $as_echo "$as_me:$LINENO: checking for the directory containing the Wine tools" >&5
......@@ -27889,6 +27890,15 @@ programs/winhlp32/Makefile: programs/winhlp32/Makefile.in programs/Makeprog.rule
ac_config_files="$ac_config_files programs/winhlp32/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
programs/winoldap.mod16/Makefile"
test "x$enable_winoldap_mod16" != xno && ALL_PROGRAM_DIRS="$ALL_PROGRAM_DIRS \\
winoldap.mod16" && ALL_PROGRAM_INSTALL_DIRS="$ALL_PROGRAM_INSTALL_DIRS \\
winoldap.mod16"
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
programs/winoldap.mod16/Makefile: programs/winoldap.mod16/Makefile.in programs/Makeprog.rules"
ac_config_files="$ac_config_files programs/winoldap.mod16/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
programs/winver/Makefile"
test "x$enable_winver" != xno && ALL_PROGRAM_DIRS="$ALL_PROGRAM_DIRS \\
winver" && ALL_PROGRAM_INSTALL_DIRS="$ALL_PROGRAM_INSTALL_DIRS \\
......@@ -29052,6 +29062,7 @@ do
"programs/winetest/Makefile") CONFIG_FILES="$CONFIG_FILES programs/winetest/Makefile" ;;
"programs/winevdm/Makefile") CONFIG_FILES="$CONFIG_FILES programs/winevdm/Makefile" ;;
"programs/winhlp32/Makefile") CONFIG_FILES="$CONFIG_FILES programs/winhlp32/Makefile" ;;
"programs/winoldap.mod16/Makefile") CONFIG_FILES="$CONFIG_FILES programs/winoldap.mod16/Makefile" ;;
"programs/winver/Makefile") CONFIG_FILES="$CONFIG_FILES programs/winver/Makefile" ;;
"programs/wordpad/Makefile") CONFIG_FILES="$CONFIG_FILES programs/wordpad/Makefile" ;;
"programs/write/Makefile") CONFIG_FILES="$CONFIG_FILES programs/write/Makefile" ;;
......
......@@ -146,6 +146,7 @@ then
enable_w32skrnl=${enable_w32skrnl:-no}
enable_winedos=${enable_winedos:-no}
enable_winevdm=${enable_winevdm:-no}
enable_winoldap_mod16=${enable_winoldap_mod16:-no}
fi
AC_CACHE_CHECK([for the directory containing the Wine tools], wine_cv_toolsdir,
......@@ -2306,6 +2307,7 @@ WINE_CONFIG_MAKEFILE([programs/winepath/Makefile],[programs/Makeprog.rules],[pro
WINE_CONFIG_MAKEFILE([programs/winetest/Makefile],[programs/Makeprog.rules],[programs],[ALL_PROGRAM_DIRS])
WINE_CONFIG_MAKEFILE([programs/winevdm/Makefile],[programs/Makeprog.rules],[programs],[ALL_PROGRAM_DIRS,ALL_PROGRAM_INSTALL_DIRS])
WINE_CONFIG_MAKEFILE([programs/winhlp32/Makefile],[programs/Makeprog.rules],[programs],[ALL_PROGRAM_DIRS,ALL_PROGRAM_INSTALL_DIRS])
WINE_CONFIG_MAKEFILE([programs/winoldap.mod16/Makefile],[programs/Makeprog.rules],[programs],[ALL_PROGRAM_DIRS,ALL_PROGRAM_INSTALL_DIRS])
WINE_CONFIG_MAKEFILE([programs/winver/Makefile],[programs/Makeprog.rules],[programs],[ALL_PROGRAM_DIRS,ALL_PROGRAM_INSTALL_DIRS])
WINE_CONFIG_MAKEFILE([programs/wordpad/Makefile],[programs/Makeprog.rules],[programs],[ALL_PROGRAM_DIRS,ALL_PROGRAM_INSTALL_DIRS])
WINE_CONFIG_MAKEFILE([programs/write/Makefile],[programs/Makeprog.rules],[programs],[ALL_PROGRAM_DIRS,ALL_PROGRAM_INSTALL_DIRS])
......
......@@ -65,7 +65,6 @@ WIN16_FILES = \
wing.dll16 \
winhelp.exe16 \
winnls.dll16 \
winoldap.mod16 \
winsock.dll16 \
wintab.dll16 \
wprocs.dll16
......@@ -93,7 +92,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 winhelp.exe16 winoldap.mod16:
comm.drv16 krnl386.exe16 stress.dll16 system.drv16 toolhelp.dll16 win87em.dll16 windebug.dll16 winhelp.exe16:
echo "kernel32.dll" >$@
lzexpand.dll16:
......
......@@ -96,7 +96,7 @@ MC_SRCS = \
nls/winerr_nor.mc
EXTRA_OBJS = relay16asm.o
EXTRA_OBJS16 = winhelp.exe.o winoldap.mod.o
EXTRA_OBJS16 = winhelp.exe.o
EXTRASUBDIRS = nls
......@@ -107,9 +107,6 @@ kernel.res: $(MC_SRCS:.mc=.mc.rc)
relay16asm.o: $(WINEBUILD)
$(WINEBUILD) $(WINEBUILDFLAGS) -o $@ --relay16
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
......
......@@ -162,54 +162,6 @@ static DWORD wait_input_idle( HANDLE process, DWORD timeout )
/**************************************************************************
* 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;
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof(startup);
if (CreateProcessA( 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 );
}
/**************************************************************************
* WINHELP entry point
*
* FIXME: should go into winhlp32.exe, but we don't support 16-bit modules in executables yet.
......
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = winoldap.mod16
APPMODE = -mwindows -Wb,--subsystem,win16
IMPORTS = kernel32 ntdll
C_SRCS = winoldap.c
@MAKE_PROG_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend
/*
* WINOLDAP implementation
*
* Copyright 2000 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wownt32.h"
#include "wine/winbase16.h"
#include "wine/server.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(module);
/***********************************************************************
* wait_input_idle
*
* user32.WaitForInputIdle releases the win16 lock, so here is a replacement.
*/
static DWORD wait_input_idle( HANDLE process, DWORD timeout )
{
DWORD ret;
HANDLE handles[2];
handles[0] = process;
SERVER_START_REQ( get_process_idle_event )
{
req->handle = wine_server_obj_handle(process);
if (!(ret = wine_server_call_err( req ))) handles[1] = wine_server_ptr_handle( reply->event );
}
SERVER_END_REQ;
if (ret) return WAIT_FAILED; /* error */
if (!handles[1]) return 0; /* no event to wait on */
return WaitForMultipleObjects( 2, handles, FALSE, timeout );
}
/**************************************************************************
* WINOLDAP entry point
*/
WORD WINAPI WinMain16( HINSTANCE16 inst, HINSTANCE16 prev, LPSTR cmdline, WORD show )
{
PROCESS_INFORMATION info;
STARTUPINFOA startup;
DWORD count, exit_code = 1;
WINE_TRACE( "%x %x %s %u\n", inst, prev, wine_dbgstr_a(cmdline), show );
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof(startup);
if (CreateProcessA( 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)
WINE_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 );
}
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