Source code of Windows XP (NT5)
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.

178 lines
4.6 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. vrdisp.c
  5. Abstract:
  6. Contains dispatcher for VdmRedir (Vr) functions
  7. Contents:
  8. VrDispatch
  9. Author:
  10. Richard L Firth (rfirth) 13-Sep-1991
  11. Environment:
  12. Flat 32-bit
  13. Revision History:
  14. 13-Sep-1991 rfirth
  15. Created
  16. --*/
  17. #include <nt.h>
  18. #include <ntrtl.h> // ASSERT, DbgPrint
  19. #include <nturtl.h>
  20. #include <windows.h>
  21. #include <softpc.h> // x86 virtual machine definitions
  22. #include <vrdlctab.h>
  23. #include <vdmredir.h> // common VdmRedir stuff
  24. #include <vrinit.h> // Vr init prototypes
  25. #include <vrmisc.h> // Vr miscellaneous prototypes
  26. #include <vrnmpipe.h> // Vr named pipe prototypes
  27. #include <vrmslot.h> // Vr mailslot prototypes
  28. #include <vrnetapi.h> // Vr net api prototypes
  29. #include <nb30.h> // NCBNAMSZ etc.
  30. #include <netb.h> // Vr netbios api prototypes
  31. #include <rdrexp.h> // VrDispatch prototypes
  32. #include <rdrsvc.h> // SVC_RDR... defines
  33. #include <smbgtpt.h>
  34. #include <dlcapi.h> // Official DLC API definition
  35. #include <ntdddlc.h> // IOCTL commands
  36. #include <dlcio.h> // Internal IOCTL API interface structures
  37. #include <vrdlc.h> // Vr dlc prototypes, etc.
  38. //
  39. // The functions in VrDispatchTable must be in the same order as the
  40. // corresponding SVC codes in rdrsvc.h
  41. //
  42. VOID (*VrDispatchTable[])(VOID) = {
  43. VrInitialize, // 0x00
  44. VrUninitialize, // 0x01
  45. VrGetNamedPipeInfo, // 0x02
  46. VrGetNamedPipeHandleState, // 0x03
  47. VrSetNamedPipeHandleState, // 0x04
  48. VrPeekNamedPipe, // 0x05
  49. VrTransactNamedPipe, // 0x06
  50. VrCallNamedPipe, // 0x07
  51. VrWaitNamedPipe, // 0x08
  52. VrDeleteMailslot, // 0x09
  53. VrGetMailslotInfo, // 0x0a
  54. VrMakeMailslot, // 0x0b
  55. VrPeekMailslot, // 0x0c
  56. VrReadMailslot, // 0x0d
  57. VrWriteMailslot, // 0x0e
  58. VrTerminateDosProcess, // 0x0f
  59. VrNetTransactApi, // 0x10
  60. VrNetRemoteApi, // 0x11
  61. VrNetNullTransactApi, // 0x12
  62. VrNetServerEnum, // 0x13
  63. VrNetUseAdd, // 0x14
  64. VrNetUseDel, // 0x15
  65. VrNetUseEnum, // 0x16
  66. VrNetUseGetInfo, // 0x17
  67. VrNetWkstaGetInfo, // 0x18
  68. VrNetWkstaSetInfo, // 0x19
  69. VrNetMessageBufferSend, // 0x1a
  70. VrGetCDNames, // 0x1b
  71. VrGetComputerName, // 0x1c
  72. VrGetUserName, // 0x1d
  73. VrGetDomainName, // 0x1e
  74. VrGetLogonServer, // 0x1f
  75. VrNetHandleGetInfo, // 0x20
  76. VrNetHandleSetInfo, // 0x21
  77. VrNetGetDCName, // 0x22
  78. VrReadWriteAsyncNmPipe, // 0x23
  79. VrReadWriteAsyncNmPipe, // 0x24
  80. VrNetbios5c, // 0x25
  81. VrHandleAsyncCompletion, // 0x26
  82. VrDlc5cHandler, // 0x27
  83. VrVdmWindowInit, // 0x28
  84. VrReturnAssignMode, // 0x29
  85. VrSetAssignMode, // 0x2a
  86. VrGetAssignListEntry, // 0x2b
  87. VrDefineMacro, // 0x2c
  88. VrBreakMacro, // 0x2d
  89. VrNetServiceControl, // 0x2e
  90. VrDismissInterrupt, // 0x2f
  91. VrEoiAndDismissInterrupt, // 0x30
  92. VrCheckPmNetbiosAnr // 0x31
  93. };
  94. #define LAST_VR_FUNCTION LAST_ELEMENT(VrDispatchTable)
  95. BOOL
  96. VrDispatch(
  97. IN ULONG SvcCode
  98. )
  99. /*++
  100. Routine Description:
  101. Dispatches a Vdm Redir support function based on the SVC code
  102. Arguments:
  103. SvcCode - Function dispatcher
  104. Return Value:
  105. BOOL
  106. TRUE - Function executed
  107. FALSE - Function not executed
  108. --*/
  109. {
  110. #if 0
  111. #if DBG
  112. DbgPrint("VrDisp: You have successfully made a Bop into VdmRedir (%d)\n",
  113. SvcCode
  114. );
  115. #endif
  116. #endif
  117. if (SvcCode > LAST_VR_FUNCTION) {
  118. #if DBG
  119. DbgPrint("Error: VrDisp: Unsupported SVC code: %d\n", SvcCode);
  120. VrUnsupportedFunction();
  121. #endif
  122. return FALSE;
  123. }
  124. VrDispatchTable[SvcCode]();
  125. return TRUE;
  126. }
  127. //
  128. // BUGBUG - this goes away when all C compilers understand inline functions
  129. //
  130. #ifndef i386
  131. LPVOID _inlinePointerFromWords(WORD seg, WORD off) {
  132. WORD _seg = seg;
  133. WORD _off = off;
  134. if (seg + off) {
  135. return (LPVOID)GetVDMAddr(_seg, _off);
  136. }
  137. return 0;
  138. }
  139. LPVOID _inlineConvertAddress(WORD Seg, WORD Off, WORD Size, BOOLEAN Pm) {
  140. WORD _seg = Seg;
  141. WORD _off = Off;
  142. return (_seg | _off) ? Sim32GetVDMPointer(((DWORD)_seg << 16) + _off, Size, Pm) : 0;
  143. }
  144. #endif