Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
a629a419
Commit
a629a419
authored
Apr 17, 2008
by
Stefan Leichter
Committed by
Alexandre Julliard
Apr 21, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Implement SHGetFolderPathAndSubDirA/W.
parent
f9c2d8e2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
4 deletions
+87
-4
shell32.spec
dlls/shell32/shell32.spec
+2
-0
shellpath.c
dlls/shell32/shellpath.c
+82
-4
shlobj.h
include/shlobj.h
+3
-0
No files found.
dlls/shell32/shell32.spec
View file @
a629a419
...
...
@@ -344,6 +344,8 @@
@ stdcall SHGetFileInfoW(ptr long ptr long long)
@ stdcall SHGetFolderLocation(long long long long ptr)
@ stdcall SHGetFolderPathA(long long long long ptr)
@ stdcall SHGetFolderPathAndSubDirA(long long long long str ptr)
@ stdcall SHGetFolderPathAndSubDirW(long long long long wstr ptr)
@ stdcall SHGetFolderPathW(long long long long ptr)
@ stub SHGetFreeDiskSpace
@ stub SHGetIconOverlayIndexA
...
...
dlls/shell32/shellpath.c
View file @
a629a419
...
...
@@ -1675,21 +1675,88 @@ HRESULT WINAPI SHGetFolderPathW(
DWORD
dwFlags
,
/* [I] which path to return */
LPWSTR
pszPath
)
/* [O] converted path */
{
HRESULT
hr
=
SHGetFolderPathAndSubDirW
(
hwndOwner
,
nFolder
,
hToken
,
dwFlags
,
NULL
,
pszPath
);
if
(
HRESULT_FROM_WIN32
(
ERROR_PATH_NOT_FOUND
)
==
hr
)
hr
=
HRESULT_FROM_WIN32
(
ERROR_FILE_NOT_FOUND
);
return
hr
;
}
HRESULT
WINAPI
SHGetFolderPathAndSubDirA
(
HWND
hwndOwner
,
/* [I] owner window */
int
nFolder
,
/* [I] CSIDL identifying the folder */
HANDLE
hToken
,
/* [I] access token */
DWORD
dwFlags
,
/* [I] which path to return */
LPCSTR
pszSubPath
,
/* [I] sub directory of the specified folder */
LPSTR
pszPath
)
/* [O] converted path */
{
int
length
;
HRESULT
hr
=
S_OK
;
LPWSTR
pszSubPathW
=
NULL
;
LPWSTR
pszPathW
=
NULL
;
TRACE
(
"%08x,%08x,%s
\n
"
,
nFolder
,
dwFlags
,
debugstr_w
(
pszSubPathW
));
if
(
pszPath
)
{
pszPathW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
MAX_PATH
*
sizeof
(
WCHAR
));
if
(
!
pszPathW
)
{
hr
=
HRESULT_FROM_WIN32
(
ERROR_NOT_ENOUGH_MEMORY
);
WARN
(
"Failed to allocate %u bytes of memory
\n
"
,
MAX_PATH
*
sizeof
(
WCHAR
));
goto
cleanup
;
}
}
TRACE
(
"%08x,%08x,%s
\n
"
,
nFolder
,
dwFlags
,
debugstr_w
(
pszSubPathW
));
/* SHGetFolderPathAndSubDirW does not distinguish if pszSubPath isn't
* set (null), or an empty string.therefore call it without the parameter set
* if pszSubPath is an empty string
*/
if
(
pszSubPath
&&
pszSubPath
[
0
])
{
length
=
MultiByteToWideChar
(
CP_ACP
,
0
,
pszSubPath
,
-
1
,
NULL
,
0
);
pszSubPathW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
length
*
sizeof
(
WCHAR
));
if
(
!
pszSubPathW
)
{
hr
=
HRESULT_FROM_WIN32
(
ERROR_NOT_ENOUGH_MEMORY
);
WARN
(
"Failed to allocate %u bytes of memory
\n
"
,
length
*
sizeof
(
WCHAR
));
goto
cleanup
;
}
MultiByteToWideChar
(
CP_ACP
,
0
,
pszSubPath
,
-
1
,
pszSubPathW
,
length
);
}
hr
=
SHGetFolderPathAndSubDirW
(
hwndOwner
,
nFolder
,
hToken
,
dwFlags
,
pszSubPathW
,
pszPathW
);
if
(
SUCCEEDED
(
hr
)
&&
pszPath
)
WideCharToMultiByte
(
CP_ACP
,
0
,
pszPathW
,
-
1
,
pszPath
,
MAX_PATH
,
NULL
,
NULL
);
cleanup:
HeapFree
(
GetProcessHeap
(),
0
,
pszPathW
);
HeapFree
(
GetProcessHeap
(),
0
,
pszSubPathW
);
return
hr
;
}
HRESULT
WINAPI
SHGetFolderPathAndSubDirW
(
HWND
hwndOwner
,
/* [I] owner window */
int
nFolder
,
/* [I] CSIDL identifying the folder */
HANDLE
hToken
,
/* [I] access token */
DWORD
dwFlags
,
/* [I] which path to return */
LPCWSTR
pszSubPath
,
/* [I] sub directory of the specified folder */
LPWSTR
pszPath
)
/* [O] converted path */
{
HRESULT
hr
;
WCHAR
szBuildPath
[
MAX_PATH
],
szTemp
[
MAX_PATH
];
DWORD
folder
=
nFolder
&
CSIDL_FOLDER_MASK
;
CSIDL_Type
type
;
int
ret
;
TRACE
(
"%p,%p,nFolder=0x%04x
\n
"
,
hwndOwner
,
pszPath
,
nFolder
);
TRACE
(
"%p,%p,nFolder=0x%04x
,%s
\n
"
,
hwndOwner
,
pszPath
,
nFolder
,
debugstr_w
(
pszSubPath
)
);
/* Windows always NULL-terminates the resulting path regardless of success
* or failure, so do so first
*/
if
(
pszPath
)
*
pszPath
=
'\0'
;
if
(
folder
>=
sizeof
(
CSIDL_Data
)
/
sizeof
(
CSIDL_Data
[
0
]))
return
E_INVALIDARG
;
if
((
SHGFP_TYPE_CURRENT
!=
dwFlags
)
&&
(
SHGFP_TYPE_DEFAULT
!=
dwFlags
))
return
E_INVALIDARG
;
szTemp
[
0
]
=
0
;
type
=
CSIDL_Data
[
folder
].
type
;
switch
(
type
)
...
...
@@ -1742,12 +1809,23 @@ HRESULT WINAPI SHGetFolderPathW(
hr
=
_SHExpandEnvironmentStrings
(
szTemp
,
szBuildPath
);
else
strcpyW
(
szBuildPath
,
szTemp
);
if
(
FAILED
(
hr
))
goto
end
;
if
(
pszSubPath
)
{
/* make sure the new path does not exceed th bufferlength
* rememebr to backslash and the termination */
if
(
MAX_PATH
<
(
lstrlenW
(
szBuildPath
)
+
lstrlenW
(
pszSubPath
)
+
2
))
{
hr
=
HRESULT_FROM_WIN32
(
ERROR_FILENAME_EXCED_RANGE
);
goto
end
;
}
PathAppendW
(
szBuildPath
,
pszSubPath
);
PathRemoveBackslashW
(
szBuildPath
);
}
/* Copy the path if it's available before we might return */
if
(
SUCCEEDED
(
hr
)
&&
pszPath
)
strcpyW
(
pszPath
,
szBuildPath
);
if
(
FAILED
(
hr
))
goto
end
;
/* if we don't care about existing directories we are ready */
if
(
nFolder
&
CSIDL_FLAG_DONT_VERIFY
)
goto
end
;
...
...
@@ -1758,7 +1836,7 @@ HRESULT WINAPI SHGetFolderPathW(
*/
if
(
!
(
nFolder
&
CSIDL_FLAG_CREATE
))
{
hr
=
HRESULT_FROM_WIN32
(
ERROR_
FILE
_NOT_FOUND
);
hr
=
HRESULT_FROM_WIN32
(
ERROR_
PATH
_NOT_FOUND
);
goto
end
;
}
...
...
include/shlobj.h
View file @
a629a419
...
...
@@ -54,6 +54,9 @@ DWORD WINAPI SHFormatDrive(HWND,UINT,UINT,UINT);
void
WINAPI
SHFree
(
LPVOID
);
BOOL
WINAPI
GetFileNameFromBrowse
(
HWND
,
LPSTR
,
DWORD
,
LPCSTR
,
LPCSTR
,
LPCSTR
,
LPCSTR
);
HRESULT
WINAPI
SHGetInstanceExplorer
(
IUnknown
**
);
HRESULT
WINAPI
SHGetFolderPathAndSubDirA
(
HWND
,
int
,
HANDLE
,
DWORD
,
LPCSTR
,
LPSTR
);
HRESULT
WINAPI
SHGetFolderPathAndSubDirW
(
HWND
,
int
,
HANDLE
,
DWORD
,
LPCWSTR
,
LPWSTR
);
#define SHGetFolderPathAndSubDir WINELIB_NAME_AW(SHGetFolderPathAndSubDir);
BOOL
WINAPI
SHGetPathFromIDListA
(
LPCITEMIDLIST
,
LPSTR
);
BOOL
WINAPI
SHGetPathFromIDListW
(
LPCITEMIDLIST
,
LPWSTR
);
#define SHGetPathFromIDList WINELIB_NAME_AW(SHGetPathFromIDList)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment