Changeset 284 in Main for trunk/Server/main.c


Ignore:
Timestamp:
Oct 9, 2024, 11:44:20 AM (5 weeks ago)
Author:
Nishi
Message:

add service support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Server/main.c

    r257 r284  
    125125void WINAPI servmain(DWORD argc, LPSTR* argv) {
    126126        char* path = get_registry("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Tewi HTTPd", "InstallDir");
     127        int st;
    127128        if(path != NULL) {
    128129                char* lpath = cm_strcat(path, "/logs/tewi.log");
     
    144145        if(status_handle == NULL) return;
    145146        if(SetServiceStatus(status_handle, &status) == 0) return;
    146         int st = startup(argc, argv);
     147        st = startup(argc, argv);
    147148        if(st != -1) {
    148149                status.dwWin32ExitCode = NO_ERROR;
     
    528529int main(int argc, char** argv) {
    529530        int st;
    530         logfile = stderr;
    531531#ifdef SERVICE
    532532        SERVICE_TABLE_ENTRY table[] = {{"Tewi HTTPd", servmain}, {NULL, NULL}};
    533         StartServiceCtrlDispatcher(table);
     533        logfile = stderr;
     534        if(!StartServiceCtrlDispatcher(table)){
     535                printf("Failed to start the service dispatcher\n");
     536                return 1;
     537        }
    534538#else
     539        logfile = stderr;
    535540#ifdef _PSP
    536541        pspDebugScreenInit();
Note: See TracChangeset for help on using the changeset viewer.