Für meinen Medienscanner verwende ich folgende Methode:
Delphi-Quellcode:
Function TUtily.GetPartitionName(Const ADrive: Char): String;
Var
Unused : Cardinal;
Buffer : array[0..19] of Char;
begin
If (GetDriveType(PChar(Format('%S:\',[ADrive]))) >1) And
(GetVolumeInformation(PChar(ADrive+':\'),
@buffer[0], SizeOf(buffer),
nil,
unused,
unused,
nil,
0)) Then
Result := buffer Else
Begin
Result := '';
RaiseLastOSError;
End;
end;