Jump to content

Dos16QueryModFromCS: Difference between revisions

From EDM2
Ak120 (talk | contribs)
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
Dos16QueryModFromCS queries the name, segment, and handle that corresponds to a 16 bit selector. It takes a selector as a parameter and returns information about the module (a protect mode application currently executing) owning that selector.
Dos16QueryModFromCS queries the name, segment, and handle that corresponds to a 16 bit selector. It takes a selector as a parameter and returns information about the module (a protect mode application currently executing) owning that selector.  


==Syntax==
==Syntax==
<PRE>
  Dos16QueryModFromCS (sel, qmresult)
#define INCL_DOSMODULEMGR
#include os2.h>


    APIRET16 APIENTRY16 Dos16QueryModFromCS
        (SEL sel, PQMRESULT qmresult)
</PRE>
==Parameters==
==Parameters==
; sel (SEL) input : Selector to be queried.  
;''sel'' ([[SEL]]) - input : Selector to be queried.
 
;''qmresult'' (QMRESULT) - output : Structure containing the queried information
; qmresult (QMRESULT) output : Structure containing the queried information
typedef struct_QMRESULT{USHORT seg; USHORT htme; char name[256];} QMRESULT;
 
  typedef QMRESULT*PQMRESULT;
    typedef struct_QMRESULT{USHORT seg; USHORT htme; char name[256];} QMRESULT;
   
    typedef QMRESULT*PQMRESULT;


==Return Code==
==Return Code==
 
;''ulrc'' (APIRET) - returns
ulrc (APIRET) returns
:Dos16QueryModFromCS returns one of the following values
 
* 0 NO_ERROR
Dos16QueryModFromCS returns one of the following values
* 87 ERROR_INVALID_PARAMETER
 
* 0         NO_ERROR
* 87       ERROR_INVALID_PARAMETER
==Remarks==
 


==Example Code==
==Example Code==
<PRE>
<PRE>
#define INCL_DOSMODULEMGR
#include <os2.h>
int main(int argc, char *argv[], char *envp[]){
int main(int argc, char *argv[], char *envp[]){
   SEL sel=0;
   SEL sel=0;
Line 57: Line 46:
}
}
</PRE>
</PRE>
==Related Functions==
==Related Functions==
* [[OS2 API:CPI:DosQueryModFromEIP|DosQueryModFromEIP]]
* [[DosQueryModFromEIP]]
* [[OS2 API:CPI:DosSetExceptionHandler|DosSetExceptionHandler]]
* [[DosSetExceptionHandler]]
 


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

Latest revision as of 22:03, 10 September 2025

Dos16QueryModFromCS queries the name, segment, and handle that corresponds to a 16 bit selector. It takes a selector as a parameter and returns information about the module (a protect mode application currently executing) owning that selector.

Syntax

Dos16QueryModFromCS (sel, qmresult)

Parameters

sel (SEL) - input
Selector to be queried.
qmresult (QMRESULT) - output
Structure containing the queried information
typedef struct_QMRESULT{USHORT seg; USHORT htme; char name[256];} QMRESULT;
typedef QMRESULT*PQMRESULT;

Return Code

ulrc (APIRET) - returns
Dos16QueryModFromCS returns one of the following values
  • 0 NO_ERROR
  • 87 ERROR_INVALID_PARAMETER

Example Code

#define INCL_DOSMODULEMGR
#include <os2.h>

int main(int argc, char *argv[], char *envp[]){
   SEL sel=0;
   QMRESULT qmresult;
   APIRET16 rc;

   if (argc!=2) {
      printf("QMODCS sel\n");
      return;
   } /* endif */

   sel=(SEL)strtoul(argv[1],NULL,16);

   rc=Dos16QueryModFromCS(sel,  qmresult);

   if (rc != 0) {
      printf("DosQueryModFromCS returned rc=%u\n",rc);
      return rc;
   } /* endif */

   printf("Sel=0x%04x Handle=0x%04x Segment=0x%04x %s\n",
           sel,qmresult.hmte,qmresult.seg,qmresult.name);

   return 0;
}

Related Functions