LOCDEFS = -DPERLDLL -DPERL_CORE
SUBSYS = console
LIBC = -lcrtdll
-LIBFILES = $(CRYPT_LIB) -ladvapi32 -luser32 -lwsock32 -lmingw32 -lgcc -lmoldname $(LIBC) \
- -lkernel32
+LIBFILES = $(CRYPT_LIB) -ladvapi32 -luser32 -lnetapi32 -lwsock32 -lmingw32 \
+ -lgcc -lmoldname $(LIBC) -lkernel32
WINIOMAYBE =
#endif
#include <windows.h>
+#ifndef __MINGW32__
#include <lmcons.h>
#include <lmerr.h>
/* ugliness to work around a buggy struct definition in lmwksta.h */
#include <lmwksta.h>
#undef LPTSTR
#define LPTSTR LPSTR
+#include <lmapibuf.h>
+#endif /* __MINGW32__ */
/* #include "config.h" */
XS(w32_DomainName)
{
dXSARGS;
+#ifdef __MINGW32__
+ /* mingw32 doesn't have NetWksta*() yet, so do it the old way */
+ char name[256];
+ DWORD size = sizeof(name);
+ if (GetUserName(name,&size)) {
+ char sid[1024];
+ DWORD sidlen = sizeof(sid);
+ char dname[256];
+ DWORD dnamelen = sizeof(dname);
+ SID_NAME_USE snu;
+ if (LookupAccountName(NULL, name, &sid, &sidlen,
+ dname, &dnamelen, &snu)) {
+ XSRETURN_PV(dname); /* all that for this */
+ }
+ }
+#else
+ /* this way is more reliable, in case user has a local account */
char dname[256];
DWORD dnamelen = sizeof(dname);
PWKSTA_INFO_100 pwi;
NetApiBufferFree(pwi);
XSRETURN_PV(dname);
}
+#endif
XSRETURN_UNDEF;
}
#define flushall _flushall
#define fcloseall _fcloseall
+#ifndef _O_NOINHERIT
+# define _O_NOINHERIT 0x0080
+# ifndef _NO_OLDNAMES
+# define O_NOINHERIT _O_NOINHERIT
+# endif
+#endif
+
#endif /* __MINGW32__ */
/* compatibility stuff for other compilers goes here */