Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/plugin/AdblockPlusClient.cpp

Issue 5447868882092032: Issue 1793 - check whether the frame is whitelisted before injecting CSS (Closed)
Left Patch Set: update Created Jan. 13, 2015, 3:20 p.m.
Right Patch Set: rebase and rename webBrowser to parentBrowser Created Nov. 30, 2015, 3:27 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/plugin/AdblockPlusClient.h ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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"
19 #include "AdblockPlusClient.h"
2 #include "PluginSettings.h" 20 #include "PluginSettings.h"
3 #include "PluginSystem.h" 21 #include "PluginSystem.h"
4 #include "PluginFilter.h" 22 #include "PluginFilter.h"
5 #include "PluginClientFactory.h"
6 #include "PluginMutex.h" 23 #include "PluginMutex.h"
7 #include "PluginClass.h" 24 #include "PluginClass.h"
8
9 #include "AdblockPlusClient.h"
10
11 #include "../shared/Utils.h" 25 #include "../shared/Utils.h"
12 26
13 namespace 27 namespace
14 { 28 {
29 class ScopedProcessInformation : public PROCESS_INFORMATION {
30 public:
31 ScopedProcessInformation()
32 {
33 hProcess = hThread = 0;
34 dwProcessId = dwThreadId = 0;
35 }
36 ~ScopedProcessInformation()
37 {
38 if (hThread != nullptr)
39 {
40 CloseHandle(hThread);
41 }
42 if (hProcess != nullptr)
43 {
44 CloseHandle(hProcess);
45 }
46 }
47 };
48
15 void SpawnAdblockPlusEngine() 49 void SpawnAdblockPlusEngine()
16 { 50 {
17 std::wstring engineExecutablePath = GetDllDir() + L"AdblockPlusEngine.exe"; 51 std::wstring engineExecutablePath = GetDllDir() + L"AdblockPlusEngine.exe";
18 CString params = to_CString(L"AdblockPlusEngine.exe " + GetBrowserLanguage() ); 52 std::wstring params = L"AdblockPlusEngine.exe " + GetBrowserLanguage();
19 53
20 STARTUPINFO startupInfo = {}; 54 STARTUPINFO startupInfo = {};
21 PROCESS_INFORMATION processInformation = {}; 55 ScopedProcessInformation processInformation;
22 56
23 HANDLE token; 57 // We need to break out from AppContainer. Launch with default security - re gistry entry will eat the user prompt
24 OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE | TOKEN_ADJUST_DEFAULT | TOKEN_QUERY | TOKEN_ASSIGN_PRIMARY, &token); 58 // See http://msdn.microsoft.com/en-us/library/bb250462(v=vs.85).aspx#wpm_el ebp
25 59 BOOL createProcRes = CreateProcessW(engineExecutablePath.c_str(), &params[0] ,
26 TOKEN_APPCONTAINER_INFORMATION *acs = NULL; 60 0, 0, false, 0, 0, 0, &startupInfo, &processInformation);
27 DWORD length = 0;
28
29 // Get AppContainer SID
30 if (!GetTokenInformation(token, TokenAppContainerSid, acs, 0, &length) && Ge tLastError() == ERROR_INSUFFICIENT_BUFFER)
31 {
32 acs = (TOKEN_APPCONTAINER_INFORMATION*) HeapAlloc(GetProcessHeap(), HEAP _ZERO_MEMORY, length);
33 if (acs != NULL)
34 {
35 GetTokenInformation(token, TokenAppContainerSid, acs, length, &length) ;
36 }
37 else
38 {
39 throw std::runtime_error("Out of memory");
40 }
41 }
42
43 BOOL createProcRes = 0;
44 // Running inside AppContainer or in Windows XP
45 if ((acs != NULL && acs->TokenAppContainer != NULL) || !IsWindowsVistaOrLate r())
46 {
47 // We need to break out from AppContainer. Launch with default security - registry entry will eat the user prompt
48 // See http://msdn.microsoft.com/en-us/library/bb250462(v=vs.85).aspx#wpm_ elebp
49 createProcRes = CreateProcessW(engineExecutablePath.c_str(), params.GetBuf fer(params.GetLength() + 1),
50 0, 0, false, 0, 0, 0, (STARTUPINFOW*)&startupInfo, &processInformation);
51 }
52 else
53 {
54 // Launch with Low Integrity explicitly
55 HANDLE newToken;
56 DuplicateTokenEx(token, 0, 0, SecurityImpersonation, TokenPrimary, &newTok en);
57
58 PSID integritySid = 0;
59 ConvertStringSidToSid(L"S-1-16-4096", &integritySid);
60 std::tr1::shared_ptr<SID> sharedIntegritySid(static_cast<SID*>(integritySi d), FreeSid); // Just to simplify cleanup
61
62 TOKEN_MANDATORY_LABEL tml = {};
63 tml.Label.Attributes = SE_GROUP_INTEGRITY;
64 tml.Label.Sid = integritySid;
65
66 // Set the process integrity level
67 SetTokenInformation(newToken, TokenIntegrityLevel, &tml, sizeof(tml));
68
69 STARTUPINFO startupInfo = {};
70 PROCESS_INFORMATION processInformation = {};
71
72 createProcRes = CreateProcessAsUserW(newToken, engineExecutablePath.c_str( ), params.GetBuffer(params.GetLength() + 1),
73 0, 0, false, 0, 0, 0, (STARTUPINFOW*)&startupInfo, &processInformation);
74 }
75
76 if (!createProcRes) 61 if (!createProcRes)
77 { 62 {
78 throw std::runtime_error("Failed to start Adblock Plus Engine"); 63 throw std::runtime_error("Failed to start Adblock Plus Engine");
79 } 64 }
80
81 CloseHandle(processInformation.hProcess);
82 CloseHandle(processInformation.hThread);
83 } 65 }
84 66
85 Communication::Pipe* OpenEnginePipe() 67 Communication::Pipe* OpenEnginePipe()
86 { 68 {
87 try 69 try
88 { 70 {
89 return new Communication::Pipe(Communication::pipeName, Communication::Pip e::MODE_CONNECT); 71 return new Communication::Pipe(Communication::pipeName, Communication::Pip e::MODE_CONNECT);
90 } 72 }
91 catch (Communication::PipeConnectionError e) 73 catch (Communication::PipeConnectionError e)
92 { 74 {
93 SpawnAdblockPlusEngine(); 75 SpawnAdblockPlusEngine();
94 76
95 const int step = 100; 77 const int step = 100;
96 for (int timeout = ENGINE_STARTUP_TIMEOUT; timeout > 0; timeout -= step) 78 for (int timeout = ENGINE_STARTUP_TIMEOUT; timeout > 0; timeout -= step)
97 { 79 {
98 Sleep(step); 80 Sleep(step);
99 try 81 try
100 { 82 {
101 return new Communication::Pipe(Communication::pipeName, Communication: :Pipe::MODE_CONNECT); 83 return new Communication::Pipe(Communication::pipeName, Communication: :Pipe::MODE_CONNECT);
102 } 84 }
103 catch (Communication::PipeConnectionError e) 85 catch (Communication::PipeConnectionError e)
104 { 86 {
105 } 87 }
106 } 88 }
107 throw std::runtime_error("Unable to open Adblock Plus Engine pipe"); 89 throw std::runtime_error("Unable to open Adblock Plus Engine pipe");
108 } 90 }
109 } 91 }
110 92
111 std::vector<std::wstring> ReadStrings(Communication::InputBuffer& message)
112 {
113 int32_t count;
114 message >> count;
115
116 std::vector<std::wstring> result;
117 for (int32_t i = 0; i < count; i++)
118 {
119 std::string str;
120 message >> str;
121 result.push_back(ToUtf16String(str));
122 }
123 return result;
124 }
125
126 std::vector<SubscriptionDescription> ReadSubscriptions(Communication::InputBuf fer& message) 93 std::vector<SubscriptionDescription> ReadSubscriptions(Communication::InputBuf fer& message)
127 { 94 {
128 int32_t count; 95 int32_t count;
129 message >> count; 96 message >> count;
130 97
131 std::vector<SubscriptionDescription> result; 98 std::vector<SubscriptionDescription> result;
132 for (int32_t i = 0; i < count; i++) 99 for (int32_t i = 0; i < count; i++)
133 { 100 {
134 SubscriptionDescription description; 101 SubscriptionDescription description;
135 std::string url; 102 std::string url;
136 message >> url; 103 message >> url;
137 description.url = ToUtf16String(url); 104 description.url = ToUtf16String(url);
138 std::string title; 105 std::string title;
139 message >> title; 106 message >> title;
140 description.title = ToUtf16String(title); 107 description.title = ToUtf16String(title);
141 std::string specialization; 108 std::string specialization;
142 message >> specialization; 109 message >> specialization;
143 description.specialization = ToUtf16String(specialization); 110 description.specialization = ToUtf16String(specialization);
144 message >> description.listed; 111 message >> description.listed;
145 result.push_back(description); 112 result.push_back(description);
146 } 113 }
147 return result; 114 return result;
148 } 115 }
149 } 116 }
150 117
151 CAdblockPlusClient* CAdblockPlusClient::s_instance = NULL; 118 CAdblockPlusClient* CAdblockPlusClient::s_instance = NULL;
152 119 CComAutoCriticalSection CAdblockPlusClient::s_criticalSectionLocal;
153 CAdblockPlusClient::CAdblockPlusClient() : CPluginClientBase() 120
121 CAdblockPlusClient::CAdblockPlusClient()
154 { 122 {
155 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter()); 123 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter());
156 } 124 }
157 125
158 bool CAdblockPlusClient::CallEngine(Communication::OutputBuffer& message, Commun ication::InputBuffer& inputBuffer) 126 bool CAdblockPlusClient::CallEngine(Communication::OutputBuffer& message, Commun ication::InputBuffer& inputBuffer)
159 { 127 {
160 DEBUG_GENERAL("CallEngine start"); 128 DEBUG_GENERAL("CallEngine start");
161 CriticalSection::Lock lock(enginePipeLock); 129 CriticalSection::Lock lock(enginePipeLock);
162 try 130 try
163 { 131 {
164 if (!enginePipe) 132 if (!enginePipe)
165 enginePipe.reset(OpenEnginePipe()); 133 enginePipe.reset(OpenEnginePipe());
166 enginePipe->WriteMessage(message); 134 enginePipe->WriteMessage(message);
167 inputBuffer = enginePipe->ReadMessage(); 135 inputBuffer = enginePipe->ReadMessage();
168 } 136 }
169 catch (const std::exception& e) 137 catch (const std::exception& ex)
170 { 138 {
171 DEBUG_GENERAL(e.what()); 139 DEBUG_EXCEPTION(ex);
172 return false; 140 return false;
173 } 141 }
174 DEBUG_GENERAL("CallEngine end"); 142 DEBUG_GENERAL("CallEngine end");
175 return true; 143 return true;
176 } 144 }
177 145
178 bool CAdblockPlusClient::CallEngine(Communication::ProcType proc, Communication: :InputBuffer& inputBuffer) 146 bool CAdblockPlusClient::CallEngine(Communication::ProcType proc, Communication: :InputBuffer& inputBuffer)
179 { 147 {
180 Communication::OutputBuffer message; 148 Communication::OutputBuffer message;
181 message << proc; 149 message << proc;
(...skipping 19 matching lines...) Expand all
201 s_instance = client; 169 s_instance = client;
202 } 170 }
203 171
204 instance = s_instance; 172 instance = s_instance;
205 } 173 }
206 s_criticalSectionLocal.Unlock(); 174 s_criticalSectionLocal.Unlock();
207 175
208 return instance; 176 return instance;
209 } 177 }
210 178
211 bool CAdblockPlusClient::ShouldBlock(const std::wstring& src, int contentType, c onst std::wstring& domain, bool addDebug) 179 bool CAdblockPlusClient::ShouldBlock(const std::wstring& src, AdblockPlus::Filte rEngine::ContentType contentType, const std::wstring& domain, bool addDebug)
212 { 180 {
213 bool isBlocked = false; 181 bool isBlocked = false;
214 bool isCached = false; 182 bool isCached = false;
215 m_criticalSectionCache.Lock(); 183 m_criticalSectionCache.Lock();
216 { 184 {
217 auto it = m_cacheBlockedSources.find(src); 185 auto it = m_cacheBlockedSources.find(src);
218 186
219 isCached = it != m_cacheBlockedSources.end(); 187 isCached = it != m_cacheBlockedSources.end();
220 if (isCached) 188 if (isCached)
221 { 189 {
222 isBlocked = it->second; 190 isBlocked = it->second;
223 } 191 }
224 } 192 }
225 m_criticalSectionCache.Unlock(); 193 m_criticalSectionCache.Unlock();
226 194
227 if (!isCached) 195 if (!isCached)
228 { 196 {
229 m_criticalSectionFilter.Lock(); 197 m_criticalSectionFilter.Lock();
230 { 198 {
231 isBlocked = m_filter->ShouldBlock(src, contentType, domain, addDebug); 199 isBlocked = m_filter->ShouldBlock(src, contentType, domain, addDebug);
232 } 200 }
233 m_criticalSectionFilter.Unlock(); 201 m_criticalSectionFilter.Unlock();
234 202
235 // Cache result, if content type is defined 203 // Cache result, if content type is defined
236 if (contentType != CFilter::contentTypeAny) 204 if (contentType != AdblockPlus::FilterEngine::ContentType::CONTENT_TYPE_OTHE R)
237 { 205 {
238 m_criticalSectionCache.Lock(); 206 m_criticalSectionCache.Lock();
239 { 207 {
240 m_cacheBlockedSources[src] = isBlocked; 208 m_cacheBlockedSources[src] = isBlocked;
241 } 209 }
242 m_criticalSectionCache.Unlock(); 210 m_criticalSectionCache.Unlock();
243 } 211 }
244 } 212 }
245 return isBlocked; 213 return isBlocked;
246 } 214 }
247 215
248 bool CAdblockPlusClient::IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::wstring& domain, const std::wstring& indent, CPluginFilter* filt er) 216 bool CAdblockPlusClient::IsElementHidden(const std::wstring& tag, IHTMLElement* pEl, const std::wstring& domain, const std::wstring& indent, CPluginFilter* filt er)
249 { 217 {
250 bool isHidden; 218 bool isHidden;
251 m_criticalSectionFilter.Lock(); 219 m_criticalSectionFilter.Lock();
252 { 220 {
253 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent); 221 isHidden = filter && filter->IsElementHidden(tag, pEl, domain, indent);
254 } 222 }
255 m_criticalSectionFilter.Unlock(); 223 m_criticalSectionFilter.Unlock();
256 return isHidden; 224 return isHidden;
257 } 225 }
258 226
259 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url, const std::ve ctor<std::string>& frameHierarchy) 227 bool CAdblockPlusClient::IsWhitelistedUrl(const std::wstring& url, const std::ve ctor<std::string>& frameHierarchy)
260 { 228 {
229 return !GetWhitelistingFilter(url, frameHierarchy).empty();
230 }
231
232 std::string CAdblockPlusClient::GetWhitelistingFilter(const std::wstring& url, c onst std::vector<std::string>& frameHierarchy)
233 {
261 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str()); 234 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" start").c_str());
262 Communication::OutputBuffer request; 235 Communication::OutputBuffer request;
263 request << Communication::PROC_IS_WHITELISTED_URL << ToUtf8String(url) << fram eHierarchy; 236 request << Communication::PROC_GET_WHITELISTING_FITER << ToUtf8String(url) << frameHierarchy;
264 237
265 Communication::InputBuffer response; 238 Communication::InputBuffer response;
266 if (!CallEngine(request, response)) 239 if (!CallEngine(request, response))
267 return false; 240 return "";
268 241
269 bool isWhitelisted; 242 std::string filterText;
270 response >> isWhitelisted; 243 response >> filterText;
271 244
272 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str()); 245 DEBUG_GENERAL((L"IsWhitelistedUrl: " + url + L" end").c_str());
273 return isWhitelisted; 246 return filterText;
274 } 247 }
275 248
276 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url, const std::vector<std::string>& frameHierarchy) 249 bool CAdblockPlusClient::IsElemhideWhitelistedOnDomain(const std::wstring& url, const std::vector<std::string>& frameHierarchy)
277 { 250 {
278 Communication::OutputBuffer request; 251 Communication::OutputBuffer request;
279 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String( url) << frameHierarchy; 252 request << Communication::PROC_IS_ELEMHIDE_WHITELISTED_ON_URL << ToUtf8String( url) << frameHierarchy;
280 253
281 Communication::InputBuffer response; 254 Communication::InputBuffer response;
282 if (!CallEngine(request, response)) 255 if (!CallEngine(request, response))
283 return false; 256 return false;
284 257
285 bool isWhitelisted; 258 bool isWhitelisted;
286 response >> isWhitelisted; 259 response >> isWhitelisted;
287 return isWhitelisted; 260 return isWhitelisted;
288 } 261 }
289 262
290 bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& co ntentType, const std::wstring& domain) 263 bool CAdblockPlusClient::Matches(const std::wstring& url, AdblockPlus::FilterEng ine::ContentType contentType, const std::wstring& domain)
291 { 264 {
292 Communication::OutputBuffer request; 265 Communication::OutputBuffer request;
293 request << Communication::PROC_MATCHES << ToUtf8String(url) << ToUtf8String(co ntentType) << ToUtf8String(domain); 266 request << Communication::PROC_MATCHES << ToUtf8String(url) << static_cast<int 32_t>(contentType) << ToUtf8String(domain);
294 267
295 Communication::InputBuffer response; 268 Communication::InputBuffer response;
296 if (!CallEngine(request, response)) 269 if (!CallEngine(request, response))
297 return false; 270 return false;
298 271
299 bool match; 272 bool match;
300 response >> match; 273 response >> match;
301 return match; 274 return match;
302 } 275 }
303 276
304 std::vector<std::wstring> CAdblockPlusClient::GetElementHidingSelectors(const st d::wstring& domain) 277 std::vector<std::wstring> CAdblockPlusClient::GetElementHidingSelectors(const st d::wstring& domain)
305 { 278 {
306 Communication::OutputBuffer request; 279 Communication::OutputBuffer request;
307 request << Communication::PROC_GET_ELEMHIDE_SELECTORS << ToUtf8String(domain); 280 request << Communication::PROC_GET_ELEMHIDE_SELECTORS << ToUtf8String(domain);
308 281
309 Communication::InputBuffer response; 282 Communication::InputBuffer response;
310 if (!CallEngine(request, response)) 283 if (!CallEngine(request, response))
311 return std::vector<std::wstring>(); 284 return std::vector<std::wstring>();
312 return ReadStrings(response); 285
286 std::vector<std::string> selectors;
287 response >> selectors;
288 return ToUtf16Strings(selectors);
313 } 289 }
314 290
315 std::vector<SubscriptionDescription> CAdblockPlusClient::FetchAvailableSubscript ions() 291 std::vector<SubscriptionDescription> CAdblockPlusClient::FetchAvailableSubscript ions()
316 { 292 {
317 Communication::InputBuffer response; 293 Communication::InputBuffer response;
318 if (!CallEngine(Communication::PROC_AVAILABLE_SUBSCRIPTIONS, response)) 294 if (!CallEngine(Communication::PROC_AVAILABLE_SUBSCRIPTIONS, response))
319 return std::vector<SubscriptionDescription>(); 295 return std::vector<SubscriptionDescription>();
320 return ReadSubscriptions(response); 296 return ReadSubscriptions(response);
321 } 297 }
322 298
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 void CAdblockPlusClient::UpdateAllSubscriptions() 344 void CAdblockPlusClient::UpdateAllSubscriptions()
369 { 345 {
370 CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS); 346 CallEngine(Communication::PROC_UPDATE_ALL_SUBSCRIPTIONS);
371 } 347 }
372 348
373 std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains() 349 std::vector<std::wstring> CAdblockPlusClient::GetExceptionDomains()
374 { 350 {
375 Communication::InputBuffer response; 351 Communication::InputBuffer response;
376 if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response)) 352 if (!CallEngine(Communication::PROC_GET_EXCEPTION_DOMAINS, response))
377 return std::vector<std::wstring>(); 353 return std::vector<std::wstring>();
378 return ReadStrings(response); 354
355 std::vector<std::string> domains;
356 response >> domains;
357 return ToUtf16Strings(domains);
379 } 358 }
380 359
381 bool CAdblockPlusClient::IsFirstRun() 360 bool CAdblockPlusClient::IsFirstRun()
382 { 361 {
383 DEBUG_GENERAL("IsFirstRun"); 362 DEBUG_GENERAL("IsFirstRun");
384 Communication::InputBuffer response; 363 Communication::InputBuffer response;
385 if (!CallEngine(Communication::PROC_IS_FIRST_RUN_ACTION_NEEDED, response)) ret urn false; 364 if (!CallEngine(Communication::PROC_IS_FIRST_RUN_ACTION_NEEDED, response)) ret urn false;
386 bool res; 365 bool res;
387 response >> res; 366 response >> res;
388 return res; 367 return res;
389 } 368 }
390 369
391 void CAdblockPlusClient::AddFilter(const std::wstring& text) 370 void CAdblockPlusClient::AddFilter(const std::wstring& text)
392 { 371 {
393 Communication::OutputBuffer request; 372 Communication::OutputBuffer request;
394 request << Communication::PROC_ADD_FILTER << ToUtf8String(text); 373 request << Communication::PROC_ADD_FILTER << ToUtf8String(text);
395 CallEngine(request); 374 CallEngine(request);
396 } 375 }
397 376
398 void CAdblockPlusClient::RemoveFilter(const std::wstring& text) 377 void CAdblockPlusClient::RemoveFilter(const std::wstring& text)
399 { 378 {
400 Communication::OutputBuffer request; 379 RemoveFilter(ToUtf8String(text));
401 request << Communication::PROC_REMOVE_FILTER << ToUtf8String(text); 380 }
381
382 void CAdblockPlusClient::RemoveFilter(const std::string& text)
383 {
384 Communication::OutputBuffer request;
385 request << Communication::PROC_REMOVE_FILTER << text;
402 CallEngine(request); 386 CallEngine(request);
403 } 387 }
404 388
405 void CAdblockPlusClient::SetPref(const std::wstring& name, const std::wstring& v alue) 389 void CAdblockPlusClient::SetPref(const std::wstring& name, const std::wstring& v alue)
406 { 390 {
407 Communication::OutputBuffer request; 391 Communication::OutputBuffer request;
408 request << Communication::PROC_SET_PREF << ToUtf8String(name) << ToUtf8String( value); 392 request << Communication::PROC_SET_PREF << ToUtf8String(name) << ToUtf8String( value);
409 CallEngine(request); 393 CallEngine(request);
410 } 394 }
411 395
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 DEBUG_GENERAL("CompareVersions"); 533 DEBUG_GENERAL("CompareVersions");
550 Communication::OutputBuffer request; 534 Communication::OutputBuffer request;
551 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2); 535 request << Communication::PROC_COMPARE_VERSIONS << ToUtf8String(v1) << ToUtf8S tring(v2);
552 Communication::InputBuffer response; 536 Communication::InputBuffer response;
553 if (!CallEngine(request, response)) 537 if (!CallEngine(request, response))
554 return 0; 538 return 0;
555 int result; 539 int result;
556 response >> result; 540 response >> result;
557 return result; 541 return result;
558 } 542 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld