diff --git a/dll/win32/CMakeLists.txt b/dll/win32/CMakeLists.txt index 78e8df9abc31c..64041aa55fcb1 100644 --- a/dll/win32/CMakeLists.txt +++ b/dll/win32/CMakeLists.txt @@ -72,6 +72,7 @@ add_subdirectory(itss) add_subdirectory(jscript) add_subdirectory(jsproxy) add_subdirectory(kernel32) +add_subdirectory(KernelBase) add_subdirectory(loadperf) add_subdirectory(lpk) add_subdirectory(lsasrv) diff --git a/dll/win32/KernelBase/CMakeLists.txt b/dll/win32/KernelBase/CMakeLists.txt index 51915ddafa781..69faf71a51179 100644 --- a/dll/win32/KernelBase/CMakeLists.txt +++ b/dll/win32/KernelBase/CMakeLists.txt @@ -10,4 +10,21 @@ include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502) add_definitions(-D_WIN32_WINNT=0x601 -DWINVER=0x601) -add_subdirectory(wine) \ No newline at end of file +add_subdirectory(wine) + +spec2def(KernelBase.dll KernelBase.spec ADD_IMPORTLIB) + +list(APPEND SOURCE + DllMain.c) + +add_library(KernelBase MODULE + ${SOURCE} + wine/KernelBase.rc + ${CMAKE_CURRENT_BINARY_DIR}/KernelBase_stubs.c + ${CMAKE_CURRENT_BINARY_DIR}/KernelBase.def) + +target_link_libraries(KernelBase kernelbase_static) +set_module_type(KernelBase win32dll ENTRYPOINT DllMain) +add_importlibs(KernelBase ntdll ntdll_vista) +add_dependencies(KernelBase psdk) +add_cd_file(TARGET KernelBase DESTINATION reactos/system32 FOR all) \ No newline at end of file diff --git a/dll/win32/KernelBase/DllMain.c b/dll/win32/KernelBase/DllMain.c new file mode 100644 index 0000000000000..03875feaeac32 --- /dev/null +++ b/dll/win32/KernelBase/DllMain.c @@ -0,0 +1,19 @@ + +/* PSDK/NDK Headers */ +#define WIN32_NO_STATUS +#include +#include +#include +#include +#include +#include + +BOOL +WINAPI +DllMain(HANDLE hDll, + DWORD dwReason, + LPVOID lpReserved) +{ + + return TRUE; +} diff --git a/dll/win32/KernelBase/KernelBase.spec b/dll/win32/KernelBase/KernelBase.spec new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/dll/win32/KernelBase/wine/CMakeLists.txt b/dll/win32/KernelBase/wine/CMakeLists.txt index c64fba924f606..9cdf69af987b3 100644 --- a/dll/win32/KernelBase/wine/CMakeLists.txt +++ b/dll/win32/KernelBase/wine/CMakeLists.txt @@ -1,2 +1,20 @@ +add_definitions(-D__WINESRC__ -D_KERNEL32_ -DWINVER=0x601 -D_WIN32_WINNT=0x601) +add_definitions( + -D__WINESRC__ + -D_WINE + -D__ROS_LONG64__ + -D_KERNELBASE_) -# TODO: +remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502) +add_definitions(-D_WIN32_WINNT=0x601 -DWINVER=0x601) + +include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine) + +list(APPEND SOURCE_STATIC + #console.c #looks like ReactOS console.c is nothing like wine. + loader.c + ) + +add_library(kernelbase_static ${SOURCE_STATIC}) +target_link_libraries(kernelbase_static ${PSEH_LIB}) +add_dependencies(kernelbase_static psdk) \ No newline at end of file diff --git a/dll/win32/KernelBase/wine/hacks.h b/dll/win32/KernelBase/wine/hacks.h new file mode 100644 index 0000000000000..54b7dedf9ea8d --- /dev/null +++ b/dll/win32/KernelBase/wine/hacks.h @@ -0,0 +1,13 @@ +#pragma once + +//TODO: everything here belongs somewhere, to save time put them here. + +#define RESOURCE_ENUM_LN 0x0001 +#define RESOURCE_ENUM_MUI 0x0002 +#define RESOURCE_ENUM_MUI_SYSTEM 0x0004 +#define RESOURCE_ENUM_VALIDATE 0x0008 + + +NTSYSAPI NTSTATUS WINAPI RtlQueryActivationContextApplicationSettings(DWORD,HANDLE,const WCHAR*,const WCHAR*,WCHAR*,SIZE_T,SIZE_T*); +NTSYSAPI NTSTATUS WINAPI LdrSetDefaultDllDirectories(ULONG); +NTSYSAPI NTSTATUS WINAPI LdrRemoveDllDirectory(void*); diff --git a/dll/win32/KernelBase/wine/kernelbase.h b/dll/win32/KernelBase/wine/kernelbase.h index 2209939a8a22c..bd2eb07cce279 100644 --- a/dll/win32/KernelBase/wine/kernelbase.h +++ b/dll/win32/KernelBase/wine/kernelbase.h @@ -24,6 +24,10 @@ #include "windef.h" #include "winbase.h" +#ifdef __REACTOS__ +#include "hacks.h" +#endif + struct pseudo_console { HANDLE signal; diff --git a/dll/win32/KernelBase/wine/loader.c b/dll/win32/KernelBase/wine/loader.c index 7afbe0460ebbe..b1dd5a875ec80 100644 --- a/dll/win32/KernelBase/wine/loader.c +++ b/dll/win32/KernelBase/wine/loader.c @@ -28,7 +28,6 @@ #include "winbase.h" #include "winnls.h" #include "winternl.h" -#include "ddk/ntddk.h" #include "kernelbase.h" #include "wine/list.h" #include "wine/asm.h" @@ -60,6 +59,7 @@ static CRITICAL_SECTION exclusive_datafile_list_section = { &critsect_debug, -1, * Modules ***********************************************************************/ +#ifndef __REACTOS__ // Let use the reactos implementation of this /****************************************************************** * get_proc_address @@ -492,12 +492,19 @@ FARPROC WINAPI DECLSPEC_HOTPATCH GetProcAddress( HMODULE module, LPCSTR function #endif /* __x86_64__ */ +#endif /*********************************************************************** * IsApiSetImplemented (kernelbase.@) */ BOOL WINAPI IsApiSetImplemented( LPCSTR name ) { +#ifdef __REACTOS__ + return TRUE; + /* + * ReactOS always has API sets on. + */ +#else UNICODE_STRING str; NTSTATUS status; BOOLEAN in_schema, present; @@ -506,8 +513,10 @@ BOOL WINAPI IsApiSetImplemented( LPCSTR name ) status = ApiSetQueryApiSetPresenceEx( &str, &in_schema, &present ); RtlFreeUnicodeString( &str ); return !status && present; +#endif } +#ifndef __REACTOS__ /*********************************************************************** * LoadLibraryA (kernelbase.@) @@ -566,6 +575,7 @@ HMODULE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW( LPCWSTR name, HANDLE file, DWOR return module; } +#endif /*********************************************************************** * LoadPackagedLibrary (kernelbase.@) @@ -1260,4 +1270,4 @@ void WINAPI DECLSPEC_HOTPATCH ReleaseActCtx( HANDLE context ) BOOL WINAPI DECLSPEC_HOTPATCH ZombifyActCtx( HANDLE context ) { return set_ntstatus( RtlZombifyActivationContext( context )); -} +} \ No newline at end of file diff --git a/sdk/include/psdk/libloaderapi.h b/sdk/include/psdk/libloaderapi.h index 8f112a7d60f7e..f1df3839656f4 100644 --- a/sdk/include/psdk/libloaderapi.h +++ b/sdk/include/psdk/libloaderapi.h @@ -25,9 +25,17 @@ extern "C" { typedef void *DLL_DIRECTORY_COOKIE, **PDLL_DIRECTORY_COOKIE; +#ifdef __REACTOS__ +DLL_DIRECTORY_COOKIE WINAPI AddDllDirectory(const WCHAR *); +BOOL WINAPI RemoveDllDirectory(DLL_DIRECTORY_COOKIE); +BOOL WINAPI SetDefaultDllDirectories(DWORD); +INT WINAPI FindStringOrdinal(DWORD, const WCHAR *, INT, const WCHAR *, INT, BOOL); +#else WINBASEAPI DLL_DIRECTORY_COOKIE WINAPI AddDllDirectory(const WCHAR *); WINBASEAPI BOOL WINAPI RemoveDllDirectory(DLL_DIRECTORY_COOKIE); WINBASEAPI BOOL WINAPI SetDefaultDllDirectories(DWORD); +WINBASEAPI INT WINAPI FindStringOrdinal(DWORD, const WCHAR *, INT, const WCHAR *, INT, BOOL); +#endif #ifdef __cplusplus }