From cde0f703803a6b3849ca342e920b1d663e4541f0 Mon Sep 17 00:00:00 2001 From: Ben Klein Date: Mon, 9 Mar 2009 15:11:00 +1100 Subject: programs/explorer Allow spaces in virtual desktop names via command line /desktop option The stripping of spaces from the start of the command line has been moved to prevent duplication of code in the added lines where cmdline is recalculated. --- programs/explorer/desktop.c | 23 +++++++++++++++++------ 1 files changed, 17 insertions(+), 6 deletions(-) diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index 480d245..7bc76e0 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -264,20 +264,29 @@ void manage_desktop( WCHAR *arg ) WCHAR *p = arg; const WCHAR *name = NULL; - /* get the rest of the command line (if any) */ + /* assume the command line starts after the first space in arg */ while (*p && !isspace(*p)) p++; if (*p) - { - *p++ = 0; - while (*p && isspace(*p)) p++; - if (*p) cmdline = p; - } + cmdline = p; /* parse the desktop option */ /* the option is of the form /desktop=name[,widthxheight] */ if (*arg == '=' || *arg == ',') { arg++; + /* arguments with spaces are surrounded with '"' */ + if ((p = strchrW( arg, '"' ))) + { + /* terminate the end of the desktop name */ + *p = 0; + cmdline = ++p; + } + else if (cmdline) + { + /* cmdline points to the end of the desktop name argument */ + *cmdline++ = 0; + } + name = arg; if ((p = strchrW( arg, ',' ))) *p++ = 0; if (!p || !parse_size( p, &width, &height )) @@ -349,6 +358,8 @@ void manage_desktop( WCHAR *arg ) STARTUPINFOW si; PROCESS_INFORMATION pi; + while (*cmdline && isspace(*cmdline)) cmdline++; + memset( &si, 0, sizeof(si) ); si.cb = sizeof(si); WINE_TRACE( "starting %s\n", wine_dbgstr_w(cmdline) ); -- 1.6.1.3