SERVICE_NOTIFY structure

Represents service status notification information. It is used by the NotifyServiceStatusChangefunction.

Syntax


typedef struct _SERVICE_NOTIFY {
  DWORD                  dwVersion;
  PFN_SC_NOTIFY_CALLBACK pfnNotifyCallback;
  PVOID                  pContext;
  DWORD                  dwNotificationStatus;
  SERVICE_STATUS_PROCESS ServiceStatus;
  DWORD                  dwNotificationTriggered;
  LPTSTR                 pszServiceNames;
} SERVICE_NOTIFY, *PSERVICE_NOTIFY;

Members

dwVersion

The structure version. This member must be SERVICE_NOTIFY_STATUS_CHANGE (2).

pfnNotifyCallback

A pointer to the callback function. For more information, see Remarks.

pContext

Any user-defined data to be passed to the callback function.

dwNotificationStatus

A value that indicates the notification status. If this member is ERROR_SUCCESS, the notification has succeeded and the ServiceStatus member contains valid information. If this member is ERROR_SERVICE_MARKED_FOR_DELETE, the service has been marked for deletion and the service handle used by NotifyServiceStatusChange must be closed.

ServiceStatus

A SERVICE_STATUS_PROCESS structure that contains the service status information. This member is only valid if dwNotificationStatus is ERROR_SUCCESS.

dwNotificationTriggered

If dwNotificationStatus is ERROR_SUCCESS, this member contains a bitmask of the notifications that triggered this call to the callback function.

pszServiceNames

If dwNotificationStatus is ERROR_SUCCESS and the notification is SERVICE_NOTIFY_CREATED or SERVICE_NOTIFY_DELETED, this member is valid and it is a MULTI_SZ string that contains one or more service names. The names of the created services will have a '/' prefix so you can distinguish them from the names of the deleted services.

If this member is valid, the notification callback function must free the string using the LocalFree function.

Remarks

The callback function is declared as follows:

typedef VOID( CALLBACK * PFN_SC_NOTIFY_CALLBACK ) (
    IN PVOID pParameter 
);

The callback function receives a pointer to the SERVICE_NOTIFY structure provided by the caller.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Winsvc.h (include Windows.h)

Unicode and ANSI names

SERVICE_NOTIFYW (Unicode) and SERVICE_NOTIFYA (ANSI)

See also

NotifyServiceStatusChange
SERVICE_STATUS_PROCESS

 

 

Community Additions

ADD
Show:
© 2014 Microsoft