delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1999/04/27/21:58:59

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
From: fortinj AT ibm DOT net
Message-ID: <37266BBC.F8F24A3A@ibm.net>
Date: Tue, 27 Apr 1999 22:00:28 -0400
Reply-To: fortinj AT ibm DOT net
X-Sender: "" <@smtp-gw01.ny.us.ibm.net> (Unverified)
X-Mailer: Mozilla 4.5 [en]C-gatewaynet (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: DJ Delorie <dj AT delorie DOT com>
CC: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: Re: cygwin1.dll startup and GDB
References: <37265A6E DOT 813F8ED8 AT ibm DOT net> <199904280131 DOT VAA28701 AT envy DOT delorie DOT com>

DJ,
	Either way, mapname will be NULL since NULL is being passed as the
first parameter to open_shared.
My understanding ( misunderstanding :) ) was that with OpenFileMapping()
a name for the shared memory was needed.  However, we are passing a NULL
pointer to it instead...

Is OpenFileMappingA() different.  I only have a reference for
OpenFileMapping().

This is the sequence...

hinfo.cc
244             fh = new (buf) fhandler_console (name);

fhandler_console.cc
37        return tty_stuff = (tty_min *) open_shared (NULL,
console_shared_h,
38                                                    sizeof
(*tty_stuff), NULL)


void *
open_shared (const char *name, HANDLE &shared_h, DWORD size, void *addr)
{
  void *shared;

  if (!shared_h)
    {
      char *mapname = name ? shared_name (name, 0) : NULL;

      shared_h = OpenFileMappingA (FILE_MAP_READ | FILE_MAP_WRITE,
                                   TRUE, mapname);

      if (!shared_h &&
          !(shared_h = CreateFileMappingA ((HANDLE) 0xffffffff,
                                           &sec_all,
                                           PAGE_READWRITE,
                                           0,
                                           size,
                                           mapname)))
        api_fatal ("CreateFileMappingA, %E.  Terminating.");
    }

...

DJ Delorie wrote:
> 
> Looks like OpenFileMapping() doesn't properly check its parameters.
> Try rearranging the code like this:
> 
>         char *mapname = NULL;
>         if (name)
>         {
>           mapname = shared_name (name, 0);
>           shared_h = OpenFileMappingA (FILE_MAP_READ | FILE_MAP_WRITE,
>                                        TRUE, mapname);
>         }
>         if (!shared_h &&
>             !(shared_h = CreateFileMappingA ((HANDLE) 0xffffffff,
>                                              &sec_all,
> 
> If this works, mail me a diff for the final source and I'll apply it.
> 
> DJ

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019