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.

99 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1985 - 1999, Microsoft Corporation
  3. Module Name:
  4. srvvdm.c
  5. Abstract:
  6. This file contains all VDM functions
  7. Author:
  8. Revision History:
  9. --*/
  10. #include "precomp.h"
  11. #include "vdm.h"
  12. #pragma hdrstop
  13. ULONG
  14. SrvVDMConsoleOperation(
  15. IN OUT PCSR_API_MSG m,
  16. IN OUT PCSR_REPLY_STATUS ReplyStatus
  17. )
  18. {
  19. PCONSOLE_VDM_MSG a = (PCONSOLE_VDM_MSG)&m->u.ApiMessageData;
  20. NTSTATUS Status;
  21. PCONSOLE_INFORMATION Console;
  22. VDM_QUERY_VDM_PROCESS_DATA QueryVdmProcessData;
  23. Status = ApiPreamble(a->ConsoleHandle,
  24. &Console
  25. );
  26. if (!NT_SUCCESS(Status)) {
  27. return Status;
  28. }
  29. //
  30. // First make sure the caller is a VDM process
  31. //
  32. QueryVdmProcessData.ProcessHandle = CONSOLE_CLIENTPROCESSHANDLE();
  33. Status = NtVdmControl(VdmQueryVdmProcess, &QueryVdmProcessData);
  34. if (!NT_SUCCESS(Status) || QueryVdmProcessData.IsVdmProcess == FALSE) {
  35. Status = STATUS_ACCESS_DENIED;
  36. } else if (!(Console->Flags & CONSOLE_VDM_REGISTERED) ||
  37. (Console->VDMProcessId != CONSOLE_CLIENTPROCESSID())) {
  38. Status = STATUS_INVALID_PARAMETER;
  39. } else {
  40. switch (a->iFunction) {
  41. case VDM_HIDE_WINDOW:
  42. Console->Flags |= CONSOLE_VDM_HIDDEN_WINDOW;
  43. PostMessage(Console->hWnd,
  44. CM_HIDE_WINDOW,
  45. 0,
  46. 0
  47. );
  48. break;
  49. case VDM_IS_ICONIC:
  50. a->Bool = IsIconic(Console->hWnd);
  51. break;
  52. case VDM_CLIENT_RECT:
  53. GetClientRect(Console->hWnd,&a->Rect);
  54. break;
  55. case VDM_CLIENT_TO_SCREEN:
  56. ClientToScreen(Console->hWnd,&a->Point);
  57. break;
  58. case VDM_SCREEN_TO_CLIENT:
  59. ScreenToClient(Console->hWnd,&a->Point);
  60. break;
  61. case VDM_IS_HIDDEN:
  62. a->Bool = ((Console->Flags & CONSOLE_NO_WINDOW) != 0);
  63. break;
  64. case VDM_FULLSCREEN_NOPAINT:
  65. if (a->Bool) {
  66. Console->Flags |= CONSOLE_FULLSCREEN_NOPAINT;
  67. } else {
  68. Console->Flags &= ~CONSOLE_FULLSCREEN_NOPAINT;
  69. }
  70. break;
  71. #if defined(FE_SB)
  72. case VDM_SET_VIDEO_MODE:
  73. Console->fVDMVideoMode = (a->Bool != 0);
  74. break;
  75. #endif
  76. default:
  77. ASSERT(FALSE);
  78. Status = STATUS_INVALID_PARAMETER;
  79. }
  80. }
  81. UnlockConsole(Console);
  82. return Status;
  83. UNREFERENCED_PARAMETER(ReplyStatus); // get rid of unreferenced parameter warning message
  84. }