~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/crtdll/crtdll_main.c

Version: ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  * Old C RunTime DLL - All functionality is provided by msvcrt.
  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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 19  */
 20 
 21 #include "config.h"
 22 
 23 #include <stdarg.h>
 24 #ifdef HAVE_SYS_STAT_H
 25 # include <sys/stat.h>
 26 #endif
 27 
 28 #include "windef.h"
 29 #include "winbase.h"
 30 
 31 #include "wine/debug.h"
 32 
 33 WINE_DEFAULT_DEBUG_CHANNEL(crtdll);
 34 
 35 /* from msvcrt */
 36 extern void CDECL __getmainargs( int *argc, char ***argv, char ***envp,
 37                                  int expand_wildcards, int *new_mode );
 38 
 39 /* The following data items are not exported from msvcrt */
 40 unsigned int CRTDLL__basemajor_dll = 0;
 41 unsigned int CRTDLL__baseminor_dll = 0;
 42 unsigned int CRTDLL__baseversion_dll = 0;
 43 unsigned int CRTDLL__cpumode_dll = 0;
 44 unsigned int CRTDLL__osmajor_dll = 0;
 45 unsigned int CRTDLL__osminor_dll = 0;
 46 unsigned int CRTDLL__osmode_dll = 0;
 47 unsigned int CRTDLL__osversion_dll = 0;
 48 
 49 /* dev_t is a short in crtdll but an unsigned int in msvcrt */
 50 typedef short crtdll_dev_t;
 51 
 52 struct crtdll_stat
 53 {
 54   crtdll_dev_t   st_dev;
 55   _ino_t         st_ino;
 56   unsigned short st_mode;
 57   short          st_nlink;
 58   short          st_uid;
 59   short          st_gid;
 60   crtdll_dev_t   st_rdev;
 61   _off_t         st_size;
 62   time_t         st_atime;
 63   time_t         st_mtime;
 64   time_t         st_ctime;
 65 };
 66 
 67 /* convert struct _stat from crtdll format to msvcrt format */
 68 static void convert_struct_stat( struct crtdll_stat *dst, const struct _stat *src )
 69 {
 70     dst->st_dev   = src->st_dev;
 71     dst->st_ino   = src->st_ino;
 72     dst->st_mode  = src->st_mode;
 73     dst->st_nlink = src->st_nlink;
 74     dst->st_uid   = src->st_uid;
 75     dst->st_gid   = src->st_gid;
 76     dst->st_rdev  = src->st_rdev;
 77     dst->st_size  = src->st_size;
 78     dst->st_atime = src->st_atime;
 79     dst->st_mtime = src->st_mtime;
 80     dst->st_ctime = src->st_ctime;
 81 }
 82 
 83 
 84 /*********************************************************************
 85  *                  DllMain  (CRTDLL.init)
 86  */
 87 BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
 88 {
 89   TRACE("(%p,%d,%p)\n",hinstDLL,fdwReason,lpvReserved);
 90 
 91   if (fdwReason == DLL_PROCESS_ATTACH)
 92   {
 93     DWORD version = GetVersion();
 94 
 95     DisableThreadLibraryCalls(hinstDLL);
 96 
 97     CRTDLL__basemajor_dll   = (version >> 24) & 0xFF;
 98     CRTDLL__baseminor_dll   = (version >> 16) & 0xFF;
 99     CRTDLL__baseversion_dll = (version >> 16);
100     CRTDLL__cpumode_dll     = 1; /* FIXME */
101     CRTDLL__osmajor_dll     = (version>>8) & 0xFF;
102     CRTDLL__osminor_dll     = (version & 0xFF);
103     CRTDLL__osmode_dll      = 1; /* FIXME */
104     CRTDLL__osversion_dll   = (version & 0xFFFF);
105   }
106   return TRUE;
107 }
108 
109 
110 /*********************************************************************
111  *                  __GetMainArgs  (CRTDLL.@)
112  */
113 void CDECL __GetMainArgs( int *argc, char ***argv, char ***envp, int expand_wildcards )
114 {
115     int new_mode = 0;
116     __getmainargs( argc, argv, envp, expand_wildcards, &new_mode );
117 }
118 
119 
120 /*********************************************************************
121  *              _fstat (CRTDLL.@)
122  */
123 int CDECL CRTDLL__fstat(int fd, struct crtdll_stat* buf)
124 {
125     extern int _fstat(int,struct _stat*);
126     struct _stat st;
127     int ret;
128 
129     if (!(ret = _fstat( fd, &st ))) convert_struct_stat( buf, &st );
130     return ret;
131 }
132 
133 
134 /*********************************************************************
135  *              _stat (CRTDLL.@)
136  */
137 int CDECL CRTDLL__stat(const char* path, struct crtdll_stat * buf)
138 {
139     extern int _stat(const char*,struct _stat*);
140     struct _stat st;
141     int ret;
142 
143     if (!(ret = _stat( path, &st ))) convert_struct_stat( buf, &st );
144     return ret;
145 }
146 
147 
148 /*********************************************************************
149  *              _strdec (CRTDLL.@)
150  */
151 char * CDECL _strdec(const char *str1, const char *str2)
152 {
153     return (char *)(str2 - 1);
154 }
155 
156 
157 /*********************************************************************
158  *              _strinc (CRTDLL.@)
159  */
160 char * CDECL _strinc(const char *str)
161 {
162     return (char *)(str + 1);
163 }
164 
165 
166 /*********************************************************************
167  *              _strncnt (CRTDLL.@)
168  */
169 size_t CDECL _strncnt(const char *str, size_t maxlen)
170 {
171     size_t len = strlen(str);
172     return (len > maxlen) ? maxlen : len;
173 }
174 
175 
176 /*********************************************************************
177  *              _strnextc (CRTDLL.@)
178  */
179 unsigned int CDECL _strnextc(const char *str)
180 {
181     return (unsigned int)str[0];
182 }
183 
184 
185 /*********************************************************************
186  *              _strninc (CRTDLL.@)
187  */
188 char * CDECL _strninc(const char *str, size_t len)
189 {
190     return (char *)(str + len);
191 }
192 
193 
194 /*********************************************************************
195  *              _strspnp (CRTDLL.@)
196  */
197 char * CDECL _strspnp( const char *str1, const char *str2)
198 {
199     str1 += strspn( str1, str2 );
200     return *str1 ? (char*)str1 : NULL;
201 }
202 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.