ReactOS  0.4.14-dev-1338-g0d187f7
dllmain.c File Reference
#include "precomp.h"
#include <mbctype.h>
#include <sys/stat.h>
#include <internal/wine/msvcrt.h>
#include <wine/debug.h>
Include dependency graph for dllmain.c:

Go to the source code of this file.

Classes

struct  crtdll_stat
 

Typedefs

typedef short crtdll_dev_t
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (crtdll)
 
void __getmainargs (int *argc, char ***argv, char ***envp, int expand_wildcards, int *new_mode)
 
int BlockEnvToEnvironA (void)
 
int BlockEnvToEnvironW (void)
 
void FreeEnvironment (char **environment)
 
void _atexit_cleanup (void)
 
static void convert_struct_stat (struct crtdll_stat *dst, const struct _stat *src)
 
BOOL WINAPI DllMain (PVOID hinstDll, ULONG dwReason, PVOID reserved)
 
void __GetMainArgs (int *argc, char ***argv, char ***envp, int expand_wildcards)
 
int CRTDLL__fstat (int fd, struct crtdll_stat *buf)
 
int CRTDLL__stat (const char *path, struct crtdll_stat *buf)
 
char_strdec (const char *str1, const char *str2)
 
char_strinc (const char *str)
 
size_t _strncnt (const char *str, size_t maxlen)
 
unsigned int _strnextc (const char *str)
 
char_strninc (const char *str, size_t len)
 
char_strspnp (const char *str1, const char *str2)
 

Variables

unsigned int _osver
 
unsigned int _winminor
 
unsigned int _winmajor
 
unsigned int _winver
 
unsigned int CRTDLL__basemajor_dll = 0
 
unsigned int CRTDLL__baseminor_dll = 0
 
unsigned int CRTDLL__baseversion_dll = 0
 
unsigned int CRTDLL__cpumode_dll = 0
 
unsigned int CRTDLL__osmajor_dll = 0
 
unsigned int CRTDLL__osminor_dll = 0
 
unsigned int CRTDLL__osmode_dll = 0
 
unsigned int CRTDLL__osversion_dll = 0
 
int _fileinfo_dll
 
char_acmdln
 
wchar_t_wcmdln
 
char ** _environ
 
char ** __initenv
 
wchar_t ** _wenviron
 
wchar_t ** __winitenv
 

Typedef Documentation

◆ crtdll_dev_t

Definition at line 61 of file dllmain.c.

Function Documentation

◆ __getmainargs()

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

Definition at line 182 of file getargs.c.

