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