Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> dosrealfarcall()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosRealFarCall()
------------------------------------------------------------------------------
 Purpose:
 Make a far call to a real mode address.

 Syntax:
 USHORT _far _cdecl DosRealFarCall(REALPTR realfn,
                                   PREGS regs,
                                   REALPTR reserved,
                                   short   wordcount,
                                   ...);

 Parameters:
 realfn     Real mode address to call.
 regs       Pointer to REGS16 structure containing the register values to be
            passed to and returned from real mode.
 reserved   Reserved. Must be zero.
 wordcount  Count of word arguments to be passed to realfn on the stack.
            Zero indicates none and a negative count causes them to be passed
            using the Pascal calling convention.
 ...        Arguments to realfn if wordcount <> 0.

 Returns:
 Register values in regs structure.

 Description:
 DosRealFarCall() allows real mode code to be called from protected mode via
 a far call. The real mode code must return via a far return instruction.
 Arguments may be passed on the stack or in registers via the REGS16
 structure. Return values are returned in the REGS16 structure.

 Example:
 #include <stdio.h>                                                          
 #include <blx286.h>                                                         
                                                                             
 void main(void)                                                             
 {                                                                           
 REGS16         regs;                                                        
 BYTE        far *xmsdriver ;                                                
                                                                             
 printf("This program attempts to get the XMS driver ");                     
 printf("version number\n");                                                 
 printf("using DosRealIntr() and DosRealFarCall()\n\n");                     
 /* Important to clear structure to zero */                                  
 memset(&regs, 0, sizeof(REGS16)) ;                                          
 regs.ax = 0x4300 ;                                                          
 if (DosRealIntr(0x2f, &regs, 0L, 0) == 0)                                   
 /* XMS installation check */                                                
    if ((regs.ax & 0xff)==0x80)                                              
       {                                                                     
       printf("XMS driver installed\n");                                     
       /* Get driver entry point */                                          
       regs.ax = 0x4310;                                                     
       if (DosRealIntr(0x2f, &regs, 0L, 0) == 0)                             
          {                                                                  
          xmsdriver = MK_FP(regs.es, regs.bx);                               
          /* real mode entry point */                                        
          printf("XMS real mode entry point is : %Fp\n",                     
             xmsdriver);                                                     
          /* Clear register structure to zero */                             
          memset(&regs, 0, sizeof(REGS16));                                  
          /* Get version function */                                         
          regs.ax = 0;                                                       
          if (DosRealFarCall((REALPTR)xmsdriver,                             
             &regs, 0L, 0) == 0)                                             
             if(regs.ax != 0)                                                
                printf("XMS driver version :                                 
 %04X\n", regs.ax);                                                          
             else                                                            
                printf("XMS get version call                                 
 failed\n");                                                                 
          else                                                               
             printf("DosRealFarCall() failed\n");                            
          }                                                                  
       else                                                                  
          printf("DosRealIntr() call failed\n");                             
       }                                                                     
    else                                                                     
       printf("XMS driver not installed\n");                                 
 else                                                                        
    printf("DosRealIntr() call failed\n");                                   
 }                                                                           

See Also: DosRealIntr()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson