DevHelp VMGlobalToProcess

This service maps an address in the system region of the global address space into an address in the address space of the current process.

C
 USHORT APIENTRY DevHelp_VMGlobalToProcess( ULONG Flags,                                          LIN   LinearAddr,                                           ULONG Length,                                           PLIN  ProcessLinearAddr) 

Assembler
 MOV  EBX,LinearAddress     ; Linear Address in global address space MOV  ECX,Length            ; Length (in bytes) of the memory object to be mapped MOV  EAX,ActionFlags       ; Actions to perform on user region ; If bit 0 (0001B) is set, the process context is                           ;    mapped for read/write access to the object. If                           ;    this bit is clear, then read only permission is                            ;    given (Note:  Some hardware may not support read                            ;    only mapping). ; If bit 1 (0010B) is set, 16-bit selectors are ;   allocated to map the 32-bit region at 64KB ;   boundaries similar to DosAllocHuge. ; If bit 2 (0100B) is set, the mapping is tracked for ;   validation and invalidation of screen buffers. ; If bit 3 (1000B) is set, the memory is allocated on                           ;    a 4MB boundary which improves performance on the ;   screen group validation/invalidation. This also ;   reserves the entire 4MB region starting at the ;   4MB boundary. ; All other bits must be clear.

MOV  DL,DevHlp_VMGlobalToProcess

CALL [Device_Help] 

C

 * Flags (ULONG) : Actions to perform on user region:

VMDHGP_WRITE - If bit 0 (0001B) is set, the process context is mapped for read/write access to the object. If this bit is clear, then read only permission is given.

VMDHGP_SELMAP - If bit 1 (0010B) is set, 16-bit selectors are allocated to map the 32-bit region at 64KB boundaries similar to DosAllocHuge.

VMDGP_SGSCONTROL - If bit 2 (0100B) is set, the mapping is tracked for validation and invalidation of screen buffers.

VMDHGP_4MEG - If bit 3 (1000B) is set, the memory is allocated on a 4MB boundary which improves performance on the screen group validation/invalidation. This also reserves the entire 4MB region starting at the 4MB boundary.

All other bits must be clear.
 * LinearAddr (LIN) : Linear address in global address space.


 * Length (ULONG): Length in bytes of memory object to be mapped.


 * ProcessLinearAddr (PLIN) : Linear address within process' address space to be returned.

Assembler
 MOV  EBX,LinearAddress     ; Linear Address in global address space MOV  ECX,Length            ; Length (in bytes) of the memory object to be mapped MOV  EAX,ActionFlags       ; Actions to perform on user region ; If bit 0 (0001B) is set, the process context is                           ;    mapped for read/write access to the object. If                           ;    this bit is clear, then read only permission is                            ;    given (Note:  Some hardware may not support read                            ;    only mapping). ; If bit 1 (0010B) is set, 16-bit selectors are ;   allocated to map the 32-bit region at 64KB ;   boundaries similar to DosAllocHuge. ; If bit 2 (0100B) is set, the mapping is tracked for ;   validation and invalidation of screen buffers. ; If bit 3 (1000B) is set, the memory is allocated on                           ;    a 4MB boundary which improves performance on the ;   screen group validation/invalidation. This also ;   reserves the entire 4MB region starting at the ;   4MB boundary. ; All other bits must be clear.



C
Success Indicator: 0 if conversion performed - returns ProcessLinearAddr.

Possible errors: Carry flag set if conversion not performed.

Assembler
 'C' Clear if conversion performed. EAX = Linear address within process's address space.

'C' Set if conversion not performed. EAX = Error code. 

Remarks
The mapping created by this function must be released with VMFree. The address range must not cross object boundaries. The address space used in this service is of the current process. In the following figure, VMGlobalToProcess maps the memory allocated with VMAlloc into Process A's private address space.

The following figure shows Mapping Performed by VMGlobalToProcess.  Before                              After ┌───────────────────────┐ 4 Gigabytes ┌───────────────────────┐ │                      │             │                       │ │     System Region     │             │     System Region     │ │                      │             │                       │ ├───────────────────────┤             ├───────────────────────┤ │       Object A        │             │       Object A        │ ├───────────────────────┤            ├───────────────────────┤ │                       │             │                       │ ├───────┬───────┬───────┤             ├───────┬───────┬───────┤ │       │       │       │             │       │       │       │ │Process│Process│Process│             │Process│Process│Process│ │  A   │   B   │   C   │             │   A   │   B   │   C   │ │Address│Address│Address│            │Address│Address│Address│ │ Space │ Space │ Space │            │ Space │ Space │ Space │ │      │       │       │             ├───────┤       │       │ │       │       │       │             │ Obj A │       │       │ │      │       │       │             ├───────┤       │       │ │       │       │       │             │       │       │       │ └───────┴───────┴───────┘      0      └───────┴───────┴───────┘ 

C

 * 1) include "dhcalls.h"

USHORT APIENTRY DevHelp_VMGlobalToProcess( ULONG Flags,                                          LIN   LinearAddr,                                           ULONG Length,                                           PLIN  ProcessLinearAddr) 