Jump to content

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

From EDM2
Ak120 (talk | contribs)
Ak120 (talk | contribs)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
This call frees a resource loaded by [[DosGetResource2]].
This call frees a resource loaded by DosGetResource2.  


==Syntax==
==Syntax==
<PRE>
  DosFreeResource (ResAddr)
  DosFreeResource


    (ResAddr)
</PRE>
==Parameters==
==Parameters==
ResAddr (PBYTE) - input : The address of the resource to free.
;ResAddr (PBYTE) - input : The address of the resource to free.
 
==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
* 0 NO_ERROR
Return code descriptions are:
* 6 ERROR_ACCESS_DENIED
 
* 0       NO_ERROR  
* 6       ERROR_ACCESS_DENIED  


==Remarks==
==Remarks==
DosFreeResource is used to free resources obtained with DosGetResource2.
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.  
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==
==Bindings==
===C Binding===
===C===
<PRE>
<PRE>
#define INCL_DOSFREERESOURCE
#define INCL_DOSFREERESOURCE
Line 30: Line 24:
USHORT  rc = DosFreeResource(ResAddr);
USHORT  rc = DosFreeResource(ResAddr);


PBYTE           ResAddr;      /* Resource address */
PBYTE   ResAddr;      /* Resource address */
 
USHORT rc;            /* return code */
USHORT           rc;            /* return code */
</PRE>
</PRE>


===MASM Binding===
===MASM===
<PRE>
<PRE>
EXTRN  DosFreeResource:FAR
EXTRN  DosFreeResource:FAR
Line 45: Line 38:
Returns WORD
Returns WORD
</PRE>
</PRE>
==Related Functions==
*


[[Category:The OS/2 API Project]]
[[Category:Dos16]]

Latest revision as of 13:32, 29 February 2020

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.

Bindings

C

#define INCL_DOSFREERESOURCE

USHORT  rc = DosFreeResource(ResAddr);

PBYTE   ResAddr;       /* Resource address */
USHORT  rc;            /* return code */

MASM

EXTRN  DosFreeResource:FAR
INCL_DOSFREERESOURCE   EQU 1

PUSH   DWORD   ResAddr       ;Resource address
CALL   DosFreeResource

Returns WORD