Author Topic: Problem autoloading .Net DLL in ZWCAD using the Manusoft system  (Read 1744 times)

0 Members and 1 Guest are viewing this topic.

ajtruckle

  • Mosquito
  • Posts: 6
Problem autoloading .Net DLL in ZWCAD using the Manusoft system
« on: January 29, 2021, 02:12:43 PM »
I have a .Net DLL that I want to autoload with ZWCAD 2021.

I have my Inno Setup Script setup as per the instructions.

#define MyAppBaseName "CutToolsZcad.dll"
#define MyAppPublisherKey "TruckleSoft"

[Files]
Source: "CutToolsZcad.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "CutToolsZcad.cuix"; DestDir: "{app}"; Flags: ignoreversion
Source: "LspLoad\LspLoad.ZRX.2021.zrx";     DestDir: "{app}"; DestName: {#MyAppBaseName}.ZRX.2021.zrx;     Flags: ignoreversion; Check: IsAvailable('ZRX', '2021', 'x86'); AfterInstall: SetupDemandload('ZRX', '2021', 'x86')
Source: "LspLoad\LspLoad.ZRX.2021.x64.zrx"; DestDir: "{app}"; DestName: {#MyAppBaseName}.ZRX.2021.x64.zrx; Flags: ignoreversion; Check: IsAvailable('ZRX', '2021', 'x64'); AfterInstall: SetupDemandload('ZRX', '2021', 'x64')

[Registry]
Root: HKLM; Subkey: Software\{#MyAppPublisherKey}\{#MyAppBaseName}; Flags: uninsdeletekeyifempty; Check: IsAdminLoggedOn()
Root: HKCU; Subkey: Software\{#MyAppPublisherKey}\{#MyAppBaseName}; Flags: uninsdeletekeyifempty; Check: not IsAdminLoggedOn()
Root: HKLM; Subkey: Software\{#MyAppPublisherKey}\{#MyAppBaseName}; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn()
Root: HKCU; Subkey: Software\{#MyAppPublisherKey}\{#MyAppBaseName}; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn()


I have the rest of the code section etc. as per the sample. I have two problems when I use this system.

1. It is creating the following registry key:

"Loader"="C:\\Users\\ajtru\\AppData\\Roaming\\CutTools for ZWCad\CutToolsZcad.dll.ZRX.2021.x64.zrx"

And it actually needs to create this registry key:

"Loader"="C:\\Users\\ajtru\\AppData\\Roaming\\CutTools for ZWCad\CutToolsZcad.dll"

2. I have to manually add the following registry key:

"Managed"=dword:00000001

How do I fix the installer so that this will work correctly?

Thanks.

ajtruckle

  • Mosquito
  • Posts: 6
Re: Problem autoloading .Net DLL in ZWCAD using the Manusoft system
« Reply #1 on: January 29, 2021, 02:26:50 PM »
Think I sorted it.

I changed this code like this:

// ----------------------------------------------------------------------------
// PopulateDemandloadKey
//   - Populate a single demand-load registry key for the application.
// ----------------------------------------------------------------------------
procedure PopulateDemandloadKey(const RootKey: Integer; const AppsKey: String; const Loader: String);
begin
  RegWriteDWordValue(RootKey, AppsKey + '\{#MyAppBaseName}', 'LoadCtrls', 2); //2 = load at startup
  RegWriteStringValue(RootKey, AppsKey + '\{#MyAppBaseName}', 'Description', '{#MyAppName}');
  RegWriteStringValue(RootKey, AppsKey + '\{#MyAppBaseName}', 'Loader', ExpandConstant('{app}') + '\' + Loader);
  RegWriteDWordValue(RootKey, AppsKey + '\{#MyAppBaseName}', 'Managed', 1); //1 = .net DLL
end;

Then further down the script I stripped off the ZRX... stuff:

        '2021' :
          case Arch of
            'x86':
              if RegQueryStringValue(HKCU32, 'Software\ZWSOFT\ZWCAD\2021', 'CurVer', ProductKey) then
                PopulateDemandloadKey(GetPreferredRoot32(), ('Software\ZWSOFT\ZWCAD\2021\' + ProductKey + '\Applications'), '{#MyAppBaseName}');
            'x64':
              if RegQueryStringValue(HKCU64, 'Software\ZWSOFT\ZWCAD\2021', 'CurVer', ProductKey) then
                PopulateDemandloadKey(GetPreferredRoot64(), ('Software\ZWSOFT\ZWCAD\2021\' + ProductKey + '\Applications'), '{#MyAppBaseName}');
          end;

Now it creates my correct keys and when I start ZWCAD it works and auto loads it.

ajtruckle

  • Mosquito
  • Posts: 6
Re: Problem autoloading .Net DLL in ZWCAD using the Manusoft system
« Reply #2 on: January 29, 2021, 02:27:49 PM »
The question now is why did the zrx approach not work as the loader?

ajtruckle

  • Mosquito
  • Posts: 6