implemented SetFileAttributesByHandle() and GetFileAttributesByHandle()

svn path=/trunk/; revision=17530
This commit is contained in:
Thomas Bluemel 2005-08-24 23:59:03 +00:00
parent 78bc5b9ab0
commit 5760f0496c
2 changed files with 76 additions and 0 deletions

View file

@ -964,6 +964,80 @@ GetFileAttributesW(LPCWSTR lpFileName)
return Result ? FileAttributeData.dwFileAttributes : INVALID_FILE_ATTRIBUTES;
}
/*
* @implemented
*/
BOOL STDCALL
GetFileAttributesByHandle(IN HANDLE hFile,
OUT LPDWORD dwFileAttributes,
IN DWORD dwFlags)
{
FILE_BASIC_INFORMATION FileBasic;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
UNREFERENCED_PARAMETER(dwFlags);
Status = NtQueryInformationFile(hFile,
&IoStatusBlock,
&FileBasic,
sizeof(FileBasic),
FileBasicInformation);
if (NT_SUCCESS(Status))
{
*dwFileAttributes = FileBasic.FileAttributes;
return TRUE;
}
SetLastErrorByStatus(Status);
return FALSE;
}
/*
* @implemented
*/
BOOL STDCALL
SetFileAttributesByHandle(IN HANDLE hFile,
IN DWORD dwFileAttributes,
IN DWORD dwFlags)
{
FILE_BASIC_INFORMATION FileBasic;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
UNREFERENCED_PARAMETER(dwFlags);
Status = NtQueryInformationFile(hFile,
&IoStatusBlock,
&FileBasic,
sizeof(FileBasic),
FileBasicInformation);
if (NT_SUCCESS(Status))
{
FileBasic.FileAttributes = dwFileAttributes;
Status = NtSetInformationFile(hFile,
&IoStatusBlock,
&FileBasic,
sizeof(FileBasic),
FileBasicInformation);
}
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus(Status);
return FALSE;
}
return TRUE;
}
/*
* @implemented
*/
BOOL STDCALL
SetFileAttributesA(
LPCSTR lpFileName,

View file

@ -372,6 +372,7 @@ GetExpandedNameA@8
GetExpandedNameW@8
GetFileAttributesA@4
GetFileAttributesW@4
GetFileAttributesByHandle@12
GetFileAttributesExA@12
GetFileAttributesExW@12
GetFileInformationByHandle@8
@ -805,6 +806,7 @@ SetFileApisToANSI@0
SetFileApisToOEM@0
SetFileAttributesA@8
SetFileAttributesW@8
SetFileAttributesByHandle@12
SetFilePointer@16
SetFilePointerEx@20
SetFileShortNameA@8