VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/VBoxTray/testcase/tstSessionHack.cpp@ 23452

Last change on this file since 23452 was 21227, checked in by vboxsync, 16 years ago

VBoxGuest.h/VMMDev.h/VBoxGuestLib.h usage cleanup.

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1/* $Id: $ */
2/** @file
3 * tstSessionHack
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21#define _WIN32_WINNT 0x0500
22#include <Windows.h>
23#include <VBox/VBoxGuest.h>
24#include <VBoxGuestInternal.h>
25#include <iprt/assert.h>
26#include <stdio.h>
27
28void main(int argc, char *argv[])
29{
30 DWORD cbReturned;
31 DWORD status = NO_ERROR;
32 HANDLE gVBoxDriver;
33
34 /* open VBox guest driver */
35 gVBoxDriver = CreateFile(VBOXGUEST_DEVICE_NAME,
36 GENERIC_READ | GENERIC_WRITE,
37 FILE_SHARE_READ | FILE_SHARE_WRITE,
38 NULL,
39 OPEN_EXISTING,
40 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
41 NULL);
42 if (gVBoxDriver == INVALID_HANDLE_VALUE)
43 {
44 printf("Could not open VBox Guest Additions driver! rc = %d\n", GetLastError());
45 return;
46 }
47
48 if (argc == 1)
49 printf("Installing session hack\n");
50 else
51 printf("Removing session hack\n");
52
53 if (!DeviceIoControl (gVBoxDriver, (argc == 1) ? VBOXGUEST_IOCTL_ENABLE_VRDP_SESSION : VBOXGUEST_IOCTL_DISABLE_VRDP_SESSION, NULL, 0, NULL, 0, &cbReturned, NULL))
54 {
55 printf("VBoxRestoreThread: DeviceIOControl(CtlMask) failed, SeamlessChangeThread exited\n");
56 }
57 CloseHandle(gVBoxDriver);
58}
59
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette