en:docs:fapi:dosallocshrseg

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:docs:fapi:dosallocshrseg [2021/08/20 08:40] – created prokusheven:docs:fapi:dosallocshrseg [2021/09/18 15:05] (current) prokushev
Line 1: Line 1:
 {{page>en:templates:fapiint}} {{page>en:templates:fapiint}}
 +
 +====== DosAllocShrSeg ======
  
 This call allocates a named shared memory segment to a process. This call allocates a named shared memory segment to a process.
  
-==Syntax== +===== Syntax =====
- DosAllocShrSeg (Size, Name, Selector)+
  
-==Parameters== +<code c> 
-;Size (USHORT- input : Number of bytes requested. The value specified must be less than or equal to 65535. A value of 0 indicates 65536 bytes. +DosAllocShrSeg (Size, Name, Selector
-;Name (PSZ) - input : Address of the name string associated with the shared memory segment to be allocated. Name specifies the symbolic name for the shared memory segment. The name string is an ASCIIZ string in the format of an OS/2 file name in a subdirectory called \SHAREMEM\. The name string must include the prefix \SHAREMEM\. For example \SHAREMEM\name. +</code>
-;Selector (P[[SEL]]) - output : Address where the selector of the allocated segment is returned.+
  
-==Return Code== +===== Parameters ===== 
-;rc (USHORT) - return:Return code descriptions are: + 
-*0 NO_ERROR +  * Size ([[USHORT]]) - input : Number of bytes requested. The value specified must be less than or equal to 65535. A value of 0 indicates 65536 bytes. 
-*8 ERROR_NOT_ENOUGH_MEMORY +  * Name ([[PSZ]]) - input : Address of the name string associated with the shared memory segment to be allocated. Name specifies the symbolic name for the shared memory segment. The name string is an ASCIIZ string in the format of an OS/2 file name in a subdirectory called \SHAREMEM\. The name string must include the prefix \SHAREMEM\. For example \SHAREMEM\name. 
-*123 ERROR_INVALID_NAME +  * Selector ([[PSEL]]) - output : Address where the selector of the allocated segment is returned. 
-*183 ERROR_ALREADY_EXISTS+ 
 +===== Return Code ===== 
 + 
 +rc ([[USHORT]]) - return:Return code descriptions are: 
 + 
 +  *0 NO_ERROR 
 +  *8 ERROR_NOT_ENOUGH_MEMORY 
 +  *123 ERROR_INVALID_NAME 
 +  *183 ERROR_ALREADY_EXISTS 
 + 
 +===== Remarks =====
  
-==Remarks== 
 DosAllocShrSeg allocates a named segment of up to 64KB in size, which is movable and swappable. The segment can be shared by any process that knows the name of the segment. DosAllocShrSeg allocates a named segment of up to 64KB in size, which is movable and swappable. The segment can be shared by any process that knows the name of the segment.
  
-To access the shared segment, another process issues [[DosGetShrSeg]], specifying the segment name. The selector returned by DosGetShrSeg is the same as the one returned by DosAllocShrSeg.+To access the shared segment, another process issues [[DosGetShrSeg]], specifying the segment name. The selector returned by [[DosGetShrSeg]] is the same as the one returned by DosAllocShrSeg.
  
-The maximum number of segments a process can define with DosAllocShrSeg or access with DosGetShrSeg is 256.+The maximum number of segments a process can define with DosAllocShrSeg or access with [[DosGetShrSeg]] is 256.
  
 ;Note: This request may be issued from privilege level 2. However, the segment is allocated as a privilege level 3 segment. ;Note: This request may be issued from privilege level 2. However, the segment is allocated as a privilege level 3 segment.
  
-==Bindings== +===== Bindings ===== 
-===C=== + 
-<PRE>+==== C ===
 + 
 +<code c>
 #define INCL_DOSMEMMGR #define INCL_DOSMEMMGR
  
Line 39: Line 50:
  
 USHORT  rc;            /* return code */ USHORT  rc;            /* return code */
-</PRE>+</code>
  
-===MASM=== +==== MASM ===
-<PRE>+ 
 +<code asm>
 EXTRN  DosAllocShrSeg:FAR EXTRN  DosAllocShrSeg:FAR
 INCL_DOSMEMMGR      EQU 1 INCL_DOSMEMMGR      EQU 1
Line 52: Line 64:
  
 Returns WORD Returns WORD
-</PRE>+</code> 
 + 
 +===== Example Code =====
  
-==Example Code== 
 This example requests a segment of memory with 27 bytes named "stock.dat" This example requests a segment of memory with 27 bytes named "stock.dat"
-<PRE>+<code c>
 #define INCL_DOSMEMMGR #define INCL_DOSMEMMGR
  
Line 68: Line 81:
                        NAME_SEG,          /* Name string */                        NAME_SEG,          /* Name string */
                        &Selector);        /* Selector allocated */                        &Selector);        /* Selector allocated */
-</PRE>+</code>
  
 {{page>en:templates:fapi}} {{page>en:templates:fapi}}