test: dynres.c Source File

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

# dynres.c

Go to the documentation of this file.

    00001 /*************************************************************************
    00002 *
    00003 * dynres.c
    00004 *
    00005 * Copyright (c) 1985 - 1999, Microsoft Corporation
    00006 *
    00007 * WinStation Dynamic display resolution change
    00008 *
    00009 * History:
    00010 * July 25th 1997 v-mohamb Created.
    00011 \***************************************************************************/
    00012
    00013 #include "precomp.h"
    00014 #pragma hdrstop
    00015
    00016 #include "ntuser.h"
    00017
    00018 #include <winsta.h>
    00019 #include <wstmsg.h>
    00020
    00021 NTSTATUS
    00022 DrChangeDisplaySettings(WINSTATIONDORECONNECTMSG *pDoReconnectMessage);
    00023
    00024 NTSTATUS
    00025 DrGetDeviceName(OUT PUNICODE_STRING pustrDeviceName,
    00026                 WINSTATIONDORECONNECTMSG *pDoReconnectMessage);
    00027 NTSTATUS
    00028 DrSetDevMode(WINSTATIONDORECONNECTMSG *pDoReconnectMessage,
    00029              PDEVMODEW pDevmodew);
    00030
    00031
    00032 NTSTATUS
    00033 DrChangeDisplaySettings(
    00034     WINSTATIONDORECONNECTMSG *pDoReconnectMessage)
    00035 {
    00036     DEVMODEW devmodew;
    00037     UNICODE_STRING ustrDeviceName;
    00038     NTSTATUS Status;
    00039
    00040
    00041     //BUGBUG Reconnecting at a resolution different than the orignal connection
    00042     // is not functional on Hydra 5
    00043     return STATUS_NOT_IMPLEMENTED;
    00044
    00045 #if DBG
    00046     DbgPrint("\nDrChangeDisplaySettings - Entering...\n");
    00047 #endif
    00048
    00049     // Setup DEVMODE for Display settings change
    00050
    00051     Status = DrSetDevMode(pDoReconnectMessage, &devmodew);
    00052
    00053     if (!NT_SUCCESS(Status))
    00054         return Status;
    00055
    00056     // Get device name from reconnect message
    00057
    00058     Status = DrGetDeviceName(&ustrDeviceName,pDoReconnectMessage);
    00059
    00060     if (!NT_SUCCESS(Status))
    00061         return Status;
    00062
    00063     // Change display settings for every desktop
    00064
    00065     Status = NtUserChangeDisplaySettings(&ustrDeviceName,
    00066                                          &devmodew,
    00067                                          NULL,
    00068                                          (CDS_RESET | CDS_GLOBAL),
    00069                                          NULL);
    00070
    00071     return Status;
    00072 }
    00073
    00074
    00075 NTSTATUS
    00076 DrGetDeviceName(
    00077     OUT PUNICODE_STRING pustrDeviceName,
    00078     WINSTATIONDORECONNECTMSG *pDoReconnectMessage)
    00079 {
    00080     NTSTATUS Status = STATUS_SUCCESS;
    00081
    00082     pDoReconnectMessage;
    00083
    00084     // Get Device name from reconnect message ( LATTER )
    00085     // for now, just use a static name for device
    00086
    00087     RtlInitUnicodeString(pustrDeviceName, DR_RECONNECT_DEVICE_NAMEW);
    00088
    00089 #if DBG
    00090     DbgPrint("DrGetDeviceName - Device name is : %ws\n", pustrDeviceName->Buffer);
    00091 #endif
    00092
    00093     return Status;
    00094 }
    00095
    00096 NTSTATUS
    00097 DrSetDevMode(
    00098     WINSTATIONDORECONNECTMSG *pDoReconnectMessage,
    00099     PDEVMODEW pDevmodew)
    00100 {
    00101     NTSTATUS Status = STATUS_SUCCESS;
    00102
    00103     // Initialize unused fields
    00104
    00105     RtlZeroMemory(pDevmodew, sizeof(DEVMODEW));
    00106
    00107     // Get Display resolution data from reconnect data
    00108
    00109     pDevmodew->dmPelsHeight = pDoReconnectMessage->VRes;
    00110     pDevmodew->dmPelsWidth  = pDoReconnectMessage->HRes;
    00111     pDevmodew->dmBitsPerPel = pDoReconnectMessage->ColorDepth;
    00112     pDevmodew->dmFields     = DM_BITSPERPEL  | DM_PELSWIDTH  | DM_PELSHEIGHT;
    00113     pDevmodew->dmSize       = sizeof(DEVMODEW);
    00114
    00115     return Status;
    00116 }
    00117
    00118
    00119
    00120