From: Hartmut Birr Date: Mon, 25 Mar 2002 21:09:18 +0000 (+0000) Subject: Rewrote SearchPathW(). X-Git-Tag: backups/mpw@12443~161 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=f4a1a5dd8e7fd1038938171f9e775cd1c3edd61d Rewrote SearchPathW(). svn path=/trunk/; revision=2781 --- diff --git a/reactos/lib/kernel32/file/dir.c b/reactos/lib/kernel32/file/dir.c index 975378fb9e3..b97bc0b5b93 100644 --- a/reactos/lib/kernel32/file/dir.c +++ b/reactos/lib/kernel32/file/dir.c @@ -1,4 +1,4 @@ -/* $Id: dir.c,v 1.28 2001/02/10 22:25:42 ekohl Exp $ +/* $Id: dir.c,v 1.29 2002/03/25 21:09:18 hbirr Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -577,151 +577,48 @@ SearchPathW ( * On failure, zero. */ { - NTSTATUS errCode; DWORD retCode = 0; - HANDLE FileHandle = NULL; - - ULONG i,j; - - WCHAR BufferW[MAX_PATH]; - WCHAR FileAndExtensionW[MAX_PATH]; - WCHAR *EnvironmentBufferW = NULL; - - UNICODE_STRING PathString; - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; + ULONG pos, len; + PWCHAR EnvironmentBufferW = NULL; + WCHAR Buffer; DPRINT("SearchPath\n"); - if ( lpPath == NULL ) - { - // check the directory from which the application loaded - - if ( GetCurrentDirectoryW( MAX_PATH, BufferW ) > 0 ) { - retCode = SearchPathW(BufferW,lpFileName, lpExtension, nBufferLength, lpBuffer, lpFilePart ); - if ( retCode != 0 ) - return retCode; - } - if ( GetSystemDirectoryW( BufferW, MAX_PATH ) > 0 ) { - retCode = SearchPathW(BufferW,lpFileName, lpExtension, nBufferLength, lpBuffer, lpFilePart ); - if ( retCode != 0 ) - return retCode; - } - - if ( GetWindowsDirectoryW( BufferW, MAX_PATH ) > 0 ) { - retCode = SearchPathW(BufferW,lpFileName, lpExtension, nBufferLength, lpBuffer, lpFilePart ); - if ( retCode != 0 ) - return retCode; - } - - j = GetEnvironmentVariableW(L"Path",EnvironmentBufferW,0); - EnvironmentBufferW = (WCHAR *)RtlAllocateHeap(GetProcessHeap(),HEAP_GENERATE_EXCEPTIONS|HEAP_ZERO_MEMORY,(j+1)*sizeof(WCHAR)); - - j = GetEnvironmentVariableW(L"Path",EnvironmentBufferW,j+1); - - for(i=0;i