AC_FUNC_STRERROR_R
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS([CreateHardLink CreateSymbolicLink])
+AC_CHECK_FUNCS([CreateHardLinkA CreateSymbolicLink])
AC_CHECK_FUNCS([chflags chown chroot])
AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fork])
AC_CHECK_FUNCS([fstat ftruncate futimes geteuid getpid])
return f == NULL ? 0 : (*f)(linkname, target, flags);
}
-int __CreateHardLinkA(const char *linkname, const char *target)
-{
- static BOOLEAN (*f)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES);
- static int set;
- if (!set) {
- set = 1;
- f = GetFunctionKernel32("CreateHardLinkA");
- }
- if (f == NULL)
- return 0;
- return (*f)(linkname, target, NULL);
-}
#endif
/*
int succeeded;
count_assertion(file, line);
-#if defined(_WIN32) && !defined(__CYGWIN__)
- succeeded = __CreateHardLinkA(newpath, linkto);
-#elif HAVE_LINK
+#if HAVE_LINK
succeeded = !link(linkto, newpath);
+#elif HAVE_CREATEHARDLINKA
+ succeeded = CreateHardLinkA(newpath, linkto, NULL);
#else
succeeded = 0;
#endif
#endif
#include <io.h>
#include <windows.h>
-#include <winbase.h>
#ifndef F_OK
#define F_OK (0)
#endif
#define umask _umask
#endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
+void *GetFunctionKernel32(const char *name)
+{
+ static HINSTANCE lib;
+ static int set;
+ if (!set) {
+ set = 1;
+ lib = LoadLibrary("kernel32.dll");
+ }
+ if (lib == NULL) {
+ fprintf(stderr, "Can't load kernel32.dll?!\n");
+ return NULL;
+ }
+ return (void *)GetProcAddress(lib, name);
+}
+
+int __CreateSymbolicLinkA(const char *linkname, const char *target, int flags)
+{
+ static BOOLEAN (*f)(LPCSTR, LPCSTR, DWORD);
+ static int set;
+ if (!set) {
+ set = 1;
+ f = GetFunctionKernel32("CreateSymbolicLinkA");
+ }
+ return f == NULL ? 0 : (*f)(linkname, target, flags);
+}
+
+#endif
+
/*
* This same file is used pretty much verbatim for all test harnesses.
*
int succeeded;
count_assertion(file, line);
-#if HAVE_CREATEHARDLINK
- succeeded = CreateHardLink(newpath, linkto, NULL);
-#elif HAVE_LINK
+#if HAVE_LINK
succeeded = !link(linkto, newpath);
+#elif HAVE_CREATEHARDLINKA
+ succeeded = CreateHardLinkA(newpath, linkto, NULL);
#else
succeeded = 0;
#endif
test_assert_make_symlink(const char *file, int line,
const char *newpath, const char *linkto)
{
-#if HAVE_CREATESYMBOLICLINK
- int targetIsDir = 0; /* TODO: Fix this. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ int targetIsDir = 0; /* TODO: Fix this */
count_assertion(file, line);
- if (CreateSymbolicLink(newpath, linkto, targetIsDir))
+ if (__CreateSymbolicLinkA(newpath, linkto, targetIsDir))
return (1);
#elif HAVE_SYMLINK
count_assertion(file, line);
return f == NULL ? 0 : (*f)(linkname, target, flags);
}
-int __CreateHardLinkA(const char *linkname, const char *target)
-{
- return CreateHardLinkA(linkname, target, NULL);
-#if 0
- static BOOLEAN (*f)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES);
- static int set;
- if (!set) {
- set = 1;
- f = GetFunctionKernel32("CreateHardLinkA");
- }
- if (f == NULL)
- return 0;
- return (*f)(linkname, target, NULL);
-#endif
-}
#endif
/*
int succeeded;
count_assertion(file, line);
-#if defined(_WIN32) && !defined(__CYGWIN__)
- succeeded = __CreateHardLinkA(newpath, linkto);
-#elif HAVE_LINK
+#if HAVE_LINK
succeeded = !link(linkto, newpath);
+#elif HAVE_CREATEHARDLINKA
+ succeeded = CreateHardLinkA(newpath, linkto, NULL);
#else
succeeded = 0;
#endif