mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +00:00
Added missing features in GetFullPathName[A/W]().
svn path=/trunk/; revision=423
This commit is contained in:
parent
278a6c540b
commit
ddd8467f99
1 changed files with 128 additions and 164 deletions
|
@ -196,9 +196,26 @@ DWORD STDCALL GetFullPathNameA(LPCSTR lpFileName,
|
|||
return 0;
|
||||
|
||||
if (isalpha(lpFileName[0]) && lpFileName[1] == ':')
|
||||
{
|
||||
if (lpFileName[2] == '\\')
|
||||
{
|
||||
lstrcpyA(lpBuffer, lpFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
CHAR szRoot[4] = "A:\\";
|
||||
DWORD len;
|
||||
|
||||
szRoot[0] = lpFileName[0];
|
||||
len = GetCurrentDirectoryA(nBufferLength, lpBuffer);
|
||||
if (lpBuffer[len - 1] != '\\')
|
||||
{
|
||||
lpBuffer[len] = '\\';
|
||||
lpBuffer[len + 1] = 0;
|
||||
}
|
||||
lstrcatA(lpBuffer, &lpFileName[2]);
|
||||
}
|
||||
}
|
||||
else if (lpFileName[0] == '\\')
|
||||
{
|
||||
GetCurrentDirectoryA(nBufferLength, lpBuffer);
|
||||
|
@ -272,40 +289,6 @@ DWORD STDCALL GetFullPathNameA(LPCSTR lpFileName,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (p[1] == '.' && (p[2] == '\\' || p[2] == 0))
|
||||
{
|
||||
lstrcpyA(p, p+2);
|
||||
}
|
||||
else if (p[1] == '.' && p[2] == '.' && (p[3] == '\\' || p[3] == 0) &&
|
||||
prev != NULL)
|
||||
{
|
||||
lstrcpyA(prev, p+3);
|
||||
p = prev;
|
||||
if (prev == (lpBuffer+2))
|
||||
{
|
||||
prev = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev--;
|
||||
while ((*prev) != '\\')
|
||||
{
|
||||
prev--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
prev = p;
|
||||
do
|
||||
{
|
||||
p++;
|
||||
}
|
||||
while ((*p) != 0 && (*p) != '\\');
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (lpFilePart != NULL)
|
||||
|
@ -351,11 +334,28 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
if (!lpFileName || !lpBuffer)
|
||||
return 0;
|
||||
|
||||
if (isalpha(lpFileName[0]) && lpFileName[1] == ':')
|
||||
if (isalpha(lpFileName[0]) && lpFileName[1] == L':')
|
||||
{
|
||||
if (lpFileName[2] == L'\\')
|
||||
{
|
||||
lstrcpyW(lpBuffer, lpFileName);
|
||||
}
|
||||
else if (lpFileName[0] == '\\')
|
||||
else
|
||||
{
|
||||
WCHAR szRoot[4] = L"A:\\";
|
||||
DWORD len;
|
||||
|
||||
szRoot[0] = lpFileName[0];
|
||||
len = GetCurrentDirectoryW(nBufferLength, lpBuffer);
|
||||
if (lpBuffer[len - 1] != L'\\')
|
||||
{
|
||||
lpBuffer[len] = L'\\';
|
||||
lpBuffer[len + 1] = 0;
|
||||
}
|
||||
lstrcatW(lpBuffer, &lpFileName[2]);
|
||||
}
|
||||
}
|
||||
else if (lpFileName[0] == L'\\')
|
||||
{
|
||||
GetCurrentDirectoryW(nBufferLength, lpBuffer);
|
||||
lstrcpyW(&lpBuffer[2], lpFileName);
|
||||
|
@ -391,7 +391,7 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
{
|
||||
p++;
|
||||
}
|
||||
while ((*p) != 0 && (*p) != '\\');
|
||||
while ((*p) != 0 && (*p) != L'\\');
|
||||
}
|
||||
else if (dwDotLen == 1)
|
||||
{
|
||||
|
@ -406,7 +406,7 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
while (n > 0)
|
||||
{
|
||||
prev--;
|
||||
if ((*prev) == '\\')
|
||||
if ((*prev) == L'\\')
|
||||
n--;
|
||||
if (prev == (lpBuffer+2))
|
||||
break;
|
||||
|
@ -422,48 +422,12 @@ DWORD STDCALL GetFullPathNameW(LPCWSTR lpFileName,
|
|||
else
|
||||
{
|
||||
prev--;
|
||||
while ((*prev) != '\\')
|
||||
while ((*prev) != L'\\')
|
||||
{
|
||||
prev--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
DPRINT("prev %w p %w\n",prev,p);
|
||||
if (p[1] == '.' && (p[2] == '\\' || p[2] == 0))
|
||||
{
|
||||
lstrcpyW(p, p+2);
|
||||
}
|
||||
else if (p[1] == '.' && p[2] == '.' && (p[3] == '\\' || p[3] == 0) &&
|
||||
prev != NULL)
|
||||
{
|
||||
lstrcpyW(prev, p+3);
|
||||
p = prev;
|
||||
if (prev == (lpBuffer+2))
|
||||
{
|
||||
prev = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev--;
|
||||
while ((*prev) != '\\')
|
||||
{
|
||||
prev--;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
prev = p;
|
||||
do
|
||||
{
|
||||
p++;
|
||||
}
|
||||
while ((*p) != 0 && (*p) != '\\');
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (lpFilePart != NULL)
|
||||
|
|
Loading…
Reference in a new issue