Jump to content

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

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
 
Line 5: Line 5:


==Parameters==
==Parameters==
;ObjNameBuf (PSZ) - output : Address of the name of an object that contributed to the failure of DosLoadModule.
;ObjNameBuf (PSZ) - output: Address of the name of an object that contributed to the failure of DosLoadModule.
;ObjNameBufL (USHORT) - input : Length, in bytes, of the buffer described by ObjNameBuf.
;ObjNameBufL (USHORT) - input: Length, in bytes, of the buffer described by ObjNameBuf.
;ModuleName (PSZ) - input : Address of the ASCIIZ name string containing the dynamic link module name or the pathname string. The filename extension used for dynamic link libraries is .DLL. When a pathname is provided, the module name may have any extension. The internal module name (the name given in the LIBRARY statement in the .DEF file) must be the same as the filename without the extension.
;ModuleName (PSZ) - input: Address of the ASCIIZ name string containing the dynamic link module name or the pathname string. The filename extension used for dynamic link libraries is .DLL. When a pathname is provided, the module name may have any extension. The internal module name (the name given in the LIBRARY statement in the .DEF file) must be the same as the filename without the extension.
; ModuleHandle (PHMODULE) - output : Address of the handle for the dynamic link module.
;ModuleHandle (PHMODULE) - output: Address of the handle for the dynamic link module.


==Return Code==
==Return Code==
;rc (USHORT) - return:Return code descriptions are:
;rc (USHORT) - return:Return code descriptions are:
* 0  NO_ERROR  
* 0  NO_ERROR
* 2  ERROR_FILE_NOT_FOUND  
* 2  ERROR_FILE_NOT_FOUND
* 3  ERROR_PATH_NOT_FOUND  
* 3  ERROR_PATH_NOT_FOUND
* 4  ERROR_TOO_MANY_OPEN_FILES  
* 4  ERROR_TOO_MANY_OPEN_FILES
* 5  ERROR_ACCESS_DENIED  
* 5  ERROR_ACCESS_DENIED
* 8  ERROR_NOT_ENOUGH_MEMORY  
* 8  ERROR_NOT_ENOUGH_MEMORY
* 11 ERROR_BAD_FORMAT  
* 11 ERROR_BAD_FORMAT
* 26 ERROR_NOT_DOS_DISK  
* 26 ERROR_NOT_DOS_DISK
* 32 ERROR_SHARING_VIOLATION  
* 32 ERROR_SHARING_VIOLATION
* 33 ERROR_LOCK_VIOLATION  
* 33 ERROR_LOCK_VIOLATION
* 36 ERROR_SHARING_BUFFER_EXCEEDED  
* 36 ERROR_SHARING_BUFFER_EXCEEDED
* 95 ERROR_INTERRUPT  
* 95 ERROR_INTERRUPT
* 108 ERROR_DRIVE_LOCKED  
* 108 ERROR_DRIVE_LOCKED
* 123 ERROR_INVALID_NAME  
* 123 ERROR_INVALID_NAME
* 127 ERROR_PROC_NOT_FOUND  
* 127 ERROR_PROC_NOT_FOUND
* 180 ERROR_INVALID_SEGMENT_NUMBER  
* 180 ERROR_INVALID_SEGMENT_NUMBER
* 182 ERROR_INVALID_ORDINAL  
* 182 ERROR_INVALID_ORDINAL
* 190 ERROR_INVALID_MODULETYPE  
* 190 ERROR_INVALID_MODULETYPE
* 191 ERROR_INVALID_EXE_SIGNATURE  
* 191 ERROR_INVALID_EXE_SIGNATURE
* 192 ERROR_EXE_MARKED_INVALID  
* 192 ERROR_EXE_MARKED_INVALID
* 194 ERROR_ITERATED_DATA_EXCEEDS_64k  
* 194 ERROR_ITERATED_DATA_EXCEEDS_64k
* 195 ERROR_INVALID_MINALLOCSIZE  
* 195 ERROR_INVALID_MINALLOCSIZE
* 196 ERROR_DYNLINK_FROM_INVALID_RING  
* 196 ERROR_DYNLINK_FROM_INVALID_RING
* 198 ERROR_INVALID_SEGDPL  
* 198 ERROR_INVALID_SEGDPL
* 199 ERROR_AUTODATASEG_EXCEEDS_64k  
* 199 ERROR_AUTODATASEG_EXCEEDS_64k
* 201 ERROR_RELOC_CHAIN_XEEDS_SEGLIM  
* 201 ERROR_RELOC_CHAIN_XEEDS_SEGLIM
* 206 ERROR_FILENAME_EXCED_RANGE
* 206 ERROR_FILENAME_EXCED_RANGE


==Remarks==
==Remarks==
If the file is an OS/2 dynamic link module, it is loaded, and a handle is returned. This handle is used for freeing the dynamic link module with a DosFreeModule request, getting procedure addresses with DosGetProcAddr requests, and getting the fully qualified file name with a DosGetModName request.
If the file is an OS/2 dynamic link module, it is loaded, and a handle is returned. This handle is used for freeing the dynamic link module with a [[DosFreeModule (OS/2 1.x)|DosFreeModule]] request, getting procedure addresses with DosGetProcAddr requests, and getting the fully qualified file name with a DosGetModName request.


