Difference between revisions of "DosFreeResource (OS/2 1.x)"

From EDM2
Jump to: navigation, search
(Created page with "==Description== This call frees a resource loaded by DosGetResource2. ==Syntax== <PRE> DosFreeResource (ResAddr) </PRE> ==Parameters== ResAddr (PBYTE) - input : The ad...")
 
(No difference)

Revision as of 11:51, 1 March 2017

Description

This call frees a resource loaded by DosGetResource2.

Syntax

 DosFreeResource

    (ResAddr)

Parameters

ResAddr (PBYTE) - input : The address of the resource to free.

Return Code

rc (USHORT) - return

Return code descriptions are:

  • 0 NO_ERROR
  • 6 ERROR_ACCESS_DENIED

Remarks

DosFreeResource is used to free resources obtained with DosGetResource2.

After the last reference to a resource is freed, the memory becomes available for reuse by the system. However, the memory is not reused until the system determines it cannot satisfy a memory allocation request. This allows the resource to remain in memory in case the process issues another DosGetResource2 call. The system thus avoids having to reread the contents of the resource from disk.

Example Code

C Binding

#define INCL_DOSFREERESOURCE

USHORT  rc = DosFreeResource(ResAddr);

PBYTE            ResAddr;       /* Resource address */

USHORT           rc;            /* return code */

MASM Binding

EXTRN  DosFreeResource:FAR
INCL_DOSFREERESOURCE   EQU 1

PUSH   DWORD   ResAddr       ;Resource address
CALL   DosFreeResource

Returns WORD

Related Functions