SERVICE_NOTIFY_2W structure (winsvc.h)
Represents service status notification information. It is used by the NotifyServiceStatusChange function.
Syntax
typedef struct _SERVICE_NOTIFY_2W {
DWORD dwVersion;
PFN_SC_NOTIFY_CALLBACK pfnNotifyCallback;
PVOID pContext;
DWORD dwNotificationStatus;
SERVICE_STATUS_PROCESS ServiceStatus;
DWORD dwNotificationTriggered;
LPWSTR pszServiceNames;
} SERVICE_NOTIFY_2W, *PSERVICE_NOTIFY_2W;
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.
Note
The winsvc.h header defines SERVICE_NOTIFY_2 as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Header | winsvc.h (include Windows.h) |