# HG changeset patch # User Andre Heinecke # Date 1411048009 -7200 # Node ID 0ddb173bcd8bdb8738e0ef5dc16992fc01dfe89d # Parent ffdc8cba139a8adf7ddf4caf857c1e2dcbd2098d (issue36) Use 8 bit encoding for cinst process start diff -r ffdc8cba139a -r 0ddb173bcd8b ui/installwrapper.cpp --- a/ui/installwrapper.cpp Thu Sep 18 15:43:48 2014 +0200 +++ b/ui/installwrapper.cpp Thu Sep 18 15:46:49 2014 +0200 @@ -97,9 +97,9 @@ * and not a pipe for communication. In debug mode the installer * also makes use of output debug string. */ DWORD retval = 0; - SHELLEXECUTEINFOW shExecInfo; + SHELLEXECUTEINFOA shExecInfo; - memset (&shExecInfo, 0, sizeof(SHELLEXECUTEINFOW)); + memset (&shExecInfo, 0, sizeof(SHELLEXECUTEINFOA)); /* Windows needs each parameter packed in " */ QString parameters = "\"list=" + mCertListFile + @@ -109,29 +109,36 @@ parameters += " --debug"; } - shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW); + shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOA); shExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; if (!is_system_install()) { - shExecInfo.lpVerb = L"open"; + shExecInfo.lpVerb = "open"; } else { - shExecInfo.lpVerb = L"runas"; + shExecInfo.lpVerb = "runas"; } - shExecInfo.lpFile = reinterpret_cast (cinstFileName.utf16()); - shExecInfo.lpParameters = reinterpret_cast (parameters.utf16()); + shExecInfo.lpFile = strdup(cinstFileName.toLocal8Bit().constData()); + shExecInfo.lpParameters = strdup(parameters.toUtf8().constData()); qDebug() << "Starting process " << cinstFileName <<" params: " << parameters; - if (!ShellExecuteExW(&shExecInfo)) { + if (!ShellExecuteExA(&shExecInfo)) { char* errmsg = getLastErrorMsg(); QString qerrmsg = QString::fromUtf8(errmsg); free(errmsg); emit error(tr("Error executing process: %1").arg(qerrmsg)); fclose(vres.fptr); + free((void*)shExecInfo.lpFile); + free((void*)shExecInfo.lpParameters); return; } retval = WaitForSingleObject(shExecInfo.hProcess, INSTALL_TIMEOUT); + free((void*)shExecInfo.lpFile); + free((void*)shExecInfo.lpParameters); + shExecInfo.lpFile = NULL; + shExecInfo.lpParameters = NULL; + if (retval != WAIT_OBJECT_0) { if (retval == WAIT_FAILED) { char* errmsg = getLastErrorMsg();