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

Wine Cross Reference
wine/dlls/msvcr90/msvcr90.c

Version: ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * msvcr90 specific functions
  3  *
  4  * Copyright 2010 Detlef Riekenberg
  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 #include <stdarg.h>
 23 
 24 #include "stdlib.h"
 25 #include "stdio.h"
 26 #include "errno.h"
 27 #include "malloc.h"
 28 #include "windef.h"
 29 #include "winbase.h"
 30 #include "wine/debug.h"
 31 #include "sys/stat.h"
 32 
 33 WINE_DEFAULT_DEBUG_CHANNEL(msvcr90);
 34 
 35 #ifdef __i386__  /* thiscall functions are i386-specific */
 36 
 37 #define THISCALL(func) __thiscall_ ## func
 38 #define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
 39 #define __thiscall __stdcall
 40 #define DEFINE_THISCALL_WRAPPER(func,args) \
 41     extern void THISCALL(func)(void); \
 42     __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
 43                       "popl %eax\n\t" \
 44                       "pushl %ecx\n\t" \
 45                       "pushl %eax\n\t" \
 46                       "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
 47 
 48 #else /* __i386__ */
 49 
 50 #define THISCALL(func) func
 51 #define THISCALL_NAME(func) __ASM_NAME(#func)
 52 #define __thiscall __cdecl
 53 #define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
 54 
 55 #endif /* __i386__ */
 56 
 57 struct __type_info_node
 58 {
 59     void *memPtr;
 60     struct __type_info_node* next;
 61 };
 62 
 63 typedef struct __type_info
 64 {
 65   const void *vtable;
 66   char       *name;        /* Unmangled name, allocated lazily */
 67   char        mangled[32]; /* Variable length, but we declare it large enough for static RTTI */
 68 } type_info;
 69 
 70 typedef void* (__cdecl *malloc_func_t)(size_t);
 71 typedef void  (__cdecl *free_func_t)(void*);
 72 
 73 extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
 74 
 75 /*********************************************************************
 76  *  msvcr90_stat64_to_stat32 [internal]
 77  */
 78 static void msvcr90_stat64_to_stat32(const struct _stat64 *buf64, struct _stat32 *buf)
 79 {
 80     buf->st_dev   = buf64->st_dev;
 81     buf->st_ino   = buf64->st_ino;
 82     buf->st_mode  = buf64->st_mode;
 83     buf->st_nlink = buf64->st_nlink;
 84     buf->st_uid   = buf64->st_uid;
 85     buf->st_gid   = buf64->st_gid;
 86     buf->st_rdev  = buf64->st_rdev;
 87     buf->st_size  = buf64->st_size;
 88     buf->st_atime = buf64->st_atime;
 89     buf->st_mtime = buf64->st_mtime;
 90     buf->st_ctime = buf64->st_ctime;
 91 }
 92 
 93 /*********************************************************************
 94  *  DllMain (MSVCR90.@)
 95  */
 96 BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
 97 {
 98     switch (reason)
 99     {
100     case DLL_WINE_PREATTACH:
101         return FALSE;  /* prefer native version */
102 
103     case DLL_PROCESS_ATTACH:
104         DisableThreadLibraryCalls(hdll);
105         _set_printf_count_output(0);
106     }
107     return TRUE;
108 }
109 
110 /*********************************************************************
111  *  _decode_pointer (MSVCR90.@)
112  *
113  * cdecl version of DecodePointer
114  *
115  */
116 void * CDECL MSVCR90_decode_pointer(void * ptr)
117 {
118     return DecodePointer(ptr);
119 }
120 
121 /*********************************************************************
122  *  _encode_pointer (MSVCR90.@)
123  *
124  * cdecl version of EncodePointer
125  *
126  */
127 void * CDECL MSVCR90_encode_pointer(void * ptr)
128 {
129     return EncodePointer(ptr);
130 }
131 
132 /*********************************************************************
133  *  _encoded_null (MSVCR90.@)
134  */
135 void * CDECL _encoded_null(void)
136 {
137     TRACE("\n");
138 
139     return MSVCR90_encode_pointer(NULL);
140 }
141 
142 /*********************************************************************
143  * _invalid_parameter_noinfo (MSVCR90.@)
144  */
145 void CDECL _invalid_parameter_noinfo(void)
146 {
147     _invalid_parameter( NULL, NULL, NULL, 0, 0 );
148 }
149 
150 /*********************************************************************
151  * __sys_nerr (MSVCR90.@)
152  */
153 int* CDECL __sys_nerr(void)
154 {
155         return (int*)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_sys_nerr");
156 }
157 
158 /*********************************************************************
159  *  __sys_errlist (MSVCR90.@)
160  */
161 char** CDECL __sys_errlist(void)
162 {
163     return (char**)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_sys_errlist");
164 }
165 
166 /*********************************************************************
167  * __clean_type_info_names_internal (MSVCR90.@)
168  */
169 void CDECL __clean_type_info_names_internal(void *p)
170 {
171     FIXME("(%p) stub\n", p);
172 }
173 
174 /*********************************************************************
175  * _recalloc (MSVCR90.@)
176  */
177 void* CDECL _recalloc(void* mem, size_t num, size_t size)
178 {
179     size_t old_size;
180     void *ret;
181 
182     if(!mem)
183         return calloc(num, size);
184 
185     size = num*size;
186     old_size = _msize(mem);
187 
188     ret = realloc(mem, size);
189     if(!ret) {
190         *_errno() = ENOMEM;
191         return NULL;
192     }
193 
194     if(size>old_size)
195         memset((BYTE*)mem+old_size, 0, size-old_size);
196     return ret;
197 }
198 
199 /*********************************************************************
200  *  _fstat32 (MSVCR90.@)
201  */
202 int CDECL _fstat32(int fd, struct _stat32* buf)
203 {
204   int ret;
205   struct _stat64 buf64;
206 
207   ret = _fstat64(fd, &buf64);
208   if (!ret)
209       msvcr90_stat64_to_stat32(&buf64, buf);
210   return ret;
211 }
212 
213 /*********************************************************************
214  *  _stat32 (MSVCR90.@)
215  */
216 int CDECL _stat32(const char *path, struct _stat32* buf)
217 {
218   int ret;
219   struct _stat64 buf64;
220 
221   ret = _stat64(path, &buf64);
222   if (!ret)
223       msvcr90_stat64_to_stat32(&buf64, buf);
224   return ret;
225 }
226 
227 /*********************************************************************
228  *  _wstat32 (MSVCR90.@)
229  */
230 int CDECL _wstat32(const wchar_t *path, struct _stat32* buf)
231 {
232   int ret;
233   struct _stat64 buf64;
234 
235   ret = _wstat64(path, &buf64);
236   if (!ret)
237       msvcr90_stat64_to_stat32(&buf64, buf);
238   return ret;
239 }
240 
241 /*********************************************************************
242  *              _fstat64i32 (MSVCRT.@)
243  */
244 
245 static void msvcrt_stat64_to_stat64i32(const struct _stat64 *buf64, struct _stat64i32 *buf)
246 {
247     buf->st_dev   = buf64->st_dev;
248     buf->st_ino   = buf64->st_ino;
249     buf->st_mode  = buf64->st_mode;
250     buf->st_nlink = buf64->st_nlink;
251     buf->st_uid   = buf64->st_uid;
252     buf->st_gid   = buf64->st_gid;
253     buf->st_rdev  = buf64->st_rdev;
254     buf->st_size  = buf64->st_size;
255     buf->st_atime = buf64->st_atime;
256     buf->st_mtime = buf64->st_mtime;
257     buf->st_ctime = buf64->st_ctime;
258 }
259 
260 int CDECL _fstat64i32(int fd, struct _stat64i32* buf)
261 {
262   int ret;
263   struct _stat64 buf64;
264 
265   ret = _fstat64(fd, &buf64);
266   if (!ret)
267       msvcrt_stat64_to_stat64i32(&buf64, buf);
268   return ret;
269 }
270 
271 /*********************************************************************
272  *              _stat64i32 (MSVCRT.@)
273  */
274 int CDECL _stat64i32(const char* path, struct _stat64i32 * buf)
275 {
276   int ret;
277   struct _stat64 buf64;
278 
279   ret = _stat64(path, &buf64);
280   if (!ret)
281     msvcrt_stat64_to_stat64i32(&buf64, buf);
282   return ret;
283 }
284 
285 /*********************************************************************
286  *              _wstat64i32 (MSVCRT.@)
287  */
288 int CDECL _wstat64i32(const wchar_t *path, struct _stat64i32 *buf)
289 {
290     int ret;
291     struct _stat64 buf64;
292 
293     ret = _wstat64(path, &buf64);
294     if (!ret)
295         msvcrt_stat64_to_stat64i32(&buf64, buf);
296     return ret;
297 }
298 
299 /*********************************************************************
300  *              _atoflt  (MSVCR90.@)
301  */
302 int CDECL _atoflt( _CRT_FLOAT *value, char *str )
303 {
304     return _atoflt_l( value, str, NULL );
305 }
306 
307 /*********************************************************************
308  * ?_name_internal_method@type_info@@QBEPBDPAU__type_info_node@@@Z (MSVCR90.@)
309  */
310 DEFINE_THISCALL_WRAPPER(MSVCRT_type_info_name_internal_method,8)
311 const char * __thiscall MSVCRT_type_info_name_internal_method(type_info * _this, struct __type_info_node *node)
312 {
313     static int once;
314 
315     if (node && !once++) FIXME("type_info_node parameter ignored\n");
316 
317     if (!_this->name)
318     {
319       /* Create and set the demangled name */
320       /* Note: mangled name in type_info struct always starts with a '.', while
321        * it isn't valid for mangled name.
322        * Is this '.' really part of the mangled name, or has it some other meaning ?
323        */
324       char* name = __unDName(0, _this->mangled + 1, 0, malloc, free, 0x2800);
325       if (name)
326       {
327         unsigned int len = strlen(name);
328 
329         /* It seems _unDName may leave blanks at the end of the demangled name */
330         while (len && name[--len] == ' ')
331           name[len] = '\0';
332 
333         if (InterlockedCompareExchangePointer((void**)&_this->name, name, NULL))
334         {
335           /* Another thread set this member since we checked above - use it */
336           free(name);
337         }
338       }
339     }
340     TRACE("(%p) returning %s\n", _this, _this->name);
341     return _this->name;
342 }
343 
344 /*********************************************************************
345  *              _CRT_RTC_INIT (MSVCR90.@)
346  */
347 void* CDECL _CRT_RTC_INIT(void *unk1, void *unk2, int unk3, int unk4, int unk5)
348 {
349     TRACE("%p %p %x %x %x\n", unk1, unk2, unk3, unk4, unk5);
350     return NULL;
351 }
352 
353 /*********************************************************************
354  *              _CRT_RTC_INITW (MSVCR90.@)
355  */
356 void* CDECL _CRT_RTC_INITW(void *unk1, void *unk2, int unk3, int unk4, int unk5)
357 {
358     TRACE("%p %p %x %x %x\n", unk1, unk2, unk3, unk4, unk5);
359     return NULL;
360 }
361 

~ [ 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.