From 9d617372d552faa96363415575c4fa2521df10f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gardou?= Date: Thu, 25 Sep 2014 18:25:02 +0000 Subject: [PATCH] =?UTF-8?q?[SPEC2DEF/CMAKE]=20=20-=20add=20a=20way=20to=20?= =?UTF-8?q?enable=20"relay=20tracing"=20(=C3=A0=20la=20wine)=20to=20module?= =?UTF-8?q?s.=20This=20uses=20wine's=20TRACE=20routine,=20debug=20channel?= =?UTF-8?q?=20being=20"relay"=20Use=20"WITH=5FRELAY"=20argument=20to=20cma?= =?UTF-8?q?ke=20macro=20spec2def=20to=20activate.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/trunk/; revision=64281 --- reactos/cmake/gcc.cmake | 18 ++++++++---------- reactos/include/reactos/stubs.h | 8 +++++++- reactos/tools/spec2def/spec2def.c | 16 ++++++++++++---- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/reactos/cmake/gcc.cmake b/reactos/cmake/gcc.cmake index cd6ce4a22f2..9b92c7f8c2e 100644 --- a/reactos/cmake/gcc.cmake +++ b/reactos/cmake/gcc.cmake @@ -306,14 +306,8 @@ endfunction() set(CMAKE_IMPLIB_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def --kill-at --output-lib=") set(CMAKE_IMPLIB_DELAYED_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def --kill-at --output-delaylib=") function(spec2def _dllname _spec_file) - # Do we also want to add importlib targets? - if(${ARGC} GREATER 2) - if(${ARGN} STREQUAL "ADD_IMPORTLIB") - set(__add_importlib TRUE) - else() - message(FATAL_ERROR "Wrong argument passed to spec2def, ${ARGN}") - endif() - endif() + + cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;WITH_RELAY" "" "" ${ARGN}) # Get library basename get_filename_component(_file ${_dllname} NAME_WE) @@ -323,13 +317,17 @@ function(spec2def _dllname _spec_file) message(FATAL_ERROR "spec2def only takes spec files as input.") endif() + if (__spec2def_WITH_RELAY) + set(__with_relay_arg "--with-tracing") + endif() + # 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 ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} + 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} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def) - if(__add_importlib) + if(__spec2def_ADD_IMPORTLIB) generate_import_lib(lib${_file} ${_dllname} ${_spec_file}) endif() endfunction() diff --git a/reactos/include/reactos/stubs.h b/reactos/include/reactos/stubs.h index 322b89b3e98..f81e53aa45c 100644 --- a/reactos/include/reactos/stubs.h +++ b/reactos/include/reactos/stubs.h @@ -1,13 +1,19 @@ #include #define WIN32_NO_STATUS #include -#include #include #include ULONG __cdecl DbgPrint(_In_z_ _Printf_format_string_ PCSTR Format, ...); +VOID +WINAPI +RaiseException(_In_ DWORD dwExceptionCode, + _In_ DWORD dwExceptionFlags, + _In_ DWORD nNumberOfArguments, + _In_ CONST ULONG_PTR *lpArguments OPTIONAL); + #define __wine_spec_unimplemented_stub(module, function) \ { \ ULONG_PTR args[2]; \ diff --git a/reactos/tools/spec2def/spec2def.c b/reactos/tools/spec2def/spec2def.c index 0bb66a0bc06..61357a2c328 100644 --- a/reactos/tools/spec2def/spec2def.c +++ b/reactos/tools/spec2def/spec2def.c @@ -764,12 +764,20 @@ ParseFile(char* pcStart, FILE *fileDest, PFNOUTLINE OutputLine) exp.nStackBytes += 8; exp.anArgs[exp.nArgCount] = ARG_DBL; } - else if (CompareToken(pc, "ptr") || - CompareToken(pc, "str") || - CompareToken(pc, "wstr")) + else if (CompareToken(pc, "ptr")) { exp.nStackBytes += 4; // sizeof(void*) on x86 - exp.anArgs[exp.nArgCount] = ARG_PTR; // FIXME: handle strings + exp.anArgs[exp.nArgCount] = ARG_PTR; + } + else if (CompareToken(pc, "str")) + { + exp.nStackBytes += 4; // sizeof(void*) on x86 + exp.anArgs[exp.nArgCount] = ARG_STR; + } + else if (CompareToken(pc, "wstr")) + { + exp.nStackBytes += 4; // sizeof(void*) on x86 + exp.anArgs[exp.nArgCount] = ARG_WSTR; } else if (CompareToken(pc, "int64")) {