I just installed 3.5.17.20 under Wine-staging 7.0, on Ubuntu/Linux 20.04.
Using installer don't work! I followed step like in Ingo install2.sh.
Now I'm launching 64bit version, but some native library is needed for package manager.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
WINEARCH=win64WINEPREFIX=/home/<myuser>/.wine.codesyswinewinecfg(SelectWindows10asversion)winetricks-qdotnet48(Popuprequire4.6.2,but4.8isrealyrequired)winetricks--force -q vcrun2019 (2015-2019 in single package)wineCODESYS\64\3.5.18.0.msi(ExtractedfromZIPdownload)-Deselectedgatewayduealinuxgatewayexists;-Deselectedruntimeduelinuxruntimeexists;InstallerworkuntilIPMCLI.exe
IPMCLI.exe fail in .net Culture Expetion:
0670:err:eventlog:ReportEventWL"Application: IPMCLI.exe\nFramework Version: v4.0.30319\nDescription: The process was terminated due to an unhandled exception.\nException Info: System.Globalization.CultureNotFoundException\n at System.Globalization.CultureInfo..ctor(System.String, Boolean)\n at System.Globalization.C"...
Last edit: mondinmr 2022-04-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good morning @mondinmr,
I'm trying to install codesys 3.5.20.0 inside bottles (with wine 9.2).
The full installation seems to be done (exept CodeMeter). When I run Codesys IDE an error related to IPMCLI appear and there is non chanse to open the IDE.
How did you solve this issue?
Thanks a lot.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I already encountered the same issue in a different context. The problem
occurs also when you try to run the simulation, or connect to a PLC with
encrypted communication.
I assume it is a bigger task, but I believe the clean solution is to
implement ncrypt in wine.
Just tested!
Function is called.
I only build this single DLL.
Some difference on message above:
- I configured with -prefix=/opt/wine-devel
- I used make install, but install copied in /opt/wine-
devel/lib/... and not in /opt/wine-devel/lib64/... so I copied DLL from lib to lib64.
- I also modified spec file to declare new funcion, marked as STUB.
Function is called by wine, BCryptExportKey is implemented in WINE, but I translated something in a wrong way and this result in an exception in NCryptFreeObject.
I think is the right way, but much work is needed.
I just writed also in wine forum.
A second problem I think need a solution to make CODESYS working under wine is manage flag 0x4000000 in NCrypt.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Ingo!
I downloaded install2.sh to see what you are doing.
I used 3.5.18 64bits, due a wine transition to 64bits in 7.0. They introduced syswow64 for 32bis compatibility and they started to suggest 64bits usage.
3.5.18 is in zip and not exe file.
I extracted msi.
I used winetricks to install dotnet472, arial, corefonts, vcrun2019.
Aftrer that I dowloaded Edge runtime 2 64 from microsoft, due the one present in prerequisites of 3.5.18 not working.
A very important step, for me is call winecfg, select windows10, and disable windows decorations managed by windows manager. Wine tricks put it back to Windows 7 so I select 10 just before launch installer.
Now I'm working on ncrypt dll.
Last edit: mondinmr 2022-05-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok! I patched ncrypt.dll!
Now signatures are verified!!!!!!!
Now more tests are needed!
In attachment there are modified files!
Now missing of 0x4000000 FLAG managment (i'm not sure), bring randomly to this:
04b4:err:eventlog:ReportEventWL"Application: CODESYS.exe\nFramework Version: v4.0.30319\nDescription: The process was terminated due to an unhandled exception.\nException Info: System.AccessViolationException\n at Microsoft.Win32.SafeHandles.SafeNCryptProviderHandle.NCryptFreeObject(IntPtr)\n at Microsoft.Win32.Safe"...04b4:fixme:advapi:DeregisterEventSource(00000000CAFE4242)stubUnhandledException:04b4:fixme:ver:GetCurrentPackageId(000000000334B0200000000000000000):stubUnhandledException:System.AccessViolationException:Attemptedtoreadorwriteprotectedmemory.Thisisoftenanindicationthatothermemoryiscorrupt.atMicrosoft.Win32.SafeHandles.SafeNCryptProviderHandle.NCryptFreeObject(IntPtrhObject)atMicrosoft.Win32.SafeHandles.SafeNCryptProviderHandle.ReleaseNativeHandle()atMicrosoft.Win32.SafeHandles.SafeNCryptHandle.ReleaseHandle()atSystem.Runtime.InteropServices.SafeHandle.InternalFinalize()atSystem.Runtime.InteropServices.SafeHandle.Finalize()wine:UnhandledpagefaultonreadaccesstoFFFFFFFFFFFFFFFFataddress000000017002AEF8(thread04b4),startingdebugger..
Only for test purpose i put a reuturn in NCryptFreeObject after call, this bring in a memory leak, but now installer work, packages are installed, signatures working. So NCRYPT_PERSIST_ONLY_FLAG probability could be managed in a key property avoiding free when this property is set.
In 3.5.18 Codesys Installer is needed, so dll should compiled also in 32bit, due this program is released only in 32bit (why in 2022??????).
Some problem persists in online.
A side comment out off topic... This massive usage of .net and C# is making development system a little bit too heavy.
Last edit: mondinmr 2022-05-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I managed to correctly launch CODESYS Developer Studio 3.5.17, almost all functionality works. The only issue remaining is that when connecting to a device and obtaining its public key, the NCryptEncrypt function is called, which is not fully implemented in the DLL source code, resulting in the connection not being established.
Currently, the code of this function in the Wine repository looks like this:
SECURITY_STATUSWINAPINCryptEncrypt(NCRYPT_KEY_HANDLEkey,BYTE*input,DWORDinsize,void*padding,BYTE*output,DWORDoutsize,DWORD*result,DWORDflags){structobject*key_object=(structobject*)key;TRACE("(%#Ix, %p, %lu, %p, %p, %lu, %p, %#lx)\n",key,input,insize,padding,output,outsize,result,flags);if(flags&~(NCRYPT_NO_PADDING_FLAG|NCRYPT_PAD_OAEP_FLAG|NCRYPT_PAD_PKCS1_FLAG|NCRYPT_SILENT_FLAG)){FIXME("Flags %lx not supported\n",flags);returnNTE_BAD_FLAGS;}if(flags&NCRYPT_NO_PADDING_FLAG||flags&NCRYPT_PAD_OAEP_FLAG){FIXME("No padding and oaep padding not supported\n");returnNTE_NOT_SUPPORTED;}if(key_object->type!=KEY)returnNTE_INVALID_HANDLE;returnmap_ntstatus(BCryptEncrypt(key_object->key.bcrypt_key,input,insize,padding,NULL,0,output,outsize,result,flags));}
The program crashes due to the NCRYPT_PAD_OAEP_FLAG flag. I'm not proficient in C++, but I attempted to add handling myself, and here's the result:
SECURITY_STATUSWINAPINCryptEncrypt(NCRYPT_KEY_HANDLEkey,BYTE*input,DWORDinsize,void*padding,BYTE*output,DWORDoutsize,DWORD*result,DWORDflags){structobject*key_object=(structobject*)key;TRACE("(%#Ix, %p, %lu, %p, %p, %lu, %p, %#lx)\n",key,input,insize,padding,output,outsize,result,flags);if(flags&~(NCRYPT_NO_PADDING_FLAG|NCRYPT_PAD_OAEP_FLAG|NCRYPT_PAD_PKCS1_FLAG|NCRYPT_SILENT_FLAG)){FIXME("Flags %lx not supported\n",flags);returnNTE_BAD_FLAGS;}if(flags&NCRYPT_NO_PADDING_FLAG){FIXME("No padding not supported\n");returnNTE_NOT_SUPPORTED;}BCRYPT_OAEP_PADDING_INFOoaepInfo={0};oaepInfo.pszAlgId=BCRYPT_SHA1_ALGORITHM;NTSTATUSstatus=BCryptEncrypt(key_object->key.bcrypt_key,input,insize,&oaepInfo,NULL,0,output,outsize,result,flags);if(key_object->type!=KEY)returnNTE_INVALID_HANDLE;returnmap_ntstatus(BCryptEncrypt(key_object->key.bcrypt_key,input,insize,padding,NULL,0,output,outsize,result,flags));}
Now, when calling the connection, it crashes with the error "bcrypt:BCryptEncrypt flags 0x4 not implemented."
Can anyone help with enhancing this functionality or at least point me in the right direction?
Last edit: ara32 2024-03-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hello forum,
does someone run a recent version of codesys (3.5.17.10) under Wine or Crossover? As this seems to be broken from 3.5.16
br Arno
Talk Topic about project #codesys-4-linux
I just installed 3.5.17.20 under Wine-staging 7.0, on Ubuntu/Linux 20.04.
Using installer don't work! I followed step like in Ingo install2.sh.
Now I'm launching 64bit version, but some native library is needed for package manager.
I just tried CODESYS 3.5.18 64 bit.
IPMCLI.exe fail in .net Culture Expetion:
Last edit: mondinmr 2022-04-28
Good morning @mondinmr,
I'm trying to install codesys 3.5.20.0 inside bottles (with wine 9.2).
The full installation seems to be done (exept CodeMeter). When I run Codesys IDE an error related to IPMCLI appear and there is non chanse to open the IDE.
How did you solve this issue?
Thanks a lot.
Put all locales to en_US.UTF8, let me install and run CODESYS 3.5.18 in wine.
You can see attached image!
The problem remain in ncrypt.
This make impossible verify any signature. So is not possible do anything else editing code. Not very useful!
Hi!
I assume it is a bigger task, but I believe the clean solution is to
implement ncrypt in wine.
Googling for it, turned out, that there was a fix in this region recently:
https://www.winehq.org/announce/7.3
The microsoft installer was the driving force for that.
Maybe you want to try this new wine version?
I am already very curious, if it works now...
My test was made in 7.7 Staging... So...
ncrypt is partially implemented, but it's missing CODESYS required API calls.
Last edit: mondinmr 2022-04-30
Ok!
Let's go!
1 - I installed WINE Development 7.7 from repository.
2 - I downloaded 7.7 development source code.
3 - Go in 7.7 source:
4 - Edit main.c adding this just before SECURITY_STATUS WINAPI NCryptImportKey
5 - edit ../../include/ncrypt.h adding this line before
SECURITY_STATUS WINAPI NCryptImportKey
6 - ...
7 - copyed resulting ncrypt.dll and .so in ...
To be tested and improved!
Just tested!
Function is called.
I only build this single DLL.
Some difference on message above:
- I configured with -prefix=/opt/wine-devel
- I used make install, but install copied in /opt/wine-
devel/lib/... and not in /opt/wine-devel/lib64/... so I copied DLL from lib to lib64.
- I also modified spec file to declare new funcion, marked as STUB.
Function is called by wine, BCryptExportKey is implemented in WINE, but I translated something in a wrong way and this result in an exception in NCryptFreeObject.
I think is the right way, but much work is needed.
I just writed also in wine forum.
A second problem I think need a solution to make CODESYS working under wine is manage flag 0x4000000 in NCrypt.
Hi @mondinmr ,
Did you manage it with the installer, or did you use the install2.sh
script, or ... ?
Cheers,
Ingo
Hi Ingo!
I downloaded install2.sh to see what you are doing.
I used 3.5.18 64bits, due a wine transition to 64bits in 7.0. They introduced syswow64 for 32bis compatibility and they started to suggest 64bits usage.
3.5.18 is in zip and not exe file.
I extracted msi.
I used winetricks to install dotnet472, arial, corefonts, vcrun2019.
Aftrer that I dowloaded Edge runtime 2 64 from microsoft, due the one present in prerequisites of 3.5.18 not working.
A very important step, for me is call winecfg, select windows10, and disable windows decorations managed by windows manager. Wine tricks put it back to Windows 7 so I select 10 just before launch installer.
Now I'm working on ncrypt dll.
Last edit: mondinmr 2022-05-04
Ok! I patched ncrypt.dll!
Now signatures are verified!!!!!!!
Now more tests are needed!
In attachment there are modified files!
Now missing of 0x4000000 FLAG managment (i'm not sure), bring randomly to this:
Last edit: mondinmr 2022-05-04
Only for test purpose i put a reuturn in NCryptFreeObject after call, this bring in a memory leak, but now installer work, packages are installed, signatures working. So NCRYPT_PERSIST_ONLY_FLAG probability could be managed in a key property avoiding free when this property is set.
In 3.5.18 Codesys Installer is needed, so dll should compiled also in 32bit, due this program is released only in 32bit (why in 2022??????).
Some problem persists in online.
A side comment out off topic... This massive usage of .net and C# is making development system a little bit too heavy.
Last edit: mondinmr 2022-05-04
Hello!
I managed to correctly launch CODESYS Developer Studio 3.5.17, almost all functionality works. The only issue remaining is that when connecting to a device and obtaining its public key, the NCryptEncrypt function is called, which is not fully implemented in the DLL source code, resulting in the connection not being established.
Currently, the code of this function in the Wine repository looks like this:
The program crashes due to the NCRYPT_PAD_OAEP_FLAG flag. I'm not proficient in C++, but I attempted to add handling myself, and here's the result:
Now, when calling the connection, it crashes with the error "bcrypt:BCryptEncrypt flags 0x4 not implemented."
Can anyone help with enhancing this functionality or at least point me in the right direction?
Last edit: ara32 2024-03-22