Commit a9b3fdd3 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

shell32: Construct the proper path target for UnixFolder.

Worse than just no unix integration is that it can actually crash if you parse e.g. "/". Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent 40afa8d9
...@@ -1797,7 +1797,7 @@ static const IDropTargetVtbl dtvt = { ...@@ -1797,7 +1797,7 @@ static const IDropTargetVtbl dtvt = {
ISFDropTarget_Drop ISFDropTarget_Drop
}; };
static HRESULT create_fs( IUnknown *outer_unk, REFIID riid, void **ppv, const CLSID *clsid) static HRESULT create_fs( IUnknown *outer_unk, REFIID riid, void **ppv, const CLSID *clsid, const WCHAR *path_target)
{ {
IGenericSFImpl *sf; IGenericSFImpl *sf;
HRESULT hr; HRESULT hr;
...@@ -1820,6 +1820,16 @@ static HRESULT create_fs( IUnknown *outer_unk, REFIID riid, void **ppv, const CL ...@@ -1820,6 +1820,16 @@ static HRESULT create_fs( IUnknown *outer_unk, REFIID riid, void **ppv, const CL
sf->ISFHelper_iface.lpVtbl = &shvt; sf->ISFHelper_iface.lpVtbl = &shvt;
sf->pclsid = clsid; sf->pclsid = clsid;
sf->outer_unk = outer_unk ? outer_unk : &sf->IUnknown_inner; sf->outer_unk = outer_unk ? outer_unk : &sf->IUnknown_inner;
if (path_target)
{
SIZE_T size = (wcslen(path_target) + 1) * sizeof(WCHAR);
if (!(sf->sPathTarget = SHAlloc(size)))
{
LocalFree(sf);
return E_OUTOFMEMORY;
}
memcpy(sf->sPathTarget, path_target, size);
}
hr = IUnknown_QueryInterface(&sf->IUnknown_inner, riid, ppv); hr = IUnknown_QueryInterface(&sf->IUnknown_inner, riid, ppv);
IUnknown_Release(&sf->IUnknown_inner); IUnknown_Release(&sf->IUnknown_inner);
...@@ -1830,25 +1840,25 @@ static HRESULT create_fs( IUnknown *outer_unk, REFIID riid, void **ppv, const CL ...@@ -1830,25 +1840,25 @@ static HRESULT create_fs( IUnknown *outer_unk, REFIID riid, void **ppv, const CL
HRESULT WINAPI IFSFolder_Constructor(IUnknown *outer_unk, REFIID riid, void **ppv) HRESULT WINAPI IFSFolder_Constructor(IUnknown *outer_unk, REFIID riid, void **ppv)
{ {
return create_fs( outer_unk, riid, ppv, &CLSID_ShellFSFolder ); return create_fs( outer_unk, riid, ppv, &CLSID_ShellFSFolder, NULL );
} }
HRESULT WINAPI UnixFolder_Constructor(IUnknown *outer_unk, REFIID riid, void **ppv) HRESULT WINAPI UnixFolder_Constructor(IUnknown *outer_unk, REFIID riid, void **ppv)
{ {
return create_fs( outer_unk, riid, ppv, &CLSID_UnixFolder ); return create_fs( outer_unk, riid, ppv, &CLSID_UnixFolder, L"\\\\?\\unix\\" );
} }
HRESULT WINAPI UnixDosFolder_Constructor(IUnknown *outer_unk, REFIID riid, void **ppv) HRESULT WINAPI UnixDosFolder_Constructor(IUnknown *outer_unk, REFIID riid, void **ppv)
{ {
return create_fs( outer_unk, riid, ppv, &CLSID_UnixDosFolder ); return create_fs( outer_unk, riid, ppv, &CLSID_UnixDosFolder, NULL );
} }
HRESULT WINAPI FolderShortcut_Constructor(IUnknown *outer_unk, REFIID riid, void **ppv) HRESULT WINAPI FolderShortcut_Constructor(IUnknown *outer_unk, REFIID riid, void **ppv)
{ {
return create_fs( outer_unk, riid, ppv, &CLSID_FolderShortcut ); return create_fs( outer_unk, riid, ppv, &CLSID_FolderShortcut, NULL );
} }
HRESULT WINAPI MyDocuments_Constructor(IUnknown *outer_unk, REFIID riid, void **ppv) HRESULT WINAPI MyDocuments_Constructor(IUnknown *outer_unk, REFIID riid, void **ppv)
{ {
return create_fs( outer_unk, riid, ppv, &CLSID_MyDocuments ); return create_fs( outer_unk, riid, ppv, &CLSID_MyDocuments, NULL );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment