Fixed a couple of bugs in RtlGetFullPathName_U.

This commit is contained in:
Eric Pouech 2003-10-04 03:06:58 +00:00 committed by Alexandre Julliard
parent 954765e0cc
commit 7760413f6b
1 changed files with 7 additions and 3 deletions

View File

@ -397,7 +397,11 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
case RELATIVE_PATH: /* foo */ case RELATIVE_PATH: /* foo */
reqsize += cd->Length; reqsize += cd->Length;
if (reqsize <= size) strcpyW(buffer, cd->Buffer); if (reqsize <= size)
{
memcpy(buffer, cd->Buffer, cd->Length);
buffer[cd->Length / sizeof(WCHAR)] = 0;
}
if (cd->Buffer[1] != ':') if (cd->Buffer[1] != ':')
{ {
ptr = strchrW(cd->Buffer + 2, '\\'); ptr = strchrW(cd->Buffer + 2, '\\');
@ -501,7 +505,7 @@ static ULONG get_full_path_helper(LPCWSTR name, LPWSTR buffer, ULONG size)
break; break;
case '\\': case '\\':
reqsize -= 2 * sizeof(WCHAR); reqsize -= 2 * sizeof(WCHAR);
memmove(ptr + 2, ptr, buffer + reqsize - ptr + sizeof(WCHAR)); memmove(ptr, ptr + 2, buffer + reqsize - ptr + sizeof(WCHAR));
break; break;
} }
} }
@ -518,7 +522,7 @@ done:
* *
* Returns the number of bytes written to buffer (not including the * Returns the number of bytes written to buffer (not including the
* terminating NULL) if the function succeeds, or the required number of bytes * terminating NULL) if the function succeeds, or the required number of bytes
* (including the terminating NULL) if the buffer is to small. * (including the terminating NULL) if the buffer is too small.
* *
* file_part will point to the filename part inside buffer (except if we use * file_part will point to the filename part inside buffer (except if we use
* DOS device name, in which case file_in_buf is NULL) * DOS device name, in which case file_in_buf is NULL)