dos12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DosGiveSeg (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSMEMMGR
 
USHORT DosGiveSeg(sel, pidProcess, pselRecipient)
SEL sel;               /* selector of shared-memory segment             */
PID pidProcess;        /* process identifier of recipient               */
PSEL pselRecipient;    /* pointer to variable for selector of recipient */
 
The DosGiveSeg function creates a new segment selector for a shared-memory
segment. The new selector can then be used by another process to access the
shared-memory segment.
 
The process that creates the new segment selector is responsible for passing
the selector to any process that uses the segment.
 
Parameter      Description
────────────────────────────────────────────────────────────────────────────
 
sel            Specifies the segment selector of the shared-memory segment.
 
pidProcess     Identifies the process that receives access to the
               shared-memory segment.
 
pselRecipient  Points to the variable that receives the new segment
               selector.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be one of the following:
 
     ERROR_ACCESS_DENIED
     ERROR_NOT_ENOUGH_MEMORY
 
Comments
 
The DosGiveSeg function is successful even if the specified process already
has access to the segment.
 
DosGiveSeg applies only to shared-memory segments created by using the
DosAllocSeg function with the fsAlloc parameter set to SEG_GIVEABLE.
 
DosGiveSeg can be issued from ring 2, but the shared-memory segment must be
a ring-3 segment.
 
See Also
 
DosAllocSeg, DosGetSeg