DevHelp VMSetMem

This service commits and decommits physical storage, or changes the type of committed memory prereserved with the DevHlp_VMAlloc The address range specified must not cross object boundaries. The range must be entirely of uniform type (that is, all decommitted (invalid), all swappable, or all resident). The range to be decommitted must be entirely precommitted.

C


USHORT APIENTRY DevHelp_VMSetMem( LIN  LinearAddr,                                  ULONG Length,                                  ULONG Flags) 

Assembler
 MOV   EBX,LinearAddress  ; Linear address of the region; must be page aligned; MOV   ECX,Size           ; Size of the region (in bytes) must be page granular MOV   EAX,Flags          ; Flags used in the request ; If bit 0 is set (00000001B), the address range is to                         ;    be decommitted. If this bit is set, the range ;   must be entirely committed. ; If bit 1 is set (00000010B), the address range is to                         ;    be made resident. The entire address range must be                         ;    decommitted, all resident or all swappable. If the ;   address range is already resident, the function ;   will return with 'C' (the carry flag) cleared, ;   indicating success, without taking any action. ;   If the address range is swappable, it will be                          ;    changed to resident. If it is uncommitted, it will ;   be committed as resident memory. ; If bit 2 is set (00000100B), the address range is to                         ;    be made swappable. The entire address range must ;   be all decommitted, all resident, or all swappable. ;   If the range is already swappable, the function ;   will return with 'C' (the carry flag) cleared, ;   indicating success, without taking any action. ;   If the address range is resident, it will be made ;   swappable.If it is uncommitted, it will be                          ;    committed as swappable memory. ; All other bits are clear.

MOV   DL,DevHlp_VMSetMem

CALL  [Device_Help] 

C

 * LinearAddr (LIN) : Linearaddress of the region; must be page aligned.


 * Length (ULONG) : Size of the region in bytes; must be page granular.


 * Flags (ULONG) : Flags used in the request:


 * VMDHS_DECOMMIT - If bit 0 (00000001B) is set, the address range is to be decommitted. If this bit is set, the range must be entirely precommitted.

VMDHS_RESIDENT - If bit 1 (00000010B) is set, the address range is to be made resident. The entire address range must be decommitted, all resident, or all swappable. If the address range is already resident, the function will return with the carry flag cleared, indicating success, without taking any action. If the address range is swappable, it will be changed to resident. If it is                          uncommitted, it will be committed as resident memory.

VMDHS_SWAP - If bit 2 (00000100B) is set, the address range is to be made swappable. The entire address range must be all decommitted, all resident, or all swappable. If the range is                          already swappable, the function will return with the carry flag cleared, indicating success, without taking any action. If the address range is resident, it will be made swappable. If it                          is uncommitted, it will be committed as swappable memory.


 * All other bits must be clear.

Assembler
 MOV   EBX,LinearAddress  ; Linear address of the region; must be page aligned; MOV   ECX,Size           ; Size of the region (in bytes) must be page granular MOV   EAX,Flags          ; Flags used in the request ; If bit 0 is set (00000001B), the address range is to                         ;    be decommitted. If this bit is set, the range ;   must be entirely committed. ; If bit 1 is set (00000010B), the address range is to                         ;    be made resident. The entire address range must be                         ;    decommitted, all resident or all swappable. If the ;   address range is already resident, the function ;   will return with 'C' (the carry flag) cleared, ;   indicating success, without taking any action. ;   If the address range is swappable, it will be                          ;    changed to resident. If it is uncommitted, it will ;   be committed as resident memory. ; If bit 2 is set (00000100B), the address range is to                         ;    be made swappable. The entire address range must ;   be all decommitted, all resident, or all swappable. ;   If the range is already swappable, the function ;   will return with 'C' (the carry flag) cleared, ;   indicating success, without taking any action. ;   If the address range is resident, it will be made ;   swappable.If it is uncommitted, it will be                          ;    committed as swappable memory. ; All other bits are clear.



C
Success Indicator: Clear if successful.

Possible errors: ERROR_ACCESS_DENIED             (5) ERROR_CROSSES_OBJECT_BOUNDARY   (32798) ERROR_INVALID_PARAMETER         (87)

Assembler
 'C' Clear if successful. EAX = 0.

'C' Set if error. EAX = Error code. Possible errors: ERROR_ACCESS_DENIED               (5) ERROR_CROSSES_OBJECT_BOUNDARY     (32798) ERROR_INVALID_PARAMETER           (87) 

Remarks
The entire region, LinearAddress+Size, must lie within a memory object previously allocated with VMAlloc that has the Reserve Only option set.

C

 * 1) include "dhcalls.h"

USHORT APIENTRY DevHelp_VMSetMem( LIN  LinearAddr,                                  ULONG Length,                                  ULONG Flags) 