Author: dchapyshev
Date: Sat Sep 13 04:21:43 2008
New Revision: 36181
URL:
http://svn.reactos.org/svn/reactos?rev=36181&view=rev
Log:
- Move FindVolumeClose, FindFirstVolumeW/A, GetVolumeNameForVolumeMountPointA to volume.c
- Implement FindVolumeClose, GetVolumeNameForVolumeMountPointA (based on wine)
Modified:
trunk/reactos/dll/win32/kernel32/file/volume.c
trunk/reactos/dll/win32/kernel32/include/kernel32.h
trunk/reactos/dll/win32/kernel32/misc/stubs.c
Modified: trunk/reactos/dll/win32/kernel32/file/volume.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/vo…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/file/volume.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/file/volume.c [iso-8859-1] Sat Sep 13 04:21:43 2008
@@ -1060,4 +1060,117 @@
return FALSE;
}
+/*
+ * @implemented (Wine 13 sep 2008)
+ */
+BOOL
+STDCALL
+GetVolumeNameForVolumeMountPointA(
+ LPCSTR lpszVolumeMountPoint,
+ LPSTR lpszVolumeName,
+ DWORD cchBufferLength
+ )
+{
+ BOOL ret;
+ WCHAR volumeW[50], *pathW = NULL;
+ DWORD len = min( sizeof(volumeW) / sizeof(WCHAR), cchBufferLength );
+
+ TRACE("(%s, %p, %x)\n", debugstr_a(lpszVolumeMountPoint), lpszVolumeName,
cchBufferLength);
+
+ if (!lpszVolumeMountPoint || !(pathW = FilenameA2W( lpszVolumeMountPoint, TRUE )))
+ return FALSE;
+
+ if ((ret = GetVolumeNameForVolumeMountPointW( pathW, volumeW, len )))
+ FilenameW2A_N( lpszVolumeName, len, volumeW, -1 );
+
+ HeapFree( GetProcessHeap(), 0, pathW );
+ return ret;
+}
+
+/*
+ * @implemented (Wine 13 sep 2008)
+ */
+HANDLE
+STDCALL
+FindFirstVolumeW(
+ LPWSTR volume,
+ DWORD len
+ )
+{
+ DWORD size = 1024;
+ HANDLE mgr = CreateFileW( MOUNTMGR_DOS_DEVICE_NAME, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING, 0, 0 );
+ if (mgr == INVALID_HANDLE_VALUE) return INVALID_HANDLE_VALUE;
+
+ for (;;)
+ {
+ MOUNTMGR_MOUNT_POINT input;
+ MOUNTMGR_MOUNT_POINTS *output;
+
+ if (!(output = HeapAlloc( GetProcessHeap(), 0, size )))
+ {
+ SetLastError( ERROR_NOT_ENOUGH_MEMORY );
+ break;
+ }
+ memset( &input, 0, sizeof(input) );
+
+ if (!DeviceIoControl( mgr, IOCTL_MOUNTMGR_QUERY_POINTS, &input,
sizeof(input),
+ output, size, NULL, NULL ))
+ {
+ if (GetLastError() != ERROR_MORE_DATA) break;
+ size = output->Size;
+ HeapFree( GetProcessHeap(), 0, output );
+ continue;
+ }
+ CloseHandle( mgr );
+ /* abuse the Size field to store the current index */
+ output->Size = 0;
+ if (!FindNextVolumeW( output, volume, len ))
+ {
+ HeapFree( GetProcessHeap(), 0, output );
+ return INVALID_HANDLE_VALUE;
+ }
+ return (HANDLE)output;
+ }
+ CloseHandle( mgr );
+ return INVALID_HANDLE_VALUE;
+}
+
+/*
+ * @implemented (Wine 13 sep 2008)
+ */
+HANDLE
+STDCALL
+FindFirstVolumeA(
+ LPSTR volume,
+ DWORD len
+ )
+{
+ WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+ HANDLE handle = FindFirstVolumeW( buffer, len );
+
+ if (handle != INVALID_HANDLE_VALUE)
+ {
+ if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL ))
+ {
+ FindVolumeClose( handle );
+ handle = INVALID_HANDLE_VALUE;
+ }
+ }
+ HeapFree( GetProcessHeap(), 0, buffer );
+ return handle;
+}
+
+/*
+ * @implemented (Wine 13 sep 2008)
+ */
+BOOL
+STDCALL
+FindVolumeClose(
+ HANDLE hFindVolume
+ )
+{
+ return HeapFree(GetProcessHeap(), 0, hFindVolume);
+}
+
/* EOF */
Modified: trunk/reactos/dll/win32/kernel32/include/kernel32.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/include…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/include/kernel32.h [iso-8859-1] Sat Sep 13 04:21:43
2008
@@ -76,6 +76,7 @@
HANDLE FASTCALL TranslateStdHandle(HANDLE hHandle);
PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc);
+DWORD FilenameW2A_N(LPSTR dest, INT destlen, LPCWSTR src, INT srclen);
DWORD FilenameW2A_FitOrFail(LPSTR DestA, INT destLen, LPCWSTR SourceW, INT sourceLen);
DWORD FilenameU2A_FitOrFail(LPSTR DestA, INT destLen, PUNICODE_STRING SourceU);
Modified: trunk/reactos/dll/win32/kernel32/misc/stubs.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/st…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/stubs.c [iso-8859-1] Sat Sep 13 04:21:43 2008
@@ -424,19 +424,6 @@
*/
BOOL
STDCALL
-FindVolumeClose(
- HANDLE hFindVolume
- )
-{
- STUB;
- return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
FindVolumeMountPointClose(
HANDLE hFindVolumeMountPoint
)
@@ -817,55 +804,6 @@
memcpy( computername, hostname, len * sizeof(WCHAR) );
computername[len + 1] = 0;
return TRUE;
-}
-
-/*
- * @implemented
- */
-HANDLE
-STDCALL
-FindFirstVolumeW(
- LPWSTR volume,
- DWORD len
- )
-{
- DWORD size = 1024;
- HANDLE mgr = CreateFileW( MOUNTMGR_DOS_DEVICE_NAME, 0,
FILE_SHARE_READ|FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, 0, 0 );
- if (mgr == INVALID_HANDLE_VALUE) return INVALID_HANDLE_VALUE;
-
- for (;;)
- {
- MOUNTMGR_MOUNT_POINT input;
- MOUNTMGR_MOUNT_POINTS *output;
-
- if (!(output = HeapAlloc( GetProcessHeap(), 0, size )))
- {
- SetLastError( ERROR_NOT_ENOUGH_MEMORY );
- break;
- }
- memset( &input, 0, sizeof(input) );
-
- if (!DeviceIoControl( mgr, IOCTL_MOUNTMGR_QUERY_POINTS, &input,
sizeof(input),
- output, size, NULL, NULL ))
- {
- if (GetLastError() != ERROR_MORE_DATA) break;
- size = output->Size;
- HeapFree( GetProcessHeap(), 0, output );
- continue;
- }
- CloseHandle( mgr );
- /* abuse the Size field to store the current index */
- output->Size = 0;
- if (!FindNextVolumeW( output, volume, len ))
- {
- HeapFree( GetProcessHeap(), 0, output );
- return INVALID_HANDLE_VALUE;
- }
- return (HANDLE)output;
- }
- CloseHandle( mgr );
- return INVALID_HANDLE_VALUE;
}
/*
@@ -1060,31 +998,6 @@
}
/*
- * @implemented
- */
-HANDLE
-STDCALL
-FindFirstVolumeA(
- LPSTR volume,
- DWORD len
- )
-{
- WCHAR *buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
- HANDLE handle = FindFirstVolumeW( buffer, len );
-
- if (handle != INVALID_HANDLE_VALUE)
- {
- if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL ))
- {
- FindVolumeClose( handle );
- handle = INVALID_HANDLE_VALUE;
- }
- }
- HeapFree( GetProcessHeap(), 0, buffer );
- return handle;
-}
-
-/*
* @unimplemented
*/
HANDLE
@@ -1146,21 +1059,6 @@
LPCSTR lpGuid,
PVOID pBuffer,
DWORD nSize
- )
-{
- STUB;
- return 0;
-}
-
-/*
- * @unimplemented
- */
-BOOL
-STDCALL
-GetVolumeNameForVolumeMountPointA(
- LPCSTR lpszVolumeMountPoint,
- LPSTR lpszVolumeName,
- DWORD cchBufferLength
)
{
STUB;