home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / vp21beta.zip / OAPILIB.RAR / DEFS / MSGSEG32.PAS < prev    next >
Pascal/Delphi Source File  |  2000-08-15  |  3KB  |  76 lines

  1. {█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█}
  2. {█                                                       █}
  3. {█      Virtual Pascal Runtime Library.  Version 1.0.    █}
  4. {█      DosGetMessage and DosQueryMessageCP support.     █}
  5. {█      ─────────────────────────────────────────────────█}
  6. {█      Copyright (C) 1995 fPrint UK Ltd                 █}
  7. {█                                                       █}
  8. {▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀}
  9.  
  10. { I found no references to the following in the documentation.          }
  11. { The only source of information is OS2386.LIB import library file      }
  12. { supplied with IBM C/C++ Developer toolkit for OS/2.                   }
  13. { DosGetMessage can be found in the msgseg32 object module,             }
  14. { DosQueryMessageCP in qryseg32.                                        }
  15.  
  16. {$OrgName+,Cdecl+,SmartLink-,AlignCode+,S-}
  17.  
  18. unit MsgSeg32;
  19.  
  20. interface
  21.  
  22. type
  23.   ULong  = Longint;
  24.   ApiRet = Longint;
  25.   PPChar = ^PChar;
  26.  
  27. function DosGetMessage(Table: PPChar; cTable: ULong; Buf: PChar; cbBuf: ULong;
  28.   MsgNumber: ULong; FileName: PChar; var cbMsg: ULong): ApiRet;
  29. function DosQueryMessageCP(pb: PChar; cb: ULong; FileName: PChar; var Buf: ULong): ApiRet;
  30.  
  31. implementation
  32.  
  33. procedure MagicEndSignature; forward;
  34. function DosIQueryMessageCP(pb: PChar; cb: ULong; FileName: PChar; var Buf: ULong; Signature: Pointer): ApiRet; external;
  35. function DosTrueGetMessage(Signature: Pointer; var Table: PChar; cTable: ULong; Buf: PChar; cbBuf: ULong;
  36.   MsgNumber: ULong; FileName: PChar; var cbMsg: ULong): ApiRet; external;
  37.  
  38. { Apparently some kind of signature used to mark the start of _MSGSEG32 segment }
  39.  
  40. procedure MagicHeaderSignature; assembler; {$USES None} {$Frame-}
  41. asm
  42.                 db      0FFh, 'MSGSEG32', 0
  43.                 dd      8001h, OFFSET MagicEndSignature
  44. end;
  45.  
  46. { DosGetMessage is declared in the OS2BASE unit, however actual name of OS/2  }
  47. { API function is DosTrueGetMessage. It requires additional first parameter,  }
  48. { pointing to the above magic header. The following procedure pops out return }
  49. { address, pushes extra parameter and pushes return address back to stack.    }
  50.  
  51. function DosGetMessage; assembler; {$USES None} {$Frame-}
  52. asm
  53.                 pop     eax
  54.                 push    OFFSET MagicHeaderSignature
  55.                 push    eax
  56.                 jmp     DosTrueGetMessage
  57. end;
  58.  
  59. { DosQueryMessageCP is declared in the OS2BASE unit, however actual name of   }
  60. { OS/2 API function is DosIQueryMessageCP. It requires additional last        }
  61. { parameter, pointing to the above magic signature.                           }
  62.  
  63. function DosQueryMessageCP(pb: PChar; cb: ULong; FileName: PChar; var Buf: ULong): ApiRet;
  64. begin
  65.   DosQueryMessageCP := DosIQueryMessageCP(pb, cb, FileName, Buf, @MagicEndSignature);
  66. end;
  67.  
  68. { Apparently some kind of signature used to mark the end of _MSGSEG32 segment }
  69.  
  70. procedure MagicEndSignature; assembler; {$USES None} {$Frame-}
  71. asm
  72.                 dd      0FFFF0000h
  73. end;
  74.  
  75. end.
  76.