Implemented SetVolumeLabelW().

svn path=/trunk/; revision=1957
This commit is contained in:
Eric Kohl 2001-06-11 19:54:05 +00:00
parent bf1b360a1e
commit 4c892bc4e7

View file

@ -1,4 +1,4 @@
/* $Id: volume.c,v 1.18 2000/08/25 15:52:56 ekohl Exp $ /* $Id: volume.c,v 1.19 2001/06/11 19:54:05 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -32,8 +32,7 @@
#define MAX_DOS_DRIVES 26 #define MAX_DOS_DRIVES 26
DWORD DWORD STDCALL
STDCALL
GetLogicalDriveStringsA(DWORD nBufferLength, GetLogicalDriveStringsA(DWORD nBufferLength,
LPSTR lpBuffer) LPSTR lpBuffer)
{ {
@ -67,8 +66,7 @@ GetLogicalDriveStringsA(DWORD nBufferLength,
} }
DWORD DWORD STDCALL
STDCALL
GetLogicalDriveStringsW(DWORD nBufferLength, GetLogicalDriveStringsW(DWORD nBufferLength,
LPWSTR lpBuffer) LPWSTR lpBuffer)
{ {
@ -100,16 +98,14 @@ GetLogicalDriveStringsW(DWORD nBufferLength,
} }
DWORD DWORD STDCALL
STDCALL
GetLogicalDrives(VOID) GetLogicalDrives(VOID)
{ {
return (((PKUSER_SHARED_DATA)USER_SHARED_DATA_BASE)->DosDeviceMap); return (((PKUSER_SHARED_DATA)USER_SHARED_DATA_BASE)->DosDeviceMap);
} }
WINBOOL WINBOOL STDCALL
STDCALL
GetDiskFreeSpaceA ( GetDiskFreeSpaceA (
LPCSTR lpRootPathName, LPCSTR lpRootPathName,
LPDWORD lpSectorsPerCluster, LPDWORD lpSectorsPerCluster,
@ -158,8 +154,7 @@ GetDiskFreeSpaceA (
} }
WINBOOL WINBOOL STDCALL
STDCALL
GetDiskFreeSpaceW( GetDiskFreeSpaceW(
LPCWSTR lpRootPathName, LPCWSTR lpRootPathName,
LPDWORD lpSectorsPerCluster, LPDWORD lpSectorsPerCluster,
@ -213,8 +208,7 @@ GetDiskFreeSpaceW(
} }
WINBOOL WINBOOL STDCALL
STDCALL
GetDiskFreeSpaceExA ( GetDiskFreeSpaceExA (
LPCSTR lpDirectoryName, LPCSTR lpDirectoryName,
PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpFreeBytesAvailableToCaller,
@ -261,8 +255,7 @@ GetDiskFreeSpaceExA (
} }
WINBOOL WINBOOL STDCALL
STDCALL
GetDiskFreeSpaceExW( GetDiskFreeSpaceExW(
LPCWSTR lpDirectoryName, LPCWSTR lpDirectoryName,
PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpFreeBytesAvailableToCaller,
@ -324,11 +317,8 @@ GetDiskFreeSpaceExW(
} }
UINT UINT STDCALL
STDCALL GetDriveTypeA(LPCSTR lpRootPathName)
GetDriveTypeA (
LPCSTR lpRootPathName
)
{ {
UNICODE_STRING RootPathNameU; UNICODE_STRING RootPathNameU;
ANSI_STRING RootPathName; ANSI_STRING RootPathName;
@ -357,11 +347,8 @@ GetDriveTypeA (
} }
UINT UINT STDCALL
STDCALL GetDriveTypeW(LPCWSTR lpRootPathName)
GetDriveTypeW (
LPCWSTR lpRootPathName
)
{ {
FILE_FS_DEVICE_INFORMATION FileFsDevice; FILE_FS_DEVICE_INFORMATION FileFsDevice;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
@ -393,9 +380,8 @@ GetDriveTypeW (
} }
WINBOOL WINBOOL STDCALL
STDCALL GetVolumeInformationA(
GetVolumeInformationA (
LPCSTR lpRootPathName, LPCSTR lpRootPathName,
LPSTR lpVolumeNameBuffer, LPSTR lpVolumeNameBuffer,
DWORD nVolumeNameSize, DWORD nVolumeNameSize,
@ -500,8 +486,7 @@ GetVolumeInformationA (
#define FS_ATTRIBUTE_BUFFER_SIZE (MAX_PATH + sizeof(FILE_FS_ATTRIBUTE_INFORMATION)) #define FS_ATTRIBUTE_BUFFER_SIZE (MAX_PATH + sizeof(FILE_FS_ATTRIBUTE_INFORMATION))
WINBOOL WINBOOL STDCALL
STDCALL
GetVolumeInformationW( GetVolumeInformationW(
LPCWSTR lpRootPathName, LPCWSTR lpRootPathName,
LPWSTR lpVolumeNameBuffer, LPWSTR lpVolumeNameBuffer,
@ -634,14 +619,55 @@ SetVolumeLabelA (
} }
WINBOOL WINBOOL STDCALL
STDCALL SetVolumeLabelW(LPCWSTR lpRootPathName,
SetVolumeLabelW ( LPCWSTR lpVolumeName)
LPCWSTR lpRootPathName,
LPCWSTR lpVolumeName
)
{ {
PFILE_FS_LABEL_INFORMATION LabelInfo;
IO_STATUS_BLOCK IoStatusBlock;
ULONG LabelLength;
HANDLE hFile;
NTSTATUS Status;
LabelLength = wcslen(lpVolumeName) * sizeof(WCHAR);
LabelInfo = RtlAllocateHeap(RtlGetProcessHeap(),
0,
sizeof(FILE_FS_LABEL_INFORMATION) +
LabelLength);
LabelInfo->VolumeLabelLength = LabelLength;
wcscpy(&LabelInfo->VolumeLabel,
lpVolumeName);
hFile = CreateFileW(lpRootPathName,
FILE_WRITE_ATTRIBUTES,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
DPRINT("hFile: %x\n", hFile);
Status = NtSetVolumeInformationFile(hFile,
&IoStatusBlock,
LabelInfo,
sizeof(FILE_FS_LABEL_INFORMATION) +
LabelLength,
FileFsLabelInformation);
RtlFreeHeap(RtlGetProcessHeap(),
0,
LabelInfo);
if (!NT_SUCCESS(Status))
{
DPRINT("Status: %x\n", Status);
CloseHandle(hFile);
SetLastErrorByStatus(Status);
return FALSE; return FALSE;
}
CloseHandle(hFile);
return TRUE;
} }
/* EOF */ /* EOF */