[Wine-patches] [eter-1.0.12] Fix a problem with services and wineole.
Alexander Morozov
amorozov на etersoft.ru
Ср Дек 23 15:59:45 MSK 2009
----------- следующая часть -----------
From c310429a28b5f8d000e71eb844346553041ba025 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Wed, 23 Dec 2009 15:20:27 +0300
Subject: [eter-1.0.12] Fix a problem with services and wineole.
---
etersoft/scripts/wine.in | 11 ++++++++++-
programs/wineboot/wineboot.c | 19 ++++++++++++-------
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/etersoft/scripts/wine.in b/etersoft/scripts/wine.in
index 1d1f305..a241119 100644
--- a/etersoft/scripts/wine.in
+++ b/etersoft/scripts/wine.in
@@ -28,6 +28,9 @@ test -f $WINEPREFIX/config && . $WINEPREFIX/config
[ -z "$WINELOADER" ] && export WINELOADER=$BINDIR/wine-glibc
+saved_WINEDLLOVERRIDES="$WINEDLLOVERRIDES"
+unset WINEDLLOVERRIDES
+
# missed on FreeBSD
[ -z "$UID" ] && export UID=`id -u`
@@ -70,12 +73,18 @@ run_wine()
{
# do not check DISPLAY here, console programs can be started without DISPLAY
if tty -s ; then
+ $WINELOADER wineboot.exe --only-first
+ export WINEDLLOVERRIDES="$saved_WINEDLLOVERRIDES"
exec $WINELOADER "$@"
else
echo "$0: Running without console, disable input" >&2
if false && [ -z "$WINELOGFILO" ] ; then
- exec $WINELOADER "$@" </dev/null >$WINEPREFIX/wine.log 2>$WINEPREFIX/wine.log
+ $WINELOADER wineboot.exe --only-first </dev/null >$WINEPREFIX/wine.log 2>$WINEPREFIX/wine.log
+ export WINEDLLOVERRIDES="$saved_WINEDLLOVERRIDES"
+ exec $WINELOADER "$@" </dev/null >>$WINEPREFIX/wine.log 2>>$WINEPREFIX/wine.log
else
+ $WINELOADER wineboot.exe --only-first </dev/null
+ export WINEDLLOVERRIDES="$saved_WINEDLLOVERRIDES"
exec $WINELOADER "$@" </dev/null
fi
fi
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
index 8fe072d..774c7d5 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -794,12 +794,13 @@ static void usage(void)
WINE_MESSAGE( " -f,--force Force exit for processes that don't exit cleanly\n" );
WINE_MESSAGE( " -i,--init Perform initialization for first Wine instance\n" );
WINE_MESSAGE( " -k,--kill Kill running processes without any cleanup\n" );
+ WINE_MESSAGE( " -o,--only-first Do not run if it is started already\n");
WINE_MESSAGE( " -r,--restart Restart only, don't do normal startup operations\n" );
WINE_MESSAGE( " -s,--shutdown Shutdown only, don't reboot\n" );
WINE_MESSAGE( " -u,--update Update the wineprefix directory\n" );
}
-static const char short_options[] = "efhikrsu";
+static const char short_options[] = "efhikorsu";
static const struct option long_options[] =
{
@@ -808,6 +809,7 @@ static const struct option long_options[] =
{ "force", 0, 0, 'f' },
{ "init" , 0, 0, 'i' },
{ "kill", 0, 0, 'k' },
+ { "only-first", 0, 0, 'o' },
{ "restart", 0, 0, 'r' },
{ "shutdown", 0, 0, 's' },
{ "update", 0, 0, 'u' },
@@ -821,7 +823,7 @@ int main( int argc, char *argv[] )
/* First, set the current directory to SystemRoot */
int optc;
- int end_session = 0, force = 0, init = 0, kill = 0, restart = 0, shutdown = 0, update = 0;
+ int end_session = 0, force = 0, init = 0, kill = 0, restart = 0, shutdown = 0, update = 0, only_first = 0;
HANDLE event;
SECURITY_ATTRIBUTES sa;
@@ -837,6 +839,7 @@ int main( int argc, char *argv[] )
case 'f': force = 1; break;
case 'i': init = 1; break;
case 'k': kill = 1; break;
+ case 'o': only_first = 1; break;
case 'r': restart = 1; break;
case 's': shutdown = 1; break;
case 'u': update = 1; break;
@@ -845,6 +848,13 @@ int main( int argc, char *argv[] )
}
}
+ sa.nLength = sizeof(sa);
+ sa.lpSecurityDescriptor = NULL;
+ sa.bInheritHandle = TRUE; /* so that services.exe inherits it */
+ event = CreateEventW( &sa, TRUE, FALSE, wineboot_eventW );
+
+ if (only_first && GetLastError() == ERROR_ALREADY_EXISTS) return 0;
+
if (end_session)
{
if (!shutdown_close_windows( force )) return 1;
@@ -854,11 +864,6 @@ int main( int argc, char *argv[] )
if (shutdown) return 0;
- sa.nLength = sizeof(sa);
- sa.lpSecurityDescriptor = NULL;
- sa.bInheritHandle = TRUE; /* so that services.exe inherits it */
- event = CreateEventW( &sa, TRUE, FALSE, wineboot_eventW );
-
ResetEvent( event ); /* in case this is a restart */
wininit();
--
1.6.5.6
Подробная информация о списке рассылки Wine-patches