2 * msvcr90 specific functions
4 * Copyright 2010 Detlef Riekenberg
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
28 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(msvcr90);
33 typedef int (CDECL *_INITTERM_E_FN)(void);
35 /*********************************************************************
38 BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
42 case DLL_WINE_PREATTACH:
43 return FALSE; /* prefer native version */
45 case DLL_PROCESS_ATTACH:
46 DisableThreadLibraryCalls(hdll);
51 /*********************************************************************
52 * _decode_pointer (MSVCR90.@)
54 * cdecl version of DecodePointer
57 void * CDECL MSVCR90_decode_pointer(void * ptr)
59 return DecodePointer(ptr);
62 /*********************************************************************
63 * _encode_pointer (MSVCR90.@)
65 * cdecl version of EncodePointer
68 void * CDECL MSVCR90_encode_pointer(void * ptr)
70 return EncodePointer(ptr);
73 /*********************************************************************
74 * _encoded_null (MSVCR90.@)
76 void * CDECL _encoded_null(void)
80 return MSVCR90_encode_pointer(NULL);
83 /*********************************************************************
84 * _initterm_e (MSVCR90.@)
86 * call an array of application initialization functions and report the return value
88 int CDECL _initterm_e(_INITTERM_E_FN *table, _INITTERM_E_FN *end)
92 TRACE("(%p, %p)\n", table, end);
94 while (!res && table < end) {
96 TRACE("calling %p\n", **table);
99 TRACE("function %p failed: 0x%x\n", *table, res);
107 /*********************************************************************
108 * _invalid_parameter_noinfo (MSVCR90.@)
110 void CDECL _invalid_parameter_noinfo(void)
112 _invalid_parameter( NULL, NULL, NULL, 0, 0 );
115 /*********************************************************************
116 * __sys_nerr (MSVCR90.@)
118 int* CDECL __sys_nerr(void)
120 return (int*)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_sys_nerr");
123 /*********************************************************************
124 * __sys_errlist (MSVCR90.@)
126 char** CDECL __sys_errlist(void)
128 return (char**)GetProcAddress(GetModuleHandleA("msvcrt.dll"), "_sys_errlist");
131 /*********************************************************************
132 * __clean_type_info_names_internal (MSVCR90.@)
134 void CDECL __clean_type_info_names_internal(void *p)
136 FIXME("(%p) stub\n", p);
139 /*********************************************************************
140 * _recalloc (MSVCR90.@)
142 void* CDECL _recalloc(void* mem, size_t num, size_t size)
148 return calloc(num, size);
151 old_size = _msize(mem);
153 ret = realloc(mem, size);
160 memset((BYTE*)mem+old_size, 0, size-old_size);
164 /*********************************************************************
165 * _fstat64i32 (MSVCRT.@)
168 static void msvcrt_stat64_to_stat64i32(const struct _stat64 *buf64, struct _stat64i32 *buf)
170 buf->st_dev = buf64->st_dev;
171 buf->st_ino = buf64->st_ino;
172 buf->st_mode = buf64->st_mode;
173 buf->st_nlink = buf64->st_nlink;
174 buf->st_uid = buf64->st_uid;
175 buf->st_gid = buf64->st_gid;
176 buf->st_rdev = buf64->st_rdev;
177 buf->st_size = buf64->st_size;
178 buf->st_atime = buf64->st_atime;
179 buf->st_mtime = buf64->st_mtime;
180 buf->st_ctime = buf64->st_ctime;
183 int CDECL _fstat64i32(int fd, struct _stat64i32* buf)
186 struct _stat64 buf64;
188 ret = _fstat64(fd, &buf64);
190 msvcrt_stat64_to_stat64i32(&buf64, buf);
194 /*********************************************************************
195 * _stat64i32 (MSVCRT.@)
197 int CDECL _stat64i32(const char* path, struct _stat64i32 * buf)
200 struct _stat64 buf64;
202 ret = _stat64(path, &buf64);
204 msvcrt_stat64_to_stat64i32(&buf64, buf);
208 /*********************************************************************
209 * _wstat64i32 (MSVCRT.@)
211 int CDECL _wstat64i32(const wchar_t *path, struct _stat64i32 *buf)
214 struct _stat64 buf64;
216 ret = _wstat64(path, &buf64);
218 msvcrt_stat64_to_stat64i32(&buf64, buf);