https://git.reactos.org/?p=reactos.git;a=commitdiff;h=63c0d5e35a4afeeb424a39e3cb66397b5ea11679

commit 63c0d5e35a4afeeb424a39e3cb66397b5ea11679
Author:     winesync <[email protected]>
AuthorDate: Fri Sep 11 19:05:02 2020 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Sep 16 10:35:58 2020 +0200

    [WINESYNC] dbghelp: Get rid of no longer needed HAVE_ZLIB checks.
    
    Signed-off-by: Jacek Caban <[email protected]>
    Signed-off-by: Alexandre Julliard <[email protected]>
    
    wine commit id 6b1bc0beac510aa48a848b8182b9310f92609dd0 by Jacek Caban 
<[email protected]>
---
 dll/win32/dbghelp/CMakeLists.txt    |  5 +--
 dll/win32/dbghelp/compat.h          |  6 ++++
 dll/win32/dbghelp/dbghelp_private.h |  1 -
 dll/win32/dbghelp/dwarf.c           | 12 ++-----
 dll/win32/dbghelp/elf_module.c      | 14 ++++----
 dll/win32/dbghelp/inflate.c         |  5 +++
 dll/win32/dbghelp/macho_module.c    | 20 ++++++------
 dll/win32/dbghelp/module.c          | 62 +++++++++++++++++------------------
 dll/win32/dbghelp/path.c            | 64 ++++++++++++++++++-------------------
 dll/win32/dbghelp/pe_module.c       |  2 +-
 dll/win32/dbghelp/symbol.c          |  8 ++---
 dll/win32/dbghelp/zlib.h            |  2 ++
 sdk/include/host/typedefs.h         |  4 +--
 sdk/tools/rsym/CMakeLists.txt       |  2 +-
 sdk/tools/winesync/dbghelp.cfg      |  2 +-
 15 files changed, 108 insertions(+), 101 deletions(-)

