- Update to r53061
[reactos.git] / dll / win32 / kernel32 / client / file / filemap.c
similarity index 88%
rename from dll/win32/kernel32/mem/section.c
rename to dll/win32/kernel32/client/file/filemap.c
index 705a8c3..46882e0 100644 (file)
@@ -27,38 +27,14 @@ CreateFileMappingA(IN HANDLE hFile,
                    IN DWORD dwMaximumSizeLow,
                    IN LPCSTR lpName)
 {
-    NTSTATUS Status;
-    ANSI_STRING AnsiName;
-    PUNICODE_STRING UnicodeCache;
-    LPCWSTR UnicodeName = NULL;
-
-    /* Check for a name */
-    if (lpName)
-    {
-        /* Use TEB Cache */
-        UnicodeCache = &NtCurrentTeb()->StaticUnicodeString;
-
-        /* Convert to unicode */
-        RtlInitAnsiString(&AnsiName, lpName);
-        Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE);
-        if (!NT_SUCCESS(Status))
-        {
-            /* Conversion failed */
-            SetLastErrorByStatus(Status);
-            return NULL;
-        }
-
-        /* Otherwise, save the buffer */
-        UnicodeName = (LPCWSTR)UnicodeCache->Buffer;
-    }
-
-    /* Call the Unicode version */
-    return CreateFileMappingW(hFile,
-                              lpFileMappingAttributes,
-                              flProtect,
-                              dwMaximumSizeHigh,
-                              dwMaximumSizeLow,
-                              UnicodeName);
+    /* Call the W(ide) function */
+    ConvertWin32AnsiObjectApiToUnicodeApi(FileMapping,
+                                          lpName,
+                                          hFile,
+                                          lpFileMappingAttributes,
+                                          flProtect,
+                                          dwMaximumSizeHigh,
+                                          dwMaximumSizeLow);
 }
 
 /*
@@ -148,7 +124,7 @@ CreateFileMappingW(HANDLE hFile,
     if (!NT_SUCCESS(Status))
     {
         /* We failed */
-        SetLastErrorByStatus(Status);
+        BaseSetLastNTError(Status);
         return NULL;
     }
 
@@ -215,7 +191,7 @@ MapViewOfFileEx(HANDLE hFileMappingObject,
     if (!NT_SUCCESS(Status))
     {
         /* We failed */
-        SetLastErrorByStatus(Status);
+        BaseSetLastNTError(Status);
         return NULL;
     }
 
@@ -257,7 +233,7 @@ UnmapViewOfFile(LPCVOID lpBaseAddress)
     if (!NT_SUCCESS(Status))
     {
         /* We failed */
-        SetLastErrorByStatus(Status);
+        BaseSetLastNTError(Status);
         return FALSE;
     }
 
@@ -290,7 +266,7 @@ OpenFileMappingA(DWORD dwDesiredAccess,
         if (!NT_SUCCESS(Status))
         {
             /* Conversion failed */
-            SetLastErrorByStatus(Status);
+            BaseSetLastNTError(Status);
             return NULL;
         }
     }
@@ -347,7 +323,7 @@ OpenFileMappingW(DWORD dwDesiredAccess,
     if (!NT_SUCCESS(Status))
     {
         /* We failed */
-        SetLastErrorByStatus(Status);
+        BaseSetLastNTError(Status);
         return NULL;
     }
 
@@ -379,7 +355,7 @@ FlushViewOfFile(LPCVOID lpBaseAddress,
     if (!NT_SUCCESS(Status))
     {
         /* We failed */
-        SetLastErrorByStatus(Status);
+        BaseSetLastNTError(Status);
         return FALSE;
     }