Skip to content

Commit b7df9b1

Browse files
committed
Further improve U01 command-line handoff and temp update path matching
1 parent 7eb6aee commit b7df9b1

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

Client/loader/Main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ namespace
4242
ERROR_INSTALL_CONTINUE = -4
4343
};
4444

45-
// Command line constants
46-
constexpr size_t MAX_CMD_LINE_LENGTH = 4096;
45+
// Command line constants. Sized to hold the Windows command-line maximum (CreateProcess limit
46+
// is 32767 wchar_t, see CreateProcessW docs). The auto-update flow serializes the sequencer
47+
// snapshot through this buffer (CInstallManager::_MaybeSwitchToTempExe -> ShellExecuteNonBlocking
48+
// -> Process C lpCmdLine), so a smaller cap silently truncates restored state and breaks the
49+
// INSTALL_ROOT carry that prevents U01 in temp-launched processes.
50+
constexpr size_t MAX_CMD_LINE_LENGTH = 32768;
4751

4852
// Report log IDs
4953
constexpr int LOG_ID_END = 1044;

Client/loader/Utils.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,10 @@ bool IsTemporaryUpdateLaunchPath(const SString& strLaunchPath)
679679
if (!strLaunchPath.ContainsI("\\upcache\\"))
680680
return false;
681681

682-
return ExtractFilename(strLaunchPath).ContainsI("_tmp_");
682+
// The auto-update flow creates the extraction directory in Install.cpp::CheckOnRestartCommand
683+
// as MakeUniquePath("...\\upcache\\_<archiveName>_tmp_"), so the leaf always begins with '_'.
684+
const SString strLeaf = ExtractFilename(strLaunchPath);
685+
return strLeaf.BeginsWith("_") && strLeaf.ContainsI("_tmp_");
683686
}
684687

685688
void SetMTASAPathSource(bool bReadFromRegistry)

Shared/sdk/SharedUtil.Misc.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,10 @@ static bool IsTemporaryUpdateLaunchPath(const SString& strLaunchPath)
405405
if (!strLaunchPath.ContainsI("\\upcache\\"))
406406
return false;
407407

408-
return ExtractFilename(strLaunchPath).ContainsI("_tmp_");
408+
// The auto-update flow creates the extraction directory in Install.cpp::CheckOnRestartCommand
409+
// as MakeUniquePath("...\\upcache\\_<archiveName>_tmp_"), so the leaf always begins with '_'.
410+
const SString strLeaf = ExtractFilename(strLaunchPath);
411+
return strLeaf.BeginsWith("_") && strLeaf.ContainsI("_tmp_");
409412
}
410413

411414
// Read Last Run Location from a specific registry view. viewFlag should be one of

0 commit comments

Comments
 (0)