ReactOS 0.4.16-dev-2104-gb84fa49
data.c File Reference
#include <fcntl.h>
#include <math.h>
#include "msvcrt.h"
#include <winnls.h>
#include "wine/debug.h"
Include dependency graph for data.c:

Go to the source code of this file.

Typedefs

typedef void(CDECL_INITTERMFUN) (void)
 
typedef int(CDECL_INITTERM_E_FN) (void)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msvcrt)
 
static char ** build_argv (WCHAR **wargv)
 
static WCHAR ** cmdline_to_argv (const WCHAR *src, int *ret_argc)
 
int *CDECL __p___argc (void)
 
unsigned int *CDECL __p__commode (void)
 
char **CDECL __p__pgmptr (void)
 
WCHAR **CDECL __p__wpgmptr (void)
 
int CDECL _get_pgmptr (char **p)
 
int CDECL _get_wpgmptr (WCHAR **p)
 
int *CDECL __p__fmode (void)
 
int CDECL _set_fmode (int mode)
 
int CDECL _get_fmode (int *mode)
 
unsigned int *CDECL __p__osver (void)
 
unsigned int *CDECL __p__winmajor (void)
 
unsigned int *CDECL __p__winminor (void)
 
unsigned int *CDECL __p__winver (void)
 
char **CDECL __p__acmdln (void)
 
wchar_t **CDECL __p__wcmdln (void)
 
char ***CDECL __p___argv (void)
 
wchar_t ***CDECL __p___wargv (void)
 
char ***CDECL __p__environ (void)
 
wchar_t ***CDECL __p__wenviron (void)
 
char ***CDECL __p___initenv (void)
 
wchar_t ***CDECL __p___winitenv (void)
 
int CDECL _get_osplatform (int *pValue)
 
wchar_tmsvcrt_wstrdupa (const char *str)
 
unsigned int *CDECL ___unguarded_readlc_active_add_func (void)
 
unsigned int CDECL ___setlc_active_func (void)
 
void msvcrt_init_args (void)
 
void msvcrt_free_args (void)
 
static int build_expanded_wargv (int *argc, wchar_t **argv)
 
int CDECL __wgetmainargs (int *argc, wchar_t ***wargv, wchar_t ***wenvp, int expand_wildcards, int *new_mode)
 
int CDECL __getmainargs (int *argc, char ***argv, char ***envp, int expand_wildcards, int *new_mode)
 
void CDECL _initterm (_INITTERMFUN *start, _INITTERMFUN *end)
 
int CDECL _initterm_e (_INITTERM_E_FN *table, _INITTERM_E_FN *end)
 
void CDECL __set_app_type (int app_type)
 
int CDECL _get_winmajor (int *value)
 
int CDECL _get_winminor (int *value)
 
int CDECL _get_osver (int *value)
 

Variables

static WCHAR ** initial_wargv
 
static int initial_argc
 
int MSVCRT___argc = 0
 
static int wargc_expand
 
unsigned int MSVCRT__commode = 0
 
int MSVCRT__fmode = 0
 
unsigned int MSVCRT__osver = 0
 
unsigned int MSVCRT__osplatform = 0
 
unsigned int MSVCRT__winmajor = 0
 
unsigned int MSVCRT__winminor = 0
 
unsigned int MSVCRT__winver = 0
 
unsigned int MSVCRT___setlc_active = 0
 
unsigned int MSVCRT___unguarded_readlc_active = 0
 
double MSVCRT__HUGE = 0
 
char ** MSVCRT___argv = NULL
 
wchar_t ** MSVCRT___wargv = NULL
 
static wchar_t ** wargv_expand
 
charMSVCRT__acmdln = NULL
 
wchar_tMSVCRT__wcmdln = NULL
 
char ** MSVCRT__environ = NULL
 
wchar_t ** MSVCRT__wenviron = NULL
 
char ** MSVCRT___initenv = NULL
 
wchar_t ** MSVCRT___winitenv = NULL
 
int MSVCRT_app_type = 0
 
charMSVCRT__pgmptr = NULL
 
WCHARMSVCRT__wpgmptr = NULL
 

Typedef Documentation

◆ _INITTERM_E_FN

typedef int(CDECL * _INITTERM_E_FN) (void)

Definition at line 222 of file data.c.

◆ _INITTERMFUN

