From a09d5bae0fd094ea6657c11c3ac2e613b325f384 Mon Sep 17 00:00:00 2001 From: Mark Jansen Date: Mon, 24 Oct 2022 21:56:54 +0200 Subject: [PATCH] [LOG2LINES] Compile the tool for MSVC builds --- CMakeLists.txt | 4 +--- dll/win32/dbghelp/CMakeLists.txt | 2 +- dll/win32/dbghelp/pe_module.c | 4 ++++ sdk/tools/CMakeLists.txt | 11 +++++------ sdk/tools/log2lines/CMakeLists.txt | 6 +++++- sdk/tools/log2lines/compat.h | 8 ++++++++ sdk/tools/log2lines/image.c | 1 + sdk/tools/rsym/rsym.h | 8 +++++--- 8 files changed, 30 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a581a80ed2..19b3c6b6931 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -147,9 +147,7 @@ if(NOT CMAKE_CROSSCOMPILING) endif() add_subdirectory(sdk/include/host) - if(NOT MSVC) - add_subdirectory(dll/win32/dbghelp) - endif() + add_subdirectory(dll/win32/dbghelp) add_subdirectory(sdk/tools) add_subdirectory(sdk/lib) diff --git a/dll/win32/dbghelp/CMakeLists.txt b/dll/win32/dbghelp/CMakeLists.txt index 3f858614a9e..5d46932e92b 100644 --- a/dll/win32/dbghelp/CMakeLists.txt +++ b/dll/win32/dbghelp/CMakeLists.txt @@ -1,6 +1,6 @@ if(NOT CMAKE_CROSSCOMPILING) - add_definitions(-DDBGHELP_STATIC_LIB) + add_definitions(-DDBGHELP_STATIC_LIB -DNONAMELESSUNION) include_directories( ${REACTOS_SOURCE_DIR}/tools) diff --git a/dll/win32/dbghelp/pe_module.c b/dll/win32/dbghelp/pe_module.c index 193876263ac..f11099e82f8 100644 --- a/dll/win32/dbghelp/pe_module.c +++ b/dll/win32/dbghelp/pe_module.c @@ -32,6 +32,10 @@ #include "winternl.h" #include "wine/debug.h" #include "wine/heap.h" +#else +#ifdef _MSC_VER +#define strcasecmp _stricmp +#endif #endif WINE_DEFAULT_DEBUG_CHANNEL(dbghelp); diff --git a/sdk/tools/CMakeLists.txt b/sdk/tools/CMakeLists.txt index 1df7a8adbcf..f7f4fd2ccce 100644 --- a/sdk/tools/CMakeLists.txt +++ b/sdk/tools/CMakeLists.txt @@ -34,8 +34,10 @@ add_subdirectory(hhpcomp) add_subdirectory(hpp) add_subdirectory(isohybrid) add_subdirectory(kbdtool) +add_subdirectory(log2lines) add_subdirectory(mkhive) add_subdirectory(mkisofs) +add_subdirectory(rsym) add_subdirectory(txt2nls) add_subdirectory(unicode) add_subdirectory(widl) @@ -47,12 +49,9 @@ if ((ARCH STREQUAL "amd64") AND (TARGET_COMPILER_ID STREQUAL "GNU")) endif() if(NOT MSVC) - add_subdirectory(log2lines) - add_subdirectory(rsym) - add_host_tool(pefixup pefixup.c) -if (ARCH STREQUAL "amd64" OR ARCH STREQUAL "arm64") - target_compile_definitions(pefixup PRIVATE _TARGET_PE64) -endif() + if (ARCH STREQUAL "amd64" OR ARCH STREQUAL "arm64") + target_compile_definitions(pefixup PRIVATE _TARGET_PE64) + endif() target_link_libraries(pefixup PRIVATE host_includes) endif() diff --git a/sdk/tools/log2lines/CMakeLists.txt b/sdk/tools/log2lines/CMakeLists.txt index 6d726e7b2f2..d1a1ae82d9a 100644 --- a/sdk/tools/log2lines/CMakeLists.txt +++ b/sdk/tools/log2lines/CMakeLists.txt @@ -9,8 +9,12 @@ list(APPEND SOURCE match.c options.c stat.c - util.c) + util.c + ../port/getopt.c) include_directories(${REACTOS_SOURCE_DIR}/sdk/tools/rsym) +if(MSVC) + include_directories(../port) +endif() add_host_tool(log2lines ${SOURCE}) target_link_libraries(log2lines PRIVATE host_includes rsym_common) diff --git a/sdk/tools/log2lines/compat.h b/sdk/tools/log2lines/compat.h index 0b66b4b6707..9d51b79b6b8 100644 --- a/sdk/tools/log2lines/compat.h +++ b/sdk/tools/log2lines/compat.h @@ -2,6 +2,10 @@ #if defined(_WIN32) +#ifdef _MSC_VER +#define strcasecmp _stricmp +#endif + #include #define POPEN _popen @@ -31,4 +35,8 @@ #endif /* not defined (_WIN32) */ +#ifndef PATH_MAX +#define PATH_MAX 260 +#endif + /* EOF */ diff --git a/sdk/tools/log2lines/image.c b/sdk/tools/log2lines/image.c index bae302b8d51..0ad18dc541c 100644 --- a/sdk/tools/log2lines/image.c +++ b/sdk/tools/log2lines/image.c @@ -13,6 +13,7 @@ #include "util.h" #include "options.h" #include "log2lines.h" +#include static PIMAGE_SECTION_HEADER find_rossym_section(PIMAGE_FILE_HEADER PEFileHeader, PIMAGE_SECTION_HEADER PESectionHeaders) diff --git a/sdk/tools/rsym/rsym.h b/sdk/tools/rsym/rsym.h index 2579674c70b..ffc72f42900 100644 --- a/sdk/tools/rsym/rsym.h +++ b/sdk/tools/rsym/rsym.h @@ -26,7 +26,7 @@ typedef struct { USHORT s_nlnno; /* number of line number entries */ ULONG s_flags; /* flags */ } SCNHDR; -#pragma pack(4) +#pragma pack(push, 4) typedef struct _SYMBOLFILE_HEADER { ULONG SymbolsOffset; @@ -135,7 +135,7 @@ typedef struct _STAB_ENTRY { #define C_ALIAS 105 /* duplicate tag */ #define C_HIDDEN 106 /* ext symbol in dmert public lib */ -#pragma pack(1) +#pragma pack(push, 1) typedef struct _COFF_SYMENT { union @@ -155,7 +155,7 @@ typedef struct _COFF_SYMENT UCHAR e_sclass; UCHAR e_numaux; } COFF_SYMENT, *PCOFF_SYMENT; -#pragma pack(4) +#pragma pack(pop) #ifdef TARGET_i386 typedef ULONG TARGET_ULONG_PTR; @@ -170,6 +170,8 @@ typedef struct _ROSSYM_ENTRY { ULONG SourceLine; } ROSSYM_ENTRY, *PROSSYM_ENTRY; +#pragma pack(pop) + #define ROUND_UP(N, S) (((N) + (S) - 1) & ~((S) - 1)) extern char*