DosGetProcAddr: Difference between revisions
Appearance
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
This call returns a far address to a desired procedure within a dynamic link module. | This call returns a far address to a desired procedure within a dynamic link module. | ||
==Syntax== | ==Syntax== | ||
DosGetProcAddr (ModuleHandle, ProcName, ProcAddress) | DosGetProcAddr (ModuleHandle, ProcName, ProcAddress) | ||
==Parameters== | ==Parameters== | ||
;ModuleHandle (HMODULE) - input : Handle of the dynamic link module. | ;ModuleHandle ([[HMODULE]]) - input: Handle of the dynamic link module. | ||
;ProcName (PSZ) - input : Address of a name string that contains the referenced procedure name. | ;ProcName (PSZ) - input: Address of a name string that contains the referenced procedure name. | ||
:Alternatively, if the selector portion of the pointer is null, the offset portion of the pointer is an explicit entry number (ordinal) within the dynamic link module. | |||
Alternatively, if the selector portion of the pointer is null, the offset portion of the pointer is an explicit entry number (ordinal) within the dynamic link module. | :DosGetProcAddr for entries within the DOSCALLS module are only supported for ordinal references. References to the DOSCALLS module by name strings are not supported and return an error. Dynamic link ordinal numbers for DOSCALLS routines are resolved by linking with DOSCALLS.LIB. | ||
;ProcAddress (PFN FAR *) - output: Procedure address. | |||
DosGetProcAddr for entries within the DOSCALLS module are only supported for ordinal references. References to the DOSCALLS module by name strings are not supported and return an error. Dynamic link ordinal numbers for DOSCALLS routines are resolved by linking with DOSCALLS.LIB. | |||
;ProcAddress (PFN FAR *) - output : Procedure address. | |||
==Return Code== | ==Return Code== | ||
;rc (USHORT) - return:Return code descriptions are: | |||
Return code descriptions are: | * 0 NO_ERROR | ||
* 0 | * 6 ERROR_INVALID_HANDLE | ||
* 6 | * 95 ERROR_INTERRUPT | ||
* 95 | * 127 ERROR_PROC_NOT_FOUND | ||
* 127 | |||
==Remarks== | ==Remarks== | ||
A 32-bit address, consisting of a selector and offset, is returned for a specified procedure. | A 32-bit address, consisting of a selector and offset, is returned for a specified procedure. | ||
To free the dynamic link module, issue DosFreeModule. After DosFreeModule is issued, procedure entry addresses returned for this handle or no longer valid. | To free the dynamic link module, issue [[DosFreeModule]]. After DosFreeModule is issued, procedure entry addresses returned for this handle or no longer valid. | ||
Other run-time dynamic link calls are DosLoadModule, DosGetModName, and DosGetModHandle. | Other run-time dynamic link calls are [[DosLoadModule]], [[DosGetModName]], and [[DosGetModHandle]]. | ||
== | ==Bindings== | ||
=== C | ===C=== | ||
<PRE> | <PRE> | ||
#define INCL_DOSMODULEMGR | #define INCL_DOSMODULEMGR | ||
Line 41: | Line 32: | ||
USHORT rc = DosGetProcAddr(ModuleHandle, ProcName, ProcAddress); | USHORT rc = DosGetProcAddr(ModuleHandle, ProcName, ProcAddress); | ||
HMODULE | HMODULE ModuleHandle; /* Module handle */ | ||
PSZ | PSZ ProcName; /* Module name string */ | ||
PFN FAR * | PFN FAR *ProcAddress; /* Procedure address (returned) */ | ||
USHORT | USHORT rc; /* return code */ | ||
</PRE> | </PRE> | ||
===MASM | ===MASM=== | ||
<PRE> | <PRE> | ||
EXTRN DosGetProcAddr:FAR | EXTRN DosGetProcAddr:FAR | ||
Line 59: | Line 50: | ||
Returns WORD | Returns WORD | ||
</PRE> | </PRE> | ||
==Related Functions== | ==Related Functions== | ||
* | *[[DosFreeModule]] | ||
*[[DosGetModHandle]] | |||
*[[DosGetModName]] | |||
*[[DosLoadModule]] | |||
[[Category:Dos]] | [[Category:Dos]] |
Revision as of 16:50, 4 June 2018
This call returns a far address to a desired procedure within a dynamic link module.
Syntax
DosGetProcAddr (ModuleHandle, ProcName, ProcAddress)
Parameters
- ModuleHandle (HMODULE) - input
- Handle of the dynamic link module.
- ProcName (PSZ) - input
- Address of a name string that contains the referenced procedure name.
- Alternatively, if the selector portion of the pointer is null, the offset portion of the pointer is an explicit entry number (ordinal) within the dynamic link module.
- DosGetProcAddr for entries within the DOSCALLS module are only supported for ordinal references. References to the DOSCALLS module by name strings are not supported and return an error. Dynamic link ordinal numbers for DOSCALLS routines are resolved by linking with DOSCALLS.LIB.
- ProcAddress (PFN FAR *) - output
- Procedure address.
Return Code
- rc (USHORT) - return
- Return code descriptions are:
- 0 NO_ERROR
- 6 ERROR_INVALID_HANDLE
- 95 ERROR_INTERRUPT
- 127 ERROR_PROC_NOT_FOUND
Remarks
A 32-bit address, consisting of a selector and offset, is returned for a specified procedure.
To free the dynamic link module, issue DosFreeModule. After DosFreeModule is issued, procedure entry addresses returned for this handle or no longer valid.
Other run-time dynamic link calls are DosLoadModule, DosGetModName, and DosGetModHandle.
Bindings
C
#define INCL_DOSMODULEMGR USHORT rc = DosGetProcAddr(ModuleHandle, ProcName, ProcAddress); HMODULE ModuleHandle; /* Module handle */ PSZ ProcName; /* Module name string */ PFN FAR *ProcAddress; /* Procedure address (returned) */ USHORT rc; /* return code */
MASM
EXTRN DosGetProcAddr:FAR INCL_DOSMODULEMGR EQU 1 PUSH WORD ModuleHandle ;Module handle PUSH@ ASCIIZ ProcName ;Module name string PUSH@ DWORD ProcAddress ;Procedure address (returned) CALL DosGetProcAddr Returns WORD