diff --git a/reactos/lib/kernel32/file/curdir.c b/reactos/lib/kernel32/file/curdir.c index f2eddf00f46..ae6e2369c8e 100644 --- a/reactos/lib/kernel32/file/curdir.c +++ b/reactos/lib/kernel32/file/curdir.c @@ -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); } diff --git a/reactos/lib/kernel32/file/file.c b/reactos/lib/kernel32/file/file.c index 10ccfdfa3d2..3768245bf7f 100644 --- a/reactos/lib/kernel32/file/file.c +++ b/reactos/lib/kernel32/file/file.c @@ -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, diff --git a/reactos/lib/kernel32/include/kernel32.h b/reactos/lib/kernel32/include/kernel32.h index 85689c81f90..c659c873e04 100755 --- a/reactos/lib/kernel32/include/kernel32.h +++ b/reactos/lib/kernel32/include/kernel32.h @@ -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); diff --git a/reactos/lib/kernel32/misc/dllmain.c b/reactos/lib/kernel32/misc/dllmain.c index 3b9117fa14a..c30baff4e29 100644 --- a/reactos/lib/kernel32/misc/dllmain.c +++ b/reactos/lib/kernel32/misc/dllmain.c @@ -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; }