Get checkbox value via TA_GetFeatureValueSolved

Hi all,

I struggled with this and wasn't able to find an example, especially for Windows, so here's for future versions of myself and others like me who use the Checkbox custom licence field and want to get the boolean value out of it.

bool taGetFeature(STRCTYPE feature) {
    HRESULT hr;
    TCHAR* featureValue;

    // First get the size of the buffer that we need
    // to store the custom license field.
    hr = TA_GetFeatureValue(taHandle, feature, 0, 0);

    // Allocate the buffer based on the size TurboActivate told us.
    featureValue = (TCHAR *)malloc(hr * sizeof(TCHAR));

    // Try to get the value and store it in the buffer
    hr = TA_GetFeatureValue(taHandle, feature, featureValue, hr);

    bool value { false };

    if (hr == TA_OK) {
        // A value == 0 means they are identical, namely "true"
        #ifdef _WIN32
            value = wcscmp(_T("1"), featureValue) == 0;
        #else
            value = strcmp(_T("1"), featureValue) == 0;
        #endif
    }

    free(featureValue);

    return value;
}

Hope it helps someone!