2 * msvcrt.dll dll data items
4 * Copyright 2000 Jon Griffiths
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.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "wine/port.h"
26 #include "wine/library.h"
27 #include "wine/unicode.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(msvcrt
);
32 int MSVCRT___argc
= 0;
33 static int argc_expand
;
34 static int wargc_expand
;
35 unsigned int MSVCRT__commode
= 0;
36 unsigned int MSVCRT__fmode
= 0;
37 unsigned int MSVCRT__osver
= 0;
38 unsigned int MSVCRT__osplatform
= 0;
39 unsigned int MSVCRT__winmajor
= 0;
40 unsigned int MSVCRT__winminor
= 0;
41 unsigned int MSVCRT__winver
= 0;
42 unsigned int MSVCRT___setlc_active
= 0;
43 unsigned int MSVCRT___unguarded_readlc_active
= 0;
44 double MSVCRT__HUGE
= 0;
45 char **MSVCRT___argv
= NULL
;
46 static char **argv_expand
;
47 MSVCRT_wchar_t
**MSVCRT___wargv
= NULL
;
48 static MSVCRT_wchar_t
**wargv_expand
;
49 char *MSVCRT__acmdln
= NULL
;
50 MSVCRT_wchar_t
*MSVCRT__wcmdln
= NULL
;
51 char **MSVCRT__environ
= NULL
;
52 MSVCRT_wchar_t
**MSVCRT__wenviron
= NULL
;
53 char **MSVCRT___initenv
= NULL
;
54 MSVCRT_wchar_t
**MSVCRT___winitenv
= NULL
;
55 int MSVCRT_app_type
= 0;
56 char* MSVCRT__pgmptr
= NULL
;
57 WCHAR
* MSVCRT__wpgmptr
= NULL
;
59 /* Get a snapshot of the current environment
60 * and construct the __p__environ array
62 * The pointer returned from GetEnvironmentStrings may get invalid when
63 * some other module cause a reallocation of the env-variable block
65 * blk is an array of pointers to environment strings, ending with a NULL
66 * and after that the actual copy of the environment strings, ending in a \0
68 char ** msvcrt_SnapshotOfEnvironmentA(char **blk
)
70 char* environ_strings
= GetEnvironmentStringsA();
71 int count
= 1, len
= 1, i
= 0; /* keep space for the trailing NULLS */
74 for (ptr
= environ_strings
; *ptr
; ptr
+= strlen(ptr
) + 1)
77 len
+= strlen(ptr
) + 1;
80 blk
= HeapReAlloc( GetProcessHeap(), 0, blk
, count
* sizeof(char*) + len
);
82 blk
= HeapAlloc(GetProcessHeap(), 0, count
* sizeof(char*) + len
);
88 memcpy(&blk
[count
],environ_strings
,len
);
89 for (ptr
= (char*) &blk
[count
]; *ptr
; ptr
+= strlen(ptr
) + 1)
96 FreeEnvironmentStringsA(environ_strings
);
100 MSVCRT_wchar_t
** msvcrt_SnapshotOfEnvironmentW(MSVCRT_wchar_t
**wblk
)
102 MSVCRT_wchar_t
* wenviron_strings
= GetEnvironmentStringsW();
103 int count
= 1, len
= 1, i
= 0; /* keep space for the trailing NULLS */
104 MSVCRT_wchar_t
*wptr
;
106 for (wptr
= wenviron_strings
; *wptr
; wptr
+= strlenW(wptr
) + 1)
109 len
+= strlenW(wptr
) + 1;
112 wblk
= HeapReAlloc( GetProcessHeap(), 0, wblk
, count
* sizeof(MSVCRT_wchar_t
*) + len
* sizeof(MSVCRT_wchar_t
));
114 wblk
= HeapAlloc(GetProcessHeap(), 0, count
* sizeof(MSVCRT_wchar_t
*) + len
* sizeof(MSVCRT_wchar_t
));
119 memcpy(&wblk
[count
],wenviron_strings
,len
* sizeof(MSVCRT_wchar_t
));
120 for (wptr
= (MSVCRT_wchar_t
*)&wblk
[count
]; *wptr
; wptr
+= strlenW(wptr
) + 1)
127 FreeEnvironmentStringsW(wenviron_strings
);
131 typedef void (CDECL
*_INITTERMFUN
)(void);
132 typedef int (CDECL
*_INITTERM_E_FN
)(void);
134 /***********************************************************************
135 * __p___argc (MSVCRT.@)
137 int* CDECL
MSVCRT___p___argc(void) { return &MSVCRT___argc
; }
139 /***********************************************************************
140 * __p__commode (MSVCRT.@)
142 unsigned int* CDECL
__p__commode(void) { return &MSVCRT__commode
; }
145 /***********************************************************************
146 * __p__pgmptr (MSVCRT.@)
148 char** CDECL
MSVCRT___p__pgmptr(void) { return &MSVCRT__pgmptr
; }
150 /***********************************************************************
151 * __p__wpgmptr (MSVCRT.@)
153 WCHAR
** CDECL
MSVCRT___p__wpgmptr(void) { return &MSVCRT__wpgmptr
; }
155 /***********************************************************************
156 * _get_pgmptr (MSVCRT.@)
158 int CDECL
_get_pgmptr(char** p
)
160 if (!MSVCRT_CHECK_PMT(p
)) return MSVCRT_EINVAL
;
166 /***********************************************************************
167 * _get_wpgmptr (MSVCRT.@)
169 int CDECL
_get_wpgmptr(WCHAR
** p
)
171 if (!MSVCRT_CHECK_PMT(p
)) return MSVCRT_EINVAL
;
172 *p
= MSVCRT__wpgmptr
;
176 /***********************************************************************
177 * __p__fmode (MSVCRT.@)
179 unsigned int* CDECL
__p__fmode(void) { return &MSVCRT__fmode
; }
181 /***********************************************************************
182 * _set_fmode (MSVCRT.@)
184 int CDECL
MSVCRT__set_fmode(int mode
)
186 /* TODO: support _O_WTEXT */
187 if(!MSVCRT_CHECK_PMT(mode
==MSVCRT__O_TEXT
|| mode
==MSVCRT__O_BINARY
))
188 return MSVCRT_EINVAL
;
190 MSVCRT__fmode
= mode
;
194 /***********************************************************************
195 * _get_fmode (MSVCRT.@)
197 int CDECL
MSVCRT__get_fmode(int *mode
)
199 if(!MSVCRT_CHECK_PMT(mode
))
200 return MSVCRT_EINVAL
;
202 *mode
= MSVCRT__fmode
;
206 /***********************************************************************
207 * __p__osver (MSVCRT.@)
209 unsigned int* CDECL
__p__osver(void) { return &MSVCRT__osver
; }
211 /***********************************************************************
212 * __p__winmajor (MSVCRT.@)
214 unsigned int* CDECL
__p__winmajor(void) { return &MSVCRT__winmajor
; }
216 /***********************************************************************
217 * __p__winminor (MSVCRT.@)
219 unsigned int* CDECL
__p__winminor(void) { return &MSVCRT__winminor
; }
221 /***********************************************************************
222 * __p__winver (MSVCRT.@)
224 unsigned int* CDECL
__p__winver(void) { return &MSVCRT__winver
; }
226 /*********************************************************************
227 * __p__acmdln (MSVCRT.@)
229 char** CDECL
__p__acmdln(void) { return &MSVCRT__acmdln
; }
231 /*********************************************************************
232 * __p__wcmdln (MSVCRT.@)
234 MSVCRT_wchar_t
** CDECL
__p__wcmdln(void) { return &MSVCRT__wcmdln
; }
236 /*********************************************************************
237 * __p___argv (MSVCRT.@)
239 char*** CDECL
MSVCRT___p___argv(void) { return &MSVCRT___argv
; }
241 /*********************************************************************
242 * __p___wargv (MSVCRT.@)
244 MSVCRT_wchar_t
*** CDECL
MSVCRT___p___wargv(void) { return &MSVCRT___wargv
; }
246 /*********************************************************************
247 * __p__environ (MSVCRT.@)
249 char*** CDECL
MSVCRT___p__environ(void)
251 return &MSVCRT__environ
;
254 /*********************************************************************
255 * __p__wenviron (MSVCRT.@)
257 MSVCRT_wchar_t
*** CDECL
MSVCRT___p__wenviron(void)
259 return &MSVCRT__wenviron
;
262 /*********************************************************************
263 * __p___initenv (MSVCRT.@)
265 char*** CDECL
__p___initenv(void) { return &MSVCRT___initenv
; }
267 /*********************************************************************
268 * __p___winitenv (MSVCRT.@)
270 MSVCRT_wchar_t
*** CDECL
__p___winitenv(void) { return &MSVCRT___winitenv
; }
272 /*********************************************************************
273 * _get_osplatform (MSVCRT.@)
275 int CDECL
MSVCRT__get_osplatform(int *pValue
)
277 if (!MSVCRT_CHECK_PMT(pValue
!= NULL
)) return MSVCRT_EINVAL
;
278 *pValue
= MSVCRT__osplatform
;
282 /* INTERNAL: Create a wide string from an ascii string */
283 MSVCRT_wchar_t
*msvcrt_wstrdupa(const char *str
)
285 const unsigned int len
= strlen(str
) + 1 ;
286 MSVCRT_wchar_t
*wstr
= MSVCRT_malloc(len
* sizeof (MSVCRT_wchar_t
));
289 MultiByteToWideChar(CP_ACP
, MB_PRECOMPOSED
,str
,len
,wstr
,len
);
293 /*********************************************************************
294 * ___unguarded_readlc_active_add_func (MSVCRT.@)
296 unsigned int * CDECL
MSVCRT____unguarded_readlc_active_add_func(void)
298 return &MSVCRT___unguarded_readlc_active
;
301 /*********************************************************************
302 * ___setlc_active_func (MSVCRT.@)
304 unsigned int CDECL
MSVCRT____setlc_active_func(void)
306 return MSVCRT___setlc_active
;
309 /* INTERNAL: Since we can't rely on Winelib startup code calling w/getmainargs,
310 * we initialise data values during DLL loading. When called by a native
311 * program we simply return the data we've already initialised. This also means
312 * you can call multiple times without leaking
314 void msvcrt_init_args(void)
318 MSVCRT__acmdln
= MSVCRT__strdup( GetCommandLineA() );
319 MSVCRT__wcmdln
= msvcrt_wstrdupa(MSVCRT__acmdln
);
320 MSVCRT___argc
= __wine_main_argc
;
321 MSVCRT___argv
= __wine_main_argv
;
322 MSVCRT___wargv
= __wine_main_wargv
;
324 TRACE("got %s, wide = %s argc=%d\n", debugstr_a(MSVCRT__acmdln
),
325 debugstr_w(MSVCRT__wcmdln
),MSVCRT___argc
);
327 osvi
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFOW
);
328 GetVersionExW( &osvi
);
329 MSVCRT__winver
= (osvi
.dwMajorVersion
<< 8) | osvi
.dwMinorVersion
;
330 MSVCRT__winmajor
= osvi
.dwMajorVersion
;
331 MSVCRT__winminor
= osvi
.dwMinorVersion
;
332 MSVCRT__osver
= osvi
.dwBuildNumber
;
333 MSVCRT__osplatform
= osvi
.dwPlatformId
;
334 TRACE( "winver %08x winmajor %08x winminor %08x osver %08x\n",
335 MSVCRT__winver
, MSVCRT__winmajor
, MSVCRT__winminor
, MSVCRT__osver
);
337 MSVCRT__HUGE
= HUGE_VAL
;
338 MSVCRT___setlc_active
= 0;
339 MSVCRT___unguarded_readlc_active
= 0;
340 MSVCRT__fmode
= MSVCRT__O_TEXT
;
342 MSVCRT__environ
= msvcrt_SnapshotOfEnvironmentA(NULL
);
343 MSVCRT___initenv
= msvcrt_SnapshotOfEnvironmentA(NULL
);
344 MSVCRT___winitenv
= msvcrt_SnapshotOfEnvironmentW(NULL
);
346 MSVCRT__pgmptr
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
);
349 if (!GetModuleFileNameA(0, MSVCRT__pgmptr
, MAX_PATH
))
350 MSVCRT__pgmptr
[0] = '\0';
352 MSVCRT__pgmptr
[MAX_PATH
- 1] = '\0';
355 MSVCRT__wpgmptr
= HeapAlloc(GetProcessHeap(), 0, MAX_PATH
* sizeof(WCHAR
));
358 if (!GetModuleFileNameW(0, MSVCRT__wpgmptr
, MAX_PATH
))
359 MSVCRT__wpgmptr
[0] = '\0';
361 MSVCRT__wpgmptr
[MAX_PATH
- 1] = '\0';
365 /* INTERNAL: free memory used by args */
366 void msvcrt_free_args(void)
368 /* FIXME: more things to free */
369 HeapFree(GetProcessHeap(), 0, MSVCRT___initenv
);
370 HeapFree(GetProcessHeap(), 0, MSVCRT___winitenv
);
371 HeapFree(GetProcessHeap(), 0, MSVCRT__environ
);
372 HeapFree(GetProcessHeap(), 0, MSVCRT__wenviron
);
373 HeapFree(GetProcessHeap(), 0, MSVCRT__pgmptr
);
374 HeapFree(GetProcessHeap(), 0, MSVCRT__wpgmptr
);
375 HeapFree(GetProcessHeap(), 0, argv_expand
);
376 HeapFree(GetProcessHeap(), 0, wargv_expand
);
379 static int build_expanded_argv(int *argc
, char **argv
)
381 int i
, size
=0, args_no
=0, path_len
;
386 for(i
=0; i
<__wine_main_argc
; i
++) {
387 WIN32_FIND_DATAA data
;
390 is_expandable
= FALSE
;
391 for(path_len
= strlen(__wine_main_argv
[i
])-1; path_len
>=0; path_len
--) {
392 if(__wine_main_argv
[i
][path_len
]=='*' || __wine_main_argv
[i
][path_len
]=='?')
393 is_expandable
= TRUE
;
394 else if(__wine_main_argv
[i
][path_len
]=='\\' || __wine_main_argv
[i
][path_len
]=='/')
400 h
= FindFirstFileA(__wine_main_argv
[i
], &data
);
402 h
= INVALID_HANDLE_VALUE
;
404 if(h
!= INVALID_HANDLE_VALUE
) {
406 if(data
.cFileName
[0]=='.' && (data
.cFileName
[1]=='\0' ||
407 (data
.cFileName
[1]=='.' && data
.cFileName
[2]=='\0')))
410 len
= strlen(data
.cFileName
)+1;
412 argv
[args_no
] = (char*)(argv
+*argc
+1)+size
;
413 memcpy(argv
[args_no
], __wine_main_argv
[i
], path_len
*sizeof(char));
414 memcpy(argv
[args_no
]+path_len
, data
.cFileName
, len
*sizeof(char));
417 size
+= len
+path_len
;
418 }while(FindNextFileA(h
, &data
));
423 len
= strlen(__wine_main_argv
[i
])+1;
425 argv
[args_no
] = (char*)(argv
+*argc
+1)+size
;
426 memcpy(argv
[args_no
], __wine_main_argv
[i
], len
*sizeof(char));
434 argv
[args_no
] = NULL
;
435 size
+= (args_no
+1)*sizeof(char*);
440 /*********************************************************************
441 * __getmainargs (MSVCRT.@)
443 void CDECL
__getmainargs(int *argc
, char** *argv
, char** *envp
,
444 int expand_wildcards
, int *new_mode
)
446 TRACE("(%p,%p,%p,%d,%p).\n", argc
, argv
, envp
, expand_wildcards
, new_mode
);
448 if (expand_wildcards
) {
449 HeapFree(GetProcessHeap(), 0, argv_expand
);
452 argv_expand
= HeapAlloc(GetProcessHeap(), 0,
453 build_expanded_argv(&argc_expand
, NULL
));
455 build_expanded_argv(&argc_expand
, argv_expand
);
457 MSVCRT___argc
= argc_expand
;
458 MSVCRT___argv
= argv_expand
;
460 expand_wildcards
= 0;
463 if (!expand_wildcards
) {
464 MSVCRT___argc
= __wine_main_argc
;
465 MSVCRT___argv
= __wine_main_argv
;
468 *argc
= MSVCRT___argc
;
469 *argv
= MSVCRT___argv
;
470 *envp
= MSVCRT___initenv
;
473 MSVCRT__set_new_mode( *new_mode
);
476 static int build_expanded_wargv(int *argc
, MSVCRT_wchar_t
**argv
)
478 int i
, size
=0, args_no
=0, path_len
;
483 for(i
=0; i
<__wine_main_argc
; i
++) {
484 WIN32_FIND_DATAW data
;
487 is_expandable
= FALSE
;
488 for(path_len
= strlenW(__wine_main_wargv
[i
])-1; path_len
>=0; path_len
--) {
489 if(__wine_main_wargv
[i
][path_len
]=='*' || __wine_main_wargv
[i
][path_len
]=='?')
490 is_expandable
= TRUE
;
491 else if(__wine_main_wargv
[i
][path_len
]=='\\' || __wine_main_wargv
[i
][path_len
]=='/')
497 h
= FindFirstFileW(__wine_main_wargv
[i
], &data
);
499 h
= INVALID_HANDLE_VALUE
;
501 if(h
!= INVALID_HANDLE_VALUE
) {
503 if(data
.cFileName
[0]=='.' && (data
.cFileName
[1]=='\0' ||
504 (data
.cFileName
[1]=='.' && data
.cFileName
[2]=='\0')))
507 len
= strlenW(data
.cFileName
)+1;
509 argv
[args_no
] = (MSVCRT_wchar_t
*)(argv
+*argc
+1)+size
;
510 memcpy(argv
[args_no
], __wine_main_wargv
[i
], path_len
*sizeof(MSVCRT_wchar_t
));
511 memcpy(argv
[args_no
]+path_len
, data
.cFileName
, len
*sizeof(MSVCRT_wchar_t
));
514 size
+= len
+path_len
;
515 }while(FindNextFileW(h
, &data
));
520 len
= strlenW(__wine_main_wargv
[i
])+1;
522 argv
[args_no
] = (MSVCRT_wchar_t
*)(argv
+*argc
+1)+size
;
523 memcpy(argv
[args_no
], __wine_main_wargv
[i
], len
*sizeof(MSVCRT_wchar_t
));
531 argv
[args_no
] = NULL
;
532 size
*= sizeof(MSVCRT_wchar_t
);
533 size
+= (args_no
+1)*sizeof(MSVCRT_wchar_t
*);
538 /*********************************************************************
539 * __wgetmainargs (MSVCRT.@)
541 void CDECL
__wgetmainargs(int *argc
, MSVCRT_wchar_t
** *wargv
, MSVCRT_wchar_t
** *wenvp
,
542 int expand_wildcards
, int *new_mode
)
544 TRACE("(%p,%p,%p,%d,%p).\n", argc
, wargv
, wenvp
, expand_wildcards
, new_mode
);
546 if (expand_wildcards
) {
547 HeapFree(GetProcessHeap(), 0, wargv_expand
);
550 wargv_expand
= HeapAlloc(GetProcessHeap(), 0,
551 build_expanded_wargv(&wargc_expand
, NULL
));
553 build_expanded_wargv(&wargc_expand
, wargv_expand
);
555 MSVCRT___argc
= wargc_expand
;
556 MSVCRT___wargv
= wargv_expand
;
558 expand_wildcards
= 0;
561 if (!expand_wildcards
) {
562 MSVCRT___argc
= __wine_main_argc
;
563 MSVCRT___wargv
= __wine_main_wargv
;
566 /* Initialize the _wenviron array if it's not already created. */
567 if (!MSVCRT__wenviron
)
568 MSVCRT__wenviron
= msvcrt_SnapshotOfEnvironmentW(NULL
);
569 *argc
= MSVCRT___argc
;
570 *wargv
= MSVCRT___wargv
;
571 *wenvp
= MSVCRT___winitenv
;
573 MSVCRT__set_new_mode( *new_mode
);
576 /*********************************************************************
577 * _initterm (MSVCRT.@)
579 void CDECL
_initterm(_INITTERMFUN
*start
,_INITTERMFUN
*end
)
581 _INITTERMFUN
* current
= start
;
583 TRACE("(%p,%p)\n",start
,end
);
588 TRACE("Call init function %p\n",*current
);
596 /*********************************************************************
597 * _initterm_e (MSVCRT.@)
599 * call an array of application initialization functions and report the return value
601 int CDECL
_initterm_e(_INITTERM_E_FN
*table
, _INITTERM_E_FN
*end
)
605 TRACE("(%p, %p)\n", table
, end
);
607 while (!res
&& table
< end
) {
609 TRACE("calling %p\n", **table
);
612 TRACE("function %p failed: 0x%x\n", *table
, res
);
620 /*********************************************************************
621 * __set_app_type (MSVCRT.@)
623 void CDECL
MSVCRT___set_app_type(int app_type
)
625 TRACE("(%d) %s application\n", app_type
, app_type
== 2 ? "Gui" : "Console");
626 MSVCRT_app_type
= app_type
;
631 /*********************************************************************
632 * _get_initial_narrow_environment (UCRTBASE.@)
634 char** CDECL
_get_initial_narrow_environment(void)
636 return MSVCRT___initenv
;
639 /*********************************************************************
640 * _configure_narrow_argv (UCRTBASE.@)
642 int CDECL
_configure_narrow_argv(int mode
)
644 TRACE("(%d)\n", mode
);
648 /*********************************************************************
649 * _initialize_narrow_environment (UCRTBASE.@)
651 int CDECL
_initialize_narrow_environment(void)
657 /*********************************************************************
658 * _get_initial_wide_environment (UCRTBASE.@)
660 MSVCRT_wchar_t
** CDECL
_get_initial_wide_environment(void)
662 return MSVCRT___winitenv
;
665 /*********************************************************************
666 * _configure_wide_argv (UCRTBASE.@)
668 int CDECL
_configure_wide_argv(int mode
)
670 FIXME("(%d) stub\n", mode
);
674 /*********************************************************************
675 * _initialize_wide_environment (UCRTBASE.@)
677 int CDECL
_initialize_wide_environment(void)
683 /*********************************************************************
684 * _get_narrow_winmain_command_line (UCRTBASE.@)
686 char* CDECL
_get_narrow_winmain_command_line(void)
688 static char *narrow_command_line
;
691 if (narrow_command_line
)
692 return narrow_command_line
;
694 s
= GetCommandLineA();
695 while (*s
&& *s
!= ' ' && *s
!= '\t')
699 while (*s
&& *s
++ != '"')
704 while (*s
== ' ' || *s
== '\t')
707 return narrow_command_line
= s
;
710 /*********************************************************************
711 * _get_wide_winmain_command_line (UCRTBASE.@)
713 MSVCRT_wchar_t
* CDECL
_get_wide_winmain_command_line(void)
715 static MSVCRT_wchar_t
*wide_command_line
;
718 if (wide_command_line
)
719 return wide_command_line
;
721 s
= GetCommandLineW();
722 while (*s
&& *s
!= ' ' && *s
!= '\t')
726 while (*s
&& *s
++ != '"')
731 while (*s
== ' ' || *s
== '\t')
734 return wide_command_line
= s
;
737 #endif /* _MSVCR_VER>=140 */
739 /*********************************************************************
740 * _get_winmajor (MSVCRT.@)
742 int CDECL
MSVCRT__get_winmajor(int* value
)
744 if (!MSVCRT_CHECK_PMT(value
!= NULL
)) return MSVCRT_EINVAL
;
745 *value
= MSVCRT__winmajor
;
749 /*********************************************************************
750 * _get_winminor (MSVCRT.@)
752 int CDECL
MSVCRT__get_winminor(int* value
)
754 if (!MSVCRT_CHECK_PMT(value
!= NULL
)) return MSVCRT_EINVAL
;
755 *value
= MSVCRT__winminor
;
759 /*********************************************************************
760 * _get_osver (MSVCRT.@)
762 int CDECL
MSVCRT__get_osver(int* value
)
764 if (!MSVCRT_CHECK_PMT(value
!= NULL
)) return MSVCRT_EINVAL
;
765 *value
= MSVCRT__osver
;