]> wimlib.net Git - wimlib/blobdiff - src/win32.c
Replace _wcserror_s for Windows XP compatibility
[wimlib] / src / win32.c
index 4e49654880be1b6ee8a88aaa949cf2a9546fb8fd..7636c5fe9d9b05d9b2d293890626cfdc4d801d17 100644 (file)
@@ -39,6 +39,7 @@
 #include "lookup_table.h"
 #include "security.h"
 #include "endianness.h"
+#include <pthread.h>
 
 #include <errno.h>
 
@@ -310,7 +311,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret,
                                  size_t path_num_chars,
                                  struct wim_lookup_table *lookup_table,
                                  struct sd_set *sd_set,
-                                 const struct capture_config *config,
+                                 const struct wimlib_capture_config *config,
                                  int add_image_flags,
                                  wimlib_progress_func_t progress_func,
                                  struct win32_capture_state *state);
@@ -323,7 +324,7 @@ win32_recurse_directory(struct wim_dentry *root,
                        size_t dir_path_num_chars,
                        struct wim_lookup_table *lookup_table,
                        struct sd_set *sd_set,
-                       const struct capture_config *config,
+                       const struct wimlib_capture_config *config,
                        int add_image_flags,
                        wimlib_progress_func_t progress_func,
                        struct win32_capture_state *state)
@@ -734,7 +735,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret,
                                  size_t path_num_chars,
                                  struct wim_lookup_table *lookup_table,
                                  struct sd_set *sd_set,
-                                 const struct capture_config *config,
+                                 const struct wimlib_capture_config *config,
                                  int add_image_flags,
                                  wimlib_progress_func_t progress_func,
                                  struct win32_capture_state *state)
@@ -751,7 +752,7 @@ win32_build_dentry_tree_recursive(struct wim_dentry **root_ret,
                        ret = WIMLIB_ERR_INVALID_CAPTURE_CONFIG;
                        goto out;
                }
-               if ((add_image_flags & WIMLIB_ADD_IMAGE_FLAG_VERBOSE)
+               if ((add_image_flags & WIMLIB_ADD_IMAGE_FLAG_EXCLUDE_VERBOSE)
                    && progress_func)
                {
                        union wimlib_progress_info info;
@@ -911,7 +912,7 @@ win32_build_dentry_tree(struct wim_dentry **root_ret,
                        const wchar_t *root_disk_path,
                        struct wim_lookup_table *lookup_table,
                        struct sd_set *sd_set,
-                       const struct capture_config *config,
+                       const struct wimlib_capture_config *config,
                        int add_image_flags,
                        wimlib_progress_func_t progress_func,
                        void *extra_arg)
@@ -1534,4 +1535,20 @@ fail:
        return -1;
 }
 
+
+/* This really could be replaced with _wcserror_s, but this doesn't seem to
+ * actually be available in MSVCRT.DLL on Windows XP (perhaps it's statically
+ * linked in by Visual Studio...?). */
+extern int
+win32_strerror_r_replacement(int errnum, wchar_t *buf, size_t buflen)
+{
+       static pthread_mutex_t strerror_lock = PTHREAD_MUTEX_INITIALIZER;
+
+       pthread_mutex_lock(&strerror_lock);
+       mbstowcs(buf, strerror(errnum), buflen);
+       buf[buflen - 1] = '\0';
+       pthread_mutex_unlock(&strerror_lock);
+       return 0;
+}
+
 #endif /* __WIN32__ */