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 LPCSTR lpPathName
) )
{ {
PUNICODE_STRING PathNameU; PWCHAR PathNameW;
NTSTATUS Status;
DPRINT("setcurrdir: %s\n",lpPathName); DPRINT("setcurrdir: %s\n",lpPathName);
if (!(PathNameU = FilenameA2U(lpPathName, FALSE))) if (!(PathNameW = FilenameA2W(lpPathName, FALSE)))
return FALSE; return FALSE;
Status = RtlSetCurrentDirectory_U(PathNameU); return SetCurrentDirectoryW(PathNameW);
if (!NT_SUCCESS(Status))
{
SetLastErrorByStatus (Status);
return FALSE;
}
return TRUE;
} }

View file

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

View file

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

View file

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