mingw fixups.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22313 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2006-01-15 13:13:36 +00:00
parent fd8a7084d7
commit 0812a50d13
3 changed files with 25 additions and 4 deletions

View file

@ -1,3 +1,12 @@
2006-01-15 Richard Frith-Macdonald <rfm@gnu.org>
* Source/win32/NSMessagePortNameServerWin32.m:
* Source/win32/NSMessagePortWin32.m:
Add hack to cope with bug reading registry ... better solution welcome
if anyone knows one.
Add security attributes to message port stuff ... should only let
current user on current machine access message ports I hope.
2006-01-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPathUtilities.m: Fix possible read off end of buffer

View file

@ -50,6 +50,8 @@ static NSMapTable portToNamesMap;
static NSString *registry;
static HKEY key;
static SECURITY_ATTRIBUTES security;
@interface NSMessagePortNameServer (private)
+ (NSString *) _query: (NSString *)name;
+ (NSString *) _translate: (NSString *)name;
@ -97,6 +99,10 @@ static void clean_up_names(void)
NSObjectMapValueCallBacks, 0);
atexit(clean_up_names);
security.nLength = sizeof(SECURITY_ATTRIBUTES);
security.lpSecurityDescriptor = 0; // Default
security.bInheritHandle = TRUE;
registry = @"Software\\GNUstepNSMessagePort";
rc = RegCreateKeyExW(
HKEY_CURRENT_USER,
@ -106,7 +112,7 @@ static void clean_up_names(void)
REG_OPTION_VOLATILE,
STANDARD_RIGHTS_WRITE|STANDARD_RIGHTS_READ|KEY_SET_VALUE
|KEY_QUERY_VALUE|KEY_NOTIFY,
NULL,
&security,
&key,
NULL);
if (rc == ERROR_SUCCESS)
@ -203,7 +209,7 @@ OutputDebugStringW(L"");
UNISTR(p),
GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
(LPSECURITY_ATTRIBUTES)0,
&security,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
(HANDLE)0);

View file

@ -127,6 +127,8 @@ typedef struct {
@implementation NSMessagePort
static SECURITY_ATTRIBUTES security;
static NSRecursiveLock *messagePortLock = nil;
/*
@ -152,7 +154,7 @@ static Class messagePortClass = 0;
UNISTR(path),
GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
(LPSECURITY_ATTRIBUTES)0,
&security,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
(HANDLE)0);
@ -184,6 +186,10 @@ static Class messagePortClass = 0;
NSNonOwnedPointerMapValueCallBacks, 0);
messagePortLock = [GSLazyRecursiveLock new];
security.nLength = sizeof(SECURITY_ATTRIBUTES);
security.lpSecurityDescriptor = 0; // Default
security.bInheritHandle = TRUE;
}
}
@ -322,7 +328,7 @@ static Class messagePortClass = 0;
UNISTR(path),
0, /* No max message size. */
MAILSLOT_WAIT_FOREVER, /* No read/write timeout. */
(LPSECURITY_ATTRIBUTES)0);
&security);
if (this->rHandle == INVALID_HANDLE_VALUE)
{