typedef void(CDECL * _INITTERMFUN) (void)

Definition at line 221 of file data.c.

Function Documentation

◆ ___setlc_active_func()

unsigned int CDECL ___setlc_active_func ( void  )

Definition at line 394 of file data.c.

395{
397}
unsigned int MSVCRT___setlc_active
Definition: data.c:47

Referenced by Test___setlc_active().

◆ ___unguarded_readlc_active_add_func()

unsigned int *CDECL ___unguarded_readlc_active_add_func ( void  )

Definition at line 386 of file data.c.

387{
389}
unsigned int MSVCRT___unguarded_readlc_active
Definition: data.c:48

Referenced by Test___unguarded_readlc_active().

◆ __getmainargs()

int CDECL __getmainargs ( int argc,
char ***  argv,
char ***  envp,
int  expand_wildcards,
int new_mode 
)

Definition at line 579 of file data.c.

581{
582 TRACE("(%p,%p,%p,%d,%p).\n", argc, argv, envp, expand_wildcards, new_mode);
583
584 if (expand_wildcards) {
588 if (wargv_expand) {
590
593 }else {
594 expand_wildcards = 0;
595 }
596 }
597 if (!expand_wildcards) {
598#ifdef __REACTOS__
599 if ((MSVCRT___argv == NULL) || (MSVCRT___argc == 0))
600 {
601 MSVCRT___argv = cmdline_to_argvA(MSVCRT__acmdln, &MSVCRT___argc);
602 }
603#else
606#endif
607 }
608
611 *envp = MSVCRT__environ;
612
613 if (new_mode)
614 _set_new_mode( *new_mode );
615 return 0;
616}
static int argc
Definition: ServiceArgs.c:12
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
static char ** build_argv(WCHAR **wargv)
Definition: data.c:63
static int initial_argc
Definition: data.c:30
static int build_expanded_wargv(int *argc, wchar_t **argv)
Definition: data.c:471
static int wargc_expand
Definition: data.c:32
char ** MSVCRT___argv
Definition: data.c:50
static WCHAR ** initial_wargv
Definition: data.c:29
int MSVCRT___argc
Definition: data.c:31
char ** MSVCRT__environ
Definition: data.c:55
char * MSVCRT__acmdln
Definition: data.c:53
static wchar_t ** wargv_expand
Definition: data.c:52
int CDECL _set_new_mode(int mode)
Definition: heap.c:227
#define argv
Definition: mplay32.c:18
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by test___getmainargs().

◆ __p___argc()

int *CDECL __p___argc ( void  )

◆ __p___argv()

char ***CDECL __p___argv ( void  )

Definition at line 329 of file data.c.

329{ return &MSVCRT___argv; }

Referenced by call_main< decltype(main)>(), mainCRTStartup(), ok_argsA_imp(), and Test___argv().

◆ __p___initenv()

char ***CDECL __p___initenv ( void  )

Definition at line 355 of file data.c.

355{ return &MSVCRT___initenv; }
char ** MSVCRT___initenv
Definition: data.c:57

Referenced by Test___initenv().

◆ __p___wargv()

wchar_t ***CDECL __p___wargv ( void  )

Definition at line 334 of file data.c.

334{ return &MSVCRT___wargv; }
wchar_t ** MSVCRT___wargv
Definition: data.c:51

Referenced by call_main< decltype(wmain)>(), ok_argsW_imp(), Test___wargv(), and wmainCRTStartup().

◆ __p___winitenv()

wchar_t ***CDECL __p___winitenv ( void  )

Definition at line 360 of file data.c.

360{ return &MSVCRT___winitenv; }
wchar_t ** MSVCRT___winitenv
Definition: data.c:58

Referenced by Test___winitenv().

◆ __p__acmdln()

char **CDECL __p__acmdln ( void  )

Definition at line 319 of file data.c.

319{ return &MSVCRT__acmdln; }

Referenced by Test__acmdln().

◆ __p__commode()

unsigned int *CDECL __p__commode ( void  )

Definition at line 232 of file data.c.

232{ return &MSVCRT__commode; }
unsigned int MSVCRT__commode
Definition: data.c:33

Referenced by Test__commode().

◆ __p__environ()

char ***CDECL __p__environ ( void  )

Definition at line 339 of file data.c.

340{
341 return &MSVCRT__environ;
342}

