windows-itpro-docs/windows/client-management/mdm/samples-for-writing-a-custom-configuration-service-provider.md
2019-05-30 09:32:38 -03:00

52 lines
1.4 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Samples for writing a custom configuration service provider
description: Samples for writing a custom configuration service provider
ms.assetid: ccda4d62-7ce1-483b-912f-25d50c974270
ms.reviewer:
manager: dansimp
ms.author: v-madhi
ms.topic: article
ms.prod: w10
ms.technology: windows
author: v-madhi
ms.date: 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](iconfigserviceprovider2configmanagernotification.md) 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”.
``` syntax
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;
```