DosLoadModule may not be called from a dynamic library initialization routine if the module to be loaded or any module referenced by it contains a dynamic link library initialization routing.
DosLoadModule may not be called from a dynamic library initialization routine if the module to be loaded or any module referenced by it contains a dynamic link library initialization routing.


==Bindings==
==Bindings==
=== C ===
===C===
<PRE>
<PRE>
#define INCL_DOSMODULEMGR
#define INCL_DOSMODULEMGR
Line 92: Line 92:
</PRE>
</PRE>


[[Category:Dos]]
[[Category:Dos16]]

Latest revision as of 02:14, 26 January 2020

This call loads a dynamic link module and returns a handle for the module.

Syntax

DosLoadModule (ObjNameBuf, ObjNameBufL, ModuleName, ModuleHandle)

Parameters

ObjNameBuf (PSZ) - output
Address of the name of an object that contributed to the failure of DosLoadModule.
ObjNameBufL (USHORT) - input
Length, in bytes, of the buffer described by ObjNameBuf.
ModuleName (PSZ) - input
Address of the ASCIIZ name string containing the dynamic link module name or the pathname string. The filename extension used for dynamic link libraries is .DLL. When a pathname is provided, the module name may have any extension. The internal module name (the name given in the LIBRARY statement in the .DEF file) must be the same as the filename without the extension.
ModuleHandle (PHMODULE) - output
Address of the handle for the dynamic link module.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 2 ERROR_FILE_NOT_FOUND
  • 3 ERROR_PATH_NOT_FOUND
  • 4 ERROR_TOO_MANY_OPEN_FILES
  • 5 ERROR_ACCESS_DENIED
  • 8 ERROR_NOT_ENOUGH_MEMORY
  • 11 ERROR_BAD_FORMAT
  • 26 ERROR_NOT_DOS_DISK
  • 32 ERROR_SHARING_VIOLATION
  • 33 ERROR_LOCK_VIOLATION
  • 36 ERROR_SHARING_BUFFER_EXCEEDED
  • 95 ERROR_INTERRUPT
  • 108 ERROR_DRIVE_LOCKED
  • 123 ERROR_INVALID_NAME
  • 127 ERROR_PROC_NOT_FOUND
  • 180 ERROR_INVALID_SEGMENT_NUMBER
  • 182 ERROR_INVALID_ORDINAL
  • 190 ERROR_INVALID_MODULETYPE
  • 191 ERROR_INVALID_EXE_SIGNATURE
  • 192 ERROR_EXE_MARKED_INVALID
  • 194 ERROR_ITERATED_DATA_EXCEEDS_64k
  • 195 ERROR_INVALID_MINALLOCSIZE
  • 196 ERROR_DYNLINK_FROM_INVALID_RING
  • 198 ERROR_INVALID_SEGDPL
  • 199 ERROR_AUTODATASEG_EXCEEDS_64k
  • 201 ERROR_RELOC_CHAIN_XEEDS_SEGLIM
  • 206 ERROR_FILENAME_EXCED_RANGE

Remarks

If the file is an OS/2 dynamic link module, it is loaded, and a handle is returned. This handle is used for freeing the dynamic link module with a DosFreeModule request, getting procedure addresses with DosGetProcAddr requests, and getting the fully qualified file name with a DosGetModName request.

DosLoadModule may not be called from a dynamic library initialization routine if the module to be loaded or any module referenced by it contains a dynamic link library initialization routing.

Bindings

C

#define INCL_DOSMODULEMGR

USHORT  rc = DosLoadModule(ObjNameBuf, ObjNameBufL, ModuleName, ModuleHandle);

PSZ      ObjNameBuf;    /* Address of object name buffer */
USHORT   ObjNameBufL;   /* Length of object name buffer */
PSZ      ModuleName;    /* Address of module name string */
PHMODULE ModuleHandle;  /* Address of module handle (returned) */

USHORT   rc;            /* return code */

MASM

EXTRN  DosLoadModule:FAR
INCL_DOSMODULEMGR   EQU 1

PUSH@  OTHER   ObjNameBuf    ;Object name buffer (returned)
PUSH   WORD    ObjNameBufL   ;Length of object name buffer
PUSH@  ASCIIZ  ModuleName    ;Module name string
PUSH@  WORD    ModuleHandle  ;Module handle (returned)
CALL           DosLoadModule

Returns WORD

Example

This example loads a module.

#define INCL_DOSMODULEMGR

#define MODULE_NAME "abcd"
#define FULL_MODULE_NAME "\\nifty\\abcd.dll"

CHAR    LoadError[100];
HMODULE ModuleHandle;
USHORT  rc;

   if (DosLoadModule(LoadError,            /* Object name buffer */
                     sizeof(LoadError),    /* Length of object name buffer */
                     MODULE_NAME,          /* Module name string */
                     &ModuleHandle) == 2)  /* Module handle */