wined3d: Remove a redundant condition in the indexbuffer() state handler.
[wine] / dlls / msvcp71 / msvcp71.c
1 /*
2  * Copyright 2010 Piotr Caban for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22
23 #include "msvcp.h"
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wine/debug.h"
28
29 #ifdef __i386__
30
31 #define DEFINE_VTBL_WRAPPER(off)            \
32     __ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \
33         "popl %eax\n\t"                     \
34         "popl %ecx\n\t"                     \
35         "pushl %eax\n\t"                    \
36         "movl 0(%ecx), %eax\n\t"            \
37         "jmp *" #off "(%eax)\n\t")
38
39 DEFINE_VTBL_WRAPPER(0);
40 DEFINE_VTBL_WRAPPER(4);
41 DEFINE_VTBL_WRAPPER(8);
42 DEFINE_VTBL_WRAPPER(12);
43 DEFINE_VTBL_WRAPPER(16);
44 DEFINE_VTBL_WRAPPER(20);
45 DEFINE_VTBL_WRAPPER(24);
46 DEFINE_VTBL_WRAPPER(28);
47 DEFINE_VTBL_WRAPPER(32);
48 DEFINE_VTBL_WRAPPER(36);
49 DEFINE_VTBL_WRAPPER(40);
50 DEFINE_VTBL_WRAPPER(44);
51 DEFINE_VTBL_WRAPPER(48);
52
53 #endif
54
55 void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
56 void (__cdecl *MSVCRT_operator_delete)(void*);
57 void* (__cdecl *MSVCRT_set_new_handler)(void*);
58
59 static void init_cxx_funcs(void)
60 {
61     HMODULE hmod = GetModuleHandleA("msvcrt.dll");
62
63     if (sizeof(void *) > sizeof(int))  /* 64-bit has different names */
64     {
65         MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z");
66         MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z");
67         MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z");
68     }
69     else
70     {
71         MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z");
72         MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z");
73         MSVCRT_set_new_handler = (void*)GetProcAddress(hmod, "?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z");
74     }
75 }
76
77 BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved)
78 {
79     switch (reason)
80     {
81         case DLL_WINE_PREATTACH:
82             return FALSE;  /* prefer native version */
83         case DLL_PROCESS_ATTACH:
84             init_cxx_funcs();
85             init_lockit();
86             init_exception(hdll);
87             init_locale(hdll);
88             init_io(hdll);
89             break;
90         case DLL_PROCESS_DETACH:
91             free_io();
92             free_locale();
93             free_lockit();
94             break;
95     }
96     return TRUE;
97 }
98
99 /* ?_BADOFF@std@@3JB -> long const std::_BADOFF */
100 /* ?_BADOFF@std@@3_JB -> __int64 const std::_BADOFF */
101 const streamoff std_BADOFF = -1;
102
103 /* ?_Fpz@std@@3_JA  __int64 std::_Fpz */
104 __int64 std_Fpz = 0;