Compare commits

...

26 Commits

Author SHA1 Message Date
Timo Kreuzer
1b3b7127de [KERNEL32_WINETEST] Hack loader test to deal with versioned exports 2024-09-19 19:02:37 +03:00
Timo Kreuzer
c0fa5e4d91 +rosautotest/CWineTest.cpp 2024-09-19 19:02:37 +03:00
Timo Kreuzer
5b7fa9a8a7 NtReadFile.c hacks 2024-09-19 19:02:36 +03:00
Timo Kreuzer
900147e199 [ROSAUTOTEST] Some timeout hacks 2024-09-19 19:02:36 +03:00
Timo Kreuzer
cf2e4d3580 +fix roscompat_desc 2024-09-19 19:02:36 +03:00
Timo Kreuzer
6180f8163c +dprints 2024-09-19 19:02:35 +03:00
Timo Kreuzer
7fee24aef2 WIP statically link __CxxFrameHandler3 2024-09-19 19:02:35 +03:00
Timo Kreuzer
5b68bec533 +roscompat_desc (use dummy for everything not linking to *_vista) 2024-09-19 19:02:35 +03:00
Timo Kreuzer
e8d6763ca5 [ROSCOMPAT_APITEST] Add a test 2024-09-19 19:02:34 +03:00
Timo Kreuzer
a1bef9e646 Revert "DEBUG add a breakpoint on static import failure"
This reverts commit aa647667d9427dac9cb2a2068b1912fb42c85637.
2024-09-19 19:02:28 +03:00
Timo Kreuzer
2b03e48686 [FUSION] Remove the stubs file from the shared library 2024-09-19 19:02:27 +03:00
Timo Kreuzer
9239e7f16e [ROSCOMPAT_DESC] Add library with dummy roscompat descriptor
This is automatically linked to all our targets. To pull it in, all targets additionally get an object file that references the descriptor. If a stubs file is already present, that will resolve the reference and the dummy descriptor will not be pulled in.
2024-09-19 19:02:27 +03:00
Timo Kreuzer
9c010aeaea [SPEC2DEF][NTDLL] Add support for empty DLL checks 2024-09-19 19:02:26 +03:00
Timo Kreuzer
e6c488ca45 [DLLS] Include roscompat descriptor in some DLLs 2024-09-19 19:02:26 +03:00
Timo Kreuzer
c40f787f03 DEBUG add a breakpoint on static import failure 2024-09-19 19:02:26 +03:00
Timo Kreuzer
fbd4954973 [NTDLL] Add mechanism to resolve imports based on version information
The loader checks for a ros-compat-descriptor, and if one is found, parses it's entries. Each entry corresponds to an export and provides a bitmask that specifies on what Windows version the export exists. If the bit for the process' appcompat version (default is still Windows 2003) is set, the export will be allowed, otherwise the export will not be allowed. If a module has a ros-compat-descritor, it is still allowed to import the "disallowed" exports.
2024-09-19 19:02:25 +03:00
Timo Kreuzer
688606640a [SPEC2DEF] Implement generating export version information
Now spec2def uses the version annotations in spec files to generate a table, which will be used to dynamically enable/disable exports based on the current process' appcompat settings, when a dll is initialized, allowing to export the appropriate functions for each version.

This feature is still disabled in config.cmake with the variable ENABLE_EXPORT_VERSIONING.
2024-09-19 19:02:25 +03:00
Timo Kreuzer
260a4fb369 [ADVAPI32_VISTA] Implicitly link to advapi32 2024-09-19 19:02:24 +03:00
Timo Kreuzer
ff1368ddb7 [ADVAPI32_VISTA] Add some missing Vista+ exports 2024-09-19 19:02:24 +03:00
Timo Kreuzer
635ff4d37c [KERNEL32_VISTA] Implicitly link to kernel32 2024-09-19 19:02:24 +03:00
Timo Kreuzer
549789cc74 [NTDLL_VISTA] Implicitly link to ntdll 2024-09-19 19:02:23 +03:00
Timo Kreuzer
d5a5efc92c [ADVAPI32][ETWTRACE] Add etwtrace library and link advapi32 to it on NT6+ 2024-09-19 19:02:23 +03:00
Timo Kreuzer
0ac9a7d750 [SOFTPUB] Replace some (broken!) stubs with forwarders 2024-09-19 19:02:22 +03:00
Timo Kreuzer
eea511bddf [WINSPOOL.DRV] Improve some stubs 2024-09-19 19:02:22 +03:00
Timo Kreuzer
139e621fde [MSVCRT] Properly export sprintf_s and _vcwprintf 2024-09-19 19:02:22 +03:00
Timo Kreuzer
9312543349 [SPEC2DEF] Use explicit ordinals on MSVC, too
This prevents MSVC from reordering the exports in a way that doesn't match our spec file. Also improve the algorithm to apply ordinals, by starting with the first specified ordinal, possibly reserving ordinals for anything declared without an ordinal before.
2024-09-19 19:02:07 +03:00
80 changed files with 1151 additions and 208 deletions

View File

@@ -6,5 +6,5 @@ add_definitions(-D__WINESRC__)
add_executable(reg add.c copy.c delete.c export.c import.c query.c reg.c reg.rc)
set_module_type(reg win32cui UNICODE)
target_link_libraries(reg wine)
add_importlibs(reg advapi32 advapi32_vista user32 msvcrt kernel32 ntdll)
add_importlibs(reg advapi32_vista user32 msvcrt kernel32 ntdll)
add_cd_file(TARGET reg DESTINATION reactos/system32 FOR all)

View File

@@ -57,7 +57,7 @@ else()
endif()
set_module_type(nfsd win32cui)
add_importlibs(nfsd advapi32 iphlpapi kernel32_vista libtirpc msvcrt shell32 ws2_32 wldap32 kernel32 ntdll)
add_importlibs(nfsd advapi32 iphlpapi libtirpc msvcrt shell32 ws2_32 wldap32 kernel32_vista ntdll)
add_pch(nfsd precomp.h SOURCE)
add_cd_file(TARGET nfsd DESTINATION reactos/system32 FOR all)

View File

@@ -31,7 +31,7 @@ list(APPEND SOURCE
file(GLOB explorer_rc_deps res/*.*)
add_rc_deps(explorer.rc ${explorer_rc_deps})
add_executable(explorer ${SOURCE} explorer.rc)
add_executable(explorer ${SOURCE} $<TARGET_OBJECTS:roscompat_desc> explorer.rc)
target_link_libraries(explorer uuid wine cpprt atl_classes)
set_module_type(explorer win32gui UNICODE)
add_importlibs(explorer advapi32 gdi32 user32 comctl32 ole32 oleaut32 shell32 browseui shlwapi shdocvw version uxtheme msvcrt kernel32 ntdll)

View File

@@ -23,6 +23,6 @@ add_executable(services ${SOURCE} services.rc)
target_link_libraries(services ${PSEH_LIB})
set_module_type(services win32gui UNICODE)
add_importlibs(services userenv user32 advapi32 advapi32_vista rpcrt4 msvcrt kernel32 ntdll)
add_importlibs(services userenv user32 advapi32_vista rpcrt4 msvcrt kernel32 ntdll)
add_pch(services services.h SOURCE)
add_cd_file(TARGET services DESTINATION reactos/system32 FOR all)

View File

@@ -32,7 +32,7 @@
* Otherwise they are kept separated, unless an explicit /MERGE is used.
*/
#pragma comment(linker, "/SECTION:.text,ERW /SECTION:.data,RW /MERGE:.MBDATA=.text /MERGE:INIT=.text /MERGE:.edata=.rdata")
#pragma comment(linker, "/SECTION:.text,ERW /SECTION:.data,RW /MERGE:.MBDATA=.text /MERGE:INIT=.text /MERGE:.edata=.rdata /MERGE:.expvers=.rdata")
#endif

View File

@@ -106,7 +106,7 @@ else()
endif()
set_module_type(libtirpc win32dll)
add_importlibs(libtirpc user32 advapi32 kernel32_vista ws2_32 msvcrt kernel32 ntdll)
add_importlibs(libtirpc user32 advapi32 ws2_32 msvcrt kernel32_vista ntdll)
add_delay_importlibs(libtirpc secur32)
add_pch(libtirpc precomp.h SOURCE)
add_cd_file(TARGET libtirpc DESTINATION reactos/system32 FOR all)

View File

@@ -19,6 +19,7 @@ add_rc_deps(appwiz.rc ${appwiz_rc_deps})
add_library(appwiz MODULE
${SOURCE}
appwiz.rc
${CMAKE_CURRENT_BINARY_DIR}/appwiz_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/appwiz.def)
set_module_type(appwiz cpl UNICODE)

View File

@@ -22,7 +22,7 @@ set_source_files_properties(devenum.rc PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT
set_module_type(devenum win32dll UNICODE)
target_link_libraries(devenum strmiids uuid wine)
add_delay_importlibs(devenum msvfw32)
add_importlibs(devenum advapi32 advapi32_vista ole32 oleaut32 winmm user32 avicap32 msacm32 dsound msdmo msvcrt kernel32 ntdll)
add_importlibs(devenum advapi32_vista ole32 oleaut32 winmm user32 avicap32 msacm32 dsound msdmo msvcrt kernel32 ntdll)
add_dependencies(devenum wineheaders)
add_pch(devenum precomp.h SOURCE)
add_cd_file(TARGET devenum DESTINATION reactos/system32 FOR all)

View File

@@ -23,6 +23,6 @@ add_library(qcap MODULE ${SOURCE}
set_module_type(qcap win32dll)
target_link_libraries(qcap strmbase strmiids uuid wine)
add_importlibs(qcap ole32 oleaut32 gdi32 advapi32 advapi32_vista msvcrt kernel32 ntdll)
add_importlibs(qcap ole32 oleaut32 gdi32 advapi32_vista msvcrt kernel32 ntdll)
add_delay_importlibs(qcap msvfw32)
add_cd_file(TARGET qcap DESTINATION reactos/system32 FOR all)

View File

@@ -43,6 +43,7 @@ list(APPEND PCH_SKIP_SOURCE
add_library(quartz MODULE
${SOURCE}
${PCH_SKIP_SOURCE}
${CMAKE_CURRENT_BINARY_DIR}/quartz_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/quartz.def
version.rc)
@@ -57,7 +58,7 @@ list(APPEND quartz_rc_deps
set_source_files_properties(version.rc PROPERTIES OBJECT_DEPENDS "${quartz_rc_deps}")
set_module_type(quartz win32dll)
target_link_libraries(quartz strmbase strmiids uuid dxguid wine ${PSEH_LIB})
add_importlibs(quartz dsound msacm32 msvfw32 ole32 oleaut32 rpcrt4 user32 gdi32 advapi32 advapi32_vista shlwapi msvcrt kernel32 ntdll)
add_importlibs(quartz dsound msacm32 msvfw32 ole32 oleaut32 rpcrt4 user32 gdi32 advapi32_vista shlwapi msvcrt kernel32 ntdll)
add_dependencies(quartz dxsdk quartz_idlheader stdole2)
add_pch(quartz precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET quartz DESTINATION reactos/system32 FOR all)

View File

@@ -24,14 +24,18 @@ add_library(rtl_um OBJECT
target_link_libraries(rtl_um apisets ${PSEH_LIB})
add_dependencies(rtl_um psdk)
# On NT6+ this is used by advapi32
add_library(etwtrace etw/trace.c)
target_link_libraries(etwtrace ${PSEH_LIB})
list(APPEND SOURCE
dbg/dbgui.c
ldr/appcompat.c
ldr/ldrapi.c
ldr/ldrinit.c
ldr/ldrpe.c
ldr/ldrutils.c
ldr/verifier.c
etw/trace.c)
ldr/verifier.c)
if(ARCH STREQUAL "i386")
list(APPEND ASM_SOURCE dispatch/i386/dispatch.S)
@@ -61,7 +65,7 @@ set_module_type(ntdll win32dll ENTRYPOINT 0)
set_subsystem(ntdll console)
################# END HACK #################
target_link_libraries(ntdll csrlib rtl rtl_um rtl_vista ntdllsys libcntpr uuid ${PSEH_LIB})
target_link_libraries(ntdll etwtrace csrlib rtl rtl_um rtl_vista ntdllsys libcntpr uuid ${PSEH_LIB})
if(DLL_EXPORT_VERSION GREATER_EQUAL 0x600)
target_link_libraries(ntdll cryptlib)
endif()
@@ -78,3 +82,6 @@ add_cd_file(TARGET ntdll DESTINATION reactos/system32 NO_CAB FOR all)
if(MSVC AND ARCH STREQUAL "i386")
target_link_libraries(libntdll ftol2)
endif()
if(DLL_EXPORT_VERSION GREATER_EQUAL 0x600)
endif()

View File

@@ -262,6 +262,7 @@
@ stdcall NtCompressKey(ptr)
@ stdcall NtConnectPort(ptr ptr ptr ptr ptr ptr ptr ptr)
@ stdcall NtContinue(ptr long)
@ stub -version=0x500 NtCreateChannel() # For testing only
@ stdcall NtCreateDebugObject(ptr long ptr long)
@ stdcall NtCreateDirectoryObject(long long long)
@ stub -version=0x600+ NtCreateEnlistment
@@ -1801,7 +1802,7 @@
@ cdecl _strlwr(str)
@ cdecl _strnicmp(str str long)
@ cdecl _strupr(str)
@ cdecl -version=0x400-0x502 -impsym _swprintf() swprintf # Compatibility for pre NT6
@ cdecl -version=0x400-0x502 -noroscompat -impsym _swprintf() swprintf # Compatibility for pre NT6
@ cdecl -version=0x600+ _swprintf(ptr str)
@ cdecl -version=0x502 _tolower(long)
@ cdecl -version=0x502 _toupper(long)

View File

@@ -46,4 +46,7 @@
/* PSEH */
#include <pseh/pseh2.h>
/* RosCompat */
#include <roscompat.h>
#endif /* _NTDLL_H */

View File

@@ -83,15 +83,20 @@ VOID NTAPI LdrpEnsureLoaderLockIsHeld(VOID);
/* ldrpe.c */
NTSTATUS
NTAPI
LdrpSnapThunk(IN PVOID ExportBase,
LdrpSnapThunk(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry,
IN PVOID ImportBase,
IN PIMAGE_THUNK_DATA OriginalThunk,
IN OUT PIMAGE_THUNK_DATA Thunk,
IN PIMAGE_EXPORT_DIRECTORY ExportEntry,
IN ULONG ExportSize,
IN BOOLEAN Static,
IN UCHAR SnapFlags,
IN LPSTR DllName);
/* SnapFlags for LdrpSnapThunk */
#define SNAP_DYNAMIC 0x0
#define SNAP_STATIC 0x1
#define SNAP_PRIVATE 0x2
NTSTATUS NTAPI
LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL,
IN PLDR_DATA_TABLE_ENTRY LdrEntry);
@@ -116,7 +121,8 @@ LdrpGetProcedureAddress(
_In_opt_ _When_(Ordinal == 0, _Notnull_) PANSI_STRING Name,
_In_opt_ _When_(Name == NULL, _In_range_(>, 0)) ULONG Ordinal,
_Out_ PVOID *ProcedureAddress,
_In_ BOOLEAN ExecuteInit);
_In_ BOOLEAN ExecuteInit,
_In_ BOOLEAN UsePrivateExports);
PLDR_DATA_TABLE_ENTRY NTAPI
LdrpAllocateDataTableEntry(IN PVOID BaseAddress);
@@ -237,6 +243,27 @@ RtlDoesFileExists_UStr(
IN PUNICODE_STRING FileName
);
/* appcompat.c */
VOID
NTAPI
LdrpInitializeExportVersioning(
_Inout_ PLDR_DATA_TABLE_ENTRY ImageLdrEntry,
_Inout_ PLDR_DATA_TABLE_ENTRY NtdllLdrEntry);
VOID
NTAPI
LdrpApplyDllExportVersioning(
_Inout_ PLDR_DATA_TABLE_ENTRY LdrEntry);
BOOLEAN
NTAPI
LdrpValidateVersionedExport(
_In_ const LDR_DATA_TABLE_ENTRY* LdrEntry,
_In_ ULONG OrdinalIndex);
extern char __ImageBase;
VOID
NTAPI
RtlpInitializeKeyedEvent(

233
dll/ntdll/ldr/appcompat.c Normal file
View File

@@ -0,0 +1,233 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS NT User-Mode Library
* FILE: dll/ntdll/ldr/appcompat.c
* PURPOSE:
* PROGRAMMERS: Timo Kreuzer <timo.kreuzer@reactos.org>
*/
/* INCLUDES *****************************************************************/
#include <ntdll.h>
#include <compat_undoc.h>
#include <compatguid_undoc.h>
#include <roscompat.h>
#define NDEBUG
#include <debug.h>
static USHORT ExportVersionMask;
static
ROSCOMPAT_VERSION_BIT
TranslateAppcompatVersionToVersionBit(
_In_ DWORD AppcompatVersion)
{
switch (AppcompatVersion)
{
case _WIN32_WINNT_NT4:
return ROSCOMPAT_VERSION_BIT_NT4;
case _WIN32_WINNT_WIN2K:
return ROSCOMPAT_VERSION_BIT_WIN2K;
case _WIN32_WINNT_WINXP:
return ROSCOMPAT_VERSION_BIT_WINXP;
case _WIN32_WINNT_WS03:
return ROSCOMPAT_VERSION_BIT_WS03;
case _WIN32_WINNT_VISTA:
return ROSCOMPAT_VERSION_BIT_VISTA;
case _WIN32_WINNT_WIN7:
return ROSCOMPAT_VERSION_BIT_WIN7;
case _WIN32_WINNT_WIN8:
return ROSCOMPAT_VERSION_BIT_WIN8;
case _WIN32_WINNT_WINBLUE:
return ROSCOMPAT_VERSION_BIT_WIN81;
case _WIN32_WINNT_WIN10:
return ROSCOMPAT_VERSION_BIT_WIN10;
default:
ASSERT(FALSE);
}
return ROSCOMPAT_VERSION_BIT_WS03;
}
PIMAGE_SECTION_HEADER
LdrpFindSectionByName(
PVOID ImageBase,
PSTR SectionName)
{
PIMAGE_NT_HEADERS NtHeaders;
PIMAGE_SECTION_HEADER SectionHeaders;
SIZE_T NameLength;
ULONG i;
/* Get the NT headers */
NtHeaders = RtlImageNtHeader(ImageBase);
if (NtHeaders == NULL)
{
return NULL;
}
SectionHeaders = IMAGE_FIRST_SECTION(NtHeaders);
/* Check for long section name */
NameLength = strlen(SectionName);
if (NameLength <= IMAGE_SIZEOF_SHORT_NAME)
{
/* Loop the sections until we found the requested one */
for (i = 0; i < NtHeaders->FileHeader.NumberOfSections; i++)
{
/* Directly compare names */
if (strncmp((char*)SectionHeaders[i].Name, SectionName, IMAGE_SIZEOF_SHORT_NAME) == 0)
{
return &SectionHeaders[i];
}
}
}
else
{
// FIXME: support long section names
ASSERT(FALSE);
}
return NULL;
}
PVOID
LdrpSectionHeaderToVAAndSize(
_In_ PVOID ImageBase,
_In_ PIMAGE_SECTION_HEADER SectionHeader,
_Out_ PSIZE_T SectionSize)
{
*SectionSize = SectionHeader->SizeOfRawData;
return (PVOID)((PUCHAR)ImageBase + SectionHeader->VirtualAddress);
}
PROSCOMPAT_DESCRIPTOR
FindRosCompatDescriptor(
_In_ PVOID ImageBase)
{
PIMAGE_SECTION_HEADER SectionHeader;
SectionHeader = LdrpFindSectionByName(ImageBase, ".expvers");
if (SectionHeader == NULL)
{
return NULL;
}
return (PROSCOMPAT_DESCRIPTOR)((PUCHAR)ImageBase + SectionHeader->VirtualAddress);
}
VOID
NTAPI
LdrpApplyDllExportVersioning(
_Inout_ PLDR_DATA_TABLE_ENTRY LdrEntry)
{
PROSCOMPAT_DESCRIPTOR RosCompatDescriptor;
/* Make sure we have a data table entry */
ASSERT(LdrEntry != NULL);
/* Ensure that this field is not used */
ASSERT(LdrEntry->PatchInformation == NULL);
/* Get the appcompat descriptor */
RosCompatDescriptor = FindRosCompatDescriptor(LdrEntry->DllBase);
if (RosCompatDescriptor == NULL)
{
DPRINT("roscompat: No descriptor in %wZ\n", &LdrEntry->BaseDllName);
return;
}
/* Save the descriptor */
LdrEntry->PatchInformation = RosCompatDescriptor;
/* Check for dummy descriptor */
if (RosCompatDescriptor->ExportMasks == NULL)
{
DPRINT("roscompat: Dummy descriptor in %wZ\n", &LdrEntry->BaseDllName);
*RosCompatDescriptor->NumberOfValidExports = MAXULONG;
return;
}
/* Count the number of valid (public) exports */
ULONG NumberOfValidExports = 0;
for (ULONG i = 0; i < RosCompatDescriptor->NumberOfOrdinals; i++)
{
if (RosCompatDescriptor->ExportMasks[i] & ExportVersionMask)
{
NumberOfValidExports++;
}
}
*RosCompatDescriptor->NumberOfValidExports = NumberOfValidExports;
DPRINT("roscompat: Applied export version info for '%wZ'\n",
&LdrEntry->BaseDllName);
}
VOID
NTAPI
LdrpInitializeExportVersioning(
_Inout_ PLDR_DATA_TABLE_ENTRY ImageLdrEntry,
_Inout_ PLDR_DATA_TABLE_ENTRY NtdllLdrEntry)
{
DWORD AppCompatVersion;
/* Get the AppCompat version */
AppCompatVersion = RosGetProcessCompatVersion();
if (AppCompatVersion == 0)
{
/* Default to WS 2003 */
AppCompatVersion = _WIN32_WINNT_WS03;
}
else
{
/* Patch the PEB */
PPEB Peb = NtCurrentPeb();
Peb->OSMajorVersion = AppCompatVersion >> 8;
Peb->OSMinorVersion = AppCompatVersion & 0xFF;
DPRINT("roscompat: Using AppCompat version %lu for image %wZ\n",
AppCompatVersion,
&ImageLdrEntry->BaseDllName);
}
/* Set the global export version mask */
ExportVersionMask = 1 << TranslateAppcompatVersionToVersionBit(AppCompatVersion);
LdrpApplyDllExportVersioning(ImageLdrEntry);
LdrpApplyDllExportVersioning(NtdllLdrEntry);
}
BOOLEAN
NTAPI
LdrpValidateVersionedExport(
_In_ const LDR_DATA_TABLE_ENTRY* LdrEntry,
_In_ ULONG OrdinalIndex)
{
PROSCOMPAT_DESCRIPTOR RosCompatDescriptor = LdrEntry->PatchInformation;
/* Check for dummy descriptor */
if (RosCompatDescriptor->ExportMasks == NULL)
{
return TRUE;
}
if (OrdinalIndex >= RosCompatDescriptor->NumberOfOrdinals)
{
DPRINT1("roscompat: Invalid ordinal %lu for '%wZ'\n",
OrdinalIndex,
&LdrEntry->BaseDllName);
return FALSE;
}
if ((RosCompatDescriptor->ExportMasks[OrdinalIndex] & ExportVersionMask) == 0)
{
DPRINT1("roscompat: Export %lu is not valid for '%wZ'\n",
OrdinalIndex,
&LdrEntry->BaseDllName);
return FALSE;
}
return TRUE;
}

View File

@@ -793,7 +793,7 @@ LdrGetProcedureAddress(
_Out_ PVOID *ProcedureAddress)
{
/* Call the internal routine and tell it to execute DllInit */
return LdrpGetProcedureAddress(BaseAddress, Name, Ordinal, ProcedureAddress, TRUE);
return LdrpGetProcedureAddress(BaseAddress, Name, Ordinal, ProcedureAddress, TRUE, FALSE);
}
/*
@@ -1526,8 +1526,7 @@ LdrUnloadDll(
/* Check if a Hotpatch is active */
if (LdrEntry->PatchInformation)
{
/* FIXME */
DPRINT1("We don't support Hotpatching yet\n");
DPRINT("roscompat: %wZ has compat info\n", &CurrentEntry->BaseDllName);
}
/* Deallocate the Entry */

View File

@@ -2267,6 +2267,9 @@ LdrpInitializeProcess(IN PCONTEXT Context,
/* Initialize Wine's active context implementation for the current process */
actctx_init(&OldShimData);
/* Process export versioning data */
LdrpInitializeExportVersioning(LdrpImageEntry, NtLdrEntry);
/* Set the current directory */
Status = RtlSetCurrentDirectory_U(&CurrentDirectory);
if (!NT_SUCCESS(Status))
@@ -2323,15 +2326,16 @@ LdrpInitializeProcess(IN PCONTEXT Context,
return Status;
}
Status = LdrGetProcedureAddress(Kernel32BaseAddress,
&BaseProcessInitPostImportName,
0,
&FunctionAddress);
/* Look up BaseProcessInitPostImport and allow to get exports hidden by roscompat */
Status = LdrpGetProcedureAddress(Kernel32BaseAddress,
&BaseProcessInitPostImportName,
0,
&FunctionAddress,
TRUE,
TRUE);
if (!NT_SUCCESS(Status))
{
if (ShowSnaps)
DPRINT1("LDR: Unable to find post-import process init function, Status=0x%08lx\n", Status);
DPRINT1("LDR: Unable to find BaseProcessInitPostImport in kernel32, Status=0x%08lx\n", Status);
return Status;
}
Kernel32ProcessInitPostImportFunction = FunctionAddress;

View File

@@ -37,6 +37,7 @@ LdrpSnapIAT(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry,
LPSTR ImportName;
ULONG ForwarderChain, i, Rva, OldProtect, IatSize, ExportSize;
SIZE_T ImportSize;
UCHAR SnapFlags;
DPRINT("LdrpSnapIAT(%wZ %wZ %p %u)\n", &ExportLdrEntry->BaseDllName, &ImportLdrEntry->BaseDllName, IatEntry, EntriesValid);
/* Get export directory */
@@ -131,6 +132,13 @@ LdrpSnapIAT(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry,
return Status;
}
/* Set snap flags. We allow private imports from our own modules */
SnapFlags = SNAP_STATIC;
if (ImportLdrEntry->PatchInformation != NULL)
{
SnapFlags |= SNAP_PRIVATE;
}
/* Check if the Thunks are already valid */
if (EntriesValid)
{
@@ -161,13 +169,13 @@ LdrpSnapIAT(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry,
/* Snap the thunk */
_SEH2_TRY
{
Status = LdrpSnapThunk(ExportLdrEntry->DllBase,
Status = LdrpSnapThunk(ExportLdrEntry,
ImportLdrEntry->DllBase,
OriginalThunk,
FirstThunk,
ExportDirectory,
ExportSize,
TRUE,
SnapFlags,
ImportName);
/* Move to the next thunk */
@@ -217,13 +225,13 @@ LdrpSnapIAT(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry,
/* Snap the Thunk */
_SEH2_TRY
{
Status = LdrpSnapThunk(ExportLdrEntry->DllBase,
Status = LdrpSnapThunk(ExportLdrEntry,
ImportLdrEntry->DllBase,
OriginalThunk,
FirstThunk,
ExportDirectory,
ExportSize,
TRUE,
SnapFlags,
ImportName);
/* Next thunks */
@@ -934,13 +942,13 @@ done:
NTSTATUS
NTAPI
LdrpSnapThunk(IN PVOID ExportBase,
LdrpSnapThunk(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry,
IN PVOID ImportBase,
IN PIMAGE_THUNK_DATA OriginalThunk,
IN OUT PIMAGE_THUNK_DATA Thunk,
IN PIMAGE_EXPORT_DIRECTORY ExportDirectory,
IN ULONG ExportSize,
IN BOOLEAN Static,
IN UCHAR SnapFlags,
IN LPSTR DllName)
{
BOOLEAN IsOrdinal;
@@ -963,6 +971,7 @@ LdrpSnapThunk(IN PVOID ExportBase,
PANSI_STRING ForwardName;
PVOID ForwarderHandle;
ULONG ForwardOrdinal;
PVOID ExportBase = ExportLdrEntry->DllBase;
/* Check if the snap is by ordinal */
if ((IsOrdinal = IMAGE_SNAP_BY_ORDINAL(OriginalThunk->u1.Ordinal)))
@@ -1013,14 +1022,11 @@ LdrpSnapThunk(IN PVOID ExportBase,
{
FailurePath:
/* Is this a static snap? */
if (Static)
if (SnapFlags & SNAP_STATIC)
{
UNICODE_STRING SnapTarget;
PLDR_DATA_TABLE_ENTRY LdrEntry;
/* What was the module we were searching in */
RtlInitAnsiString(&TempString, DllName ? DllName : "Unknown");
/* What was the module we were searching for */
if (LdrpCheckForLoadedDllHandle(ImportBase, &LdrEntry))
SnapTarget = LdrEntry->BaseDllName;
@@ -1029,12 +1035,14 @@ FailurePath:
/* Inform the debug log */
if (IsOrdinal)
DPRINT1("Failed to snap ordinal %Z!0x%x for %wZ\n", &TempString, OriginalOrdinal, &SnapTarget);
DPRINT1("Failed to snap ordinal %wZ!0x%x for %wZ\n", &ExportLdrEntry->BaseDllName, OriginalOrdinal, &SnapTarget);
else
DPRINT1("Failed to snap %Z!%s for %wZ\n", &TempString, ImportName, &SnapTarget);
DPRINT1("Failed to snap %wZ!%s for %wZ\n", &ExportLdrEntry->BaseDllName, ImportName, &SnapTarget);
/* These are critical errors. Setup a string for the DLL name */
RtlAnsiStringToUnicodeString(&HardErrorDllName, &TempString, TRUE);
RtlDuplicateUnicodeString(RTL_DUPLICATE_UNICODE_STRING_NULL_TERMINATE,
&ExportLdrEntry->BaseDllName,
&HardErrorDllName);
/* Set it as the parameter */
HardErrorParameters[1] = (ULONG_PTR)&HardErrorDllName;
@@ -1101,6 +1109,17 @@ FailurePath:
}
else
{
/* Check if we need to check export version information */
if (!(SnapFlags & SNAP_PRIVATE) && (ExportLdrEntry->PatchInformation != NULL))
{
/* Check if the export is allowed by current appcompat seetings */
if (!LdrpValidateVersionedExport(ExportLdrEntry, Ordinal))
{
/* It is not allowed, fail */
goto FailurePath;
}
}
/* The ordinal seems correct, get the AddressOfFunctions VA */
AddressOfFunctions = (PULONG)
((ULONG_PTR)ExportBase +
@@ -1195,7 +1214,8 @@ FailurePath:
ForwardName,
ForwardOrdinal,
(PVOID*)&Thunk->u1.Function,
FALSE);
FALSE,
(ExportLdrEntry->PatchInformation != NULL));
/* If this fails, then error out */
if (!NT_SUCCESS(Status)) goto FailurePath;
}

View File

@@ -1511,6 +1511,11 @@ NoRelocNeeded:
LdrpValidateImageForMp(LdrEntry);
}
if (NT_SUCCESS(Status))
{
LdrpApplyDllExportVersioning(LdrEntry);
}
// FIXME: LdrpCorUnloadImage() is missing
/* Close section and return status */
@@ -2228,7 +2233,8 @@ LdrpGetProcedureAddress(
_In_opt_ _When_(Ordinal == 0, _Notnull_) PANSI_STRING Name,
_In_opt_ _When_(Name == NULL, _In_range_(>, 0)) ULONG Ordinal,
_Out_ PVOID *ProcedureAddress,
_In_ BOOLEAN ExecuteInit)
_In_ BOOLEAN ExecuteInit,
_In_ BOOLEAN UsePrivateExports)
{
NTSTATUS Status = STATUS_SUCCESS;
UCHAR ImportBuffer[64]; // 128 since NT6.2
@@ -2338,13 +2344,13 @@ LdrpGetProcedureAddress(
}
/* Now get the thunk */
Status = LdrpSnapThunk(LdrEntry->DllBase,
Status = LdrpSnapThunk(LdrEntry,
ImageBase,
&Thunk,
&Thunk,
ExportDir,
ExportDirSize,
FALSE,
UsePrivateExports ? SNAP_PRIVATE : 0,
NULL);
/* Finally, see if we're supposed to run the init routines */
@@ -2529,6 +2535,17 @@ LdrpLoadDll(IN BOOLEAN Redirected,
if (LdrEntry->LoadCount != 0xFFFF) LdrEntry->LoadCount++;
LdrpUpdateLoadCount2(LdrEntry, LDRP_UPDATE_REFCOUNT);
/* Check for DLL with 0 valid exports */
if (NT_SUCCESS(Status) && LdrEntry->PatchInformation != NULL)
{
PROSCOMPAT_DESCRIPTOR RosCompatDescriptor = LdrEntry->PatchInformation;
if (*RosCompatDescriptor->NumberOfValidExports == 0)
{
DPRINT1("appcompat: %wZ has 0 valid exports\n", &RawDllName);
Status = STATUS_DLL_NOT_FOUND;
}
}
/* Check if we failed */
if (!NT_SUCCESS(Status))
{
@@ -2598,6 +2615,17 @@ LdrpLoadDll(IN BOOLEAN Redirected,
}
else
{
/* Check for DLL with 0 valid exports */
if (LdrEntry->PatchInformation != NULL)
{
PROSCOMPAT_DESCRIPTOR RosCompatDescriptor = LdrEntry->PatchInformation;
if (*RosCompatDescriptor->NumberOfValidExports == 0)
{
Status = STATUS_DLL_NOT_FOUND;
_SEH2_LEAVE;
}
}
/* We were already loaded. Are we a DLL? */
if ((LdrEntry->Flags & LDRP_IMAGE_DLL) && (LdrEntry->LoadCount != 0xFFFF))
{
@@ -2683,7 +2711,7 @@ PVOID LdrpGetShimEngineFunction(PCSZ FunctionName)
PVOID Address;
RtlInitAnsiString(&Function, FunctionName);
/* Skip Dll init */
Status = LdrpGetProcedureAddress(g_pShimEngineModule, &Function, 0, &Address, FALSE);
Status = LdrpGetProcedureAddress(g_pShimEngineModule, &Function, 0, &Address, FALSE, TRUE);
return NT_SUCCESS(Status) ? Address : NULL;
}

View File

@@ -267,7 +267,7 @@ AvrfpResolveThunks(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
RtlInitAnsiString(&ThunkName, ThunkDescriptor->ThunkName);
/* We cannot call the public api, because that would run init routines! */
if (NT_SUCCESS(LdrpGetProcedureAddress(LdrEntry->DllBase, &ThunkName, 0, &ThunkDescriptor->ThunkOldAddress, FALSE)))
if (NT_SUCCESS(LdrpGetProcedureAddress(LdrEntry->DllBase, &ThunkName, 0, &ThunkDescriptor->ThunkOldAddress, FALSE, FALSE)))
{
if (AVrfpDebug & RTL_VRF_DBG_SHOWFOUNDEXPORTS)
DbgPrint("AVRF: (%wZ) %Z export found.\n", &LdrEntry->BaseDllName, &ThunkName);

View File

@@ -1,6 +1,4 @@
spec2def(ntdll_vista.dll ntdll_vista.spec ADD_IMPORTLIB)
add_definitions(
-D__NTDLL__
-D_NTOSKRNL_
@@ -14,12 +12,23 @@ list(APPEND SOURCE
DllMain.c
${CMAKE_CURRENT_BINARY_DIR}/ntdll_vista.def)
add_library(ntdll_vista MODULE ${SOURCE} ntdll_vista.rc)
set_module_type(ntdll_vista win32dll ENTRYPOINT DllMain 12)
target_link_libraries(ntdll_vista smlib rtl_vista)
if(ARCH STREQUAL "arm")
target_link_libraries(ntdll_vista chkstk)
if(DLL_EXPORT_VERSION GREATER_EQUAL 0x600)
# On NT6+ builds this is an empty interface library
add_library(libntdll_vista INTERFACE)
target_sources(libntdll_vista INTERFACE $<TARGET_OBJECTS:roscompat_desc>)
else()
# On pre-NT6 builds we create an additional DLL
spec2def(ntdll_vista.dll ntdll_vista.spec ADD_IMPORTLIB)
add_library(ntdll_vista MODULE ${SOURCE} ntdll_vista.rc)
set_module_type(ntdll_vista win32dll ENTRYPOINT DllMain 12)
target_link_libraries(ntdll_vista smlib rtl_vista)
if(ARCH STREQUAL "arm")
target_link_libraries(ntdll_vista chkstk)
endif()
add_importlibs(ntdll_vista ntdll)
add_dependencies(ntdll_vista psdk)
add_cd_file(TARGET ntdll_vista DESTINATION reactos/system32 FOR all)
endif()
add_importlibs(ntdll_vista ntdll)
add_dependencies(ntdll_vista psdk)
add_cd_file(TARGET ntdll_vista DESTINATION reactos/system32 FOR all)
# Implicitly link against ntdll
target_link_libraries(libntdll_vista INTERFACE libntdll)

View File

@@ -35,6 +35,7 @@ add_library(shellbtrfs MODULE
${btrfs_asm}
${PCH_SKIP_SOURCE}
shellbtrfs.rc
${CMAKE_CURRENT_BINARY_DIR}/shellbtrfs_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/shellbtrfs.def)
file(GLOB shellbtrfs_rc_deps *.ico)
@@ -43,6 +44,6 @@ add_rc_deps(shellbtrfs.rc ${shellbtrfs_rc_deps})
set_module_type(shellbtrfs win32dll UNICODE)
target_link_libraries(shellbtrfs uuid cppstl)
set_target_cpp_properties(shellbtrfs WITH_EXCEPTIONS)
add_importlibs(shellbtrfs advapi32 advapi32_vista ole32 shell32 shlwapi user32 comctl32 uxtheme setupapi comdlg32 gdi32 msvcrt kernel32_vista kernel32 ntdll)
add_importlibs(shellbtrfs advapi32_vista ole32 shell32 shlwapi user32 comctl32 uxtheme setupapi comdlg32 gdi32 msvcrt kernel32_vista ntdll)
add_pch(shellbtrfs precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET shellbtrfs DESTINATION reactos/system32 FOR all)

View File

@@ -32,6 +32,7 @@ add_library(zipfldr MODULE
${SOURCE}
${ZLIB_SOURCE}
zipfldr.rc
${CMAKE_CURRENT_BINARY_DIR}/zipfldr_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/zipfldr.def)
set_module_type(zipfldr win32dll UNICODE)

View File

@@ -63,6 +63,12 @@ add_library(advapi32 MODULE
set_module_type(advapi32 win32dll UNICODE ENTRYPOINT DllMain 12)
target_link_libraries(advapi32 cryptlib wine ${PSEH_LIB})
add_delay_importlibs(advapi32 secur32)
add_importlibs(advapi32 advapi32_vista rpcrt4 kernel32 ntdll)
add_importlibs(advapi32 rpcrt4 kernel32 ntdll)
add_pch(advapi32 advapi32.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET advapi32 DESTINATION reactos/system32 FOR all)
if(DLL_EXPORT_VERSION GREATER_EQUAL 0x600)
target_link_libraries(advapi32 etwtrace)
else()
add_importlibs(advapi32 advapi32_vista)
endif()

View File

@@ -1,10 +1,13 @@
1 stdcall I_ScGetCurrentGroupStateW(ptr wstr ptr)
@ stdcall -version=0x502 A_SHAFinal(ptr ptr)
@ stdcall -version=0x600+ A_SHAFinal(ptr ptr) ntdll.A_SHAFinal
@ stdcall -version=0x502 A_SHAInit(ptr)
@ stdcall -version=0x600+ A_SHAInit(ptr) ntdll.A_SHAInit
@ stdcall -version=0x502 A_SHAUpdate(ptr ptr long)
@ stdcall -version=0x600+ A_SHAUpdate(ptr ptr long) ntdll.A_SHAUpdate
@ stdcall -version=0x502 -noroscompat A_SHAFinal(ptr ptr)
@ stdcall -version=0x600+ -noroscompat A_SHAFinal(ptr ptr) ntdll.A_SHAFinal
@ stdcall -version=0x502+ -roscompat A_SHAFinal(ptr ptr) ntdll.A_SHAFinal
@ stdcall -version=0x502 -noroscompat A_SHAInit(ptr)
@ stdcall -version=0x600+ -noroscompat A_SHAInit(ptr) ntdll.A_SHAInit
@ stdcall -version=0x502+ -roscompat A_SHAInit(ptr) ntdll.A_SHAInit
@ stdcall -version=0x502 -noroscompat A_SHAUpdate(ptr ptr long)
@ stdcall -version=0x600+ -noroscompat A_SHAUpdate(ptr ptr long) ntdll.A_SHAUpdate
@ stdcall -version=0x502+ -roscompat A_SHAUpdate(ptr ptr long) ntdll.A_SHAUpdate
@ stdcall AbortSystemShutdownA(ptr)
@ stdcall AbortSystemShutdownW(ptr)
@ stdcall AccessCheck(ptr long long ptr ptr ptr ptr ptr)
@@ -69,10 +72,12 @@
@ stdcall CommandLineFromMsiDescriptor(wstr ptr ptr)
@ stub ComputeAccessTokenFromCodeAuthzLevel
@ stdcall ControlService(long long ptr)
@ stdcall -version=0x502 ControlTraceA(double str ptr long) ntdll.EtwControlTraceA
@ stdcall -stub -version=0x600+ ControlTraceA(double str ptr long)
@ stdcall -version=0x502 ControlTraceW(double wstr ptr long) ntdll.EtwControlTraceW
@ stdcall -stub -version=0x600+ ControlTraceW(double wstr ptr long)
@ stdcall -version=0x502 -noroscompat ControlTraceA(double str ptr long) ntdll.EtwControlTraceA
@ stdcall -version=0x600+ -noroscompat ControlTraceA(double str ptr long) EtwControlTraceA
@ stdcall -version=0x502+ -roscompat ControlTraceA(double str ptr long) ntdll.EtwControlTraceA
@ stdcall -version=0x502 -noroscompat ControlTraceW(double wstr ptr long) ntdll.EtwControlTraceW
@ stdcall -version=0x600+ -noroscompat ControlTraceW(double wstr ptr long) EtwControlTraceW
@ stdcall -version=0x502+ -roscompat ControlTraceW(double wstr ptr long) ntdll.EtwControlTraceW
@ stub ConvertAccessToSecurityDescriptorA
@ stub ConvertAccessToSecurityDescriptorW
@ stub ConvertSDToStringSDRootDomainA
@@ -206,8 +211,9 @@
@ stdcall ElfReportEventA(long long long long ptr long long ptr ptr long ptr ptr)
@ stdcall ElfReportEventAndSourceW(long long ptr long long long ptr ptr long long ptr ptr long ptr ptr)
@ stdcall ElfReportEventW(long long long long ptr long long ptr ptr long ptr ptr)
@ stdcall -version=0x502 EnableTrace(long long long ptr double) ntdll.EtwEnableTrace
@ stdcall -stub -version=0x600+ EnableTrace(long long long ptr double)
@ stdcall -version=0x502 -noroscompat EnableTrace(long long long ptr double) ntdll.EtwEnableTrace
@ stdcall -version=0x600+ -noroscompat EnableTrace(long long long ptr double) EtwEnableTrace
@ stdcall -version=0x502+ -roscompat EnableTrace(long long long ptr double) ntdll.EtwEnableTrace
@ stdcall EncryptFileA(str)
@ stdcall EncryptFileW(wstr)
@ stub EncryptedFileKeyInfo
@@ -219,18 +225,21 @@
@ stdcall EnumServicesStatusExA(long long long long ptr long ptr ptr ptr str)
@ stdcall EnumServicesStatusExW(long long long long ptr long ptr ptr ptr wstr)
@ stdcall EnumServicesStatusW(long long long ptr long ptr ptr ptr)
@ stdcall -version=0x502 EnumerateTraceGuids(ptr long ptr) ntdll.EtwEnumerateTraceGuids
@ stdcall -stub -version=0x600+ EnumerateTraceGuids(ptr long ptr)
@ stdcall -version=0x502 -noroscompat EnumerateTraceGuids(ptr long ptr) ntdll.EtwEnumerateTraceGuids
@ stdcall -version=0x600+ -noroscompat EnumerateTraceGuids(ptr long ptr) EtwEnumerateTraceGuids
@ stdcall -version=0x502+ -roscompat EnumerateTraceGuids(ptr long ptr) ntdll.EtwEnumerateTraceGuids
@ stdcall EqualDomainSid(ptr ptr ptr)
@ stdcall EqualPrefixSid(ptr ptr)
@ stdcall EqualSid(ptr ptr)
@ stdcall FileEncryptionStatusA(str ptr)
@ stdcall FileEncryptionStatusW(wstr ptr)
@ stdcall FindFirstFreeAce(ptr ptr)
@ stdcall -version=0x502 FlushTraceA(double str ptr) ntdll.EtwFlushTraceA
@ stdcall -stub -version=0x600+ FlushTraceA(double str ptr)
@ stdcall -version=0x502 FlushTraceW(double wstr ptr) ntdll.EtwFlushTraceW
@ stdcall -stub -version=0x600+ FlushTraceW(double wstr ptr)
@ stdcall -version=0x502 -noroscompat FlushTraceA(double str ptr) ntdll.EtwFlushTraceA
@ stdcall -version=0x600+ -noroscompat FlushTraceA(double str ptr) EtwFlushTraceA
@ stdcall -version=0x502+ -roscompat FlushTraceA(double str ptr) ntdll.EtwFlushTraceA
@ stdcall -version=0x502 -noroscompat FlushTraceW(double wstr ptr) ntdll.EtwFlushTraceW
@ stdcall -version=0x600+ -noroscompat FlushTraceW(double wstr ptr) EtwFlushTraceW
@ stdcall -version=0x502+ -roscompat FlushTraceW(double wstr ptr) ntdll.EtwFlushTraceW
@ stub FreeEncryptedFileKeyInfo
@ stdcall FreeEncryptionCertificateHashList(ptr)
@ stdcall FreeInheritedFromArray(ptr long ptr)
@@ -408,18 +417,24 @@
@ stdcall LsaSetTrustedDomainInfoByName(ptr ptr long ptr)
@ stdcall LsaSetTrustedDomainInformation(ptr ptr long ptr)
@ stdcall LsaStorePrivateData(ptr ptr ptr)
@ stdcall -version=0x502 MD4Final(ptr)
@ stdcall -version=0x600+ MD4Final(ptr) ntdll.MD4Final
@ stdcall -version=0x502 MD4Init(ptr)
@ stdcall -version=0x600+ MD4Init(ptr) ntdll.MD4Init
@ stdcall -version=0x502 MD4Update(ptr ptr long)
@ stdcall -version=0x600+ MD4Update(ptr ptr long) ntdll.MD4Update
@ stdcall -version=0x502 MD5Final(ptr)
@ stdcall -version=0x600+ MD5Final(ptr) ntdll.MD5Final
@ stdcall -version=0x502 MD5Init(ptr)
@ stdcall -version=0x600+ MD5Init(ptr) ntdll.MD5Init
@ stdcall -version=0x502 MD5Update(ptr ptr long)
@ stdcall -version=0x600+ MD5Update(ptr ptr long) ntdll.MD5Update
@ stdcall -version=0x502 -noroscompat MD4Final(ptr)
@ stdcall -version=0x600+ -noroscompat MD4Final(ptr) ntdll.MD4Final
@ stdcall -version=0x502+ -roscompat MD4Final(ptr) ntdll.MD4Final
@ stdcall -version=0x502 -noroscompat MD4Init(ptr)
@ stdcall -version=0x600+ -noroscompat MD4Init(ptr) ntdll.MD4Init
@ stdcall -version=0x502+ -roscompat MD4Init(ptr) ntdll.MD4Init
@ stdcall -version=0x502 -noroscompat MD4Update(ptr ptr long)
@ stdcall -version=0x600+ -noroscompat MD4Update(ptr ptr long) ntdll.MD4Update
@ stdcall -version=0x502+ -roscompat MD4Update(ptr ptr long) ntdll.MD4Update
@ stdcall -version=0x502 -noroscompat MD5Final(ptr)
@ stdcall -version=0x600+ -noroscompat MD5Final(ptr) ntdll.MD5Final
@ stdcall -version=0x502+ -roscompat MD5Final(ptr) ntdll.MD5Final
@ stdcall -version=0x502 -noroscompat MD5Init(ptr)
@ stdcall -version=0x600+ -noroscompat MD5Init(ptr) ntdll.MD5Init
@ stdcall -version=0x502+ -roscompat MD5Init(ptr) ntdll.MD5Init
@ stdcall -version=0x502 -noroscompat MD5Update(ptr ptr long)
@ stdcall -version=0x600+ -noroscompat MD5Update(ptr ptr long) ntdll.MD5Update
@ stdcall -version=0x502+ -roscompat MD5Update(ptr ptr long) ntdll.MD5Update
@ stub MSChapSrvChangePassword2
@ stub MSChapSrvChangePassword
@ stdcall MakeAbsoluteSD2(ptr ptr)
@@ -455,10 +470,12 @@
@ stdcall PrivilegedServiceAuditAlarmW(wstr wstr long ptr long)
@ stub ProcessIdleTasks
@ stdcall ProcessTrace(ptr long ptr ptr)
@ stdcall -version=0x502 QueryAllTracesA(ptr long ptr) ntdll.EtwQueryAllTracesA
@ stdcall -stub -version=0x600+ QueryAllTracesA(ptr long ptr)
@ stdcall -version=0x502 QueryAllTracesW(ptr long ptr) ntdll.EtwQueryAllTracesW
@ stdcall -stub -version=0x600+ QueryAllTracesW(ptr long ptr)
@ stdcall -version=0x502 -noroscompat QueryAllTracesA(ptr long ptr) ntdll.EtwQueryAllTracesA
@ stdcall -version=0x600+ -noroscompat QueryAllTracesA(ptr long ptr) EtwQueryAllTracesA
@ stdcall -version=0x502+ -roscompat QueryAllTracesA(ptr long ptr) ntdll.EtwQueryAllTracesA
@ stdcall -version=0x502 -noroscompat QueryAllTracesW(ptr long ptr) ntdll.EtwQueryAllTracesW
@ stdcall -version=0x600+ -noroscompat QueryAllTracesW(ptr long ptr) EtwQueryAllTracesW
@ stdcall -version=0x502+ -roscompat QueryAllTracesW(ptr long ptr) ntdll.EtwQueryAllTracesW
@ stdcall QueryRecoveryAgentsOnEncryptedFile(wstr ptr)
@ stdcall QueryServiceConfig2A(long long ptr long ptr)
@ stdcall QueryServiceConfig2W(long long ptr long ptr)
@@ -469,10 +486,12 @@
@ stdcall QueryServiceObjectSecurity(long long ptr long ptr)
@ stdcall QueryServiceStatus(long ptr)
@ stdcall QueryServiceStatusEx(long long ptr long ptr)
@ stdcall -version=0x502 QueryTraceA(double str ptr) ntdll.EtwQueryTraceA
@ stdcall -stub -version=0x600+ QueryTraceA(double str ptr)
@ stdcall -version=0x502 QueryTraceW(double str ptr) ntdll.EtwQueryTraceW
@ stdcall -stub -version=0x600+ QueryTraceW(double str ptr)
@ stdcall -version=0x502 -noroscompat QueryTraceA(double str ptr) ntdll.EtwQueryTraceA
@ stdcall -version=0x600+ -noroscompat QueryTraceA(double str ptr) EtwQueryTraceA
@ stdcall -version=0x502+ -roscompat QueryTraceA(double str ptr) ntdll.EtwQueryTraceA
@ stdcall -version=0x502 -noroscompat QueryTraceW(double str ptr) ntdll.EtwQueryTraceW
@ stdcall -version=0x600+ -noroscompat QueryTraceW(double str ptr) EtwQueryTraceW
@ stdcall -version=0x502+ -roscompat QueryTraceW(double str ptr) ntdll.EtwQueryTraceW
@ stdcall QueryUsersOnEncryptedFile(wstr ptr)
@ stdcall ReadEncryptedFileRaw(ptr ptr ptr)
@ stdcall ReadEventLogA(long long long ptr long ptr ptr)
@@ -482,6 +501,8 @@
@ stub RegConnectRegistryExA
@ stub RegConnectRegistryExW
@ stdcall RegConnectRegistryW(wstr long ptr)
@ stdcall -version=0x600+ RegCopyTreeA(ptr str ptr)
@ stdcall -version=0x600+ RegCopyTreeW(ptr wstr ptr)
@ stdcall RegCreateKeyA(long str ptr)
@ stdcall RegCreateKeyExA(long str long ptr long long ptr ptr ptr)
@ stdcall RegCreateKeyExW(long wstr long ptr long long ptr ptr ptr)
@@ -490,6 +511,8 @@
@ stdcall RegDeleteKeyExA(long str long long)
@ stdcall RegDeleteKeyExW(long wstr long long)
@ stdcall RegDeleteKeyW(long wstr)
@ stdcall -version=0x600+ RegDeleteTreeA(long str)
@ stdcall -version=0x600+ RegDeleteTreeW(long wstr)
@ stdcall RegDeleteValueA(long str)
@ stdcall RegDeleteValueW(long wstr)
@ stdcall RegDisablePredefinedCache()
@@ -533,6 +556,8 @@
@ stdcall RegSaveKeyExW(long str ptr long)
@ stdcall RegSaveKeyW(long ptr ptr)
@ stdcall RegSetKeySecurity(long long ptr)
@ stdcall -version=0x600+ RegSetKeyValueA(long str str long ptr long)
@ stdcall -version=0x600+ RegSetKeyValueW(long wstr wstr long ptr long)
@ stdcall RegSetValueA(long str long ptr long)
@ stdcall RegSetValueExA(long str long long ptr long)
@ stdcall RegSetValueExW(long wstr long long ptr long)
@@ -607,14 +632,18 @@
@ stdcall StartServiceCtrlDispatcherA(ptr)
@ stdcall StartServiceCtrlDispatcherW(ptr)
@ stdcall StartServiceW(long long ptr)
@ stdcall -version=0x502 StartTraceA(ptr str ptr) ntdll.EtwStartTraceA
@ stdcall -stub -version=0x600+ StartTraceA(ptr str ptr)
@ stdcall -version=0x502 StartTraceW(ptr wstr ptr) ntdll.EtwStartTraceW
@ stdcall -stub -version=0x600+ StartTraceW(ptr wstr ptr)
@ stdcall -version=0x502 StopTraceA(double str ptr) ntdll.EtwStopTraceA
@ stdcall -stub -version=0x600+ StopTraceA(double str ptr)
@ stdcall -version=0x502 StopTraceW(double wstr ptr) ntdll.EtwStopTraceW
@ stdcall -stub -version=0x600+ StopTraceW(double wstr ptr)
@ stdcall -version=0x502 -noroscompat StartTraceA(ptr str ptr) ntdll.EtwStartTraceA
@ stdcall -version=0x600+ -noroscompat StartTraceA(ptr str ptr) EtwStartTraceA
@ stdcall -version=0x502+ -roscompat StartTraceA(ptr str ptr) ntdll.EtwStartTraceA
@ stdcall -version=0x502 -noroscompat StartTraceW(ptr wstr ptr) ntdll.EtwStartTraceW
@ stdcall -version=0x600+ -noroscompat StartTraceW(ptr wstr ptr) EtwStartTraceW
@ stdcall -version=0x502+ -roscompat StartTraceW(ptr wstr ptr) ntdll.EtwStartTraceW
@ stdcall -version=0x502 -noroscompat StopTraceA(double str ptr) ntdll.EtwStopTraceA
@ stdcall -version=0x600+ -noroscompat StopTraceA(double str ptr) EtwStopTraceA
@ stdcall -version=0x502+ -roscompat StopTraceA(double str ptr) ntdll.EtwStopTraceA
@ stdcall -version=0x502 -noroscompat StopTraceW(double wstr ptr) ntdll.EtwStopTraceW
@ stdcall -version=0x600+ -noroscompat StopTraceW(double wstr ptr) EtwStopTraceW
@ stdcall -version=0x502+ -roscompat StopTraceW(double wstr ptr) ntdll.EtwStopTraceW
@ stdcall SystemFunction001(ptr ptr ptr)
@ stdcall SystemFunction002(ptr ptr ptr)
@ stdcall SystemFunction003(ptr ptr)
@@ -653,8 +682,9 @@
@ stdcall SystemFunction036(ptr long) # RtlGenRandom
@ stdcall SystemFunction040(ptr long long) # RtlEncryptMemory
@ stdcall SystemFunction041(ptr long long) # RtlDecryptMemory
@ stdcall -version=0x502 TraceEvent(double ptr) ntdll.EtwTraceEvent
@ stdcall -stub -version=0x600+ TraceEvent(double ptr)
@ stdcall -version=0x502 -noroscompat TraceEvent(double ptr) ntdll.EtwTraceEvent
@ stdcall -version=0x600+ -noroscompat TraceEvent(double ptr) EtwTraceEvent
@ stdcall -version=0x502+ -roscompat TraceEvent(double ptr) ntdll.EtwTraceEvent
@ stdcall TraceEventInstance(double ptr ptr ptr) ntdll.EtwTraceEventInstance
@ varargs TraceMessage() ntdll.EtwTraceMessage
@ stdcall TraceMessageVa() ntdll.EtwTraceMessageVa
@@ -666,10 +696,12 @@
@ stdcall UnlockServiceDatabase(ptr)
@ stub UnregisterIdleTask
@ stdcall UnregisterTraceGuids(double) ntdll.EtwUnregisterTraceGuids
@ stdcall -version=0x502 UpdateTraceA(double str ptr) ntdll.EtwUpdateTraceA
@ stdcall -stub -version=0x600+ UpdateTraceA(double str ptr)
@ stdcall -version=0x502 UpdateTraceW(double wstr ptr) ntdll.EtwUpdateTraceW
@ stdcall -stub -version=0x600+ UpdateTraceW(double wstr ptr)
@ stdcall -version=0x502 -noroscompat UpdateTraceA(double str ptr) ntdll.EtwUpdateTraceA
@ stdcall -version=0x600+ -noroscompat UpdateTraceA(double str ptr) EtwUpdateTraceA
@ stdcall -version=0x502+ -roscompat UpdateTraceA(double str ptr) ntdll.EtwUpdateTraceA
@ stdcall -version=0x502 -noroscompat UpdateTraceW(double wstr ptr) ntdll.EtwUpdateTraceW
@ stdcall -version=0x600+ -noroscompat UpdateTraceW(double wstr ptr) EtwUpdateTraceW
@ stdcall -version=0x502+ -roscompat UpdateTraceW(double wstr ptr) ntdll.EtwUpdateTraceW
@ stub WdmWmiServiceMain
@ stub WmiCloseBlock
@ stub WmiCloseTraceWithCursor
@@ -687,10 +719,12 @@
@ stub WmiGetTraceHeader
@ stub WmiMofEnumerateResourcesA
@ stub WmiMofEnumerateResourcesW
@ stdcall -version=0x502 WmiNotificationRegistrationA(ptr long ptr long long) ntdll.EtwNotificationRegistrationA
@ stdcall -stub -version=0x600+ WmiNotificationRegistrationA(ptr long ptr long long)
@ stdcall -version=0x502 WmiNotificationRegistrationW(ptr long ptr long long) ntdll.EtwNotificationRegistrationW
@ stdcall -stub -version=0x600+ WmiNotificationRegistrationW(ptr long ptr long long)
@ stdcall -version=0x502 -noroscompat WmiNotificationRegistrationA(ptr long ptr long long) ntdll.EtwNotificationRegistrationA
@ stdcall -version=0x600+ -noroscompat WmiNotificationRegistrationA(ptr long ptr long long) EtwNotificationRegistrationA
@ stdcall -version=0x502+ -roscompat WmiNotificationRegistrationA(ptr long ptr long long) ntdll.EtwNotificationRegistrationA
@ stdcall -version=0x502 -noroscompat WmiNotificationRegistrationW(ptr long ptr long long) ntdll.EtwNotificationRegistrationW
@ stdcall -version=0x600+ -noroscompat WmiNotificationRegistrationW(ptr long ptr long long) EtwNotificationRegistrationW
@ stdcall -version=0x502+ -roscompat WmiNotificationRegistrationW(ptr long ptr long long) ntdll.EtwNotificationRegistrationW
@ stub WmiOpenBlock
@ stub WmiOpenTraceWithCursor
@ stub WmiParseTraceEvent
@@ -703,10 +737,12 @@
@ stub WmiQuerySingleInstanceMultipleA
@ stub WmiQuerySingleInstanceMultipleW
@ stub WmiQuerySingleInstanceW
@ stdcall -version=0x502 WmiReceiveNotificationsA(long long long long) ntdll.EtwReceiveNotificationsA
@ stdcall -stub -version=0x600+ WmiReceiveNotificationsA(long long long long)
@ stdcall -version=0x502 WmiReceiveNotificationsW(long long long long) ntdll.EtwReceiveNotificationsW
@ stdcall -stub -version=0x600+ WmiReceiveNotificationsW(long long long long)
@ stdcall -version=0x502 -noroscompat WmiReceiveNotificationsA(long long long long) ntdll.EtwReceiveNotificationsA
@ stdcall -version=0x600+ -noroscompat WmiReceiveNotificationsA(long long long long) EtwReceiveNotificationsA
@ stdcall -version=0x502+ -roscompat WmiReceiveNotificationsA(long long long long) ntdll.EtwReceiveNotificationsA
@ stdcall -version=0x502 -noroscompat WmiReceiveNotificationsW(long long long long) ntdll.EtwReceiveNotificationsW
@ stdcall -version=0x600+ -noroscompat WmiReceiveNotificationsW(long long long long) EtwReceiveNotificationsW
@ stdcall -version=0x502+ -roscompat WmiReceiveNotificationsW(long long long long) ntdll.EtwReceiveNotificationsW
@ stub WmiSetSingleInstanceA
@ stub WmiSetSingleInstanceW
@ stub WmiSetSingleItemA

View File

@@ -3,7 +3,6 @@ remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502)
add_definitions(-D_WIN32_WINNT=0x600 -DWINVER=0x600)
add_definitions(-D_ADVAPI32_ -D_ADVAPI32_VISTA_)
spec2def(advapi32_vista.dll advapi32_vista.spec ADD_IMPORTLIB)
include_directories(
../advapi32
@@ -15,9 +14,20 @@ list(APPEND SOURCE
../advapi32/reg/reg.c
${CMAKE_CURRENT_BINARY_DIR}/advapi32_vista.def)
add_library(advapi32_vista MODULE ${SOURCE} advapi32_vista.rc)
set_module_type(advapi32_vista win32dll ENTRYPOINT DllMain 12)
target_link_libraries(advapi32_vista wine ${PSEH_LIB})
add_importlibs(advapi32_vista advapi32 kernel32 ntdll)
add_dependencies(advapi32_vista psdk advapi32)
add_cd_file(TARGET advapi32_vista DESTINATION reactos/system32 FOR all)
if(DLL_EXPORT_VERSION GREATER_EQUAL 0x600)
# On NT6+ builds this is an empty interface library
add_library(libadvapi32_vista INTERFACE)
target_sources(libadvapi32_vista INTERFACE $<TARGET_OBJECTS:roscompat_desc>)
else()
# On pre-NT6 builds we create an additional DLL
spec2def(advapi32_vista.dll advapi32_vista.spec ADD_IMPORTLIB)
add_library(advapi32_vista MODULE ${SOURCE} advapi32_vista.rc)
set_module_type(advapi32_vista win32dll ENTRYPOINT DllMain 12)
target_link_libraries(advapi32_vista wine ${PSEH_LIB})
add_importlibs(advapi32_vista advapi32 kernel32 ntdll)
add_dependencies(advapi32_vista psdk advapi32)
add_cd_file(TARGET advapi32_vista DESTINATION reactos/system32 FOR all)
endif()
# Implicitly link against advapi32
target_link_libraries(libadvapi32_vista INTERFACE libadvapi32)

View File

@@ -34,6 +34,6 @@ add_typelib(atl_lib.idl)
add_dependencies(atl stdole2)
set_module_type(atl win32dll)
target_link_libraries(atl uuid wine)
add_importlibs(atl oleaut32 ole32 user32 gdi32 advapi32 advapi32_vista shlwapi msvcrt kernel32 ntdll)
add_importlibs(atl oleaut32 ole32 user32 gdi32 advapi32_vista shlwapi msvcrt kernel32 ntdll)
add_pch(atl precomp.h SOURCE)
add_cd_file(TARGET atl DESTINATION reactos/system32 FOR all)

View File

@@ -22,6 +22,6 @@ add_library(atl100 MODULE
set_module_type(atl100 win32dll)
target_link_libraries(atl100 uuid wine)
add_importlibs(atl100 ole32 oleaut32 user32 gdi32 advapi32 advapi32_vista shlwapi msvcrt kernel32 ntdll)
add_importlibs(atl100 ole32 oleaut32 user32 gdi32 advapi32_vista shlwapi msvcrt kernel32 ntdll)
add_pch(atl100 precomp.h SOURCE)
add_cd_file(TARGET atl100 DESTINATION reactos/system32 FOR all)

View File

@@ -22,6 +22,6 @@ add_library(atl80 MODULE
set_module_type(atl80 win32dll)
target_link_libraries(atl80 uuid wine)
add_importlibs(atl80 oleaut32 user32 ole32 gdi32 advapi32 advapi32_vista shlwapi msvcrt kernel32 ntdll)
add_importlibs(atl80 oleaut32 user32 ole32 gdi32 advapi32_vista shlwapi msvcrt kernel32 ntdll)
add_pch(atl80 precomp.h SOURCE)
add_cd_file(TARGET atl80 DESTINATION reactos/system32 FOR all)

View File

@@ -62,6 +62,7 @@ add_library(comctl32 MODULE
${SOURCE}
${PCH_SKIP_SOURCE}
rsrc.rc
${CMAKE_CURRENT_BINARY_DIR}/comctl32_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/comctl32.def)
if(MSVC)

View File

@@ -55,6 +55,6 @@ endif()
set_module_type(crypt32 win32dll)
target_link_libraries(crypt32 wine ${PSEH_LIB} oldnames)
add_delay_importlibs(crypt32 cryptnet)
add_importlibs(crypt32 bcrypt user32 advapi32 advapi32_vista msvcrt kernel32 ntdll)
add_importlibs(crypt32 bcrypt user32 advapi32_vista msvcrt kernel32 ntdll)
add_pch(crypt32 precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET crypt32 DESTINATION reactos/system32 FOR all)

View File

@@ -153,6 +153,7 @@ INT __WideCharToMultiByte( UINT page, DWORD flags, LPCWSTR src, INT srclen, LPST
#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
#define IMAGE_DEBUG_MISC_EXENAME 1
#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
#if 0
typedef struct _IMAGE_EXPORT_DIRECTORY {
DWORD Characteristics;
DWORD TimeDateStamp;
@@ -166,6 +167,7 @@ typedef struct _IMAGE_EXPORT_DIRECTORY {
DWORD AddressOfNames;
DWORD AddressOfNameOrdinals;
} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
#endif
typedef struct _IMAGE_DEBUG_MISC {
DWORD DataType;
DWORD Length;

View File

@@ -10,7 +10,7 @@ list(APPEND COMMON_SOURCE
assembly.c
fusion.c
precomp.h
${CMAKE_CURRENT_BINARY_DIR}/fusion_stubs.c)
)
add_library(fusion_common STATIC ${COMMON_SOURCE})
add_dependencies(fusion_common psdk)
@@ -18,6 +18,7 @@ add_pch(fusion_common precomp.h COMMON_SOURCE)
add_library(fusion MODULE
version.rc
${CMAKE_CURRENT_BINARY_DIR}/fusion_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/fusion.def)
set_module_type(fusion win32dll)

View File

@@ -6,6 +6,7 @@ spec2def(fusion.dll fusion.spec)
add_library(fusion_1_1 MODULE
${fusion_folder}/version.rc
${CMAKE_CURRENT_BINARY_DIR}/fusion_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/fusion.def)
set_module_type(fusion_1_1 win32dll)

View File

@@ -6,6 +6,7 @@ spec2def(fusion.dll fusion.spec)
add_library(fusion_2_0 MODULE
${fusion_folder}/version.rc
${CMAKE_CURRENT_BINARY_DIR}/fusion_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/fusion.def)
set_module_type(fusion_2_0 win32dll)

View File

@@ -23,6 +23,6 @@ add_library(inseng MODULE
set_module_type(inseng win32dll)
target_link_libraries(inseng uuid wine)
add_importlibs(inseng ole32 urlmon kernel32_vista msvcrt kernel32 ntdll)
add_importlibs(inseng ole32 urlmon msvcrt kernel32_vista ntdll)
add_pch(inseng precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET inseng DESTINATION reactos/system32 FOR all)

View File

@@ -32,7 +32,7 @@
@ stub -version=0x600+ BaseGenerateAppCompatData
@ stdcall BaseInitAppcompatCacheSupport()
@ stdcall BaseIsAppcompatInfrastructureDisabled() IsShimInfrastructureDisabled
@ stdcall -version=0x501-0x502 BaseProcessInitPostImport()
@ stdcall -version=0x501-0x502 -noroscompat BaseProcessInitPostImport()
@ stdcall -version=0x600+ BaseProcessInitPostImport() # HACK: This export is dynamicaly imported by ntdll
;@ stdcall -version=0x502 -arch=x86_64 BaseProcessStart()
@ stdcall BaseQueryModuleData(str str ptr ptr ptr) ;check

View File

@@ -4,7 +4,6 @@ add_definitions(-D_WIN32_WINNT=0x600 -DWINVER=0x600)
add_definitions(-D_KERNEL32_)
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/subsys ..)
spec2def(kernel32_vista.dll kernel32_vista.spec ADD_IMPORTLIB)
list(APPEND SOURCE
firmware.c
@@ -25,13 +24,25 @@ add_library(kernel32_vista_static ${SOURCE})
target_link_libraries(kernel32_vista_static ${PSEH_LIB})
add_dependencies(kernel32_vista_static psdk)
add_library(kernel32_vista MODULE
DllMain.c
kernel32_vista.rc
${CMAKE_CURRENT_BINARY_DIR}/kernel32_vista.def)
set_module_type(kernel32_vista win32dll ENTRYPOINT DllMain 12)
target_link_libraries(kernel32_vista kernel32_vista_static kernel32_shared)
add_importlibs(kernel32_vista kernel32 ntdll_vista ntdll)
add_delay_importlibs(kernel32_vista ntdll_vista)
add_dependencies(kernel32_vista psdk)
add_cd_file(TARGET kernel32_vista DESTINATION reactos/system32 FOR all)
if(DLL_EXPORT_VERSION GREATER_EQUAL 0x600)
# On NT6+ builds this is an empty interface library
add_library(libkernel32_vista INTERFACE)
target_sources(libkernel32_vista INTERFACE $<TARGET_OBJECTS:roscompat_desc>)
else()
# On pre-NT6 builds we create an additional DLL
spec2def(kernel32_vista.dll kernel32_vista.spec ADD_IMPORTLIB)
add_library(kernel32_vista MODULE
DllMain.c
kernel32_vista.rc
${CMAKE_CURRENT_BINARY_DIR}/kernel32_vista_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/kernel32_vista.def)
set_module_type(kernel32_vista win32dll ENTRYPOINT DllMain 12)
target_link_libraries(kernel32_vista kernel32_vista_static kernel32_shared)
add_importlibs(kernel32_vista kernel32 ntdll_vista)
add_delay_importlibs(kernel32_vista ntdll_vista)
add_dependencies(kernel32_vista psdk)
add_cd_file(TARGET kernel32_vista DESTINATION reactos/system32 FOR all)
endif()
# Implicitly link against kernel32
target_link_libraries(libkernel32_vista INTERFACE libkernel32)

View File

@@ -32,7 +32,7 @@ add_library(msctf MODULE
set_module_type(msctf win32dll UNICODE)
target_link_libraries(msctf uuid wine cicero)
add_importlibs(msctf user32 advapi32 advapi32_vista msvcrt kernel32 ntdll)
add_importlibs(msctf user32 advapi32_vista msvcrt kernel32 ntdll)
add_delay_importlibs(msctf shell32 shlwapi ole32 oleaut32 imm32 gdi32)
add_pch(msctf precomp.h SOURCE)
add_cd_file(TARGET msctf DESTINATION reactos/system32 FOR all)

View File

@@ -87,13 +87,12 @@ set_module_type(msi win32dll)
target_link_libraries(msi uuid ${PSEH_LIB} wine_dll_register oldnames)
add_dependencies(msi msi_idlheader)
add_delay_importlibs(msi odbccp32 crypt32 wintrust apphelp)
add_importlibs(msi advapi32 advapi32_vista cabinet comctl32 gdi32 ole32 oleaut32 shell32 shlwapi rpcrt4 urlmon user32 version wininet sxs
add_importlibs(msi advapi32_vista cabinet comctl32 gdi32 ole32 oleaut32 shell32 shlwapi rpcrt4 urlmon user32 version wininet sxs
#FIXME : imagehlp, mspatcha should be in delayed imports
imagehlp
mspatcha
msvcrt
kernel32_vista
kernel32
ntdll)
add_pch(msi precomp.h "${PCH_SKIP_SOURCE}")

View File

@@ -241,8 +241,8 @@
@ cdecl -arch=i386 -norelay __CxxFrameHandler2(ptr ptr ptr ptr) __CxxFrameHandler
@ cdecl -version=0x600+ -arch=x86_64 -norelay __CxxFrameHandler2(ptr ptr ptr ptr) __CxxFrameHandler
@ cdecl -arch=arm -norelay __CxxFrameHandler3(ptr ptr ptr ptr)
@ cdecl -version=0x600+ -arch=i386 -norelay __CxxFrameHandler3(ptr ptr ptr ptr)
@ cdecl -version=0x600+ -arch=x86_64 -norelay __CxxFrameHandler3(ptr ptr ptr ptr) __CxxFrameHandler
@ cdecl -version=0x600+ -arch=i386 -norelay -private __CxxFrameHandler3(ptr ptr ptr ptr) # We link the one from msvcrtex
@ cdecl -version=0x600+ -arch=x86_64 -norelay -private __CxxFrameHandler3(ptr ptr ptr ptr) __CxxFrameHandler # We link the one from msvcrtex
@ stdcall -arch=i386 __CxxLongjmpUnwind(ptr)
@ cdecl -arch=i386 __CxxQueryExceptionSize()
@ cdecl -arch=i386 __CxxRegisterExceptionObject()
@@ -1035,7 +1035,7 @@
@ cdecl -version=0x600+ _strupr_s_l(str long ptr)
@ cdecl -version=0x600+ _strxfrm_l(ptr str long ptr)
@ cdecl _swab(str str long)
@ cdecl -version=0x400-0x502 -impsym _swprintf(ptr str) swprintf # Compatibility for pre NT6
@ cdecl -version=0x400-0x502 -noroscompat -impsym _swprintf(ptr str) swprintf # Compatibility for pre NT6
@ cdecl -version=0x600+ _swprintf(ptr str)
@ stub -version=0x600+ _swprintf_c
@ stub -version=0x600+ _swprintf_c_l
@@ -1085,7 +1085,7 @@
@ stub -version=0x600+ _vcprintf_p_l
@ stub -version=0x600+ _vcprintf_s
@ stub -version=0x600+ _vcprintf_s_l
@ stub -version=0x600+ _vcwprintf
@ cdecl -version=0x600+ _vcwprintf(wstr ptr)
@ stub -version=0x600+ _vcwprintf_l
@ stub -version=0x600+ _vcwprintf_p
@ stub -version=0x600+ _vcwprintf_p_l
@@ -1123,7 +1123,7 @@
@ stub -version=0x600+ _vsprintf_p
@ stub -version=0x600+ _vsprintf_p_l
@ stub -version=0x600+ _vsprintf_s_l
@ cdecl -version=0x400-0x502 -impsym _vswprintf() vswprintf # Compatibility for pre NT6
@ cdecl -version=0x400-0x502 -noroscompat -impsym _vswprintf() vswprintf # Compatibility for pre NT6
@ stub -version=0x600+ _vswprintf
@ stub -version=0x600+ _vswprintf_c
@ stub -version=0x600+ _vswprintf_c_l
@@ -1452,7 +1452,7 @@
@ cdecl sinh(double)
@ cdecl -arch=x86_64,arm sinhf(long)
@ varargs sprintf(ptr str)
@ stub -version=0x600+ sprintf_s
@ varargs -version=0x600+ sprintf_s()
@ cdecl sqrt(double)
@ cdecl -arch=x86_64,arm sqrtf(long)
@ cdecl srand(long)

View File

@@ -90,7 +90,7 @@ endif()
set_module_type(ole32 win32dll)
target_link_libraries(ole32 wine uuid ${PSEH_LIB})
add_delay_importlibs(ole32 oleaut32)
add_importlibs(ole32 advapi32 user32 gdi32 rpcrt4 msvcrt kernel32 kernel32_vista ntdll)
add_importlibs(ole32 advapi32 user32 gdi32 rpcrt4 msvcrt kernel32_vista ntdll)
add_dependencies(ole32 ole32idl)
add_pch(ole32 precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET ole32 DESTINATION reactos/system32 FOR all)

View File

@@ -60,6 +60,6 @@ add_dependencies(oleaut32 oleaut32_idlheader)
set_module_type(oleaut32 win32dll)
target_link_libraries(oleaut32 wine wineldr uuid ${PSEH_LIB})
add_delay_importlibs(oleaut32 comctl32 urlmon windowscodecs)
add_importlibs(oleaut32 ole32 rpcrt4 user32 gdi32 advapi32 kernel32_vista msvcrt kernel32 ntdll)
add_importlibs(oleaut32 ole32 rpcrt4 user32 gdi32 advapi32 msvcrt kernel32_vista ntdll)
add_pch(oleaut32 precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET oleaut32 DESTINATION reactos/system32 FOR all)

View File

@@ -14,5 +14,5 @@ list(APPEND SOURCE
add_library(pdh MODULE ${SOURCE})
set_module_type(pdh win32dll)
target_link_libraries(pdh wine)
add_importlibs(pdh msvcrt kernel32_vista kernel32 ntdll)
add_importlibs(pdh msvcrt kernel32_vista ntdll)
add_cd_file(TARGET pdh DESTINATION reactos/system32 FOR all)

View File

@@ -66,7 +66,7 @@ endif()
set_module_type(rpcrt4 win32dll)
target_link_libraries(rpcrt4 wine uuid ${PSEH_LIB})
add_delay_importlibs(rpcrt4 iphlpapi wininet secur32 user32 oleaut32)
add_importlibs(rpcrt4 advapi32 advapi32_vista kernel32_vista ws2_32 msvcrt kernel32 ntdll)
add_importlibs(rpcrt4 advapi32_vista ws2_32 msvcrt kernel32_vista ntdll)
add_dependencies(rpcrt4 ndr_types_header)
add_pch(rpcrt4 precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET rpcrt4 DESTINATION reactos/system32 FOR all)

View File

@@ -20,6 +20,7 @@ list(APPEND SOURCE
add_library(rsaenh MODULE
${SOURCE}
rsrc.rc
${CMAKE_CURRENT_BINARY_DIR}/rsaenh_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/rsaenh.def)
set_module_type(rsaenh win32dll)

View File

@@ -14,5 +14,5 @@ list(APPEND SOURCE
add_library(snmpapi MODULE ${SOURCE} snmpapi.rc)
set_module_type(snmpapi win32dll)
target_link_libraries(snmpapi wine)
add_importlibs(snmpapi msvcrt kernel32_vista kernel32 ntdll)
add_importlibs(snmpapi msvcrt kernel32_vista ntdll)
add_cd_file(TARGET snmpapi DESTINATION reactos/system32 FOR all)

View File

@@ -2,9 +2,9 @@
2 stdcall GenericChainFinalProv(ptr) wintrust.GenericChainFinalProv
3 stdcall HTTPSCertificateTrust(ptr) wintrust.HTTPSCertificateTrust
4 stdcall SoftpubDefCertInit(ptr) wintrust.SoftpubDefCertInit
5 stub SoftpubFreeDefUsageCallData
6 stub SoftpubLoadDefUsageCallData
7 stub AddPersonalTrustDBPages
5 stdcall SoftpubFreeDefUsageCallData(long ptr) wintrust.SoftpubFreeDefUsageCallData
6 stdcall SoftpubLoadDefUsageCallData(long ptr) wintrust.SoftpubLoadDefUsageCallData
7 stdcall AddPersonalTrustDBPages() wintrust.AddPersonalTrustDBPages
@ stdcall -private DllRegisterServer() wintrust.SoftpubDllRegisterServer
@ stdcall -private DllUnregisterServer() wintrust.SoftpubDllUnregisterServer
10 stdcall DriverCleanupPolicy(ptr) wintrust.DriverCleanupPolicy

View File

@@ -52,6 +52,6 @@ add_library(urlmon MODULE
set_module_type(urlmon win32dll)
target_link_libraries(urlmon uuid wine ${PSEH_LIB})
add_delay_importlibs(urlmon advpack)
add_importlibs(urlmon rpcrt4 propsys ole32 oleaut32 shlwapi shell32 wininet user32 advapi32 kernel32_vista msvcrt kernel32 ntdll)
add_importlibs(urlmon rpcrt4 propsys ole32 oleaut32 shlwapi shell32 wininet user32 advapi32 msvcrt kernel32_vista ntdll)
add_pch(urlmon precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET urlmon DESTINATION reactos/system32 FOR all)

View File

@@ -24,6 +24,6 @@ add_library(userenv MODULE
set_module_type(userenv win32dll)
target_link_libraries(userenv uuid)
add_importlibs(userenv advapi32 advapi32_vista user32 msvcrt kernel32 ntdll)
add_importlibs(userenv advapi32_vista user32 msvcrt kernel32 ntdll)
add_pch(userenv precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET userenv DESTINATION reactos/system32 FOR all)

View File

@@ -80,6 +80,6 @@ endif()
set_module_type(windowscodecs win32dll)
target_link_libraries(windowscodecs wine uuid ${PSEH_LIB})
add_importlibs(windowscodecs ole32 oleaut32 rpcrt4 shlwapi user32 gdi32 advapi32 advapi32_vista propsys msvcrt kernel32 ntdll)
add_importlibs(windowscodecs ole32 oleaut32 rpcrt4 shlwapi user32 gdi32 advapi32_vista propsys msvcrt kernel32 ntdll)
add_pch(windowscodecs precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET windowscodecs DESTINATION reactos/system32 FOR all)

View File

@@ -25,12 +25,13 @@ add_typelib(winhttp_tlb.idl)
add_library(winhttp MODULE
${SOURCE}
rsrc.rc
${CMAKE_CURRENT_BINARY_DIR}/winhttp_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/winhttp.def)
set_module_type(winhttp win32dll)
target_link_libraries(winhttp uuid wine)
add_delay_importlibs(winhttp oleaut32 crypt32 secur32)
add_importlibs(winhttp user32 advapi32 ws2_32 jsproxy kernel32_vista msvcrt kernel32 ntdll)
add_importlibs(winhttp user32 advapi32 ws2_32 jsproxy msvcrt kernel32_vista ntdll)
add_dependencies(winhttp stdole2)
add_pch(winhttp precomp.h SOURCE)
add_cd_file(TARGET winhttp DESTINATION reactos/system32 FOR all)

View File

@@ -48,6 +48,6 @@ set_module_type(wininet win32dll)
target_link_libraries(wininet wine ${PSEH_LIB} oldnames)
add_delay_importlibs(wininet secur32 crypt32 cryptui iphlpapi dhcpcsvc)
add_importlibs(wininet mpr shlwapi shell32 user32 advapi32 ws2_32 normaliz kernel32_vista msvcrt kernel32 ntdll)
add_importlibs(wininet mpr shlwapi shell32 user32 advapi32 ws2_32 normaliz msvcrt kernel32_vista ntdll)
add_pch(wininet precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET wininet DESTINATION reactos/system32 FOR all)

View File

@@ -30,7 +30,7 @@ list(APPEND wshom_rc_deps
set_source_files_properties(wshom.rc PROPERTIES OBJECT_DEPENDS "${wshom_rc_deps}")
set_module_type(wshom win32ocx)
target_link_libraries(wshom uuid wine)
add_importlibs(wshom oleaut32 ole32 shell32 advapi32 advapi32_vista user32 msvcrt kernel32 ntdll)
add_importlibs(wshom oleaut32 ole32 shell32 advapi32_vista user32 msvcrt kernel32 ntdll)
add_dependencies(wshom stdole2 wshom_idlheader)
add_pch(wshom precomp.h "${PCH_SKIP_SOURCE}")
add_cd_file(TARGET wshom DESTINATION reactos/system32 FOR all)

View File

@@ -12,7 +12,7 @@ function(add_hal _halname)
cmake_parse_arguments(_haldata "" "" "SOURCES;COMPONENTS" ${ARGN})
# Handle the spec file for the dll name
spec2def(${_halname}.dll ../hal.spec ADD_IMPORTLIB)
spec2def(${_halname}.dll ../hal.spec ADD_IMPORTLIB KERNELMODE)
# Create the actual target
foreach(_component ${_haldata_COMPONENTS})

View File

@@ -41,6 +41,7 @@ add_subdirectory(ole32)
add_subdirectory(opengl32)
add_subdirectory(pefile)
add_subdirectory(powrprof)
add_subdirectory(roscompat)
add_subdirectory(rtl)
add_subdirectory(sdk)
add_subdirectory(setupapi)

View File

@@ -55,6 +55,7 @@ START_TEST(NtReadFile)
trace("System is %d bits, Size of MDL: %lu\n", Is64BitSystem() ? 64 : 32, SizeOfMdl());
trace("Max MDL data size: 0x%lx bytes\n", LargeMdlMaxDataSize);
fprintf(stderr, "NtReadFile Line %u\n", __LINE__);
ByteOffset.QuadPart = 0;
Buffer = NULL;
@@ -71,6 +72,7 @@ START_TEST(NtReadFile)
return;
}
fprintf(stderr, "NtReadFile Line %u\n", __LINE__);
InitializeObjectAttributes(&ObjectAttributes,
&FileName,
OBJ_CASE_INSENSITIVE,
@@ -88,6 +90,7 @@ START_TEST(NtReadFile)
FILE_NO_INTERMEDIATE_BUFFERING,
NULL,
0);
fprintf(stderr, "NtReadFile Line %u\n", __LINE__);
ok_hex(Status, STATUS_SUCCESS);
ByteOffset.QuadPart = 0x10000;

View File

@@ -0,0 +1,5 @@
add_executable(roscompat_apitest roscompat.c testlist.c)
set_module_type(roscompat_apitest win32cui)
add_importlibs(roscompat_apitest msvcrt advapi32 kernel32)
add_rostests_file(TARGET roscompat_apitest)

View File

@@ -0,0 +1,133 @@
/*
* PROJECT: ReactOS API tests
* LICENSE: MIT (https://spdx.org/licenses/MIT)
* PURPOSE: Test for reactos compatibility layer
* COPYRIGHT: Copyright 2024 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
#include <apitest.h>
#include <windows.h>
#include <stdio.h>
#include <ndk/rtlfuncs.h>
DWORD g_WinVersion;
struct
{
PSTR DllName;
PSTR FunctionName;
ULONG MinVersion;
ULONG MaxVersion;
} g_TestCases[] =
{
{"ntdll.dll", "NtCreateChannel", 0x0500, 0x0500},
{"ntdll.dll", "LdrFindCreateProcessManifest", 0x0501, 0x0502},
{"ntdll.dll", "NtCreateEnlistment", 0x0600, 0xFFFF},
};
static
void
InsideCompatMode(PSTR CompatMode)
{
CHAR szEnvVar[20];
HMODULE hModule;
PVOID pAddress;
GetEnvironmentVariableA("__COMPAT_LAYER", szEnvVar, _countof(szEnvVar));
fprintf(stderr, "Running test as %s, __COMPAT_LAYER='%s', g_Winver=0x%lx\n",
CompatMode,
szEnvVar,
g_WinVersion);
for (ULONG i = 0; i < _countof(g_TestCases); i++)
{
fprintf(stderr, "i=%lu, 0x%lx [0x%lx .. 0x%lx]\n",
i,
g_WinVersion,
g_TestCases[i].MinVersion,
g_TestCases[i].MaxVersion);
hModule = LoadLibraryA(g_TestCases[i].DllName);
if (hModule == NULL)
{
printf("Failed to load %s\n", g_TestCases[i].DllName);
continue;
}
pAddress = GetProcAddress(hModule, g_TestCases[i].FunctionName);
if ((g_WinVersion >= g_TestCases[i].MinVersion) &&
(g_WinVersion <= g_TestCases[i].MaxVersion))
{
fprintf(stderr, "1\n");
ok(pAddress != NULL, "%s should be present\n", g_TestCases[i].FunctionName);
}
else
{
fprintf(stderr, "2\n");
ok(pAddress == NULL, "%s should not be present\n", g_TestCases[i].FunctionName);
}
FreeLibrary(hModule);
}
// TODO: Load a DLL with 0 exports and check if it's loaded
}
static
int
RunTestInCompatMode(PSTR CompatMode)
{
CHAR szCmdLine[MAX_PATH];
DWORD ret;
ret = GetModuleFileNameA(NULL, szCmdLine, _countof(szCmdLine));
lstrcatA(szCmdLine, " roscompat ");
lstrcatA(szCmdLine, CompatMode);
// Set the compatibility mode
SetEnvironmentVariableA("__COMPAT_LAYER", CompatMode);
// Run the test
ret = system(szCmdLine);
// Clear the compatibility mode
SetEnvironmentVariableA("__COMPAT_LAYER", NULL);
return ret;
}
BOOL
IsThisReactOS()
{
HKEY hKey;
LONG lRes;
lRes = RegOpenKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\ReactOS", &hKey);
return (lRes == ERROR_SUCCESS);
}
START_TEST(roscompat)
{
#if 0
if (!IsThisReactOS())
{
skip("This test is only for ReactOS\n")
return;
}
#endif
g_WinVersion = NtCurrentPeb()->OSMajorVersion << 8 | NtCurrentPeb()->OSMinorVersion;
if (__argc > 2)
{
InsideCompatMode(__argv[2]);
return;
}
RunTestInCompatMode("Win2k");
RunTestInCompatMode("WinXP");
RunTestInCompatMode("Win2k3");
RunTestInCompatMode("Vista");
RunTestInCompatMode("Win7");
RunTestInCompatMode("Win8");
}

View File

@@ -0,0 +1,14 @@
#define __ROS_LONG64__
#define STANDALONE
#include <wine/test.h>
extern void func_roscompat(void);
const struct test winetest_testlist[] =
{
{ "roscompat", func_roscompat },
{ 0, 0 }
};

View File

@@ -11,7 +11,7 @@ static const DWORD ListTimeout = 10000;
// This value needs to be lower than the <timeout> configured in sysreg.xml! (usually 180000)
// Otherwise, sysreg2 kills the VM before we can kill the process.
static const DWORD ProcessActivityTimeout = 170000;
static const DWORD ProcessActivityTimeout = 60000;
/**
@@ -294,6 +294,7 @@ CWineTest::RunTest(CTestInfo* TestInfo)
string tailString;
CPipe Pipe;
char Buffer[1024];
DWORD TimeutRepeats = 0;
ss << "Running Wine Test, Module: " << TestInfo->Module << ", Test: " << TestInfo->Test << endl;
StringOut(ss.str());
@@ -327,6 +328,18 @@ CWineTest::RunTest(CTestInfo* TestInfo)
}
else if (dwReadResult == WAIT_TIMEOUT)
{
if (++TimeutRepeats < 3)
{
// The process activity timeout above has elapsed without any new data.
// We'll try to read again, but only a few times.
float elapsed = ((float)GetTickCount() - StartTime)/1000;
stringstream ssTimeout;
ssTimeout << "[ROSAUTOTEST] Test timeout #" << TimeutRepeats;
ssTimeout << " @ " << elapsed << "s of test time. Retrying..." << endl;
StringOut(ssTimeout.str());
continue;
}
// The process activity timeout above has elapsed without any new data.
TESTEXCEPTION("Timeout while waiting for the test process\n");
}

View File

@@ -1438,6 +1438,13 @@ static void test_FakeDLL(void)
continue;
dll_func = (BYTE *)GetProcAddress(module, func_name);
#ifdef __REACTOS__
if (!dll_func)
{
/* Not a bug, but a feature (versioned exports) */
continue;
}
#endif /* __REACTOS__ */
ok(dll_func != NULL, "%s: GetProcAddress returned NULL\n", func_name);
#if defined(__i386__)
if (dll_func[0] == 0x90 && dll_func[1] == 0x90 &&

View File

@@ -115,5 +115,8 @@ endif()
set(USE_DUMMY_PSEH FALSE CACHE BOOL
"Whether to disable PSEH support.")
set(DLL_EXPORT_VERSION "0x502" CACHE STRING
set(DLL_EXPORT_VERSION "0xFFF" CACHE STRING
"The NT version the user mode DLLs target.")
set(ENABLE_EXPORT_VERSIONING TRUE CACHE BOOL
"Whether to enable export patching based on appcompat version.")

View File

@@ -370,11 +370,17 @@ function(fixup_load_config _target)
DEPENDS native-pefixup)
endfunction()
function(generate_import_lib _libname _dllname _spec_file __version_arg)
if(ENABLE_EXPORT_VERSIONING)
set(SPEC2DEF_NOROSCOMPAT "")
else()
set(SPEC2DEF_NOROSCOMPAT "--noroscompat")
endif()
function(generate_import_lib _libname _dllname _spec_file __version_arg __roscompat_arg)
# Generate the def for the import lib
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def
COMMAND native-spec2def ${__version_arg} -n=${_dllname} -a=${ARCH2} ${ARGN} --implib -d=${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
COMMAND native-spec2def ${__roscompat_arg} ${__version_arg} -n=${_dllname} -a=${ARCH2} ${ARGN} --implib -d=${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
# With this, we let DLLTOOL create an import library
@@ -424,7 +430,7 @@ endfunction()
function(spec2def _dllname _spec_file)
cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS;WITH_RELAY" "VERSION" "" ${ARGN})
cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS;WITH_RELAY;KERNELMODE" "VERSION" "" ${ARGN})
# Get library basename
get_filename_component(_file ${_dllname} NAME_WE)
@@ -438,7 +444,11 @@ function(spec2def _dllname _spec_file)
set(__with_relay_arg "--with-tracing")
endif()
if(__spec2def_VERSION)
set(__roscompat_arg ${SPEC2DEF_NOROSCOMPAT})
if(__spec2def_KERNELMODE)
set(__version_arg "--version=0x502")
set(__roscompat_arg "--noroscompat")
elseif(__spec2def_VERSION)
set(__version_arg "--version=0x${__spec2def_VERSION}")
else()
set(__version_arg "--version=${DLL_EXPORT_VERSION}")
@@ -447,7 +457,7 @@ function(spec2def _dllname _spec_file)
# Generate exports def and C stubs file for the DLL
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${__version_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
COMMAND native-spec2def ${__roscompat_arg} -n=${_dllname} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${__version_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
# Do not use precompiled headers for the stub file
@@ -459,7 +469,7 @@ function(spec2def _dllname _spec_file)
set(_extraflags --no-private-warnings)
endif()
generate_import_lib(lib${_file} ${_dllname} ${_spec_file} ${_extraflags} "${__version_arg}")
generate_import_lib(lib${_file} ${_dllname} ${_spec_file} ${_extraflags} "${__version_arg}" "${__roscompat_arg}")
endif()
endfunction()

View File

@@ -313,7 +313,13 @@ function(fixup_load_config _target)
# msvc knows how to generate a load_config so no hacks here
endfunction()
function(generate_import_lib _libname _dllname _spec_file __version_arg)
if(ENABLE_EXPORT_VERSIONING)
set(SPEC2DEF_NOROSCOMPAT "")
else()
set(SPEC2DEF_NOROSCOMPAT "--noroscompat")
endif()
function(generate_import_lib _libname _dllname _spec_file __version_arg __roscompat_arg)
set(_def_file ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_implib.def)
set(_asm_stubs_file ${CMAKE_CURRENT_BINARY_DIR}/${_libname}_stubs.asm)
@@ -322,7 +328,7 @@ function(generate_import_lib _libname _dllname _spec_file __version_arg)
# Generate the def, asm stub and alias files
add_custom_command(
OUTPUT ${_asm_stubs_file} ${_def_file} ${_asm_impalias_file}
COMMAND native-spec2def --ms ${__version_arg} -a=${SPEC2DEF_ARCH} --implib -n=${_dllname} -d=${_def_file} -l=${_asm_stubs_file} -i=${_asm_impalias_file} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
COMMAND native-spec2def ${__roscompat_arg} --ms ${__version_arg} -a=${SPEC2DEF_ARCH} --implib -n=${_dllname} -d=${_def_file} -l=${_asm_stubs_file} -i=${_asm_impalias_file} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
# Compile the generated asm stub file
@@ -372,7 +378,7 @@ else()
endif()
function(spec2def _dllname _spec_file)
cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS;WITH_RELAY" "VERSION" "" ${ARGN})
cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS;WITH_RELAY;KERNELMODE" "VERSION" "" ${ARGN})
# Get library basename
get_filename_component(_file ${_dllname} NAME_WE)
@@ -386,7 +392,11 @@ function(spec2def _dllname _spec_file)
set(__with_relay_arg "--with-tracing")
endif()
if(__spec2def_VERSION)
set(__roscompat_arg ${SPEC2DEF_NOROSCOMPAT})
if(__spec2def_KERNELMODE)
set(__version_arg "--version=0x502")
set(__roscompat_arg "--noroscompat")
elseif(__spec2def_VERSION)
set(__version_arg "--version=0x${__spec2def_VERSION}")
else()
set(__version_arg "--version=${DLL_EXPORT_VERSION}")
@@ -395,14 +405,14 @@ function(spec2def _dllname _spec_file)
# Generate exports def and C stubs file for the DLL
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${__version_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
COMMAND native-spec2def ${__roscompat_arg} --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${__version_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
# Do not use precompiled headers for the stub file
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
if(__spec2def_ADD_IMPORTLIB)
generate_import_lib(lib${_file} ${_dllname} ${_spec_file} "${__version_arg}")
generate_import_lib(lib${_file} ${_dllname} ${_spec_file} "${__version_arg}" "${__roscompat_arg}")
if(__spec2def_NO_PRIVATE_WARNINGS)
set_property(TARGET lib${_file} APPEND PROPERTY STATIC_LIBRARY_OPTIONS /ignore:4104)
endif()

View File

@@ -1,5 +1,7 @@
#pragma once
#include "typedefs.h"
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x010b
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x020b
@@ -85,6 +87,22 @@ typedef struct _IMAGE_DOS_HEADER {
} IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
#pragma pack(pop)
#pragma pack(push,4)
typedef struct _IMAGE_EXPORT_DIRECTORY {
ULONG Characteristics;
ULONG TimeDateStamp;
USHORT MajorVersion;
USHORT MinorVersion;
ULONG Name;
ULONG Base;
ULONG NumberOfFunctions;
ULONG NumberOfNames;
ULONG AddressOfFunctions;
ULONG AddressOfNames;
ULONG AddressOfNameOrdinals;
} IMAGE_EXPORT_DIRECTORY, * PIMAGE_EXPORT_DIRECTORY;
#pragma pack(pop)
#pragma pack(push,4)
typedef struct _IMAGE_FILE_HEADER {
WORD Machine;
@@ -102,7 +120,7 @@ typedef struct _IMAGE_DATA_DIRECTORY {
DWORD Size;
} IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY;
typedef struct _IMAGE_OPTIONAL_HEADER32 {
typedef struct _IMAGE_OPTIONAL_HEADER {
WORD Magic;
BYTE MajorLinkerVersion;
BYTE MinorLinkerVersion;

View File

@@ -1011,7 +1011,7 @@ WINBOOL WINAPI EnumPrintersW(DWORD Flags,LPWSTR Name,DWORD Level,LPBYTE pPrinter
LONG WINAPI DocumentPropertiesW(HWND hWnd,HANDLE hPrinter,LPWSTR pDeviceName,PDEVMODEW pDevModeOutput,PDEVMODEW pDevModeInput,DWORD fMode);
LONG WINAPI AdvancedDocumentPropertiesA(HWND hWnd,HANDLE hPrinter,LPSTR pDeviceName,PDEVMODEA pDevModeOutput,PDEVMODEA pDevModeInput);
LONG WINAPI AdvancedDocumentPropertiesW(HWND hWnd,HANDLE hPrinter,LPWSTR pDeviceName,PDEVMODEW pDevModeOutput,PDEVMODEW pDevModeInput);
LONG ExtDeviceMode(HWND hWnd,HANDLE hInst,LPDEVMODEA pDevModeOutput,LPSTR pDeviceName,LPSTR pPort,LPDEVMODEA pDevModeInput,LPSTR pProfile,DWORD fMode);
LONG WINAPI ExtDeviceMode(HWND hWnd,HANDLE hInst,LPDEVMODEA pDevModeOutput,LPSTR pDeviceName,LPSTR pPort,LPDEVMODEA pDevModeInput,LPSTR pProfile,DWORD fMode);
DWORD WINAPI GetPrinterDataA(HANDLE hPrinter,LPSTR pValueName,LPDWORD pType,LPBYTE pData,DWORD nSize,LPDWORD pcbNeeded);
DWORD WINAPI GetPrinterDataW(HANDLE hPrinter,LPWSTR pValueName,LPDWORD pType,LPBYTE pData,DWORD nSize,LPDWORD pcbNeeded);
DWORD WINAPI GetPrinterDataExA(HANDLE hPrinter,LPCSTR pKeyName,LPCSTR pValueName,LPDWORD pType,LPBYTE pData,DWORD nSize,LPDWORD pcbNeeded);

View File

@@ -0,0 +1,49 @@
/*!
\brief Header shared by ntdll/ldr and spec2def
*/
#pragma once
#ifdef ROSCOMPAT_HOST
#include "../host/pecoff.h"
#else
#endif
typedef enum _ROSCOMPAT_VERSION_BIT
{
ROSCOMPAT_VERSION_BIT_NT4 = 0,
ROSCOMPAT_VERSION_BIT_WIN2K = 1,
ROSCOMPAT_VERSION_BIT_WINXP = 2,
ROSCOMPAT_VERSION_BIT_WS03 = 3,
ROSCOMPAT_VERSION_BIT_VISTA = 4,
ROSCOMPAT_VERSION_BIT_WIN7 = 5,
ROSCOMPAT_VERSION_BIT_WIN8 = 6,
ROSCOMPAT_VERSION_BIT_WIN81 = 7,
ROSCOMPAT_VERSION_BIT_WIN10 = 8,
} ROSCOMPAT_VERSION_BIT;
typedef unsigned short ROSCOMPAT_VERMASK;
#if !defined(_WINNT_) && !defined(ROSCOMPAT_HOST)
typedef struct _IMAGE_EXPORT_DIRECTORY
{
unsigned long Characteristics;
unsigned long TimeDateStamp;
unsigned short MajorVersion;
unsigned short MinorVersion;
unsigned long Name;
unsigned long Base;
unsigned long NumberOfFunctions;
unsigned long NumberOfNames;
unsigned long AddressOfFunctions;
unsigned long AddressOfNames;
unsigned long AddressOfNameOrdinals;
} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
#endif
typedef struct _ROSCOMPAT_DESCRIPTOR
{
ROSCOMPAT_VERMASK* ExportMasks; // Array with size NumberOfExportNames
unsigned long NumberOfOrdinals;
unsigned long BaseOrdinal;
unsigned long *NumberOfValidExports;
} ROSCOMPAT_DESCRIPTOR, * PROSCOMPAT_DESCRIPTOR;

View File

@@ -1,4 +1,9 @@
#pragma once
#define __STUBS__H__
#include <roscompat.h>
#ifndef _WINDEF_
typedef unsigned short wchar_t;
typedef unsigned long DWORD, ULONG;

View File

@@ -40,6 +40,7 @@ add_subdirectory(lsalib)
add_subdirectory(nt)
add_subdirectory(pathcch)
add_subdirectory(pseh)
add_subdirectory(roscompat)
if(KDBG)
add_subdirectory(rossym)

View File

@@ -55,11 +55,11 @@ if(ARCH STREQUAL "i386")
elseif(ARCH STREQUAL "amd64")
list(APPEND MSVCRTEX_ASM_SOURCE
except/amd64/chkstk_ms.s)
if(MSVC AND DLL_EXPORT_VERSION LESS 0x600)
#if(MSVC AND DLL_EXPORT_VERSION LESS 0x600)
list(APPEND MSVCRTEX_ASM_SOURCE
except/amd64/__CxxFrameHandler3.s
)
endif()
#endif()
elseif(ARCH STREQUAL "arm")
list(APPEND MSVCRTEX_SOURCE
math/arm/__rt_sdiv.c

View File

@@ -0,0 +1,2 @@
add_library(roscompat_desc OBJECT roscompat_desc.c)

View File

@@ -0,0 +1,20 @@
#include <roscompat.h>
static unsigned long NumberOfValidExports = 0xFFFFFFFF;
#if defined(_MSC_VER)
#pragma section(".expvers$ZZZ")
__declspec(allocate(".expvers$ZZZ"))
#elif defined(__GNUC__)
__attribute__ ((section(".expvers$ZZZ")))
#else
#error Your compiler is not supported.
#endif
ROSCOMPAT_DESCRIPTOR __roscompat_dummy_descriptor__ =
{
0,
0,
1,
&NumberOfValidExports
};

View File

@@ -24,7 +24,6 @@ add_host_tool(mkshelllink mkshelllink/mkshelllink.c)
add_host_tool(obj2bin obj2bin/obj2bin.c)
target_link_libraries(obj2bin PRIVATE host_includes)
add_host_tool(spec2def spec2def/spec2def.c)
add_host_tool(utf16le utf16le/utf16le.cpp)
add_subdirectory(asmpp)
@@ -37,6 +36,7 @@ add_subdirectory(kbdtool)
add_subdirectory(log2lines)
add_subdirectory(mkhive)
add_subdirectory(mkisofs)
add_subdirectory(spec2def)
add_subdirectory(rsym)
add_subdirectory(txt2nls)
add_subdirectory(unicode)

View File

@@ -0,0 +1,4 @@
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos)
add_host_tool(spec2def spec2def.c)

View File

@@ -4,6 +4,9 @@
#include <string.h>
#include <stdarg.h>
#define ROSCOMPAT_HOST
#include <roscompat.h>
#ifdef _MSC_VER
#define strcasecmp(_String1, _String2) _stricmp(_String1, _String2)
#define strncasecmp(_String1, _String2, _MaxCount) _strnicmp(_String1, _String2, _MaxCount)
@@ -28,8 +31,7 @@ typedef struct
int anArgs[30];
unsigned int uFlags;
int nNumber;
unsigned nStartVersion;
unsigned nEndVersion;
unsigned short uVersionMask;
int bVersionIncluded;
} EXPORT;
@@ -67,6 +69,7 @@ int gbImportLib = 0;
int gbNotPrivateNoWarn = 0;
int gbTracing = 0;
int giArch = ARCH_X86;
int gbNoRosCompat = 0;
char *pszArchString = "i386";
char *pszArchString2;
char *pszSourceFileName = NULL;
@@ -110,6 +113,31 @@ enum
ARG_FLOAT
};
unsigned short
GetVersionMask(unsigned uStartVersion, unsigned uEndVersion)
{
unsigned short uMask = 0;
if ((uStartVersion <= 0x400) && (uEndVersion >= 0x400))
uMask |= (1 << ROSCOMPAT_VERSION_BIT_NT4);
if ((uStartVersion <= 0x500) && (uEndVersion >= 0x500))
uMask |= (1 << ROSCOMPAT_VERSION_BIT_WIN2K);
if ((uStartVersion <= 0x501) && (uEndVersion >= 0x501))
uMask |= (1 << ROSCOMPAT_VERSION_BIT_WINXP);
if ((uStartVersion <= 0x502) && (uEndVersion >= 0x502))
uMask |= (1 << ROSCOMPAT_VERSION_BIT_WS03);
if ((uStartVersion <= 0x600) && (uEndVersion >= 0x600))
uMask |= (1 << ROSCOMPAT_VERSION_BIT_VISTA);
if ((uStartVersion <= 0x601) && (uEndVersion >= 0x601))
uMask |= (1 << ROSCOMPAT_VERSION_BIT_WIN7);
if ((uStartVersion <= 0x602) && (uEndVersion >= 0x602))
uMask |= (1 << ROSCOMPAT_VERSION_BIT_WIN8);
if ((uStartVersion <= 0x603) && (uEndVersion >= 0x603))
uMask |= (1 << ROSCOMPAT_VERSION_BIT_WIN81);
if ((uStartVersion <= 0xA00) && (uEndVersion >= 0xA00))
uMask |= (1 << ROSCOMPAT_VERSION_BIT_WIN10);
return uMask;
}
const char* astrCallingConventions[] =
{
"STDCALL",
@@ -781,8 +809,8 @@ OutputLine_def(FILE *fileDest, EXPORT *pexp)
else
OutputLine_def_GCC(fileDest, pexp);
/* On GCC builds we force ordinals */
if ((pexp->uFlags & FL_ORDINAL) || (!gbMSComp && !gbImportLib))
/* If it is not an import lib, we force ordinals */
if ((pexp->uFlags & FL_ORDINAL) || !gbImportLib)
{
fprintf(fileDest, " @%d", pexp->nOrdinal);
}
@@ -964,8 +992,7 @@ ParseFile(char* pcStart, FILE *fileDest, unsigned *cExports)
exp.nArgCount = 0;
exp.uFlags = 0;
exp.nNumber++;
exp.nStartVersion = 0;
exp.nEndVersion = 0xFFFFFFFF;
exp.uVersionMask = 0xFFFF;
exp.bVersionIncluded = 1;
/* Skip white spaces */
@@ -1087,12 +1114,21 @@ ParseFile(char* pcStart, FILE *fileDest, unsigned *cExports)
{
if (giArch != ARCH_X86) included = 0;
}
else if (CompareToken(pc, "-roscompat"))
{
if (gbNoRosCompat) included = 0;
}
else if (CompareToken(pc, "-noroscompat"))
{
if (!gbNoRosCompat) included = 0;
}
else if (CompareToken(pc, "-version="))
{
const char *pcVersionStart = pc + 9;
/* Default to not included */
exp.bVersionIncluded = 0;
exp.bVersionIncluded = gbNoRosCompat ? 0 : 1;
exp.uVersionMask = 0;
pc += 8;
/* Look if we are included */
@@ -1132,8 +1168,7 @@ ParseFile(char* pcStart, FILE *fileDest, unsigned *cExports)
"Invalid version range");
}
exp.nStartVersion = version;
exp.nEndVersion = endversion;
exp.uVersionMask |= GetVersionMask(version, endversion);
/* Now compare the range with our version */
if ((guOsVersion >= version) &&
@@ -1421,6 +1456,7 @@ ApplyOrdinals(EXPORT* pexports, unsigned cExports)
{
unsigned short i, j;
char* used;
unsigned short firstOrdinal = 0xFFFF, firstIndex = 0;
/* Allocate a table to mark used ordinals */
used = malloc(65536);
@@ -1436,22 +1472,50 @@ ApplyOrdinals(EXPORT* pexports, unsigned cExports)
{
if (pexports[i].uFlags & FL_ORDINAL)
{
assert(pexports[i].nOrdinal >= 0 && pexports[i].nOrdinal <= 0xFFF);
if (used[pexports[i].nOrdinal] != 0)
{
fprintf(stderr, "Found duplicate ordinal: %u\n", pexports[i].nOrdinal);
return -1;
}
used[pexports[i].nOrdinal] = 1;
if (pexports[i].nOrdinal < firstOrdinal)
{
firstOrdinal = pexports[i].nOrdinal;
firstIndex = i;
}
}
}
/* Check if we found an ordinal */
if (firstOrdinal != 0xFFFF)
{
/* We did. Reserve ordinals for entries before that one. */
if (firstOrdinal > firstIndex)
firstOrdinal -= firstIndex;
else
firstOrdinal = 1;
}
else
{
/* We didn't, so start with 1 */
firstOrdinal = 1;
}
/* Pass 2: apply available ordinals */
for (i = 0, j = 1; i < cExports; i++)
for (i = 0, j = firstOrdinal; i < cExports; i++)
{
if ((pexports[i].uFlags & FL_ORDINAL) == 0 && pexports[i].bVersionIncluded)
{
while (used[j] != 0)
{
if (j >= 0xFFF)
{
fprintf(stderr, "Ran out of ordinals.");
return -1;
}
j++;
}
pexports[i].nOrdinal = j;
used[j] = 1;
@@ -1477,7 +1541,117 @@ void usage(void)
" --implib generate a def file for an import library\n"
" --no-private-warnings suppress warnings about symbols that should be -private\n"
" -a=<arch> set architecture to <arch> (i386, x86_64, arm, arm64)\n"
" --with-tracing generate wine-like \"+relay\" trace trampolines (needs -s)\n");
" --with-tracing generate wine-like \"+relay\" trace trampolines (needs -s)\n"
" --noroscompat don't generate ros-compat information\n");
}
// HACK, because mingw headers
#define MIN(a,b) ((a) <= (b) ? (a) : (b))
int CompareExports(const void* pLeft,const void* pRight)
{
EXPORT *pexpLeft = (EXPORT*)pLeft;
EXPORT *pexpRight = (EXPORT*)pRight;
int result = strncmp(pexpLeft->strName.buf,
pexpRight->strName.buf,
MIN(pexpLeft->strName.len,
pexpRight->strName.len));
if (result == 0)
{
return (pexpLeft->strName.len < pexpRight->strName.len) ? -1 : 1;
}
return result;
}
void
Output_RosCompatDescriptor(FILE *file, EXPORT *pexports, unsigned int cExports)
{
unsigned int i;
unsigned short ordinalToExport[0x10000];
unsigned short baseOrdinal = 0xFFFF;
unsigned short maxOrdinal = 0;
/* Initialize the ordinalToExport table */
memset(ordinalToExport, 0xFF, sizeof(ordinalToExport));
/* Fill in the ordinalToExport table */
for (i = 0; i < cExports; i++)
{
if (ordinalToExport[pexports[i].nOrdinal] != 0xFFFF)
{
fprintf(stderr, "Duplicate ordinal %d\n", pexports[i].nOrdinal);
exit(-1);
}
ordinalToExport[pexports[i].nOrdinal] = i;
if (pexports[i].nOrdinal < baseOrdinal)
{
baseOrdinal = pexports[i].nOrdinal;
}
if (pexports[i].nOrdinal > maxOrdinal)
{
maxOrdinal = pexports[i].nOrdinal;
}
}
fprintf(file, "unsigned short __roscompat_export_masks__[] =\n{\n");
for (unsigned short ordinal = baseOrdinal;
ordinal <= maxOrdinal;
ordinal++)
{
unsigned short iExport = ordinalToExport[ordinal];
if (iExport == 0xFFFF)
{
fprintf(file, " 0x0, // [%u]: Ordinal %u: <not exported>\n",
ordinal - baseOrdinal,
ordinal);
continue;
}
if (pexports[iExport].uFlags & FL_NONAME)
{
fprintf(file,
" 0x%04x, // [%u]: Ordinal %u: <noname>\n",
pexports[iExport].uVersionMask,
ordinal - baseOrdinal,
ordinal);
}
else
{
fprintf(file,
" 0x%04x, // [%u]: Ordinal %u: %.*s\n",
pexports[iExport].uVersionMask,
ordinal - baseOrdinal,
ordinal,
pexports[iExport].strName.len,
pexports[iExport].strName.buf);
}
}
fprintf(file,
" 0x0 // dummy \n"
"};\n"
"\n"
"static unsigned long NumberOfValidExports = 0;\n"
"\n"
"#if defined(_MSC_VER)\n"
"#pragma section(\".expvers$AAA\")\n"
"__declspec(allocate(\".expvers$AAA\"))\n"
"#elif defined(__GNUC__)\n"
"__attribute__ ((section(\".expvers$AAA\")))\n"
"#else\n"
"#error Your compiler is not supported (fix in spec2def).\n"
"#endif\n"
"ROSCOMPAT_DESCRIPTOR __roscompat_descriptor__ = \n"
"{\n"
" __roscompat_export_masks__,\n"
" (sizeof(__roscompat_export_masks__) / sizeof(__roscompat_export_masks__[0])) - 1,\n"
" %u,\n"
" &NumberOfValidExports\n"
"};\n",
baseOrdinal);
}
int main(int argc, char *argv[])
@@ -1506,6 +1680,10 @@ int main(int argc, char *argv[])
usage();
return 0;
}
else if (strcasecmp(argv[i], "--noroscompat") == 0)
{
gbNoRosCompat = 1;
}
else if (argv[i][1] == 'd' && argv[i][2] == '=')
{
pszDefFileName = argv[i] + 3;
@@ -1640,13 +1818,10 @@ int main(int argc, char *argv[])
return -1;
}
if (!gbMSComp)
if (ApplyOrdinals(pexports, cExports) < 0)
{
if (ApplyOrdinals(pexports, cExports) < 0)
{
fprintf(stderr, "error: could not apply ordinals!\n");
return -1;
}
fprintf(stderr, "error: could not apply ordinals!\n");
return -1;
}
if (pszDefFileName)
@@ -1688,6 +1863,11 @@ int main(int argc, char *argv[])
OutputLine_stub(file, &pexports[i]);
}
if (gbNoRosCompat == 0)
{
Output_RosCompatDescriptor(file, pexports, cExports);
}
fclose(file);
}

View File

@@ -364,3 +364,30 @@ void RosConvertUnicodeDevModeToAnsiDevmode(PDEVMODEW pDevModeInput, PDEVMODEA pD
memcpy( pDevModeOutput, pTmp, pTmp->dmSize + pTmp->dmDriverExtra); // Copy into a Wide char (Larger) buffer.
HeapFree(hProcessHeap, 0, pTmp);
}
VOID
WINAPI
DeviceMode(
PVOID param_1,
PVOID param_2,
PCHAR param_3,
PVOID param_4)
{
UNIMPLEMENTED;
}
LONG
WINAPI
ExtDeviceMode(
HWND hWnd,
HANDLE hInst,
LPDEVMODEA pDevModeOutput,
LPSTR pDeviceName,
LPSTR pPort,
LPDEVMODEA pDevModeInput,
LPSTR pProfile,
DWORD fMode)
{
UNIMPLEMENTED;
return 0;
}

View File

@@ -4059,3 +4059,36 @@ Cleanup:
SetLastError(dwErrorCode);
return (dwErrorCode == ERROR_SUCCESS);
}
HANDLE
WINAPI
CreatePrinterIC(
_In_ HANDLE hPrinter,
_In_opt_ LPDEVMODEW pDevMode)
{
UNIMPLEMENTED;
return NULL;
}
BOOL
WINAPI
DeletePrinterIC(
_In_ HANDLE hPrinterIC)
{
UNIMPLEMENTED;
return FALSE;
}
BOOL
WINAPI
PlayGdiScriptOnPrinterIC(
_In_ HANDLE hPrinterIC,
_In_reads_bytes_(cIn) LPBYTE pIn,
_In_ DWORD cIn,
_Out_writes_bytes_(cOut) LPBYTE pOut,
_In_ DWORD cOut,
_In_ DWORD ul)
{
UNIMPLEMENTED;
return FALSE;
}

View File

@@ -40,7 +40,7 @@
139 stub ConnectToPrinterDlg
140 stub ConvertAnsiDevModeToUnicodeDevmode
141 stub ConvertUnicodeDevModeToAnsiDevmode
142 stdcall -stub CreatePrinterIC(ptr ptr)
142 stdcall CreatePrinterIC(ptr ptr)
143 stdcall DEVICECAPABILITIES(str str long ptr ptr) DeviceCapabilitiesA
144 stdcall DEVICEMODE(ptr ptr str ptr) DeviceMode
145 stdcall DeleteFormA(ptr str)
@@ -64,7 +64,7 @@
163 stdcall DeletePrinterDriverExA(str str str long long)
164 stdcall DeletePrinterDriverExW(wstr wstr wstr long long)
165 stdcall DeletePrinterDriverW(wstr wstr wstr)
166 stdcall -stub DeletePrinterIC(ptr)
166 stdcall DeletePrinterIC(ptr)
167 stdcall DeletePrinterKeyA(ptr str)
168 stdcall DeletePrinterKeyW(ptr wstr)
169 stdcall DevQueryPrint(ptr ptr ptr)
@@ -72,7 +72,7 @@
171 stdcall DeviceCapabilities(str str long ptr ptr) DeviceCapabilitiesA
172 stdcall DeviceCapabilitiesA(str str long ptr ptr)
173 stdcall DeviceCapabilitiesW(wstr wstr long ptr ptr)
174 stdcall -stub DeviceMode(ptr ptr str ptr)
174 stdcall DeviceMode(ptr ptr str ptr)
175 stdcall DevicePropertySheets(ptr long)
176 stdcall DocumentEvent(ptr ptr long long ptr long ptr)
177 stdcall DocumentPropertiesA(ptr ptr str ptr ptr long)
@@ -134,7 +134,7 @@
233 stdcall EnumPrinterKeyW(ptr wstr wstr long ptr)
234 stdcall EnumPrintersA(long ptr long ptr long ptr ptr)
235 stdcall EnumPrintersW(long ptr long ptr long ptr ptr)
236 stdcall -stub ExtDeviceMode(ptr ptr ptr str str ptr str long)
236 stdcall ExtDeviceMode(ptr ptr ptr str str ptr str long)
237 stub FindClosePrinterChangeNotification
238 stub FindFirstPrinterChangeNotification
239 stub FindNextPrinterChangeNotification
@@ -161,7 +161,7 @@
260 stdcall IsValidDevmodeW(ptr long)
261 stdcall OpenPrinterA(str ptr ptr)
262 stdcall OpenPrinterW(wstr ptr ptr)
263 stdcall -stub PlayGdiScriptOnPrinterIC(ptr ptr long ptr long long)
263 stdcall PlayGdiScriptOnPrinterIC(ptr ptr long ptr long long)
264 stdcall PrinterMessageBoxA(ptr long ptr str str long)
265 stdcall PrinterMessageBoxW(ptr long ptr wstr wstr long)
266 stdcall PrinterProperties(ptr ptr)

View File

@@ -29,6 +29,6 @@ add_library(localspl MODULE
set_module_type(localspl win32dll UNICODE)
target_link_libraries(localspl skiplist16 wine)
add_importlibs(localspl user32 advapi32 advapi32_vista netapi32 rpcrt4 secur32 spoolss msvcrt kernel32 ntdll)
add_importlibs(localspl user32 advapi32_vista netapi32 rpcrt4 secur32 spoolss msvcrt kernel32 ntdll)
add_pch(localspl precomp.h SOURCE)
add_cd_file(TARGET localspl DESTINATION reactos/system32 FOR all)