From 6c07abd294970c2d5ab23d39b0cf1a12d02011ba Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Wed, 22 Sep 2004 09:31:01 +0000 Subject: [PATCH] implemented CheckNameLegalDOS8Dot3A/W() svn path=/trunk/; revision=10969 --- reactos/lib/kernel32/file/file.c | 95 ++++++++++++++++++++++++++++++- reactos/lib/kernel32/misc/stubs.c | 36 +----------- 2 files changed, 95 insertions(+), 36 deletions(-) diff --git a/reactos/lib/kernel32/file/file.c b/reactos/lib/kernel32/file/file.c index a3741f7a976..8593886cf61 100644 --- a/reactos/lib/kernel32/file/file.c +++ b/reactos/lib/kernel32/file/file.c @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.57 2004/09/06 15:56:25 weiden Exp $ +/* $Id: file.c,v 1.58 2004/09/22 09:31:01 weiden Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries @@ -1360,4 +1360,97 @@ SetFileShortNameA( return Ret; } + +/* + * @implemented + */ +BOOL +STDCALL +CheckNameLegalDOS8Dot3W( + LPCWSTR lpName, + LPSTR lpOemName OPTIONAL, + DWORD OemNameSize OPTIONAL, + PBOOL pbNameContainsSpaces OPTIONAL, + PBOOL pbNameLegal + ) +{ + UNICODE_STRING Name; + ANSI_STRING AnsiName; + + if(lpName == NULL || + (lpOemName == NULL && OemNameSize != 0) || + pbNameLegal == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if(lpOemName != NULL) + { + AnsiName.Buffer = lpOemName; + AnsiName.MaximumLength = OemNameSize * sizeof(CHAR); + AnsiName.Length = 0; + } + + RtlInitUnicodeString(&Name, lpName); + + *pbNameLegal = RtlIsNameLegalDOS8Dot3(&Name, + (lpOemName ? &AnsiName : NULL), + (BOOLEAN*)pbNameContainsSpaces); + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +STDCALL +CheckNameLegalDOS8Dot3A( + LPCSTR lpName, + LPSTR lpOemName OPTIONAL, + DWORD OemNameSize OPTIONAL, + PBOOL pbNameContainsSpaces OPTIONAL, + PBOOL pbNameLegal + ) +{ + UNICODE_STRING Name; + ANSI_STRING AnsiName, AnsiInputName; + NTSTATUS Status; + + if(lpName == NULL || + (lpOemName == NULL && OemNameSize != 0) || + pbNameLegal == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if(lpOemName != NULL) + { + AnsiName.Buffer = lpOemName; + AnsiName.MaximumLength = OemNameSize * sizeof(CHAR); + AnsiName.Length = 0; + } + + RtlInitAnsiString(&AnsiInputName, (LPSTR)lpName); + if(bIsFileApiAnsi) + Status = RtlAnsiStringToUnicodeString(&Name, &AnsiInputName, TRUE); + else + Status = RtlOemStringToUnicodeString(&Name, &AnsiInputName, TRUE); + + if(!NT_SUCCESS(Status)) + { + SetLastErrorByStatus(Status); + return FALSE; + } + + *pbNameLegal = RtlIsNameLegalDOS8Dot3(&Name, + (lpOemName ? &AnsiName : NULL), + (BOOLEAN*)pbNameContainsSpaces); + + return TRUE; +} + /* EOF */ diff --git a/reactos/lib/kernel32/misc/stubs.c b/reactos/lib/kernel32/misc/stubs.c index 72531490b96..da9ed59b3c7 100644 --- a/reactos/lib/kernel32/misc/stubs.c +++ b/reactos/lib/kernel32/misc/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.86 2004/09/21 22:08:18 weiden Exp $ +/* $Id: stubs.c,v 1.87 2004/09/22 09:31:01 weiden Exp $ * * KERNEL32.DLL stubs (unimplemented functions) * Remove from this file, if you implement them. @@ -1307,23 +1307,6 @@ ZombifyActCtx( return 0; } -/* - * @unimplemented - */ -BOOL -STDCALL -CheckNameLegalDOS8Dot3W( - LPCWSTR lpName, - LPSTR lpOemName OPTIONAL, - DWORD OemNameSize OPTIONAL, - PBOOL pbNameContainsSpaces OPTIONAL, - PBOOL pbNameLegal - ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - /* * @unimplemented */ @@ -1667,23 +1650,6 @@ VerifyVersionInfoW( return 0; } -/* - * @unimplemented - */ -BOOL -STDCALL -CheckNameLegalDOS8Dot3A( - LPCSTR lpName, - LPSTR lpOemName OPTIONAL, - DWORD OemNameSize OPTIONAL, - PBOOL pbNameContainsSpaces OPTIONAL, - PBOOL pbNameLegal - ) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - /* * @unimplemented */