implemented SetFileShortName()

svn path=/trunk/; revision=8783
This commit is contained in:
Thomas Bluemel 2004-03-18 18:29:19 +00:00
parent 27f458a084
commit 177645b96c
2 changed files with 93 additions and 31 deletions

View file

@ -1,4 +1,4 @@
/* $Id: file.c,v 1.52 2004/03/18 16:19:25 weiden Exp $
/* $Id: file.c,v 1.53 2004/03/18 18:29:18 weiden Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -1183,7 +1183,7 @@ SetFileValidData(
sizeof(FILE_VALID_DATA_LENGTH_INFORMATION),
FileValidDataLengthInformation
);
if (!NT_SUCCESS(Status)){
SetLastErrorByStatus(Status);
return FALSE;
@ -1192,4 +1192,94 @@ SetFileValidData(
return TRUE;
}
/*
* @implemented
*/
BOOL
STDCALL
SetFileShortNameW(
HANDLE hFile,
LPCWSTR lpShortName)
{
NTSTATUS Status;
ULONG NeededSize;
UNICODE_STRING ShortName;
IO_STATUS_BLOCK IoStatusBlock;
PFILE_NAME_INFORMATION FileNameInformation;
if(!lpShortName)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
RtlInitUnicodeString(&ShortName, lpShortName);
NeededSize = sizeof(FILE_NAME_INFORMATION) + ShortName.Length + sizeof(WCHAR);
if(!(FileNameInformation = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, NeededSize)))
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
FileNameInformation->FileNameLength = ShortName.Length;
RtlCopyMemory(FileNameInformation->FileName, ShortName.Buffer, ShortName.Length);
Status = NtSetInformationFile(hFile,
&IoStatusBlock, //out
FileNameInformation,
NeededSize,
FileShortNameInformation);
RtlFreeHeap(RtlGetProcessHeap(), 0, FileNameInformation);
if(!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
}
return NT_SUCCESS(Status);
}
/*
* @implemented
*/
BOOL
STDCALL
SetFileShortNameA(
HANDLE hFile,
LPCSTR lpShortName
)
{
NTSTATUS Status;
BOOL Ret;
ANSI_STRING ShortNameA;
UNICODE_STRING ShortName;
if(!lpShortName)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
RtlInitAnsiString(&ShortNameA, (LPSTR)lpShortName);
if(bIsFileApiAnsi)
Status = RtlAnsiStringToUnicodeString(&ShortName, &ShortNameA, TRUE);
else
Status = RtlOemStringToUnicodeString(&ShortName, &ShortNameA, TRUE);
if(!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
return FALSE;
}
Ret = SetFileShortNameW(hFile, ShortName.Buffer);
RtlFreeUnicodeString(&ShortName);
return Ret;
}
/* EOF */

View file

@ -1,4 +1,4 @@
/* $Id: stubs.c,v 1.69 2004/03/18 16:19:26 weiden Exp $
/* $Id: stubs.c,v 1.70 2004/03/18 18:29:19 weiden Exp $
*
* KERNEL32.DLL stubs (unimplemented functions)
* Remove from this file, if you implement them.
@ -1880,20 +1880,6 @@ SetDllDirectoryW(
return 0;
}
/*
* @unimplemented
*/
BOOL
STDCALL
SetFileShortNameW(
HANDLE hFile,
LPCWSTR lpShortName
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/*
* @unimplemented
*/
@ -2254,20 +2240,6 @@ SetDllDirectoryA(
return 0;
}
/*
* @unimplemented
*/
BOOL
STDCALL
SetFileShortNameA(
HANDLE hFile,
LPCSTR lpShortName
)
{
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return 0;
}
/*
* @unimplemented
*/