Referenced by getenv(), and Test__environ().

◆ __p__fmode()

int *CDECL __p__fmode ( void  )

Definition at line 269 of file data.c.

269{ return &MSVCRT__fmode; }
int MSVCRT__fmode
Definition: data.c:34

Referenced by Test__fmode().

◆ __p__osver()

unsigned int *CDECL __p__osver ( void  )

Definition at line 299 of file data.c.

299{ return &MSVCRT__osver; }
unsigned int MSVCRT__osver
Definition: data.c:35

Referenced by Test__osver().

◆ __p__pgmptr()

char **CDECL __p__pgmptr ( void  )

Definition at line 238 of file data.c.

238{ return &MSVCRT__pgmptr; }
char * MSVCRT__pgmptr
Definition: data.c:60

Referenced by Test__pgmptr().

◆ __p__wcmdln()

wchar_t **CDECL __p__wcmdln ( void  )

Definition at line 324 of file data.c.

324{ return &MSVCRT__wcmdln; }
wchar_t * MSVCRT__wcmdln
Definition: data.c:54

Referenced by Test__wcmdln().

◆ __p__wenviron()

wchar_t ***CDECL __p__wenviron ( void  )

Definition at line 347 of file data.c.

348{
349 return &MSVCRT__wenviron;
350}
wchar_t ** MSVCRT__wenviron
Definition: data.c:56

Referenced by _wgetenv(), and Test__wenviron().

◆ __p__winmajor()

unsigned int *CDECL __p__winmajor ( void  )

Definition at line 304 of file data.c.

304{ return &MSVCRT__winmajor; }
unsigned int MSVCRT__winmajor
Definition: data.c:37

Referenced by Test__winmajor().

◆ __p__winminor()

unsigned int *CDECL __p__winminor ( void  )

Definition at line 309 of file data.c.

309{ return &MSVCRT__winminor; }
unsigned int MSVCRT__winminor
Definition: data.c:38

Referenced by Test__winminor().

◆ __p__winver()

unsigned int *CDECL __p__winver ( void  )

Definition at line 314 of file data.c.

314{ return &MSVCRT__winver; }
unsigned int MSVCRT__winver
Definition: data.c:39

Referenced by Test__winver().

◆ __p__wpgmptr()

WCHAR **CDECL __p__wpgmptr ( void  )

Definition at line 243 of file data.c.

243{ return &MSVCRT__wpgmptr; }
WCHAR * MSVCRT__wpgmptr
Definition: data.c:61

Referenced by Test__wpgmptr().

◆ __set_app_type()

void CDECL __set_app_type ( int  app_type)

Definition at line 676 of file data.c.

677{
678 TRACE("(%d) %s application\n", app_type, app_type == 2 ? "Gui" : "Console");
679 MSVCRT_app_type = app_type;
680}
int MSVCRT_app_type
Definition: data.c:59

◆ __wgetmainargs()

int CDECL __wgetmainargs ( int argc,
wchar_t ***  wargv,
wchar_t ***  wenvp,
int  expand_wildcards,
int new_mode 
)

Definition at line 536 of file data.c.

538{
539 TRACE("(%p,%p,%p,%d,%p).\n", argc, wargv, wenvp, expand_wildcards, new_mode);
540
541 if (expand_wildcards) {
545 if (wargv_expand) {
547
550 }else {
551 expand_wildcards = 0;
552 }
553 }
554 if (!expand_wildcards) {
555#ifdef __REACTOS__
556 if ((MSVCRT___wargv == NULL) || (MSVCRT___argc == 0))
557 {
559 }
560#else
563#endif
564 }
565
567
569 *wargv = MSVCRT___wargv;
570 *wenvp = MSVCRT__wenviron;
571 if (new_mode)
572 _set_new_mode( *new_mode );
573 return 0;
574}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static WCHAR ** cmdline_to_argv(const WCHAR *src, int *ret_argc)
Definition: data.c:85
int env_init(BOOL unicode, BOOL modif)
Definition: environ.c:30

Referenced by test__wenviron(), and wmainCRTStartup().

◆ _get_fmode()

int CDECL _get_fmode ( int mode)

Definition at line 287 of file data.c.

288{
290 return EINVAL;
291
293 return 0;
294}
#define EINVAL
Definition: errno.h:44
#define MSVCRT_CHECK_PMT(x)
Definition: msvcrt.h:378
GLenum mode
Definition: glext.h:6217

