IOCTL_SERVICE_NOTIFY_ADDR_CHANGE
A version of this page is also available for
4/8/2010
This IOCTL is passed as an input parameter along when Services.exe notifies every running service of address changes in the system.
Parameters
- pBufIn
[in] Pointer to a PIP_ADAPTER_ADDRESSES structure containing information on the local addresses for a specific network adapter.
Return Values
Returns TRUE if successful, FALSE otherwise. To obtain extended error information, call the SetLastError function.
Remarks
When Services.exe initializes, it creates a thread that receives notification about address changes in the system. When an IP address on the system is added or removed, this thread wakes and calls the GetAdaptersAddresses function to retrieve the information about the local addresses. It then calls every running service with IOCTL_SERVICE_NOTIFY_ADDR_CHANGE and with the results of GetAdaptersAddresses in the input parameters.
If a service needs to use this information later, it must call GetAdaptersAddresses to retrieve its own copy of this data. The pointer passed to the service during the call to the xxx_IOControl (Services.exe) function is valid only during the duration of the function call. You must not copy the data to a private buffer using memcpy_s because the structure contains internal pointers to memory locations inside the buffer that will not be valid when the call to xxx_IOControl returns.
If a service needs to keep track of network interfaces, it must call GetAdaptersAddresses when it initializes to obtain the current state of the network adapters. Services.exe only generates the IOCTL_SERVICE_NOTIFY_ADDR_CHANGE IOCTL when network adapter information changes, therefore the service must read this information on its own initially. A logical place for the call to GetAdaptersAddresses would be in the service's xxx_Init (Services.exe) function.
An example of a service that makes use of the network adapter information and IOCTL_NOTIFY_ADDR_CHANGE is the Web Server. The Web Server can be configured to route HTTP requests to different virtual Web sites based on the network adapter the HTTP request arrived on, but it must internally keep track of the system's network adapters in order to route these requests.
Requirements
Header | service.h |
Windows Embedded CE | Windows CE .NET 4.1 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |