HISE Logo Forum
    • Categories
    • Register
    • Login

    How can I daw lock my plugins?

    Scheduled Pinned Locked Moved General Questions
    6 Posts 3 Posters 36 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pcs800P
      pcs800
      last edited by

      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?

      d.healeyD 1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey @pcs800
        last edited by

        @pcs800 I don't see a function for that in the API

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        pcs800P 1 Reply Last reply Reply Quote 0
        • pcs800P
          pcs800 @d.healey
          last edited by

          @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
          
          d.healeyD 1 Reply Last reply Reply Quote 0
          • d.healeyD
            d.healey @pcs800
            last edited by

            @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.

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey
              last edited by d.healey

              Ah, here it is: https://docs.juce.com/master/classjuce_1_1PluginHostType.html#a177830e408982c1688b2c7645b921ff0

              Doesn't include Mixcraft though

              Free HISE Bootcamp Full Course for beginners.
              YouTube Channel - Public HISE tutorials
              My Patreon - HISE tutorials

              HISEnbergH 1 Reply Last reply Reply Quote 1
              • HISEnbergH
                HISEnberg @d.healey
                last edited by

                @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:

                https://github.com/christophhart/HISE/blob/01b810a9d31f032b30537b4767082732cd96f46e/JUCE/modules/juce_audio_processors/utilities/juce_PluginHostType.h#L38

                https://github.com/christophhart/HISE/blob/01b810a9d31f032b30537b4767082732cd96f46e/JUCE/modules/juce_audio_processors/utilities/juce_PluginHostType.cpp#L4

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post

                18

                Online

                2.0k

                Users

                12.6k

                Topics

                109.7k

                Posts