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

Unified Diff: src/plugin/AdblockPlusClient.cpp

Issue 10783032: Pass browser locale to the JS code (Closed)
Patch Set: Created June 4, 2013, 8:57 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/engine/main.cpp ('K') | « src/engine/main.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/AdblockPlusClient.cpp
===================================================================
--- a/src/plugin/AdblockPlusClient.cpp
+++ b/src/plugin/AdblockPlusClient.cpp
@@ -15,26 +15,28 @@
#include "../shared/AutoHandle.h"
#include "../shared/Communication.h"
namespace
{
void SpawnAdblockPlusEngine()
{
std::wstring engineExecutablePath = DllDir() + L"AdblockPlusEngine.exe";
+ CString browserLanguage = CPluginSystem::GetInstance()->GetBrowserLanguage();
STARTUPINFO startupInfo = {};
PROCESS_INFORMATION processInformation = {};
HANDLE token;
OpenProcessToken(GetCurrentProcess(), TOKEN_DUPLICATE | TOKEN_ADJUST_DEFAULT | TOKEN_QUERY | TOKEN_ASSIGN_PRIMARY, &token);
HANDLE newToken;
DuplicateTokenEx(token, 0, 0, SecurityImpersonation, TokenPrimary, &newToken);
- if (!CreateProcessAsUser(newToken, 0, const_cast<wchar_t*>(engineExecutablePath.c_str()), 0, 0, 0, 0, 0, 0,
- &startupInfo, &processInformation))
+ if (!CreateProcessAsUserW(newToken, engineExecutablePath.c_str(),
+ browserLanguage.GetBuffer(browserLanguage.GetLength() + 1),
Felix Dahlke 2013/06/04 09:46:09 I'd prefer const_cast<LPWSTR>(browserLanguage.c_st
Wladimir Palant 2013/06/04 11:28:45 No, it doesn't do the same thing (besides, browser
Felix Dahlke 2013/06/04 11:34:20 Oh, tought it had c_str() or some equivalent. Well
+ 0, 0, 0, 0, 0, 0, &startupInfo, &processInformation))
{
DWORD error = GetLastError();
throw std::runtime_error("Failed to start Adblock Plus Engine");
}
CloseHandle(processInformation.hProcess);
CloseHandle(processInformation.hThread);
}
« src/engine/main.cpp ('K') | « src/engine/main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld