Tech Support > Microsoft Windows > Development Resources > error 998 Invalid access to memory location. Here's why:
error 998 Invalid access to memory location. Here's why:
Posted by pete on April 9th, 2008


Post is only to document this misleading error message.

The error appears if I call a function that takes struct STARTUPINFO
as an argument and I forget to initialize the first member of the
struct to sizeof(STARTUPINFO):

Good: STARTUPINFO si = {sizeof(si)};
Bad: STARTUPINFO si;

Example:

STARTUPINFO si; // Bad
stat = CreateProcess( NULL, "myApp.exe", NULL, NULL, FALSE,
CREATE_NEW_CONSOLE, NULL, NULL, &si,
&pi );

returns 0 and GetLastError() returns 998.

-- Pete

Posted by Christian ASTOR on April 9th, 2008


On 9 avr, 10:15, pete <pete...@yahoo.com> wrote:

Because you're certainly in Debug Mode.
In Release, you will get an Access violation...