2 * DOS drives handling functions
4 * Copyright 1993 Erik Bos
5 * Copyright 1996 Alexandre Julliard
11 #include <sys/types.h>
14 #if defined(__linux__) || defined(sun) || defined(hpux)
17 #if defined(__NetBSD__) || defined(__FreeBSD__)
18 #include <sys/param.h>
19 #include <sys/mount.h>
20 #include <sys/errno.h>
22 #if defined(__svr4__) || defined(_SCO_DS)
23 #include <sys/statfs.h>
41 char *root
; /* root dir in Unix format without trailing / */
42 char *dos_cwd
; /* cwd in DOS format without leading or trailing \ */
43 char *unix_cwd
; /* cwd in Unix format without leading or trailing / */
44 char label
[12]; /* drive label */
45 DWORD serial
; /* drive serial number */
46 DRIVETYPE type
; /* drive type */
47 UINT32 flags
; /* drive flags */
51 static const char * const DRIVE_Types
[] =
53 "floppy", /* TYPE_FLOPPY */
55 "cdrom", /* TYPE_CDROM */
56 "network" /* TYPE_NETWORK */
60 /* Known filesystem types */
68 static const FS_DESCR DRIVE_Filesystems
[] =
70 { "unix", DRIVE_CASE_SENSITIVE
| DRIVE_CASE_PRESERVING
},
71 { "msdos", DRIVE_SHORT_NAMES
},
72 { "dos", DRIVE_SHORT_NAMES
},
73 { "fat", DRIVE_SHORT_NAMES
},
74 { "vfat", DRIVE_CASE_PRESERVING
},
75 { "win95", DRIVE_CASE_PRESERVING
},
80 static DOSDRIVE DOSDrives
[MAX_DOS_DRIVES
];
81 static int DRIVE_CurDrive
= -1;
83 static HTASK16 DRIVE_LastTask
= 0;
86 /***********************************************************************
89 static DRIVETYPE
DRIVE_GetDriveType( const char *name
)
94 PROFILE_GetWineIniString( name
, "Type", "hd", buffer
, sizeof(buffer
) );
95 for (i
= 0; i
< sizeof(DRIVE_Types
)/sizeof(DRIVE_Types
[0]); i
++)
97 if (!lstrcmpi32A( buffer
, DRIVE_Types
[i
] )) return (DRIVETYPE
)i
;
99 fprintf( stderr
, "%s: unknown type '%s', defaulting to 'hd'.\n",
105 /***********************************************************************
108 static UINT32
DRIVE_GetFSFlags( const char *name
, const char *value
)
110 const FS_DESCR
*descr
;
112 for (descr
= DRIVE_Filesystems
; descr
->name
; descr
++)
113 if (!lstrcmpi32A( value
, descr
->name
)) return descr
->flags
;
114 fprintf( stderr
, "%s: unknown filesystem type '%s', defaulting to 'unix'.\n",
116 return DRIVE_CASE_SENSITIVE
| DRIVE_CASE_PRESERVING
;
120 /***********************************************************************
125 int i
, len
, count
= 0;
126 char name
[] = "Drive A";
127 char path
[MAX_PATHNAME_LEN
];
132 for (i
= 0, drive
= DOSDrives
; i
< MAX_DOS_DRIVES
; i
++, name
[6]++, drive
++)
134 PROFILE_GetWineIniString( name
, "Path", "", path
, sizeof(path
)-1 );
137 p
= path
+ strlen(path
) - 1;
138 while ((p
> path
) && ((*p
== '/') || (*p
== '\\'))) *p
-- = '\0';
140 drive
->root
= xstrdup( path
);
142 drive
->root
= xstrdup( "/" );
143 drive
->dos_cwd
= xstrdup( "" );
144 drive
->unix_cwd
= xstrdup( "" );
145 drive
->type
= DRIVE_GetDriveType( name
);
148 /* Get the drive label */
149 PROFILE_GetWineIniString( name
, "Label", name
, drive
->label
, 12 );
150 if ((len
= strlen(drive
->label
)) < 11)
152 /* Pad label with spaces */
153 memset( drive
->label
+ len
, ' ', 11 - len
);
154 drive
->label
[12] = '\0';
157 /* Get the serial number */
158 PROFILE_GetWineIniString( name
, "Serial", "12345678",
159 buffer
, sizeof(buffer
) );
160 drive
->serial
= strtoul( buffer
, NULL
, 16 );
162 /* Get the filesystem type */
163 PROFILE_GetWineIniString( name
, "Filesystem", "unix",
164 buffer
, sizeof(buffer
) );
165 drive
->flags
= DRIVE_GetFSFlags( name
, buffer
);
167 /* Make the first hard disk the current drive */
168 if ((DRIVE_CurDrive
== -1) && (drive
->type
== TYPE_HD
))
172 dprintf_dosfs( stddeb
, "%s: path=%s type=%s label='%s' serial=%08lx flags=%08x\n",
173 name
, path
, DRIVE_Types
[drive
->type
],
174 drive
->label
, drive
->serial
, drive
->flags
);
176 else dprintf_dosfs( stddeb
, "%s: not defined\n", name
);
181 fprintf( stderr
, "Warning: no valid DOS drive found, check your configuration file.\n" );
182 /* Create a C drive pointing to Unix root dir */
183 DOSDrives
[2].root
= xstrdup( "/" );
184 DOSDrives
[2].dos_cwd
= xstrdup( "" );
185 DOSDrives
[2].unix_cwd
= xstrdup( "" );
186 strcpy( DOSDrives
[2].label
, "Drive C " );
187 DOSDrives
[2].serial
= 0x12345678;
188 DOSDrives
[2].type
= TYPE_HD
;
189 DOSDrives
[2].flags
= 0;
193 /* Make sure the current drive is valid */
194 if (DRIVE_CurDrive
== -1)
196 for (i
= 0, drive
= DOSDrives
; i
< MAX_DOS_DRIVES
; i
++, drive
++)
198 if (drive
->root
&& !(drive
->flags
& DRIVE_DISABLED
))
210 /***********************************************************************
213 int DRIVE_IsValid( int drive
)
215 if ((drive
< 0) || (drive
>= MAX_DOS_DRIVES
)) return 0;
216 return (DOSDrives
[drive
].root
&&
217 !(DOSDrives
[drive
].flags
& DRIVE_DISABLED
));
221 /***********************************************************************
222 * DRIVE_GetCurrentDrive
224 int DRIVE_GetCurrentDrive(void)
226 TDB
*pTask
= (TDB
*)GlobalLock16( GetCurrentTask() );
227 if (pTask
&& (pTask
->curdrive
& 0x80)) return pTask
->curdrive
& ~0x80;
228 return DRIVE_CurDrive
;
232 /***********************************************************************
233 * DRIVE_SetCurrentDrive
235 int DRIVE_SetCurrentDrive( int drive
)
237 TDB
*pTask
= (TDB
*)GlobalLock16( GetCurrentTask() );
238 if (!DRIVE_IsValid( drive
))
240 DOS_ERROR( ER_InvalidDrive
, EC_MediaError
, SA_Abort
, EL_Disk
);
243 dprintf_dosfs( stddeb
, "DRIVE_SetCurrentDrive: %c:\n", 'A' + drive
);
244 DRIVE_CurDrive
= drive
;
245 if (pTask
) pTask
->curdrive
= drive
| 0x80;
250 /***********************************************************************
251 * DRIVE_FindDriveRoot
253 * Find a drive for which the root matches the begginning of the given path.
254 * This can be used to translate a Unix path into a drive + DOS path.
255 * Return value is the drive, or -1 on error. On success, path is modified
256 * to point to the beginning of the DOS path.
257 * FIXME: this only does a textual comparison of the path names, and won't
258 * work well in the presence of symbolic links.
260 int DRIVE_FindDriveRoot( const char **path
)
262 int drive
, rootdrive
= -1;
265 dprintf_dosfs( stddeb
, "DRIVE_FindDriveRoot: searching '%s'\n", *path
);
266 for (drive
= 0; drive
< MAX_DOS_DRIVES
; drive
++)
268 if (!DOSDrives
[drive
].root
||
269 (DOSDrives
[drive
].flags
& DRIVE_DISABLED
)) continue;
271 p2
= DOSDrives
[drive
].root
;
272 dprintf_dosfs( stddeb
, "DRIVE_FindDriveRoot: checking %c: '%s'\n",
275 while (*p2
== '/') p2
++;
279 continue; /* Look if there's a better match */
283 while ((*p1
== '\\') || (*p1
== '/')) p1
++;
284 while (*p2
== '/') p2
++;
285 while ((*p1
== *p2
) && (*p2
) && (*p2
!= '/')) p1
++, p2
++;
288 if (IS_END_OF_NAME(*p1
)) /* OK, found it */
296 if (IS_END_OF_NAME(*p1
))
297 continue; /* Go to next path element */
299 break; /* No match, go to next drive */
306 /***********************************************************************
309 const char * DRIVE_GetRoot( int drive
)
311 if (!DRIVE_IsValid( drive
)) return NULL
;
312 return DOSDrives
[drive
].root
;
316 /***********************************************************************
319 const char * DRIVE_GetDosCwd( int drive
)
321 TDB
*pTask
= (TDB
*)GlobalLock16( GetCurrentTask() );
322 if (!DRIVE_IsValid( drive
)) return NULL
;
324 /* Check if we need to change the directory to the new task. */
325 if (pTask
&& (pTask
->curdrive
& 0x80) && /* The task drive is valid */
326 ((pTask
->curdrive
& ~0x80) == drive
) && /* and it's the one we want */
327 (DRIVE_LastTask
!= GetCurrentTask())) /* and the task changed */
329 /* Perform the task-switch */
330 if (!DRIVE_Chdir( drive
, pTask
->curdir
)) DRIVE_Chdir( drive
, "\\" );
331 DRIVE_LastTask
= GetCurrentTask();
333 return DOSDrives
[drive
].dos_cwd
;
337 /***********************************************************************
340 const char * DRIVE_GetUnixCwd( int drive
)
342 TDB
*pTask
= (TDB
*)GlobalLock16( GetCurrentTask() );
343 if (!DRIVE_IsValid( drive
)) return NULL
;
345 /* Check if we need to change the directory to the new task. */
346 if (pTask
&& (pTask
->curdrive
& 0x80) && /* The task drive is valid */
347 ((pTask
->curdrive
& ~0x80) == drive
) && /* and it's the one we want */
348 (DRIVE_LastTask
!= GetCurrentTask())) /* and the task changed */
350 /* Perform the task-switch */
351 if (!DRIVE_Chdir( drive
, pTask
->curdir
)) DRIVE_Chdir( drive
, "\\" );
352 DRIVE_LastTask
= GetCurrentTask();
354 return DOSDrives
[drive
].unix_cwd
;
358 /***********************************************************************
361 const char * DRIVE_GetLabel( int drive
)
363 if (!DRIVE_IsValid( drive
)) return NULL
;
364 return DOSDrives
[drive
].label
;
368 /***********************************************************************
369 * DRIVE_GetSerialNumber
371 DWORD
DRIVE_GetSerialNumber( int drive
)
373 if (!DRIVE_IsValid( drive
)) return 0;
374 return DOSDrives
[drive
].serial
;
378 /***********************************************************************
379 * DRIVE_SetSerialNumber
381 int DRIVE_SetSerialNumber( int drive
, DWORD serial
)
383 if (!DRIVE_IsValid( drive
)) return 0;
384 DOSDrives
[drive
].serial
= serial
;
389 /***********************************************************************
392 DRIVETYPE
DRIVE_GetType( int drive
)
394 if (!DRIVE_IsValid( drive
)) return TYPE_INVALID
;
395 return DOSDrives
[drive
].type
;
399 /***********************************************************************
402 UINT32
DRIVE_GetFlags( int drive
)
404 if ((drive
< 0) || (drive
>= MAX_DOS_DRIVES
)) return 0;
405 return DOSDrives
[drive
].flags
;
409 /***********************************************************************
412 int DRIVE_Chdir( int drive
, const char *path
)
414 char buffer
[MAX_PATHNAME_LEN
];
415 const char *unix_cwd
, *dos_cwd
;
417 TDB
*pTask
= (TDB
*)GlobalLock16( GetCurrentTask() );
419 dprintf_dosfs( stddeb
, "DRIVE_Chdir(%c:,%s)\n", 'A' + drive
, path
);
420 strcpy( buffer
, "A:" );
422 lstrcpyn32A( buffer
+ 2, path
, sizeof(buffer
) - 2 );
424 if (!(unix_cwd
= DOSFS_GetUnixFileName( buffer
, TRUE
))) return 0;
425 if (!FILE_Stat( unix_cwd
, &attr
, NULL
, NULL
, NULL
)) return 0;
426 if (!(attr
& FA_DIRECTORY
))
428 DOS_ERROR( ER_FileNotFound
, EC_NotFound
, SA_Abort
, EL_Disk
);
431 unix_cwd
+= strlen( DOSDrives
[drive
].root
);
432 while (*unix_cwd
== '/') unix_cwd
++;
434 lstrcpyn32A( buffer
+ 3, unix_cwd
, sizeof(buffer
) - 3 );
435 if (!(dos_cwd
= DOSFS_GetDosTrueName( buffer
, TRUE
))) return 0;
437 dprintf_dosfs( stddeb
, "DRIVE_Chdir(%c:): unix_cwd=%s dos_cwd=%s\n",
438 'A' + drive
, unix_cwd
, dos_cwd
+ 3 );
440 free( DOSDrives
[drive
].dos_cwd
);
441 free( DOSDrives
[drive
].unix_cwd
);
442 DOSDrives
[drive
].dos_cwd
= xstrdup( dos_cwd
+ 3 );
443 DOSDrives
[drive
].unix_cwd
= xstrdup( unix_cwd
);
445 if (pTask
&& (pTask
->curdrive
& 0x80) &&
446 ((pTask
->curdrive
& ~0x80) == drive
))
448 lstrcpyn32A( pTask
->curdir
, dos_cwd
+ 2, sizeof(pTask
->curdir
) );
449 DRIVE_LastTask
= GetCurrentTask();
455 /***********************************************************************
458 int DRIVE_Disable( int drive
)
460 if ((drive
< 0) || (drive
>= MAX_DOS_DRIVES
) || !DOSDrives
[drive
].root
)
462 DOS_ERROR( ER_InvalidDrive
, EC_MediaError
, SA_Abort
, EL_Disk
);
465 DOSDrives
[drive
].flags
|= DRIVE_DISABLED
;
470 /***********************************************************************
473 int DRIVE_Enable( int drive
)
475 if ((drive
< 0) || (drive
>= MAX_DOS_DRIVES
) || !DOSDrives
[drive
].root
)
477 DOS_ERROR( ER_InvalidDrive
, EC_MediaError
, SA_Abort
, EL_Disk
);
480 DOSDrives
[drive
].flags
&= ~DRIVE_DISABLED
;
485 /***********************************************************************
488 static int DRIVE_GetFreeSpace( int drive
, DWORD
*size
, DWORD
*available
)
492 if (!DRIVE_IsValid(drive
))
494 DOS_ERROR( ER_InvalidDrive
, EC_MediaError
, SA_Abort
, EL_Disk
);
498 #if defined(__svr4__) || defined(_SCO_DS)
499 if (statfs( DOSDrives
[drive
].root
, &info
, 0, 0) < 0)
501 if (statfs( DOSDrives
[drive
].root
, &info
) < 0)
505 fprintf(stderr
,"dosfs: cannot do statfs(%s)\n", DOSDrives
[drive
].root
);
509 *size
= info
.f_bsize
* info
.f_blocks
;
510 #if defined(__svr4__) || defined(_SCO_DS)
511 *available
= info
.f_bfree
* info
.f_bsize
;
513 *available
= info
.f_bavail
* info
.f_bsize
;
519 /***********************************************************************
520 * GetDiskFreeSpace16 (KERNEL.422)
522 BOOL16
GetDiskFreeSpace16( LPCSTR root
, LPDWORD cluster_sectors
,
523 LPDWORD sector_bytes
, LPDWORD free_clusters
,
524 LPDWORD total_clusters
)
526 return GetDiskFreeSpace32A( root
, cluster_sectors
, sector_bytes
,
527 free_clusters
, total_clusters
);
531 /***********************************************************************
532 * GetDiskFreeSpace32A (KERNEL32.206)
534 BOOL32
GetDiskFreeSpace32A( LPCSTR root
, LPDWORD cluster_sectors
,
535 LPDWORD sector_bytes
, LPDWORD free_clusters
,
536 LPDWORD total_clusters
)
539 DWORD size
,available
;
541 if (!root
) drive
= DRIVE_GetCurrentDrive();
544 if ((root
[1] != ':') || (root
[2] != '\\'))
546 fprintf( stderr
, "GetDiskFreeSpaceA: invalid root '%s'\n", root
);
549 drive
= toupper(root
[0]) - 'A';
551 if (!DRIVE_GetFreeSpace(drive
, &size
, &available
)) return FALSE
;
556 *cluster_sectors
= 1;
557 while (*cluster_sectors
* 65530 < size
) *cluster_sectors
*= 2;
558 *free_clusters
= available
/ *cluster_sectors
;
559 *total_clusters
= size
/ *cluster_sectors
;
564 /***********************************************************************
565 * GetDiskFreeSpace32W (KERNEL32.207)
567 BOOL32
GetDiskFreeSpace32W( LPCWSTR root
, LPDWORD cluster_sectors
,
568 LPDWORD sector_bytes
, LPDWORD free_clusters
,
569 LPDWORD total_clusters
)
574 xroot
= HEAP_strdupWtoA( GetProcessHeap(), 0, root
);
575 ret
= GetDiskFreeSpace32A( xroot
,cluster_sectors
, sector_bytes
,
576 free_clusters
, total_clusters
);
577 HeapFree( GetProcessHeap(), 0, xroot
);
582 /***********************************************************************
583 * GetDriveType16 (KERNEL.136)
585 UINT16
GetDriveType16( UINT16 drive
)
587 dprintf_dosfs( stddeb
, "GetDriveType(%c:)\n", 'A' + drive
);
588 switch(DRIVE_GetType(drive
))
590 case TYPE_FLOPPY
: return DRIVE_REMOVABLE
;
591 case TYPE_HD
: return DRIVE_FIXED
;
592 case TYPE_CDROM
: return DRIVE_REMOTE
;
593 case TYPE_NETWORK
: return DRIVE_REMOTE
;
595 default: return DRIVE_CANNOTDETERMINE
;
600 /***********************************************************************
601 * GetDriveType32A (KERNEL32.208)
603 UINT32
GetDriveType32A( LPCSTR root
)
605 dprintf_dosfs( stddeb
, "GetDriveType32A(%s)\n", root
);
608 fprintf( stderr
, "GetDriveType32A: invalid root '%s'\n", root
);
609 return DRIVE_DOESNOTEXIST
;
611 switch(DRIVE_GetType(toupper(root
[0]) - 'A'))
613 case TYPE_FLOPPY
: return DRIVE_REMOVABLE
;
614 case TYPE_HD
: return DRIVE_FIXED
;
615 case TYPE_CDROM
: return DRIVE_CDROM
;
616 case TYPE_NETWORK
: return DRIVE_REMOTE
;
618 default: return DRIVE_CANNOTDETERMINE
;
623 /***********************************************************************
624 * GetDriveType32W (KERNEL32.209)
626 UINT32
GetDriveType32W( LPCWSTR root
)
628 LPSTR xpath
= HEAP_strdupWtoA( GetProcessHeap(), 0, root
);
629 UINT32 ret
= GetDriveType32A( xpath
);
630 HeapFree( GetProcessHeap(), 0, xpath
);
635 /***********************************************************************
636 * GetCurrentDirectory16 (KERNEL.411)
638 UINT16
GetCurrentDirectory16( UINT16 buflen
, LPSTR buf
)
640 return (UINT16
)GetCurrentDirectory32A( buflen
, buf
);
644 /***********************************************************************
645 * GetCurrentDirectory32A (KERNEL32.196)
647 * Returns "X:\\path\\etc\\".
649 UINT32
GetCurrentDirectory32A( UINT32 buflen
, LPSTR buf
)
652 const char *s
= DRIVE_GetDosCwd( DRIVE_GetCurrentDrive() );
658 lstrcpyn32A( buf
, pref
, MIN( 4, buflen
) );
659 if (buflen
) buf
[0] += DRIVE_GetCurrentDrive();
660 if (buflen
> 3) lstrcpyn32A( buf
+ 3, s
, buflen
- 3 );
661 return strlen(s
) + 3; /* length of WHOLE current directory */
665 /***********************************************************************
666 * GetCurrentDirectory32W (KERNEL32.197)
668 UINT32
GetCurrentDirectory32W( UINT32 buflen
, LPWSTR buf
)
670 LPSTR xpath
= HeapAlloc( GetProcessHeap(), 0, buflen
+1 );
671 UINT32 ret
= GetCurrentDirectory32A( buflen
, xpath
);
672 lstrcpyAtoW( buf
, xpath
);
673 HeapFree( GetProcessHeap(), 0, xpath
);
678 /***********************************************************************
679 * SetCurrentDirectory (KERNEL.412)
681 BOOL16
SetCurrentDirectory16( LPCSTR dir
)
683 if (dir
[0] && (dir
[1]==':'))
685 int drive
= tolower( *dir
) - 'a';
686 if (!DRIVE_IsValid(drive
))
688 DOS_ERROR( ER_InvalidDrive
, EC_MediaError
, SA_Abort
, EL_Disk
);
693 /* FIXME: what about empty strings? Add a \\ ? */
694 return DRIVE_Chdir( DRIVE_GetCurrentDrive(), dir
);
697 /***********************************************************************
698 * SetCurrentDirectory32A (KERNEL32.479)
700 BOOL32
SetCurrentDirectory32A( LPCSTR dir
)
702 /* FIXME: Unauthorized Windows 95 mentions that SetCurrentDirectory
703 * may change drive and current directory for there is no drive based
706 return SetCurrentDirectory16(dir
);
709 /***********************************************************************
710 * SetCurrentDirectory32W (KERNEL32.480)
712 BOOL32
SetCurrentDirectory32W( LPCWSTR dirW
)
714 LPSTR dir
= HEAP_strdupWtoA( GetProcessHeap(), 0, dirW
);
715 BOOL32 res
= SetCurrentDirectory32A( dir
);
716 HeapFree( GetProcessHeap(), 0, dir
);
721 /***********************************************************************
722 * GetLogicalDriveStrings32A (KERNEL32.231)
724 UINT32
GetLogicalDriveStrings32A( UINT32 len
, LPSTR buffer
)
728 for (drive
= count
= 0; drive
< MAX_DOS_DRIVES
; drive
++)
729 if (DRIVE_IsValid(drive
)) count
++;
730 if (count
* 4 * sizeof(char) <= len
)
733 for (drive
= 0; drive
< MAX_DOS_DRIVES
; drive
++)
734 if (DRIVE_IsValid(drive
))
743 return count
* 4 * sizeof(char);
747 /***********************************************************************
748 * GetLogicalDriveStrings32W (KERNEL32.232)
750 UINT32
GetLogicalDriveStrings32W( UINT32 len
, LPWSTR buffer
)
754 for (drive
= count
= 0; drive
< MAX_DOS_DRIVES
; drive
++)
755 if (DRIVE_IsValid(drive
)) count
++;
756 if (count
* 4 * sizeof(WCHAR
) <= len
)
759 for (drive
= 0; drive
< MAX_DOS_DRIVES
; drive
++)
760 if (DRIVE_IsValid(drive
))
762 *p
++ = (WCHAR
)('a' + drive
);
769 return count
* 4 * sizeof(WCHAR
);
773 /***********************************************************************
774 * GetLogicalDrives (KERNEL32.233)
776 DWORD
GetLogicalDrives(void)
781 for (drive
= 0; drive
< MAX_DOS_DRIVES
; drive
++)
782 if (DRIVE_IsValid(drive
)) ret
|= (1 << drive
);
787 /***********************************************************************
788 * GetVolumeInformation32A (KERNEL32.309)
790 BOOL32
GetVolumeInformation32A( LPCSTR root
, LPSTR label
, DWORD label_len
,
791 DWORD
*serial
, DWORD
*filename_len
,
792 DWORD
*flags
, LPSTR fsname
, DWORD fsname_len
)
796 /* FIXME, SetLastErrors missing */
798 if (!root
) drive
= DRIVE_GetCurrentDrive();
801 if ((root
[1] != ':') || (root
[2] != '\\'))
803 fprintf( stderr
, "GetVolumeInformation: invalid root '%s'\n",root
);
806 drive
= toupper(root
[0]) - 'A';
808 if (!DRIVE_IsValid( drive
)) return FALSE
;
809 if (label
) lstrcpyn32A( label
, DOSDrives
[drive
].label
, label_len
);
810 if (serial
) *serial
= DOSDrives
[drive
].serial
;
812 /* Set the filesystem information */
813 /* Note: we only emulate a FAT fs at the present */
815 if (filename_len
) *filename_len
= 12;
816 if (flags
) *flags
= 0;
817 if (fsname
) lstrcpyn32A( fsname
, "FAT", fsname_len
);
822 /***********************************************************************
823 * GetVolumeInformation32W (KERNEL32.310)
825 BOOL32
GetVolumeInformation32W( LPCWSTR root
, LPWSTR label
, DWORD label_len
,
826 DWORD
*serial
, DWORD
*filename_len
,
827 DWORD
*flags
, LPWSTR fsname
, DWORD fsname_len
)
829 LPSTR xroot
= HEAP_strdupWtoA( GetProcessHeap(), 0, root
);
830 LPSTR xvolname
= label
? HeapAlloc(GetProcessHeap(),0,label_len
) : NULL
;
831 LPSTR xfsname
= fsname
? HeapAlloc(GetProcessHeap(),0,fsname_len
) : NULL
;
832 BOOL32 ret
= GetVolumeInformation32A( xroot
, xvolname
, label_len
, serial
,
833 filename_len
, flags
, xfsname
,
837 if (label
) lstrcpyAtoW( label
, xvolname
);
838 if (fsname
) lstrcpyAtoW( fsname
, xfsname
);
840 HeapFree( GetProcessHeap(), 0, xroot
);
841 HeapFree( GetProcessHeap(), 0, xvolname
);
842 HeapFree( GetProcessHeap(), 0, xfsname
);