IltmmSupportManager::UnlockSupport Example for C

IltmmSupportManager* g_pSprtMngr; 

HRESULT DVDUnlockSupport()
{
   VARIANT_BOOL vb; 

   HRESULT hr = CoCreateInstance(&CLSID_ltmmSupportManager, NULL, CLSCTX_INPROC_SERVER, &IID_IltmmSupportManager, (void**)&g_pSprtMngr); 
   if (hr != S_OK) 
      return -1; 

   IltmmSupportManager_IsSupportLocked (g_pSprtMngr, L_SUPPORT_CONVERTFROMDVD, &vb); 
   if (vb == VARIANT_TRUE) 
   {
      static TCHAR L_KEY_CONVERTFROMDVD[] = "DVDKey";

      hr = IltmmSupportManager_UnlockSupport (g_pSprtMngr, L_SUPPORT_CONVERTFROMDVD, T2OLE(L_KEY_CONVERTFROMDVD)); 
      if (hr != S_OK) 
      {
         IltmmSupportManager_Release(g_pSprtMngr); 
         return hr; 
      }
      IltmmSupportManager_IsSupportLocked (g_pSprtMngr, L_SUPPORT_CONVERTFROMDVD, &vb); 
      if (vb != VARIANT_FALSE) 
         return E_FAIL; 

      return S_OK; 
   }

   return S_OK; 
}