1 | /* $Id: vcc-fakes-kernel32.cpp 84405 2020-05-20 14:27:07Z 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-2020 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 | #include <iprt/types.h>
|
---|
33 | #include <iprt/asm.h>
|
---|
34 | #include <iprt/assert.h>
|
---|
35 | #include <iprt/string.h>
|
---|
36 | #ifdef DEBUG
|
---|
37 | # include <stdio.h> /* _snprintf */
|
---|
38 | #endif
|
---|
39 |
|
---|
40 | #ifndef RT_ARCH_X86
|
---|
41 | # error "This code is X86 only"
|
---|
42 | #endif
|
---|
43 |
|
---|
44 | #include <iprt/nt/nt-and-windows.h>
|
---|
45 |
|
---|
46 | #include "vcc-fakes.h"
|
---|
47 |
|
---|
48 |
|
---|
49 | /*********************************************************************************************************************************
|
---|
50 | * Defined Constants And Macros *
|
---|
51 | *********************************************************************************************************************************/
|
---|
52 | #ifndef HEAP_STANDARD
|
---|
53 | # define HEAP_STANDARD 0
|
---|
54 | #endif
|
---|
55 |
|
---|
56 |
|
---|
57 | /** Declare a kernel32 API.
|
---|
58 | * @note We are not exporting them as that causes duplicate symbol troubles in
|
---|
59 | * the OpenGL bits. */
|
---|
60 | #define DECL_KERNEL32(a_Type) extern "C" a_Type WINAPI
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 | /*********************************************************************************************************************************
|
---|
65 | * Global Variables *
|
---|
66 | *********************************************************************************************************************************/
|
---|
67 | static volatile bool g_fInitialized = false;
|
---|
68 | #define MAKE_IMPORT_ENTRY(a_uMajorVer, a_uMinorVer, a_Name, a_cb) DECLARE_FUNCTION_POINTER(a_Name, a_cb)
|
---|
69 | #ifdef VCC_FAKES_TARGET_VCC100
|
---|
70 | # include "vcc-fakes-kernel32-100.h"
|
---|
71 | #elif defined(VCC_FAKES_TARGET_VCC140)
|
---|
72 | # include "vcc-fakes-kernel32-141.h"
|
---|
73 | #elif defined(VCC_FAKES_TARGET_VCC141)
|
---|
74 | # include "vcc-fakes-kernel32-141.h"
|
---|
75 | #elif defined(VCC_FAKES_TARGET_VCC142)
|
---|
76 | # include "vcc-fakes-kernel32-141.h"
|
---|
77 | #else
|
---|
78 | # error "Port me!"
|
---|
79 | #endif
|
---|
80 |
|
---|
81 |
|
---|
82 | static BOOL FakeSetLastErrorFromNtStatus(NTSTATUS rcNt)
|
---|
83 | {
|
---|
84 | DWORD dwErr;
|
---|
85 | switch (rcNt)
|
---|
86 | {
|
---|
87 | case STATUS_INVALID_PARAMETER:
|
---|
88 | case STATUS_INVALID_PARAMETER_1:
|
---|
89 | case STATUS_INVALID_PARAMETER_2:
|
---|
90 | case STATUS_INVALID_PARAMETER_3:
|
---|
91 | case STATUS_INVALID_PARAMETER_4:
|
---|
92 | case STATUS_INVALID_PARAMETER_5:
|
---|
93 | case STATUS_INVALID_PARAMETER_6:
|
---|
94 | case STATUS_INVALID_PARAMETER_7:
|
---|
95 | case STATUS_INVALID_PARAMETER_8:
|
---|
96 | case STATUS_INVALID_PARAMETER_9:
|
---|
97 | case STATUS_INVALID_PARAMETER_10:
|
---|
98 | case STATUS_INVALID_PARAMETER_11:
|
---|
99 | case STATUS_INVALID_PARAMETER_12:
|
---|
100 | dwErr = ERROR_INVALID_PARAMETER;
|
---|
101 | break;
|
---|
102 |
|
---|
103 | case STATUS_INVALID_HANDLE:
|
---|
104 | dwErr = ERROR_INVALID_HANDLE;
|
---|
105 | break;
|
---|
106 |
|
---|
107 | case STATUS_ACCESS_DENIED:
|
---|
108 | dwErr = ERROR_ACCESS_DENIED;
|
---|
109 | break;
|
---|
110 |
|
---|
111 | default:
|
---|
112 | dwErr = ERROR_INVALID_PARAMETER;
|
---|
113 | break;
|
---|
114 | }
|
---|
115 | SetLastError(dwErr);
|
---|
116 | return FALSE;
|
---|
117 | }
|
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 | DECL_KERNEL32(PVOID) Fake_DecodePointer(PVOID pvEncoded)
|
---|
122 | {
|
---|
123 | return pvEncoded;
|
---|
124 | }
|
---|
125 |
|
---|
126 |
|
---|
127 | DECL_KERNEL32(PVOID) Fake_EncodePointer(PVOID pvNative)
|
---|
128 | {
|
---|
129 | return pvNative;
|
---|
130 | }
|
---|
131 |
|
---|
132 |
|
---|
133 | DECL_KERNEL32(BOOL) Fake_InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION pCritSect, DWORD cSpin)
|
---|
134 | {
|
---|
135 | RT_NOREF(cSpin);
|
---|
136 | InitializeCriticalSection(pCritSect);
|
---|
137 | return TRUE;
|
---|
138 | }
|
---|
139 |
|
---|
140 |
|
---|
141 | DECL_KERNEL32(HANDLE) Fake_CreateIoCompletionPort(HANDLE hFile, HANDLE hExistingCompletionPort, ULONG_PTR uCompletionKey,
|
---|
142 | DWORD cConcurrentThreads)
|
---|
143 | {
|
---|
144 | RT_NOREF(hFile, hExistingCompletionPort, uCompletionKey, cConcurrentThreads);
|
---|
145 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
146 | return NULL;
|
---|
147 | }
|
---|
148 |
|
---|
149 |
|
---|
150 | DECL_KERNEL32(BOOL) Fake_GetQueuedCompletionStatus(HANDLE hCompletionPort, PDWORD_PTR pcbTransfered, PULONG_PTR puCompletionKey,
|
---|
151 | LPOVERLAPPED *ppOverlapped, DWORD cMs)
|
---|
152 | {
|
---|
153 | RT_NOREF(hCompletionPort, pcbTransfered, puCompletionKey, ppOverlapped, cMs);
|
---|
154 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
155 | return FALSE;
|
---|
156 | }
|
---|
157 |
|
---|
158 |
|
---|
159 | DECL_KERNEL32(BOOL) Fake_PostQueuedCompletionStatus(HANDLE hCompletionPort, DWORD cbTransfered, ULONG_PTR uCompletionKey,
|
---|
160 | LPOVERLAPPED pOverlapped)
|
---|
161 | {
|
---|
162 | RT_NOREF(hCompletionPort, cbTransfered, uCompletionKey, pOverlapped);
|
---|
163 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
164 | return FALSE;
|
---|
165 | }
|
---|
166 |
|
---|
167 |
|
---|
168 | DECL_KERNEL32(BOOL) Fake_HeapSetInformation(HANDLE hHeap, HEAP_INFORMATION_CLASS enmInfoClass, PVOID pvBuf, SIZE_T cbBuf)
|
---|
169 | {
|
---|
170 | RT_NOREF(hHeap);
|
---|
171 | if (enmInfoClass == HeapCompatibilityInformation)
|
---|
172 | {
|
---|
173 | if ( cbBuf != sizeof(ULONG)
|
---|
174 | || !pvBuf
|
---|
175 | || *(PULONG)pvBuf == HEAP_STANDARD
|
---|
176 | )
|
---|
177 | {
|
---|
178 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
179 | return FALSE;
|
---|
180 | }
|
---|
181 | return TRUE;
|
---|
182 | }
|
---|
183 |
|
---|
184 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
185 | return FALSE;
|
---|
186 | }
|
---|
187 |
|
---|
188 |
|
---|
189 | DECL_KERNEL32(BOOL) Fake_HeapQueryInformation(HANDLE hHeap, HEAP_INFORMATION_CLASS enmInfoClass,
|
---|
190 | PVOID pvBuf, SIZE_T cbBuf, PSIZE_T pcbRet)
|
---|
191 | {
|
---|
192 | RT_NOREF(hHeap);
|
---|
193 | if (enmInfoClass == HeapCompatibilityInformation)
|
---|
194 | {
|
---|
195 | *pcbRet = sizeof(ULONG);
|
---|
196 | if (cbBuf < sizeof(ULONG) || !pvBuf)
|
---|
197 | {
|
---|
198 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
---|
199 | return FALSE;
|
---|
200 | }
|
---|
201 | *(PULONG)pvBuf = HEAP_STANDARD;
|
---|
202 | return TRUE;
|
---|
203 | }
|
---|
204 |
|
---|
205 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
206 | return FALSE;
|
---|
207 | }
|
---|
208 |
|
---|
209 |
|
---|
210 | /* These are used by INTEL\mt_obj\Timer.obj: */
|
---|
211 |
|
---|
212 | DECL_KERNEL32(HANDLE) Fake_CreateTimerQueue(void)
|
---|
213 | {
|
---|
214 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
215 | return NULL;
|
---|
216 | }
|
---|
217 |
|
---|
218 | DECL_KERNEL32(BOOL) Fake_CreateTimerQueueTimer(PHANDLE phTimer, HANDLE hTimerQueue, WAITORTIMERCALLBACK pfnCallback, PVOID pvUser,
|
---|
219 | DWORD msDueTime, DWORD msPeriod, ULONG fFlags)
|
---|
220 | {
|
---|
221 | NOREF(phTimer); NOREF(hTimerQueue); NOREF(pfnCallback); NOREF(pvUser); NOREF(msDueTime); NOREF(msPeriod); NOREF(fFlags);
|
---|
222 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
223 | return FALSE;
|
---|
224 | }
|
---|
225 |
|
---|
226 | DECL_KERNEL32(BOOL) Fake_DeleteTimerQueueTimer(HANDLE hTimerQueue, HANDLE hTimer, HANDLE hEvtCompletion)
|
---|
227 | {
|
---|
228 | NOREF(hTimerQueue); NOREF(hTimer); NOREF(hEvtCompletion);
|
---|
229 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
230 | return FALSE;
|
---|
231 | }
|
---|
232 |
|
---|
233 | /* This is used by several APIs. */
|
---|
234 |
|
---|
235 | DECL_KERNEL32(VOID) Fake_InitializeSListHead(PSLIST_HEADER pHead)
|
---|
236 | {
|
---|
237 | pHead->Alignment = 0;
|
---|
238 | }
|
---|
239 |
|
---|
240 |
|
---|
241 | DECL_KERNEL32(PSLIST_ENTRY) Fake_InterlockedFlushSList(PSLIST_HEADER pHead)
|
---|
242 | {
|
---|
243 | PSLIST_ENTRY pRet = NULL;
|
---|
244 | if (pHead->Next.Next)
|
---|
245 | {
|
---|
246 | for (;;)
|
---|
247 | {
|
---|
248 | SLIST_HEADER OldHead = *pHead;
|
---|
249 | SLIST_HEADER NewHead;
|
---|
250 | NewHead.Alignment = 0;
|
---|
251 | NewHead.Sequence = OldHead.Sequence + 1;
|
---|
252 | if (ASMAtomicCmpXchgU64(&pHead->Alignment, NewHead.Alignment, OldHead.Alignment))
|
---|
253 | {
|
---|
254 | pRet = OldHead.Next.Next;
|
---|
255 | break;
|
---|
256 | }
|
---|
257 | }
|
---|
258 | }
|
---|
259 | return pRet;
|
---|
260 | }
|
---|
261 |
|
---|
262 | DECL_KERNEL32(PSLIST_ENTRY) Fake_InterlockedPopEntrySList(PSLIST_HEADER pHead)
|
---|
263 | {
|
---|
264 | PSLIST_ENTRY pRet = NULL;
|
---|
265 | for (;;)
|
---|
266 | {
|
---|
267 | SLIST_HEADER OldHead = *pHead;
|
---|
268 | pRet = OldHead.Next.Next;
|
---|
269 | if (pRet)
|
---|
270 | {
|
---|
271 | SLIST_HEADER NewHead;
|
---|
272 | __try
|
---|
273 | {
|
---|
274 | NewHead.Next.Next = pRet->Next;
|
---|
275 | }
|
---|
276 | __except(EXCEPTION_EXECUTE_HANDLER)
|
---|
277 | {
|
---|
278 | continue;
|
---|
279 | }
|
---|
280 | NewHead.Depth = OldHead.Depth - 1;
|
---|
281 | NewHead.Sequence = OldHead.Sequence + 1;
|
---|
282 | if (ASMAtomicCmpXchgU64(&pHead->Alignment, NewHead.Alignment, OldHead.Alignment))
|
---|
283 | break;
|
---|
284 | }
|
---|
285 | else
|
---|
286 | break;
|
---|
287 | }
|
---|
288 | return pRet;
|
---|
289 | }
|
---|
290 |
|
---|
291 | DECL_KERNEL32(PSLIST_ENTRY) Fake_InterlockedPushEntrySList(PSLIST_HEADER pHead, PSLIST_ENTRY pEntry)
|
---|
292 | {
|
---|
293 | PSLIST_ENTRY pRet = NULL;
|
---|
294 | for (;;)
|
---|
295 | {
|
---|
296 | SLIST_HEADER OldHead = *pHead;
|
---|
297 | pRet = OldHead.Next.Next;
|
---|
298 | pEntry->Next = pRet;
|
---|
299 | SLIST_HEADER NewHead;
|
---|
300 | NewHead.Next.Next = pEntry;
|
---|
301 | NewHead.Depth = OldHead.Depth + 1;
|
---|
302 | NewHead.Sequence = OldHead.Sequence + 1;
|
---|
303 | if (ASMAtomicCmpXchgU64(&pHead->Alignment, NewHead.Alignment, OldHead.Alignment))
|
---|
304 | break;
|
---|
305 | }
|
---|
306 | return pRet;
|
---|
307 | }
|
---|
308 |
|
---|
309 | DECL_KERNEL32(WORD) Fake_QueryDepthSList(PSLIST_HEADER pHead)
|
---|
310 | {
|
---|
311 | return pHead->Depth;
|
---|
312 | }
|
---|
313 |
|
---|
314 |
|
---|
315 | /* curl drags these in: */
|
---|
316 | DECL_KERNEL32(BOOL) Fake_VerifyVersionInfoA(LPOSVERSIONINFOEXA pInfo, DWORD fTypeMask, DWORDLONG fConditionMask)
|
---|
317 | {
|
---|
318 | OSVERSIONINFOEXA VerInfo;
|
---|
319 | RT_ZERO(VerInfo);
|
---|
320 | VerInfo.dwOSVersionInfoSize = sizeof(VerInfo);
|
---|
321 | if (!GetVersionExA((OSVERSIONINFO *)&VerInfo))
|
---|
322 | {
|
---|
323 | RT_ZERO(VerInfo);
|
---|
324 | VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
---|
325 | BOOL fRet = GetVersionExA((OSVERSIONINFO *)&VerInfo);
|
---|
326 | if (fRet)
|
---|
327 | { /* likely */ }
|
---|
328 | else
|
---|
329 | {
|
---|
330 | MY_ASSERT(false, "VerifyVersionInfoA: #1");
|
---|
331 | return FALSE;
|
---|
332 | }
|
---|
333 | }
|
---|
334 |
|
---|
335 | BOOL fRet = TRUE;
|
---|
336 | for (unsigned i = 0; i < 8 && fRet; i++)
|
---|
337 | if (fTypeMask & RT_BIT_32(i))
|
---|
338 | {
|
---|
339 | uint32_t uLeft, uRight;
|
---|
340 | switch (RT_BIT_32(i))
|
---|
341 | {
|
---|
342 | #define MY_CASE(a_Num, a_Member) case a_Num: uLeft = VerInfo.a_Member; uRight = pInfo->a_Member; break
|
---|
343 | MY_CASE(VER_MINORVERSION, dwMinorVersion);
|
---|
344 | MY_CASE(VER_MAJORVERSION, dwMajorVersion);
|
---|
345 | MY_CASE(VER_BUILDNUMBER, dwBuildNumber);
|
---|
346 | MY_CASE(VER_PLATFORMID, dwPlatformId);
|
---|
347 | MY_CASE(VER_SERVICEPACKMINOR, wServicePackMinor);
|
---|
348 | MY_CASE(VER_SERVICEPACKMAJOR, wServicePackMinor);
|
---|
349 | MY_CASE(VER_SUITENAME, wSuiteMask);
|
---|
350 | MY_CASE(VER_PRODUCT_TYPE, wProductType);
|
---|
351 | #undef MY_CASE
|
---|
352 | default: uLeft = uRight = 0; MY_ASSERT(false, "VerifyVersionInfoA: #2");
|
---|
353 | }
|
---|
354 | switch ((uint8_t)(fConditionMask >> (i*8)))
|
---|
355 | {
|
---|
356 | case VER_EQUAL: fRet = uLeft == uRight; break;
|
---|
357 | case VER_GREATER: fRet = uLeft > uRight; break;
|
---|
358 | case VER_GREATER_EQUAL: fRet = uLeft >= uRight; break;
|
---|
359 | case VER_LESS: fRet = uLeft < uRight; break;
|
---|
360 | case VER_LESS_EQUAL: fRet = uLeft <= uRight; break;
|
---|
361 | case VER_AND: fRet = (uLeft & uRight) == uRight; break;
|
---|
362 | case VER_OR: fRet = (uLeft & uRight) != 0; break;
|
---|
363 | default: fRet = FALSE; MY_ASSERT(false, "VerifyVersionInfoA: #3"); break;
|
---|
364 | }
|
---|
365 | }
|
---|
366 |
|
---|
367 | return fRet;
|
---|
368 | }
|
---|
369 |
|
---|
370 |
|
---|
371 | DECL_KERNEL32(ULONGLONG) Fake_VerSetConditionMask(ULONGLONG fConditionMask, DWORD fTypeMask, BYTE bOperator)
|
---|
372 | {
|
---|
373 | for (unsigned i = 0; i < 8; i++)
|
---|
374 | if (fTypeMask & RT_BIT_32(i))
|
---|
375 | {
|
---|
376 | uint64_t fMask = UINT64_C(0xff) << (i*8);
|
---|
377 | fConditionMask &= ~fMask;
|
---|
378 | fConditionMask |= (uint64_t)bOperator << (i*8);
|
---|
379 |
|
---|
380 | }
|
---|
381 | return fConditionMask;
|
---|
382 | }
|
---|
383 |
|
---|
384 |
|
---|
385 | #if VCC_FAKES_TARGET >= 140
|
---|
386 | /** @since 5.0 (windows 2000) */
|
---|
387 | DECL_KERNEL32(BOOL) Fake_GetModuleHandleExW(DWORD dwFlags, LPCWSTR pwszModuleName, HMODULE *phModule)
|
---|
388 | {
|
---|
389 | HMODULE hmod;
|
---|
390 | if (dwFlags & GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS)
|
---|
391 | {
|
---|
392 | /** @todo search the loader list. */
|
---|
393 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
394 | return FALSE;
|
---|
395 | }
|
---|
396 | else
|
---|
397 | {
|
---|
398 | hmod = GetModuleHandleW(pwszModuleName);
|
---|
399 | if (!hmod)
|
---|
400 | return FALSE;
|
---|
401 | }
|
---|
402 |
|
---|
403 | /*
|
---|
404 | * Get references to the module.
|
---|
405 | */
|
---|
406 | if ( !(dwFlags & (GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | GET_MODULE_HANDLE_EX_FLAG_PIN))
|
---|
407 | && GetModuleHandleW(NULL) != hmod)
|
---|
408 | {
|
---|
409 | WCHAR wszModule[MAX_PATH];
|
---|
410 | if (GetModuleFileNameW(hmod, wszModule, RT_ELEMENTS(wszModule)) > 0)
|
---|
411 | {
|
---|
412 | if (dwFlags & GET_MODULE_HANDLE_EX_FLAG_PIN)
|
---|
413 | {
|
---|
414 | uint32_t cRefs = 32;
|
---|
415 | while (cRefs-- > 0)
|
---|
416 | LoadLibraryW(wszModule);
|
---|
417 | }
|
---|
418 | else if (!LoadLibraryW(wszModule))
|
---|
419 | return FALSE;
|
---|
420 | }
|
---|
421 | }
|
---|
422 |
|
---|
423 | *phModule = hmod;
|
---|
424 | return TRUE;
|
---|
425 | }
|
---|
426 | #endif /* VCC_FAKES_TARGET >= 141 */
|
---|
427 |
|
---|
428 |
|
---|
429 | #if VCC_FAKES_TARGET >= 140
|
---|
430 | /** @since 5.0 (windows 2000) */
|
---|
431 | DECL_KERNEL32(BOOL) Fake_SetFilePointerEx(HANDLE hFile, LARGE_INTEGER offDistanceToMove,
|
---|
432 | PLARGE_INTEGER pNewFilePointer, DWORD dwMoveMethod)
|
---|
433 | {
|
---|
434 | NTSTATUS rcNt;
|
---|
435 | IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER;
|
---|
436 |
|
---|
437 | FILE_POSITION_INFORMATION PosInfo;
|
---|
438 | switch (dwMoveMethod)
|
---|
439 | {
|
---|
440 | case FILE_BEGIN:
|
---|
441 | PosInfo.CurrentByteOffset = offDistanceToMove;
|
---|
442 | break;
|
---|
443 |
|
---|
444 | case FILE_CURRENT:
|
---|
445 | PosInfo.CurrentByteOffset.QuadPart = INT64_MAX;
|
---|
446 | rcNt = NtQueryInformationFile(hFile, &Ios, &PosInfo, sizeof(PosInfo), FilePositionInformation);
|
---|
447 | if (NT_SUCCESS(rcNt))
|
---|
448 | {
|
---|
449 | PosInfo.CurrentByteOffset.QuadPart += offDistanceToMove.QuadPart;
|
---|
450 | break;
|
---|
451 | }
|
---|
452 | return FakeSetLastErrorFromNtStatus(rcNt);
|
---|
453 |
|
---|
454 | case FILE_END:
|
---|
455 | {
|
---|
456 | FILE_STANDARD_INFO StdInfo = {0};
|
---|
457 | rcNt = NtQueryInformationFile(hFile, &Ios, &StdInfo, sizeof(StdInfo), FileStandardInformation);
|
---|
458 | if (NT_SUCCESS(rcNt))
|
---|
459 | {
|
---|
460 | PosInfo.CurrentByteOffset.QuadPart = offDistanceToMove.QuadPart + StdInfo.EndOfFile.QuadPart;
|
---|
461 | break;
|
---|
462 | }
|
---|
463 | return FakeSetLastErrorFromNtStatus(rcNt);
|
---|
464 | }
|
---|
465 |
|
---|
466 | default:
|
---|
467 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
468 | return FALSE;
|
---|
469 | }
|
---|
470 |
|
---|
471 | rcNt = NtSetInformationFile(hFile, &Ios, &PosInfo, sizeof(PosInfo), FilePositionInformation);
|
---|
472 | if (NT_SUCCESS(rcNt))
|
---|
473 | {
|
---|
474 | if (pNewFilePointer)
|
---|
475 | *pNewFilePointer = PosInfo.CurrentByteOffset;
|
---|
476 | return TRUE;
|
---|
477 | }
|
---|
478 | return FakeSetLastErrorFromNtStatus(rcNt);
|
---|
479 | }
|
---|
480 | #endif /* VCC_FAKES_TARGET >= 140 */
|
---|
481 |
|
---|
482 |
|
---|
483 | #if VCC_FAKES_TARGET >= 140
|
---|
484 | /** @since 5.0 (windows 2000) */
|
---|
485 | DECL_KERNEL32(BOOL) Fake_GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER pcbFile)
|
---|
486 | {
|
---|
487 | IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER;
|
---|
488 | FILE_STANDARD_INFO StdInfo = {0};
|
---|
489 | NTSTATUS rcNt = NtQueryInformationFile(hFile, &Ios, &StdInfo, sizeof(StdInfo), FileStandardInformation);
|
---|
490 | if (NT_SUCCESS(rcNt))
|
---|
491 | {
|
---|
492 | *pcbFile = StdInfo.EndOfFile;
|
---|
493 | return TRUE;
|
---|
494 | }
|
---|
495 | return FakeSetLastErrorFromNtStatus(rcNt);
|
---|
496 | }
|
---|
497 | #endif /* VCC_FAKES_TARGET >= 140 */
|
---|
498 |
|
---|
499 |
|
---|
500 |
|
---|
501 |
|
---|
502 | /*
|
---|
503 | * NT 3.51 stuff.
|
---|
504 | */
|
---|
505 |
|
---|
506 | #if VCC_FAKES_TARGET >= 140
|
---|
507 | /** @since 4.0 */
|
---|
508 | DECL_KERNEL32(HANDLE) Fake_FindFirstFileExW(LPCWSTR pwszFileName, FINDEX_INFO_LEVELS enmInfoLevel, LPVOID pvFindFileData,
|
---|
509 | FINDEX_SEARCH_OPS enmSearchOp, LPVOID pvSearchFilter, DWORD dwAdditionalFlags)
|
---|
510 | {
|
---|
511 | // STL: FindFirstFileExW(, FindExInfoBasic, , FindExSearchNameMatch, NULL, 0);
|
---|
512 | // CRT/_findfile: FindFirstFileExW(, FindExInfoStandard, , FindExSearchNameMatch, NULL, 0);
|
---|
513 | // CRT/argv_wildcards: FindFirstFileExW(, FindExInfoStandard, , FindExSearchNameMatch, NULL, 0);
|
---|
514 | MY_ASSERT_STMT_RETURN(dwAdditionalFlags == 0, SetLastError(ERROR_INVALID_PARAMETER), INVALID_HANDLE_VALUE);
|
---|
515 | MY_ASSERT_STMT_RETURN(pvSearchFilter == NULL, SetLastError(ERROR_INVALID_PARAMETER), INVALID_HANDLE_VALUE);
|
---|
516 | MY_ASSERT_STMT_RETURN(enmSearchOp == FindExSearchNameMatch, SetLastError(ERROR_INVALID_PARAMETER), INVALID_HANDLE_VALUE);
|
---|
517 | MY_ASSERT_STMT_RETURN(enmInfoLevel == FindExInfoStandard || enmInfoLevel == FindExInfoBasic,
|
---|
518 | SetLastError(ERROR_INVALID_PARAMETER), INVALID_HANDLE_VALUE);
|
---|
519 |
|
---|
520 | return FindFirstFileW(pwszFileName, (WIN32_FIND_DATAW *)pvFindFileData);
|
---|
521 | }
|
---|
522 | #endif /* VCC_FAKES_TARGET >= 140 */
|
---|
523 |
|
---|
524 |
|
---|
525 | DECL_KERNEL32(BOOL) Fake_IsProcessorFeaturePresent(DWORD enmProcessorFeature)
|
---|
526 | {
|
---|
527 | /* Could make more of an effort here... */
|
---|
528 | RT_NOREF(enmProcessorFeature);
|
---|
529 | return FALSE;
|
---|
530 | }
|
---|
531 |
|
---|
532 |
|
---|
533 | DECL_KERNEL32(BOOL) Fake_CancelIo(HANDLE hHandle)
|
---|
534 | {
|
---|
535 | /* All NT versions the NTDLL API this corresponds to. */
|
---|
536 | RESOLVE_NTDLL_API(NtCancelIoFile);
|
---|
537 | if (pfnNtCancelIoFile)
|
---|
538 | {
|
---|
539 | IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER;
|
---|
540 | NTSTATUS rcNt = pfnNtCancelIoFile(hHandle, &Ios);
|
---|
541 | if (RT_SUCCESS(rcNt))
|
---|
542 | return TRUE;
|
---|
543 | if (rcNt == STATUS_INVALID_HANDLE)
|
---|
544 | SetLastError(ERROR_INVALID_HANDLE);
|
---|
545 | else
|
---|
546 | SetLastError(ERROR_INVALID_FUNCTION);
|
---|
547 | }
|
---|
548 | else
|
---|
549 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
550 | return FALSE;
|
---|
551 | }
|
---|
552 |
|
---|
553 |
|
---|
554 | /*
|
---|
555 | * NT 3.50 stuff.
|
---|
556 | */
|
---|
557 |
|
---|
558 | #if VCC_FAKES_TARGET >= 140
|
---|
559 | /** @since 3.51 */
|
---|
560 | DECL_KERNEL32(VOID) Fake_FreeLibraryAndExitThread(HMODULE hLibModule, DWORD dwExitCode)
|
---|
561 | {
|
---|
562 | if (hLibModule)
|
---|
563 | FreeModule(hLibModule);
|
---|
564 | ExitThread(dwExitCode);
|
---|
565 | }
|
---|
566 | #endif /* VCC_FAKES_TARGET >= 140 */
|
---|
567 |
|
---|
568 |
|
---|
569 | DECL_KERNEL32(BOOL) Fake_IsDebuggerPresent(VOID)
|
---|
570 | {
|
---|
571 | /* Fallback: */
|
---|
572 | return FALSE;
|
---|
573 | }
|
---|
574 |
|
---|
575 |
|
---|
576 | DECL_KERNEL32(VOID) Fake_GetSystemTimeAsFileTime(LPFILETIME pTime)
|
---|
577 | {
|
---|
578 | DWORD dwVersion = GetVersion();
|
---|
579 | if ( (dwVersion & 0xff) > 3
|
---|
580 | || ( (dwVersion & 0xff) == 3
|
---|
581 | && ((dwVersion >> 8) & 0xff) >= 50) )
|
---|
582 | {
|
---|
583 | PKUSER_SHARED_DATA pUsd = (PKUSER_SHARED_DATA)MM_SHARED_USER_DATA_VA;
|
---|
584 |
|
---|
585 | /* use interrupt time */
|
---|
586 | LARGE_INTEGER Time;
|
---|
587 | do
|
---|
588 | {
|
---|
589 | Time.HighPart = pUsd->SystemTime.High1Time;
|
---|
590 | Time.LowPart = pUsd->SystemTime.LowPart;
|
---|
591 | } while (pUsd->SystemTime.High2Time != Time.HighPart);
|
---|
592 |
|
---|
593 | pTime->dwHighDateTime = Time.HighPart;
|
---|
594 | pTime->dwLowDateTime = Time.LowPart;
|
---|
595 | }
|
---|
596 | else
|
---|
597 | {
|
---|
598 | /* NT 3.1 didn't have a KUSER_SHARED_DATA nor a GetSystemTimeAsFileTime export. */
|
---|
599 | SYSTEMTIME SystemTime;
|
---|
600 | GetSystemTime(&SystemTime);
|
---|
601 | BOOL fRet = SystemTimeToFileTime(&SystemTime, pTime);
|
---|
602 | if (fRet)
|
---|
603 | { /* likely */ }
|
---|
604 | else
|
---|
605 | {
|
---|
606 | MY_ASSERT(false, "GetSystemTimeAsFileTime: #2");
|
---|
607 | pTime->dwHighDateTime = 0;
|
---|
608 | pTime->dwLowDateTime = 0;
|
---|
609 | }
|
---|
610 | }
|
---|
611 | }
|
---|
612 |
|
---|
613 |
|
---|
614 | /*
|
---|
615 | * NT 3.1 stuff.
|
---|
616 | */
|
---|
617 |
|
---|
618 | DECL_KERNEL32(BOOL) Fake_GetVersionExA(LPOSVERSIONINFOA pInfo)
|
---|
619 | {
|
---|
620 | DWORD dwVersion = GetVersion();
|
---|
621 |
|
---|
622 | /* Common fields: */
|
---|
623 | pInfo->dwMajorVersion = dwVersion & 0xff;
|
---|
624 | pInfo->dwMinorVersion = (dwVersion >> 8) & 0xff;
|
---|
625 | if (!(dwVersion & RT_BIT_32(31)))
|
---|
626 | pInfo->dwBuildNumber = dwVersion >> 16;
|
---|
627 | else
|
---|
628 | pInfo->dwBuildNumber = 511;
|
---|
629 | pInfo->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
---|
630 | /** @todo get CSD from registry. */
|
---|
631 | pInfo->szCSDVersion[0] = '\0';
|
---|
632 |
|
---|
633 | /* OSVERSIONINFOEX fields: */
|
---|
634 | if (pInfo->dwOSVersionInfoSize > sizeof((*pInfo)))
|
---|
635 | {
|
---|
636 | LPOSVERSIONINFOEXA pInfoEx = (LPOSVERSIONINFOEXA)pInfo;
|
---|
637 | if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXA, wServicePackMinor))
|
---|
638 | {
|
---|
639 | pInfoEx->wServicePackMajor = 0;
|
---|
640 | pInfoEx->wServicePackMinor = 0;
|
---|
641 | }
|
---|
642 | if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXA, wSuiteMask))
|
---|
643 | pInfoEx->wSuiteMask = 0;
|
---|
644 | if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXA, wProductType))
|
---|
645 | pInfoEx->wProductType = VER_NT_WORKSTATION;
|
---|
646 | if (pInfoEx->wReserved > RT_UOFFSETOF(OSVERSIONINFOEXA, wProductType))
|
---|
647 | pInfoEx->wReserved = 0;
|
---|
648 | }
|
---|
649 |
|
---|
650 | return TRUE;
|
---|
651 | }
|
---|
652 |
|
---|
653 |
|
---|
654 | DECL_KERNEL32(BOOL) Fake_GetVersionExW(LPOSVERSIONINFOW pInfo)
|
---|
655 | {
|
---|
656 | DWORD dwVersion = GetVersion();
|
---|
657 |
|
---|
658 | /* Common fields: */
|
---|
659 | pInfo->dwMajorVersion = dwVersion & 0xff;
|
---|
660 | pInfo->dwMinorVersion = (dwVersion >> 8) & 0xff;
|
---|
661 | if (!(dwVersion & RT_BIT_32(31)))
|
---|
662 | pInfo->dwBuildNumber = dwVersion >> 16;
|
---|
663 | else
|
---|
664 | pInfo->dwBuildNumber = 511;
|
---|
665 | pInfo->dwPlatformId = VER_PLATFORM_WIN32_NT;
|
---|
666 | /** @todo get CSD from registry. */
|
---|
667 | pInfo->szCSDVersion[0] = '\0';
|
---|
668 |
|
---|
669 | /* OSVERSIONINFOEX fields: */
|
---|
670 | if (pInfo->dwOSVersionInfoSize > sizeof((*pInfo)))
|
---|
671 | {
|
---|
672 | LPOSVERSIONINFOEXW pInfoEx = (LPOSVERSIONINFOEXW)pInfo;
|
---|
673 | if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXW, wServicePackMinor))
|
---|
674 | {
|
---|
675 | pInfoEx->wServicePackMajor = 0;
|
---|
676 | pInfoEx->wServicePackMinor = 0;
|
---|
677 | }
|
---|
678 | if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXW, wSuiteMask))
|
---|
679 | pInfoEx->wSuiteMask = 0;
|
---|
680 | if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXW, wProductType))
|
---|
681 | pInfoEx->wProductType = VER_NT_WORKSTATION;
|
---|
682 | if (pInfoEx->wReserved > RT_UOFFSETOF(OSVERSIONINFOEXW, wProductType))
|
---|
683 | pInfoEx->wReserved = 0;
|
---|
684 | }
|
---|
685 |
|
---|
686 | return TRUE;
|
---|
687 | }
|
---|
688 |
|
---|
689 |
|
---|
690 | DECL_KERNEL32(LPWCH) Fake_GetEnvironmentStringsW(void)
|
---|
691 | {
|
---|
692 | /*
|
---|
693 | * Environment is ANSI in NT 3.1. We should only be here for NT 3.1.
|
---|
694 | * For now, don't try do a perfect job converting it, just do it.
|
---|
695 | */
|
---|
696 | char *pszzEnv = (char *)RTNtCurrentPeb()->ProcessParameters->Environment;
|
---|
697 | size_t offEnv = 0;
|
---|
698 | while (pszzEnv[offEnv] != '\0')
|
---|
699 | {
|
---|
700 | size_t cchLen = strlen(&pszzEnv[offEnv]);
|
---|
701 | offEnv += cchLen + 1;
|
---|
702 | }
|
---|
703 | size_t const cchEnv = offEnv + 1;
|
---|
704 |
|
---|
705 | PRTUTF16 pwszzEnv = (PRTUTF16)HeapAlloc(GetProcessHeap(), 0, cchEnv * sizeof(RTUTF16));
|
---|
706 | if (!pwszzEnv)
|
---|
707 | return NULL;
|
---|
708 | for (offEnv = 0; offEnv < cchEnv; offEnv++)
|
---|
709 | {
|
---|
710 | unsigned char ch = pwszzEnv[offEnv];
|
---|
711 | if (!(ch & 0x80))
|
---|
712 | pwszzEnv[offEnv] = ch;
|
---|
713 | else
|
---|
714 | pwszzEnv[offEnv] = '_';
|
---|
715 | }
|
---|
716 | return pwszzEnv;
|
---|
717 | }
|
---|
718 |
|
---|
719 |
|
---|
720 | DECL_KERNEL32(BOOL) Fake_FreeEnvironmentStringsW(LPWCH pwszzEnv)
|
---|
721 | {
|
---|
722 | if (pwszzEnv)
|
---|
723 | HeapFree(GetProcessHeap(), 0, pwszzEnv);
|
---|
724 | return TRUE;
|
---|
725 | }
|
---|
726 |
|
---|
727 |
|
---|
728 | DECL_KERNEL32(int) Fake_GetLocaleInfoA(LCID idLocale, LCTYPE enmType, LPSTR pData, int cchData)
|
---|
729 | {
|
---|
730 | NOREF(idLocale); NOREF(enmType); NOREF(pData); NOREF(cchData);
|
---|
731 | //MY_ASSERT(false, "GetLocaleInfoA: idLocale=%#x enmType=%#x cchData=%#x", idLocale, enmType, cchData);
|
---|
732 | MY_ASSERT(false, "GetLocaleInfoA");
|
---|
733 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
734 | return 0;
|
---|
735 | }
|
---|
736 |
|
---|
737 |
|
---|
738 | #if VCC_FAKES_TARGET >= 140
|
---|
739 | /** @since 3.51 */
|
---|
740 | DECL_KERNEL32(BOOL) Fake_EnumSystemLocalesW(LOCALE_ENUMPROCW pfnLocaleEnum, DWORD dwFlags)
|
---|
741 | {
|
---|
742 | RT_NOREF(pfnLocaleEnum, dwFlags);
|
---|
743 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
744 | return FALSE;
|
---|
745 | }
|
---|
746 | #endif /* VCC_FAKES_TARGET >= 140 */
|
---|
747 |
|
---|
748 |
|
---|
749 | DECL_KERNEL32(BOOL) Fake_EnumSystemLocalesA(LOCALE_ENUMPROCA pfnCallback, DWORD fFlags)
|
---|
750 | {
|
---|
751 | NOREF(pfnCallback); NOREF(fFlags);
|
---|
752 | //MY_ASSERT(false, "EnumSystemLocalesA: pfnCallback=%p fFlags=%#x", pfnCallback, fFlags);
|
---|
753 | MY_ASSERT(false, "EnumSystemLocalesA");
|
---|
754 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
755 | return FALSE;
|
---|
756 | }
|
---|
757 |
|
---|
758 |
|
---|
759 | DECL_KERNEL32(BOOL) Fake_IsValidLocale(LCID idLocale, DWORD fFlags)
|
---|
760 | {
|
---|
761 | NOREF(idLocale); NOREF(fFlags);
|
---|
762 | //MY_ASSERT(false, "IsValidLocale: idLocale fFlags=%#x", idLocale, fFlags);
|
---|
763 | MY_ASSERT(false, "IsValidLocale");
|
---|
764 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
765 | return FALSE;
|
---|
766 | }
|
---|
767 |
|
---|
768 |
|
---|
769 | DECL_KERNEL32(DWORD_PTR) Fake_SetThreadAffinityMask(HANDLE hThread, DWORD_PTR fAffinityMask)
|
---|
770 | {
|
---|
771 | SYSTEM_INFO SysInfo;
|
---|
772 | GetSystemInfo(&SysInfo);
|
---|
773 | //MY_ASSERT(false, "SetThreadAffinityMask: hThread=%p fAffinityMask=%p SysInfo.dwActiveProcessorMask=%p",
|
---|
774 | // hThread, fAffinityMask, SysInfo.dwActiveProcessorMask);
|
---|
775 | MY_ASSERT(false, "SetThreadAffinityMask");
|
---|
776 | if ( SysInfo.dwActiveProcessorMask == fAffinityMask
|
---|
777 | || fAffinityMask == ~(DWORD_PTR)0)
|
---|
778 | return fAffinityMask;
|
---|
779 |
|
---|
780 | SetLastError(ERROR_NOT_SUPPORTED);
|
---|
781 | RT_NOREF(hThread);
|
---|
782 | return 0;
|
---|
783 | }
|
---|
784 |
|
---|
785 |
|
---|
786 | DECL_KERNEL32(BOOL) Fake_GetProcessAffinityMask(HANDLE hProcess, PDWORD_PTR pfProcessAffinityMask, PDWORD_PTR pfSystemAffinityMask)
|
---|
787 | {
|
---|
788 | SYSTEM_INFO SysInfo;
|
---|
789 | GetSystemInfo(&SysInfo);
|
---|
790 | //MY_ASSERT(false, "GetProcessAffinityMask: SysInfo.dwActiveProcessorMask=%p", SysInfo.dwActiveProcessorMask);
|
---|
791 | MY_ASSERT(false, "GetProcessAffinityMask");
|
---|
792 | if (pfProcessAffinityMask)
|
---|
793 | *pfProcessAffinityMask = SysInfo.dwActiveProcessorMask;
|
---|
794 | if (pfSystemAffinityMask)
|
---|
795 | *pfSystemAffinityMask = SysInfo.dwActiveProcessorMask;
|
---|
796 | RT_NOREF(hProcess);
|
---|
797 | return TRUE;
|
---|
798 | }
|
---|
799 |
|
---|
800 |
|
---|
801 | DECL_KERNEL32(BOOL) Fake_GetHandleInformation(HANDLE hObject, DWORD *pfFlags)
|
---|
802 | {
|
---|
803 | OBJECT_HANDLE_FLAG_INFORMATION Info = { 0, 0 };
|
---|
804 | DWORD cbRet = sizeof(Info);
|
---|
805 | NTSTATUS rcNt = NtQueryObject(hObject, ObjectHandleFlagInformation, &Info, sizeof(Info), &cbRet);
|
---|
806 | if (NT_SUCCESS(rcNt))
|
---|
807 | {
|
---|
808 | *pfFlags = (Info.Inherit ? HANDLE_FLAG_INHERIT : 0)
|
---|
809 | | (Info.ProtectFromClose ? HANDLE_FLAG_PROTECT_FROM_CLOSE : 0);
|
---|
810 | return TRUE;
|
---|
811 | }
|
---|
812 | *pfFlags = 0;
|
---|
813 | //MY_ASSERT(rcNt == STATUS_INVALID_HANDLE, "rcNt=%#x", rcNt);
|
---|
814 | MY_ASSERT(rcNt == STATUS_INVALID_HANDLE || rcNt == STATUS_INVALID_INFO_CLASS, "GetHandleInformation");
|
---|
815 | SetLastError(rcNt == STATUS_INVALID_HANDLE ? ERROR_INVALID_HANDLE : ERROR_INVALID_FUNCTION); /* see also process-win.cpp */
|
---|
816 | return FALSE;
|
---|
817 | }
|
---|
818 |
|
---|
819 |
|
---|
820 | DECL_KERNEL32(BOOL) Fake_SetHandleInformation(HANDLE hObject, DWORD fMask, DWORD fFlags)
|
---|
821 | {
|
---|
822 | NOREF(hObject); NOREF(fMask); NOREF(fFlags);
|
---|
823 | SetLastError(ERROR_INVALID_FUNCTION);
|
---|
824 | return FALSE;
|
---|
825 | }
|
---|
826 |
|
---|
827 |
|
---|
828 |
|
---|
829 | /**
|
---|
830 | * Resolves all the APIs ones and for all, updating the fake IAT entries.
|
---|
831 | */
|
---|
832 | DECLASM(void) FakeResolve_kernel32(void)
|
---|
833 | {
|
---|
834 | CURRENT_VERSION_VARIABLE();
|
---|
835 |
|
---|
836 | HMODULE hmod = GetModuleHandleW(L"kernel32");
|
---|
837 | MY_ASSERT(hmod != NULL, "kernel32");
|
---|
838 |
|
---|
839 | #undef MAKE_IMPORT_ENTRY
|
---|
840 | #define MAKE_IMPORT_ENTRY(a_uMajorVer, a_uMinorVer, a_Name, a_cb) RESOLVE_IMPORT(a_uMajorVer, a_uMinorVer, a_Name, a_cb)
|
---|
841 | #ifdef VCC_FAKES_TARGET_VCC100
|
---|
842 | # include "vcc-fakes-kernel32-100.h"
|
---|
843 | #elif defined(VCC_FAKES_TARGET_VCC140)
|
---|
844 | # include "vcc-fakes-kernel32-141.h"
|
---|
845 | #elif defined(VCC_FAKES_TARGET_VCC141)
|
---|
846 | # include "vcc-fakes-kernel32-141.h"
|
---|
847 | #elif defined(VCC_FAKES_TARGET_VCC142)
|
---|
848 | # include "vcc-fakes-kernel32-141.h"
|
---|
849 | #else
|
---|
850 | # error "Port me!"
|
---|
851 | #endif
|
---|
852 |
|
---|
853 | g_fInitialized = true;
|
---|
854 | }
|
---|
855 |
|
---|
856 |
|
---|
857 | /* Dummy to force dragging in this object in the link, so the linker
|
---|
858 | won't accidentally use the symbols from kernel32. */
|
---|
859 | extern "C" int vcc100_kernel32_fakes_cpp(void)
|
---|
860 | {
|
---|
861 | return 42;
|
---|
862 | }
|
---|
863 |
|
---|