I think, the problem is in exitCode
argument.
MSND specifies it as LPDWORD
that is pointer for DWORD
. You should pass valid pointer to the function, so it could dereference it to save exit code here:
DWORD exitCode;
//....
if(!GetExitCodeProcess(shellInfo.hProcess, &exitCode))