How can I daw lock my plugins?
-
Is there a way to have my plugins check which daw they are opened in, and then work normally if it is Mixcraft, but disable itself if it is any other daw?
-
@pcs800 I don't see a function for that in the API
-
@d-healey We have a third party plugin developer who did this, with the following code.
Does this help?#if JUCE_WINDOWS #include <windows.h> #include <wincrypt.h> #include <Softpub.h> #include <iostream> #pragma comment(lib, "crypt32.lib") #pragma comment(lib, "wintrust.lib") bool VerifyMixcraftIsHost() { const std::string expectedName = "Acoustica, Inc"; wchar_t path[MAX_PATH]; GetModuleFileNameW(nullptr, path, MAX_PATH); juce::File hostExeFile = juce::File(juce::CharPointer_UTF16(path)); WINTRUST_FILE_INFO fileInfo = {}; fileInfo.cbStruct = sizeof(WINTRUST_FILE_INFO); fileInfo.pcwszFilePath = hostExeFile.getFullPathName().toWideCharPointer(); WINTRUST_DATA winTrustData = {}; winTrustData.cbStruct = sizeof(WINTRUST_DATA); winTrustData.pPolicyCallbackData = nullptr; winTrustData.pSIPClientData = nullptr; winTrustData.dwUIChoice = WTD_UI_NONE; winTrustData.fdwRevocationChecks = WTD_REVOKE_NONE; winTrustData.dwUnionChoice = WTD_CHOICE_FILE; winTrustData.pFile = &fileInfo; winTrustData.dwStateAction = WTD_STATEACTION_VERIFY; winTrustData.dwProvFlags = WTD_CACHE_ONLY_URL_RETRIEVAL; GUID policyGUID = WINTRUST_ACTION_GENERIC_VERIFY_V2; LONG status = WinVerifyTrust(nullptr, &policyGUID, &winTrustData); if (status != ERROR_SUCCESS) { std::wcout << L"WinVerifyTrust failed with status: " << status << std::endl; return false; } // Access the certificate CRYPT_PROVIDER_DATA* providerData = WTHelperProvDataFromStateData(winTrustData.hWVTStateData); if (!providerData) return false; CRYPT_PROVIDER_SGNR* signer = WTHelperGetProvSignerFromChain(providerData, 0, FALSE, 0); if (!signer) return false; PCCERT_CONTEXT certContext = signer->pasCertChain[0].pCert; if (!certContext) return false; // Extract the name char nameBuffer[512]; DWORD nameLen = CertGetNameStringA(certContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, nullptr, nameBuffer, sizeof(nameBuffer)); if (nameLen > 0) { std::cout << "Certificate name: " << nameBuffer << std::endl; return expectedName == std::string(nameBuffer); } return false; } #endif
-
@pcs800 You could add it in the HISE source code, but I wouldn't be surprised if there is already a JUCE function for this which would be simpler to add.
-
Ah, here it is: https://docs.juce.com/master/classjuce_1_1PluginHostType.html#a177830e408982c1688b2c7645b921ff0
Doesn't include Mixcraft though
-
@pcs800 Looks like it is integrated into the HISE source code (included with the JUCE modules), but you would need to add you own API for this to communicate in HISE script, or edit the HISE source code to contain a version of the script you provided: