c - First-chance exception: KernelBase.dll -



c - First-chance exception: KernelBase.dll -

i'm trying build , run piece of programme vs2012 pro.

#include "stdafx.h" int _tmain(int argc, _tchar* argv[]) { startupinfo si; process_information pi; //allocate memory zeromemory(&si, sizeof(si)); si.cb = sizeof(si); zeromemory(&pi, sizeof(pi)); //create kid process if (!createprocess(null, //use command line l"mspaint.exe", //command line null, //don't inherit process handle null, //don't inherit thread handle false, //disable handle inheritance 0, //no creation flags null, //use parent's environment block null, //use parent's existing directory &si, &pi)) { fprintf(stderr, "create process failed"); homecoming -1; } waitforsingleobject(pi.hprocess, infinite); closehandle(pi.hprocess); closehandle(pi.hthread); homecoming 0; }

i error:

'consoleapplication1.exe' (win32): loaded 'g:\workspace\vs2012\consoleapplication1\debug\consoleapplication1.exe'. symbols loaded.

'consoleapplication1.exe' (win32): loaded 'c:\windows\syswow64\ntdll.dll'. cannot find or open pdb file.

'consoleapplication1.exe' (win32): loaded 'c:\windows\syswow64\kernel32.dll'. cannot find or open pdb file.

'consoleapplication1.exe' (win32): loaded 'c:\windows\syswow64\kernelbase.dll'. cannot find or open pdb file.

'consoleapplication1.exe' (win32): loaded 'c:\windows\syswow64\msvcr110d.dll'. symbols loaded.

first-chance exception @ 0x763919e3 (kernelbase.dll) in consoleapplication1.exe: 0xc0000005: access violation writing location 0x00cb586e.

unhandled exception @ 0x763919e3 (kernelbase.dll) in consoleapplication1.exe: 0xc0000005: access violation writing location 0x00cb586e.

the programme '[6992] consoleapplication1.exe' has exited code 0 (0x0).

note built without no error (the file stdafx.h contains headers need).

i searched error, not find out solution, , simple program, can't understand what's problem here :(.

please help me.

from createprocessw documentation, sec parameter:

the unicode version of function, createprocessw, can modify contents of string. therefore, parameter cannot pointer read-only memory (such const variable or literal string). if parameter constant string, function may cause access violation

so in reply question, don't pass constant string literal sec parameter function, or you'll av.

c visual-studio-2010 winapi access-violation

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -