mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[MSVCRT20]
- being a full blown crt dll, msvcrt20 needs a correct dllmain entry point svn path=/trunk/; revision=52834
This commit is contained in:
parent
33b1f742e6
commit
7b87ca19ec
3 changed files with 160 additions and 14 deletions
|
@ -1,8 +1,15 @@
|
|||
|
||||
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
||||
add_definitions(
|
||||
-DUSE_MSVCRT_PREFIX
|
||||
-D_MSVCRT_
|
||||
-D_MSVCRT_LIB_
|
||||
-D_MT
|
||||
-D_CTYPE_DISABLE_MACROS
|
||||
-D_NO_INLINING
|
||||
-DCRTDLL
|
||||
-D__MINGW_IMPORT="")
|
||||
|
||||
add_definitions(-D__WINESRC__)
|
||||
add_definitions(-DCRTDLL)
|
||||
include_directories(${REACTOS_SOURCE_DIR}/lib/sdk/crt/include)
|
||||
|
||||
spec2def(msvcrt20.dll msvcrt20.spec)
|
||||
|
||||
|
@ -13,7 +20,8 @@ list(APPEND SOURCE
|
|||
${CMAKE_CURRENT_BINARY_DIR}/msvcrt20.def)
|
||||
|
||||
add_library(msvcrt20 SHARED ${SOURCE})
|
||||
set_entrypoint(msvcrt20 0)
|
||||
set_entrypoint(msvcrt20 DllMain@12)
|
||||
set_image_base(msvcrt20 ${baseaddress_msvcrt20})
|
||||
|
||||
target_link_libraries(msvcrt20 crt wine)
|
||||
|
||||
|
|
|
@ -18,15 +18,143 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#define _CRT_PRECOMP_H
|
||||
#include <internal/tls.h>
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
#include <internal/wine/msvcrt.h>
|
||||
#include <locale.h>
|
||||
#include <mbctype.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "wine/debug.h"
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
||||
|
||||
/* EXTERNAL PROTOTYPES ********************************************************/
|
||||
|
||||
extern int BlockEnvToEnvironA(void);
|
||||
extern int BlockEnvToEnvironW(void);
|
||||
extern void FreeEnvironment(char **environment);
|
||||
extern void _atexit_cleanup(void);
|
||||
|
||||
extern unsigned int _osplatform;
|
||||
extern unsigned int _osver;
|
||||
extern unsigned int _winminor;
|
||||
extern unsigned int _winmajor;
|
||||
extern unsigned int _winver;
|
||||
|
||||
extern char* _acmdln; /* pointer to ascii command line */
|
||||
extern wchar_t* _wcmdln; /* pointer to wide character command line */
|
||||
#undef _environ
|
||||
extern char** _environ; /* pointer to environment block */
|
||||
extern char** __initenv; /* pointer to initial environment block */
|
||||
extern wchar_t** _wenviron; /* pointer to environment block */
|
||||
extern wchar_t** __winitenv; /* pointer to initial environment block */
|
||||
|
||||
extern void CDECL __getmainargs(int *argc, char** *argv, char** *envp,
|
||||
int expand_wildcards, int *new_mode);
|
||||
extern void CDECL __wgetmainargs(int *argc, WCHAR** *wargv, WCHAR** *wenvp,
|
||||
int expand_wildcards, int *new_mode);
|
||||
|
||||
/* LIBRARY GLOBAL VARIABLES ***************************************************/
|
||||
|
||||
HANDLE hHeap = NULL; /* handle for heap */
|
||||
|
||||
|
||||
/* LIBRARY ENTRY POINT ********************************************************/
|
||||
|
||||
BOOL
|
||||
WINAPI
|
||||
DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
||||
{
|
||||
OSVERSIONINFOW osvi;
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH://1
|
||||
/* initialize version info */
|
||||
//DPRINT1("Process Attach %d\n", nAttachCount);
|
||||
//DPRINT1("Process Attach\n");
|
||||
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
|
||||
GetVersionExW( &osvi );
|
||||
_winver = (osvi.dwMajorVersion << 8) | osvi.dwMinorVersion;
|
||||
_winmajor = osvi.dwMajorVersion;
|
||||
_winminor = osvi.dwMinorVersion;
|
||||
_osplatform = osvi.dwPlatformId;
|
||||
_osver = osvi.dwBuildNumber;
|
||||
hHeap = HeapCreate(0, 100000, 0);
|
||||
if (hHeap == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* create tls stuff */
|
||||
if (!CreateThreadData())
|
||||
return FALSE;
|
||||
|
||||
if (BlockEnvToEnvironA() < 0)
|
||||
return FALSE;
|
||||
|
||||
if (BlockEnvToEnvironW() < 0)
|
||||
{
|
||||
FreeEnvironment(_environ);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
_acmdln = _strdup(GetCommandLineA());
|
||||
_wcmdln = _wcsdup(GetCommandLineW());
|
||||
|
||||
/* FIXME: more initializations... */
|
||||
|
||||
/* Initialization of the WINE code */
|
||||
msvcrt_init_mt_locks();
|
||||
msvcrt_init_io();
|
||||
setlocale(0, "C");
|
||||
//_setmbcp(_MB_CP_LOCALE);
|
||||
|
||||
TRACE("Attach done\n");
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
FreeThreadData(NULL);
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
//DPRINT1("Detach %d\n", nAttachCount);
|
||||
//DPRINT("Detach\n");
|
||||
/* FIXME: more cleanup... */
|
||||
/* Deinit of the WINE code */
|
||||
msvcrt_free_io();
|
||||
msvcrt_free_mt_locks();
|
||||
|
||||
_atexit_cleanup();
|
||||
|
||||
|
||||
/* destroy tls stuff */
|
||||
DestroyThreadData();
|
||||
|
||||
if (__winitenv && __winitenv != _wenviron)
|
||||
FreeEnvironment((char**)__winitenv);
|
||||
if (_wenviron)
|
||||
FreeEnvironment((char**)_wenviron);
|
||||
|
||||
if (__initenv && __initenv != _environ)
|
||||
FreeEnvironment(__initenv);
|
||||
if (_environ)
|
||||
FreeEnvironment(_environ);
|
||||
|
||||
/* destroy heap */
|
||||
HeapDestroy(hHeap);
|
||||
|
||||
TRACE("Detach done\n");
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* LIBRARY EXPORTS ************************************************************/
|
||||
|
||||
/*********************************************************************
|
||||
* __getmainargs (MSVCRT20.@)
|
||||
*
|
||||
|
@ -48,3 +176,5 @@ void CDECL MSVCRT20__wgetmainargs( int *argc, WCHAR** *wargv, WCHAR** *wenvp,
|
|||
{
|
||||
__wgetmainargs( argc, wargv, wenvp, expand_wildcards, &new_mode );
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -1,16 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<group>
|
||||
<module name="msvcrt20" type="win32dll" baseaddress="${BASEADDRESS_MSVCRT20}" installbase="system32" installname="msvcrt20.dll" allowwarnings="true" entrypoint="0" iscrt="yes">
|
||||
<importlibrary definition="msvcrt20.spec" />
|
||||
<include base="msvcrt20">.</include>
|
||||
<include base="ReactOS">include/reactos/wine</include>
|
||||
<define name="__WINESRC__" />
|
||||
<module name="msvcrt20" type="win32dll"
|
||||
baseaddress="${BASEADDRESS_MSVCRT20}" installbase="system32"
|
||||
installname="msvcrt20.dll"
|
||||
entrypoint="DllMain@12" iscrt="yes">
|
||||
<importlibrary definition="msvcrt20.spec" />
|
||||
<include base="msvcrt20">.</include>
|
||||
<include base="crt">include</include>
|
||||
<define name="USE_MSVCRT_PREFIX" />
|
||||
<define name="_MSVCRT_" />
|
||||
<define name="_MSVCRT_LIB_" />
|
||||
<define name="_MT" />
|
||||
<define name="_CTYPE_DISABLE_MACROS" />
|
||||
<define name="_NO_INLINING" />
|
||||
<define name="CRTDLL" />
|
||||
<file>msvcrt20.c</file>
|
||||
<file>msvcrt20.c</file>
|
||||
<file>stubs.c</file>
|
||||
<library>wine</library>
|
||||
<library>wine</library>
|
||||
<library>crt</library>
|
||||
<library>pseh</library>
|
||||
</module>
|
||||
</module>
|
||||
</group>
|
||||
|
|
Loading…
Reference in a new issue