Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.0 KiB

  1. COMMENT #
  2. //***************************************************************************
  3. //
  4. //
  5. //
  6. // Microsoft Confidential
  7. // Copyright (c) Microsoft Corporation 1992-1993
  8. // All rights reserved
  9. //
  10. // Include file for using DPMI functionality in Windows.
  11. //
  12. //***************************************************************************
  13. END COMMENT #
  14. DPMI EQU 031h ; DPMI interrupt vector
  15. ALLOC_LDT_DESC EQU 0000h
  16. SEG_TO_DESC EQU 0002h
  17. SET_SEG_BASE_ADDR EQU 0007h
  18. SET_SEG_LIMIT EQU 0008h
  19. ALLOC_DOS_MEM_BLOCK EQU 0100h
  20. FREE_DOS_MEM_BLOCK EQU 0101h
  21. SET_REALMODE_INTVEC EQU 0201h
  22. GET_REALMODE_INTVEC EQU 0200h
  23. SIMULATE_RELMODE_INT EQU 0300h
  24. CALL_REALMODE_PROC EQU 0301h
  25. ; ***************************************************************************
  26. EXTERNDEF C IsWindows:WORD
  27. EXTERNDEF C IntVector:WORD
  28. EXTERNDEF C DosMem:DWORD
  29. ; ***************************************************************************
  30. ;
  31. ; Macro for simulating a real mode interrupt from protect mode using DPMI.
  32. ; Before invoking the macro the registers should be setup for the desired
  33. ; real mode interrupt call. All register pointer must be to real mode
  34. ; memory obtained via DPMI.
  35. ;
  36. ; ***************************************************************************
  37. DpmiInt MACRO Vector:REQ
  38. LOCAL IsDos ; Local label
  39. LOCAL EndMacro ; Local labe
  40. cmp IsWindows, 0 ; See if a Windows app
  41. je IsDos ; If not not Windows use DOS int
  42. mov IntVector, Vector ; Set vector to simulate
  43. call GenericDpmi ; Call generic DPMI function
  44. jmp SHORT EndMacro
  45. IsDos:
  46. int Vector ; Do DOS interrupt
  47. EndMacro:
  48. ENDM
  49. ; ***************************************************************************
  50. ;
  51. ; Real Mode call structure for Simulating Real Mode Interrupts using DPMI
  52. ;
  53. ; ***************************************************************************
  54. RealModeCallStruc Struc
  55. RegEDI dd ?
  56. RegESI dd ?
  57. RegEBP dd ?
  58. Regres dd ?
  59. RegEBX dd ?
  60. RegEDX dd ?
  61. RegECX dd ?
  62. RegEAX dd ?
  63. RegFlg dw ?
  64. RegES dw ?
  65. RegDS dw ?
  66. RegFS dw ?
  67. RegGS dw ?
  68. RegIP dw ?
  69. RegCS dw ?
  70. RegSP dw ?
  71. RegSS dw ?
  72. RealModeCallStruc Ends
  73. ; ***************************************************************************
  74. ;
  75. ; Real Mode call structure for Simulating Real Mode Interrupts using DPMI
  76. ;
  77. ; ***************************************************************************
  78. @proto_100 TYPEDEF PROTO C
  79. GenericDpmi PROTO @proto_100
  80. @proto_101 TYPEDEF PROTO C
  81. DpmiDskRdWr PROTO @proto_101