From 7af8b13f116941415e1adc118e3dfec3b5ef1c53 Mon Sep 17 00:00:00 2001 From: Rolf Kalbermatter Date: Wed, 21 Jan 2004 23:51:57 +0000 Subject: [PATCH] Implement PathGetShortPathA/W and change its prototype to match the documentation on MSDN. --- dlls/shell32/shellpath.c | 30 +++++++++++++++++++++--------- dlls/shell32/undocshell.h | 2 -- include/shlobj.h | 5 +++++ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index a0516633ca..3cb349b52e 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -236,29 +236,41 @@ void WINAPI PathRemoveExtensionAW(LPVOID lpszPath) /************************************************************************* * PathGetShortPathA [internal] */ -LPSTR WINAPI PathGetShortPathA(LPSTR lpszPath) +static void PathGetShortPathA(LPSTR pszPath) { - FIXME("%s stub\n", lpszPath); - return NULL; + CHAR path[MAX_PATH]; + + TRACE("%s\n", pszPath); + + if (GetShortPathNameA(pszPath, path, MAX_PATH)) + { + lstrcpyA(pszPath, path); + } } /************************************************************************* * PathGetShortPathW [internal] */ -LPWSTR WINAPI PathGetShortPathW(LPWSTR lpszPath) +static void PathGetShortPathW(LPWSTR pszPath) { - FIXME("%s stub\n", debugstr_w(lpszPath)); - return NULL; + WCHAR path[MAX_PATH]; + + TRACE("%s\n", debugstr_w(pszPath)); + + if (GetShortPathNameW(pszPath, path, MAX_PATH)) + { + lstrcpyW(pszPath, path); + } } /************************************************************************* * PathGetShortPath [SHELL32.92] */ -LPVOID WINAPI PathGetShortPathAW(LPVOID lpszPath) +VOID WINAPI PathGetShortPathAW(LPVOID pszPath) { if(SHELL_OsIsUnicode()) - return PathGetShortPathW(lpszPath); - return PathGetShortPathA(lpszPath); + PathGetShortPathW(pszPath); + PathGetShortPathA(pszPath); } /************************************************************************* diff --git a/dlls/shell32/undocshell.h b/dlls/shell32/undocshell.h index d1af69715f..86224edb25 100644 --- a/dlls/shell32/undocshell.h +++ b/dlls/shell32/undocshell.h @@ -544,8 +544,6 @@ LPVOID WINAPI PathGetArgsAW(LPVOID lpszPath); BOOL WINAPI PathRemoveFileSpecAW(LPVOID lpszPath); -LPVOID WINAPI PathGetShortPathAW(LPVOID lpszPath); - void WINAPI PathRemoveBlanksAW(LPVOID lpszPath); VOID WINAPI PathQuoteSpacesAW(LPVOID path); diff --git a/include/shlobj.h b/include/shlobj.h index 4cbafd1e15..f626a586c8 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -841,6 +841,11 @@ typedef struct _FILEGROUPDESCRIPTORW { DECL_WINELIB_TYPE_AW(FILEGROUPDESCRIPTOR) DECL_WINELIB_TYPE_AW(LPFILEGROUPDESCRIPTOR) +/**************************************************************************** + * Path Manipulation Routines + */ +VOID WINAPI PathGetShortPath(LPWSTR pszPath); + #include /*****************************************************************************