| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | |
| 4 * | |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | |
| 6 * it under the terms of the GNU General Public License version 3 as | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 1 #include "PluginStdAfx.h" | 18 #include "PluginStdAfx.h" |
| 2 #include "PluginSettings.h" | 19 #include "PluginSettings.h" |
| 3 #include "PluginSystem.h" | 20 #include "PluginSystem.h" |
| 4 #include "PluginFilter.h" | 21 #include "PluginFilter.h" |
| 5 #include "PluginClientFactory.h" | 22 #include "PluginClientFactory.h" |
| 6 #include "PluginMutex.h" | 23 #include "PluginMutex.h" |
| 7 #include "PluginClass.h" | 24 #include "PluginClass.h" |
| 8 | 25 |
| 9 #include "AdblockPlusClient.h" | 26 #include "AdblockPlusClient.h" |
| 10 | 27 |
| 11 #include "../shared/Utils.h" | 28 #include "../shared/Utils.h" |
| 12 | 29 |
| 13 namespace | 30 namespace |
| 14 { | 31 { |
| 15 void SpawnAdblockPlusEngine() | 32 void SpawnAdblockPlusEngine() |
| 16 { | 33 { |
| 17 std::wstring engineExecutablePath = GetDllDir() + L"AdblockPlusEngine.exe"; | 34 std::wstring engineExecutablePath = GetDllDir() + L"AdblockPlusEngine.exe"; |
| 18 CString params = to_CString(L"AdblockPlusEngine.exe " + GetBrowserLanguage() ); | 35 CString params = ToCString(L"AdblockPlusEngine.exe " + GetBrowserLanguage()) ; |
| 19 | 36 |
| 20 STARTUPINFO startupInfo = {}; | 37 STARTUPINFO startupInfo = {}; |
| 21 PROCESS_INFORMATION processInformation = {}; | 38 PROCESS_INFORMATION processInformation = {}; |
| 22 | 39 |
| 23 HANDLE token; | 40 HANDLE token; |
| 24 OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE | TOKEN_ADJUST_DEFAULT | TOKEN_QUERY | TOKEN_ASSIGN_PRIMARY, &token); | 41 OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE | TOKEN_ADJUST_DEFAULT | TOKEN_QUERY | TOKEN_ASSIGN_PRIMARY, &token); |
| 25 | 42 |
| 26 TOKEN_APPCONTAINER_INFORMATION *acs = NULL; | 43 TOKEN_APPCONTAINER_INFORMATION *acs = NULL; |
| 27 DWORD length = 0; | 44 DWORD length = 0; |
| 28 | 45 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 return false; | 300 return false; |
| 284 | 301 |
| 285 bool isWhitelisted; | 302 bool isWhitelisted; |
| 286 response >> isWhitelisted; | 303 response >> isWhitelisted; |
| 287 return isWhitelisted; | 304 return isWhitelisted; |
| 288 } | 305 } |
| 289 | 306 |
| 290 bool CAdblockPlusClient::Matches(const std::wstring& url, AdblockPlus::FilterEng ine::ContentType contentType, const std::wstring& domain) | 307 bool CAdblockPlusClient::Matches(const std::wstring& url, AdblockPlus::FilterEng ine::ContentType contentType, const std::wstring& domain) |
| 291 { | 308 { |
| 292 Communication::OutputBuffer request; | 309 Communication::OutputBuffer request; |
| 293 request << Communication::PROC_MATCHES << ToUtf8String(url) << static_cast<int 32_t>(contentType) << ToUtf8String(domain); | 310 request << Communication::PROC_MATCHES << ToUtf8String(url) << static_cast<int 32_t>(contentType) << ToUtf8String(domain); |
|
Eric
2015/01/13 17:29:36
I still think it would be good to define operator<
sergei
2015/01/28 13:44:45
done.
| |
| 294 | 311 |
| 295 Communication::InputBuffer response; | 312 Communication::InputBuffer response; |
| 296 if (!CallEngine(request, response)) | 313 if (!CallEngine(request, response)) |
| 297 return false; | 314 return false; |
| 298 | 315 |
| 299 bool match; | 316 bool match; |
| 300 response >> match; | 317 response >> match; |
| 301 return match; | 318 return match; |
| 302 } | 319 } |
| 303 | 320 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 DEBUG_GENERAL("CompareVersions"); | 566 DEBUG_GENERAL("CompareVersions"); |
| 550 Communication::OutputBuffer request; | 567 Communication::OutputBuffer request; |
| 551 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2); | 568 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2); |
| 552 Communication::InputBuffer response; | 569 Communication::InputBuffer response; |
| 553 if (!CallEngine(request, response)) | 570 if (!CallEngine(request, response)) |
| 554 return 0; | 571 return 0; |
| 555 int result; | 572 int result; |
| 556 response >> result; | 573 response >> result; |
| 557 return result; | 574 return result; |
| 558 } | 575 } |
| LEFT | RIGHT |