Commit in reactos/lib/kernel32/mem on MAIN
resnotify.c+7-91.1 -> 1.2
section.c+40-231.26 -> 1.27
+47-32
2 modified files
minor fixes

reactos/lib/kernel32/mem
resnotify.c 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- resnotify.c	21 Sep 2004 19:17:26 -0000	1.1
+++ resnotify.c	24 Oct 2004 12:55:19 -0000	1.2
@@ -1,4 +1,4 @@
-/* $Id: resnotify.c,v 1.1 2004/09/21 19:17:26 weiden Exp $
+/* $Id: resnotify.c,v 1.2 2004/10/24 12:55:19 weiden Exp $
  *
  * COPYRIGHT:            See COPYING in the top level directory
  * PROJECT:              ReactOS kernel
@@ -45,12 +45,11 @@
         return NULL;
     }
 
-    ObjectAttributes.Length = sizeof(OBJECT_ATTRIBUTES);
-    ObjectAttributes.RootDirectory = hBaseDir;
-    ObjectAttributes.ObjectName = &EventName;
-    ObjectAttributes.Attributes = 0;
-    ObjectAttributes.SecurityDescriptor = NULL;
-    ObjectAttributes.SecurityQualityOfService = NULL;
+    InitializeObjectAttributes(&ObjectAttributes,
+                               &EventName,
+                               0,
+                               hBaseDir,
+                               NULL);
 
     Status = NtOpenEvent(&hEvent,
                          EVENT_QUERY_STATE | SYNCHRONIZE,
@@ -76,7 +75,6 @@
     )
 {
     EVENT_BASIC_INFORMATION ebi;
-    ULONG RetLen;
     NTSTATUS Status;
     
     if(ResourceState != NULL)
@@ -85,7 +83,7 @@
                             EventBasicInformation,
                             &ebi,
                             sizeof(ebi),
-                            &RetLen);
+                            NULL);
       if(NT_SUCCESS(Status))
       {
         *ResourceState = ebi.EventState;

reactos/lib/kernel32/mem
section.c 1.26 -> 1.27
diff -u -r1.26 -r1.27
--- section.c	28 Aug 2004 22:16:27 -0000	1.26
+++ section.c	24 Oct 2004 12:55:19 -0000	1.27
@@ -1,4 +1,4 @@
-/* $Id: section.c,v 1.26 2004/08/28 22:16:27 navaraf Exp $
+/* $Id: section.c,v 1.27 2004/10/24 12:55:19 weiden Exp $
  *
  * COPYRIGHT:            See COPYING in the top level directory
  * PROJECT:              ReactOS kernel
@@ -64,24 +64,34 @@
         MaximumSize.u.HighPart = dwMaximumSizeHigh;
         MaximumSizePointer = &MaximumSize;
      }
-   RtlInitAnsiString(&AnsiName,
-		     (LPSTR)lpName);
-   RtlAnsiStringToUnicodeString(&UnicodeName,
-				&AnsiName,
-				TRUE);
+
+   if (lpName != NULL)
+     {
+        RtlInitAnsiString(&AnsiName,
+                          (LPSTR)lpName);
+        RtlAnsiStringToUnicodeString(&UnicodeName,
+                                     &AnsiName,
+                                     TRUE);
+     }
+
    InitializeObjectAttributes(&ObjectAttributes,
-			      &UnicodeName,
+			      (lpName ? &UnicodeName : NULL),
 			      0,
 			      hBaseDir,
 			      SecurityDescriptor);
+
    Status = NtCreateSection(&SectionHandle,
 			    SECTION_ALL_ACCESS,
 			    &ObjectAttributes,
 			    MaximumSizePointer,
 			    flProtect & MASK_PAGE_FLAGS,
 			    flProtect & MASK_SEC_FLAGS,
-			    hFile==INVALID_HANDLE_VALUE ? NULL : hFile);
-   RtlFreeUnicodeString(&UnicodeName);
+			    ((hFile != INVALID_HANDLE_VALUE) ? hFile : NULL));
+   if (lpName != NULL)
+     {
+        RtlFreeUnicodeString(&UnicodeName);
+     }
+
    if (!NT_SUCCESS(Status))
      {
 	SetLastErrorByStatus(Status);
@@ -135,20 +145,26 @@
         MaximumSize.u.HighPart = dwMaximumSizeHigh;
         MaximumSizePointer = &MaximumSize;
      }
-   RtlInitUnicodeString(&UnicodeName,
-			lpName);
+
+   if (lpName != NULL)
+     {
+        RtlInitUnicodeString(&UnicodeName,
+                             lpName);
+     }
+
    InitializeObjectAttributes(&ObjectAttributes,
-			      &UnicodeName,
+			      (lpName ? &UnicodeName : NULL),
 			      0,
 			      hBaseDir,
 			      SecurityDescriptor);
+
    Status = NtCreateSection(&SectionHandle,
 			    SECTION_ALL_ACCESS,
 			    &ObjectAttributes,
 			    MaximumSizePointer,
 			    flProtect & MASK_PAGE_FLAGS,
 			    flProtect & MASK_SEC_FLAGS,
-			    hFile==INVALID_HANDLE_VALUE ? NULL : hFile);
+			    ((hFile != INVALID_HANDLE_VALUE) ? hFile : NULL));
    if (!NT_SUCCESS(Status))
      {
 	SetLastErrorByStatus(Status);
@@ -270,12 +286,11 @@
    OBJECT_ATTRIBUTES ObjectAttributes;
    ANSI_STRING AnsiName;
    UNICODE_STRING UnicodeName;
-
-   ULONG Attributes = 0;
-
-   if (bInheritHandle)
+   
+   if (lpName == NULL)
      {
-	Attributes = OBJ_INHERIT;
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return NULL;
      }
 
    RtlInitAnsiString(&AnsiName,
@@ -286,7 +301,7 @@
 
    InitializeObjectAttributes(&ObjectAttributes,
 			      &UnicodeName,
-			      Attributes,
+			      (bInheritHandle ? OBJ_INHERIT : 0),
 			      hBaseDir,
 			      NULL);
    Status = NtOpenSection(&SectionHandle,
@@ -298,6 +313,7 @@
 	SetLastErrorByStatus (Status);
 	return NULL;
      }
+
    return SectionHandle;
 }
 
@@ -314,18 +330,18 @@
    HANDLE SectionHandle;
    OBJECT_ATTRIBUTES ObjectAttributes;
    UNICODE_STRING UnicodeName;
-   ULONG Attributes = 0;
 
-   if (bInheritHandle)
+   if (lpName == NULL)
      {
-	Attributes = OBJ_INHERIT;
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return NULL;
      }
 
    RtlInitUnicodeString(&UnicodeName,
 			lpName);
    InitializeObjectAttributes(&ObjectAttributes,
 			      &UnicodeName,
-			      Attributes,
+			      (bInheritHandle ? OBJ_INHERIT : 0),
 			      hBaseDir,
 			      NULL);
    Status = ZwOpenSection(&SectionHandle,
@@ -336,6 +352,7 @@
 	SetLastErrorByStatus(Status);
 	return NULL;
      }
+
    return SectionHandle;
 }
 
CVSspam 0.2.8