i2pd/DaemonWin32.cpp

55 lines
1.1 KiB
C++
Raw Normal View History

2016-01-20 03:00:00 +03:00
#include "Config.h"
2014-04-20 05:54:34 +04:00
#include "Daemon.h"
#include "util.h"
#include "Log.h"
2014-04-20 05:54:34 +04:00
#ifdef _WIN32
2016-03-09 22:41:14 +03:00
#include "Win32/Win32App.h"
2014-04-20 05:54:34 +04:00
namespace i2p
{
namespace util
{
bool DaemonWin32::init(int argc, char* argv[])
2014-04-20 05:54:34 +04:00
{
setlocale(LC_CTYPE, "");
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
2016-03-09 22:41:14 +03:00
setlocale(LC_ALL, "Russian");
return Daemon_Singleton::init(argc, argv);
}
bool DaemonWin32::start()
{
setlocale(LC_CTYPE, "");
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
setlocale(LC_ALL, "Russian");
2016-03-09 22:41:14 +03:00
if (!i2p::win32::StartWin32App ()) return false;
2014-04-20 05:54:34 +04:00
2016-03-06 05:46:01 +03:00
bool ret = Daemon_Singleton::start();
if (ret && IsLogToFile ())
2016-03-09 22:41:14 +03:00
{
2016-03-06 05:46:01 +03:00
// TODO: find out where this garbage to console comes from
SetStdHandle(STD_OUTPUT_HANDLE, INVALID_HANDLE_VALUE);
SetStdHandle(STD_ERROR_HANDLE, INVALID_HANDLE_VALUE);
}
return ret;
2014-04-20 05:54:34 +04:00
}
bool DaemonWin32::stop()
2016-03-09 22:41:14 +03:00
{
i2p::win32::StopWin32App ();
2014-04-20 05:54:34 +04:00
return Daemon_Singleton::stop();
2016-03-09 22:41:14 +03:00
}
void DaemonWin32::run ()
{
i2p::win32::RunWin32App ();
}
2014-04-20 05:54:34 +04:00
}
}
2015-12-18 15:27:47 +03:00
#endif