[Wine-patches] [eterhack] eterbug #6748
Alexander Morozov
amorozov на etersoft.ru
Вт Янв 11 19:37:36 MSK 2011
----------- следующая часть -----------
From 84550742d02044e048ce6ae0ace9bd08cd8ebe29 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Tue, 11 Jan 2011 16:48:32 +0300
Subject: [eterhack 1/2] Do not convert path a second time (eterbug #6748).
---
programs/start/start.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/programs/start/start.c b/programs/start/start.c
index 81c1d27..6c5df38 100644
--- a/programs/start/start.c
+++ b/programs/start/start.c
@@ -154,6 +154,7 @@ static WCHAR *build_args( int argc, WCHAR **argvW )
return ret;
}
+#if 0
static WCHAR *get_parent_dir(WCHAR* path)
{
WCHAR *last_slash;
@@ -172,6 +173,7 @@ static WCHAR *get_parent_dir(WCHAR* path)
return result;
}
+#endif
int wmain (int argc, WCHAR *argv[])
{
@@ -182,7 +184,9 @@ int wmain (int argc, WCHAR *argv[])
int progid_open = 0;
WCHAR *dos_filename = NULL;
WCHAR *parent_directory = NULL;
+#if 0
DWORD binary_type;
+#endif
static const WCHAR openW[] = { 'o', 'p', 'e', 'n', 0 };
static const WCHAR unixW[] = { 'u', 'n', 'i', 'x', 0 };
@@ -283,6 +287,7 @@ int wmain (int argc, WCHAR *argv[])
args = build_args( argc - i, &argv[i] );
sei.lpParameters = args;
+#if 0 /* In WINE на Etersoft path is already converted to Windows path (eterbug #6748) */
if (unix_mode || progid_open) {
LPWSTR (*CDECL wine_get_dos_file_name_ptr)(LPCSTR);
char* multibyte_unixpath;
@@ -341,11 +346,14 @@ int wmain (int argc, WCHAR *argv[])
goto done;
}
}
+#endif
if (!ShellExecuteExW(&sei))
fatal_string_error(STRING_EXECFAIL, GetLastError(), sei.lpFile);
+#if 0
done:
+#endif
HeapFree( GetProcessHeap(), 0, args );
HeapFree( GetProcessHeap(), 0, dos_filename );
HeapFree( GetProcessHeap(), 0, parent_directory );
--
1.7.3.4
----------- следующая часть -----------
From 59a527c8db1189616fe7d88ea725d682a3c73365 Mon Sep 17 00:00:00 2001
From: Alexander Morozov <amorozov на etersoft.ru>
Date: Tue, 11 Jan 2011 18:25:02 +0300
Subject: [eterhack 2/2] Convert unix paths in kernel32.
---
dlls/kernel32/process.c | 51 +++++++++++++++++++++++++++++++++++++++++++++-
etersoft/scripts/wine.in | 17 +--------------
2 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 568e1ce..fc045fd 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -1231,6 +1231,52 @@ static BOOL etersoft_check_license(const WCHAR *main_exe_name, const CHAR *pname
return TRUE;
}
+char **convert_unix_paths( char **argv )
+{
+ int ac, argc = 0;
+ char **ret;
+
+ while (argv[++argc]);
+ ret = RtlAllocateHeap( GetProcessHeap(), 0, (argc + 1) * sizeof(*argv) );
+
+ for (ac = 0; ac < argc; ++ac)
+ {
+ WCHAR *dos_path;
+ int fd, len;
+
+ fd = open( argv[ac], O_RDONLY );
+ if (fd < 0)
+ {
+ len = strlen(argv[ac]) + 1;
+ ret[ac] = RtlAllocateHeap( GetProcessHeap(), 0, len );
+ strcpy( ret[ac], argv[ac] );
+ }
+ else
+ {
+ close( fd );
+ dos_path = wine_get_dos_file_name( argv[ac] );
+ len = WideCharToMultiByte( CP_UNIXCP, 0, dos_path, -1, ret[ac], 0,
+ NULL, NULL );
+ ret[ac] = RtlAllocateHeap( GetProcessHeap(), 0, len );
+ WideCharToMultiByte( CP_UNIXCP, 0, dos_path, -1, ret[ac], len, NULL,
+ NULL );
+ RtlFreeHeap( GetProcessHeap(), 0, dos_path );
+ }
+ }
+ ret[ac] = NULL;
+
+ return ret;
+}
+
+void free_converted_paths( char **argv )
+{
+ int ac;
+
+ for (ac = 0; argv[ac]; ++ac)
+ RtlFreeHeap( GetProcessHeap(), 0, argv[ac] );
+ RtlFreeHeap( GetProcessHeap(), 0, argv );
+}
+
/***********************************************************************
* __wine_kernel_init
*
@@ -1248,6 +1294,7 @@ void CDECL __wine_kernel_init(void)
HANDLE boot_events[2];
BOOL got_environment = TRUE;
BOOL got_current_dir = FALSE;
+ char **argv;
/* Initialize everything */
@@ -1274,7 +1321,9 @@ void CDECL __wine_kernel_init(void)
init_current_directory( ¶ms->CurrentDirectory, &got_current_dir );
set_process_name( __wine_main_argc, __wine_main_argv );
- set_library_wargv( __wine_main_argv );
+ argv = convert_unix_paths( __wine_main_argv );
+ set_library_wargv( argv );
+ free_converted_paths( argv );
boot_events[0] = boot_events[1] = 0;
if (peb->ProcessParameters->ImagePathName.Buffer)
diff --git a/etersoft/scripts/wine.in b/etersoft/scripts/wine.in
index 91cd593..e2039f4 100644
--- a/etersoft/scripts/wine.in
+++ b/etersoft/scripts/wine.in
@@ -481,20 +481,6 @@ if [ -n "$WINEWORKDIRPATH" ] ; then
cd "$WINEWORKDIRPATH"
fi
-# translate args from unix path to windows, if possible (eterbug #4933)
-args_to_winpath()
-{
- for i in "$@" ; do
- local TP="$i"
- local TR=${i/\~/$HOME}
- if [ -r "$TR" ] ; then
- WP=$($WINELOADER winepath -w "$TR" 2>/dev/null)
- [ -z "$WP" ] || TP="$WP"
- fi
- echo "'$TP' "
- done
-}
-
STARTCOM=
# if file is exists in Unix or Wine notation
WINEPROGRAMUNIXPATH=$($WINELOADER winepath "$1")
@@ -510,5 +496,4 @@ if [ -n "$1" ] && [ -f "$WINEPROGRAMUNIXPATH" ] ; then
fi
fi
-eval run_wine $STARTCOM $(args_to_winpath "$@")
-
+run_wine $STARTCOM "$@"
--
1.7.3.4
Подробная информация о списке рассылки Wine-patches