| 1 | /* | 
|---|
| 2 | * msvcrt.dll dll data items | 
|---|
| 3 | * | 
|---|
| 4 | * Copyright 2000 Jon Griffiths | 
|---|
| 5 | * | 
|---|
| 6 | * This library is free software; you can redistribute it and/or | 
|---|
| 7 | * modify it under the terms of the GNU Lesser General Public | 
|---|
| 8 | * License as published by the Free Software Foundation; either | 
|---|
| 9 | * version 2.1 of the License, or (at your option) any later version. | 
|---|
| 10 | * | 
|---|
| 11 | * This library is distributed in the hope that it will be useful, | 
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
|---|
| 14 | * Lesser General Public License for more details. | 
|---|
| 15 | * | 
|---|
| 16 | * You should have received a copy of the GNU Lesser General Public | 
|---|
| 17 | * License along with this library; if not, write to the Free Software | 
|---|
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | 
|---|
| 19 | */ | 
|---|
| 20 | #ifndef __WIN32OS2__ | 
|---|
| 21 | #include "config.h" | 
|---|
| 22 | #else | 
|---|
| 23 | #include <emxheader.h> | 
|---|
| 24 | #endif | 
|---|
| 25 |  | 
|---|
| 26 | #include "wine/port.h" | 
|---|
| 27 |  | 
|---|
| 28 | #include <math.h> | 
|---|
| 29 | #include "msvcrt.h" | 
|---|
| 30 |  | 
|---|
| 31 | #include "msvcrt/stdlib.h" | 
|---|
| 32 | #include "msvcrt/string.h" | 
|---|
| 33 |  | 
|---|
| 34 | #ifndef __WIN32OS2__ | 
|---|
| 35 | #include "wine/library.h" | 
|---|
| 36 | #endif | 
|---|
| 37 | #include "wine/unicode.h" | 
|---|
| 38 | #include "wine/debug.h" | 
|---|
| 39 |  | 
|---|
| 40 | WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); | 
|---|
| 41 |  | 
|---|
| 42 | unsigned int MSVCRT___argc; | 
|---|
| 43 | unsigned int MSVCRT_basemajor;/* FIXME: */ | 
|---|
| 44 | unsigned int MSVCRT_baseminor;/* FIXME: */ | 
|---|
| 45 | unsigned int MSVCRT_baseversion; /* FIXME: */ | 
|---|
| 46 | unsigned int MSVCRT__commode; | 
|---|
| 47 | unsigned int MSVCRT__fmode; | 
|---|
| 48 | unsigned int MSVCRT_osmajor;/* FIXME: */ | 
|---|
| 49 | unsigned int MSVCRT_osminor;/* FIXME: */ | 
|---|
| 50 | unsigned int MSVCRT_osmode;/* FIXME: */ | 
|---|
| 51 | unsigned int MSVCRT__osver; | 
|---|
| 52 | unsigned int MSVCRT_osversion; /* FIXME: */ | 
|---|
| 53 | unsigned int MSVCRT__winmajor; | 
|---|
| 54 | unsigned int MSVCRT__winminor; | 
|---|
| 55 | unsigned int MSVCRT__winver; | 
|---|
| 56 | unsigned int MSVCRT__sys_nerr; /* FIXME: not accessible from Winelib apps */ | 
|---|
| 57 | char**       MSVCRT__sys_errlist; /* FIXME: not accessible from Winelib apps */ | 
|---|
| 58 | unsigned int MSVCRT___setlc_active; | 
|---|
| 59 | unsigned int MSVCRT___unguarded_readlc_active; | 
|---|
| 60 | double MSVCRT__HUGE; | 
|---|
| 61 | char **MSVCRT___argv; | 
|---|
| 62 | MSVCRT_wchar_t **MSVCRT___wargv; | 
|---|
| 63 | char *MSVCRT__acmdln; | 
|---|
| 64 | MSVCRT_wchar_t *MSVCRT__wcmdln; | 
|---|
| 65 | char **MSVCRT__environ = 0; | 
|---|
| 66 | MSVCRT_wchar_t **MSVCRT__wenviron = 0; | 
|---|
| 67 | char **MSVCRT___initenv = 0; | 
|---|
| 68 | MSVCRT_wchar_t **MSVCRT___winitenv = 0; | 
|---|
| 69 | int MSVCRT_timezone; | 
|---|
| 70 | int MSVCRT_app_type; | 
|---|
| 71 |  | 
|---|
| 72 | /* Get a snapshot of the current environment | 
|---|
| 73 | * and construct the __p__environ array | 
|---|
| 74 | * | 
|---|
| 75 | * The pointer returned from GetEnvironmentStrings may get invalid when | 
|---|
| 76 | * some other module cause a reallocation of the env-variable block | 
|---|
| 77 | * | 
|---|
| 78 | * blk is an array of pointers to environment strings, ending with a NULL | 
|---|
| 79 | * and after that the actual copy of the environment strings, ending in a \0 | 
|---|
| 80 | */ | 
|---|
| 81 | char ** msvcrt_SnapshotOfEnvironmentA(char **blk) | 
|---|
| 82 | { | 
|---|
| 83 | char* environ_strings = GetEnvironmentStringsA(); | 
|---|
| 84 | int count = 1, len = 1, i = 0; /* keep space for the trailing NULLS */ | 
|---|
| 85 | char *ptr; | 
|---|
| 86 |  | 
|---|
| 87 | for (ptr = environ_strings; *ptr; ptr += strlen(ptr) + 1) | 
|---|
| 88 | { | 
|---|
| 89 | count++; | 
|---|
| 90 | len += strlen(ptr) + 1; | 
|---|
| 91 | } | 
|---|
| 92 | if (blk) | 
|---|
| 93 | blk = HeapReAlloc( GetProcessHeap(), 0, blk, count* sizeof(char*) + len ); | 
|---|
| 94 | else | 
|---|
| 95 | blk = HeapAlloc(GetProcessHeap(), 0, count* sizeof(char*) + len ); | 
|---|
| 96 |  | 
|---|
| 97 | if (blk) | 
|---|
| 98 | { | 
|---|
| 99 | if (count) | 
|---|
| 100 | { | 
|---|
| 101 | memcpy(&blk[count],environ_strings,len); | 
|---|
| 102 | for (ptr = (char*) &blk[count]; *ptr; ptr += strlen(ptr) + 1) | 
|---|
| 103 | { | 
|---|
| 104 | blk[i++] = ptr; | 
|---|
| 105 | } | 
|---|
| 106 | } | 
|---|
| 107 | blk[i] = NULL; | 
|---|
| 108 | } | 
|---|
| 109 | FreeEnvironmentStringsA(environ_strings); | 
|---|
| 110 | return blk; | 
|---|
| 111 | } | 
|---|
| 112 |  | 
|---|
| 113 | MSVCRT_wchar_t ** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t **wblk) | 
|---|
| 114 | { | 
|---|
| 115 | MSVCRT_wchar_t* wenviron_strings = GetEnvironmentStringsW(); | 
|---|
| 116 | int count = 1, len = 1, i = 0; /* keep space for the trailing NULLS */ | 
|---|
| 117 | MSVCRT_wchar_t *wptr; | 
|---|
| 118 |  | 
|---|
| 119 | for (wptr = wenviron_strings; *wptr; wptr += strlenW(wptr) + 1) | 
|---|
| 120 | { | 
|---|
| 121 | count++; | 
|---|
| 122 | len += strlenW(wptr) + 1; | 
|---|
| 123 | } | 
|---|
| 124 | if (wblk) | 
|---|
| 125 | wblk = HeapReAlloc( GetProcessHeap(), 0, wblk, count* sizeof(MSVCRT_wchar_t*) + len * sizeof(MSVCRT_wchar_t)); | 
|---|
| 126 | else | 
|---|
| 127 | wblk = HeapAlloc(GetProcessHeap(), 0, count* sizeof(MSVCRT_wchar_t*) + len * sizeof(MSVCRT_wchar_t)); | 
|---|
| 128 | if (wblk) | 
|---|
| 129 | { | 
|---|
| 130 | if (count) | 
|---|
| 131 | { | 
|---|
| 132 | memcpy(&wblk[count],wenviron_strings,len * sizeof(MSVCRT_wchar_t)); | 
|---|
| 133 | for (wptr = (MSVCRT_wchar_t*)&wblk[count]; *wptr; wptr += strlenW(wptr) + 1) | 
|---|
| 134 | { | 
|---|
| 135 | wblk[i++] = wptr; | 
|---|
| 136 | } | 
|---|
| 137 | } | 
|---|
| 138 | wblk[i] = NULL; | 
|---|
| 139 | } | 
|---|
| 140 | FreeEnvironmentStringsW(wenviron_strings); | 
|---|
| 141 | return wblk; | 
|---|
| 142 | } | 
|---|
| 143 |  | 
|---|
| 144 | typedef void (*_INITTERMFUN)(void); | 
|---|
| 145 |  | 
|---|
| 146 | /*********************************************************************** | 
|---|
| 147 | *              __p___argc (MSVCRT.@) | 
|---|
| 148 | */ | 
|---|
| 149 | int* __p___argc(void) { return &MSVCRT___argc; } | 
|---|
| 150 |  | 
|---|
| 151 | /*********************************************************************** | 
|---|
| 152 | *              __p__commode (MSVCRT.@) | 
|---|
| 153 | */ | 
|---|
| 154 | unsigned int* __p__commode(void) { return &MSVCRT__commode; } | 
|---|
| 155 |  | 
|---|
| 156 | /*********************************************************************** | 
|---|
| 157 | *              __p__fmode (MSVCRT.@) | 
|---|
| 158 | */ | 
|---|
| 159 | unsigned int* __p__fmode(void) { return &MSVCRT__fmode; } | 
|---|
| 160 |  | 
|---|
| 161 | /*********************************************************************** | 
|---|
| 162 | *              __p__osver (MSVCRT.@) | 
|---|
| 163 | */ | 
|---|
| 164 | unsigned int* __p__osver(void) { return &MSVCRT__osver; } | 
|---|
| 165 |  | 
|---|
| 166 | /*********************************************************************** | 
|---|
| 167 | *              __p__winmajor (MSVCRT.@) | 
|---|
| 168 | */ | 
|---|
| 169 | unsigned int* __p__winmajor(void) { return &MSVCRT__winmajor; } | 
|---|
| 170 |  | 
|---|
| 171 | /*********************************************************************** | 
|---|
| 172 | *              __p__winminor (MSVCRT.@) | 
|---|
| 173 | */ | 
|---|
| 174 | unsigned int* __p__winminor(void) { return &MSVCRT__winminor; } | 
|---|
| 175 |  | 
|---|
| 176 | /*********************************************************************** | 
|---|
| 177 | *              __p__winver (MSVCRT.@) | 
|---|
| 178 | */ | 
|---|
| 179 | unsigned int* __p__winver(void) { return &MSVCRT__winver; } | 
|---|
| 180 |  | 
|---|
| 181 | /********************************************************************* | 
|---|
| 182 | *              __p__acmdln (MSVCRT.@) | 
|---|
| 183 | */ | 
|---|
| 184 | char** __p__acmdln(void) { return &MSVCRT__acmdln; } | 
|---|
| 185 |  | 
|---|
| 186 | /********************************************************************* | 
|---|
| 187 | *              __p__wcmdln (MSVCRT.@) | 
|---|
| 188 | */ | 
|---|
| 189 | MSVCRT_wchar_t** __p__wcmdln(void) { return &MSVCRT__wcmdln; } | 
|---|
| 190 |  | 
|---|
| 191 | /********************************************************************* | 
|---|
| 192 | *              __p___argv (MSVCRT.@) | 
|---|
| 193 | */ | 
|---|
| 194 | char*** __p___argv(void) { return &MSVCRT___argv; } | 
|---|
| 195 |  | 
|---|
| 196 | /********************************************************************* | 
|---|
| 197 | *              __p___wargv (MSVCRT.@) | 
|---|
| 198 | */ | 
|---|
| 199 | MSVCRT_wchar_t*** __p___wargv(void) { return &MSVCRT___wargv; } | 
|---|
| 200 |  | 
|---|
| 201 | /********************************************************************* | 
|---|
| 202 | *              __p__environ (MSVCRT.@) | 
|---|
| 203 | */ | 
|---|
| 204 | char*** __p__environ(void) | 
|---|
| 205 | { | 
|---|
| 206 | if (!MSVCRT__environ) | 
|---|
| 207 | MSVCRT__environ = msvcrt_SnapshotOfEnvironmentA(NULL); | 
|---|
| 208 | return &MSVCRT__environ; | 
|---|
| 209 | } | 
|---|
| 210 |  | 
|---|
| 211 | /********************************************************************* | 
|---|
| 212 | *              __p__wenviron (MSVCRT.@) | 
|---|
| 213 | */ | 
|---|
| 214 | MSVCRT_wchar_t*** __p__wenviron(void) | 
|---|
| 215 | { | 
|---|
| 216 | if (!MSVCRT__wenviron) | 
|---|
| 217 | MSVCRT__wenviron = msvcrt_SnapshotOfEnvironmentW(NULL); | 
|---|
| 218 | return &MSVCRT__wenviron; | 
|---|
| 219 | } | 
|---|
| 220 |  | 
|---|
| 221 | /********************************************************************* | 
|---|
| 222 | *              __p___initenv (MSVCRT.@) | 
|---|
| 223 | */ | 
|---|
| 224 | char*** __p___initenv(void) { return &MSVCRT___initenv; } | 
|---|
| 225 |  | 
|---|
| 226 | /********************************************************************* | 
|---|
| 227 | *              __p___winitenv (MSVCRT.@) | 
|---|
| 228 | */ | 
|---|
| 229 | MSVCRT_wchar_t*** __p___winitenv(void) { return &MSVCRT___winitenv; } | 
|---|
| 230 |  | 
|---|
| 231 | /********************************************************************* | 
|---|
| 232 | *              __p__timezone (MSVCRT.@) | 
|---|
| 233 | */ | 
|---|
| 234 | int* __p__timezone(void) { return &MSVCRT_timezone; } | 
|---|
| 235 |  | 
|---|
| 236 | /* INTERNAL: Create a wide string from an ascii string */ | 
|---|
| 237 | static MSVCRT_wchar_t *wstrdupa(const char *str) | 
|---|
| 238 | { | 
|---|
| 239 | const size_t len = strlen(str) + 1 ; | 
|---|
| 240 | MSVCRT_wchar_t *wstr = MSVCRT_malloc(len* sizeof (MSVCRT_wchar_t)); | 
|---|
| 241 | if (!wstr) | 
|---|
| 242 | return NULL; | 
|---|
| 243 | MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,str,len,wstr,len); | 
|---|
| 244 | return wstr; | 
|---|
| 245 | } | 
|---|
| 246 |  | 
|---|
| 247 |  | 
|---|
| 248 | #ifdef __WIN32OS2__ | 
|---|
| 249 |  | 
|---|
| 250 | static int __wine_main_argc = 0; | 
|---|
| 251 | static char **__wine_main_argv = NULL; | 
|---|
| 252 | static WCHAR **__wine_main_wargv = NULL; | 
|---|
| 253 | char *argv[255]; | 
|---|
| 254 |  | 
|---|
| 255 | extern char* strtok(char*,const char*); | 
|---|
| 256 |  | 
|---|
| 257 | static void set_library_argv( char **incargv) | 
|---|
| 258 | { | 
|---|
| 259 | int argc = 0; | 
|---|
| 260 | WCHAR *p; | 
|---|
| 261 | WCHAR **wargv; | 
|---|
| 262 | char *token2 = NULL; | 
|---|
| 263 | DWORD total = 0; | 
|---|
| 264 |  | 
|---|
| 265 | char argvbuf[255]; | 
|---|
| 266 |  | 
|---|
| 267 | strcpy(argvbuf,incargv[0]); | 
|---|
| 268 |  | 
|---|
| 269 | if (argvbuf[0] == '\"') | 
|---|
| 270 | token2 = strtok(argvbuf, "\""); | 
|---|
| 271 | else | 
|---|
| 272 | token2 = strtok(argvbuf, " "); | 
|---|
| 273 |  | 
|---|
| 274 | if (token2) | 
|---|
| 275 | do | 
|---|
| 276 | { | 
|---|
| 277 | argv[argc] = HeapAlloc( GetProcessHeap(), 0, strlen(token2)+1); | 
|---|
| 278 | strcpy(argv[argc++],token2); | 
|---|
| 279 | } | 
|---|
| 280 | while (token2 = strtok(NULL, " ")); | 
|---|
| 281 |  | 
|---|
| 282 | argv[argc] = NULL; | 
|---|
| 283 | for (argc = 0; argv[argc]; argc++) | 
|---|
| 284 | total += MultiByteToWideChar( CP_ACP, 0, argv[argc], -1, NULL, 0 ); | 
|---|
| 285 |  | 
|---|
| 286 | wargv = HeapAlloc( GetProcessHeap(), 0, | 
|---|
| 287 | total * sizeof(WCHAR) + (argc + 1) * sizeof(*wargv) ); | 
|---|
| 288 | p = (WCHAR *)(wargv + argc + 1); | 
|---|
| 289 | for (argc = 0; argv[argc]; argc++) | 
|---|
| 290 | { | 
|---|
| 291 | DWORD len = MultiByteToWideChar( CP_ACP, 0, argv[argc], -1, p, total ); | 
|---|
| 292 | wargv[argc] = p; | 
|---|
| 293 | p += len; | 
|---|
| 294 | total -= len; | 
|---|
| 295 | } | 
|---|
| 296 | wargv[argc] = NULL; | 
|---|
| 297 |  | 
|---|
| 298 | dprintf(("Num of args is %d",argc)); | 
|---|
| 299 |  | 
|---|
| 300 | __wine_main_argc  = argc; | 
|---|
| 301 | __wine_main_argv  = argv; | 
|---|
| 302 | __wine_main_wargv = wargv; | 
|---|
| 303 | } | 
|---|
| 304 | #endif | 
|---|
| 305 |  | 
|---|
| 306 | /* INTERNAL: Since we can't rely on Winelib startup code calling w/getmainargs, | 
|---|
| 307 | * we initialise data values during DLL loading. When called by a native | 
|---|
| 308 | * program we simply return the data we've already initialised. This also means | 
|---|
| 309 | * you can call multiple times without leaking | 
|---|
| 310 | */ | 
|---|
| 311 | void msvcrt_init_args(void) | 
|---|
| 312 | { | 
|---|
| 313 | DWORD version; | 
|---|
| 314 |  | 
|---|
| 315 | MSVCRT__acmdln = _strdup( GetCommandLineA() ); | 
|---|
| 316 | MSVCRT__wcmdln = wstrdupa(MSVCRT__acmdln); | 
|---|
| 317 | #ifdef __WIN32OS2__ | 
|---|
| 318 | set_library_argv(&MSVCRT__acmdln); | 
|---|
| 319 | #endif | 
|---|
| 320 | MSVCRT___argc = __wine_main_argc; | 
|---|
| 321 | MSVCRT___argv = __wine_main_argv; | 
|---|
| 322 | MSVCRT___wargv = __wine_main_wargv; | 
|---|
| 323 |  | 
|---|
| 324 | TRACE("got '%s', wide = %s argc=%d\n", MSVCRT__acmdln, | 
|---|
| 325 | debugstr_w(MSVCRT__wcmdln),MSVCRT___argc); | 
|---|
| 326 |  | 
|---|
| 327 | version = GetVersion(); | 
|---|
| 328 | MSVCRT__osver       = version >> 16; | 
|---|
| 329 | MSVCRT__winminor    = version & 0xFF; | 
|---|
| 330 | MSVCRT__winmajor    = (version>>8) & 0xFF; | 
|---|
| 331 | MSVCRT_baseversion = version >> 16; | 
|---|
| 332 | MSVCRT__winver     = ((version >> 8) & 0xFF) + ((version & 0xFF) << 8); | 
|---|
| 333 | MSVCRT_baseminor   = (version >> 16) & 0xFF; | 
|---|
| 334 | MSVCRT_basemajor   = (version >> 24) & 0xFF; | 
|---|
| 335 | MSVCRT_osversion   = version & 0xFFFF; | 
|---|
| 336 | MSVCRT_osminor     = version & 0xFF; | 
|---|
| 337 | MSVCRT_osmajor     = (version>>8) & 0xFF; | 
|---|
| 338 | MSVCRT__sys_nerr   = 43; | 
|---|
| 339 | MSVCRT__HUGE = HUGE_VAL; | 
|---|
| 340 | MSVCRT___setlc_active = 0; | 
|---|
| 341 | MSVCRT___unguarded_readlc_active = 0; | 
|---|
| 342 | MSVCRT_timezone = 0; | 
|---|
| 343 |  | 
|---|
| 344 | /* FIXME: set app type for Winelib apps */ | 
|---|
| 345 |  | 
|---|
| 346 | MSVCRT___initenv= msvcrt_SnapshotOfEnvironmentA(NULL); | 
|---|
| 347 | MSVCRT___winitenv= msvcrt_SnapshotOfEnvironmentW(NULL); | 
|---|
| 348 |  | 
|---|
| 349 | } | 
|---|
| 350 |  | 
|---|
| 351 |  | 
|---|
| 352 | /* INTERNAL: free memory used by args */ | 
|---|
| 353 | void msvcrt_free_args(void) | 
|---|
| 354 | { | 
|---|
| 355 | /* FIXME: more things to free */ | 
|---|
| 356 | if (MSVCRT___initenv) HeapFree(GetProcessHeap(), 0,MSVCRT___initenv); | 
|---|
| 357 | if (MSVCRT___winitenv) HeapFree(GetProcessHeap(), 0,MSVCRT___winitenv); | 
|---|
| 358 | if (MSVCRT__environ) HeapFree(GetProcessHeap(), 0,MSVCRT__environ); | 
|---|
| 359 | if (MSVCRT__wenviron) HeapFree(GetProcessHeap(), 0,MSVCRT__wenviron); | 
|---|
| 360 | } | 
|---|
| 361 |  | 
|---|
| 362 | /********************************************************************* | 
|---|
| 363 | *              __getmainargs (MSVCRT.@) | 
|---|
| 364 | */ | 
|---|
| 365 | void __getmainargs(int *argc, char** *argv, char** *envp, | 
|---|
| 366 | int expand_wildcards, int *new_mode) | 
|---|
| 367 | { | 
|---|
| 368 | TRACE("(%p,%p,%p,%d,%p).\n", argc, argv, envp, expand_wildcards, new_mode); | 
|---|
| 369 | *argc = MSVCRT___argc; | 
|---|
| 370 | *argv = MSVCRT___argv; | 
|---|
| 371 | *envp = MSVCRT___initenv; | 
|---|
| 372 | if (new_mode) | 
|---|
| 373 | MSVCRT__set_new_mode( *new_mode ); | 
|---|
| 374 | } | 
|---|
| 375 |  | 
|---|
| 376 | /********************************************************************* | 
|---|
| 377 | *              __wgetmainargs (MSVCRT.@) | 
|---|
| 378 | */ | 
|---|
| 379 | void __wgetmainargs(int *argc, MSVCRT_wchar_t** *wargv, MSVCRT_wchar_t** *wenvp, | 
|---|
| 380 | int expand_wildcards, int *new_mode) | 
|---|
| 381 | { | 
|---|
| 382 | TRACE("(%p,%p,%p,%d,%p).\n", argc, wargv, wenvp, expand_wildcards, new_mode); | 
|---|
| 383 | *argc = MSVCRT___argc; | 
|---|
| 384 | *wargv = MSVCRT___wargv; | 
|---|
| 385 | *wenvp = MSVCRT___winitenv; | 
|---|
| 386 | if (new_mode) | 
|---|
| 387 | MSVCRT__set_new_mode( *new_mode ); | 
|---|
| 388 | } | 
|---|
| 389 |  | 
|---|
| 390 | /********************************************************************* | 
|---|
| 391 | *              _initterm (MSVCRT.@) | 
|---|
| 392 | */ | 
|---|
| 393 | unsigned int _initterm(_INITTERMFUN *start,_INITTERMFUN *end) | 
|---|
| 394 | { | 
|---|
| 395 | _INITTERMFUN* current = start; | 
|---|
| 396 |  | 
|---|
| 397 | TRACE("(%p,%p)\n",start,end); | 
|---|
| 398 | while (current<end) | 
|---|
| 399 | { | 
|---|
| 400 | if (*current) | 
|---|
| 401 | { | 
|---|
| 402 | TRACE("Call init function %p\n",*current); | 
|---|
| 403 | (**current)(); | 
|---|
| 404 | TRACE("returned\n"); | 
|---|
| 405 | } | 
|---|
| 406 | current++; | 
|---|
| 407 | } | 
|---|
| 408 | return 0; | 
|---|
| 409 | } | 
|---|
| 410 |  | 
|---|
| 411 | /********************************************************************* | 
|---|
| 412 | *              __set_app_type (MSVCRT.@) | 
|---|
| 413 | */ | 
|---|
| 414 | void MSVCRT___set_app_type(int app_type) | 
|---|
| 415 | { | 
|---|
| 416 | TRACE("(%d) %s application\n", app_type, app_type == 2 ? "Gui" : "Console"); | 
|---|
| 417 | MSVCRT_app_type = app_type; | 
|---|
| 418 | } | 
|---|