source: trunk/src/msvcrt/mainmsvcrt40.c@ 9633

Last change on this file since 9633 was 9633, checked in by sandervl, 23 years ago

PF: Msvcrt Wine port with GCC

File size: 2.2 KB
Line 
1/*
2 * msvcrt.dll initialisation functions
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include "msvcrt.h"
21#define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF)
22#include "msvcrt/locale.h"
23#include "msvcrt/stdio.h"
24
25#include "wine/debug.h"
26
27WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
28
29/* Index to TLS */
30DWORD MSVCRT_tls_index;
31
32static inline BOOL msvcrt_init_tls(void);
33static inline BOOL msvcrt_free_tls(void);
34const char* msvcrt_get_reason(DWORD reason) WINE_UNUSED;
35
36typedef void* (*MSVCRT_malloc_func)(unsigned int);
37typedef void (*MSVCRT_free_func)(void*);
38
39int _CRT_init (void);
40void _CRT_term (void);
41void __ctordtorInit (void);
42void __ctordtorTerm (void);
43
44static HMODULE dllHandle = 0;
45
46BOOL WINAPI MSVCRT40_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
47
48
49unsigned long _DLL_InitTerm (unsigned long mod_handle,
50 unsigned long flag)
51{
52 switch (flag)
53 {
54 case 0:
55 if (_CRT_init () != 0)
56 return 0;
57 __ctordtorInit ();
58
59 dllHandle = RegisterLxDll(mod_handle, MSVCRT40_Init, 0,0,0,0);
60
61 return 1;
62 case 1:
63 __ctordtorTerm ();
64 _CRT_term ();
65
66 if(dllHandle) {
67 UnregisterLxDll(dllHandle);
68 }
69
70 return 1;
71 default:
72 return 0;
73 }
74 return 1;
75 }
76
77/*********************************************************************
78 * Init
79 */
80BOOL WINAPI MSVCRT40_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
81{
82 return MSVCRT_Init(hinstDLL, fdwReason, lpvReserved);
83}
84
85
Note: See TracBrowser for help on using the repository browser.