183 {
184  int i, doexpand, slashesAdded, escapedQuote, inQuotes, bufferIndex, anyLetter;
185  size_t len;
186  char* buffer;
187 
188  /* missing threading init */
189 
190  i = 0;
191  doexpand = expand_wildcards;
192  escapedQuote = FALSE;
193  anyLetter = FALSE;
194  slashesAdded = 0;
195  inQuotes = 0;
196  bufferIndex = 0;
197 
198  if (__argv && _environ)
199  {
200  *argv = __argv;
201  *env = _environ;
202  *argc = __argc;
203  return;
204  }
205 
206  __argc = 0;
207 
208  len = strlen(_acmdln);
209  buffer = malloc(sizeof(char) * len);
210 
211  // Reference: https://msdn.microsoft.com/en-us/library/a1y7w461.aspx
212  while (TRUE)
213  {
214  // Arguments are delimited by white space, which is either a space or a tab.
215  if (i >= len || ((_acmdln[i] == ' ' || _acmdln[i] == '\t') && !inQuotes))
216  {
217  // Handle the case when empty spaces are in the end of the cmdline
218  if (anyLetter)
219  {
220  aexpand(strndup(buffer, bufferIndex), doexpand);
221  }
222  // Copy the last element from buffer and quit the loop
223  if (i >= len)
224  {
225  break;
226  }
227 
228  while (_acmdln[i] == ' ' || _acmdln[i] == '\t')
229  ++i;
230  anyLetter = FALSE;
231  bufferIndex = 0;
232  slashesAdded = 0;
233  escapedQuote = FALSE;
234  continue;
235  }
236 
237  anyLetter = TRUE;
238 
239  if (_acmdln[i] == '\\')
240  {
241  buffer[bufferIndex++] = _acmdln[i];
242  ++slashesAdded;
243  ++i;
244  escapedQuote = FALSE;
245  continue;
246  }
247 
248  if (_acmdln[i] == '\"')
249  {
250  if (slashesAdded > 0)
251  {
252  if (slashesAdded % 2 == 0)
253  {
254  // If an even number of backslashes is followed by a double quotation mark, then one backslash (\)
255  // is placed in the argv array for every pair of backslashes (\\), and the double quotation mark (")
256  // is interpreted as a string delimiter.
257  bufferIndex -= slashesAdded / 2;
258  }
259  else
260  {
261  // If an odd number of backslashes is followed by a double quotation mark, then one backslash (\)
262  // is placed in the argv array for every pair of backslashes (\\) and the double quotation mark is
263  // interpreted as an escape sequence by the remaining backslash, causing a literal double quotation mark (")
264  // to be placed in argv.
265  bufferIndex -= slashesAdded / 2 + 1;
266  buffer[bufferIndex++] = '\"';
267  slashesAdded = 0;
268  escapedQuote = TRUE;
269  ++i;
270  continue;
271  }
272  slashesAdded = 0;
273  }
274  else if (!inQuotes && i > 0 && _acmdln[i - 1] == '\"' && !escapedQuote)
275  {
276  buffer[bufferIndex++] = '\"';
277  ++i;
278  escapedQuote = TRUE;
279  continue;
280  }
281  slashesAdded = 0;
282  escapedQuote = FALSE;
283  inQuotes = !inQuotes;
284  doexpand = inQuotes ? FALSE : expand_wildcards;
285  ++i;
286  continue;
287  }
288 
289  buffer[bufferIndex++] = _acmdln[i];
290  slashesAdded = 0;
291  escapedQuote = FALSE;
292  ++i;
293  }
294 
295  /* Free the temporary buffer. */
296  free(buffer);
297 
298  *argc = __argc;
299  if (__argv == NULL)
300  {
301  __argv = (char**)malloc(sizeof(char*));
302  __argv[0] = 0;
303  }
304  *argv = __argv;
305  *env = _environ;
306 
307  _pgmptr = malloc(MAX_PATH * sizeof(char));
308  if (_pgmptr)
309  {
311  _pgmptr[0] = '\0';
312  else
313  _pgmptr[MAX_PATH - 1] = '\0';
314  }
315  else
316  {
317  _pgmptr = _strdup(__argv[0]);
318  }
319 
321 
322  // if (new_mode) _set_new_mode(*new_mode);
323 }
char ** _environ
Definition: environ.c:22
int __argc
Definition: getargs.c:21
static int argc
Definition: ServiceArgs.c:12
#define TRUE
Definition: types.h:120
char * _acmdln
Definition: environ.c:18
char ** __argv
Definition: getargs.c:18
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define free
Definition: debug_ros.c:5
BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem)
Definition: heapmem.c:156
GLuint buffer
Definition: glext.h:5915
#define argv
Definition: mplay32.c:18
#define _strdup
Definition: debug_ros.c:7
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
Definition: loader.c:539
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
GLuint bufferIndex
Definition: glext.h:7857
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
#define MAX_PATH
Definition: compat.h:26
int aexpand(char *name, int expand_wildcards)
Definition: getargs.c:132
GLenum GLsizei len
Definition: glext.h:6722
char * strndup(char const *name, size_t len)
Definition: getargs.c:25
char * _pgmptr
Definition: environ.c:27
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:168
#define malloc
Definition: debug_ros.c:4

Referenced by __GetMainArgs(), and pre_cpp_init().

◆ __GetMainArgs()

void __GetMainArgs ( int argc,
char ***  argv,
char ***  envp,
int  expand_wildcards 
)

Definition at line 195 of file dllmain.c.

196 {
197  int new_mode = 0;
198  __getmainargs( argc, argv, envp, expand_wildcards, &new_mode );
199 }
static int argc
Definition: ServiceArgs.c:12
#define argv
Definition: mplay32.c:18
void __getmainargs(int *argc, char ***argv, char ***envp, int expand_wildcards, int *new_mode)
Definition: getargs.c:182

