Skip to main content
ConvertLengthToIpv4Mask function

The ConvertLengthToIpv4Mask function converts an IPv4 prefix length to an IPv4 subnet mask.

Syntax


NETIO_STATUS WINAPI ConvertLengthToIpv4Mask(
  _In_   ULONG MaskLength,
  _Out_  PULONG Mask
);

Parameters

MaskLength [in]

The IPv4 prefix length, in bits.

Mask [out]

A pointer to a LONG value to hold the IPv4 subnet mask when the function returns successfully.

Return value

On success, ConvertLengthToIpv4Mask returns NO_ERROR. Any nonzero return value indicates failure and the Mask parameter is set to INADDR_NONE defined in the Ws2def.h header file.

Error codeMeaning
ERROR_INVALID_PARAMETER

One of the parameters was invalid. This error is returned if the MaskLength parameter was invalid.

 

Remarks

The ConvertLengthToIpv4Mask function is available on Windows Vista and later.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Netioapi.h (include Iphlpapi.h)

Library

Iphlpapi.lib

DLL

Iphlpapi.dll

See also

ConvertIpv4MaskToLength

 

 

Build date: 11/16/2013