Commit 2b99e1c1 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Make sure we always have a valid process title.

parent e091c12b
...@@ -468,11 +468,9 @@ void ENV_CopyStartupInformation(void) ...@@ -468,11 +468,9 @@ void ENV_CopyStartupInformation(void)
startup_infoA.cb = sizeof(startup_infoA); startup_infoA.cb = sizeof(startup_infoA);
startup_infoA.lpReserved = NULL; startup_infoA.lpReserved = NULL;
startup_infoA.lpDesktop = (rupp->Desktop.Length && startup_infoA.lpDesktop = RtlUnicodeStringToAnsiString( &ansi, &rupp->Desktop, TRUE ) == STATUS_SUCCESS ?
RtlUnicodeStringToAnsiString( &ansi, &rupp->Desktop, TRUE) == STATUS_SUCCESS) ?
ansi.Buffer : NULL; ansi.Buffer : NULL;
startup_infoA.lpTitle = (rupp->WindowTitle.Length && startup_infoA.lpTitle = RtlUnicodeStringToAnsiString( &ansi, &rupp->WindowTitle, TRUE ) == STATUS_SUCCESS ?
RtlUnicodeStringToAnsiString( &ansi, &rupp->WindowTitle, TRUE) == STATUS_SUCCESS) ?
ansi.Buffer : NULL; ansi.Buffer : NULL;
startup_infoA.dwX = rupp->dwX; startup_infoA.dwX = rupp->dwX;
startup_infoA.dwY = rupp->dwY; startup_infoA.dwY = rupp->dwY;
......
...@@ -1481,6 +1481,7 @@ static startup_info_t *create_startup_info( LPCWSTR filename, LPCWSTR cmdline, ...@@ -1481,6 +1481,7 @@ static startup_info_t *create_startup_info( LPCWSTR filename, LPCWSTR cmdline,
const STARTUPINFOW *startup, DWORD *info_size ) const STARTUPINFOW *startup, DWORD *info_size )
{ {
const RTL_USER_PROCESS_PARAMETERS *cur_params; const RTL_USER_PROCESS_PARAMETERS *cur_params;
const WCHAR *title;
startup_info_t *info; startup_info_t *info;
DWORD size; DWORD size;
void *ptr; void *ptr;
...@@ -1510,13 +1511,14 @@ static startup_info_t *create_startup_info( LPCWSTR filename, LPCWSTR cmdline, ...@@ -1510,13 +1511,14 @@ static startup_info_t *create_startup_info( LPCWSTR filename, LPCWSTR cmdline,
else else
cur_dir = cur_params->CurrentDirectory.DosPath.Buffer; cur_dir = cur_params->CurrentDirectory.DosPath.Buffer;
} }
title = startup->lpTitle ? startup->lpTitle : imagepath;
size = sizeof(*info); size = sizeof(*info);
size += strlenW( cur_dir ) * sizeof(WCHAR); size += strlenW( cur_dir ) * sizeof(WCHAR);
size += cur_params->DllPath.Length; size += cur_params->DllPath.Length;
size += strlenW( imagepath ) * sizeof(WCHAR); size += strlenW( imagepath ) * sizeof(WCHAR);
size += strlenW( cmdline ) * sizeof(WCHAR); size += strlenW( cmdline ) * sizeof(WCHAR);
if (startup->lpTitle) size += strlenW( startup->lpTitle ) * sizeof(WCHAR); size += strlenW( title ) * sizeof(WCHAR);
if (startup->lpDesktop) size += strlenW( startup->lpDesktop ) * sizeof(WCHAR); if (startup->lpDesktop) size += strlenW( startup->lpDesktop ) * sizeof(WCHAR);
/* FIXME: shellinfo */ /* FIXME: shellinfo */
if (startup->lpReserved2 && startup->cbReserved2) size += startup->cbReserved2; if (startup->lpReserved2 && startup->cbReserved2) size += startup->cbReserved2;
...@@ -1575,7 +1577,7 @@ static startup_info_t *create_startup_info( LPCWSTR filename, LPCWSTR cmdline, ...@@ -1575,7 +1577,7 @@ static startup_info_t *create_startup_info( LPCWSTR filename, LPCWSTR cmdline,
ptr = (char *)ptr + cur_params->DllPath.Length; ptr = (char *)ptr + cur_params->DllPath.Length;
info->imagepath_len = append_string( &ptr, imagepath ); info->imagepath_len = append_string( &ptr, imagepath );
info->cmdline_len = append_string( &ptr, cmdline ); info->cmdline_len = append_string( &ptr, cmdline );
if (startup->lpTitle) info->title_len = append_string( &ptr, startup->lpTitle ); info->title_len = append_string( &ptr, title );
if (startup->lpDesktop) info->desktop_len = append_string( &ptr, startup->lpDesktop ); if (startup->lpDesktop) info->desktop_len = append_string( &ptr, startup->lpDesktop );
if (startup->lpReserved2 && startup->cbReserved2) if (startup->lpReserved2 && startup->cbReserved2)
{ {
......
...@@ -661,7 +661,7 @@ static void test_Startup(void) ...@@ -661,7 +661,7 @@ static void test_Startup(void)
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
todo_wine okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop);
okChildString("StartupInfoA", "lpTitle", startup.lpTitle); okChildString("StartupInfoA", "lpTitle", startup.lpTitle);
okChildInt("StartupInfoA", "dwX", startup.dwX); okChildInt("StartupInfoA", "dwX", startup.dwX);
okChildInt("StartupInfoA", "dwY", startup.dwY); okChildInt("StartupInfoA", "dwY", startup.dwY);
...@@ -701,8 +701,8 @@ static void test_Startup(void) ...@@ -701,8 +701,8 @@ static void test_Startup(void)
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop);
result = getChildString( "StartupInfoA", "lpTitle" ); result = getChildString( "StartupInfoA", "lpTitle" );
todo_wine ok( broken(!result) || (result && !strCmp( result, selfname, 0 )), ok( broken(!result) || (result && !strCmp( result, selfname, 0 )),
"expected '%s' or null, got '%s'\n", selfname, result ); "expected '%s' or null, got '%s'\n", selfname, result );
okChildInt("StartupInfoA", "dwX", startup.dwX); okChildInt("StartupInfoA", "dwX", startup.dwX);
okChildInt("StartupInfoA", "dwY", startup.dwY); okChildInt("StartupInfoA", "dwY", startup.dwY);
okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); okChildInt("StartupInfoA", "dwXSize", startup.dwXSize);
...@@ -740,7 +740,7 @@ static void test_Startup(void) ...@@ -740,7 +740,7 @@ static void test_Startup(void)
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop);
todo_wine okChildString("StartupInfoA", "lpTitle", startup.lpTitle); okChildString("StartupInfoA", "lpTitle", startup.lpTitle);
okChildInt("StartupInfoA", "dwX", startup.dwX); okChildInt("StartupInfoA", "dwX", startup.dwX);
okChildInt("StartupInfoA", "dwY", startup.dwY); okChildInt("StartupInfoA", "dwY", startup.dwY);
okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); okChildInt("StartupInfoA", "dwXSize", startup.dwXSize);
...@@ -777,8 +777,8 @@ static void test_Startup(void) ...@@ -777,8 +777,8 @@ static void test_Startup(void)
WritePrivateProfileStringA(NULL, NULL, NULL, resfile); WritePrivateProfileStringA(NULL, NULL, NULL, resfile);
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
todo_wine okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop); okChildString("StartupInfoA", "lpDesktop", startup.lpDesktop);
todo_wine okChildString("StartupInfoA", "lpTitle", startup.lpTitle); okChildString("StartupInfoA", "lpTitle", startup.lpTitle);
okChildInt("StartupInfoA", "dwX", startup.dwX); okChildInt("StartupInfoA", "dwX", startup.dwX);
okChildInt("StartupInfoA", "dwY", startup.dwY); okChildInt("StartupInfoA", "dwY", startup.dwY);
okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); okChildInt("StartupInfoA", "dwXSize", startup.dwXSize);
...@@ -1214,8 +1214,8 @@ static void test_SuspendFlag(void) ...@@ -1214,8 +1214,8 @@ static void test_SuspendFlag(void)
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", us.lpDesktop); okChildString("StartupInfoA", "lpDesktop", us.lpDesktop);
result = getChildString( "StartupInfoA", "lpTitle" ); result = getChildString( "StartupInfoA", "lpTitle" );
todo_wine ok( broken(!result) || (result && !strCmp( result, selfname, 0 )), ok( broken(!result) || (result && !strCmp( result, selfname, 0 )),
"expected '%s' or null, got '%s'\n", selfname, result ); "expected '%s' or null, got '%s'\n", selfname, result );
okChildInt("StartupInfoA", "dwX", startup.dwX); okChildInt("StartupInfoA", "dwX", startup.dwX);
okChildInt("StartupInfoA", "dwY", startup.dwY); okChildInt("StartupInfoA", "dwY", startup.dwY);
okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); okChildInt("StartupInfoA", "dwXSize", startup.dwXSize);
...@@ -1276,8 +1276,8 @@ static void test_DebuggingFlag(void) ...@@ -1276,8 +1276,8 @@ static void test_DebuggingFlag(void)
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", us.lpDesktop); okChildString("StartupInfoA", "lpDesktop", us.lpDesktop);
result = getChildString( "StartupInfoA", "lpTitle" ); result = getChildString( "StartupInfoA", "lpTitle" );
todo_wine ok( broken(!result) || (result && !strCmp( result, selfname, 0 )), ok( broken(!result) || (result && !strCmp( result, selfname, 0 )),
"expected '%s' or null, got '%s'\n", selfname, result ); "expected '%s' or null, got '%s'\n", selfname, result );
okChildInt("StartupInfoA", "dwX", startup.dwX); okChildInt("StartupInfoA", "dwX", startup.dwX);
okChildInt("StartupInfoA", "dwY", startup.dwY); okChildInt("StartupInfoA", "dwY", startup.dwY);
okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); okChildInt("StartupInfoA", "dwXSize", startup.dwXSize);
...@@ -1389,8 +1389,8 @@ static void test_Console(void) ...@@ -1389,8 +1389,8 @@ static void test_Console(void)
okChildInt("StartupInfoA", "cb", startup.cb); okChildInt("StartupInfoA", "cb", startup.cb);
okChildString("StartupInfoA", "lpDesktop", us.lpDesktop); okChildString("StartupInfoA", "lpDesktop", us.lpDesktop);
result = getChildString( "StartupInfoA", "lpTitle" ); result = getChildString( "StartupInfoA", "lpTitle" );
todo_wine ok( broken(!result) || (result && !strCmp( result, selfname, 0 )), ok( broken(!result) || (result && !strCmp( result, selfname, 0 )),
"expected '%s' or null, got '%s'\n", selfname, result ); "expected '%s' or null, got '%s'\n", selfname, result );
okChildInt("StartupInfoA", "dwX", startup.dwX); okChildInt("StartupInfoA", "dwX", startup.dwX);
okChildInt("StartupInfoA", "dwY", startup.dwY); okChildInt("StartupInfoA", "dwY", startup.dwY);
okChildInt("StartupInfoA", "dwXSize", startup.dwXSize); okChildInt("StartupInfoA", "dwXSize", startup.dwXSize);
......
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