VirtualBox

source: vbox/trunk/src/VBox/Runtime/r3/win/vcc100-kernel32-fakes.cpp@ 56290

Last change on this file since 56290 was 56290, checked in by vboxsync, 10 years ago

IPRT: Updated (C) year.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: vcc100-kernel32-fakes.cpp 56290 2015-06-09 14:01:31Z vboxsync $ */
2/** @file
3 * IPRT - Tricks to make the Visual C++ 2010 CRT work on NT4, W2K and XP.
4 */
5
6/*
7 * Copyright (C) 2012-2015 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 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27
28/*******************************************************************************
29* Header Files *
30*******************************************************************************/
31#include <iprt/cdefs.h>
32
33#ifndef RT_ARCH_X86
34# error "This code is X86 only"
35#endif
36
37#define DecodePointer Ignore_DecodePointer
38#define EncodePointer Ignore_EncodePointer
39#define InitializeCriticalSectionAndSpinCount Ignore_InitializeCriticalSectionAndSpinCount
40#define HeapSetInformation Ignore_HeapSetInformation
41#define HeapQueryInformation Ignore_HeapQueryInformation
42#include <Windows.h>
43#undef DecodePointer
44#undef EncodePointer
45#undef InitializeCriticalSectionAndSpinCount
46#undef HeapSetInformation
47#undef HeapQueryInformation
48
49
50#ifndef HEAP_STANDARD
51# define HEAP_STANDARD 0
52#endif
53
54
55/** @todo Try dynamically resolve the functions the first time one of them is
56 * called. */
57
58extern "C"
59__declspec(dllexport) PVOID WINAPI
60DecodePointer(PVOID pvEncoded)
61{
62 /*
63 * Fallback code.
64 */
65 return pvEncoded;
66}
67
68
69extern "C"
70__declspec(dllexport) PVOID WINAPI
71EncodePointer(PVOID pvNative)
72{
73 /*
74 * Fallback code.
75 */
76 return pvNative;
77}
78
79
80extern "C"
81__declspec(dllexport) BOOL WINAPI
82InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION pCritSect, DWORD cSpin)
83{
84
85 /*
86 * Fallback code.
87 */
88 InitializeCriticalSection(pCritSect);
89 return TRUE;
90}
91
92
93extern "C"
94__declspec(dllexport) BOOL WINAPI
95HeapSetInformation(HANDLE hHeap, HEAP_INFORMATION_CLASS enmInfoClass, PVOID pvBuf, SIZE_T cbBuf)
96{
97 /*
98 * Fallback code.
99 */
100 if (enmInfoClass == HeapCompatibilityInformation)
101 {
102 if ( cbBuf != sizeof(ULONG)
103 || !pvBuf
104 || *(PULONG)pvBuf == HEAP_STANDARD
105 )
106 {
107 SetLastError(ERROR_INVALID_PARAMETER);
108 return FALSE;
109 }
110 return TRUE;
111 }
112
113 SetLastError(ERROR_INVALID_PARAMETER);
114 return FALSE;
115}
116
117
118extern "C"
119__declspec(dllexport) BOOL WINAPI
120HeapQueryInformation(HANDLE hHeap, HEAP_INFORMATION_CLASS enmInfoClass, PVOID pvBuf, SIZE_T cbBuf, PSIZE_T pcbRet)
121{
122
123 /*
124 * Fallback code.
125 */
126 if (enmInfoClass == HeapCompatibilityInformation)
127 {
128 *pcbRet = sizeof(ULONG);
129 if (cbBuf < sizeof(ULONG) || !pvBuf)
130 {
131 SetLastError(ERROR_INSUFFICIENT_BUFFER);
132 return FALSE;
133 }
134 *(PULONG)pvBuf = HEAP_STANDARD;
135 return TRUE;
136 }
137
138 SetLastError(ERROR_INVALID_PARAMETER);
139 return FALSE;
140}
141
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