Referenced by _pipe(), _wpopen(), configure_text_mode(), is_text_mode(), and split_oflags().

◆ _get_osplatform()

int CDECL _get_osplatform ( int pValue)

Definition at line 365 of file data.c.

366{
367 if (!MSVCRT_CHECK_PMT(pValue != NULL)) return EINVAL;
369 return 0;
370}
unsigned int MSVCRT__osplatform
Definition: data.c:36
PWCHAR pValue

◆ _get_osver()

int CDECL _get_osver ( int value)

Definition at line 819 of file data.c.

820{
821 if (!MSVCRT_CHECK_PMT(value != NULL)) return EINVAL;
823 return 0;
824}
Definition: pdh_main.c:96

◆ _get_pgmptr()

int CDECL _get_pgmptr ( char **  p)

Definition at line 248 of file data.c.

249{
250 if (!MSVCRT_CHECK_PMT(p)) return EINVAL;
251
252 *p = MSVCRT__pgmptr;
253 return 0;
254}
GLfloat GLfloat p
Definition: glext.h:8902

◆ _get_winmajor()

int CDECL _get_winmajor ( int value)

Definition at line 799 of file data.c.

800{
801 if (!MSVCRT_CHECK_PMT(value != NULL)) return EINVAL;
803 return 0;
804}

◆ _get_winminor()

int CDECL _get_winminor ( int value)

Definition at line 809 of file data.c.

810{
811 if (!MSVCRT_CHECK_PMT(value != NULL)) return EINVAL;
813 return 0;
814}

◆ _get_wpgmptr()

int CDECL _get_wpgmptr ( WCHAR **  p)

Definition at line 259 of file data.c.

260{
261 if (!MSVCRT_CHECK_PMT(p)) return EINVAL;
263 return 0;
264}

◆ _initterm()

void CDECL _initterm ( _INITTERMFUN start,
_INITTERMFUN end 
)

Definition at line 632 of file data.c.

633{
635
636 TRACE("(%p,%p)\n",start,end);
637 while (current<end)
638 {
639 if (*current)
640 {
641 TRACE("Call init function %p\n",*current);
642 (**current)();
643 TRACE("returned\n");
644 }
645 current++;
646 }
647}
void(CDECL * _INITTERMFUN)(void)
Definition: data.c:221
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
struct task_struct * current
Definition: linux.c:32

Referenced by __scrt_initialize(), and common_exit().

◆ _initterm_e()

int CDECL _initterm_e ( _INITTERM_E_FN table,
_INITTERM_E_FN end 
)

Definition at line 654 of file data.c.

655{
656 int res = 0;
657
658 TRACE("(%p, %p)\n", table, end);
659
660 while (!res && table < end) {
661 if (*table) {
662 TRACE("calling %p\n", **table);
663 res = (**table)();
664 if (res)
665 TRACE("function %p failed: %#x\n", *table, res);
666
667 }
668 table++;
669 }
670 return res;
671}
GLuint res
Definition: glext.h:9613

Referenced by __scrt_initialize().

◆ _set_fmode()

int CDECL _set_fmode ( int  mode)

Definition at line 274 of file data.c.

275{
276 /* TODO: support _O_WTEXT */
278 return EINVAL;
279
281 return 0;
282}
#define _O_BINARY
Definition: cabinet.h:51
#define _O_TEXT
Definition: cabinet.h:50

◆ build_argv()

static char ** build_argv ( WCHAR **  wargv)
static

Definition at line 63 of file data.c.

64{
65 int argc;
66 char *p, **argv;
67 DWORD total = 0;
68
69 for (argc = 0; wargv[argc]; argc++)
70 total += WideCharToMultiByte( CP_ACP, 0, wargv[argc], -1, NULL, 0, NULL, NULL );
71
72 argv = HeapAlloc( GetProcessHeap(), 0, total + (argc + 1) * sizeof(*argv) );
73 p = (char *)(argv + argc + 1);
74 for (argc = 0; wargv[argc]; argc++)
75 {
76 DWORD reslen = WideCharToMultiByte( CP_ACP, 0, wargv[argc], -1, p, total, NULL, NULL );
77 argv[argc] = p;
78 p += reslen;
79 total -= reslen;
80 }
81 argv[argc] = NULL;
82 return argv;
83}
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
unsigned long DWORD
Definition: ntddk_ex.h:95
size_t total
static DWORD LPDWORD reslen
Definition: directory.c:51

