home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / XSRVACVT.C < prev    next >
Text File  |  1996-02-05  |  2KB  |  42 lines

  1. /*****************************************************************************/
  2. /* File:                                             IBM INTERNAL USE ONLY   */
  3. /*   xsrvacvt.c                                                              */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*                                                                           */
  7. /*   Converts flat address to sel:off form and vice versa using dosdebug.    */
  8. /*   !!!!use these to convert code addresses!!!!                             */
  9. /*                                                                           */
  10. /* History:                                                                  */
  11. /*                                                                           */
  12. /*...Release 1.00 (03/03/92)                                                 */
  13. /*...                                                                        */
  14. /*****************************************************************************/
  15. #include "all.h"
  16.  
  17. void Sys_Flat2SelOff(ULONG Address,USHORT *Selector,USHORT *Offset)
  18. {
  19.    PtraceBuffer  Ptb;
  20.    memset(&Ptb,0,sizeof(Ptb));
  21.  
  22.    Ptb.Pid  = GetEspProcessID();
  23.    Ptb.Cmd  = DBG_C_LinToSel;
  24.    Ptb.Addr = Address;
  25.    DosDebug(&Ptb);
  26.    *Selector = (ushort)Ptb.Value;
  27.    *Offset   = (ushort)Ptb.Index;
  28. }
  29.  
  30. ULONG Sys_SelOff2Flat(USHORT Selector,USHORT Offset)
  31. {
  32.    PtraceBuffer  Ptb;
  33.    memset(&Ptb,0,sizeof(Ptb));
  34.  
  35.    Ptb.Pid   = GetEspProcessID();
  36.    Ptb.Cmd   = DBG_C_SelToLin;
  37.    Ptb.Value = Selector;
  38.    Ptb.Index = Offset;
  39.    DosDebug(&Ptb);
  40.    return( Ptb.Addr );
  41. }
  42.