windows-itpro-docs/windows/client-management/mdm/samples-for-writing-a-custom-configuration-service-provider.md
2018-05-11 10:45:43 -07:00

1.4 KiB

title, description, ms.assetid, ms.author, ms.topic, ms.prod, ms.technology, author, ms.date
title description ms.assetid ms.author ms.topic ms.prod ms.technology author ms.date
Samples for writing a custom configuration service provider Samples for writing a custom configuration service provider ccda4d62-7ce1-483b-912f-25d50c974270 maricia article w10 windows MariciaAlforque 06/26/2017

Samples for writing a custom configuration service provider

The following example shows how to retrieve Integrated Circuit Card Identifier (ICCID) and International Mobile Subscriber Identity (IMSI) for a dual SIM phone.

Retrieving ICCID and IMSI for a dual SIM phone

The following sample is used in the IConfigServiceProvider2::ConfigManagerNotification method implementation. It first retrieves the IConfigSession2 object, and then queries the ICCID with the IConfigSession2::GetSessionVariable method. To retrieve the IMSI, replace L”ICCID” with L”IMSI”.

case CFGMGR_NOTIFICATION_SETSESSIONOBJ:
    if (NULL != lpParam)
    {
        m_pSession = reinterpret_cast<IConfigSession2*>(lpParam);
        m_pSession->AddRef();
    }

    bstrContext = SysAllocString(L"ICCID");
    if (NULL == bstrContext)
    {
    hr = E_OUTOFMEMORY;
    goto Error;
    }

    hr = m_pSession->GetSessionVariable(bstrContext, &varValue);
    if (FAILED(hr))
    {
        goto Error;
    }
    break;