Solved

using createservice

Posted on 2004-03-30
6
336 Views
Last Modified: 2010-04-04
Hi experts,
Has anyone got a code example of how to use CREATESERVICE. I'm getting stuck with the lpDependencies (what the heck do I put in it). :(
Thanks,
DJ
0
Comment
Question by:DickJonesOCP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 17

Expert Comment

by:mokule
ID: 10713333
Most probably You should  place there nil meaning that Your service doesn't require any service started before by the system.
0
 
LVL 17

Accepted Solution

by:
mokule earned 250 total points
ID: 10713383
example from MSDN in C but its clear enough I think

BOOL CreateSampleService()
{
    LPCTSTR lpszBinaryPathName =
        "%SystemRoot%\\system\\testserv.exe";
 
    schService = CreateService(
        schSCManager,              // SCManager database
        "Sample_Srv",              // name of service
        lpszDisplayName,           // service name to display
        SERVICE_ALL_ACCESS,        // desired access
        SERVICE_WIN32_OWN_PROCESS, // service type
        SERVICE_DEMAND_START,      // start type
        SERVICE_ERROR_NORMAL,      // error control type
        lpszBinaryPathName,        // service's binary
        NULL,                      // no load ordering group
        NULL,                      // no tag identifier
        NULL,                      // no dependencies
        NULL,                      // LocalSystem account
        NULL);                     // no password
 
    if (schService == NULL)
    {
        printf("CreateService failed.\n");
        return FALSE;
    }
    else
    {
        CloseServiceHandle(schService);
        return TRUE;
    }
}

0
 

Author Comment

by:DickJonesOCP
ID: 10713511
mokule,
dependencies doesn't like the value NULL or nil or anything else I've tried. It comes up with a message 'incompatible types STRING and PDWORD' ??

help !
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:mokule
ID: 10713574
place empty string
0
 

Author Comment

by:DickJonesOCP
ID: 10713596
tried that, same message :(
and an emtpy pdword
0
 

Author Comment

by:DickJonesOCP
ID: 10713623
Aha worked with a 0, gave you the points coz u came up with a descriptor (even though I had it anyway) but thanks for your help,
All the best,
DJ
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month8 days, 1 hour left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question