MCPcopy Create free account
hub / github.com/Project-LemonLime/Project_LemonLime / run

Method run

src/core/processrunner_win.cpp:87–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85} // namespace
86
87ProcessRunnerResult WinProcessRunner::run() {
88 ProcessRunnerResult res;
89 res.result = CorrectAnswer;
90 int extraTime = qCeil(qMax(2000, config.timeLimit * 2) * config.extraTimeRatio);
91
92 SetErrorMode(SEM_NOGPFAULTERRORBOX);
93 STARTUPINFOEX siex;
94 PROCESS_INFORMATION pi;
95 SECURITY_ATTRIBUTES sa;
96 ZeroMemory(&siex, sizeof(siex));
97 siex.StartupInfo.cb = sizeof(siex);
98 siex.StartupInfo.dwFlags = STARTF_USESTDHANDLES;
99 ZeroMemory(&pi, sizeof(pi));
100 ZeroMemory(&sa, sizeof(sa));
101 sa.bInheritHandle = TRUE;
102
103 PSID appContainerSID{nullptr};
104 QString appContainerName = "Lemonlime" + getRandomString(10);
105
106#ifdef WINDOWS_APPCONTAINER_SUPPORT
107 // Create Window App Container (Windows 8+)
108
109 auto hResult = CreateAppContainerProfile((const WCHAR *)(appContainerName.utf16()),
110 (const WCHAR *)(appContainerName.utf16()),
111 (const WCHAR *)(appContainerName.utf16()), nullptr, 0,
112 &appContainerSID); // Without any Permissions
113
114 if (hResult != S_OK) {
115 res.score = 0;
116 res.result = CannotStartProgram;
117 res.message = "Failed to create app container";
118 WARN("Failed to create app container");
119 switch (hResult) {
120 case E_ACCESSDENIED:
121 WARN("Possible error: Access Denied");
122 break;
123 case HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS):
124 WARN("Possible error:", appContainerName, "Already Exists");
125 break;
126 case E_INVALIDARG:
127 WARN("Possible error: Invalid Args, Please Report Bugs");
128 break;
129 default:
130 WARN("Unknown error");
131 }
132 return res;
133 }
134
135 auto cleanupContainer = qScopeGuard([&] {
136 FreeSid(appContainerSID);
137 DeleteAppContainerProfile((const WCHAR *)(appContainerName.utf16()));
138 });
139
140 SECURITY_CAPABILITIES sc;
141 ZeroMemory(&sc, sizeof(sc));
142
143 sc.AppContainerSid = appContainerSID;
144

Callers

nothing calls this directly

Calls 3

getRandomStringFunction · 0.85
startMethod · 0.80

Tested by

no test coverage detected