diff --git a/dll/win32/dbghelp/CMakeLists.txt b/dll/win32/dbghelp/CMakeLists.txt
index e217f4eacd2..15e1aaba010 100644
--- a/dll/win32/dbghelp/CMakeLists.txt
+++ b/dll/win32/dbghelp/CMakeLists.txt
@@ -8,13 +8,13 @@ if(NOT CMAKE_CROSSCOMPILING)
     add_definitions(-DDBGHELP_STATIC_LIB)
 
     include_directories(
-        ${REACTOS_SOURCE_DIR}/tools
-        ${REACTOS_SOURCE_DIR}/sdk/include/reactos/libs/zlib)
+        ${REACTOS_SOURCE_DIR}/tools)
 
     list(APPEND SOURCE
         compat.c
         dbghelp.c
         dwarf.c
+        inflate.c
         module.c
         pe_module.c
         source.c
@@ -57,6 +57,7 @@ else()
 #       elf_module.c
         image.c
 #       macho_module.c
+        inflate.c
         minidump.c
         module.c
         msc.c
diff --git a/dll/win32/dbghelp/compat.h b/dll/win32/dbghelp/compat.h
index 1485a78e024..2bfa06bc242 100644
--- a/dll/win32/dbghelp/compat.h
+++ b/dll/win32/dbghelp/compat.h
@@ -9,6 +9,12 @@
 #include <stdlib.h>
 #include <wchar.h>
 #include <ctype.h>
+#include <wctype.h>
+
+#define wcsnicmp strncmpiW
+#define wcsicmp strcmpiW
+#define wcsrchr strrchrW
+#define wcschr strchrW
 
 typedef HANDLE HWND;
 
diff --git a/dll/win32/dbghelp/dbghelp_private.h 
b/dll/win32/dbghelp/dbghelp_private.h
index 3dba350f405..4f5bf926149 100644
--- a/dll/win32/dbghelp/dbghelp_private.h
+++ b/dll/win32/dbghelp/dbghelp_private.h
@@ -35,7 +35,6 @@
 #include "oaidl.h"
 #include "winnls.h"
 #include "wine/list.h"
-#include "wine/unicode.h"
 #include "wine/rbtree.h"
 
 #include "cvconst.h"
diff --git a/dll/win32/dbghelp/dwarf.c b/dll/win32/dbghelp/dwarf.c
index 975e8754978..4874f0843c5 100644
--- a/dll/win32/dbghelp/dwarf.c
+++ b/dll/win32/dbghelp/dwarf.c
@@ -48,6 +48,7 @@
 #else
 #include "dbghelp_private.h"
 #include "image_private.h"
+#include "zlib.h"
 #endif /* !DBGHELP_STATIC_LIB */
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_dwarf);
@@ -725,7 +726,7 @@ compute_location(const struct module *module, 
dwarf2_traverse_context_t* ctx, st
         case DW_OP_pick:        stack[stk + 1] = stack[stk - 
dwarf2_parse_byte(ctx)]; stk++; break;
         case DW_OP_swap:        tmp = stack[stk]; stack[stk] = stack[stk-1]; 
stack[stk-1] = tmp; break;
         case DW_OP_rot:         tmp = stack[stk]; stack[stk] = stack[stk-1]; 
stack[stk-1] = stack[stk-2]; stack[stk-2] = tmp; break;
-        case DW_OP_abs:         stack[stk] = labs(stack[stk]); break;
+        case DW_OP_abs:         stack[stk] = sizeof(stack[stk]) == 8 ? 
llabs((INT64)stack[stk]) : abs((INT32)stack[stk]); break;
         case DW_OP_neg:         stack[stk] = -stack[stk]; break;
         case DW_OP_not:         stack[stk] = ~stack[stk]; break;
         case DW_OP_and:         stack[stk-1] &= stack[stk]; stk--; break;
@@ -3138,7 +3139,7 @@ static ULONG_PTR eval_expression(const struct module* 
module, struct cpu_stack_w
         case DW_OP_pick:        stack[sp + 1] = stack[sp - 
dwarf2_parse_byte(&ctx)]; sp++; break;
         case DW_OP_swap:        tmp = stack[sp]; stack[sp] = stack[sp-1]; 
stack[sp-1] = tmp; break;
         case DW_OP_rot:         tmp = stack[sp]; stack[sp] = stack[sp-1]; 
stack[sp-1] = stack[sp-2]; stack[sp-2] = tmp; break;
-        case DW_OP_abs:         stack[sp] = labs(stack[sp]); break;
+        case DW_OP_abs:         stack[sp] = sizeof(stack[sp]) == 8 ? 
llabs((INT64)stack[sp]) : abs((INT32)stack[sp]); break;
         case DW_OP_neg:         stack[sp] = -stack[sp]; break;
         case DW_OP_not:         stack[sp] = ~stack[sp]; break;
         case DW_OP_and:         stack[sp-1] &= stack[sp]; sp--; break;
@@ -3382,7 +3383,6 @@ static void dwarf2_location_compute(struct process* pcs,
     }
 }
 
-#ifdef HAVE_ZLIB
 static void *zalloc(void *priv, uInt items, uInt sz)
 {
     return HeapAlloc(GetProcessHeap(), 0, items * sz);
@@ -3464,8 +3464,6 @@ out:
     return ret;
 }
 
-#endif
-
 static inline BOOL dwarf2_init_section(dwarf2_section_t* section, struct 
image_file_map* fmap,
                                        const char* sectname, const char* 
zsectname,
                                        struct image_section_map* ism)
@@ -3489,11 +3487,7 @@ static inline BOOL dwarf2_init_section(dwarf2_section_t* 
section, struct image_f
 
     if (zsectname && image_find_section(fmap, zsectname, ism))
     {
-#ifdef HAVE_ZLIB
         return dwarf2_init_zsection(section, zsectname, ism);
-#else
-        FIXME("dbghelp not built with zlib, but compressed section found\n" );
-#endif
     }
 
     return FALSE;
diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c
index a77b034f420..5f92432d0e8 100644
--- a/dll/win32/dbghelp/elf_module.c
+++ b/dll/win32/dbghelp/elf_module.c
@@ -333,7 +333,7 @@ struct elf_map_file_data
 };
 
 static BOOL elf_map_file_read(struct image_file_map* fmap, struct 
elf_map_file_data* emfd,
-                              void* buf, size_t len, off_t off)
+                              void* buf, size_t len, size_t off)
 {
     LARGE_INTEGER li;
     DWORD bytes_read;
@@ -1068,8 +1068,8 @@ static BOOL elf_load_debug_info_from_map(struct module* 
module,
         lret = dwarf2_parse(module, module->reloc_delta, thunks, fmap);
         ret = ret || lret;
     }
-    if (strstrW(module->module.ModuleName, S_ElfW) ||
-        !strcmpW(module->module.ModuleName, S_WineLoaderW))
+    if (wcsstr(module->module.ModuleName, S_ElfW) ||
+        !wcscmp(module->module.ModuleName, S_WineLoaderW))
     {
         /* add the thunks for native libraries */
         if (!(dbghelp_options & SYMOPT_PUBLICS_ONLY))
@@ -1263,7 +1263,7 @@ static BOOL elf_load_file_from_fmap(struct process* pcs, 
const WCHAR* filename,
         ptr = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(filename) + 1) * 
sizeof(WCHAR));
         if (ptr)
         {
-            strcpyW(ptr, filename);
+            lstrcpyW(ptr, filename);
             elf_info->module_name = ptr;
         }
         else ret = FALSE;
@@ -1424,7 +1424,7 @@ static BOOL elf_search_and_load_file(struct process* pcs, 
const WCHAR* filename,
         return module->module.SymType;
     }
 
-    if (strstrW(filename, S_libstdcPPW)) return FALSE; /* We know we can't do 
it */
+    if (wcsstr(filename, S_libstdcPPW)) return FALSE; /* We know we can't do 
it */
     ret = elf_load_file(pcs, filename, load_offset, dyn_addr, elf_info);
     /* if relative pathname, try some absolute base dirs */
     if (!ret && filename == file_name(filename))
@@ -1494,7 +1494,7 @@ static BOOL elf_enum_modules_internal(const struct 
process* pcs,
             {
                 bufstr[sizeof(bufstr) - 1] = '\0';
                 MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, bufstrW, 
ARRAY_SIZE(bufstrW));
-                if (main_name && !bufstrW[0]) strcpyW(bufstrW, main_name);
+                if (main_name && !bufstrW[0]) lstrcpyW(bufstrW, main_name);
                 if (!cb(bufstrW, (ULONG_PTR)lm.l_addr, (ULONG_PTR)lm.l_ld, 
FALSE, user))
                     break;
             }
@@ -1536,7 +1536,7 @@ static BOOL elf_enum_modules_internal(const struct 
process* pcs,
             {
                 bufstr[sizeof(bufstr) - 1] = '\0';
                 MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, bufstrW, 
ARRAY_SIZE(bufstrW));
-                if (main_name && !bufstrW[0]) strcpyW(bufstrW, main_name);
+                if (main_name && !bufstrW[0]) lstrcpyW(bufstrW, main_name);
                 if (!cb(bufstrW, (ULONG_PTR)lm.l_addr, (ULONG_PTR)lm.l_ld, 
FALSE, user))
                     break;
             }
diff --git a/dll/win32/dbghelp/inflate.c b/dll/win32/dbghelp/inflate.c
index 1f2d65ea327..1ace8487b5b 100644
--- a/dll/win32/dbghelp/inflate.c
+++ b/dll/win32/dbghelp/inflate.c
@@ -1,3 +1,7 @@
+#ifdef DBGHELP_STATIC_LIB
+#include "compat.h"
+#include "zlib.h"
+#else
 /* inflate.c -- zlib decompression
  *
  * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
@@ -28,6 +32,7 @@
 #include <limits.h>
 #include "winternl.h"
 #include "zlib.h"
+#endif /* DBGHELP_STATIC_LIB */
 
 #define DEF_WBITS MAX_WBITS
 #define zmemcpy memcpy
diff --git a/dll/win32/dbghelp/macho_module.c b/dll/win32/dbghelp/macho_module.c
index 3249a7ab2ac..51119593770 100644
--- a/dll/win32/dbghelp/macho_module.c
+++ b/dll/win32/dbghelp/macho_module.c
@@ -1267,7 +1267,7 @@ static WCHAR *query_dsym(const GUID *uuid, const WCHAR 
*filename)
         p += query->DeviceNameLength / sizeof(WCHAR);
         memcpy(p, dsym_subpath, sizeof(dsym_subpath));
         p += ARRAY_SIZE(dsym_subpath) - 1;
-        strcpyW(p, filename);
+        lstrcpyW(p, filename);
     }
 
     if (query != (void *)buf) HeapFree(GetProcessHeap(), 0, query);
