VirtualBox

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

Last change on this file since 76553 was 76553, checked in by vboxsync, 5 years ago

scm --update-copyright-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-shell32-fakes.cpp 76553 2019-01-01 01:45:53Z 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-2019 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#define RT_NO_STRICT /* Minimal deps so that it works on NT 3.51 too. */
32#include <iprt/types.h>
33#include <iprt/assert.h>
34#include <iprt/string.h>
35
36#ifndef RT_ARCH_X86
37# error "This code is X86 only"
38#endif
39
40#define CommandLineToArgvW Ignore_CommandLineToArgvW
41
42#include <iprt/nt/nt-and-windows.h>
43
44#undef CommandLineToArgvW
45
46
47/*********************************************************************************************************************************
48* Defined Constants And Macros *
49*********************************************************************************************************************************/
50/** Dynamically resolves an kernel32 API. */
51#define RESOLVE_ME(ApiNm) \
52 static decltype(ShellExecuteW) * volatile s_pfnInitialized = NULL; \
53 static decltype(ApiNm) *s_pfnApi = NULL; \
54 decltype(ApiNm) *pfnApi; \
55 if (s_pfnInitialized) \
56 pfnApi = s_pfnApi; \
57 else \
58 { \
59 pfnApi = (decltype(pfnApi))GetProcAddress(GetModuleHandleW(L"shell32"), #ApiNm); \
60 s_pfnApi = pfnApi; \
61 s_pfnInitialized = ShellExecuteW; /* ensures shell32 is loaded */ \
62 } do {} while (0)
63
64
65/** Declare a shell32 API.
66 * @note We are not exporting them as that causes duplicate symbol troubles in
67 * the OpenGL bits. */
68#define DECL_SHELL32(a_Type) extern "C" a_Type WINAPI
69
70
71/*********************************************************************************************************************************
72* Internal Functions *
73*********************************************************************************************************************************/
74
75
76DECL_SHELL32(LPWSTR *) CommandLineToArgvW(LPCWSTR pwszCmdLine, int *pcArgs)
77{
78 RESOLVE_ME(CommandLineToArgvW);
79 if (pfnApi)
80 return pfnApi(pwszCmdLine, pcArgs);
81
82 *pcArgs = 0;
83 return NULL;
84}
85
86
87/* Dummy to force dragging in this object in the link, so the linker
88 won't accidentally use the symbols from shell32. */
89extern "C" int vcc100_shell32_fakes_cpp(void)
90{
91 return 42;
92}
93
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use