ChangeSet ID: 21380 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/11/21 10:26:34
Modified files: dlls/kernel : virtual.c sync.c
Log message: Vitaliy Margolen wine-patch@kievinfo.com Kernel32 should create named objects with OBJ_OPENIF flag set. Handle STATUS_OBJECT_NAME_EXISTS explicitly as it's not mapped with RtlNtStatusToDosError.
Patch: http://cvs.winehq.org/patch.py?id=21380
Old revision New revision Changes Path 1.11 1.12 +5 -2 wine/dlls/kernel/virtual.c 1.92 1.93 +20 -8 wine/dlls/kernel/sync.c
Index: wine/dlls/kernel/virtual.c diff -u -p wine/dlls/kernel/virtual.c:1.11 wine/dlls/kernel/virtual.c:1.12 --- wine/dlls/kernel/virtual.c:1.11 21 Nov 2005 16:26:34 -0000 +++ wine/dlls/kernel/virtual.c 21 Nov 2005 16:26:34 -0000 @@ -308,7 +308,7 @@ HANDLE WINAPI CreateFileMappingW( HANDLE attr.Length = sizeof(attr); attr.RootDirectory = 0; attr.ObjectName = NULL; - attr.Attributes = OBJ_CASE_INSENSITIVE | + attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF | ((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0); attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; attr.SecurityQualityOfService = NULL; @@ -354,7 +354,10 @@ HANDLE WINAPI CreateFileMappingW( HANDLE size.u.HighPart = size_high;
status = NtCreateSection( &ret, access, &attr, &size, protect, sec_type, hFile ); - SetLastError( RtlNtStatusToDosError(status) ); + if (status == STATUS_OBJECT_NAME_EXISTS) + SetLastError( ERROR_ALREADY_EXISTS ); + else + SetLastError( RtlNtStatusToDosError(status) ); return ret; }
Index: wine/dlls/kernel/sync.c diff -u -p wine/dlls/kernel/sync.c:1.92 wine/dlls/kernel/sync.c:1.93 --- wine/dlls/kernel/sync.c:1.92 21 Nov 2005 16:26:34 -0000 +++ wine/dlls/kernel/sync.c 21 Nov 2005 16:26:34 -0000 @@ -445,7 +445,7 @@ HANDLE WINAPI CreateEventW( SECURITY_ATT attr.Length = sizeof(attr); attr.RootDirectory = 0; attr.ObjectName = NULL; - attr.Attributes = OBJ_CASE_INSENSITIVE | + attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF | ((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0); attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; attr.SecurityQualityOfService = NULL; @@ -456,7 +456,10 @@ HANDLE WINAPI CreateEventW( SECURITY_ATT }
status = NtCreateEvent( &ret, EVENT_ALL_ACCESS, &attr, manual_reset, initial_state ); - SetLastError( RtlNtStatusToDosError(status) ); + if (status == STATUS_OBJECT_NAME_EXISTS) + SetLastError( ERROR_ALREADY_EXISTS ); + else + SetLastError( RtlNtStatusToDosError(status) ); return ret; }
@@ -640,7 +643,7 @@ HANDLE WINAPI CreateMutexW( SECURITY_ATT attr.Length = sizeof(attr); attr.RootDirectory = 0; attr.ObjectName = NULL; - attr.Attributes = OBJ_CASE_INSENSITIVE | + attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF | ((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0); attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; attr.SecurityQualityOfService = NULL; @@ -651,7 +654,10 @@ HANDLE WINAPI CreateMutexW( SECURITY_ATT }
status = NtCreateMutant( &ret, MUTEX_ALL_ACCESS, &attr, owner ); - SetLastError( RtlNtStatusToDosError(status) ); + if (status == STATUS_OBJECT_NAME_EXISTS) + SetLastError( ERROR_ALREADY_EXISTS ); + else + SetLastError( RtlNtStatusToDosError(status) ); return ret; }
@@ -762,7 +768,7 @@ HANDLE WINAPI CreateSemaphoreW( SECURITY attr.Length = sizeof(attr); attr.RootDirectory = 0; attr.ObjectName = NULL; - attr.Attributes = OBJ_CASE_INSENSITIVE | + attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF | ((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0); attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; attr.SecurityQualityOfService = NULL; @@ -773,7 +779,10 @@ HANDLE WINAPI CreateSemaphoreW( SECURITY }
status = NtCreateSemaphore( &ret, SEMAPHORE_ALL_ACCESS, &attr, initial, max ); - SetLastError( RtlNtStatusToDosError(status) ); + if (status == STATUS_OBJECT_NAME_EXISTS) + SetLastError( ERROR_ALREADY_EXISTS ); + else + SetLastError( RtlNtStatusToDosError(status) ); return ret; }
@@ -877,7 +886,7 @@ HANDLE WINAPI CreateWaitableTimerW( SECU attr.Length = sizeof(attr); attr.RootDirectory = 0; attr.ObjectName = NULL; - attr.Attributes = OBJ_CASE_INSENSITIVE | + attr.Attributes = OBJ_CASE_INSENSITIVE | OBJ_OPENIF | ((sa && sa->bInheritHandle) ? OBJ_INHERIT : 0); attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; attr.SecurityQualityOfService = NULL; @@ -889,7 +898,10 @@ HANDLE WINAPI CreateWaitableTimerW( SECU
status = NtCreateTimer(&handle, TIMER_ALL_ACCESS, &attr, manual ? NotificationTimer : SynchronizationTimer); - SetLastError( RtlNtStatusToDosError(status) ); + if (status == STATUS_OBJECT_NAME_EXISTS) + SetLastError( ERROR_ALREADY_EXISTS ); + else + SetLastError( RtlNtStatusToDosError(status) ); return handle; }