◆ _atexit_cleanup()

void _atexit_cleanup ( void  )

◆ _strdec()

char* _strdec ( const char str1,
const char str2 
)

Definition at line 233 of file dllmain.c.

234 {
235  return (char *)(str2 - 1);
236 }

◆ _strinc()

char* _strinc ( const char str)

Definition at line 242 of file dllmain.c.

243 {
244  return (char *)(str + 1);
245 }
const WCHAR * str

◆ _strncnt()

size_t _strncnt ( const char str,
size_t  maxlen 
)

Definition at line 251 of file dllmain.c.

252 {
253  size_t len = strlen(str);
254  return (len > maxlen) ? maxlen : len;
255 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
const WCHAR * str
GLenum GLsizei len
Definition: glext.h:6722

◆ _strnextc()

unsigned int _strnextc ( const char str)

Definition at line 261 of file dllmain.c.

262 {
263  return (unsigned int)str[0];
264 }
const WCHAR * str

◆ _strninc()

char* _strninc ( const char str,
size_t  len 
)

Definition at line 270 of file dllmain.c.

271 {
272  return (char *)(str + len);
273 }
const WCHAR * str
GLenum GLsizei len
Definition: glext.h:6722

◆ _strspnp()

char* _strspnp ( const char str1,
const char str2 
)

Definition at line 279 of file dllmain.c.

280 {
281  str1 += strspn( str1, str2 );
282  return *str1 ? (char*)str1 : NULL;
283 }
_Check_return_ _CRTIMP size_t __cdecl strspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
smooth NULL
Definition: ftsmooth.c:416

◆ BlockEnvToEnvironA()

int BlockEnvToEnvironA ( void  )

Definition at line 34 of file environ.c.

35 {
36  char *ptr, *environment_strings;
37  char **envptr;
38  int count = 1;
39  size_t len;
40 
41  TRACE("BlockEnvToEnvironA()\n");
42 
43  environment_strings = GetEnvironmentStringsA();
44  if (environment_strings == NULL) {
45  return -1;
46  }
47 
48  for (ptr = environment_strings; *ptr; ptr += len)
49  {
50  len = strlen(ptr) + 1;
51  /* Skip drive letter settings. */
52  if (*ptr != '=')
53  count++;
54  }
55 
56  __initenv = _environ = malloc(count * sizeof(char*));
57  if (_environ)
58  {
59  for (ptr = environment_strings, envptr = _environ; count > 1; ptr += len)
60  {
61  len = strlen(ptr) + 1;
62  /* Skip drive letter settings. */
63  if (*ptr != '=')
64  {
65  if ((*envptr = malloc(len)) == NULL)
66  {
67  for (envptr--; envptr >= _environ; envptr--)
68  free(*envptr);
69  FreeEnvironmentStringsA(environment_strings);
70  free(_environ);
72  return -1;
73  }
74  memcpy(*envptr++, ptr, len);
75  count--;
76  }
77  }
78  /* Add terminating NULL entry. */
79  *envptr = NULL;
80  }
81 
82  FreeEnvironmentStringsA(environment_strings);
83  return _environ ? 0 : -1;
84 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define free
Definition: debug_ros.c:5
BOOL WINAPI FreeEnvironmentStringsA(IN LPSTR EnvironmentStrings)
Definition: environ.c:379
char ** _environ
Definition: environ.c:22
char ** __initenv
Definition: environ.c:24
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
LPSTR WINAPI GetEnvironmentStringsA(VOID)
Definition: environ.c:293
#define malloc
Definition: debug_ros.c:4

Referenced by DllMain().

◆ BlockEnvToEnvironW()

int BlockEnvToEnvironW ( void  )

Definition at line 86 of file environ.c.

87 {
88  wchar_t *ptr, *environment_strings;
89  wchar_t **envptr;
90  int count = 1;
91  size_t len;
92 
93  TRACE("BlockEnvToEnvironW()\n");
94 
95  environment_strings = GetEnvironmentStringsW();
96  if (environment_strings == NULL) {
97  return -1;
98  }
99 
100  for (ptr = environment_strings; *ptr; ptr += len)
101  {
102  len = wcslen(ptr) + 1;
103  /* Skip drive letter settings. */
104  if (*ptr != '=')
105  count++;
106  }
107 
108  __winitenv = _wenviron = malloc(count * sizeof(wchar_t*));
109  if (_wenviron)
110  {
111  for (ptr = environment_strings, envptr = _wenviron; count > 1; ptr += len)
112  {
113  len = wcslen(ptr) + 1;
114  /* Skip drive letter settings. */
115  if (*ptr != '=')
116  {
117  if ((*envptr = malloc(len * sizeof(wchar_t))) == NULL)
118  {
119  for (envptr--; envptr >= _wenviron; envptr--)
120  free(*envptr);
121  FreeEnvironmentStringsW(environment_strings);
122  free(_wenviron);
124  return -1;
125  }
126  memcpy(*envptr++, ptr, len * sizeof(wchar_t));
127  count--;
128  }
129  }
130  /* Add terminating NULL entry. */
131  *envptr = NULL;
132  }
133 
134  FreeEnvironmentStringsW(environment_strings);
135  return _wenviron ? 0 : -1;
136 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define free
Definition: debug_ros.c:5
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
wchar_t ** _wenviron
Definition: environ.c:23
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI FreeEnvironmentStringsW(IN LPWSTR EnvironmentStrings)
Definition: environ.c:389
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
LPWSTR WINAPI GetEnvironmentStringsW(VOID)
Definition: environ.c:344
wchar_t ** __winitenv
Definition: environ.c:25
#define malloc
Definition: debug_ros.c:4
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by DllMain().

◆ convert_struct_stat()

static void convert_struct_stat ( struct crtdll_stat dst,
const struct _stat src 
)
static

Definition at line 79 of file dllmain.c.

80 {
81  dst->st_dev = src->st_dev;
82  dst->st_ino = src->st_ino;
83  dst->st_mode = src->st_mode;
84  dst->st_nlink = src->st_nlink;
85  dst->st_uid = src->st_uid;
86  dst->st_gid = src->st_gid;
87  dst->st_rdev = src->st_rdev;
88  dst->st_size = src->st_size;
89  dst->st_atime = src->st_atime;
90  dst->st_mtime = src->st_mtime;
91  dst->st_ctime = src->st_ctime;
92 }
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340

Referenced by CRTDLL__fstat(), and CRTDLL__stat().

◆ CRTDLL__fstat()

int CRTDLL__fstat ( int  fd,
struct crtdll_stat buf 
)

Definition at line 205 of file dllmain.c.

206 {
207  extern int _fstat(int,struct _stat*);
208  struct _stat st;
209  int ret;
210 
211  if (!(ret = _fstat( fd, &st ))) convert_struct_stat( buf, &st );
212  return ret;
213 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: stat.h:40
static int fd
Definition: io.c:51
static void convert_struct_stat(struct crtdll_stat *dst, const struct _stat *src)
Definition: dllmain.c:79
int ret
_CRTIMP int __cdecl _fstat(_In_ int _FileDes, _Out_ struct _stat *_Stat)

◆ CRTDLL__stat()

int CRTDLL__stat ( const char path,
struct crtdll_stat buf 
)

Definition at line 219 of file dllmain.c.

220 {
221  extern int _stat(const char*,struct _stat*);
222  struct _stat st;
223  int ret;
224 
225  if (!(ret = _stat( path, &st ))) convert_struct_stat( buf, &st );
226  return ret;
227 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
Definition: stat.h:40
static void convert_struct_stat(struct crtdll_stat *dst, const struct _stat *src)
Definition: dllmain.c:79
int ret
_CRTIMP int __cdecl _stat(_In_z_ const char *_Name, _Out_ struct _stat *_Stat)

◆ DllMain()

BOOL WINAPI DllMain ( PVOID  hinstDll,
ULONG  dwReason,
PVOID  reserved 
)

Definition at line 98 of file dllmain.c.

99 {
100  DWORD version;
101  switch (dwReason)
102  {
103  case DLL_PROCESS_ATTACH:
104  version = GetVersion();
105 
106  /* initialize version info */
107  CRTDLL__basemajor_dll = (version >> 24) & 0xFF;
108  CRTDLL__baseminor_dll = (version >> 16) & 0xFF;
110  CRTDLL__cpumode_dll = 1; /* FIXME */
111  CRTDLL__osmajor_dll = (version >>8) & 0xFF;
112  CRTDLL__osminor_dll = (version & 0xFF);
113  CRTDLL__osmode_dll = 1; /* FIXME */
114  CRTDLL__osversion_dll = (version & 0xFFFF);
115 
116  _winmajor = (_osver >> 8) & 0xFF;
117  _winminor = _osver & 0xFF;
118  _winver = (_winmajor << 8) + _winminor;
119  _osver = (_osver >> 16) & 0xFFFF;
120 
121  /* create tls stuff */
122  if (!msvcrt_init_tls())
123  return FALSE;
124 
125  if (BlockEnvToEnvironA() < 0)
126  return FALSE;
127 
128  if (BlockEnvToEnvironW() < 0)
129  {
131  return FALSE;
132  }
133 
136 
137  /* Initialization of the WINE code */
139  //if(!msvcrt_init_locale()) {
140  //msvcrt_free_mt_locks();
141  // msvcrt_free_tls_mem();
142  //return FALSE;
143  //}
144  //msvcrt_init_math();
145  msvcrt_init_io();
146  //msvcrt_init_console();
147  //msvcrt_init_args();
148  //msvcrt_init_signals();
150  TRACE("Attach done\n");
151  break;
152  case DLL_THREAD_ATTACH:
153  break;
154 
155  case DLL_THREAD_DETACH:
157  break;
158 
159  case DLL_PROCESS_DETACH:
160  TRACE("Detach\n");
161  /* Deinit of the WINE code */
162  msvcrt_free_io();
163  if (reserved) break;
166  //msvcrt_free_console();
167  //msvcrt_free_args();
168  //msvcrt_free_signals();
170  if (!msvcrt_free_tls())
171  return FALSE;
172  //MSVCRT__free_locale(MSVCRT_locale);
173 
174  if (__winitenv && __winitenv != _wenviron)
175  FreeEnvironment((char**)__winitenv);
176  if (_wenviron)
177  FreeEnvironment((char**)_wenviron);
178 
179  if (__initenv && __initenv != _environ)
181  if (_environ)
183 
184  TRACE("Detach done\n");
185  break;
186  }
187 
188  return TRUE;
189 }
unsigned int CRTDLL__osversion_dll
Definition: dllmain.c:49
unsigned int CRTDLL__cpumode_dll
Definition: dllmain.c:45
#define TRUE
Definition: types.h:120
void msvcrt_free_io(void)
Definition: file.c:1100
wchar_t ** _wenviron
Definition: environ.c:23
#define DLL_THREAD_ATTACH
Definition: compat.h:121
unsigned int CRTDLL__basemajor_dll
Definition: dllmain.c:42
void msvcrt_free_tls_mem(void)
Definition: tls.c:51
unsigned int CRTDLL__osmode_dll
Definition: dllmain.c:48
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
void msvcrt_init_io(void)
Definition: file.c:457
#define _strdup
Definition: debug_ros.c:7
#define DLL_THREAD_DETACH
Definition: compat.h:122
DWORD WINAPI GetVersion(VOID)
Definition: version.c:22
unsigned int _winminor
Definition: environ.c:12
wchar_t ** __winitenv
Definition: environ.c:25
void msvcrt_free_popen_data(void)
Definition: popen.c:29
unsigned int CRTDLL__baseminor_dll
Definition: dllmain.c:43
BOOL msvcrt_free_tls(void)
Definition: tls.c:21
DWORD dwReason
Definition: misc.cpp:154
char ** _environ
Definition: environ.c:22
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2013
r reserved
Definition: btrfs.c:2865
static const WCHAR version[]
Definition: asmname.c:66
char * _acmdln
Definition: environ.c:18
unsigned int _osver
Definition: environ.c:11
#define DLL_PROCESS_DETACH
Definition: compat.h:119
void msvcrt_free_mt_locks(void)
Definition: lock.c:77
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int _winmajor
Definition: environ.c:13
int __cdecl _setmbcp(int)
Definition: _setmbcp.c:218
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL msvcrt_init_tls(void)
Definition: tls.c:9
unsigned int _winver
Definition: environ.c:14
LPSTR WINAPI GetCommandLineA(VOID)
Definition: proc.c:2003
#define _MB_CP_LOCALE
Definition: msvcrt.h:831
char ** __initenv
Definition: environ.c:24
wchar_t * _wcmdln
Definition: environ.c:19
void FreeEnvironment(char **environment)
Definition: environ.c:190
unsigned int CRTDLL__osmajor_dll
Definition: dllmain.c:46
int BlockEnvToEnvironW(void)
Definition: environ.c:86
unsigned int CRTDLL__baseversion_dll
Definition: dllmain.c:44
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
int BlockEnvToEnvironA(void)
Definition: environ.c:34
unsigned int CRTDLL__osminor_dll
Definition: dllmain.c:47
void msvcrt_init_mt_locks(void)
Definition: lock.c:54

◆ FreeEnvironment()

void FreeEnvironment ( char **  environment)

Internal function to deallocate environment block. Although it's parameter are defined as char**, it's able to work also with wide character environment block which are of type wchar_t**.

Parameters
environmentEnvironment to free.

Definition at line 190 of file environ.c.

191 {
192  char **envptr;
193  for (envptr = environment; *envptr != NULL; envptr++)
194  free(*envptr);
195  free(environment);
196 }
#define free
Definition: debug_ros.c:5
smooth NULL
Definition: ftsmooth.c:416

Referenced by DllMain().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( crtdll  )

Variable Documentation

◆ __initenv

char** __initenv

Definition at line 24 of file environ.c.

Referenced by DllMain().

◆ __winitenv

wchar_t** __winitenv

Definition at line 25 of file environ.c.

Referenced by DllMain().

◆ _acmdln

char* _acmdln

Definition at line 18 of file environ.c.

Referenced by DllMain().

◆ _environ

char** _environ

Definition at line 22 of file environ.c.

Referenced by DllMain().

◆ _fileinfo_dll

int _fileinfo_dll

Definition at line 50 of file dllmain.c.

◆ _osver

unsigned int _osver

Definition at line 11 of file environ.c.

Referenced by DllMain().

◆ _wcmdln

wchar_t* _wcmdln

Definition at line 19 of file environ.c.

Referenced by DllMain().

◆ _wenviron

wchar_t** _wenviron

Definition at line 23 of file environ.c.

Referenced by DllMain().

◆ _winmajor

unsigned int _winmajor

Definition at line 13 of file environ.c.

Referenced by DllMain().

◆ _winminor

unsigned int _winminor

Definition at line 12 of file environ.c.

Referenced by DllMain().

◆ _winver

unsigned int _winver

Definition at line 14 of file environ.c.

Referenced by DllMain().

◆ CRTDLL__basemajor_dll

unsigned int CRTDLL__basemajor_dll = 0

Definition at line 42 of file dllmain.c.

Referenced by DllMain().

◆ CRTDLL__baseminor_dll

unsigned int CRTDLL__baseminor_dll = 0

Definition at line 43 of file dllmain.c.

Referenced by DllMain().

◆ CRTDLL__baseversion_dll

unsigned int CRTDLL__baseversion_dll = 0

Definition at line 44 of file dllmain.c.

Referenced by DllMain().

◆ CRTDLL__cpumode_dll

unsigned int CRTDLL__cpumode_dll = 0

Definition at line 45 of file dllmain.c.

Referenced by DllMain().

◆ CRTDLL__osmajor_dll

unsigned int CRTDLL__osmajor_dll = 0

Definition at line 46 of file dllmain.c.

Referenced by DllMain().

◆ CRTDLL__osminor_dll

unsigned int CRTDLL__osminor_dll = 0

Definition at line 47 of file dllmain.c.

Referenced by DllMain().

◆ CRTDLL__osmode_dll

unsigned int CRTDLL__osmode_dll = 0

Definition at line 48 of file dllmain.c.

Referenced by DllMain().

◆ CRTDLL__osversion_dll

unsigned int CRTDLL__osversion_dll = 0

Definition at line 49 of file dllmain.c.

Referenced by DllMain().