- Timestamp:
- Nov 3, 2024 2:32:49 AM (4 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/startuphacks-win.c
r2413 r3645 2 2 /** @file 3 3 * kBuild - Alternative argument parser for the windows startup code. 4 *5 * @todo Update license when SED is updated.6 4 */ 7 5 8 6 /* 9 * Copyright (c) 2006-20 10knut st. osmundsen <[email protected]>7 * Copyright (c) 2006-2024 knut st. osmundsen <[email protected]> 10 8 * 11 9 * parse_args(): Copyright (c) 1992-1998 by Eberhard Mattes … … 36 34 #include <malloc.h> 37 35 #include <Windows.h> 36 #if _MSC_VER >= 1400 37 # include <vcruntime_startup.h> 38 #endif 38 39 39 40 … … 53 54 54 55 55 56 #if _MSC_VER >= 1400 57 int __cdecl _configure_narrow_argv(_crt_argv_mode const mode) 58 #else 56 59 int __cdecl _setargv(void) 60 #endif 57 61 { 58 62 static char s_szProgramName[MAX_PATH + 1]; … … 66 70 GetModuleFileName(NULL, s_szProgramName, MAX_PATH); 67 71 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; 70 75 #endif 71 76 … … 83 88 g_papszArgs = malloc(sizeof(*g_papszArgs) * (g_cArgs + 2)); 84 89 if (!g_papszArgs) 85 return -1;90 return _MSC_VER >= 1400 ? ENOMEM : -1; 86 91 pszCmdLineBuf = malloc(cb); 87 92 if (!pszCmdLineBuf) 88 return -1;93 return _MSC_VER >= 1400 ? ENOMEM : -1; 89 94 parse_args(pszCmdLine, g_papszArgs, pszCmdLineBuf); 90 95 g_papszArgs[g_cArgs] = g_papszArgs[g_cArgs + 1] = NULL; … … 95 100 return 0; 96 101 } 97 98 102 #if _MSC_VER >= 1400 103 int (__cdecl * __imp__configure_narrow_argv)(_crt_argv_mode) = _configure_narrow_argv; 104 #endif 105 106 107 #if _MSC_VER < 1400 99 108 /* when linking with the crtexe.c, the __getmainargs() call will redo the _setargv job inside the msvc*.dll. */ 100 109 int __cdecl __getmainargs(int *pargc, char ***pargv, char ***penvp, int dowildcard, /*_startupinfo*/ void *startinfo) … … 106 115 } 107 116 108 # if defined(_M_IX86)117 # if defined(_M_IX86) 109 118 int (__cdecl * _imp____getmainargs)(int *, char ***, char ***, int, /*_startupinfo*/ void *) = __getmainargs; 110 # else119 # else 111 120 int (__cdecl * __imp___getmainargs)(int *, char ***, char ***, int, /*_startupinfo*/ void *) = __getmainargs; 112 # endif113 121 # endif 122 #endif 114 123 115 124
Note:
See TracChangeset
for help on using the changeset viewer.