diff --git a/reactos/include/ascii.h b/reactos/include/ascii.h index c694424e14f..49c32536b68 100644 --- a/reactos/include/ascii.h +++ b/reactos/include/ascii.h @@ -1107,6 +1107,12 @@ GetCurrentDirectoryA( LPSTR lpBuffer ); +BOOL +STDCALL +NeedCurrentDirectoryForExePathA( + LPCSTR ExeName + ); + WINBOOL STDCALL GetDiskFreeSpaceA( diff --git a/reactos/include/funcs.h b/reactos/include/funcs.h index 573b18eecd6..2a2fc546aa6 100644 --- a/reactos/include/funcs.h +++ b/reactos/include/funcs.h @@ -358,6 +358,7 @@ typedef PPROGRESS_ROUTINE LPPROGRESS_ROUTINE; #define GetWindowsDirectory GetWindowsDirectoryW #define SetCurrentDirectory SetCurrentDirectoryW #define GetCurrentDirectory GetCurrentDirectoryW +#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathW #define GetDiskFreeSpace GetDiskFreeSpaceW #define GetDiskFreeSpaceEx GetDiskFreeSpaceExW #define CreateDirectory CreateDirectoryW @@ -878,6 +879,7 @@ typedef PPROGRESS_ROUTINE LPPROGRESS_ROUTINE; #define GetWindowsDirectory GetWindowsDirectoryA #define SetCurrentDirectory SetCurrentDirectoryA #define GetCurrentDirectory GetCurrentDirectoryA +#define NeedCurrentDirectoryForExePath NeedCurrentDirectoryForExePathA #define GetDiskFreeSpace GetDiskFreeSpaceA #define GetDiskFreeSpaceEx GetDiskFreeSpaceExA #define CreateDirectory CreateDirectoryA diff --git a/reactos/include/unicode.h b/reactos/include/unicode.h index e7d5e7471f2..847bad2269b 100644 --- a/reactos/include/unicode.h +++ b/reactos/include/unicode.h @@ -1118,6 +1118,12 @@ GetCurrentDirectoryW( LPWSTR lpBuffer ); +BOOL +STDCALL +NeedCurrentDirectoryForExePathW( + LPCWSTR ExeName + ); + WINBOOL STDCALL GetDiskFreeSpaceW( diff --git a/reactos/lib/kernel32/file/dir.c b/reactos/lib/kernel32/file/dir.c index b46e2d091a9..5011b836986 100644 --- a/reactos/lib/kernel32/file/dir.c +++ b/reactos/lib/kernel32/file/dir.c @@ -1059,4 +1059,44 @@ GetDllDirectoryA( return Ret; } + +/* + * @unimplemented + */ +BOOL STDCALL +NeedCurrentDirectoryForExePathW(LPCWSTR ExeName) +{ + DPRINT1("NeedCurrentDirectoryForExePathW(0x%x) not implemented!\n", ExeName); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/* + * @implemented + */ +BOOL STDCALL +NeedCurrentDirectoryForExePathA(LPCSTR ExeName) +{ + ANSI_STRING ExeNameA; + UNICODE_STRING ExeNameU; + BOOL Ret; + + RtlInitAnsiString(&ExeNameA, ExeName); + if(bIsFileApiAnsi) + { + RtlAnsiStringToUnicodeString(&ExeNameU, &ExeNameA, TRUE); + } + else + { + RtlOemStringToUnicodeString(&ExeNameU, &ExeNameA, TRUE); + } + + Ret = NeedCurrentDirectoryForExePathW(ExeNameU.Buffer); + + RtlFreeUnicodeString(&ExeNameU); + + return Ret; +} + /* EOF */ diff --git a/reactos/lib/kernel32/kernel32.def b/reactos/lib/kernel32/kernel32.def index f618755bef1..383ec6db0ef 100644 --- a/reactos/lib/kernel32/kernel32.def +++ b/reactos/lib/kernel32/kernel32.def @@ -641,6 +641,8 @@ MoveFileW@8 MoveFileWithProgressW@20 MulDiv@12 MultiByteToWideChar@24 +NeedCurrentDirectoryForExePathA@4 +NeedCurrentDirectoryForExePathW@4 NlsConvertIntegerToString@20 ;NlsGetCacheUpdateCount ;NlsResetProcessLocale