Referenced by __getmainargs(), and msvcrt_init_args().

◆ build_expanded_wargv()

static int build_expanded_wargv ( int argc,
wchar_t **  argv 
)
static

Definition at line 471 of file data.c.

472{
473 int i, size=0, args_no=0, path_len;
474 BOOL is_expandable;
475 HANDLE h;
476
477 args_no = 0;
478 for(i=0; i < initial_argc; i++) {
480 int len = 0;
481
482 is_expandable = FALSE;
483 for(path_len = wcslen(initial_wargv[i])-1; path_len>=0; path_len--) {
484 if(initial_wargv[i][path_len]=='*' || initial_wargv[i][path_len]=='?')
485 is_expandable = TRUE;
486 else if(initial_wargv[i][path_len]=='\\' || initial_wargv[i][path_len]=='/')
487 break;
488 }
489 path_len++;
490
491 if(is_expandable)
493 else
495
496 if(h != INVALID_HANDLE_VALUE) {
497 do {
498 if(data.cFileName[0]=='.' && (data.cFileName[1]=='\0' ||
499 (data.cFileName[1]=='.' && data.cFileName[2]=='\0')))
500 continue;
501
502 len = wcslen(data.cFileName)+1;
503 if(argv) {
504 argv[args_no] = (wchar_t*)(argv+*argc+1)+size;
505 memcpy(argv[args_no], initial_wargv[i], path_len*sizeof(wchar_t));
506 memcpy(argv[args_no]+path_len, data.cFileName, len*sizeof(wchar_t));
507 }
508 args_no++;
509 size += len+path_len;
510 }while(FindNextFileW(h, &data));
511 FindClose(h);
512 }
513
514 if(!len) {
516 if(argv) {
517 argv[args_no] = (wchar_t*)(argv+*argc+1)+size;
518 memcpy(argv[args_no], initial_wargv[i], len*sizeof(wchar_t));
519 }
520 args_no++;
521 size += len;
522 }
523 }
524
525 if(argv)
526 argv[args_no] = NULL;
527 size *= sizeof(wchar_t);
528 size += (args_no+1)*sizeof(wchar_t*);
529 *argc = args_no;
530 return size;
531}
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2983
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizeiptr size
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static DWORD path_len
Definition: batch.c:31
#define wchar_t
Definition: wchar.h:102

Referenced by __getmainargs(), and __wgetmainargs().

◆ cmdline_to_argv()

static WCHAR ** cmdline_to_argv ( const WCHAR src,
int ret_argc 
)
static

Definition at line 85 of file data.c.

86{
87 WCHAR **argv, *arg, *dst;
88 int argc, in_quotes = 0, bcount = 0, len = wcslen(src) + 1;
89
90 argc = 2 + len / 2;
91 argv = HeapAlloc( GetProcessHeap(), 0, argc * sizeof(*argv) + len * sizeof(WCHAR) );
92 arg = dst = (WCHAR *)(argv + argc);
93 argc = 0;
94 while (*src)
95 {
96 if ((*src == ' ' || *src == '\t') && !in_quotes)
97 {
98 /* skip the remaining spaces */
99 while (*src == ' ' || *src == '\t') src++;
100 if (!*src) break;
101 /* close the argument and copy it */
102 *dst++ = 0;
103 argv[argc++] = arg;
104 /* start with a new argument */
105 arg = dst;
106 bcount = 0;
107 }
108 else if (*src == '\\')
109 {
110 *dst++ = *src++;
111 bcount++;
112 }
113 else if (*src == '"')
114 {
115 if ((bcount & 1) == 0)
116 {
117 /* Preceded by an even number of '\', this is half that
118 * number of '\', plus a '"' which we discard.
119 */
120 dst -= bcount / 2;
121 src++;
122 if (in_quotes && *src == '"') *dst++ = *src++;
123#ifdef __REACTOS__
124 in_quotes = !in_quotes;
125#else
126 else in_quotes = !in_quotes;
127#endif
128 }
129 else
130 {
131 /* Preceded by an odd number of '\', this is half that
132 * number of '\' followed by a '"'
133 */
134 dst -= bcount / 2 + 1;
135 *dst++ = *src++;
136 }
137 bcount = 0;
138 }
139 else /* a regular character */
140 {
141 *dst++ = *src++;
142 bcount = 0;
143 }
144 }
145 *dst = 0;
146 argv[argc++] = arg;
147 argv[argc] = NULL;
148 *ret_argc = argc;
149 return argv;
150}
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
void * arg
Definition: msvc.h:10
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by __wgetmainargs(), and msvcrt_init_args().

