removed faulty FilenameA2U (returned ptr to stack var)

remove faulty init of StaticUnicodeString (now done in ntdll)

svn path=/trunk/; revision=14226
This commit is contained in:
Gunnar Dalsnes 2005-03-20 17:26:58 +00:00
parent 08482c30b1
commit de75c774c3
4 changed files with 13 additions and 42 deletions

View file

@ -83,23 +83,14 @@ SetCurrentDirectoryA (
LPCSTR lpPathName
)
{
PUNICODE_STRING PathNameU;
NTSTATUS Status;
PWCHAR PathNameW;
DPRINT("setcurrdir: %s\n",lpPathName);
if (!(PathNameU = FilenameA2U(lpPathName, FALSE)))
if (!(PathNameW = FilenameA2W(lpPathName, FALSE)))
return FALSE;
Status = RtlSetCurrentDirectory_U(PathNameU);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus (Status);
return FALSE;
}
return TRUE;
return SetCurrentDirectoryW(PathNameW);
}

View file

@ -26,19 +26,9 @@ BOOL bIsFileApiAnsi = TRUE; // set the file api to ansi or oem
/* FUNCTIONS ****************************************************************/
PWCHAR
PWCHAR
FilenameA2W(LPCSTR NameA, BOOL alloc)
{
PUNICODE_STRING pstrW;
pstrW = FilenameA2U(NameA, alloc);
return pstrW ? pstrW->Buffer : NULL;
}
PUNICODE_STRING
FilenameA2U(LPCSTR NameA, BOOL alloc)
{
ANSI_STRING str;
UNICODE_STRING strW;
@ -57,7 +47,7 @@ FilenameA2U(LPCSTR NameA, BOOL alloc)
Status= RtlOemStringToUnicodeString( pstrW, &str, alloc );
if (NT_SUCCESS(Status))
return pstrW;
return pstrW->Buffer;
if (Status== STATUS_BUFFER_OVERFLOW)
SetLastError( ERROR_FILENAME_EXCED_RANGE );
@ -134,7 +124,9 @@ FilenameW2A_FitOrFail(
}
/*
Return: num. TCHARS copied into dest including nullterm
*/
DWORD
FilenameA2W_N(
LPWSTR dest,
@ -154,10 +146,12 @@ FilenameA2W_N(
if (ret) dest[(ret/sizeof(WCHAR))-1]=0;
return ret;
return ret/sizeof(WCHAR);
}
/*
Return: num. TCHARS copied into dest including nullterm
*/
DWORD
FilenameW2A_N(
LPSTR dest,

View file

@ -62,7 +62,6 @@ PTEB GetTeb(VOID);
PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc);
PUNICODE_STRING FilenameA2U(LPCSTR NameA, BOOL alloc);
DWORD FilenameW2A_FitOrFail(LPSTR DestA, INT destLen, LPCWSTR SourceW, INT sourceLen);
DWORD FilenameU2A_FitOrFail(LPSTR DestA, INT destLen, PUNICODE_STRING SourceU);

View file

@ -82,7 +82,6 @@ DllMain(HANDLE hDll,
LPVOID lpReserved)
{
NTSTATUS Status;
PTEB Teb = NtCurrentTeb();
(void)lpReserved;
@ -149,10 +148,6 @@ DllMain(HANDLE hDll,
SetConsoleCtrlHandler(DefaultConsoleCtrlHandler, TRUE);
Teb->StaticUnicodeString.Length = 0;
Teb->StaticUnicodeString.MaximumLength = sizeof(Teb->StaticUnicodeBuffer);
Teb->StaticUnicodeString.Buffer = Teb->StaticUnicodeBuffer;
/* Insert more dll attach stuff here! */
DllInitialized = TRUE;
@ -178,14 +173,6 @@ DllMain(HANDLE hDll,
}
break;
case DLL_THREAD_ATTACH:
Teb->StaticUnicodeString.Length = 0;
Teb->StaticUnicodeString.MaximumLength = sizeof(Teb->StaticUnicodeBuffer);
Teb->StaticUnicodeString.Buffer = Teb->StaticUnicodeBuffer;
break;
default:
break;
}