mirror of
https://github.com/reactos/reactos.git
synced 2025-02-28 19:32:59 +00:00
[SETUPAPI] Slightly improve pSetupGetFileTitle
- Make the function return a pointer to const string. - Skip any drive path if any, looking for ':' just once.
This commit is contained in:
parent
a8206bae3d
commit
c5a5c4a03b
2 changed files with 17 additions and 19 deletions
|
@ -986,34 +986,32 @@ DWORD WINAPI GetSetFileTimestamp(LPCWSTR lpFileName,
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* pSetupGetFileTitle [SETUPAPI.@]
|
* pSetupGetFileTitle [SETUPAPI.@]
|
||||||
*
|
*
|
||||||
* Returns a pointer to the last part of a fully qualified file name.
|
* Returns a pointer to the last part (file name) of a full file path.
|
||||||
*
|
*
|
||||||
* PARAMS
|
* PARAMS
|
||||||
* lpFileName [I] File name
|
* pFilePath [I] The fully qualified file path.
|
||||||
*
|
*
|
||||||
* RETURNS
|
* RETURNS
|
||||||
* Pointer to a files name.
|
* Pointer to the file name, if any, or the terminating NULL.
|
||||||
*/
|
*/
|
||||||
LPWSTR WINAPI
|
PCWSTR WINAPI
|
||||||
pSetupGetFileTitle(LPCWSTR lpFileName)
|
pSetupGetFileTitle(PCWSTR pFilePath)
|
||||||
{
|
{
|
||||||
LPWSTR ptr;
|
PCWSTR ptr, ret;
|
||||||
LPWSTR ret;
|
|
||||||
WCHAR c;
|
WCHAR c;
|
||||||
|
|
||||||
TRACE("%s\n", debugstr_w(lpFileName));
|
TRACE("%s\n", debugstr_w(pFilePath));
|
||||||
|
|
||||||
ptr = (LPWSTR)lpFileName;
|
/* Skip the drive letter if any */
|
||||||
ret = ptr;
|
ptr = pFilePath;
|
||||||
while (TRUE)
|
if (*ptr && ptr[1] == L':')
|
||||||
|
ptr += 2;
|
||||||
|
|
||||||
|
/* Find the last path separator preceding the file name */
|
||||||
|
for (ret = ptr; (c = *ptr);)
|
||||||
{
|
{
|
||||||
c = *ptr;
|
++ptr;
|
||||||
|
if (c == L'\\' || c == L'/')
|
||||||
if (c == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
ptr++;
|
|
||||||
if (c == (WCHAR)'\\' || c == (WCHAR)'/' || c == (WCHAR)':')
|
|
||||||
ret = ptr;
|
ret = ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ WINSETUPAPI VOID WINAPI pSetupCenterWindowRelativeToParent(HWND);
|
||||||
WINSETUPAPI BOOL WINAPI pSetupConcatenatePaths(LPWSTR, LPCWSTR, DWORD, LPDWORD);
|
WINSETUPAPI BOOL WINAPI pSetupConcatenatePaths(LPWSTR, LPCWSTR, DWORD, LPDWORD);
|
||||||
WINSETUPAPI PWSTR WINAPI pSetupDuplicateString(PCWSTR);
|
WINSETUPAPI PWSTR WINAPI pSetupDuplicateString(PCWSTR);
|
||||||
WINSETUPAPI BOOL WINAPI pSetupEnablePrivilege(PCWSTR, BOOL);
|
WINSETUPAPI BOOL WINAPI pSetupEnablePrivilege(PCWSTR, BOOL);
|
||||||
WINSETUPAPI PWSTR WINAPI pSetupGetFileTitle(PCWSTR);
|
WINSETUPAPI PCWSTR WINAPI pSetupGetFileTitle(PCWSTR);
|
||||||
WINSETUPAPI BOOL WINAPI pSetupGetVersionInfoFromImage(LPWSTR, PULARGE_INTEGER, LPWORD);
|
WINSETUPAPI BOOL WINAPI pSetupGetVersionInfoFromImage(LPWSTR, PULARGE_INTEGER, LPWORD);
|
||||||
WINSETUPAPI DWORD WINAPI pSetupGuidFromString(PCWSTR, LPGUID);
|
WINSETUPAPI DWORD WINAPI pSetupGuidFromString(PCWSTR, LPGUID);
|
||||||
WINSETUPAPI BOOL WINAPI pSetupIsGuidNull(LPGUID);
|
WINSETUPAPI BOOL WINAPI pSetupIsGuidNull(LPGUID);
|
||||||
|
|
Loading…
Reference in a new issue