Hi,
I have a Paylink controller that I'm trying to access from a .NET (4.5) program in C#.
I have this code running on several computers and it works correctly, but on one particular computer, the following line throws an error:
var OpenRes = AESImhei.OpenMHE();
I expect the result to be 0, but I'm getting error 31 (ERROR_GEN_FAILURE).
However, the demo program (demo.exe) is working and connects to the controller correctly.
Nathan
Error 31 (ERROR_GEN_FAILURE) using IIS
Moderators: aardvark, davebush, Admin
Error 31 (ERROR_GEN_FAILURE) using IIS
Last edited by Nathan on Mon Mar 31, 2025 2:42 pm, edited 1 time in total.
Re: Error 31 (ERROR_GEN_FAILURE)
Hi Nathan,
The Paylink driver and the DLL communicate using a shared memory segment, and error 31 means that for some reason the DLL is unable to open the segment correctly.
This can be due to access permissions if you are running the application in an unusual way. Can you think of any way the failing PC is different?
Dave
The Paylink driver and the DLL communicate using a shared memory segment, and error 31 means that for some reason the DLL is unable to open the segment correctly.
This can be due to access permissions if you are running the application in an unusual way. Can you think of any way the failing PC is different?
Dave
Aardvark software developer. Please put all communication on the problem through the board for the benefit of others.
Re: Error 31 (ERROR_GEN_FAILURE)
Hi,
The only thing that comes to mind is that the PC where this installation is running was set up more recently than the others.
In my older setups I was using 32-bit programs and it could be that in previous installations, while in this newer installation, the programs are 64-bit.
Maybe since my application uses the 32-bit version, they may not be able to share the same memory address.
I have had problems with the DLL (32 or 64 bits). In my previous project, I used the 32-bit version and had to configure the application pool in IIS to support 32-bit applications.
Nathan
The only thing that comes to mind is that the PC where this installation is running was set up more recently than the others.
In my older setups I was using 32-bit programs and it could be that in previous installations, while in this newer installation, the programs are 64-bit.
Maybe since my application uses the 32-bit version, they may not be able to share the same memory address.
I have had problems with the DLL (32 or 64 bits). In my previous project, I used the 32-bit version and had to configure the application pool in IIS to support 32-bit applications.
Nathan
Re: Error 31 (ERROR_GEN_FAILURE)
Hi,
There is a problem to do with users, which I think is related to IIS. (It may be only on 64 bit)
With IIS the application is not running as the normal user, while the driver program is.
As these are running as different users, that means that shared memory has to be in the "global segment" - at which point everyone on the machine can access it.
You achieve this by putting the line
in Standard.cfg after the Driver line.
In order for the driver program to be able to do this, you will have to run it with Administrator privileges. There's no need to change your application.
Regards
Dave
There is a problem to do with users, which I think is related to IIS. (It may be only on 64 bit)
With IIS the application is not running as the normal user, while the driver program is.
As these are running as different users, that means that shared memory has to be in the "global segment" - at which point everyone on the machine can access it.
You achieve this by putting the line
Code: Select all
Use Global Segment
In order for the driver program to be able to do this, you will have to run it with Administrator privileges. There's no need to change your application.
Regards
Dave
Aardvark software developer. Please put all communication on the problem through the board for the benefit of others.
Re: Error 31 (ERROR_GEN_FAILURE)
That was it Dave.
Solved.
Thank you for your help.
Nathan
Solved.
Thank you for your help.
Nathan