Commit dd9dcaea authored by jan.koester's avatar jan.koester
Browse files

teste

parent d324e7ba
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -145,14 +145,18 @@ static VOID WINAPI ServiceMain(DWORD /*argc*/, LPSTR * /*argv*/) {
    g_svcHandle = RegisterServiceCtrlHandlerA("zaehler2mqtt", svcCtrlHandler);
    if (!g_svcHandle) return;

    reportSvcStatus(SERVICE_START_PENDING, 3000);
    reportSvcStatus(SERVICE_START_PENDING, 10000);

    // Determine config path: Windows registry (always available, no extra file)
    if (g_configPath.empty())
        g_configPath = "HKLM\\Software\\zaehler2mqtt";

    try {
        reportSvcStatus(SERVICE_RUNNING);
        runApplication(g_configPath);
    } catch (const std::exception &e) {
        std::cerr << "zaehler2mqtt service error: " << e.what() << "\n";
    } catch (...) {}

    reportSvcStatus(SERVICE_STOPPED);
}