OLD | NEW |
1 #include <AdblockPlus.h> | 1 #include <AdblockPlus.h> |
2 #include <functional> | 2 #include <functional> |
3 #include <vector> | 3 #include <vector> |
4 #include <Windows.h> | 4 #include <Windows.h> |
5 | 5 |
6 #include "../shared/AutoHandle.h" | 6 #include "../shared/AutoHandle.h" |
7 #include "../shared/Communication.h" | 7 #include "../shared/Communication.h" |
8 #include "../shared/Dictionary.h" | 8 #include "../shared/Dictionary.h" |
9 #include "../shared/Utils.h" | 9 #include "../shared/Utils.h" |
10 #include "../shared/Version.h" | 10 #include "../shared/Version.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 if (GetLastError() == ERROR_ALREADY_EXISTS) | 378 if (GetLastError() == ERROR_ALREADY_EXISTS) |
379 { | 379 { |
380 DebugLastError("Named pipe exists, another engine instance appears to be run
ning"); | 380 DebugLastError("Named pipe exists, another engine instance appears to be run
ning"); |
381 return 1; | 381 return 1; |
382 } | 382 } |
383 | 383 |
384 int argc; | 384 int argc; |
385 LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); | 385 LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); |
386 std::wstring locale(argc >= 2 ? argv[1] : L""); | 386 std::wstring locale(argc >= 2 ? argv[1] : L""); |
| 387 Communication::browserSID = argc >= 3 ? argv[2] : L""; |
387 LocalFree(argv); | 388 LocalFree(argv); |
388 Dictionary::Create(locale); | 389 Dictionary::Create(locale); |
389 filterEngine = CreateFilterEngine(locale); | 390 filterEngine = CreateFilterEngine(locale); |
390 updater.reset(new Updater(filterEngine->GetJsEngine())); | 391 updater.reset(new Updater(filterEngine->GetJsEngine())); |
391 | 392 |
392 for (;;) | 393 for (;;) |
393 { | 394 { |
394 try | 395 try |
395 { | 396 { |
396 Communication::Pipe* pipe = new Communication::Pipe(Communication::pipeNam
e, | 397 Communication::Pipe* pipe = new Communication::Pipe(Communication::pipeNam
e, |
397 Communication::Pipe::MODE_CREATE); | 398 Communication::Pipe::MODE_CREATE); |
398 | 399 |
399 AutoHandle thread(CreateThread(0, 0, ClientThread, static_cast<LPVOID>(pip
e), 0, 0)); | 400 AutoHandle thread(CreateThread(0, 0, ClientThread, static_cast<LPVOID>(pip
e), 0, 0)); |
400 if (!thread) | 401 if (!thread) |
401 { | 402 { |
402 delete pipe; | 403 delete pipe; |
403 DebugLastError("CreateThread failed"); | 404 DebugLastError("CreateThread failed"); |
404 return 1; | 405 return 1; |
405 } | 406 } |
406 } | 407 } |
407 catch (std::runtime_error e) | 408 catch (std::runtime_error e) |
408 { | 409 { |
409 DebugException(e); | 410 DebugException(e); |
410 return 1; | 411 return 1; |
411 } | 412 } |
412 } | 413 } |
413 | 414 |
414 return 0; | 415 return 0; |
415 } | 416 } |
OLD | NEW |