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.

90 lines
2.5 KiB

  1. /*************************************************************************
  2. *
  3. * channel.c
  4. *
  5. * WinStation channel routines
  6. *
  7. * Copyright Microsoft Corporation, 1998
  8. *
  9. *
  10. *************************************************************************/
  11. /*
  12. * Includes
  13. */
  14. #include "precomp.h"
  15. #pragma hdrstop
  16. NTSTATUS
  17. WinStationOpenChannel (
  18. HANDLE IcaDevice,
  19. HANDLE ProcessHandle,
  20. CHANNELCLASS ChannelClass,
  21. PVIRTUALCHANNELNAME pVirtualName,
  22. PHANDLE pDupChannel
  23. )
  24. {
  25. NTSTATUS Status;
  26. HANDLE ChannelHandle;
  27. Status = IcaChannelOpen( IcaDevice,
  28. ChannelClass,
  29. pVirtualName,
  30. &ChannelHandle );
  31. if ( !NT_SUCCESS( Status ) ) {
  32. TRACE((hTrace,TC_ICASRV,TT_ERROR, "TERMSRV: WinStationOpenChannel, IcaChannelOpen 0x%x\n",
  33. Status ));
  34. return Status;
  35. }
  36. Status = NtDuplicateObject( NtCurrentProcess(),
  37. ChannelHandle,
  38. ProcessHandle,
  39. pDupChannel,
  40. 0,
  41. 0,
  42. DUPLICATE_SAME_ACCESS );
  43. if ( !NT_SUCCESS( Status ) ) {
  44. TRACE((hTrace,TC_ICASRV,TT_ERROR, "TERMSRV: WinStationOpenChannel, NtDuplicateObject 0x%x\n",
  45. Status ));
  46. (void) IcaChannelClose( ChannelHandle );
  47. return Status;
  48. }
  49. Status = IcaChannelClose( ChannelHandle );
  50. TRACE((hTrace,TC_ICASRV,TT_API1, "TERMSRV: WinStationOpenChannel status 0x%x\n", Status ));
  51. return Status;
  52. }
  53. /*
  54. * Disable virtual channel depending on the WinStation configuration.
  55. * This was supposed to be for security purposes (Web client).
  56. *
  57. * Notes:
  58. * This doesn't protect the client since it's a host configuration option.
  59. * The client doesn't have to support any virtual channels.
  60. * It doesn't protect the host since it's the client devices you are denying
  61. * access to.
  62. * You may be adding some (fake) data security by denying the user access to
  63. * a client printer and disk so he can't download data.
  64. */
  65. VOID
  66. VirtualChannelSecurity( PWINSTATION pWinStation )
  67. {
  68. // Check for availability
  69. if ( pWinStation->pWsx &&
  70. pWinStation->pWsx->pWsxVirtualChannelSecurity ) {
  71. (void) pWinStation->pWsx->pWsxVirtualChannelSecurity(
  72. pWinStation->pWsxContext,
  73. pWinStation->hIca,
  74. &pWinStation->Config.Config.User);
  75. }
  76. }