Author: jgardou
Date: Thu Sep 25 18:25:02 2014
New Revision: 64281
URL: 
http://svn.reactos.org/svn/reactos?rev=64281&view=rev
Log:
[SPEC2DEF/CMAKE]
 - add a way to enable "relay tracing" (à la wine) to modules.
This uses wine's TRACE routine, debug channel being "relay"
Use "WITH_RELAY" argument to cmake macro spec2def to activate.
Modified:
    trunk/reactos/cmake/gcc.cmake
    trunk/reactos/include/reactos/stubs.h
    trunk/reactos/tools/spec2def/spec2def.c
Modified: trunk/reactos/cmake/gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/gcc.cmake?rev=64281&…
==============================================================================
--- trunk/reactos/cmake/gcc.cmake       [iso-8859-1] (original)
+++ trunk/reactos/cmake/gcc.cmake       [iso-8859-1] Thu Sep 25 18:25:02 2014
@@ -306,14 +306,8 @@
 set(CMAKE_IMPLIB_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS>
--kill-at --output-lib=<TARGET>")
 set(CMAKE_IMPLIB_DELAYED_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def
<OBJECTS> --kill-at --output-delaylib=<TARGET>")
 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 @@
         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()
Modified: trunk/reactos/include/reactos/stubs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/stubs.h?re…
==============================================================================
--- trunk/reactos/include/reactos/stubs.h       [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/stubs.h       [iso-8859-1] Thu Sep 25 18:25:02 2014
@@ -1,12 +1,18 @@
 #include <stdarg.h>
 #define WIN32_NO_STATUS
 #include <windef.h>
-#include <winbase.h>
 #include <wine/config.h>
 #include <wine/exception.h>
 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) \
 { \
Modified: trunk/reactos/tools/spec2def/spec2def.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/spec2def/spec2def.c?…
==============================================================================
--- trunk/reactos/tools/spec2def/spec2def.c     [iso-8859-1] (original)
+++ trunk/reactos/tools/spec2def/spec2def.c     [iso-8859-1] Thu Sep 25 18:25:02 2014
@@ -764,12 +764,20 @@
                     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"))
                 {