locked
Question On DRM , GenerateKeyID(w_KeyID,&d_KeyID) return S_FAIL RRS feed

  • Question

  • Following is the code where it success all the hr  to S_OK ,But last one which is indicated

    in  red colour gives the handle result S_FAIL.

    can any body help me?.

    thanks in advance

    WCHAR *Encoder::GenerateKeyID()

    {

    HRESULT hr;

    IWMWriter *m_pWriter = NULL;

    hr = WMCreateWriter( NULL, &m_pWriter );

    IWMDRMWriter *pDRMWriter = NULL;

    hr = m_pWriter->QueryInterface(IID_IWMDRMWriter,(void **) &pDRMWriter);

    DWORD d_KeyID = NULL;

    hr = pDRMWriter->GenerateKeyID(NULL,&d_KeyID);

    WCHAR *w_KeyID = new WCHAR[d_KeyID];

    //w_KeyID=NULL;

    ZeroMemory(w_KeyID,sizeof(WCHAR)* d_KeyID);

    hr = pDRMWriter->GenerateKeyID(w_KeyID,&d_KeyID); //This will retrun Fail Gives S_FAIL

    return w_KeyID;

    }

    amit

     

    Saturday, December 30, 2006 4:35 AM

Answers