Index: src/plugin/AdblockPlusClient.cpp |
=================================================================== |
--- a/src/plugin/AdblockPlusClient.cpp |
+++ b/src/plugin/AdblockPlusClient.cpp |
@@ -44,22 +44,32 @@ |
// Running inside AppContainer? |
if (acs != NULL && acs->TokenAppContainer != NULL) |
{ |
- // Launch with default security. Registry entry will eat the user prompt |
+ // We need to break out from AppContainer. Launch with default security - registry entry will eat the user prompt |
// See http://msdn.microsoft.com/en-us/library/bb250462(v=vs.85).aspx#wpm_elebp |
- LPWSTR stringSid; |
- ConvertSidToStringSidW(acs->TokenAppContainer, &stringSid); |
- params.Append(L" "); |
- params.Append(stringSid); |
- LocalFree(stringSid); |
createProcRes = CreateProcessW(engineExecutablePath.c_str(), params.GetBuffer(params.GetLength() + 1), |
0, 0, false, 0, 0, 0, (STARTUPINFOW*)&startupInfo, &processInformation); |
} |
else |
Felix Dahlke
2013/12/10 16:46:36
This happens if the engine is first started from b
Oleksandr
2014/03/04 10:40:05
yes. bing.com (or any other website from the excep
|
{ |
- // Launch with the same security token (Low Integrity) explicitly |
+ // Launch with Low Integrity explicitly |
HANDLE newToken; |
DuplicateTokenEx(token, 0, 0, SecurityImpersonation, TokenPrimary, &newToken); |
+ PSID pIntegritySid = 0; |
Felix Dahlke
2013/12/10 16:46:36
Less Hungarian please :D
|
+ BOOL res = ConvertStringSidToSid(L"S-1-16-4096", &pIntegritySid); |
Felix Dahlke
2013/12/10 16:46:36
Since the return value is ignored, there's no need
|
+ std::tr1::shared_ptr<SID> sharedIntegritySid(static_cast<SID*>(pIntegritySid), FreeSid); // Just to simplify cleanup |
+ |
+ TOKEN_MANDATORY_LABEL tml = {0}; |
Felix Dahlke
2013/12/10 16:46:36
Let's go with {} for consistency's sake.
|
+ tml.Label.Attributes = SE_GROUP_INTEGRITY; |
+ tml.Label.Sid = pIntegritySid; |
+ |
+ // Set the process integrity level |
+ res = SetTokenInformation(newToken, TokenIntegrityLevel, &tml, sizeof(TOKEN_MANDATORY_LABEL) + GetLengthSid(pIntegritySid)); |
Felix Dahlke
2013/12/10 16:46:36
As above, no need to store the return value.
|
+ |
+ STARTUPINFO startupInfo = {}; |
+ PROCESS_INFORMATION processInformation = {}; |
+ BOOL createProcRes = 0; |
Felix Dahlke
2013/12/10 16:46:36
Why redeclare the variable here? This means that w
|
+ |
createProcRes = CreateProcessAsUserW(newToken, engineExecutablePath.c_str(), params.GetBuffer(params.GetLength() + 1), |
0, 0, false, 0, 0, 0, (STARTUPINFOW*)&startupInfo, &processInformation); |
} |