diff --git a/dll/win32/kernelbase/wine/path.c b/dll/win32/kernelbase/wine/path.c index 346fc077a9b..a64f7e0bc3d 100644 --- a/dll/win32/kernelbase/wine/path.c +++ b/dll/win32/kernelbase/wine/path.c @@ -23,8 +23,6 @@ #include #include -#ifndef STATIC_PATHCCH - #include "windef.h" #include "winbase.h" #include "pathcch.h" @@ -39,25 +37,20 @@ #include "wine/debug.h" #include "wine/heap.h" +#ifndef STATIC_PATHCCH WINE_DEFAULT_DEBUG_CHANNEL(path); +#else +#undef TRACE +#define TRACE(...) +#endif /* !STATIC_PATHCCH */ -#else // STATIC_PATHCCH #ifdef __REACTOS__ -/* This is the static implementation of the PathCch library */ - -#include -#include /* The PathCch functions use size_t, but Wine's implementation uses SIZE_T, * so temporarily change the define'd SIZE_T type to the compatible one... */ #undef SIZE_T #define SIZE_T size_t -#include -#include - -#define TRACE(...) - #if (_WIN32_WINNT < _WIN32_WINNT_VISTA) || (DLL_EXPORT_VERSION < _WIN32_WINNT_VISTA) /* wcsnlen is an NT6+ function. To cover all cases, use a private implementation */ static inline size_t compat_wcsnlen(const wchar_t* str, size_t size) @@ -68,24 +61,7 @@ static inline size_t compat_wcsnlen(const wchar_t* str, size_t size) #define wcsnlen compat_wcsnlen #endif /* _WIN32_WINNT || DLL_EXPORT_VERSION */ -// Implementation from string.c copied here in order not -// to depend on the whole file just for the PathCch library. -WCHAR * WINAPI StrRChrW(const WCHAR *str, const WCHAR *end, WORD ch) -{ - WCHAR *ret = NULL; - - if (!str) return NULL; - if (!end) end = str + lstrlenW(str); - while (str < end) - { - if (*str == ch) ret = (WCHAR *)str; - str++; - } - return ret; -} - #endif /* __REACTOS__ */ -#endif // STATIC_PATHCCH #ifndef STATIC_PATHCCH diff --git a/sdk/lib/pathcch/CMakeLists.txt b/sdk/lib/pathcch/CMakeLists.txt index a77a3a0c66d..350710cd3db 100644 --- a/sdk/lib/pathcch/CMakeLists.txt +++ b/sdk/lib/pathcch/CMakeLists.txt @@ -1,9 +1,11 @@ +include_directories(BEFORE ${REACTOS_SOURCE_DIR}/sdk/include/wine) + # Down-level static PathCch library, to be used for # programs that need to run on Windows 7 and below. -add_library(pathcch_static STATIC ${REACTOS_SOURCE_DIR}/dll/win32/kernelbase/wine/path.c) +add_library(pathcch_static STATIC ${REACTOS_SOURCE_DIR}/dll/win32/kernelbase/wine/path.c StrRChrW.c) add_dependencies(pathcch_static xdk) -target_compile_definitions(pathcch_static PRIVATE wcsnicmp=_wcsnicmp STATIC_PATHCCH) +target_compile_definitions(pathcch_static PRIVATE wcsnicmp=_wcsnicmp STATIC_PATHCCH PATHCCH_NO_DEPRECATE WINSHLWAPI=) # Windows 8+ compatible libraries, importing from either # kernelbase.dll or api-ms-win-core-path-l1-1-0.dll diff --git a/sdk/lib/pathcch/StrRChrW.c b/sdk/lib/pathcch/StrRChrW.c new file mode 100644 index 00000000000..e04fd4e6f3a --- /dev/null +++ b/sdk/lib/pathcch/StrRChrW.c @@ -0,0 +1,19 @@ + +#include +#include + +// Implementation from string.c copied here in order not +// to depend on the whole file just for the PathCch library. +WCHAR * WINAPI StrRChrW(const WCHAR *str, const WCHAR *end, WORD ch) +{ + WCHAR *ret = NULL; + + if (!str) return NULL; + if (!end) end = str + lstrlenW(str); + while (str < end) + { + if (*str == ch) ret = (WCHAR *)str; + str++; + } + return ret; +}