implemented GetFinalPathNameByHandleA() and added stub for GetFinalPathNameByHandleW()

svn path=/trunk/; revision=20850
This commit is contained in:
Thomas Bluemel 2006-01-14 13:37:08 +00:00
parent 6fca38c9bf
commit 7c8174e7ee
3 changed files with 95 additions and 2 deletions

View file

@ -1600,4 +1600,87 @@ CheckNameLegalDOS8Dot3A(
return TRUE;
}
/*
* @implemented
*/
DWORD
WINAPI
GetFinalPathNameByHandleA(IN HANDLE hFile,
OUT LPSTR lpszFilePath,
IN DWORD cchFilePath,
IN DWORD dwFlags)
{
WCHAR FilePathW[MAX_PATH];
UNICODE_STRING FilePathU;
DWORD PrevLastError;
DWORD Ret = 0;
if (cchFilePath != 0 &&
cchFilePath > sizeof(FilePathW) / sizeof(FilePathW[0]))
{
FilePathU.Length = 0;
FilePathU.MaximumLength = cchFilePath * sizeof(WCHAR);
FilePathU.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
0,
FilePathU.MaximumLength);
if (FilePathU.Buffer == NULL)
{
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return 0;
}
}
else
{
FilePathU.Length = 0;
FilePathU.MaximumLength = sizeof(FilePathW);
FilePathU.Buffer = FilePathW;
}
/* save the last error code */
PrevLastError = GetLastError();
SetLastError(ERROR_SUCCESS);
/* call the unicode version that does all the work */
Ret = GetFinalPathNameByHandleW(hFile,
FilePathU.Buffer,
cchFilePath,
dwFlags);
if (GetLastError() == ERROR_SUCCESS)
{
/* no error, restore the last error code and convert the string */
SetLastError(PrevLastError);
Ret = FilenameU2A_FitOrFail(lpszFilePath,
cchFilePath,
&FilePathU);
}
/* free allocated memory if necessary */
if (FilePathU.Buffer != FilePathW)
{
RtlFreeHeap(RtlGetProcessHeap(),
0,
FilePathU.Buffer);
}
return Ret;
}
/*
* @unimplemented
*/
DWORD
WINAPI
GetFinalPathNameByHandleW(IN HANDLE hFile,
OUT LPWSTR lpszFilePath,
IN DWORD cchFilePath,
IN DWORD dwFlags)
{
UNIMPLEMENTED;
return 0;
}
/* EOF */

View file

@ -387,6 +387,8 @@ GetFileSize@8
GetFileSizeEx@8
GetFileTime@16
GetFileType@4
GetFinalPathNameByHandleA@16
GetFinalPathNameByHandleW@16
GetFirmwareEnvironmentVariableA@16
GetFirmwareEnvironmentVariableW@16
GetFullPathNameA@16

View file

@ -1368,6 +1368,8 @@ BOOL WINAPI GetExitCodeThread(HANDLE,PDWORD);
DWORD WINAPI GetFileAttributesA(LPCSTR);
#if (_WIN32_WINNT >= 0x0600)
BOOL WINAPI GetFileAttributesByHandle(HANDLE,LPDWORD,DWORD);
DWORD WINAPI GetFinalPathNameByHandleA(HANDLE,LPSTR,DWORD,DWORD);
DWORD WINAPI GetFinalPathNameByHandleW(HANDLE,LPWSTR,DWORD,DWORD);
#endif
DWORD WINAPI GetFileAttributesW(LPCWSTR);
BOOL WINAPI GetFileAttributesExA(LPCSTR,GET_FILEEX_INFO_LEVELS,PVOID);
@ -2042,8 +2044,11 @@ typedef PCACTCTXW PCACTCTX;
#define GetEnvironmentStrings GetEnvironmentStringsW
#define GetEnvironmentVariable GetEnvironmentVariableW
#define GetFileAttributes GetFileAttributesW
#define GetFileSecurity GetFileSecurityW
#define GetFileAttributesEx GetFileAttributesExW
#define GetFileSecurity GetFileSecurityW
#if (_WIN32_WINNT >= 0x0600)
#define GetFinalPathNameByHandle GetFinalPathNameByHandleW
#endif
#define GetFullPathName GetFullPathNameW
#define GetLogicalDriveStrings GetLogicalDriveStringsW
#if (_WIN32_WINNT >= 0x0500 || _WIN32_WINDOWS >= 0x0410)
@ -2241,8 +2246,11 @@ typedef ENUMRESTYPEPROCA ENUMRESTYPEPROC;
#define GetDriveType GetDriveTypeA
#define GetEnvironmentVariable GetEnvironmentVariableA
#define GetFileAttributes GetFileAttributesA
#define GetFileSecurity GetFileSecurityA
#define GetFileAttributesEx GetFileAttributesExA
#define GetFileSecurity GetFileSecurityA
#if (_WIN32_WINNT >= 0x0600)
#define GetFinalPathNameByHandle GetFinalPathNameByHandleA
#endif
#define GetFullPathName GetFullPathNameA
#define GetLogicalDriveStrings GetLogicalDriveStringsA
#if (_WIN32_WINNT >= 0x0500 || _WIN32_WINDOWS >= 0x0410)