Archive: Error on exiting Installer


Error on exiting Installer
Hi all,

I'm getting an Application Error when Installer exists. Error message says: "Instruction at "0x01a01c51" referenced memory at "0x00000004". The memory could not be "read". Click OK to terminate the program.

Installer does everything it is supposed to, but this annoying message pops up in the end. Any pointers as to what I should be looking for or check to get rid of the error?


Error on exiting Installer UPDATE
Update;

I have now identified when this runtime error occurs. It happens every time I use a specific call to an external DLL through System::Call. Call has following signature:

bool APIENTRY GetSomeStuff( char *Buffer, int BufferLength )

Call from NSIS is:
System::Call "Mydllfilename::GetSomeStuff(t .r7, i 30) i .r0"

I have experimented with different ways/parameters in the System::Call, but nothing seems to make a difference. The call produces the desired results, but for some reason I always get an Application error when Installer exits. The error does not occur if this call is not made. Any ideas as to why this happens? A bug in the dll? The same dll has been earlier used with InstallShield without issue. Also, it seems to work fine when called otherwise outside of NSIS.


InstallShield? is this function cdecl by any chance? Or to put it another way, what is APIENTRY defined to?

You could try adding the cdecl flag to the system call, see the system readme for more info


APIENTRY is defined in windef.h:

#define WINAPI      __stdcall
...
#define APIENTRY WINAPI

You you have the source to this thing, you could try to replace the body of the function with something simple like


lstrcpynA(Buffer,"foobarbaz",BufferLength);
return 1;