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

This commit is contained in:
Alexandre Julliard 2010-06-08 11:53:58 +02:00
parent e091c12b66
commit 2b99e1c17d
3 changed files with 18 additions and 18 deletions

View File

@ -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;

View File

@ -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,
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,
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)
{ {

View File

@ -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,7 +701,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);
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);
@ -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)
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,7 +1214,7 @@ 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);
@ -1276,7 +1276,7 @@ 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);
@ -1389,7 +1389,7 @@ 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);