@@ -1300,19 +1300,19 @@ static void find_and_map_dsym(struct process *pcs, 
struct module* module)
         return;
 
     p = file_name(module->module.LoadedImageName);
-    len = strlenW(module->module.LoadedImageName) + strlenW(dot_dsym) + 
strlenW(dsym_subpath) + strlenW(p) + 1;
+    len = lstrlenW(module->module.LoadedImageName) + lstrlenW(dot_dsym) + 
lstrlenW(dsym_subpath) + lstrlenW(p) + 1;
     path = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
     if (!path)
         return;
-    strcpyW(path, module->module.LoadedImageName);
-    strcatW(path, dot_dsym);
-    strcatW(path, dsym_subpath);
-    strcatW(path, p);
+    lstrcpyW(path, module->module.LoadedImageName);
+    lstrcatW(path, dot_dsym);
+    lstrcatW(path, dsym_subpath);
+    lstrcatW(path, p);
 
     if (try_dsym(pcs, path, fmap))
         goto found;
 
-    strcpyW(path + strlenW(module->module.LoadedImageName), dot_dwarf);
+    lstrcpyW(path + lstrlenW(module->module.LoadedImageName), dot_dwarf);
 
     if (try_dsym(pcs, path, fmap))
         goto found;
@@ -1514,7 +1514,7 @@ static BOOL macho_load_file(struct process* pcs, const 
WCHAR* filename,
         ptr = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(filename) + 1) * 
sizeof(WCHAR));
         if (ptr)
         {
-            strcpyW(ptr, filename);
+            lstrcpyW(ptr, filename);
             macho_info->module_name = ptr;
         }
         else ret = FALSE;
@@ -1566,7 +1566,7 @@ static BOOL macho_search_and_load_file(struct process* 
pcs, const WCHAR* filenam
         return module->module.SymType;
     }
 
-    if (strstrW(filename, S_libstdcPPW)) return FALSE; /* We know we can't do 
it */
+    if (wcsstr(filename, S_libstdcPPW)) return FALSE; /* We know we can't do 
it */
 
     load_params.process    = pcs;
     load_params.load_addr  = load_addr;
@@ -1658,7 +1658,7 @@ static BOOL macho_enum_modules_internal(const struct 
process* pcs,
             bufstr[sizeof(bufstr) - 1] = '\0';
             TRACE("[%d] image file %s\n", i, debugstr_a(bufstr));
             MultiByteToWideChar(CP_UNIXCP, 0, bufstr, -1, bufstrW, 
ARRAY_SIZE(bufstrW));
-            if (main_name && !bufstrW[0]) strcpyW(bufstrW, main_name);
+            if (main_name && !bufstrW[0]) lstrcpyW(bufstrW, main_name);
             if (!cb(bufstrW, info.imageLoadAddress, user)) break;
         }
     }
diff --git a/dll/win32/dbghelp/module.c b/dll/win32/dbghelp/module.c
index 91d23bff8fc..bf3cf8852e4 100644
--- a/dll/win32/dbghelp/module.c
+++ b/dll/win32/dbghelp/module.c
@@ -59,9 +59,9 @@ static int match_ext(const WCHAR* ptr, size_t len)
 
     for (e = ext; *e; e++)
     {
-        l = strlenW(*e);
+        l = lstrlenW(*e);
         if (l >= len) return 0;
-        if (strncmpiW(&ptr[len - l], *e, l)) continue;
+        if (wcsnicmp(&ptr[len - l], *e, l)) continue;
         return l;
     }
     return 0;
@@ -71,7 +71,7 @@ static const WCHAR* get_filename(const WCHAR* name, const 
WCHAR* endptr)
 {
     const WCHAR*        ptr;
 
-    if (!endptr) endptr = name + strlenW(name);
+    if (!endptr) endptr = name + lstrlenW(name);
     for (ptr = endptr - 1; ptr >= name; ptr--)
     {
         if (*ptr == '/' || *ptr == '\\') break;
@@ -100,14 +100,14 @@ static BOOL is_wine_loader(const WCHAR *module)
     else
     {
         buffer = heap_alloc( sizeof(wineW) + 2 * sizeof(WCHAR) );
-        strcpyW( buffer, wineW );
+        lstrcpyW( buffer, wineW );
     }
 
-    if (!strcmpW( filename, buffer ))
+    if (!wcscmp( filename, buffer ))
         ret = TRUE;
 
-    strcatW( buffer, suffixW );
-    if (!strcmpW( filename, buffer ))
+    lstrcatW( buffer, suffixW );
+    if (!wcscmp( filename, buffer ))
         ret = TRUE;
 
     heap_free( buffer );
@@ -120,7 +120,7 @@ static void module_fill_module(const WCHAR* in, WCHAR* out, 
size_t size)
     const WCHAR *ptr, *endptr;
     size_t      len, l;
 
-    ptr = get_filename(in, endptr = in + strlenW(in));
+    ptr = get_filename(in, endptr = in + lstrlenW(in));
     len = min(endptr - ptr, size - 1);
     memcpy(out, ptr, len * sizeof(WCHAR));
     out[len] = '\0';
@@ -132,11 +132,11 @@ static void module_fill_module(const WCHAR* in, WCHAR* 
out, size_t size)
 #endif
     else
     {
-        if (len > 3 && !strcmpiW(&out[len - 3], S_DotSoW) &&
+        if (len > 3 && !wcsicmp(&out[len - 3], S_DotSoW) &&
             (l = match_ext(out, len - 3)))
-            strcpyW(&out[len - l - 3], S_ElfW);
+            lstrcpyW(&out[len - l - 3], S_ElfW);
     }
-    while ((*out = tolowerW(*out))) out++;
+    while ((*out = towlower(*out))) out++;
 }
 
 void module_set_module(struct module* module, const WCHAR* name)
@@ -166,15 +166,15 @@ WCHAR *get_wine_loader_name(struct process *pcs)
     else
     {
         buffer = heap_alloc( sizeof(wineW) + 2 * sizeof(WCHAR) );
-        strcpyW( buffer, wineW );
+        lstrcpyW( buffer, wineW );
     }
 
-    p = buffer + strlenW( buffer ) - strlenW( suffixW );
-    if (p > buffer && !strcmpW( p, suffixW ))
+    p = buffer + lstrlenW( buffer ) - lstrlenW( suffixW );
+    if (p > buffer && !wcscmp( p, suffixW ))
         *p = 0;
 
     if (pcs->is_64bit)
-        strcatW(buffer, suffixW);
+        lstrcatW(buffer, suffixW);
 
     TRACE( "returning %s\n", debugstr_w(buffer) );
     return buffer;
@@ -282,7 +282,7 @@ struct module* module_find_by_nameW(const struct process* 
pcs, const WCHAR* name
 
     for (module = pcs->lmodules; module; module = module->next)
     {
-        if (!strcmpiW(name, module->module.ModuleName)) return module;
+        if (!wcsicmp(name, module->module.ModuleName)) return module;
     }
     SetLastError(ERROR_INVALID_NAME);
     return NULL;
@@ -308,14 +308,14 @@ struct module* module_is_already_loaded(const struct 
process* pcs, const WCHAR*
     /* first compare the loaded image name... */
     for (module = pcs->lmodules; module; module = module->next)
     {
-        if (!strcmpiW(name, module->module.LoadedImageName))
+        if (!wcsicmp(name, module->module.LoadedImageName))
             return module;
     }
     /* then compare the standard filenames (without the path) ... */
     filename = get_filename(name, NULL);
     for (module = pcs->lmodules; module; module = module->next)
     {
-        if (!strcmpiW(filename, get_filename(module->module.LoadedImageName, 
NULL)))
+        if (!wcsicmp(filename, get_filename(module->module.LoadedImageName, 
NULL)))
             return module;
     }
     SetLastError(ERROR_INVALID_NAME);
@@ -457,7 +457,7 @@ static BOOL module_is_container_loaded(const struct 
process* pcs,
 
     if (!base) return FALSE;
     filename = get_filename(ImageName, NULL);
-    len = strlenW(filename);
+    len = lstrlenW(filename);
 
     for (module = pcs->lmodules; module; module = module->next)
     {
@@ -466,7 +466,7 @@ static BOOL module_is_container_loaded(const struct 
process* pcs,
             base < module->module.BaseOfImage + module->module.ImageSize)
         {
             modname = get_filename(module->module.LoadedImageName, NULL);
-            if (!strncmpiW(modname, filename, len) &&
+            if (!wcsnicmp(modname, filename, len) &&
                 !memcmp(modname + len, S_DotSoW, 3 * sizeof(WCHAR)))
             {
                 return TRUE;
@@ -555,17 +555,17 @@ static BOOL image_locate_debug_link(const struct module* 
module, struct image_fi
     if (!fmap_link) return FALSE;
 
     filename_len = MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, NULL, 0);
-    path_len = strlenW(module->module.LoadedImageName);
-    if (module->real_path) path_len = max(path_len, 
strlenW(module->real_path));
+    path_len = lstrlenW(module->module.LoadedImageName);
+    if (module->real_path) path_len = max(path_len, 
lstrlenW(module->real_path));
     p = HeapAlloc(GetProcessHeap(), 0,
                   (globalDebugDirLen + path_len + 6 + 1 + filename_len + 1) * 
sizeof(WCHAR));
     if (!p) goto found;
 
     /* we prebuild the string with "execdir" */
-    strcpyW(p, module->module.LoadedImageName);
+    lstrcpyW(p, module->module.LoadedImageName);
     slash = p;
-    if ((slash2 = strrchrW(slash, '/'))) slash = slash2 + 1;
-    if ((slash2 = strrchrW(slash, '\\'))) slash = slash2 + 1;
+    if ((slash2 = wcsrchr(slash, '/'))) slash = slash2 + 1;
+    if ((slash2 = wcsrchr(slash, '\\'))) slash = slash2 + 1;
 
     /* testing execdir/filename */
     MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, slash, filename_len);
@@ -578,10 +578,10 @@ static BOOL image_locate_debug_link(const struct module* 
module, struct image_fi
 
     if (module->real_path)
     {
-        strcpyW(p, module->real_path);
+        lstrcpyW(p, module->real_path);
         slash = p;
-        if ((slash2 = strrchrW(slash, '/'))) slash = slash2 + 1;
-        if ((slash2 = strrchrW(slash, '\\'))) slash = slash2 + 1;
+        if ((slash2 = wcsrchr(slash, '/'))) slash = slash2 + 1;
+        if ((slash2 = wcsrchr(slash, '\\'))) slash = slash2 + 1;
         MultiByteToWideChar(CP_UNIXCP, 0, filename, -1, slash, filename_len);
         if (image_check_debug_link(p, fmap_link, crc)) goto found;
     }
@@ -1200,9 +1200,9 @@ BOOL  WINAPI SymGetModuleInfoW(HANDLE hProcess, DWORD 
dwAddr,
     miw.CheckSum      = miw64.CheckSum;
     miw.NumSyms       = miw64.NumSyms;
     miw.SymType       = miw64.SymType;
-    strcpyW(miw.ModuleName, miw64.ModuleName);
-    strcpyW(miw.ImageName, miw64.ImageName);
-    strcpyW(miw.LoadedImageName, miw64.LoadedImageName);
+    lstrcpyW(miw.ModuleName, miw64.ModuleName);
+    lstrcpyW(miw.ImageName, miw64.ImageName);
+    lstrcpyW(miw.LoadedImageName, miw64.LoadedImageName);
     memcpy(ModuleInfo, &miw, ModuleInfo->SizeOfStruct);
 
     return TRUE;
diff --git a/dll/win32/dbghelp/path.c b/dll/win32/dbghelp/path.c
index e3c8d3afdb1..d4e04ff1f40 100644
--- a/dll/win32/dbghelp/path.c
+++ b/dll/win32/dbghelp/path.c
@@ -46,7 +46,7 @@ const WCHAR* file_name(const WCHAR* str)
 {
     const WCHAR*      p;
 
-    for (p = str + strlenW(str) - 1; p >= str && !is_sep(*p); p--);
+    for (p = str + lstrlenW(str) - 1; p >= str && !is_sep(*p); p--);
     return p + 1;
 }
 
@@ -54,7 +54,7 @@ static inline void file_pathW(const WCHAR *src, WCHAR *dst)
 {
     int len;
 
-    for (len = strlenW(src) - 1; (len > 0) && (!is_sep(src[len])); len--);
+    for (len = lstrlenW(src) - 1; (len > 0) && (!is_sep(src[len])); len--);
     memcpy( dst, src, len * sizeof(WCHAR) );
     dst[len] = 0;
 }
@@ -176,12 +176,12 @@ BOOL WINAPI SymMatchFileNameW(PCWSTR file, PCWSTR match,
     TRACE("(%s %s %p %p)\n",
           debugstr_w(file), debugstr_w(match), filestop, matchstop);
 
-    fptr = file + strlenW(file) - 1;
-    mptr = match + strlenW(match) - 1;
+    fptr = file + lstrlenW(file) - 1;
+    mptr = match + lstrlenW(match) - 1;
 
     while (fptr >= file && mptr >= match)
     {
-        if (toupperW(*fptr) != toupperW(*mptr) && !(is_sep(*fptr) && 
is_sep(*mptr)))
+        if (towupper(*fptr) != towupper(*mptr) && !(is_sep(*fptr) && 
is_sep(*mptr)))
             break;
         fptr--; mptr--;
     }
@@ -229,10 +229,10 @@ static BOOL do_searchW(PCWSTR file, PWSTR buffer, BOOL 
recurse,
     static const WCHAR  S_DotW[] = {'.','\0'};
     static const WCHAR  S_DotDotW[] = {'.','.','\0'};
 
-    pos = strlenW(buffer);
+    pos = lstrlenW(buffer);
     if (pos == 0) return FALSE;
     if (buffer[pos - 1] != '\\') buffer[pos++] = '\\';
-    strcpyW(buffer + pos, S_AllW);
+    lstrcpyW(buffer + pos, S_AllW);
     if ((h = FindFirstFileW(buffer, &fd)) == INVALID_HANDLE_VALUE)
         return FALSE;
     /* doc doesn't specify how the tree is enumerated...
@@ -240,9 +240,9 @@ static BOOL do_searchW(PCWSTR file, PWSTR buffer, BOOL 
recurse,
      */
     do
     {
-        if (!strcmpW(fd.cFileName, S_DotW) || !strcmpW(fd.cFileName, 
S_DotDotW)) continue;
+        if (!wcscmp(fd.cFileName, S_DotW) || !wcscmp(fd.cFileName, S_DotDotW)) 
continue;
 
-        strcpyW(buffer + pos, fd.cFileName);
+        lstrcpyW(buffer + pos, fd.cFileName);
         if (recurse && (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
             found = do_searchW(file, buffer, TRUE, cb, user);
         else if (SymMatchFileNameW(buffer, file, NULL, NULL))
@@ -263,7 +263,7 @@ BOOL WINAPI SearchTreeForFileW(PCWSTR root, PCWSTR file, 
PWSTR buffer)
 {
     TRACE("(%s, %s, %p)\n",
           debugstr_w(root), debugstr_w(file), buffer);
-    strcpyW(buffer, root);
+    lstrcpyW(buffer, root);
     return do_searchW(file, buffer, TRUE, NULL, NULL);
 }
 
@@ -296,7 +296,7 @@ BOOL WINAPI EnumDirTreeW(HANDLE hProcess, PCWSTR root, 
PCWSTR file,
     TRACE("(%p %s %s %p %p %p)\n",
           hProcess, debugstr_w(root), debugstr_w(file), buffer, cb, user);
 
-    strcpyW(buffer, root);
+    lstrcpyW(buffer, root);
     return do_searchW(file, buffer, TRUE, cb, user);
 }
 
@@ -390,13 +390,13 @@ BOOL WINAPI SymFindFileInPathW(HANDLE hProcess, PCWSTR 
searchPath, PCWSTR full_p
     /* first check full path to file */
     if (sffip_cb(full_path, &s))
     {
-        strcpyW(buffer, full_path);
+        lstrcpyW(buffer, full_path);
         return TRUE;
     }
 
     while (searchPath)
     {
-        ptr = strchrW(searchPath, ';');
+        ptr = wcschr(searchPath, ';');
         if (ptr)
         {
             memcpy(tmp, searchPath, (ptr - searchPath) * sizeof(WCHAR));
@@ -405,12 +405,12 @@ BOOL WINAPI SymFindFileInPathW(HANDLE hProcess, PCWSTR 
searchPath, PCWSTR full_p
         }
         else
         {
-            strcpyW(tmp, searchPath);
+            lstrcpyW(tmp, searchPath);
             searchPath = NULL;
         }
         if (do_searchW(filename, tmp, FALSE, sffip_cb, &s))
         {
-            strcpyW(buffer, tmp);
+            lstrcpyW(buffer, tmp);
             return TRUE;
         }
     }
@@ -584,7 +584,7 @@ static BOOL CALLBACK module_find_cb(PCWSTR buffer, PVOID 
user)
     }
     if (matched > mf->matched)
     {
-        strcpyW(mf->filename, buffer);
+        lstrcpyW(mf->filename, buffer);
         mf->matched = matched;
     }
     /* yes, EnumDirTree/do_search and SymFindFileInPath callbacks use the 
opposite
@@ -619,7 +619,7 @@ BOOL path_find_symbol_file(const struct process* pcs, const 
struct module* modul
     /* first check full path to file */
     if (module_find_cb(full_pathW, &mf))
     {
-        strcpyW( buffer, full_pathW );
+        lstrcpyW( buffer, full_pathW );
         return TRUE;
     }
 
@@ -643,7 +643,7 @@ BOOL path_find_symbol_file(const struct process* pcs, const 
struct module* modul
 
     while (searchPath)
     {
-        ptr = strchrW(searchPath, ';');
+        ptr = wcschr(searchPath, ';');
         if (ptr)
         {
             memcpy(buffer, searchPath, (ptr - searchPath) * sizeof(WCHAR));
@@ -652,7 +652,7 @@ BOOL path_find_symbol_file(const struct process* pcs, const 
struct module* modul
         }
         else
         {
-            strcpyW(buffer, searchPath);
+            lstrcpyW(buffer, searchPath);
             searchPath = NULL;
         }
         /* return first fully matched file */
@@ -661,7 +661,7 @@ BOOL path_find_symbol_file(const struct process* pcs, const 
struct module* modul
     /* if no fully matching file is found, return the best matching file if 
any */
     if ((dbghelp_options & SYMOPT_LOAD_ANYTHING) && mf.matched)
     {
-        strcpyW( buffer, mf.filename );
+        lstrcpyW( buffer, mf.filename );
         *is_unmatched = TRUE;
         return TRUE;
     }
@@ -717,12 +717,12 @@ BOOL search_dll_path(const WCHAR *name, BOOL 
(*match)(void*, HANDLE, const WCHAR
         end = buf + GetEnvironmentVariableW(winebuilddirW, buf, len);
 
         memcpy(end, dllsW, sizeof(dllsW));
-        strcpyW(end + ARRAY_SIZE(dllsW), name);
-        if ((p = strrchrW(end, '.')) && !lstrcmpW(p, dot_soW)) *p = 0;
-        if ((p = strrchrW(end, '.')) && !lstrcmpW(p, dot_dllW)) *p = 0;
-        p = end + strlenW(end);
+        lstrcpyW(end + ARRAY_SIZE(dllsW), name);
+        if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, dot_soW)) *p = 0;
+        if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, dot_dllW)) *p = 0;
+        p = end + lstrlenW(end);
         *p++ = '\\';
-        strcpyW(p, name);
+        lstrcpyW(p, name);
         file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, 
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
         if (file != INVALID_HANDLE_VALUE)
         {
@@ -733,12 +733,12 @@ BOOL search_dll_path(const WCHAR *name, BOOL 
(*match)(void*, HANDLE, const WCHAR
 
         memcpy(end, programsW, sizeof(programsW));
         end += ARRAY_SIZE(programsW);
-        strcpyW(end, name);
-        if ((p = strrchrW(end, '.')) && !lstrcmpW(p, dot_soW)) *p = 0;
-        if ((p = strrchrW(end, '.')) && !lstrcmpW(p, dot_exeW)) *p = 0;
-        p = end + strlenW(end);
+        lstrcpyW(end, name);
+        if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, dot_soW)) *p = 0;
+        if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, dot_exeW)) *p = 0;
+        p = end + lstrlenW(end);
         *p++ = '\\';
-        strcpyW(p, name);
+        lstrcpyW(p, name);
         file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, 
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
         if (file != INVALID_HANDLE_VALUE)
         {
@@ -753,13 +753,13 @@ BOOL search_dll_path(const WCHAR *name, BOOL 
(*match)(void*, HANDLE, const WCHAR
     for (i = 0;; i++)
     {
         WCHAR env_name[64];
-        sprintfW(env_name, winedlldirW, i);
+        swprintf(env_name, ARRAY_SIZE(env_name), winedlldirW, i);
         if (!(len = GetEnvironmentVariableW(env_name, NULL, 0))) break;
         if (!(buf = heap_alloc((len + lstrlenW(name) + 2) * sizeof(WCHAR)))) 
return FALSE;
 
         len = GetEnvironmentVariableW(env_name, buf, len);
         buf[len++] = '\\';
-        strcpyW(buf + len, name);
+        lstrcpyW(buf + len, name);
         file = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL, 
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
         if (file != INVALID_HANDLE_VALUE)
         {
diff --git a/dll/win32/dbghelp/pe_module.c b/dll/win32/dbghelp/pe_module.c
index 549f39991f6..864be64f573 100644
--- a/dll/win32/dbghelp/pe_module.c
+++ b/dll/win32/dbghelp/pe_module.c
@@ -813,7 +813,7 @@ struct module* pe_load_native_module(struct process* pcs, 
const WCHAR* name,
             return NULL;
         opened = TRUE;
     }
-    else if (name) strcpyW(loaded_name, name);
+    else if (name) lstrcpyW(loaded_name, name);
     else if (dbghelp_options & SYMOPT_DEFERRED_LOADS)
         FIXME("Trouble ahead (no module name passed in deferred mode)\n");
     if (!(modfmt = HeapAlloc(GetProcessHeap(), 0, sizeof(struct module_format) 
+ sizeof(struct pe_module_info))))
diff --git a/dll/win32/dbghelp/symbol.c b/dll/win32/dbghelp/symbol.c
index 947df4a1cff..09b83f38a00 100644
--- a/dll/win32/dbghelp/symbol.c
+++ b/dll/win32/dbghelp/symbol.c
@@ -1063,7 +1063,7 @@ static BOOL sym_enum(HANDLE hProcess, ULONG64 BaseOfDll, 
PCWSTR Mask,
     if (BaseOfDll == 0)
     {
         /* do local variables ? */
-        if (!Mask || !(bang = strchrW(Mask, '!')))
+        if (!Mask || !(bang = wcschr(Mask, '!')))
             return symt_enum_locals(pair.pcs, Mask, se);
 
         if (bang == Mask) return FALSE;
@@ -1106,7 +1106,7 @@ static BOOL sym_enum(HANDLE hProcess, ULONG64 BaseOfDll, 
PCWSTR Mask,
         return FALSE;
 
     /* we always ignore module name from Mask when BaseOfDll is defined */
-    if (Mask && (bang = strchrW(Mask, '!')))
+    if (Mask && (bang = wcschr(Mask, '!')))
     {
         if (bang == Mask) return FALSE;
         Mask = bang + 1;
@@ -1865,7 +1865,7 @@ DWORD WINAPI UnDecorateSymbolNameW(const WCHAR 
*decorated_name, WCHAR *undecorat
         {
             MultiByteToWideChar(CP_ACP, 0, ptr, -1, undecorated_name, 
undecorated_length);
             undecorated_name[undecorated_length - 1] = 0;
-            ret = strlenW(undecorated_name);
+            ret = lstrlenW(undecorated_name);
             und_free(ptr);
         }
         HeapFree(GetProcessHeap(), 0, buf);
@@ -1888,7 +1888,7 @@ static  int     re_fetch_char(const WCHAR** re)
 
 static inline int  re_match_char(WCHAR ch1, WCHAR ch2, BOOL _case)
 {
-    return _case ? ch1 - ch2 : toupperW(ch1) - toupperW(ch2);
+    return _case ? ch1 - ch2 : towupper(ch1) - towupper(ch2);
 }
 
 static const WCHAR* re_match_one(const WCHAR* string, const WCHAR* elt, BOOL 
_case)
diff --git a/dll/win32/dbghelp/zlib.h b/dll/win32/dbghelp/zlib.h
index e72398c2d9c..4c59f709ba3 100644
--- a/dll/win32/dbghelp/zlib.h
+++ b/dll/win32/dbghelp/zlib.h
@@ -26,7 +26,9 @@
 #ifndef ZLIB_H
 #define ZLIB_H
 
+#ifndef DBGHELP_STATIC_LIB
 #include "windef.h"
+#endif
 
 #undef FAR
 #define FAR
diff --git a/sdk/include/host/typedefs.h b/sdk/include/host/typedefs.h
index 3a31aab7a93..bbc56890f96 100644
--- a/sdk/include/host/typedefs.h
+++ b/sdk/include/host/typedefs.h
@@ -55,7 +55,7 @@ typedef uint8_t UINT8;
 typedef int16_t SHORT, *PSHORT;
 typedef uint16_t USHORT, *PUSHORT, WORD, *PWORD, *LPWORD, WCHAR, *PWCHAR, 
*PWSTR, *LPWSTR, UINT16;
 typedef const uint16_t *PCWSTR, *LPCWSTR;
-typedef int32_t INT, LONG, *PLONG, *LPLONG, BOOL, WINBOOL;
+typedef int32_t INT, LONG, *PLONG, *LPLONG, BOOL, WINBOOL, INT32;
 typedef uint32_t UINT, *PUINT, *LPUINT, ULONG, *PULONG, DWORD, *PDWORD, 
*LPDWORD, UINT32;
 #if defined(_LP64) || defined(_WIN64)
 typedef int64_t LONG_PTR, *PLONG_PTR, INT_PTR, *PINT_PTR;
@@ -65,7 +65,7 @@ typedef int32_t LONG_PTR, *PLONG_PTR, INT_PTR, *PINT_PTR;
 typedef uint32_t ULONG_PTR, DWORD_PTR, *PULONG_PTR, UINT_PTR, *PUINT_PTR;
 #endif
 typedef uint64_t ULONG64, DWORD64, *PDWORD64, UINT64, ULONGLONG;
-typedef int64_t LONGLONG, LONG64;
+typedef int64_t LONGLONG, LONG64, INT64;
 typedef float FLOAT;
 typedef double DOUBLE;
 
diff --git a/sdk/tools/rsym/CMakeLists.txt b/sdk/tools/rsym/CMakeLists.txt
index 370f74efd8c..6d3c8ed443c 100644
--- a/sdk/tools/rsym/CMakeLists.txt
+++ b/sdk/tools/rsym/CMakeLists.txt
@@ -11,6 +11,6 @@ elseif(ARCH STREQUAL "arm")
     add_executable(rsym rsym64.c)
 endif()
 
-target_link_libraries(rsym PRIVATE host_includes rsym_common dbghelphost 
zlibhost unicode)
+target_link_libraries(rsym PRIVATE host_includes rsym_common dbghelphost 
unicode)
 add_host_tool(raddr2line raddr2line.c)
 target_link_libraries(raddr2line PRIVATE host_includes rsym_common)
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index ce9b658b22d..e1eddf4ee19 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -4,4 +4,4 @@ files:
   include/dbghelp.h: sdk/include/psdk/dbghelp.h
   include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
 tags:
-  wine: 5bc58410f28aefea3c3f41e056a372aff4dceac7
+  wine: 6b1bc0beac510aa48a848b8182b9310f92609dd0

Reply via email to