]> git.ipfire.org Git - thirdparty/git.git/blobdiff - compat/mingw.c
Sync with 2.34.2
[thirdparty/git.git] / compat / mingw.c
index 5e42191fa4acb4ec353df177488ec4d7d1555a05..41fc16310c8018057be238efdd348fdee94616bd 100644 (file)
@@ -9,6 +9,8 @@
 #include "win32/lazyload.h"
 #include "../config.h"
 #include "dir.h"
+#define SECURITY_WIN32
+#include <sspi.h>
 
 #define HCAST(type, handle) ((type)(intptr_t)handle)
 
@@ -1009,7 +1011,7 @@ size_t mingw_strftime(char *s, size_t max,
        /* a pointer to the original strftime in case we can't find the UCRT version */
        static size_t (*fallback)(char *, size_t, const char *, const struct tm *) = strftime;
        size_t ret;
-       DECLARE_PROC_ADDR(ucrtbase.dll, size_t, strftime, char *, size_t,
+       DECLARE_PROC_ADDR(ucrtbase.dll, size_t, __cdecl, strftime, char *, size_t,
                const char *, const struct tm *);
 
        if (INIT_PROC_ADDR(strftime))
@@ -1126,6 +1128,10 @@ char *mingw_getcwd(char *pointer, int len)
        }
        if (!ret || ret >= ARRAY_SIZE(wpointer))
                return NULL;
+       if (GetFileAttributesW(wpointer) == INVALID_FILE_ATTRIBUTES) {
+               errno = ENOENT;
+               return NULL;
+       }
        if (xwcstoutf(pointer, wpointer, len) < 0)
                return NULL;
        convert_slashes(pointer);
@@ -2186,7 +2192,7 @@ enum EXTENDED_NAME_FORMAT {
 
 static char *get_extended_user_info(enum EXTENDED_NAME_FORMAT type)
 {
-       DECLARE_PROC_ADDR(secur32.dll, BOOL, GetUserNameExW,
+       DECLARE_PROC_ADDR(secur32.dll, BOOL, SEC_ENTRY, GetUserNameExW,
                enum EXTENDED_NAME_FORMAT, LPCWSTR, PULONG);
        static wchar_t wbuffer[1024];
        DWORD len;