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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 389 |
390 if (GetLastError() == ERROR_ALREADY_EXISTS) | 390 if (GetLastError() == ERROR_ALREADY_EXISTS) |
391 { | 391 { |
392 DebugLastError("Named pipe exists, another engine instance appears to be run
ning"); | 392 DebugLastError("Named pipe exists, another engine instance appears to be run
ning"); |
393 return 1; | 393 return 1; |
394 } | 394 } |
395 | 395 |
396 int argc; | 396 int argc; |
397 LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); | 397 LPWSTR* argv = CommandLineToArgvW(GetCommandLineW(), &argc); |
398 std::wstring locale(argc >= 2 ? argv[1] : L""); | 398 std::wstring locale(argc >= 2 ? argv[1] : L""); |
399 Communication::browserSID = argc >= 3 ? argv[2] : L""; | |
400 LocalFree(argv); | 399 LocalFree(argv); |
401 Dictionary::Create(locale); | 400 Dictionary::Create(locale); |
402 filterEngine = CreateFilterEngine(locale); | 401 filterEngine = CreateFilterEngine(locale); |
403 updater.reset(new Updater(filterEngine->GetJsEngine())); | 402 updater.reset(new Updater(filterEngine->GetJsEngine())); |
404 | 403 |
405 for (;;) | 404 for (;;) |
406 { | 405 { |
407 try | 406 try |
408 { | 407 { |
409 Communication::Pipe* pipe = new Communication::Pipe(Communication::pipeNam
e, | 408 Communication::Pipe* pipe = new Communication::Pipe(Communication::pipeNam
e, |
410 Communication::Pipe::MODE_CREATE); | 409 Communication::Pipe::MODE_CREATE); |
411 | 410 |
412 AutoHandle thread(CreateThread(0, 0, ClientThread, static_cast<LPVOID>(pip
e), 0, 0)); | 411 AutoHandle thread(CreateThread(0, 0, ClientThread, static_cast<LPVOID>(pip
e), 0, 0)); |
413 if (!thread) | 412 if (!thread) |
414 { | 413 { |
415 delete pipe; | 414 delete pipe; |
416 DebugLastError("CreateThread failed"); | 415 DebugLastError("CreateThread failed"); |
417 return 1; | 416 return 1; |
418 } | 417 } |
419 } | 418 } |
420 catch (std::runtime_error e) | 419 catch (std::runtime_error e) |
421 { | 420 { |
422 DebugException(e); | 421 DebugException(e); |
423 return 1; | 422 return 1; |
424 } | 423 } |
425 } | 424 } |
426 | 425 |
427 return 0; | 426 return 0; |
428 } | 427 } |
OLD | NEW |