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

Side by Side Diff: src/plugin/AdblockPlusClient.cpp

Issue 5171515343503360: Issue #41 - Bring method of determining IE version up to date (Closed)
Patch Set: Created June 21, 2014, 8:25 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 #include "PluginSettings.h" 2 #include "PluginSettings.h"
3 #include "PluginSystem.h" 3 #include "PluginSystem.h"
4 #include "PluginFilter.h" 4 #include "PluginFilter.h"
5 #include "PluginClientFactory.h" 5 #include "PluginClientFactory.h"
6 #include "PluginMutex.h" 6 #include "PluginMutex.h"
7 #include "PluginClass.h" 7 #include "PluginClass.h"
8 8
9 #include "AdblockPlusClient.h" 9 #include "AdblockPlusClient.h"
10 10
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (!CallEngine(request, response)) 313 if (!CallEngine(request, response))
314 return false; 314 return false;
315 315
316 bool isWhitelisted; 316 bool isWhitelisted;
317 response >> isWhitelisted; 317 response >> isWhitelisted;
318 318
319 DEBUG_GENERAL(L"IsWhitelistedUrl: " + url + L" end"); 319 DEBUG_GENERAL(L"IsWhitelistedUrl: " + url + L" end");
320 return isWhitelisted; 320 return isWhitelisted;
321 } 321 }
322 322
323 int CAdblockPlusClient::GetIEVersion()
324 {
325 //HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
326 HKEY hKey;
327 LSTATUS status = RegOpenKey(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Interne t Explorer", &hKey);
328 if (status != 0)
329 {
330 return 0;
331 }
332 DWORD type, cbData;
333 BYTE version[50];
334 cbData = 50;
335 status = RegQueryValueEx(hKey, L"Version", NULL, &type, (BYTE*)version, &cbDat a);
336 if (status != 0)
337 {
338 return 0;
339 }
340 RegCloseKey(hKey);
341 return (int)(version[0] - 48);
342 }
343
344 bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& co ntentType, const std::wstring& domain) 323 bool CAdblockPlusClient::Matches(const std::wstring& url, const std::wstring& co ntentType, const std::wstring& domain)
345 { 324 {
346 Communication::OutputBuffer request; 325 Communication::OutputBuffer request;
347 request << Communication::PROC_MATCHES << ToUtf8String(url) << ToUtf8String(co ntentType) << ToUtf8String(domain); 326 request << Communication::PROC_MATCHES << ToUtf8String(url) << ToUtf8String(co ntentType) << ToUtf8String(domain);
348 327
349 Communication::InputBuffer response; 328 Communication::InputBuffer response;
350 if (!CallEngine(request, response)) 329 if (!CallEngine(request, response))
351 return false; 330 return false;
352 331
353 bool match; 332 bool match;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 Communication::OutputBuffer request; 537 Communication::OutputBuffer request;
559 request << Communication::PROC_GET_HOST << ToUtf8String(url); 538 request << Communication::PROC_GET_HOST << ToUtf8String(url);
560 539
561 Communication::InputBuffer response; 540 Communication::InputBuffer response;
562 if (!CallEngine(request, response)) 541 if (!CallEngine(request, response))
563 return L""; 542 return L"";
564 std::string host; 543 std::string host;
565 response >> host; 544 response >> host;
566 return ToUtf16String(host); 545 return ToUtf16String(host);
567 } 546 }
OLDNEW

Powered by Google App Engine
This is Rietveld