Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. error in starting widows service after installation

error in starting widows service after installation

Scheduled Pinned Locked Moved C / C++ / MFC
helpdebuggingworkspace
5 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Subrat Patnaik
    wrote on last edited by
    #1

    hi all, i have written a small service.now when i install the service, the service gets installed what i feel but is not able to start. using an installer i am installing the service application in windows vista. it gives out an error during installation, when the service is getting started. it throws an error as follows: Create process failed: error code 14001. the application has failed to start because the application configuration is incorrect. reinstalling the application may fix the problem. i tried reinstalling, however the same problem persists... i am pasting the code below,, for initial main, service installation and service start functions..please can i get some help on fixing the error.... */////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void __cdecl _tmain(int argc, char **argv) { HKEY hKeyHandle; DWORD dwDataToWrite = 1; if( argc == 3 ) { printf("ERROR:\tIncorrect number of arguments\n\n"); return; } char *arg1 = argv[1]; char *arg2 = argv[2]; if(_strnicmp(arg1, "install", 7) == 0) { if(!PathFileExists(arg2 )) { exit(1); } if (InstallService(arg2)) { MessageBox(NULL,"Service installed successfully",Message,MB_OK); } else { MessageBox(NULL,"Error in service installation",Message,MB_OK); exit(2); } } else if (lstrcmpi( arg1, TEXT("uninstall")) == 0 ) { if(!ServiceDelete()) { MessageBox(NULL,"Error in Un-installing",Message,MB_OK); exit(3); } } else if (lstrcmpi( arg1, TEXT("enable")) == 0 ) { if (!EnableService()) { MessageBox(NULL,"Error in enabling",Message,MB_OK); exit(4); } } else exit(0); SERVICE_TABLE_ENTRY DispatchTable[] = { { SRVCNAME, (LPSERVICE_MAIN_FUNCTION) SvcMain }, { NULL, NULL } }; StartServiceCtrlDispatcher(DispatchTable); } // Service main function for the service VOID WINAPI SvcMain(DWORD dwArgs,LPTSTR *lpszArgv) { DWORD dwErr = 0; debug_log("In Service Main-The Entry Point for Service"); // Register the handler function to service svcStatusHandle = RegisterServiceCtrlHandlerEx(TEXT(SRVCNAME),(LPHANDLER_FUNCTION_EX)SvcCtrlHandler,NULL); if(!svcStatusHandle) { debug_log("Failed to register service handler function error(%d) returned",GetLastError()); (VOID)ReportServiceStatus(SERVICE_STOPPED,dwErr,0); return; } // service status m

    C 1 Reply Last reply
    0
    • S Subrat Patnaik

      hi all, i have written a small service.now when i install the service, the service gets installed what i feel but is not able to start. using an installer i am installing the service application in windows vista. it gives out an error during installation, when the service is getting started. it throws an error as follows: Create process failed: error code 14001. the application has failed to start because the application configuration is incorrect. reinstalling the application may fix the problem. i tried reinstalling, however the same problem persists... i am pasting the code below,, for initial main, service installation and service start functions..please can i get some help on fixing the error.... */////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void __cdecl _tmain(int argc, char **argv) { HKEY hKeyHandle; DWORD dwDataToWrite = 1; if( argc == 3 ) { printf("ERROR:\tIncorrect number of arguments\n\n"); return; } char *arg1 = argv[1]; char *arg2 = argv[2]; if(_strnicmp(arg1, "install", 7) == 0) { if(!PathFileExists(arg2 )) { exit(1); } if (InstallService(arg2)) { MessageBox(NULL,"Service installed successfully",Message,MB_OK); } else { MessageBox(NULL,"Error in service installation",Message,MB_OK); exit(2); } } else if (lstrcmpi( arg1, TEXT("uninstall")) == 0 ) { if(!ServiceDelete()) { MessageBox(NULL,"Error in Un-installing",Message,MB_OK); exit(3); } } else if (lstrcmpi( arg1, TEXT("enable")) == 0 ) { if (!EnableService()) { MessageBox(NULL,"Error in enabling",Message,MB_OK); exit(4); } } else exit(0); SERVICE_TABLE_ENTRY DispatchTable[] = { { SRVCNAME, (LPSERVICE_MAIN_FUNCTION) SvcMain }, { NULL, NULL } }; StartServiceCtrlDispatcher(DispatchTable); } // Service main function for the service VOID WINAPI SvcMain(DWORD dwArgs,LPTSTR *lpszArgv) { DWORD dwErr = 0; debug_log("In Service Main-The Entry Point for Service"); // Register the handler function to service svcStatusHandle = RegisterServiceCtrlHandlerEx(TEXT(SRVCNAME),(LPHANDLER_FUNCTION_EX)SvcCtrlHandler,NULL); if(!svcStatusHandle) { debug_log("Failed to register service handler function error(%d) returned",GetLastError()); (VOID)ReportServiceStatus(SERVICE_STOPPED,dwErr,0); return; } // service status m

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      No need to paste the full code of your application. Please read the posting guidelines ("How to get an answer to your question") before posting... For your problem: are you using VC2005 or VC2008 ? If yes, you have to instal the VC redistributable package on the target platform. This will install the C-runtime and MFC libraries. You can find this for VC2005 here[^]. IF you need another version of VC (2008, or with a service pack installed), you'll have to search a bit on the website.

      Cédric Moonen Software developer
      Charting control [v2.0] OpenGL game tutorial in C++

      C S 2 Replies Last reply
      0
      • C Cedric Moonen

        No need to paste the full code of your application. Please read the posting guidelines ("How to get an answer to your question") before posting... For your problem: are you using VC2005 or VC2008 ? If yes, you have to instal the VC redistributable package on the target platform. This will install the C-runtime and MFC libraries. You can find this for VC2005 here[^]. IF you need another version of VC (2008, or with a service pack installed), you'll have to search a bit on the website.

        Cédric Moonen Software developer
        Charting control [v2.0] OpenGL game tutorial in C++

        C Offline
        C Offline
        Chuck OToole
        wrote on last edited by
        #3

        Or you can build you application with Static MCF and CRTL libraries instead of using DLLs. Base distribution for Vista does not include the VS2008 runtime yet.

        1 Reply Last reply
        0
        • C Cedric Moonen

          No need to paste the full code of your application. Please read the posting guidelines ("How to get an answer to your question") before posting... For your problem: are you using VC2005 or VC2008 ? If yes, you have to instal the VC redistributable package on the target platform. This will install the C-runtime and MFC libraries. You can find this for VC2005 here[^]. IF you need another version of VC (2008, or with a service pack installed), you'll have to search a bit on the website.

          Cédric Moonen Software developer
          Charting control [v2.0] OpenGL game tutorial in C++

          S Offline
          S Offline
          Subrat Patnaik
          wrote on last edited by
          #4

          i am using vs2008. i did install the redistributable package on the machine..and still the same problem persists....

          C 1 Reply Last reply
          0
          • S Subrat Patnaik

            i am using vs2008. i did install the redistributable package on the machine..and still the same problem persists....

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #5

            Did you install the redistributable package for VC2008 ? Otherwise, as someone else mentioned, another solution would be to statically link to the C-runtime and MFC dlls.

            Cédric Moonen Software developer
            Charting control [v2.0] OpenGL game tutorial in C++

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups