]> wimlib.net Git - wimlib/blobdiff - src/win32_replacements.c
Fix win32-test-imagex-capture_and_apply.bat and add to CI
[wimlib] / src / win32_replacements.c
index c2fb556d15553228412a535a606960118989e2ea..5df6c78eefaabf5fe763dd0d6e319d464e685411 100644 (file)
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public License
- * along with this file; if not, see http://www.gnu.org/licenses/.
+ * along with this file; if not, see https://www.gnu.org/licenses/.
  */
 
-#ifdef __WIN32__
+#ifdef _WIN32
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
 #endif
 
 #include <errno.h>
-#include <pthread.h>
 #include <io.h>        /* for _get_osfhandle()  */
 #include <fcntl.h>
 
@@ -469,21 +468,6 @@ err_set_errno:
        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...?). */
-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;
-}
-
 #define MAX_IO_AMOUNT 1048576
 
 static int
@@ -692,7 +676,7 @@ win32_wglob(const wchar_t *pattern, int flags,
                pglob->gl_pathv[pglob->gl_pathc++] = path;
        } while (FindNextFileW(hFind, &dat));
        err = GetLastError();
-       CloseHandle(hFind);
+       FindClose(hFind);
        if (err != ERROR_NO_MORE_FILES) {
                set_errno_from_win32_error(err);
                ret = GLOB_ABORTED;
@@ -701,7 +685,7 @@ win32_wglob(const wchar_t *pattern, int flags,
        return 0;
 
 oom:
-       CloseHandle(hFind);
+       FindClose(hFind);
        errno = ENOMEM;
        ret = GLOB_NOSPACE;
 fail_globfree:
@@ -786,4 +770,4 @@ now_as_wim_timestamp(void)
        return ((u64)ft.dwHighDateTime << 32) | ft.dwLowDateTime;
 }
 
-#endif /* __WIN32__ */
+#endif /* _WIN32 */