kernel32/volume: Don't modify the last error in GetVolumeInformation

Alexandre Goujon ale.goujon at gmail.com
Mon May 28 09:16:02 CDT 2012


---
 dlls/kernel32/volume.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index 23bcca1..8caea27 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -671,6 +671,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
     WCHAR *p;
     enum fs_type type = FS_UNKNOWN;
     BOOL ret = FALSE;
+    DWORD lastError;
 
     if (!root) root = default_rootW;
     if (!RtlDosPathNameToNtPathName_U( root, &nt_name, NULL, NULL ))
@@ -714,6 +715,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
 
         /* check for audio CD */
         /* FIXME: we only check the first track for now */
+        lastError = GetLastError();
         if (DeviceIoControl( handle, IOCTL_CDROM_READ_TOC, NULL, 0, &toc, sizeof(toc), &br, 0 ))
         {
             if (!(toc.TrackData[0].Control & 0x04))  /* audio track */
@@ -729,6 +731,8 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
         }
         else
         {
+            /* At this point, last error is ERROR_NOT_SUPPORTED. Restoring the previous one */
+            SetLastError(lastError);
             type = VOLUME_ReadFATSuperblock( handle, superblock );
             if (type == FS_UNKNOWN) type = VOLUME_ReadCDSuperblock( handle, superblock );
         }
-- 
1.7.9.5




More information about the wine-patches mailing list