removed faulty FilenameA2U (returned ptr to stack var)
remove faulty init of StaticUnicodeString (now done in ntdll)
Modified: trunk/reactos/lib/kernel32/file/curdir.c
Modified: trunk/reactos/lib/kernel32/file/file.c
Modified: trunk/reactos/lib/kernel32/include/kernel32.h
Modified: trunk/reactos/lib/kernel32/misc/dllmain.c
_____
Modified: trunk/reactos/lib/kernel32/file/curdir.c
--- trunk/reactos/lib/kernel32/file/curdir.c 2005-03-20 17:24:11 UTC
(rev 14225)
+++ trunk/reactos/lib/kernel32/file/curdir.c 2005-03-20 17:26:58 UTC
(rev 14226)
@@ -83,23 +83,14 @@
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);
}
_____
Modified: trunk/reactos/lib/kernel32/file/file.c
--- trunk/reactos/lib/kernel32/file/file.c 2005-03-20 17:24:11 UTC
(rev 14225)
+++ trunk/reactos/lib/kernel32/file/file.c 2005-03-20 17:26:58 UTC
(rev 14226)
@@ -26,20 +26,10 @@
/* 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;
PUNICODE_STRING pstrW;
@@ -57,7 +47,7 @@
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 @@
}
-
+/*
+Return: num. TCHARS copied into dest including nullterm
+*/
DWORD
FilenameA2W_N(
LPWSTR dest,
@@ -154,10 +146,12 @@
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,
_____
Modified: trunk/reactos/lib/kernel32/include/kernel32.h
--- trunk/reactos/lib/kernel32/include/kernel32.h 2005-03-20
17:24:11 UTC (rev 14225)
+++ trunk/reactos/lib/kernel32/include/kernel32.h 2005-03-20
17:26:58 UTC (rev 14226)
@@ -62,7 +62,6 @@
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);
_____
Modified: trunk/reactos/lib/kernel32/misc/dllmain.c
--- trunk/reactos/lib/kernel32/misc/dllmain.c 2005-03-20 17:24:11 UTC
(rev 14225)
+++ trunk/reactos/lib/kernel32/misc/dllmain.c 2005-03-20 17:26:58 UTC
(rev 14226)
@@ -82,7 +82,6 @@
LPVOID lpReserved)
{
NTSTATUS Status;
- PTEB Teb = NtCurrentTeb();
(void)lpReserved;
@@ -149,10 +148,6 @@
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 @@
}
break;
- case DLL_THREAD_ATTACH:
-
- Teb->StaticUnicodeString.Length = 0;
- Teb->StaticUnicodeString.MaximumLength =
sizeof(Teb->StaticUnicodeBuffer);
- Teb->StaticUnicodeString.Buffer = Teb->StaticUnicodeBuffer;
- break;
-
-
default:
break;
}