VirtualBox

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

Last change on this file since 46757 was 44528, checked in by vboxsync, 12 years ago

header (C) fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 1.8 KB
Line 
1/* $Id: tstSessionHack.cpp 44528 2013-02-04 14:27:54Z vboxsync $ */
2/** @file
3 * tstSessionHack
4 */
5
6/*
7 * Copyright (C) 2006-2010 Oracle Corporation
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#define _WIN32_WINNT 0x0500
18#include <Windows.h>
19#include <VBox/VBoxGuest.h>
20#include <VBoxGuestInternal.h>
21#include <iprt/assert.h>
22#include <stdio.h>
23
24void main(int argc, char *argv[])
25{
26 DWORD cbReturned;
27 DWORD status = NO_ERROR;
28 HANDLE gVBoxDriver;
29
30 /* open VBox guest driver */
31 gVBoxDriver = CreateFile(VBOXGUEST_DEVICE_NAME,
32 GENERIC_READ | GENERIC_WRITE,
33 FILE_SHARE_READ | FILE_SHARE_WRITE,
34 NULL,
35 OPEN_EXISTING,
36 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
37 NULL);
38 if (gVBoxDriver == INVALID_HANDLE_VALUE)
39 {
40 printf("Could not open VBox Guest Additions driver! rc = %d\n", GetLastError());
41 return;
42 }
43
44 if (argc == 1)
45 printf("Installing session hack\n");
46 else
47 printf("Removing session hack\n");
48
49 if (!DeviceIoControl (gVBoxDriver, (argc == 1) ? VBOXGUEST_IOCTL_ENABLE_VRDP_SESSION : VBOXGUEST_IOCTL_DISABLE_VRDP_SESSION, NULL, 0, NULL, 0, &cbReturned, NULL))
50 {
51 printf("VBoxRestoreThread: DeviceIOControl(CtlMask) failed, SeamlessChangeThread exited\n");
52 }
53 CloseHandle(gVBoxDriver);
54}
55
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