◆ msvcrt_free_args()

void msvcrt_free_args ( void  )

Definition at line 462 of file data.c.

463{
464 /* FIXME: more things to free */
469}

Referenced by DllMain().

◆ msvcrt_init_args()

void msvcrt_init_args ( void  )

Definition at line 404 of file data.c.

405{
407
414
415 TRACE("got %s, wide = %s argc=%d\n", debugstr_a(MSVCRT__acmdln),
417
425 TRACE( "winver %08x winmajor %08x winminor %08x osver %08x\n",
427#ifdef _CRTDLL
431#endif
432
436#ifndef __REACTOS__
438#endif
439
441
443 if (MSVCRT__pgmptr)
444 {
446 MSVCRT__pgmptr[0] = '\0';
447 else
448 MSVCRT__pgmptr[MAX_PATH - 1] = '\0';
449 }
450
452 if (MSVCRT__wpgmptr)
453 {
455 MSVCRT__wpgmptr[0] = '\0';
456 else
457 MSVCRT__wpgmptr[MAX_PATH - 1] = '\0';
458 }
459}
#define _strdup
Definition: debug_ros.c:7
unsigned int CRTDLL__baseminor_dll
Definition: dllmain.c:38
unsigned int CRTDLL__basemajor_dll
Definition: dllmain.c:37
unsigned int CRTDLL__baseversion_dll
Definition: dllmain.c:39
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR lpFilename, DWORD nSize)
Definition: loader.c:600
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
LPWSTR WINAPI GetCommandLineW(void)
Definition: process.c:1338
LPSTR WINAPI GetCommandLineA(void)
Definition: process.c:1329
DWORD WINAPI GetVersion(void)
Definition: version.c:1458
double MSVCRT__HUGE
Definition: data.c:49
_ACRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *) __WINE_DEALLOC(free) __WINE_MALLOC
Definition: wcs.c:81
#define HUGE_VAL
Definition: math.h:274
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
ULONG dwPlatformId
Definition: rtltypes.h:241
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
ULONG dwMajorVersion
Definition: rtltypes.h:238
ULONG dwBuildNumber
Definition: rtltypes.h:240
ULONG dwMinorVersion
Definition: rtltypes.h:239
OSVERSIONINFO osvi
Definition: ver.c:28
struct _OSVERSIONINFOW OSVERSIONINFOW

Referenced by DllMain().

◆ msvcrt_wstrdupa()

wchar_t * msvcrt_wstrdupa ( const char str)

Definition at line 373 of file data.c.

374{
375 const unsigned int len = strlen(str) + 1 ;
376 wchar_t *wstr = malloc(len* sizeof (wchar_t));
377 if (!wstr)
378 return NULL;
380 return wstr;
381}
#define malloc
Definition: debug_ros.c:4
#define MultiByteToWideChar
Definition: compat.h:110
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1592
const WCHAR * str
#define MB_PRECOMPOSED
Definition: winnls.h:299

Referenced by _fdopen(), _fsopen(), _popen(), _sopen_s(), freopen(), and putenv_helper().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msvcrt  )

Variable Documentation

◆ initial_argc

int initial_argc
static

Definition at line 30 of file data.c.

Referenced by __getmainargs(), __wgetmainargs(), build_expanded_wargv(), and msvcrt_init_args().

◆ initial_wargv

WCHAR** initial_wargv
static

Definition at line 29 of file data.c.

Referenced by __getmainargs(), __wgetmainargs(), build_expanded_wargv(), and msvcrt_init_args().

◆ MSVCRT___argc

int MSVCRT___argc = 0

Definition at line 31 of file data.c.

Referenced by __getmainargs(), __p___argc(), __wgetmainargs(), and msvcrt_init_args().

◆ MSVCRT___argv

char** MSVCRT___argv = NULL

Definition at line 50 of file data.c.

