Crash upon senselClose() - ntdll.dll

Hello,

Any time I am calling the senselClose() function, my app crashes.

If I run the debugging, I get this message: “Exception non gérée à 0x00007FFB6C968353 (ntdll.dll) dans Max.exe : 0xC0000374: Un segment de mémoire a été endommagé (paramètres : 0x00007FFB6C9BF6B0).”.

Translation: Unhandeld exception at à 0x00007FFB6C968353 (ntdll.dll) in Max.exe: 0xC0000374: A fragment of memory has been damaged (parameters: 0x00007FFB6C9BF6B0).

Max.exe is the application’s name.

Any idea how to solve this?

Thank you in advance.

Hello,

Thank you for reaching out. I will look into this issue and get back to you.

Hello Alex,

Any news about this?

Some suggestions from a fellow developer, if you haven’t already tried them.

  1. There are memory-heap validation functions that can be called, prior to calling senselClose() and throughout the code, which might help detect if and where memory is being overwritten/damaged. E.g. in Visual Studio one can use ASSERT(_CrtCheckMemory()); This command checks the heap at (and only at) the spot it is inserted. There are other related memory debugging mechanisms, as well.

  2. Comment-out the calls to senselClose(). Does it then crash elsewhere?

Thanks TIm, I’m going to see if (1) can help but about (2), I confirm that if I comment out the line senselClose(&handle); there’s no crash any more.

Hi, sorry for the delay. I was attempting to recreate the error on a few machines but I can see the solution in your latest post.

You should not send a pointer of the handle to sensel close (use senselClose(handle) instead). Hope this helps!

That was it! I still don’t totally grasp the pointer stuff in C…

Thanks a lot, Alex!

It’s amazing (but true) that the Visual Studio compiler doesn’t complain about the apparent type mismatch in the argument to senselClose().

The following is addressed to Alex, not amundsen.

Alex, I believe that if you change the typedef of SENSEL_HANDLE to:

struct SenselHandle { void* handle; };
typedef struct SenselHandle *SENSEL_HANDLE;

that all existing code will still work, but the compiler will then warn about the kind of error that amundsen ran into. I tested this and it seems to work.

 ...Tim...
1 Like

Glad to hear it worked!

Thanks Tim. Great idea!

If the main issue is you do not know that how to access the missing ntdll.dll files, so learn from here how to fix the error and keep your computer secure also.