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.

159 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. Int2f.c
  5. Abstract:
  6. This module provides the int 2f API for dpmi
  7. Author:
  8. Neil Sandlin (neilsa) 23-Nov-1996
  9. Revision History:
  10. --*/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. #include <softpc.h>
  14. #include "xlathlp.h"
  15. //
  16. // Local constants
  17. //
  18. #define MSCDEX_FUNC 0x15
  19. #define WIN386_FUNC 0x16
  20. #define WIN386_IDLE 0x80
  21. #define WIN386_Get_Device_API 0x84
  22. #define WIN386_INT31 0x86
  23. #define WIN386_GETLDT 0x88
  24. #define WIN386_KRNLIDLE 0x89
  25. #define DPMI_MSDOS_EXT 0x8A
  26. #define SEL_LDT 0x137
  27. #define DISPCRIT_FUNC 0x40
  28. #define DISPCRIT_ENTER 0x03
  29. #define DISPCRIT_EXIT 0x04
  30. #define XMS_ID 0x43
  31. #define XMS_INS_CHK 0x00
  32. #define XMS_CTRL_FUNC 0x10
  33. BOOL nt_mscdex(VOID);
  34. BOOL
  35. PMInt2fHandler(
  36. VOID
  37. )
  38. /*++
  39. Routine Description:
  40. This routine is called at the end of the protect mode PM int chain
  41. for int 2fh. It is provided for compatibility with win31.
  42. Arguments:
  43. Client registers are the arguments to int2f
  44. Return Value:
  45. TRUE if the interrupt was handled, FALSE otherwise
  46. --*/
  47. {
  48. DECLARE_LocalVdmContext;
  49. BOOL bHandled = FALSE;
  50. static char szMSDOS[] = "MS-DOS";
  51. PCHAR VdmData;
  52. switch(getAH()) {
  53. //
  54. // Int2f Func 15xx - MSCDEX
  55. //
  56. case MSCDEX_FUNC:
  57. bHandled = nt_mscdex();
  58. break;
  59. //
  60. // Int2f Func 16
  61. //
  62. case WIN386_FUNC:
  63. switch(getAL()) {
  64. case WIN386_KRNLIDLE:
  65. case WIN386_IDLE:
  66. bHandled = TRUE;
  67. break;
  68. case WIN386_GETLDT:
  69. if (getBX() == 0xbad) {
  70. setAX(0);
  71. setBX(SEL_LDT);
  72. bHandled = TRUE;
  73. }
  74. break;
  75. case WIN386_INT31:
  76. setAX(0);
  77. bHandled = TRUE;
  78. break;
  79. case WIN386_Get_Device_API:
  80. GetVxDApiHandler(getBX());
  81. bHandled = TRUE;
  82. break;
  83. case DPMI_MSDOS_EXT:
  84. VdmData = VdmMapFlat(getDS(), (*GetSIRegister)(), VDM_PM);
  85. if (!strcmp(VdmData, szMSDOS)) {
  86. setES(HIWORD(DosxMsDosApi));
  87. (*SetDIRegister)((ULONG)LOWORD(DosxMsDosApi));
  88. setAX(0);
  89. bHandled = TRUE;
  90. }
  91. break;
  92. }
  93. break;
  94. //
  95. // Int2f Func 40
  96. //
  97. case DISPCRIT_FUNC:
  98. if ((getAL() == DISPCRIT_ENTER) ||
  99. (getAL() == DISPCRIT_ENTER)) {
  100. bHandled = TRUE;
  101. }
  102. break;
  103. //
  104. // Int2f Func 43
  105. //
  106. case XMS_ID:
  107. if (getAL() == XMS_INS_CHK) {
  108. setAL(0x80);
  109. bHandled = TRUE;
  110. } else if (getAL() == XMS_CTRL_FUNC) {
  111. setES(HIWORD(DosxXmsControl));
  112. setBX(LOWORD(DosxXmsControl));
  113. bHandled = TRUE;
  114. }
  115. break;
  116. }
  117. return bHandled;
  118. }