From 0b2cac89a5bfb3a36b7dacd0890a79355cc9d8a2 Mon Sep 17 00:00:00 2001 From: rfm Date: Mon, 19 Jul 2010 08:54:38 +0000 Subject: [PATCH] mingw fixups git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30999 72102866-910b-0410-8b05-ffd578937521 --- Source/NSPathUtilities.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/NSPathUtilities.m b/Source/NSPathUtilities.m index 9c3b67bb8..025c9d77f 100644 --- a/Source/NSPathUtilities.m +++ b/Source/NSPathUtilities.m @@ -119,6 +119,7 @@ static NSString *gnustep_is_flattened = #if defined(__MINGW__) +#include #include /* @@ -946,6 +947,7 @@ static void InitialisePathUtilities(void) unichar buf[1024]; SID_NAME_USE use; SID sid; + LPTSTR str; DWORD n = 1024; if (GetUserNameW(buf, &n) == 0 || buf[0] == '\0') @@ -954,12 +956,17 @@ static void InitialisePathUtilities(void) format: @"Unable to determine current user name"]; } n = sizeof(SID); - if (LookupAccountName(0, buf, &sid, &n, NULL, 0, &use) == 0) + if (LookupAccountNameW(0, buf, &sid, &n, NULL, 0, &use) == 0) { [NSException raise: NSInternalInconsistencyException format: @"Unable to determine current account"]; } - gnustepUserID = [[NSString alloc] initWithFormat: @"%ld", (long)sid]; + if (ConvertSidToStringSid(&sid, &str) == 0) + { + [NSException raise: NSInternalInconsistencyException + format: @"Unable to get current user ID string"]; + } + gnustepUserID = [[NSString alloc] initWithUTF8String: str]; } #else gnustepUserID = [[NSString alloc] initWithFormat: @"%ld", (long)getuid()];