VirtualBox

Changeset 3645 in kBuild for trunk


Ignore:
Timestamp:
Nov 3, 2024 2:32:49 AM (4 weeks ago)
Author:
bird
Message:

lib/startuphacks-win.c: UCRT adjustments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/startuphacks-win.c

    r2413 r3645  
    22/** @file
    33 * kBuild - Alternative argument parser for the windows startup code.
    4  *
    5  * @todo Update license when SED is updated.
    64 */
    75
    86/*
    9  * Copyright (c) 2006-2010 knut st. osmundsen <[email protected]>
     7 * Copyright (c) 2006-2024 knut st. osmundsen <[email protected]>
    108 *
    119 * parse_args(): Copyright (c) 1992-1998 by Eberhard Mattes
     
    3634#include <malloc.h>
    3735#include <Windows.h>
     36#if _MSC_VER >= 1400
     37# include <vcruntime_startup.h>
     38#endif
    3839
    3940
     
    5354
    5455
    55 
     56#if _MSC_VER >= 1400
     57int __cdecl _configure_narrow_argv(_crt_argv_mode const mode)
     58#else
    5659int __cdecl _setargv(void)
     60#endif
    5761{
    5862    static char s_szProgramName[MAX_PATH + 1];
     
    6670    GetModuleFileName(NULL, s_szProgramName, MAX_PATH);
    6771    s_szProgramName[MAX_PATH] = '\0';
    68 #if _MSC_VER >= 1400 && !defined(CRTDLL) && !defined(_DLL)
    69     _set_pgmptr(s_szProgramName);
     72#if _MSC_VER >= 1400
     73    _pgmptr = s_szProgramName;
     74    (void)mode;
    7075#endif
    7176
     
    8388    g_papszArgs = malloc(sizeof(*g_papszArgs) * (g_cArgs + 2));
    8489    if (!g_papszArgs)
    85         return -1;
     90        return _MSC_VER >= 1400 ? ENOMEM : -1;
    8691    pszCmdLineBuf = malloc(cb);
    8792    if (!pszCmdLineBuf)
    88         return -1;
     93        return _MSC_VER >= 1400 ? ENOMEM : -1;
    8994    parse_args(pszCmdLine, g_papszArgs, pszCmdLineBuf);
    9095    g_papszArgs[g_cArgs] = g_papszArgs[g_cArgs + 1] = NULL;
     
    95100    return 0;
    96101}
    97 
    98 
     102#if _MSC_VER >= 1400
     103int (__cdecl * __imp__configure_narrow_argv)(_crt_argv_mode) = _configure_narrow_argv;
     104#endif
     105
     106
     107#if _MSC_VER < 1400
    99108/* when linking with the crtexe.c, the __getmainargs() call will redo the _setargv job inside the msvc*.dll. */
    100109int __cdecl __getmainargs(int *pargc, char ***pargv, char ***penvp, int dowildcard, /*_startupinfo*/ void *startinfo)
     
    106115}
    107116
    108 #if defined(_M_IX86)
     117# if defined(_M_IX86)
    109118int (__cdecl * _imp____getmainargs)(int *, char ***, char ***, int, /*_startupinfo*/ void *) = __getmainargs;
    110 #else
     119# else
    111120int (__cdecl * __imp___getmainargs)(int *, char ***, char ***, int, /*_startupinfo*/ void *) = __getmainargs;
    112 #endif
    113 
     121# endif
     122#endif
    114123
    115124
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette