Where is qlmlicense.xml?

Comments

13 comments

  • Official comment
    Avatar
    Soraco Technologies

    Hi Erik

    There's no qlmLicense.xml for Windows C++ apps. The qlmLicense.xml is just used for mobile / cross platform apps.

     

    For C++ windows apps, the license is stored typically in the registry although it can also be stored on the file system.

    For more information about where keys are stored, check this article.

     

    John

    Comment actions Permalink
  • Avatar
    Erik Gawtry

    Okay, thanks.  I guess I need to rewrite that example that you sent me.

    -Erik

     

    0
    Comment actions Permalink
  • Avatar
    Soraco Technologies

    You should not need to... can you please remind me which example I sent you.

    0
    Comment actions Permalink
  • Avatar
    Erik Gawtry

    Okay, I have this but it always fails the Validate with "Data at the root level is invalid. Line 1, position 1." (XXXXXX is the guid), it IS reading the registry entry properly :

    HKEY hKey;
     
    if( ::RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Classes\\CLSID\\{XXXXXXX}\\Elevation", 0, KEY_READ, &hKey) != ERROR_SUCCESS )
    {
    	return NULL;
    }
    WCHAR wszData[4096];
    DWORD dwType = REG_SZ;
    DWORD cbData = sizeof(wszData);
    ::RegGetValueW(hKey, L""NULLRRF_RT_REG_SZ, &dwType, (PVOID)wszData, &cbData);
    ::RegCloseKey(hKey);
     
    CComBSTR bstrError;
    if (productProperties->ValidateSignature(wszData, _bstr_t(rsaPublicKey), &bstrError) == VARIANT_FALSE)
    {
    	return NULL;
    }
    else
    {
    	productProperties->Deserialize(wszData);
     
    	IQlmProductPropertyPtr pp = productProperties->GetProperty(_bstr_t("engineering"), _bstr_t("module_eng"));
     
    	OutputDebugString((LPCWSTR) (pp->PropValue.pbstrVal));
     
    }
    

     

    0
    Comment actions Permalink
  • Avatar
    Erik Gawtry

    BTW, The original you sent me had this at the top:

    // store the license file - you may want to customize the destination folder
    TCHAR docsFolder[MAX_PATH];
    SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, 0, docsFolder);
     
    CString licenseFile = docsFolder + CString("\\") + productPropertiesFileName;
     
    std::ifstream inFile (licenseFile); //open the input file
     
    std::stringstream strStream;
     
    strStream << inFile.rdbuf();//read the file
    string str = strStream.str();//str holds the content of the file
    

     

    0
    Comment actions Permalink
  • Avatar
    Soraco Technologies

    I understand. The sample is the right one. The license file referred to here only applies if your are using Custom Product Properties. Let me know if you are.

    0
    Comment actions Permalink
  • Avatar
    Erik Gawtry

    By "custom" you mean the ones I added when I created the license in Design Products?  If so, then yes.

    0
    Comment actions Permalink
  • Avatar
    Erik Gawtry

    And I still need to know what to plug into the ValidateSignature().

     

    0
    Comment actions Permalink
  • Avatar
    Soraco Technologies (Edited )

    Ok. 

    As per the sample that I sent you, the LicenseValidator class will call WriteProductProperties if the license validation succeeds. Note that you can call WriteProductProperties any time you want. The code I provided you is just an example.

    If you look at the WriteProductProperties function in the LicenseValidator class, you will see that this function will create an xml file in the MyDocuments folder. Feel free to change the location of the file as you see fit.

    Every time your application starts up, or whenever you want, you can call LicenseValidator::ReadProductProperties to read the license file.

    Both ReadProductProperties and WriteProductProperties call ValidateSignature so you do not need to call ValidateSignature directly. 

    0
    Comment actions Permalink
  • Avatar
    Soraco Technologies

    In the code that you sent me, I'm not sure what you are reading from the registry.

    The Product Properties are stored in an XML file by WriteProductProperties.The code that I sent you should work fine.

    I'd be happy to setup a screen sharing session to expedite this.

     

    0
    Comment actions Permalink
  • Avatar
    Erik Gawtry

    I figured it out based on what you said above.  Works great now.

    BSTR bstrResponse;
    BSTR bstrProps = theApp.m_lv->license->GetProductProperties(_bstr_t(""), _bstr_t(theApp.m_lv->activationKey), &bstrResponse);
     
    theApp.m_lv->productProperties->Deserialize(bstrProps);
     
     
    IQlmProductPropertyPtr pp = theApp.m_lv->productProperties->GetProperty(_bstr_t("category"), _bstr_t("callsign"));
     
    if( pp )
    	StringCchCopyW(wszCallsign, ARRAYSIZE(wszCallsign), (LPCWSTR) (pp->PropValue.pbstrVal));
    else
    {
    LicensePropertyError:
    	AfxMessageBox(L"Invalid License", MB_OK|MB_ICONEXCLAMATION);
    	FreeLicenseResources ();
    	SetCurrentDirectory(wszSavePath);
    	ExitProcess(0);
    }
     
    

     

    0
    Comment actions Permalink
  • Avatar
    Erik Gawtry

    Thank you for all your help over the last couple of weeks.  Support was great.

    I wish there had been some basic documentation so I didn't need the aforementioned support.  I may write up a "Getting Started" and send it to you to add to your website.  People shouldn't have to jump in with no basic knowledge of how everything works.  Development went from about two days to three weeks.

    -Erik

    0
    Comment actions Permalink
  • Avatar
    Soraco Technologies

    Glad you got it working and thanks for the feedback Erik.

    0
    Comment actions Permalink

Please sign in to leave a comment.