test: srvvdm.c File Reference

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# srvvdm.c File Reference

`#include "precomp.h"`

Go to the source code of this file.

## Functions

ULONG | SrvVDMConsoleOperation (IN OUT PCSR_API_MSG m, IN OUT PCSR_REPLY_STATUS ReplyStatus)

## Function Documentation

ULONG SrvVDMConsoleOperation | ( | IN OUT PCSR_API_MSG | m,
|  | IN OUT PCSR_REPLY_STATUS | ReplyStatus
| ) |

Definition at line 24 of file srvvdm.c.

References ApiPreamble(), ASSERT, _CONSOLE_VDM_MSG::Bool, BYTE, ClientToScreen(), CM_HIDE_WINDOW, CONSOLE_CLIENTPROCESSID, CONSOLE_FULLSCREEN_NOPAINT, CONSOLE_NO_WINDOW, CONSOLE_VDM_REGISTERED, _CONSOLE_VDM_MSG::ConsoleHandle, ConsoleHeapAlloc, ConsoleHeapFree, ConsoleHeapSize, DWORD, FALSE, _CONSOLE_INFORMATION::Flags, GetClientRect(), _CONSOLE_INFORMATION::hWnd, _CONSOLE_VDM_MSG::iFunction, IsIconic(), MAKE_TAG, NT_SUCCESS, NTSTATUS(), NULL, PBYTE, PCONSOLE_VDM_MSG, _CONSOLE_VDM_MSG::Point, PostMessage(), _CONSOLE_VDM_MSG::Rect, ScreenToClient(), _CONSOLE_INFORMATION::StateBuffer, _CONSOLE_INFORMATION::StateLength, Status, UnlockConsole(), and _CONSOLE_INFORMATION::VDMProcessId.

    00028 {
    00029     PCONSOLE_VDM_MSG a = (PCONSOLE_VDM_MSG)&m->u.ApiMessageData;
    00030     NTSTATUS Status;
    00031     PCONSOLE_INFORMATION Console;
    00032
    00033     Status = ApiPreamble(a->ConsoleHandle,
    00034                          &Console
    00035                         );
    00036     if (!NT_SUCCESS(Status)) {
    00037         return Status;
    00038     }
    00039     if (!(Console->Flags & CONSOLE_VDM_REGISTERED) ||
    00040         (Console->VDMProcessId != CONSOLE_CLIENTPROCESSID())) {
    00041         Status = STATUS_INVALID_PARAMETER;
    00042     } else {
    00043         switch (a->iFunction) {
    00044             case VDM_HIDE_WINDOW:
    00045                 PostMessage(Console->hWnd,
    00046                              CM_HIDE_WINDOW,
    00047                              0,
    00048                              0
    00049                            );
    00050                 break;
    00051             case VDM_IS_ICONIC:
    00052                 a->Bool = IsIconic(Console->hWnd);
    00053                 break;
    00054             case VDM_CLIENT_RECT:
    00055                 GetClientRect(Console->hWnd,&a->Rect);
    00056                 break;
    00057             case VDM_CLIENT_TO_SCREEN:
    00058                 ClientToScreen(Console->hWnd,&a->Point);
    00059                 break;
    00060             case VDM_SCREEN_TO_CLIENT:
    00061                 ScreenToClient(Console->hWnd,&a->Point);
    00062                 break;
    00063             case VDM_IS_HIDDEN:
    00064                 a->Bool = ((Console->Flags & CONSOLE_NO_WINDOW) != 0);
    00065                 break;
    00066             case VDM_FULLSCREEN_NOPAINT:
    00067                 if (a->Bool) {
    00068                     Console->Flags |= CONSOLE_FULLSCREEN_NOPAINT;
    00069                 } else {
    00070                     Console->Flags &= ~CONSOLE_FULLSCREEN_NOPAINT;
    00071                 }
    00072                 break;
    00073 #if defined(FE_SB)
    00074             case VDM_SET_VIDEO_MODE:
    00075                 Console->fVDMVideoMode = (a->Bool != 0);
    00076                 break;
    00077 #if defined(i386)
    00078             case VDM_SAVE_RESTORE_HW_STATE:
    00079                 if (ISNECPC98(gdwMachineId)) {
    00080                     // This function is used by MVDM to save/restore HW state
    00081                     // when it executes DOS-AP on Fullscreen again.
    00082                     // It is called from MVDM\SOFTPC\HOST\SRC\NT_FULSC.C.
    00083                     VIDEO_HARDWARE_STATE State;
    00084                     ULONG StateSize = sizeof(State);
    00085
    00086                     State.StateHeader = Console->StateBuffer;
    00087                     State.StateLength = Console->StateLength;
    00088
    00089
    00090                     Status = GdiFullscreenControl(a->Bool ? FullscreenControlRestoreHardwareState
    00091                                                           : FullscreenControlSaveHardwareState,
    00092                                                   &State,
    00093                                                   StateSize,
    00094                                                   &State,
    00095                                                   &StateSize);
    00096                 }
    00097                 break;
    00098             case VDM_VIDEO_IOCTL:
    00099                 if (ISNECPC98(gdwMachineId)) {
    00100                     // This function is used by MVDM to access CG.
    00101                     // It is called from MVDM\SOFTPC\HOST\SRC\NT_CGW.C.
    00102                     PVOID InBuffer;
    00103
    00104                     if (!CsrValidateMessageBuffer(m, &a->VDMIoctlParam.lpvInBuffer, a->VDMIoctlParam.cbInBuffer, sizeof(BYTE)) ||
    00105                         !CsrValidateMessageBuffer(m, &a->VDMIoctlParam.lpvOutBuffer, a->VDMIoctlParam.cbOutBuffer, sizeof(BYTE))) {
    00106                         UnlockConsole(Console);
    00107                         return STATUS_INVALID_PARAMETER;
    00108                     }
    00109
    00110                     InBuffer = ConsoleHeapAlloc(
    00111                                          MAKE_TAG( TMP_DBCS_TAG ),
    00112                                          a->VDMIoctlParam.cbInBuffer + sizeof(DWORD)
    00113                                         );
    00114                     if (InBuffer == NULL)
    00115                     {
    00116                         Status = STATUS_NO_MEMORY;
    00117                         break;
    00118                     }
    00119
    00120                     *((PDWORD)InBuffer) = a->VDMIoctlParam.dwIoControlCode;
    00121                     RtlCopyMemory((PBYTE)InBuffer + sizeof(DWORD),
    00122                                   a->VDMIoctlParam.lpvInBuffer,
    00123                                   a->VDMIoctlParam.cbInBuffer
    00124                                  );
    00125
    00126                     Status = GdiFullscreenControl(
    00127                                  FullscreenControlSpecificVideoControl,
    00128                                  InBuffer,
    00129                                  ConsoleHeapSize(InBuffer),
    00130                                  a->VDMIoctlParam.lpvOutBuffer,
    00131                                  a->VDMIoctlParam.lpvOutBuffer ?
    00132                                      &a->VDMIoctlParam.cbOutBuffer : 0
    00133                                  );
    00134
    00135                     ConsoleHeapFree(InBuffer);
    00136                 }
    00137                 break;
    00138 #endif
    00139 #endif
    00140             default:
    00141                 ASSERT(FALSE);
    00142         }
    00143     }
    00144
    00145     UnlockConsole(Console);
    00146     return Status;
    00147     UNREFERENCED_PARAMETER(ReplyStatus);    // get rid of unreferenced parameter warning message
    00148 }