WPA Service: Add a Service Description?

George S. Lockwood gslockwood
Thu Sep 7 20:08:30 PDT 2006


Jouni,

The following code will add a desciption to the service.  Put it in
just before you start closing handles: as in: before
	CloseServiceHandle(svc);

static int register_service(const TCHAR *exe)
{
	SC_HANDLE svc, scm;
	SERVICE_DESCRIPTION ServiceDescription;    //<----new
.
.
.
	ServiceDescription.lpDescription = SERVICE_DESCRIPTION_TEXT;
	if( !ChangeServiceConfig2(
		svc,                 // handle to service
		SERVICE_CONFIG_DESCRIPTION, // change: description
		&ServiceDescription ) )                   // value: new description
	{
		printf("ChangeServiceConfig2 failed\n");
	}
	else
	{
		printf("ChangeServiceConfig2 succeeded\n");
	}


define SERVICE_DESCRIPTION_TEXT in build_config.h as:

#define SERVICE_DESCRIPTION_TEXT TEXT("This is the abcxyz
Wpa_supplicant based Wireless connection Service")


works!

george

On 9/7/06, George S. Lockwood <gslockwood at gmail.com> wrote:
> Any chance of moving the:
>
> #define SERVICE_NAME_A
> #define SERVICE_NAME
> #define DISPLAY_NAME
>
> into the build_config.h file?
>
> and adding a #define SERVICE_DESCRIPTION
>
> adding code in for a main_winmain.c to set this description string?
>
> I believe code similiar to the following would work:
>
> /*
>     'To change the description, create an instance of the SERVICE_DESCRIPTION
>     'structure and set the lpDescription member to your desired description.
> */
>     ServiceDescription.lpDescription = _
>       "This is my custom description for my Windows Service Application!"
>
> /*
>     'Call ChangeServiceConfig2 with SERVICE_CONFIG_DESCRIPTION in the second
>     'parameter and the SERVICE_DESCRIPTION instance in the third parameter
>     'to update the description.
> */
>     bChangeServiceConfig2 = ChangeServiceConfig2(iServiceHandle, _
>     modAPI.InfoLevel.SERVICE_CONFIG_DESCRIPTION, ServiceDescription)
>
>
> this would follow your recent paradigm choice of separating custom
> settings of to the build_config.h file and well the description would
> be a wonderful enhancement!
>
> thanks so much,
>
> g
>




More information about the Hostap mailing list