Re: Shared memory and error 997

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Matthew Ireland (matthew.ireland_at_worldspan.com)
Date: 06/04/04


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
>
>



Relevant Pages

  • Re: Persistent connections
    ... do you get a persistent PHP ... the at command (from an SSH ... HUP to all child process. ... expired - the method described above just changes the parent process ...
    (comp.lang.php)
  • kill(child_pid, SIGSTOP);
    ... and accept user to type in command use execvpto execute user command ... if process receives SIGSTOP while child process running on ... parent process to continue to accept new command? ...
    (comp.os.linux.development.system)
  • Re: unix shell script ignores exit when in function that is piped to tee
    ... > process is fed into the stdin of the parent process that's running the right ... > hand side of the command. ... If there is a child process it should have a different process-id, ... But I tried printing out the pid to a file from within the ...
    (comp.unix.shell)
  • Re: export does not work on makefiles
    ... In general, whenever you run a command, that command runs ... as a separate process with its own copy of the parent process' environment. ... That child process modified its environment and then ...
    (comp.unix.programmer)
  • Re: IPC
    ... >> This is a nasty command that attempts to fill up your disk with a file ... because the shell process will wait for the command process ... parent shell will NOT wait for the child process to complete. ... child process 22187 finished, closing pipe ...
    (comp.lang.perl.misc)