Re: Shared memory and error 997
From: Matthew Ireland (matthew.ireland_at_worldspan.com)
Date: 06/04/04
- Next message: Mike S.: "Edit box, ::TextOutW(), and repainting"
- Previous message: NewAlias: "Re: NEWBIE: DLL import unresolved externals"
- In reply to: William DePalo [MVP VC++]: "Re: Shared memory and error 997"
- Next in thread: William DePalo [MVP VC++]: "Re: Shared memory and error 997"
- Reply: William DePalo [MVP VC++]: "Re: Shared memory and error 997"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 4 Jun 2004 13:26:56 -0400
In parent process
*********
HANDLE hMemory =
CreateFileMapping(NULL,NULL,PAGE_READWRITE,0,sizeof(myStruct),szName);
CreateProcess(...including szName in the command line
*********
In child process
*********
HANDLE hMemory = OpenFileMapping(FILE_MAP_ALL_ACCESS,FALSE,argv[3]);
#ifdef _DEBUG
printf("unable to open file mapping '%s', %d\n", argv[3], GetLastError());
#endif
*********
"William DePalo [MVP VC++]" <willd.no.spam@mvps.org> wrote in message
news:%23ZqqmClSEHA.4068@TK2MSFTNGP09.phx.gbl...
> "Matthew Ireland" <matthew.ireland@worldspan.com> wrote in message
> news:%23F3T92jSEHA.3968@TK2MSFTNGP09.phx.gbl...
> > I am creating a piece of named memory to shared between two processes
> using
> > CreateFileMapping() in the parent process. I pass the name used as a
> > command line parameter to the child process. When I attempt to access
the
> > shared memory using OpenFileMapping() it fails and GetLastError()
reports
> > error 997 (ERROR_IO_PENDING: Overlapped I/O in progress). This error
> seems
> > to have nothing to do with the operation I am attempting.
> >
> > Has anyone out there run accross this? What causes it? How can I get
> around
> > this?
>
> If you have a _short_ snippet of code that causes this behavior you can
post
> it here.
>
> At the risk of repeating the obvious I should tell you to check two
things:
>
> 1) Make sure there is _no_ intervening API call between the failure and
> your call to GetLastError()
>
> 2) Make sure that you only call GetLastError() in response to a failure of
a
> function documented to set the last error for the thread
>
> Regards,
> Will
>
>
- Next message: Mike S.: "Edit box, ::TextOutW(), and repainting"
- Previous message: NewAlias: "Re: NEWBIE: DLL import unresolved externals"
- In reply to: William DePalo [MVP VC++]: "Re: Shared memory and error 997"
- Next in thread: William DePalo [MVP VC++]: "Re: Shared memory and error 997"
- Reply: William DePalo [MVP VC++]: "Re: Shared memory and error 997"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|