VirtualBox

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

Last change on this file since 76513 was 70486, checked in by vboxsync, 7 years ago

IPRT/process-win.cpp: Make inheritance work on NT 3.1 too.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 19.1 KB
Line 
1/* $Id: vcc100-kernel32-fakes.cpp 70486 2018-01-08 14:16:16Z 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-2017 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 "vcc100-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*********************************************************************************************************************************/
67static 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#include "vcc100-kernel32-fakes.h"
70
71
72
73DECL_KERNEL32(PVOID) Fake_DecodePointer(PVOID pvEncoded)
74{
75 return pvEncoded;
76}
77
78
79DECL_KERNEL32(PVOID) Fake_EncodePointer(PVOID pvNative)
80{
81 return pvNative;
82}
83
84
85DECL_KERNEL32(BOOL) Fake_InitializeCriticalSectionAndSpinCount(LPCRITICAL_SECTION pCritSect, DWORD cSpin)
86{
87 RT_NOREF(cSpin);
88 InitializeCriticalSection(pCritSect);
89 return TRUE;
90}
91
92
93DECL_KERNEL32(BOOL) Fake_HeapSetInformation(HANDLE hHeap, HEAP_INFORMATION_CLASS enmInfoClass, PVOID pvBuf, SIZE_T cbBuf)
94{
95 RT_NOREF(hHeap);
96 if (enmInfoClass == HeapCompatibilityInformation)
97 {
98 if ( cbBuf != sizeof(ULONG)
99 || !pvBuf
100 || *(PULONG)pvBuf == HEAP_STANDARD
101 )
102 {
103 SetLastError(ERROR_INVALID_PARAMETER);
104 return FALSE;
105 }
106 return TRUE;
107 }
108
109 SetLastError(ERROR_INVALID_PARAMETER);
110 return FALSE;
111}
112
113
114DECL_KERNEL32(BOOL) Fake_HeapQueryInformation(HANDLE hHeap, HEAP_INFORMATION_CLASS enmInfoClass,
115 PVOID pvBuf, SIZE_T cbBuf, PSIZE_T pcbRet)
116{
117 RT_NOREF(hHeap);
118 if (enmInfoClass == HeapCompatibilityInformation)
119 {
120 *pcbRet = sizeof(ULONG);
121 if (cbBuf < sizeof(ULONG) || !pvBuf)
122 {
123 SetLastError(ERROR_INSUFFICIENT_BUFFER);
124 return FALSE;
125 }
126 *(PULONG)pvBuf = HEAP_STANDARD;
127 return TRUE;
128 }
129
130 SetLastError(ERROR_INVALID_PARAMETER);
131 return FALSE;
132}
133
134
135/* These are used by INTEL\mt_obj\Timer.obj: */
136
137DECL_KERNEL32(HANDLE) Fake_CreateTimerQueue(void)
138{
139 SetLastError(ERROR_NOT_SUPPORTED);
140 return NULL;
141}
142
143DECL_KERNEL32(BOOL) Fake_CreateTimerQueueTimer(PHANDLE phTimer, HANDLE hTimerQueue, WAITORTIMERCALLBACK pfnCallback, PVOID pvUser,
144 DWORD msDueTime, DWORD msPeriod, ULONG fFlags)
145{
146 NOREF(phTimer); NOREF(hTimerQueue); NOREF(pfnCallback); NOREF(pvUser); NOREF(msDueTime); NOREF(msPeriod); NOREF(fFlags);
147 SetLastError(ERROR_NOT_SUPPORTED);
148 return FALSE;
149}
150
151DECL_KERNEL32(BOOL) Fake_DeleteTimerQueueTimer(HANDLE hTimerQueue, HANDLE hTimer, HANDLE hEvtCompletion)
152{
153 NOREF(hTimerQueue); NOREF(hTimer); NOREF(hEvtCompletion);
154 SetLastError(ERROR_NOT_SUPPORTED);
155 return FALSE;
156}
157
158/* This is used by several APIs. */
159
160DECL_KERNEL32(VOID) Fake_InitializeSListHead(PSLIST_HEADER pHead)
161{
162 pHead->Alignment = 0;
163}
164
165
166DECL_KERNEL32(PSLIST_ENTRY) Fake_InterlockedFlushSList(PSLIST_HEADER pHead)
167{
168 PSLIST_ENTRY pRet = NULL;
169 if (pHead->Next.Next)
170 {
171 for (;;)
172 {
173 SLIST_HEADER OldHead = *pHead;
174 SLIST_HEADER NewHead;
175 NewHead.Alignment = 0;
176 NewHead.Sequence = OldHead.Sequence + 1;
177 if (ASMAtomicCmpXchgU64(&pHead->Alignment, NewHead.Alignment, OldHead.Alignment))
178 {
179 pRet = OldHead.Next.Next;
180 break;
181 }
182 }
183 }
184 return pRet;
185}
186
187DECL_KERNEL32(PSLIST_ENTRY) Fake_InterlockedPopEntrySList(PSLIST_HEADER pHead)
188{
189 PSLIST_ENTRY pRet = NULL;
190 for (;;)
191 {
192 SLIST_HEADER OldHead = *pHead;
193 pRet = OldHead.Next.Next;
194 if (pRet)
195 {
196 SLIST_HEADER NewHead;
197 __try
198 {
199 NewHead.Next.Next = pRet->Next;
200 }
201 __except(EXCEPTION_EXECUTE_HANDLER)
202 {
203 continue;
204 }
205 NewHead.Depth = OldHead.Depth - 1;
206 NewHead.Sequence = OldHead.Sequence + 1;
207 if (ASMAtomicCmpXchgU64(&pHead->Alignment, NewHead.Alignment, OldHead.Alignment))
208 break;
209 }
210 else
211 break;
212 }
213 return pRet;
214}
215
216DECL_KERNEL32(PSLIST_ENTRY) Fake_InterlockedPushEntrySList(PSLIST_HEADER pHead, PSLIST_ENTRY pEntry)
217{
218 PSLIST_ENTRY pRet = NULL;
219 for (;;)
220 {
221 SLIST_HEADER OldHead = *pHead;
222 pRet = OldHead.Next.Next;
223 pEntry->Next = pRet;
224 SLIST_HEADER NewHead;
225 NewHead.Next.Next = pEntry;
226 NewHead.Depth = OldHead.Depth + 1;
227 NewHead.Sequence = OldHead.Sequence + 1;
228 if (ASMAtomicCmpXchgU64(&pHead->Alignment, NewHead.Alignment, OldHead.Alignment))
229 break;
230 }
231 return pRet;
232}
233
234DECL_KERNEL32(WORD) Fake_QueryDepthSList(PSLIST_HEADER pHead)
235{
236 return pHead->Depth;
237}
238
239
240/* curl drags these in: */
241DECL_KERNEL32(BOOL) Fake_VerifyVersionInfoA(LPOSVERSIONINFOEXA pInfo, DWORD fTypeMask, DWORDLONG fConditionMask)
242{
243 OSVERSIONINFOEXA VerInfo;
244 RT_ZERO(VerInfo);
245 VerInfo.dwOSVersionInfoSize = sizeof(VerInfo);
246 if (!GetVersionExA((OSVERSIONINFO *)&VerInfo))
247 {
248 RT_ZERO(VerInfo);
249 VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
250 BOOL fRet = GetVersionExA((OSVERSIONINFO *)&VerInfo);
251 if (fRet)
252 { /* likely */ }
253 else
254 {
255 MY_ASSERT(false, "VerifyVersionInfoA: #1");
256 return FALSE;
257 }
258 }
259
260 BOOL fRet = TRUE;
261 for (unsigned i = 0; i < 8 && fRet; i++)
262 if (fTypeMask & RT_BIT_32(i))
263 {
264 uint32_t uLeft, uRight;
265 switch (RT_BIT_32(i))
266 {
267#define MY_CASE(a_Num, a_Member) case a_Num: uLeft = VerInfo.a_Member; uRight = pInfo->a_Member; break
268 MY_CASE(VER_MINORVERSION, dwMinorVersion);
269 MY_CASE(VER_MAJORVERSION, dwMajorVersion);
270 MY_CASE(VER_BUILDNUMBER, dwBuildNumber);
271 MY_CASE(VER_PLATFORMID, dwPlatformId);
272 MY_CASE(VER_SERVICEPACKMINOR, wServicePackMinor);
273 MY_CASE(VER_SERVICEPACKMAJOR, wServicePackMinor);
274 MY_CASE(VER_SUITENAME, wSuiteMask);
275 MY_CASE(VER_PRODUCT_TYPE, wProductType);
276#undef MY_CASE
277 default: uLeft = uRight = 0; MY_ASSERT(false, "VerifyVersionInfoA: #2");
278 }
279 switch ((uint8_t)(fConditionMask >> (i*8)))
280 {
281 case VER_EQUAL: fRet = uLeft == uRight; break;
282 case VER_GREATER: fRet = uLeft > uRight; break;
283 case VER_GREATER_EQUAL: fRet = uLeft >= uRight; break;
284 case VER_LESS: fRet = uLeft < uRight; break;
285 case VER_LESS_EQUAL: fRet = uLeft <= uRight; break;
286 case VER_AND: fRet = (uLeft & uRight) == uRight; break;
287 case VER_OR: fRet = (uLeft & uRight) != 0; break;
288 default: fRet = FALSE; MY_ASSERT(false, "VerifyVersionInfoA: #3"); break;
289 }
290 }
291
292 return fRet;
293}
294
295
296DECL_KERNEL32(ULONGLONG) Fake_VerSetConditionMask(ULONGLONG fConditionMask, DWORD fTypeMask, BYTE bOperator)
297{
298 for (unsigned i = 0; i < 8; i++)
299 if (fTypeMask & RT_BIT_32(i))
300 {
301 uint64_t fMask = UINT64_C(0xff) << (i*8);
302 fConditionMask &= ~fMask;
303 fConditionMask |= (uint64_t)bOperator << (i*8);
304
305 }
306 return fConditionMask;
307}
308
309
310/*
311 * NT 3.51 stuff.
312 */
313
314DECL_KERNEL32(BOOL) Fake_IsProcessorFeaturePresent(DWORD enmProcessorFeature)
315{
316 /* Could make more of an effort here... */
317 RT_NOREF(enmProcessorFeature);
318 return FALSE;
319}
320
321
322DECL_KERNEL32(BOOL) Fake_CancelIo(HANDLE hHandle)
323{
324 /* All NT versions the NTDLL API this corresponds to. */
325 RESOLVE_NTDLL_API(NtCancelIoFile);
326 if (pfnNtCancelIoFile)
327 {
328 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER;
329 NTSTATUS rcNt = pfnNtCancelIoFile(hHandle, &Ios);
330 if (RT_SUCCESS(rcNt))
331 return TRUE;
332 if (rcNt == STATUS_INVALID_HANDLE)
333 SetLastError(ERROR_INVALID_HANDLE);
334 else
335 SetLastError(ERROR_INVALID_FUNCTION);
336 }
337 else
338 SetLastError(ERROR_NOT_SUPPORTED);
339 return FALSE;
340}
341
342
343/*
344 * NT 3.50 stuff.
345 */
346
347DECL_KERNEL32(BOOL) Fake_IsDebuggerPresent(VOID)
348{
349 /* Fallback: */
350 return FALSE;
351}
352
353
354DECL_KERNEL32(VOID) Fake_GetSystemTimeAsFileTime(LPFILETIME pTime)
355{
356 DWORD dwVersion = GetVersion();
357 if ( (dwVersion & 0xff) > 3
358 || ( (dwVersion & 0xff) == 3
359 && ((dwVersion >> 8) & 0xff) >= 50) )
360 {
361 PKUSER_SHARED_DATA pUsd = (PKUSER_SHARED_DATA)MM_SHARED_USER_DATA_VA;
362
363 /* use interrupt time */
364 LARGE_INTEGER Time;
365 do
366 {
367 Time.HighPart = pUsd->SystemTime.High1Time;
368 Time.LowPart = pUsd->SystemTime.LowPart;
369 } while (pUsd->SystemTime.High2Time != Time.HighPart);
370
371 pTime->dwHighDateTime = Time.HighPart;
372 pTime->dwLowDateTime = Time.LowPart;
373 }
374 else
375 {
376 /* NT 3.1 didn't have a KUSER_SHARED_DATA nor a GetSystemTimeAsFileTime export. */
377 SYSTEMTIME SystemTime;
378 GetSystemTime(&SystemTime);
379 BOOL fRet = SystemTimeToFileTime(&SystemTime, pTime);
380 if (fRet)
381 { /* likely */ }
382 else
383 {
384 MY_ASSERT(false, "GetSystemTimeAsFileTime: #2");
385 pTime->dwHighDateTime = 0;
386 pTime->dwLowDateTime = 0;
387 }
388 }
389}
390
391
392/*
393 * NT 3.1 stuff.
394 */
395
396DECL_KERNEL32(BOOL) Fake_GetVersionExA(LPOSVERSIONINFOA pInfo)
397{
398 DWORD dwVersion = GetVersion();
399
400 /* Common fields: */
401 pInfo->dwMajorVersion = dwVersion & 0xff;
402 pInfo->dwMinorVersion = (dwVersion >> 8) & 0xff;
403 if (!(dwVersion & RT_BIT_32(31)))
404 pInfo->dwBuildNumber = dwVersion >> 16;
405 else
406 pInfo->dwBuildNumber = 511;
407 pInfo->dwPlatformId = VER_PLATFORM_WIN32_NT;
408/** @todo get CSD from registry. */
409 pInfo->szCSDVersion[0] = '\0';
410
411 /* OSVERSIONINFOEX fields: */
412 if (pInfo->dwOSVersionInfoSize > sizeof((*pInfo)))
413 {
414 LPOSVERSIONINFOEXA pInfoEx = (LPOSVERSIONINFOEXA)pInfo;
415 if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXA, wServicePackMinor))
416 {
417 pInfoEx->wServicePackMajor = 0;
418 pInfoEx->wServicePackMinor = 0;
419 }
420 if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXA, wSuiteMask))
421 pInfoEx->wSuiteMask = 0;
422 if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXA, wProductType))
423 pInfoEx->wProductType = VER_NT_WORKSTATION;
424 if (pInfoEx->wReserved > RT_UOFFSETOF(OSVERSIONINFOEXA, wProductType))
425 pInfoEx->wReserved = 0;
426 }
427
428 return TRUE;
429}
430
431
432DECL_KERNEL32(BOOL) Fake_GetVersionExW(LPOSVERSIONINFOW pInfo)
433{
434 DWORD dwVersion = GetVersion();
435
436 /* Common fields: */
437 pInfo->dwMajorVersion = dwVersion & 0xff;
438 pInfo->dwMinorVersion = (dwVersion >> 8) & 0xff;
439 if (!(dwVersion & RT_BIT_32(31)))
440 pInfo->dwBuildNumber = dwVersion >> 16;
441 else
442 pInfo->dwBuildNumber = 511;
443 pInfo->dwPlatformId = VER_PLATFORM_WIN32_NT;
444/** @todo get CSD from registry. */
445 pInfo->szCSDVersion[0] = '\0';
446
447 /* OSVERSIONINFOEX fields: */
448 if (pInfo->dwOSVersionInfoSize > sizeof((*pInfo)))
449 {
450 LPOSVERSIONINFOEXW pInfoEx = (LPOSVERSIONINFOEXW)pInfo;
451 if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXW, wServicePackMinor))
452 {
453 pInfoEx->wServicePackMajor = 0;
454 pInfoEx->wServicePackMinor = 0;
455 }
456 if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXW, wSuiteMask))
457 pInfoEx->wSuiteMask = 0;
458 if (pInfoEx->dwOSVersionInfoSize > RT_UOFFSETOF(OSVERSIONINFOEXW, wProductType))
459 pInfoEx->wProductType = VER_NT_WORKSTATION;
460 if (pInfoEx->wReserved > RT_UOFFSETOF(OSVERSIONINFOEXW, wProductType))
461 pInfoEx->wReserved = 0;
462 }
463
464 return TRUE;
465}
466
467
468DECL_KERNEL32(LPWCH) Fake_GetEnvironmentStringsW(void)
469{
470 /*
471 * Environment is ANSI in NT 3.1. We should only be here for NT 3.1.
472 * For now, don't try do a perfect job converting it, just do it.
473 */
474 char *pszzEnv = (char *)RTNtCurrentPeb()->ProcessParameters->Environment;
475 size_t offEnv = 0;
476 while (pszzEnv[offEnv] != '\0')
477 {
478 size_t cchLen = strlen(&pszzEnv[offEnv]);
479 offEnv += cchLen + 1;
480 }
481 size_t const cchEnv = offEnv + 1;
482
483 PRTUTF16 pwszzEnv = (PRTUTF16)HeapAlloc(GetProcessHeap(), 0, cchEnv * sizeof(RTUTF16));
484 if (!pwszzEnv)
485 return NULL;
486 for (offEnv = 0; offEnv < cchEnv; offEnv++)
487 {
488 unsigned char ch = pwszzEnv[offEnv];
489 if (!(ch & 0x80))
490 pwszzEnv[offEnv] = ch;
491 else
492 pwszzEnv[offEnv] = '_';
493 }
494 return pwszzEnv;
495}
496
497
498DECL_KERNEL32(BOOL) Fake_FreeEnvironmentStringsW(LPWCH pwszzEnv)
499{
500 if (pwszzEnv)
501 HeapFree(GetProcessHeap(), 0, pwszzEnv);
502 return TRUE;
503}
504
505
506DECL_KERNEL32(int) Fake_GetLocaleInfoA(LCID idLocale, LCTYPE enmType, LPSTR pData, int cchData)
507{
508 NOREF(idLocale); NOREF(enmType); NOREF(pData); NOREF(cchData);
509 //MY_ASSERT(false, "GetLocaleInfoA: idLocale=%#x enmType=%#x cchData=%#x", idLocale, enmType, cchData);
510 MY_ASSERT(false, "GetLocaleInfoA");
511 SetLastError(ERROR_NOT_SUPPORTED);
512 return 0;
513}
514
515
516DECL_KERNEL32(BOOL) Fake_EnumSystemLocalesA(LOCALE_ENUMPROCA pfnCallback, DWORD fFlags)
517{
518 NOREF(pfnCallback); NOREF(fFlags);
519 //MY_ASSERT(false, "EnumSystemLocalesA: pfnCallback=%p fFlags=%#x", pfnCallback, fFlags);
520 MY_ASSERT(false, "EnumSystemLocalesA");
521 SetLastError(ERROR_NOT_SUPPORTED);
522 return FALSE;
523}
524
525
526DECL_KERNEL32(BOOL) Fake_IsValidLocale(LCID idLocale, DWORD fFlags)
527{
528 NOREF(idLocale); NOREF(fFlags);
529 //MY_ASSERT(false, "IsValidLocale: idLocale fFlags=%#x", idLocale, fFlags);
530 MY_ASSERT(false, "IsValidLocale");
531 SetLastError(ERROR_NOT_SUPPORTED);
532 return FALSE;
533}
534
535
536DECL_KERNEL32(DWORD_PTR) Fake_SetThreadAffinityMask(HANDLE hThread, DWORD_PTR fAffinityMask)
537{
538 SYSTEM_INFO SysInfo;
539 GetSystemInfo(&SysInfo);
540 //MY_ASSERT(false, "SetThreadAffinityMask: hThread=%p fAffinityMask=%p SysInfo.dwActiveProcessorMask=%p",
541 // hThread, fAffinityMask, SysInfo.dwActiveProcessorMask);
542 MY_ASSERT(false, "SetThreadAffinityMask");
543 if ( SysInfo.dwActiveProcessorMask == fAffinityMask
544 || fAffinityMask == ~(DWORD_PTR)0)
545 return fAffinityMask;
546
547 SetLastError(ERROR_NOT_SUPPORTED);
548 RT_NOREF(hThread);
549 return 0;
550}
551
552
553DECL_KERNEL32(BOOL) Fake_GetProcessAffinityMask(HANDLE hProcess, PDWORD_PTR pfProcessAffinityMask, PDWORD_PTR pfSystemAffinityMask)
554{
555 SYSTEM_INFO SysInfo;
556 GetSystemInfo(&SysInfo);
557 //MY_ASSERT(false, "GetProcessAffinityMask: SysInfo.dwActiveProcessorMask=%p", SysInfo.dwActiveProcessorMask);
558 MY_ASSERT(false, "GetProcessAffinityMask");
559 if (pfProcessAffinityMask)
560 *pfProcessAffinityMask = SysInfo.dwActiveProcessorMask;
561 if (pfSystemAffinityMask)
562 *pfSystemAffinityMask = SysInfo.dwActiveProcessorMask;
563 RT_NOREF(hProcess);
564 return TRUE;
565}
566
567
568DECL_KERNEL32(BOOL) Fake_GetHandleInformation(HANDLE hObject, DWORD *pfFlags)
569{
570 OBJECT_HANDLE_FLAG_INFORMATION Info = { 0, 0 };
571 DWORD cbRet = sizeof(Info);
572 NTSTATUS rcNt = NtQueryObject(hObject, ObjectHandleFlagInformation, &Info, sizeof(Info), &cbRet);
573 if (NT_SUCCESS(rcNt))
574 {
575 *pfFlags = (Info.Inherit ? HANDLE_FLAG_INHERIT : 0)
576 | (Info.ProtectFromClose ? HANDLE_FLAG_PROTECT_FROM_CLOSE : 0);
577 return TRUE;
578 }
579 *pfFlags = 0;
580 //MY_ASSERT(rcNt == STATUS_INVALID_HANDLE, "rcNt=%#x", rcNt);
581 MY_ASSERT(rcNt == STATUS_INVALID_HANDLE || rcNt == STATUS_INVALID_INFO_CLASS, "GetHandleInformation");
582 SetLastError(rcNt == STATUS_INVALID_HANDLE ? ERROR_INVALID_HANDLE : ERROR_INVALID_FUNCTION); /* see also process-win.cpp */
583 return FALSE;
584}
585
586
587DECL_KERNEL32(BOOL) Fake_SetHandleInformation(HANDLE hObject, DWORD fMask, DWORD fFlags)
588{
589 NOREF(hObject); NOREF(fMask); NOREF(fFlags);
590 SetLastError(ERROR_INVALID_FUNCTION);
591 return FALSE;
592}
593
594
595
596/**
597 * Resolves all the APIs ones and for all, updating the fake IAT entries.
598 */
599DECLASM(void) FakeResolve_kernel32(void)
600{
601 CURRENT_VERSION_VARIABLE();
602
603 HMODULE hmod = GetModuleHandleW(L"kernel32");
604 MY_ASSERT(hmod != NULL, "kernel32");
605
606#undef MAKE_IMPORT_ENTRY
607#define MAKE_IMPORT_ENTRY(a_uMajorVer, a_uMinorVer, a_Name, a_cb) RESOLVE_IMPORT(a_uMajorVer, a_uMinorVer, a_Name, a_cb)
608#include "vcc100-kernel32-fakes.h"
609
610 g_fInitialized = true;
611}
612
613
614/* Dummy to force dragging in this object in the link, so the linker
615 won't accidentally use the symbols from kernel32. */
616extern "C" int vcc100_kernel32_fakes_cpp(void)
617{
618 return 42;
619}
620
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