| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- diff -ruN wine/configure.ac wine-patched/configure.ac
- --- wine/configure.ac 2004-03-03 13:30:46.000000000 -0700
- +++ wine-patched/configure.ac 2004-03-04 17:44:34.000000000 -0700
- @@ -1670,6 +1670,7 @@
- programs/uninstaller/Makefile
- programs/view/Makefile
- programs/wcmd/Makefile
- +programs/wine-sharedlib/Makefile
- programs/wineboot/Makefile
- programs/winebrowser/Makefile
- programs/winecfg/Makefile
- diff -ruN wine/dlls/kernel/process.c wine-patched/dlls/kernel/process.c
- --- wine/dlls/kernel/process.c 2004-02-20 13:19:24.000000000 -0700
- +++ wine-patched/dlls/kernel/process.c 2004-03-04 17:44:34.000000000 -0700
- @@ -756,8 +756,12 @@
-
- SetLastError( 0 ); /* clear error code */
- if (peb->BeingDebugged) DbgBreakPoint();
- - ExitProcess( entry( peb ) );
- + if (__wine_shared_lib==0) {
- + // This starts the main app and then exits wine
- + ExitProcess( entry( peb ) );
- + }
- }
- +
- __EXCEPT(UnhandledExceptionFilter)
- {
- TerminateThread( GetCurrentThread(), GetExceptionCode() );
- @@ -895,13 +899,20 @@
- set_library_wargv( __wine_main_argv );
- if (!build_command_line( __wine_main_wargv )) goto error;
-
- - stack_size = RtlImageNtHeader(peb->ImageBaseAddress)->OptionalHeader.SizeOfStackReserve;
- + if (__wine_shared_lib==1) {
- + /* We don't want a new stack if we're going shared. Screws up our return path */
- + start_process(NULL);
- + } else {
- + stack_size = RtlImageNtHeader(peb->ImageBaseAddress)->OptionalHeader.SizeOfStackReserve;
-
- - /* allocate main thread stack */
- - if (!THREAD_InitStack( NtCurrentTeb(), stack_size )) goto error;
- + /* allocate main thread stack */
- + if (!THREAD_InitStack( NtCurrentTeb(), stack_size )) goto error;
- +
- + /* switch to the new stack */
- + wine_switch_to_stack( start_process, NULL, NtCurrentTeb()->Tib.StackBase );
- + }
- + return;
-
- - /* switch to the new stack */
- - wine_switch_to_stack( start_process, NULL, NtCurrentTeb()->Tib.StackBase );
-
- error:
- ExitProcess( GetLastError() );
- diff -ruN wine/dlls/ntdll/loader.c wine-patched/dlls/ntdll/loader.c
- --- wine/dlls/ntdll/loader.c 2004-02-23 18:25:03.000000000 -0700
- +++ wine-patched/dlls/ntdll/loader.c 2004-03-04 17:44:34.000000000 -0700
- @@ -1951,7 +1951,9 @@
- WINE_MODREF *wm;
- NTSTATUS status;
- ANSI_STRING func_name;
- - void (* DECLSPEC_NORETURN init_func)();
- + /* We might return for shared-lib startup */
- + /* void (* DECLSPEC_NORETURN init_func)(); */
- + void (* init_func)();
- extern void __wine_dbg_ntdll_init(void);
-
- thread_init();
- diff -ruN wine/include/wine/library.h wine-patched/include/wine/library.h
- --- wine/include/wine/library.h 2004-01-02 14:08:05.000000000 -0700
- +++ wine-patched/include/wine/library.h 2004-03-04 17:44:34.000000000 -0700
- @@ -49,6 +49,7 @@
- extern void wine_dll_unload( void *handle );
- extern int wine_dll_get_owner( const char *name, char *buffer, int size, int *file_exists );
-
- +extern int __wine_shared_lib;
- extern int __wine_main_argc;
- extern char **__wine_main_argv;
- extern WCHAR **__wine_main_wargv;
- diff -ruN wine/libs/wine/loader.c wine-patched/libs/wine/loader.c
- --- wine/libs/wine/loader.c 2004-01-02 14:08:05.000000000 -0700
- +++ wine-patched/libs/wine/loader.c 2004-03-04 17:44:34.000000000 -0700
- @@ -46,6 +46,7 @@
- char **__wine_main_argv = NULL;
- WCHAR **__wine_main_wargv = NULL;
- char **__wine_main_environ = NULL;
- +int __wine_shared_lib = 0;
-
- struct dll_path_context
- {
- diff -ruN wine/libs/wine/wine.def wine-patched/libs/wine/wine.def
- --- wine/libs/wine/wine.def 2004-02-04 19:01:35.000000000 -0700
- +++ wine-patched/libs/wine/wine.def 2004-03-04 17:44:34.000000000 -0700
- @@ -9,6 +9,7 @@
- __wine_dbgstr_an
- __wine_dbgstr_wn
- __wine_dll_register
- + __wine_shared_lib
- __wine_main_argc
- __wine_main_argv
- __wine_main_environ
- diff -ruN wine/libs/wine/wine.map wine-patched/libs/wine/wine.map
- --- wine/libs/wine/wine.map 2004-02-12 15:54:00.000000000 -0700
- +++ wine-patched/libs/wine/wine.map 2004-03-04 17:44:34.000000000 -0700
- @@ -9,6 +9,7 @@
- __wine_dbgstr_an;
- __wine_dbgstr_wn;
- __wine_dll_register;
- + __wine_shared_lib;
- __wine_main_argc;
- __wine_main_argv;
- __wine_main_environ;
- diff -ruN wine/programs/Makefile.in wine-patched/programs/Makefile.in
- --- wine/programs/Makefile.in 2004-01-06 13:49:59.000000000 -0700
- +++ wine-patched/programs/Makefile.in 2004-03-04 17:44:34.000000000 -0700
- @@ -11,6 +11,7 @@
- cmdlgtst \
- control \
- expand \
- + wine-sharedlib \
- notepad \
- progman \
- regedit \
- @@ -41,6 +42,7 @@
- clock \
- control \
- expand \
- + wine-sharedlib \
- notepad \
- progman \
- regedit \
- @@ -179,6 +181,9 @@
- icinfo.exe$(DLLEXT): avitools/icinfo.exe$(DLLEXT)
- $(RM) $@ && $(LN_S) avitools/icinfo.exe$(DLLEXT) $@
-
- +wine-sharedlib.exe$(DLLEXT): wine-sharedlib/wine-sharedlib.exe$(DLLEXT)
- + $(RM) $@ && $(LN_S) wine-sharedlib/wine-sharedlib.exe$(DLLEXT) $@
- +
- notepad.exe$(DLLEXT): notepad/notepad.exe$(DLLEXT)
- $(RM) $@ && $(LN_S) notepad/notepad.exe$(DLLEXT) $@
-
- @@ -255,6 +260,7 @@
- control/control.exe$(DLLEXT): control
- expand/expand.exe$(DLLEXT): expand
- avitools/icinfo.exe$(DLLEXT): avitools
- +wine-sharedlib/wine-sharedlib.exe$(DLLEXT): wine-sharedlib
- notepad/notepad.exe$(DLLEXT): notepad
- progman/progman.exe$(DLLEXT): progman
- regedit/regedit.exe$(DLLEXT): regedit
- diff -ruN wine/programs/wine-sharedlib/Makefile.in wine-patched/programs/wine-sharedlib/Makefile.in
- --- wine/programs/wine-sharedlib/Makefile.in 1969-12-31 17:00:00.000000000 -0700
- +++ wine-patched/programs/wine-sharedlib/Makefile.in 2004-03-04 17:44:34.000000000 -0700
- @@ -0,0 +1,27 @@
- +TOPSRCDIR = @top_srcdir@
- +TOPOBJDIR = ../..
- +SRCDIR = @srcdir@
- +VPATH = @srcdir@
- +MODULE = wine-sharedlib.exe
- +APPMODE = -mwindows
- +IMPORTS = kernel32
- +DELAYIMPORTS = user32
- +EXTRAINCL =
- +EXTRADEFS = -DDLLPATH=\"${exec_prefix}/lib/wine\" -DLIBPATH=\"${exec_prefix}/lib\"
- +EXTRALIBS = -ldl -lpthread
- +C_SRCS = \
- + wine-sharedlib.c \
- + ../../loader/pthread.c
- +
- +RC_SRCS =
- +RC_BINSRC =
- +RC_BINARIES =
- +
- +PLTESTS =
- +
- +EXTRASUBDIRS =
- +
- +@MAKE_PROG_RULES@
- +
- +dlldir = ${exec_prefix}/lib
- +### Dependencies:
- diff -ruN wine/programs/wine-sharedlib/wine-sharedlib.c wine-patched/programs/wine-sharedlib/wine-sharedlib.c
- --- wine/programs/wine-sharedlib/wine-sharedlib.c 1969-12-31 17:00:00.000000000 -0700
- +++ wine-patched/programs/wine-sharedlib/wine-sharedlib.c 2004-03-04 17:47:06.000000000 -0700
- @@ -0,0 +1,81 @@
- +/*
- + * wine-sharedlib code
- + *
- + * Copyright 2004 Novell, Inc. (http://www.novell.com/)
- + *
- + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- + */
- +
- +
- +#include <wine/library.h>
- +#include <stdio.h>
- +#include <windows.h>
- +#include <winsock.h>
- +#include <dlfcn.h>
- +
- +/*
- + Dummy WinMain. If __wine_shared_lib is set this function is never actually called
- +*/
- +
- +int WINAPI
- +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
- +{
- + return(0);
- +}
- +
- +HMODULE WINAPI (*LoadLibraryF)(LPCSTR libname);
- +FARPROC WINAPI (*GetProcAddressF)(HMODULE hModule, LPCSTR function);
- +
- +/*
- + WineLoadLibrary is used by System.Windows.Forms to import the Wine dlls
- +*/
- +void *
- +WineLoadLibrary(unsigned char *dll)
- +{
- + return(LoadLibraryF(dll));
- +}
- +
- +void *
- +WineGetProcAddress(void *handle, unsigned char *function)
- +{
- + return(GetProcAddressF(handle, function));
- +}
- +
- +/*
- + SharedWineInit() Must be called to initialize Wine. Sets the __wine_shared_lib flag
- + to make wine return after initialization instead of running WinMain
- +*/
- +
- +int
- +SharedWineInit(void)
- +{
- + unsigned char Error[1024]="";
- + char *WineArguments[] = {"sharedapp", LIBPATH "/wine-sharedlib.exe.so", NULL};
- +
- + __wine_shared_lib=1;
- +
- + wine_init(2, WineArguments, Error, sizeof(Error));
- + if (Error[0]!='\0') {
- + printf("Wine initialization error:%s\n", Error);
- + exit(-1);
- + }
- +
- + putenv ("_WINE_SHAREDLIB_PATH=" DLLPATH);
- +
- + LoadLibraryF=LoadLibraryA;
- + GetProcAddressF=GetProcAddress;
- +
- + return(0);
- +}
- diff -ruN wine/tools/winebuild/spec32.c wine-patched/tools/winebuild/spec32.c
- --- wine/tools/winebuild/spec32.c 2004-02-16 13:24:32.000000000 -0700
- +++ wine-patched/tools/winebuild/spec32.c 2004-03-04 17:44:34.000000000 -0700
- @@ -568,6 +568,7 @@
- fprintf( outfile, "extern int __wine_main_argc;\n" );
- fprintf( outfile, "extern char **__wine_main_argv;\n" );
- fprintf( outfile, "extern char **__wine_main_environ;\n" );
- + fprintf( outfile, "extern int __wine_shared_lib;\n" );
- fprintf( outfile, "extern unsigned short **__wine_main_wargv;\n" );
- fprintf( outfile, "extern void _init(int, char**, char**);\n" );
- fprintf( outfile, "extern void _fini();\n" );
|