Author: ion
Date: Sun Nov  6 23:01:04 2011
New Revision: 54323

URL: http://svn.reactos.org/svn/reactos?rev=54323&view=rev
Log:
[KERNEL32]: Move the "curdir.c" APIs into path.c as well, as they are Path 
APIs. No code changes (just formatting and moving to DPRINTs).

Removed:
    trunk/reactos/dll/win32/kernel32/client/file/curdir.c
Modified:
    trunk/reactos/dll/win32/kernel32/CMakeLists.txt
    trunk/reactos/dll/win32/kernel32/client/path.c
    trunk/reactos/dll/win32/kernel32/kernel32.rbuild

Modified: trunk/reactos/dll/win32/kernel32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/CMakeLists.txt?rev=54323&r1=54322&r2=54323&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/CMakeLists.txt [iso-8859-1] Sun Nov  6 
23:01:04 2011
@@ -43,7 +43,6 @@
     client/file/copy.c
     client/file/console.c
     client/file/create.c
-    client/file/curdir.c
     client/file/delete.c
     client/file/deviceio.c
     client/file/dir.c

Removed: trunk/reactos/dll/win32/kernel32/client/file/curdir.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/file/curdir.c?rev=54322&view=auto
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/file/curdir.c [iso-8859-1] 
(original)
+++ trunk/reactos/dll/win32/kernel32/client/file/curdir.c (removed)
@@ -1,388 +1,0 @@
-/* $Id$
- *
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS system libraries
- * FILE:            lib/kernel32/file/curdir.c
- * PURPOSE:         Current directory functions
- * PROGRAMMER:      Eric Kohl
- *                  Filip Navara
- *                  Steven Edwards
- *                  Thomas Weidenmueller
- *                  Gunnar Andre' Dalsnes
- * UPDATE HISTORY:
- *                  Created 30/09/98
- */
-
-
-/* INCLUDES ******************************************************************/
-
-#include <k32.h>
-#define NDEBUG
-#include <debug.h>
-
-#if DBG
-DEBUG_CHANNEL(kernel32file);
-#endif
-
-/* GLOBAL VARIABLES **********************************************************/
-
-UNICODE_STRING SystemDirectory;
-UNICODE_STRING WindowsDirectory;
-UNICODE_STRING BaseDefaultPathAppend;
-UNICODE_STRING BaseDefaultPath;
-
-
-/* FUNCTIONS *****************************************************************/
-
-
-
-
-/*
- * @implemented
- */
-DWORD
-WINAPI
-GetCurrentDirectoryA (
-       DWORD   nBufferLength,
-       LPSTR   lpBuffer
-       )
-{
-   WCHAR BufferW[MAX_PATH];
-   DWORD ret;
-
-   ret = GetCurrentDirectoryW(MAX_PATH, BufferW);
-
-   if (!ret) return 0;
-   if (ret > MAX_PATH)
-   {
-      SetLastError(ERROR_FILENAME_EXCED_RANGE);
-      return 0;
-   }
-
-   return FilenameW2A_FitOrFail(lpBuffer, nBufferLength, BufferW, ret+1);
-}
-
-
-/*
- * @implemented
- */
-DWORD
-WINAPI
-GetCurrentDirectoryW (
-       DWORD   nBufferLength,
-       LPWSTR  lpBuffer
-       )
-{
-       ULONG Length;
-
-       Length = RtlGetCurrentDirectory_U (nBufferLength * sizeof(WCHAR),
-                                          lpBuffer);
-
-       return (Length / sizeof (WCHAR));
-}
-
-
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-SetCurrentDirectoryA (
-       LPCSTR  lpPathName
-       )
-{
-   PWCHAR PathNameW;
-
-   TRACE("setcurrdir: %s\n",lpPathName);
-
-   if (!(PathNameW = FilenameA2W(lpPathName, FALSE)))
-      return FALSE;
-
-   return SetCurrentDirectoryW(PathNameW);
-}
-
-
-/*
- * @implemented
- */
-BOOL
-WINAPI
-SetCurrentDirectoryW (
-       LPCWSTR lpPathName
-       )
-{
-       UNICODE_STRING UnicodeString;
-       NTSTATUS Status;
-
-       RtlInitUnicodeString (&UnicodeString,
-                             lpPathName);
-
-       Status = RtlSetCurrentDirectory_U (&UnicodeString);
-       if (!NT_SUCCESS(Status))
-       {
-               BaseSetLastNTError (Status);
-               return FALSE;
-       }
-
-       return TRUE;
-}
-
-
-/*
- * @implemented
- *
- * NOTE: Windows returns a dos/short (8.3) path
- */
-DWORD
-WINAPI
-GetTempPathA (
-       DWORD   nBufferLength,
-       LPSTR   lpBuffer
-       )
-{
-   WCHAR BufferW[MAX_PATH];
-   DWORD ret;
-
-   ret = GetTempPathW(MAX_PATH, BufferW);
-
-   if (!ret)
-      return 0;
-
-   if (ret > MAX_PATH)
-   {
-      SetLastError(ERROR_FILENAME_EXCED_RANGE);
-      return 0;
-   }
-
-   return FilenameW2A_FitOrFail(lpBuffer, nBufferLength, BufferW, ret+1);
-}
-
-
-/*
- * @implemented
- *
- * ripped from wine
- */
-DWORD
-WINAPI
-GetTempPathW (
-       DWORD   count,
-   LPWSTR   path
-       )
-{
-    static const WCHAR tmp[]  = { 'T', 'M', 'P', 0 };
-    static const WCHAR temp[] = { 'T', 'E', 'M', 'P', 0 };
-    static const WCHAR userprofile[] = { 
'U','S','E','R','P','R','O','F','I','L','E',0 };
-    WCHAR tmp_path[MAX_PATH];
-    UINT ret;
-
-    TRACE("%u,%p\n", count, path);
-
-    if (!(ret = GetEnvironmentVariableW( tmp, tmp_path, MAX_PATH )) &&
-        !(ret = GetEnvironmentVariableW( temp, tmp_path, MAX_PATH )) &&
-        !(ret = GetEnvironmentVariableW( userprofile, tmp_path, MAX_PATH )) &&
-        !(ret = GetWindowsDirectoryW( tmp_path, MAX_PATH )))
-        return 0;
-
-   if (ret > MAX_PATH)
-   {
-     SetLastError(ERROR_FILENAME_EXCED_RANGE);
-     return 0;
-   }
-
-   ret = GetFullPathNameW(tmp_path, MAX_PATH, tmp_path, NULL);
-   if (!ret) return 0;
-
-   if (ret > MAX_PATH - 2)
-   {
-     SetLastError(ERROR_FILENAME_EXCED_RANGE);
-     return 0;
-   }
-
-   if (tmp_path[ret-1] != '\\')
-   {
-     tmp_path[ret++] = '\\';
-     tmp_path[ret]   = '\0';
-   }
-
-   ret++; /* add space for terminating 0 */
-
-   if (count)
-   {
-     lstrcpynW(path, tmp_path, count);
-     if (count >= ret)
-         ret--; /* return length without 0 */
-     else if (count < 4)
-         path[0] = 0; /* avoid returning ambiguous "X:" */
-   }
-
-   TRACE("GetTempPathW returning %u, %S\n", ret, path);
-   return ret;
-
-}
-
-
-/*
- * @implemented
- */
-UINT
-WINAPI
-GetSystemDirectoryA (
-       LPSTR   lpBuffer,
-       UINT    uSize
-       )
-{
-   return FilenameU2A_FitOrFail(lpBuffer, uSize, &SystemDirectory);
-}
-
-
-/*
- * @implemented
- */
-UINT
-WINAPI
-GetSystemDirectoryW (
-       LPWSTR  lpBuffer,
-       UINT    uSize
-       )
-{
-       ULONG Length;
-
-       Length = SystemDirectory.Length / sizeof (WCHAR);
-
-       if (lpBuffer == NULL)
-               return Length + 1;
-
-       if (uSize > Length)     {
-               memmove (lpBuffer,
-                        SystemDirectory.Buffer,
-                        SystemDirectory.Length);
-               lpBuffer[Length] = 0;
-
-               return Length;    //good: ret chars excl. nullchar
-       }
-
-       return Length+1;         //bad: ret space needed incl. nullchar
-}
-
-/*
- * @implemented
- */
-UINT
-WINAPI
-GetWindowsDirectoryA (
-       LPSTR   lpBuffer,
-       UINT    uSize
-       )
-{
-   return FilenameU2A_FitOrFail(lpBuffer, uSize, &WindowsDirectory);
-}
-
-
-/*
- * @implemented
- */
-UINT
-WINAPI
-GetWindowsDirectoryW (
-       LPWSTR  lpBuffer,
-       UINT    uSize
-       )
-{
-       ULONG Length;
-
-       Length = WindowsDirectory.Length / sizeof (WCHAR);
-
-       if (lpBuffer == NULL)
-               return Length + 1;
-
-       if (uSize > Length)
-       {
-               memmove (lpBuffer,
-                        WindowsDirectory.Buffer,
-                        WindowsDirectory.Length);
-               lpBuffer[Length] = 0;
-
-               return Length;    //good: ret chars excl. nullchar
-       }
-
-       return Length+1;        //bad: ret space needed incl. nullchar
-}
-
-/*
- * @implemented
- */
-UINT
-WINAPI
-GetSystemWindowsDirectoryA(
-       LPSTR   lpBuffer,
-       UINT    uSize
-       )
-{
-    return GetWindowsDirectoryA( lpBuffer, uSize );
-}
-
-/*
- * @implemented
- */
-UINT
-WINAPI
-GetSystemWindowsDirectoryW(
-       LPWSTR  lpBuffer,
-       UINT    uSize
-       )
-{
-    return GetWindowsDirectoryW( lpBuffer, uSize );
-}
-
-/*
- * @unimplemented
- */
-UINT
-WINAPI
-GetSystemWow64DirectoryW(
-    LPWSTR lpBuffer,
-    UINT uSize
-    )
-{
-#ifdef _WIN64
-    ERR("GetSystemWow64DirectoryW is UNIMPLEMENTED!\n");
-    return 0;
-#else
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-#endif
-}
-
-/*
- * @unimplemented
- */
-UINT
-WINAPI
-GetSystemWow64DirectoryA(
-    LPSTR lpBuffer,
-    UINT uSize
-    )
-{
-#ifdef _WIN64
-   WCHAR BufferW[MAX_PATH];
-   UINT ret;
-
-   ret = GetSystemWow64DirectoryW(BufferW, MAX_PATH);
-
-   if (!ret) return 0;
-   if (ret > MAX_PATH)
-   {
-      SetLastError(ERROR_FILENAME_EXCED_RANGE);
-      return 0;
-   }
-
-   return FilenameW2A_FitOrFail(lpBuffer, uSize, BufferW, ret+1);
-#else
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
-#endif
-}
-
-/* EOF */