Referenced by __getmainargs(), __p___argv(), msvcrt_free_args(), and msvcrt_init_args().

◆ MSVCRT___initenv

char** MSVCRT___initenv = NULL

Definition at line 57 of file data.c.

Referenced by __p___initenv(), and env_init().

◆ MSVCRT___setlc_active

unsigned int MSVCRT___setlc_active = 0

Definition at line 47 of file data.c.

Referenced by ___setlc_active_func(), and msvcrt_init_args().

◆ MSVCRT___unguarded_readlc_active

unsigned int MSVCRT___unguarded_readlc_active = 0

Definition at line 48 of file data.c.

Referenced by ___unguarded_readlc_active_add_func(), and msvcrt_init_args().

◆ MSVCRT___wargv

wchar_t** MSVCRT___wargv = NULL

Definition at line 51 of file data.c.

Referenced by __p___wargv(), __wgetmainargs(), and msvcrt_init_args().

◆ MSVCRT___winitenv

wchar_t** MSVCRT___winitenv = NULL

Definition at line 58 of file data.c.

Referenced by __p___winitenv(), env_init(), and env_set().

◆ MSVCRT__acmdln

char* MSVCRT__acmdln = NULL

Definition at line 53 of file data.c.

Referenced by __getmainargs(), __p__acmdln(), and msvcrt_init_args().

◆ MSVCRT__commode

unsigned int MSVCRT__commode = 0

Definition at line 33 of file data.c.

Referenced by __p__commode(), and msvcrt_get_flags().

◆ MSVCRT__environ

char** MSVCRT__environ = NULL

◆ MSVCRT__fmode

int MSVCRT__fmode = 0

Definition at line 34 of file data.c.

Referenced by __p__fmode(), _get_fmode(), _set_fmode(), and msvcrt_init_args().

◆ MSVCRT__HUGE

double MSVCRT__HUGE = 0

Definition at line 49 of file data.c.

Referenced by msvcrt_init_args().

◆ MSVCRT__osplatform

unsigned int MSVCRT__osplatform = 0

Definition at line 36 of file data.c.

Referenced by _get_osplatform(), and msvcrt_init_args().

◆ MSVCRT__osver

unsigned int MSVCRT__osver = 0

Definition at line 35 of file data.c.

Referenced by __p__osver(), _get_osver(), and msvcrt_init_args().

◆ MSVCRT__pgmptr

char* MSVCRT__pgmptr = NULL

Definition at line 60 of file data.c.

Referenced by __p__pgmptr(), _get_pgmptr(), msvcrt_free_args(), and msvcrt_init_args().

◆ MSVCRT__wcmdln

wchar_t* MSVCRT__wcmdln = NULL

Definition at line 54 of file data.c.

Referenced by __p__wcmdln(), __wgetmainargs(), and msvcrt_init_args().

◆ MSVCRT__wenviron

wchar_t** MSVCRT__wenviron = NULL

◆ MSVCRT__winmajor

unsigned int MSVCRT__winmajor = 0

Definition at line 37 of file data.c.

Referenced by __p__winmajor(), _get_winmajor(), and msvcrt_init_args().

◆ MSVCRT__winminor

unsigned int MSVCRT__winminor = 0

Definition at line 38 of file data.c.

Referenced by __p__winminor(), _get_winminor(), and msvcrt_init_args().

◆ MSVCRT__winver

unsigned int MSVCRT__winver = 0

Definition at line 39 of file data.c.

Referenced by __p__winver(), _get_winver(), and msvcrt_init_args().

◆ MSVCRT__wpgmptr

WCHAR* MSVCRT__wpgmptr = NULL

Definition at line 61 of file data.c.

Referenced by __p__wpgmptr(), _get_wpgmptr(), DoMessageBoxW(), msvcrt_free_args(), and msvcrt_init_args().

◆ MSVCRT_app_type

int MSVCRT_app_type = 0

Definition at line 59 of file data.c.

Referenced by __set_app_type(), _amsg_exit(), _wassert(), and abort().

◆ wargc_expand

int wargc_expand
static

Definition at line 32 of file data.c.

Referenced by __getmainargs(), and __wgetmainargs().

◆ wargv_expand

wchar_t** wargv_expand
static

Definition at line 52 of file data.c.

Referenced by __getmainargs(), __wgetmainargs(), and msvcrt_free_args().