mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-27 18:50:47 +00:00
Add initial bugfix for problem reported by Wim
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24398 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f9daa8dbc6
commit
fdcd37b4c6
1 changed files with 37 additions and 8 deletions
|
@ -159,8 +159,10 @@ static void clean_up_names(void)
|
||||||
{
|
{
|
||||||
NSString *n;
|
NSString *n;
|
||||||
NSString *p;
|
NSString *p;
|
||||||
unsigned char buf[25];
|
unsigned char buf[1024];
|
||||||
DWORD len = 25;
|
unsigned char *ptr = buf;
|
||||||
|
DWORD max = 1024;
|
||||||
|
DWORD len = 1024;
|
||||||
DWORD type;
|
DWORD type;
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -194,21 +196,46 @@ OutputDebugStringW(L"");
|
||||||
UNISTR(n),
|
UNISTR(n),
|
||||||
(LPDWORD)0,
|
(LPDWORD)0,
|
||||||
&type,
|
&type,
|
||||||
(LPBYTE)buf,
|
(LPBYTE)ptr,
|
||||||
&len);
|
&len);
|
||||||
|
while (rc == ERROR_MORE_DATA)
|
||||||
|
{
|
||||||
|
if (ptr != buf)
|
||||||
|
{
|
||||||
|
objc_free(ptr);
|
||||||
|
}
|
||||||
|
max += 1024;
|
||||||
|
ptr = objc_malloc(max);
|
||||||
|
len = max;
|
||||||
|
rc = RegQueryValueExW(
|
||||||
|
key,
|
||||||
|
UNISTR(n),
|
||||||
|
(LPDWORD)0,
|
||||||
|
&type,
|
||||||
|
(LPBYTE)ptr,
|
||||||
|
&len);
|
||||||
|
}
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
if (ptr != buf)
|
||||||
|
{
|
||||||
|
objc_free(ptr);
|
||||||
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = [NSString stringWithUTF8String: buf];
|
p = [NSString stringWithUTF8String: ptr];
|
||||||
|
if (ptr != buf)
|
||||||
|
{
|
||||||
|
objc_free(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See if we can open the mailslot ... if not, the query returned
|
* See if we can open the port mailslot ... if not, the query returned
|
||||||
* an old name, and we can remove it.
|
* an old name, and we can remove it.
|
||||||
*/
|
*/
|
||||||
p = [NSString stringWithFormat:
|
p = [NSString stringWithFormat:
|
||||||
@"\\\\.\\mailslot\\GNUstep\\NSMessagePort\\%@", n];
|
@"\\\\.\\mailslot\\GNUstep\\NSMessagePort\\%@", p];
|
||||||
h = CreateFileW(
|
h = CreateFileW(
|
||||||
UNISTR(p),
|
UNISTR(p),
|
||||||
GENERIC_WRITE,
|
GENERIC_WRITE,
|
||||||
|
@ -287,6 +314,7 @@ OutputDebugStringW(L"");
|
||||||
NSMutableArray *a;
|
NSMutableArray *a;
|
||||||
NSString *n;
|
NSString *n;
|
||||||
int rc;
|
int rc;
|
||||||
|
const unsigned char *str;
|
||||||
|
|
||||||
NSDebugLLog(@"NSMessagePortNameServer", @"register %@ as %@\n", port, name);
|
NSDebugLLog(@"NSMessagePortNameServer", @"register %@ as %@\n", port, name);
|
||||||
if ([port isKindOfClass: [NSMessagePort class]] == NO)
|
if ([port isKindOfClass: [NSMessagePort class]] == NO)
|
||||||
|
@ -304,14 +332,15 @@ OutputDebugStringW(L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
n = [[self class] _translate: name];
|
n = [[self class] _translate: name];
|
||||||
|
str = [[(NSMessagePort*)port name] UTF8String];
|
||||||
|
|
||||||
rc = RegSetValueExW(
|
rc = RegSetValueExW(
|
||||||
key,
|
key,
|
||||||
UNISTR(n),
|
UNISTR(n),
|
||||||
0,
|
0,
|
||||||
REG_BINARY,
|
REG_BINARY,
|
||||||
[[(NSMessagePort*)port name] UTF8String],
|
str,
|
||||||
25);
|
strlen(str)+1);
|
||||||
if (rc == ERROR_SUCCESS)
|
if (rc == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
rc = RegFlushKey(key);
|
rc = RegFlushKey(key);
|
||||||
|
|
Loading…
Reference in a new issue