| 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 | #define TLS_OUT_OF_INDEXES ((DWORD)0xFFFFFFFF)
|
|---|
| 21 |
|
|---|
| 22 | #include "wine/debug.h"
|
|---|
| 23 |
|
|---|
| 24 | WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | int _CRT_init (void);
|
|---|
| 28 | void _CRT_term (void);
|
|---|
| 29 | void __ctordtorInit (void);
|
|---|
| 30 | void __ctordtorTerm (void);
|
|---|
| 31 |
|
|---|
| 32 | static HMODULE dllHandle = 0;
|
|---|
| 33 |
|
|---|
| 34 | BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved);
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | unsigned long _DLL_InitTerm (unsigned long mod_handle,
|
|---|
| 38 | unsigned long flag)
|
|---|
| 39 | {
|
|---|
| 40 | switch (flag)
|
|---|
| 41 | {
|
|---|
| 42 | case 0:
|
|---|
| 43 | if (_CRT_init () != 0)
|
|---|
| 44 | return 0;
|
|---|
| 45 | __ctordtorInit ();
|
|---|
| 46 |
|
|---|
| 47 | dllHandle = RegisterLxDll(mod_handle, CRTDLL_Init, 0,0,0,0);
|
|---|
| 48 |
|
|---|
| 49 | return 1;
|
|---|
| 50 | case 1:
|
|---|
| 51 | __ctordtorTerm ();
|
|---|
| 52 | _CRT_term ();
|
|---|
| 53 |
|
|---|
| 54 | if(dllHandle) {
|
|---|
| 55 | UnregisterLxDll(dllHandle);
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | return 1;
|
|---|
| 59 | default:
|
|---|
| 60 | return 0;
|
|---|
| 61 | }
|
|---|
| 62 | return 1;
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | /*********************************************************************
|
|---|
| 66 | * Init
|
|---|
| 67 | */
|
|---|
| 68 | BOOL WINAPI CRTDLL_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|---|
| 69 | {
|
|---|
| 70 | return DllMain(hinstDLL,fdwReason,lpvReserved);
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|