Modified: trunk/reactos/dll/win32/kernel32/client/path.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/path.c?rev=54323&r1=54322&r2=54323&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/path.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/path.c [iso-8859-1] Sun Nov  6 
23:01:04 2011
@@ -17,6 +17,10 @@
 
 UNICODE_STRING BaseDllDirectory;
 UNICODE_STRING NoDefaultCurrentDirectoryInExePath = 
RTL_CONSTANT_STRING(L"NoDefaultCurrentDirectoryInExePath");
+UNICODE_STRING SystemDirectory;
+UNICODE_STRING WindowsDirectory;
+UNICODE_STRING BaseDefaultPathAppend;
+UNICODE_STRING BaseDefaultPath;
 
 /* This is bitmask for each illegal filename character */
 /* If someone has time, please feel free to use 0b notation */
@@ -452,7 +456,7 @@
 
 /*
  * @implemented
- * 
+ *
  * NOTE: Many of these A functions may seem to do rather complex A<->W mapping
  * beyond what you would usually expect. There are two main reasons:
  *
@@ -1471,4 +1475,293 @@
     return ReturnLength;
 }
 
+/*
+ * @implemented
+ */
+DWORD
+WINAPI
+GetCurrentDirectoryA(IN DWORD nBufferLength,
+                     IN LPSTR lpBuffer)
+{
+   WCHAR BufferW[MAX_PATH];
+   DWORD ret;
+
+   ret = GetCurrentDirectoryW(MAX_PATH, BufferW);
+
+   if (!ret) return 0;
+   if (ret > MAX_PATH)
+   {
+      SetLastError(ERROR_FILENAME_EXCED_RANGE);
+      return 0;
+   }
+
+   return FilenameW2A_FitOrFail(lpBuffer, nBufferLength, BufferW, ret+1);
+}
+
+/*
+ * @implemented
+ */
+DWORD
+WINAPI
+GetCurrentDirectoryW(IN DWORD nBufferLength,
+                     IN LPWSTR lpBuffer)
+{
+    ULONG Length;
+
+    Length = RtlGetCurrentDirectory_U (nBufferLength * sizeof(WCHAR), 
lpBuffer);
+    return (Length / sizeof (WCHAR));
+}
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+SetCurrentDirectoryA(IN LPCSTR lpPathName)
+{
+   PWCHAR PathNameW;
+
+   DPRINT("setcurrdir: %s\n",lpPathName);
+
+   if (!(PathNameW = FilenameA2W(lpPathName, FALSE))) return FALSE;
+
+   return SetCurrentDirectoryW(PathNameW);
+}
+
+/*
+ * @implemented
+ */
+BOOL
+WINAPI
+SetCurrentDirectoryW(IN LPCWSTR lpPathName)
+{
+    UNICODE_STRING UnicodeString;
+    NTSTATUS Status;
+
+    RtlInitUnicodeString(&UnicodeString, lpPathName);
+
+    Status = RtlSetCurrentDirectory_U(&UnicodeString);
+    if (!NT_SUCCESS(Status))
+    {
+        BaseSetLastNTError (Status);
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+/*
+ * @implemented
+ *
+ * NOTE: Windows returns a dos/short (8.3) path
+ */
+DWORD
+WINAPI
+GetTempPathA(IN DWORD nBufferLength,
+             IN LPSTR lpBuffer)
+{
+   WCHAR BufferW[MAX_PATH];
+   DWORD ret;
+
+   ret = GetTempPathW(MAX_PATH, BufferW);
+
+   if (!ret) return 0;
+
+   if (ret > MAX_PATH)
+   {
+      SetLastError(ERROR_FILENAME_EXCED_RANGE);
+      return 0;
+   }
+
+   return FilenameW2A_FitOrFail(lpBuffer, nBufferLength, BufferW, ret+1);
+}
+
+/*
+ * @implemented
+ *
+ * ripped from wine
+ */
+DWORD
+WINAPI
+GetTempPathW(IN DWORD count,
+             IN LPWSTR path)
+{
+    static const WCHAR tmp[]  = { 'T', 'M', 'P', 0 };
+    static const WCHAR temp[] = { 'T', 'E', 'M', 'P', 0 };
+    static const WCHAR userprofile[] = { 
'U','S','E','R','P','R','O','F','I','L','E',0 };
+    WCHAR tmp_path[MAX_PATH];
+    UINT ret;
+
+    DPRINT("%u,%p\n", count, path);
+
+    if (!(ret = GetEnvironmentVariableW( tmp, tmp_path, MAX_PATH )) &&
+        !(ret = GetEnvironmentVariableW( temp, tmp_path, MAX_PATH )) &&
+        !(ret = GetEnvironmentVariableW( userprofile, tmp_path, MAX_PATH )) &&
+        !(ret = GetWindowsDirectoryW( tmp_path, MAX_PATH )))
+        return 0;
+
+   if (ret > MAX_PATH)
+   {
+     SetLastError(ERROR_FILENAME_EXCED_RANGE);
+     return 0;
+   }
+
+   ret = GetFullPathNameW(tmp_path, MAX_PATH, tmp_path, NULL);
+   if (!ret) return 0;
+
+   if (ret > MAX_PATH - 2)
+   {
+     SetLastError(ERROR_FILENAME_EXCED_RANGE);
+     return 0;
+   }
+
+   if (tmp_path[ret-1] != '\\')
+   {
+     tmp_path[ret++] = '\\';
+     tmp_path[ret]   = '\0';
+   }
+
+   ret++; /* add space for terminating 0 */
+
+   if (count)
+   {
+     lstrcpynW(path, tmp_path, count);
+     if (count >= ret)
+         ret--; /* return length without 0 */
+     else if (count < 4)
+         path[0] = 0; /* avoid returning ambiguous "X:" */
+   }
+
+   DPRINT("GetTempPathW returning %u, %S\n", ret, path);
+   return ret;
+}
+
+/*
+ * @implemented
+ */
+UINT
+WINAPI
+GetSystemDirectoryA(IN LPSTR lpBuffer,
+                    IN UINT uSize)
+{
+   return FilenameU2A_FitOrFail(lpBuffer, uSize, &SystemDirectory);
+}
+
+/*
+ * @implemented
+ */
+UINT
+WINAPI
+GetSystemDirectoryW(IN LPWSTR lpBuffer,
+                    IN UINT uSize)
+{
+    ULONG Length;
+
+    Length = SystemDirectory.Length / sizeof (WCHAR);
+
+    if (lpBuffer == NULL) return Length + 1;
+
+    if (uSize > Length)
+    {
+        memmove(lpBuffer, SystemDirectory.Buffer, SystemDirectory.Length);
+        lpBuffer[Length] = 0;
+
+        return Length;   //good: ret chars excl. nullchar
+    }
+
+    return Length+1;    //bad: ret space needed incl. nullchar
+}
+
+/*
+ * @implemented
+ */
+UINT
+WINAPI
+GetWindowsDirectoryA(IN LPSTR lpBuffer,
+                     IN UINT uSize)
+{
+   return FilenameU2A_FitOrFail(lpBuffer, uSize, &WindowsDirectory);
+}
+
+/*
+ * @implemented
+ */
+UINT
+WINAPI
+GetWindowsDirectoryW(IN LPWSTR lpBuffer,
+                     IN UINT uSize)
+{
+    ULONG Length;
+
+    Length = WindowsDirectory.Length / sizeof (WCHAR);
+
+    if (lpBuffer == NULL) return Length + 1;
+
+    if (uSize > Length)
+    {
+        memmove(lpBuffer, WindowsDirectory.Buffer, WindowsDirectory.Length);
+        lpBuffer[Length] = 0;
+
+        return Length;   //good: ret chars excl. nullchar
+    }
+
+    return Length+1;   //bad: ret space needed incl. nullchar
+}
+
+/*
+ * @implemented
+ */
+UINT
+WINAPI
+GetSystemWindowsDirectoryA(IN LPSTR lpBuffer,
+                           IN UINT uSize)
+{
+    return GetWindowsDirectoryA(lpBuffer, uSize);
+}
+
+/*
+ * @implemented
+ */
+UINT
+WINAPI
+GetSystemWindowsDirectoryW(IN LPWSTR lpBuffer,
+                           IN UINT uSize)
+{
+    return GetWindowsDirectoryW(lpBuffer, uSize);
+}
+
+/*
+ * @unimplemented
+ */
+UINT
+WINAPI
+GetSystemWow64DirectoryW(IN LPWSTR lpBuffer,
+                         IN UINT uSize)
+{
+#ifdef _WIN64
+    UNIMPLEMENTED;
+    return 0;
+#else
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+#endif
+}
+
+/*
+ * @unimplemented
+ */
+UINT
+WINAPI
+GetSystemWow64DirectoryA(IN LPSTR lpBuffer,
+                         IN UINT uSize)
+{
+#ifdef _WIN64
+    UNIMPLEMENTED;
+    return 0;
+#else
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 0;
+#endif
+}
+
 /* EOF */

Modified: trunk/reactos/dll/win32/kernel32/kernel32.rbuild
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/kernel32.rbuild?rev=54323&r1=54322&r2=54323&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/kernel32.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/kernel32.rbuild [iso-8859-1] Sun Nov  6 
23:01:04 2011
@@ -61,7 +61,6 @@
                        <file>copy.c</file>
                        <file>console.c</file>
                        <file>create.c</file>
-                       <file>curdir.c</file>
                        <file>delete.c</file>
                        <file>deviceio.c</file>
                        <file>dir.c</file>


Reply via email to