IMbnPinManager::GetPinState method (mbnapi.h)


Starting in Windows 10, version 1803, the Win32 APIs described in this section are replaced by the Windows Runtime APIs in the Windows.Networking.Connectivity namespace.

Gets the current PIN state of the device.


HRESULT GetPinState(
  [out] ULONG *requestID


[out] requestID

A pointer to the request ID set by the Mobile Broadband service for this asynchronous request. The response will contain the same request ID.

Return value

This method can return one of these values.

Return code Description
The method completed successfully.
The Mobile Broadband service is not running on this system.
The interface is invalid, most likely because the Mobile Broadband device has been removed from the system.
The interface is invalid. Most likely the Mobile Broadband device has been removed from the system.


The GetPinState method initiates an asynchronous request for the PIN state of the device. The PIN state indicates if a PIN needs to be entered for a requested operation to complete. It also contains information about which type of PIN is expected by a device and optionally it provides the number of attempts remaining for entering a valid PIN.

This method always returns the current PIN state of the device. It does not cache the PIN state at the time when this object is created. Instead it always contacts the device and returns the current PIN state of the device.

Since this is an asynchronous operation, GetPinState will return immediately. On completion of the operation, the Mobile Broadband service will call the OnGetPinStateComplete method of IMbnPinManagerEvents.

Whenever an operation returns E_MBN_PIN_REQUIRED or the ready state reported by the device is MBN_READY_STATE_DEVICE_LOCKED, an application should use this method to query the type of PIN required to unlock the device or SIM.

While this operation is in progress, if the Mobile Broadband device gets removed from the system then a call to the OnGetPinStateComplete method of IMbnPinManagerEvents is not guaranteed.


Minimum supported client Windows 7 [desktop apps | UWP apps]
Minimum supported server None supported
Target Platform Windows
Header mbnapi.h

See also