The NetServiceGetInfo API retrieves information about a particular network service that is started.
Restrictions
This API can be called from DLS and OS/2 workstations. This API does not have any access authority requirements.
#include <netcons.h> #include <service.h> NetServiceGetInfo(pszServername, service, sLevel, buf, usBuflen, pusBytesAvail); /* 16 bit*/ Net32ServiceGetInfo(pszServername, service, ulLevel, buf, ulBuflen, pulBytesAvail); /* 32 bit*/Parameters
See Common Parameter Definitions for descriptions of parameters not defined here.
service
The following table lists the return codes most significant to this API.
(See API Return Codes for a complete
list of return codes.) ┌─────────────────────────────┬───────┬────────────────────────────────────────┐│SYMBOLICCONSTANT
│VALUE│MEANING │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_Success │ 0 │ No errors were encountered. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_BAD_NETPATH │ 53 │ The network path cannot be found. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_INVALID_LEVEL │ 124 │ The sLevel parameter is not valid. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ ERROR_MORE_DATA │ 234 │ Additional data is available, but the │
│ │ │ buffer is too small. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_NetNotStarted │ 2102 │ The redirector NETWKSTA.200 has not
│
│ │ │ been started. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_BufTooSmall │ 2123 │ The buffer is too small for fixed- │
│ │ │ length data. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_WkstaNotStarted │ 2138 │ The Requester service has not been
│
│ │ │ started. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_InternalError │ 2140 │ An internal error has occurred. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_BadTransactConfig │ 2141 │ The server is not configured for
│
│ │ │ transactions. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_InvalidAPI │ 2142 │ The requested API is not supported on
│
│ │ │ the remote server. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_ServiceTableLocked │ 2180 │ The service does not respond to
│
│ │ │ control actions. │
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_ServiceNotInstalled │ 2184 │ The service has not been started.
│
├─────────────────────────────┼───────┼────────────────────────────────────────┤
│ NERR_InvalidComputer │ 2351 │ The specified computer name is not
│
│ │ │ valid. │
└─────────────────────────────┴───────┴────────────────────────────────────────┘
Other codes could be returned from the following functions:
If you call this API with the buffer length parameter equal to zero, the API returns a value for total bytes available. This technique is useful if you do not know the exact buffer size required.
The NetServiceGetInfo API returns the NERR_Success code for services that are not started (SERVICE_UNINSTALLED). If a service is stopped, an application can examine the available data of a server using the NetServiceControl API.
The NetServiceGetInfo API is similar to the NetServiceControl API passed with the INTERROGATE opcode. The NetServiceGetInfo API, however, does not interrogate the service; it only retrieves the status that the service last posted.
For information about controlling the operations of a network service, see Services - NetServiceControl.