Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
88cf8ce5
Commit
88cf8ce5
authored
Mar 01, 2005
by
Juan Lang
Committed by
Alexandre Julliard
Mar 01, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert tabs to space, wrap long lines, make indenting consistent.
parent
01aa7137
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
544 additions
and
454 deletions
+544
-454
shfldr_fs.c
dlls/shell32/shfldr_fs.c
+544
-454
No files found.
dlls/shell32/shfldr_fs.c
View file @
88cf8ce5
/*
*
file system folder
*
file system folder
*
*
Copyright 1997
Marcus Meissner
*
Copyright 1998, 1999, 2002
Juergen Schmied
*
Copyright 1997
Marcus Meissner
*
Copyright 1998, 1999, 2002
Juergen Schmied
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -67,24 +67,24 @@ typedef struct {
IDropTargetVtbl
*
lpvtblDropTarget
;
ISFHelperVtbl
*
lpvtblSFHelper
;
IUnknown
*
pUnkOuter
;
/* used for aggregation */
IUnknown
*
pUnkOuter
;
/* used for aggregation */
CLSID
*
pclsid
;
/* both paths are parsible from the desktop */
LPSTR
sPathTarget
;
/* complete path to target used for enumeration and ChangeNotify */
LPSTR
sPathTarget
;
/* complete path to target used for enumeration and ChangeNotify */
LPITEMIDLIST
pidlRoot
;
/* absolute pidl */
LPITEMIDLIST
pidlRoot
;
/* absolute pidl */
int
dwAttributes
;
/* attributes returned by GetAttributesOf FIXME: use it */
int
dwAttributes
;
/* attributes returned by GetAttributesOf FIXME: use it */
UINT
cfShellIDList
;
/* clipboardformat for IDropTarget */
BOOL
fAcceptFmt
;
/* flag for pending Drop */
UINT
cfShellIDList
;
/* clipboardformat for IDropTarget */
BOOL
fAcceptFmt
;
/* flag for pending Drop */
}
IGenericSFImpl
;
static
struct
IUnknownVtbl
unkvt
;
static
struct
IShellFolder2Vtbl
sfvt
;
static
struct
IPersistFolder3Vtbl
vt_FSFldr_PersistFolder3
;
/* IPersistFolder3 for a FS_Folder */
static
struct
IPersistFolder3Vtbl
vt_FSFldr_PersistFolder3
;
/* IPersistFolder3 for a FS_Folder */
static
struct
IDropTargetVtbl
dtvt
;
static
struct
ISFHelperVtbl
shvt
;
...
...
@@ -106,31 +106,31 @@ static struct ISFHelperVtbl shvt;
/*
converts This to a interface pointer
*/
#define _IUnknown_(This)
(IUnknown*)&(This->lpVtbl)
#define _IShellFolder_(This)
(IShellFolder*)&(This->lpvtblShellFolder)
#define _IShellFolder2_(This)
(IShellFolder2*)&(This->lpvtblShellFolder)
#define _IPersist_(This)
(IPersist*)&(This->lpvtblPersistFolder3)
#define _IPersistFolder_(This)
(IPersistFolder*)&(This->lpvtblPersistFolder3)
#define _IPersistFolder2_(This)
(IPersistFolder2*)&(This->lpvtblPersistFolder3)
#define _IPersistFolder3_(This)
(IPersistFolder3*)&(This->lpvtblPersistFolder3)
#define _IDropTarget_(This)
(IDropTarget*)&(This->lpvtblDropTarget)
#define _ISFHelper_(This)
(ISFHelper*)&(This->lpvtblSFHelper)
#define _IUnknown_(This)
(IUnknown*)&(This->lpVtbl)
#define _IShellFolder_(This)
(IShellFolder*)&(This->lpvtblShellFolder)
#define _IShellFolder2_(This)
(IShellFolder2*)&(This->lpvtblShellFolder)
#define _IPersist_(This)
(IPersist*)&(This->lpvtblPersistFolder3)
#define _IPersistFolder_(This)
(IPersistFolder*)&(This->lpvtblPersistFolder3)
#define _IPersistFolder2_(This)
(IPersistFolder2*)&(This->lpvtblPersistFolder3)
#define _IPersistFolder3_(This)
(IPersistFolder3*)&(This->lpvtblPersistFolder3)
#define _IDropTarget_(This)
(IDropTarget*)&(This->lpvtblDropTarget)
#define _ISFHelper_(This)
(ISFHelper*)&(This->lpvtblSFHelper)
/**************************************************************************
*
registers clipboardformat once
*
registers clipboardformat once
*/
static
void
SF_RegisterClipFmt
(
IGenericSFImpl
*
This
)
{
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
This
->
cfShellIDList
)
{
This
->
cfShellIDList
=
RegisterClipboardFormatA
(
CFSTR_SHELLIDLIST
);
This
->
cfShellIDList
=
RegisterClipboardFormatA
(
CFSTR_SHELLIDLIST
);
}
}
/**************************************************************************
*
we need a separate IUnknown to handle aggregation
*
(inner IUnknown)
*
we need a separate IUnknown to handle aggregation
*
(inner IUnknown)
*/
static
HRESULT
WINAPI
IUnknown_fnQueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
...
...
@@ -141,30 +141,30 @@ static HRESULT WINAPI IUnknown_fnQueryInterface (IUnknown * iface, REFIID riid,
*
ppvObj
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
))
*
ppvObj
=
_IUnknown_
(
This
);
*
ppvObj
=
_IUnknown_
(
This
);
else
if
(
IsEqualIID
(
riid
,
&
IID_IShellFolder
))
*
ppvObj
=
_IShellFolder_
(
This
);
*
ppvObj
=
_IShellFolder_
(
This
);
else
if
(
IsEqualIID
(
riid
,
&
IID_IShellFolder2
))
*
ppvObj
=
_IShellFolder_
(
This
);
*
ppvObj
=
_IShellFolder_
(
This
);
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersist
))
*
ppvObj
=
_IPersist_
(
This
);
*
ppvObj
=
_IPersist_
(
This
);
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistFolder
))
*
ppvObj
=
_IPersistFolder_
(
This
);
*
ppvObj
=
_IPersistFolder_
(
This
);
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistFolder2
))
*
ppvObj
=
_IPersistFolder2_
(
This
);
*
ppvObj
=
_IPersistFolder2_
(
This
);
else
if
(
IsEqualIID
(
riid
,
&
IID_IPersistFolder3
))
*
ppvObj
=
_IPersistFolder3_
(
This
);
*
ppvObj
=
_IPersistFolder3_
(
This
);
else
if
(
IsEqualIID
(
riid
,
&
IID_ISFHelper
))
*
ppvObj
=
_ISFHelper_
(
This
);
*
ppvObj
=
_ISFHelper_
(
This
);
else
if
(
IsEqualIID
(
riid
,
&
IID_IDropTarget
))
{
*
ppvObj
=
_IDropTarget_
(
This
);
SF_RegisterClipFmt
(
This
);
*
ppvObj
=
_IDropTarget_
(
This
);
SF_RegisterClipFmt
(
This
);
}
if
(
*
ppvObj
)
{
IUnknown_AddRef
((
IUnknown
*
)
(
*
ppvObj
));
TRACE
(
"-- Interface = %p
\n
"
,
*
ppvObj
);
return
S_OK
;
IUnknown_AddRef
((
IUnknown
*
)
(
*
ppvObj
));
TRACE
(
"-- Interface = %p
\n
"
,
*
ppvObj
);
return
S_OK
;
}
TRACE
(
"-- Interface: E_NOINTERFACE
\n
"
);
return
E_NOINTERFACE
;
...
...
@@ -188,13 +188,13 @@ static ULONG WINAPI IUnknown_fnRelease (IUnknown * iface)
TRACE
(
"(%p)->(count=%lu)
\n
"
,
This
,
refCount
+
1
);
if
(
!
refCount
)
{
TRACE
(
"-- destroying IShellFolder(%p)
\n
"
,
This
);
TRACE
(
"-- destroying IShellFolder(%p)
\n
"
,
This
);
if
(
This
->
pidlRoot
)
SHFree
(
This
->
pidlRoot
);
if
(
This
->
sPathTarget
)
SHFree
(
This
->
sPathTarget
);
LocalFree
((
HLOCAL
)
This
);
if
(
This
->
pidlRoot
)
SHFree
(
This
->
pidlRoot
);
if
(
This
->
sPathTarget
)
SHFree
(
This
->
sPathTarget
);
LocalFree
((
HLOCAL
)
This
);
}
return
refCount
;
}
...
...
@@ -217,24 +217,25 @@ static shvheader GenericSFHeader[] = {
#define GENERICSHELLVIEWCOLUMNS 5
/**************************************************************************
*
IFSFolder_Constructor
*
IFSFolder_Constructor
*
* NOTES
* creating undocumented ShellFS_Folder as part of an aggregation
* {F3364BA0-65B9-11CE-A9BA-00AA004AE837}
*
*/
HRESULT
WINAPI
IFSFolder_Constructor
(
IUnknown
*
pUnkOuter
,
REFIID
riid
,
LPVOID
*
ppv
)
HRESULT
WINAPI
IFSFolder_Constructor
(
IUnknown
*
pUnkOuter
,
REFIID
riid
,
LPVOID
*
ppv
)
{
IGenericSFImpl
*
sf
;
TRACE
(
"unkOut=%p %s
\n
"
,
pUnkOuter
,
shdebugstr_guid
(
riid
));
if
(
pUnkOuter
&&
!
IsEqualIID
(
riid
,
&
IID_IUnknown
))
return
CLASS_E_NOAGGREGATION
;
return
CLASS_E_NOAGGREGATION
;
sf
=
(
IGenericSFImpl
*
)
LocalAlloc
(
GMEM_ZEROINIT
,
sizeof
(
IGenericSFImpl
));
if
(
!
sf
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
sf
->
ref
=
0
;
sf
->
lpVtbl
=
&
unkvt
;
...
...
@@ -246,8 +247,8 @@ HRESULT WINAPI IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID
sf
->
pUnkOuter
=
pUnkOuter
?
pUnkOuter
:
_IUnknown_
(
sf
);
if
(
!
SUCCEEDED
(
IUnknown_QueryInterface
(
_IUnknown_
(
sf
),
riid
,
ppv
)))
{
IUnknown_Release
(
_IUnknown_
(
sf
));
return
E_NOINTERFACE
;
IUnknown_Release
(
_IUnknown_
(
sf
));
return
E_NOINTERFACE
;
}
TRACE
(
"--%p
\n
"
,
*
ppv
);
...
...
@@ -258,14 +259,16 @@ HRESULT WINAPI IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID
* IShellFolder_fnQueryInterface
*
* PARAMETERS
* REFIID riid
[in ] Requested InterfaceID
* LPVOID* ppvObject
[out] Interface* to hold the result
* REFIID riid
[in ] Requested InterfaceID
* LPVOID* ppvObject
[out] Interface* to hold the result
*/
static
HRESULT
WINAPI
IShellFolder_fnQueryInterface
(
IShellFolder2
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
static
HRESULT
WINAPI
IShellFolder_fnQueryInterface
(
IShellFolder2
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
TRACE
(
"(%p)->(%s,%p)
\n
"
,
This
,
shdebugstr_guid
(
riid
),
ppvObj
);
TRACE
(
"(%p)->(%s,%p)
\n
"
,
This
,
shdebugstr_guid
(
riid
),
ppvObj
);
return
IUnknown_QueryInterface
(
This
->
pUnkOuter
,
riid
,
ppvObj
);
}
...
...
@@ -357,8 +360,8 @@ LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path)
* subfolder to evaluate the remaining parts.
* Now we can parse into namespaces implemented by shell extensions
*
* Behaviour on win98:
lpszDisplayName=NULL -> crash
*
lpszDisplayName="" -> returns mycoputer-pidl
* Behaviour on win98:
lpszDisplayName=NULL -> crash
*
lpszDisplayName="" -> returns mycoputer-pidl
*
* FIXME
* pdwAttributes is not set
...
...
@@ -366,10 +369,11 @@ LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path)
*/
static
HRESULT
WINAPI
IShellFolder_fnParseDisplayName
(
IShellFolder2
*
iface
,
HWND
hwndOwner
,
LPBC
pbc
,
LPOLESTR
lpszDisplayName
,
DWORD
*
pchEaten
,
LPITEMIDLIST
*
ppidl
,
DWORD
*
pdwAttributes
)
HWND
hwndOwner
,
LPBC
pbc
,
LPOLESTR
lpszDisplayName
,
DWORD
*
pchEaten
,
LPITEMIDLIST
*
ppidl
,
DWORD
*
pdwAttributes
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
...
...
@@ -381,47 +385,50 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
DWORD
len
;
TRACE
(
"(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)
\n
"
,
This
,
hwndOwner
,
pbc
,
lpszDisplayName
,
debugstr_w
(
lpszDisplayName
),
pchEaten
,
ppidl
,
pdwAttributes
);
This
,
hwndOwner
,
pbc
,
lpszDisplayName
,
debugstr_w
(
lpszDisplayName
),
pchEaten
,
ppidl
,
pdwAttributes
);
if
(
!
lpszDisplayName
||
!
ppidl
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
if
(
pchEaten
)
*
pchEaten
=
0
;
/* strange but like the original */
*
pchEaten
=
0
;
/* strange but like the original */
pidlTemp
=
SHELL32_CreatePidlFromBindCtx
(
pbc
,
lpszDisplayName
);
if
(
!
pidlTemp
&&
*
lpszDisplayName
)
{
/* get the next element */
szNext
=
GetNextElementW
(
lpszDisplayName
,
szElement
,
MAX_PATH
);
/* get the next element */
szNext
=
GetNextElementW
(
lpszDisplayName
,
szElement
,
MAX_PATH
);
/* build the full pathname to the element */
/* build the full pathname to the element */
/* lstrcpyW(szPath, This->sPathTarget); */
MultiByteToWideChar
(
CP_ACP
,
0
,
This
->
sPathTarget
,
-
1
,
szPath
,
MAX_PATH
);
PathAddBackslashW
(
szPath
);
len
=
lstrlenW
(
szPath
);
lstrcpynW
(
szPath
+
len
,
szElement
,
MAX_PATH
-
len
);
/* get the pidl */
hr
=
_ILCreateFromPathW
(
szPath
,
&
pidlTemp
);
if
(
SUCCEEDED
(
hr
))
{
if
(
szNext
&&
*
szNext
)
{
/* try to analyse the next element */
hr
=
SHELL32_ParseNextElement
(
iface
,
hwndOwner
,
pbc
,
&
pidlTemp
,
(
LPOLESTR
)
szNext
,
pchEaten
,
pdwAttributes
);
}
else
{
/* it's the last element */
if
(
pdwAttributes
&&
*
pdwAttributes
)
{
hr
=
SHELL32_GetItemAttributes
(
_IShellFolder_
(
This
),
pidlTemp
,
pdwAttributes
);
}
}
}
/* get the pidl */
hr
=
_ILCreateFromPathW
(
szPath
,
&
pidlTemp
);
if
(
SUCCEEDED
(
hr
))
{
if
(
szNext
&&
*
szNext
)
{
/* try to analyse the next element */
hr
=
SHELL32_ParseNextElement
(
iface
,
hwndOwner
,
pbc
,
&
pidlTemp
,
(
LPOLESTR
)
szNext
,
pchEaten
,
pdwAttributes
);
}
else
{
/* it's the last element */
if
(
pdwAttributes
&&
*
pdwAttributes
)
{
hr
=
SHELL32_GetItemAttributes
(
_IShellFolder_
(
This
),
pidlTemp
,
pdwAttributes
);
}
}
}
}
if
(
SUCCEEDED
(
hr
))
*
ppidl
=
pidlTemp
;
*
ppidl
=
pidlTemp
;
else
*
ppidl
=
NULL
;
*
ppidl
=
NULL
;
TRACE
(
"(%p)->(-- pidl=%p ret=0x%08lx)
\n
"
,
This
,
ppidl
?
*
ppidl
:
0
,
hr
);
...
...
@@ -429,18 +436,20 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
}
/**************************************************************************
*
IShellFolder_fnEnumObjects
*
IShellFolder_fnEnumObjects
* PARAMETERS
* HWND hwndOwner, //[in ] Parent Window
* DWORD grfFlags, //[in ] SHCONTF enumeration mask
* LPENUMIDLIST* ppenumIDList //[out] IEnumIDList interface
*/
static
HRESULT
WINAPI
IShellFolder_fnEnumObjects
(
IShellFolder2
*
iface
,
HWND
hwndOwner
,
DWORD
dwFlags
,
LPENUMIDLIST
*
ppEnumIDList
)
IShellFolder_fnEnumObjects
(
IShellFolder2
*
iface
,
HWND
hwndOwner
,
DWORD
dwFlags
,
LPENUMIDLIST
*
ppEnumIDList
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
TRACE
(
"(%p)->(HWND=%p flags=0x%08lx pplist=%p)
\n
"
,
This
,
hwndOwner
,
dwFlags
,
ppEnumIDList
);
TRACE
(
"(%p)->(HWND=%p flags=0x%08lx pplist=%p)
\n
"
,
This
,
hwndOwner
,
dwFlags
,
ppEnumIDList
);
*
ppEnumIDList
=
IEnumIDList_Constructor
();
if
(
*
ppEnumIDList
)
...
...
@@ -456,7 +465,7 @@ IShellFolder_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags
}
/**************************************************************************
*
IShellFolder_fnBindToObject
*
IShellFolder_fnBindToObject
* PARAMETERS
* LPCITEMIDLIST pidl, //[in ] relative pidl to open
* LPBC pbc, //[in ] optional FileSystemBindData context
...
...
@@ -464,13 +473,16 @@ IShellFolder_fnEnumObjects (IShellFolder2 * iface, HWND hwndOwner, DWORD dwFlags
* LPVOID* ppvObject //[out] Interface*
*/
static
HRESULT
WINAPI
IShellFolder_fnBindToObject
(
IShellFolder2
*
iface
,
LPCITEMIDLIST
pidl
,
LPBC
pbc
,
REFIID
riid
,
LPVOID
*
ppvOut
)
IShellFolder_fnBindToObject
(
IShellFolder2
*
iface
,
LPCITEMIDLIST
pidl
,
LPBC
pbc
,
REFIID
riid
,
LPVOID
*
ppvOut
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
TRACE
(
"(%p)->(pidl=%p,%p,%s,%p)
\n
"
,
This
,
pidl
,
pbc
,
shdebugstr_guid
(
riid
),
ppvOut
);
TRACE
(
"(%p)->(pidl=%p,%p,%s,%p)
\n
"
,
This
,
pidl
,
pbc
,
shdebugstr_guid
(
riid
),
ppvOut
);
return
SHELL32_BindToChild
(
This
->
pidlRoot
,
This
->
sPathTarget
,
pidl
,
riid
,
ppvOut
);
return
SHELL32_BindToChild
(
This
->
pidlRoot
,
This
->
sPathTarget
,
pidl
,
riid
,
ppvOut
);
}
/**************************************************************************
...
...
@@ -482,11 +494,13 @@ IShellFolder_fnBindToObject (IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pbc
* LPVOID* ppvObject //[out] Interface* returned
*/
static
HRESULT
WINAPI
IShellFolder_fnBindToStorage
(
IShellFolder2
*
iface
,
LPCITEMIDLIST
pidl
,
LPBC
pbcReserved
,
REFIID
riid
,
LPVOID
*
ppvOut
)
IShellFolder_fnBindToStorage
(
IShellFolder2
*
iface
,
LPCITEMIDLIST
pidl
,
LPBC
pbcReserved
,
REFIID
riid
,
LPVOID
*
ppvOut
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
FIXME
(
"(%p)->(pidl=%p,%p,%s,%p) stub
\n
"
,
This
,
pidl
,
pbcReserved
,
shdebugstr_guid
(
riid
),
ppvOut
);
FIXME
(
"(%p)->(pidl=%p,%p,%s,%p) stub
\n
"
,
This
,
pidl
,
pbcReserved
,
shdebugstr_guid
(
riid
),
ppvOut
);
*
ppvOut
=
NULL
;
return
E_NOTIMPL
;
...
...
@@ -497,7 +511,8 @@ IShellFolder_fnBindToStorage (IShellFolder2 * iface, LPCITEMIDLIST pidl, LPBC pb
*/
static
HRESULT
WINAPI
IShellFolder_fnCompareIDs
(
IShellFolder2
*
iface
,
LPARAM
lParam
,
LPCITEMIDLIST
pidl1
,
LPCITEMIDLIST
pidl2
)
IShellFolder_fnCompareIDs
(
IShellFolder2
*
iface
,
LPARAM
lParam
,
LPCITEMIDLIST
pidl1
,
LPCITEMIDLIST
pidl2
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
...
...
@@ -510,33 +525,35 @@ IShellFolder_fnCompareIDs (IShellFolder2 * iface, LPARAM lParam, LPCITEMIDLIST p
}
/**************************************************************************
*
IShellFolder_fnCreateViewObject
*
IShellFolder_fnCreateViewObject
*/
static
HRESULT
WINAPI
IShellFolder_fnCreateViewObject
(
IShellFolder2
*
iface
,
HWND
hwndOwner
,
REFIID
riid
,
LPVOID
*
ppvOut
)
IShellFolder_fnCreateViewObject
(
IShellFolder2
*
iface
,
HWND
hwndOwner
,
REFIID
riid
,
LPVOID
*
ppvOut
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
LPSHELLVIEW
pShellView
;
HRESULT
hr
=
E_INVALIDARG
;
TRACE
(
"(%p)->(hwnd=%p,%s,%p)
\n
"
,
This
,
hwndOwner
,
shdebugstr_guid
(
riid
),
ppvOut
);
TRACE
(
"(%p)->(hwnd=%p,%s,%p)
\n
"
,
This
,
hwndOwner
,
shdebugstr_guid
(
riid
),
ppvOut
);
if
(
ppvOut
)
{
*
ppvOut
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IDropTarget
))
{
hr
=
IShellFolder_QueryInterface
(
iface
,
&
IID_IDropTarget
,
ppvOut
);
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IContextMenu
))
{
FIXME
(
"IContextMenu not implemented
\n
"
);
hr
=
E_NOTIMPL
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IShellView
))
{
pShellView
=
IShellView_Constructor
((
IShellFolder
*
)
iface
);
if
(
pShellView
)
{
hr
=
IShellView_QueryInterface
(
pShellView
,
riid
,
ppvOut
);
IShellView_Release
(
pShellView
);
}
}
*
ppvOut
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IDropTarget
))
{
hr
=
IShellFolder_QueryInterface
(
iface
,
&
IID_IDropTarget
,
ppvOut
);
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IContextMenu
))
{
FIXME
(
"IContextMenu not implemented
\n
"
);
hr
=
E_NOTIMPL
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IShellView
))
{
pShellView
=
IShellView_Constructor
((
IShellFolder
*
)
iface
);
if
(
pShellView
)
{
hr
=
IShellView_QueryInterface
(
pShellView
,
riid
,
ppvOut
);
IShellView_Release
(
pShellView
);
}
}
}
TRACE
(
"-- (%p)->(interface=%p)
\n
"
,
This
,
ppvOut
);
return
hr
;
...
...
@@ -552,25 +569,27 @@ IShellFolder_fnCreateViewObject (IShellFolder2 * iface, HWND hwndOwner, REFIID r
*
*/
static
HRESULT
WINAPI
IShellFolder_fnGetAttributesOf
(
IShellFolder2
*
iface
,
UINT
cidl
,
LPCITEMIDLIST
*
apidl
,
DWORD
*
rgfInOut
)
IShellFolder_fnGetAttributesOf
(
IShellFolder2
*
iface
,
UINT
cidl
,
LPCITEMIDLIST
*
apidl
,
DWORD
*
rgfInOut
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
HRESULT
hr
=
S_OK
;
TRACE
(
"(%p)->(cidl=%d apidl=%p mask=0x%08lx)
\n
"
,
This
,
cidl
,
apidl
,
*
rgfInOut
);
TRACE
(
"(%p)->(cidl=%d apidl=%p mask=0x%08lx)
\n
"
,
This
,
cidl
,
apidl
,
*
rgfInOut
);
if
((
!
cidl
)
||
(
!
apidl
)
||
(
!
rgfInOut
))
return
E_INVALIDARG
;
return
E_INVALIDARG
;
if
(
*
rgfInOut
==
0
)
*
rgfInOut
=
~
0
;
*
rgfInOut
=
~
0
;
while
(
cidl
>
0
&&
*
apidl
)
{
pdump
(
*
apidl
);
SHELL32_GetItemAttributes
(
_IShellFolder_
(
This
),
*
apidl
,
rgfInOut
);
apidl
++
;
cidl
--
;
pdump
(
*
apidl
);
SHELL32_GetItemAttributes
(
_IShellFolder_
(
This
),
*
apidl
,
rgfInOut
);
apidl
++
;
cidl
--
;
}
TRACE
(
"-- result=0x%08lx
\n
"
,
*
rgfInOut
);
...
...
@@ -590,19 +609,22 @@ IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl, LPCITEMIDLIST
* LPVOID* ppvObject) //[out] Resulting Interface
*
* NOTES
* This function gets asked to return "view objects" for one or more (multiple select)
* items:
* The viewobject typically is an COM object with one of the following interfaces:
* This function gets asked to return "view objects" for one or more (multiple
* select) items:
* The viewobject typically is an COM object with one of the following
* interfaces:
* IExtractIcon,IDataObject,IContextMenu
* In order to support icon positions in the default Listview your DataObject
* must implement the SetData method (in addition to GetData :) - the shell passes
* a barely documented "Icon positions" structure to SetData when the drag starts,
* and GetData's it if the drop is in another explorer window that needs the positions.
* must implement the SetData method (in addition to GetData :) - the shell
* passes a barely documented "Icon positions" structure to SetData when the
* drag starts, and GetData's it if the drop is in another explorer window that
* needs the positions.
*/
static
HRESULT
WINAPI
IShellFolder_fnGetUIObjectOf
(
IShellFolder2
*
iface
,
HWND
hwndOwner
,
UINT
cidl
,
LPCITEMIDLIST
*
apidl
,
REFIID
riid
,
UINT
*
prgfInOut
,
LPVOID
*
ppvOut
)
HWND
hwndOwner
,
UINT
cidl
,
LPCITEMIDLIST
*
apidl
,
REFIID
riid
,
UINT
*
prgfInOut
,
LPVOID
*
ppvOut
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
...
...
@@ -611,42 +633,45 @@ IShellFolder_fnGetUIObjectOf (IShellFolder2 * iface,
HRESULT
hr
=
E_INVALIDARG
;
TRACE
(
"(%p)->(%p,%u,apidl=%p,%s,%p,%p)
\n
"
,
This
,
hwndOwner
,
cidl
,
apidl
,
shdebugstr_guid
(
riid
),
prgfInOut
,
ppvOut
);
This
,
hwndOwner
,
cidl
,
apidl
,
shdebugstr_guid
(
riid
),
prgfInOut
,
ppvOut
);
if
(
ppvOut
)
{
*
ppvOut
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IContextMenu
)
&&
(
cidl
>=
1
))
{
pObj
=
(
LPUNKNOWN
)
ISvItemCm_Constructor
((
IShellFolder
*
)
iface
,
This
->
pidlRoot
,
apidl
,
cidl
);
hr
=
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDataObject
)
&&
(
cidl
>=
1
))
{
pObj
=
(
LPUNKNOWN
)
IDataObject_Constructor
(
hwndOwner
,
This
->
pidlRoot
,
apidl
,
cidl
);
hr
=
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IExtractIconA
)
&&
(
cidl
==
1
))
{
pidl
=
ILCombine
(
This
->
pidlRoot
,
apidl
[
0
]);
pObj
=
(
LPUNKNOWN
)
IExtractIconA_Constructor
(
pidl
);
SHFree
(
pidl
);
hr
=
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IExtractIconW
)
&&
(
cidl
==
1
))
{
pidl
=
ILCombine
(
This
->
pidlRoot
,
apidl
[
0
]);
pObj
=
(
LPUNKNOWN
)
IExtractIconW_Constructor
(
pidl
);
SHFree
(
pidl
);
hr
=
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDropTarget
)
&&
(
cidl
>=
1
))
{
hr
=
IShellFolder_QueryInterface
(
iface
,
&
IID_IDropTarget
,
(
LPVOID
*
)
&
pObj
);
}
else
if
((
IsEqualIID
(
riid
,
&
IID_IShellLinkW
)
||
IsEqualIID
(
riid
,
&
IID_IShellLinkA
))
&&
(
cidl
==
1
))
{
pidl
=
ILCombine
(
This
->
pidlRoot
,
apidl
[
0
]);
hr
=
IShellLink_ConstructFromFile
(
NULL
,
riid
,
pidl
,
(
LPVOID
*
)
&
pObj
);
SHFree
(
pidl
);
}
else
{
hr
=
E_NOINTERFACE
;
}
if
(
SUCCEEDED
(
hr
)
&&
!
pObj
)
hr
=
E_OUTOFMEMORY
;
*
ppvOut
=
pObj
;
*
ppvOut
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IContextMenu
)
&&
(
cidl
>=
1
))
{
pObj
=
(
LPUNKNOWN
)
ISvItemCm_Constructor
((
IShellFolder
*
)
iface
,
This
->
pidlRoot
,
apidl
,
cidl
);
hr
=
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDataObject
)
&&
(
cidl
>=
1
))
{
pObj
=
(
LPUNKNOWN
)
IDataObject_Constructor
(
hwndOwner
,
This
->
pidlRoot
,
apidl
,
cidl
);
hr
=
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IExtractIconA
)
&&
(
cidl
==
1
))
{
pidl
=
ILCombine
(
This
->
pidlRoot
,
apidl
[
0
]);
pObj
=
(
LPUNKNOWN
)
IExtractIconA_Constructor
(
pidl
);
SHFree
(
pidl
);
hr
=
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IExtractIconW
)
&&
(
cidl
==
1
))
{
pidl
=
ILCombine
(
This
->
pidlRoot
,
apidl
[
0
]);
pObj
=
(
LPUNKNOWN
)
IExtractIconW_Constructor
(
pidl
);
SHFree
(
pidl
);
hr
=
S_OK
;
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IDropTarget
)
&&
(
cidl
>=
1
))
{
hr
=
IShellFolder_QueryInterface
(
iface
,
&
IID_IDropTarget
,
(
LPVOID
*
)
&
pObj
);
}
else
if
((
IsEqualIID
(
riid
,
&
IID_IShellLinkW
)
||
IsEqualIID
(
riid
,
&
IID_IShellLinkA
))
&&
(
cidl
==
1
))
{
pidl
=
ILCombine
(
This
->
pidlRoot
,
apidl
[
0
]);
hr
=
IShellLink_ConstructFromFile
(
NULL
,
riid
,
pidl
,
(
LPVOID
*
)
&
pObj
);
SHFree
(
pidl
);
}
else
{
hr
=
E_NOINTERFACE
;
}
if
(
SUCCEEDED
(
hr
)
&&
!
pObj
)
hr
=
E_OUTOFMEMORY
;
*
ppvOut
=
pObj
;
}
TRACE
(
"(%p)->hr=0x%08lx
\n
"
,
This
,
hr
);
return
hr
;
...
...
@@ -656,41 +681,44 @@ void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags)
{
/*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */
if
(
!
(
dwFlags
&
SHGDN_FORPARSING
)
&&
((
dwFlags
&
SHGDN_INFOLDER
)
||
(
dwFlags
==
SHGDN_NORMAL
)))
{
HKEY
hKey
;
DWORD
dwData
;
DWORD
dwDataSize
=
sizeof
(
DWORD
);
BOOL
doHide
=
FALSE
;
/* The default value is FALSE (win98 at least) */
if
(
!
RegCreateKeyExA
(
HKEY_CURRENT_USER
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Explorer
\\
Advanced"
,
0
,
0
,
0
,
KEY_ALL_ACCESS
,
0
,
&
hKey
,
0
))
{
if
(
!
RegQueryValueExA
(
hKey
,
"HideFileExt"
,
0
,
0
,
(
LPBYTE
)
&
dwData
,
&
dwDataSize
))
doHide
=
dwData
;
RegCloseKey
(
hKey
);
}
if
(
!
doHide
)
{
LPSTR
ext
=
PathFindExtensionA
(
szPath
);
if
(
ext
)
{
HKEY
hkey
;
char
classname
[
MAX_PATH
];
LONG
classlen
=
MAX_PATH
;
if
(
!
RegQueryValueA
(
HKEY_CLASSES_ROOT
,
ext
,
classname
,
&
classlen
))
if
(
!
RegOpenKeyA
(
HKEY_CLASSES_ROOT
,
classname
,
&
hkey
))
{
if
(
!
RegQueryValueExA
(
hkey
,
"NeverShowExt"
,
0
,
NULL
,
NULL
,
NULL
))
doHide
=
TRUE
;
RegCloseKey
(
hkey
);
}
}
}
if
(
doHide
&&
szPath
[
0
]
!=
'.'
)
PathRemoveExtensionA
(
szPath
);
((
dwFlags
&
SHGDN_INFOLDER
)
||
(
dwFlags
==
SHGDN_NORMAL
)))
{
HKEY
hKey
;
DWORD
dwData
;
DWORD
dwDataSize
=
sizeof
(
DWORD
);
BOOL
doHide
=
FALSE
;
/* The default value is FALSE (win98 at least) */
if
(
!
RegCreateKeyExA
(
HKEY_CURRENT_USER
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Explorer
\\
Advanced"
,
0
,
0
,
0
,
KEY_ALL_ACCESS
,
0
,
&
hKey
,
0
))
{
if
(
!
RegQueryValueExA
(
hKey
,
"HideFileExt"
,
0
,
0
,
(
LPBYTE
)
&
dwData
,
&
dwDataSize
))
doHide
=
dwData
;
RegCloseKey
(
hKey
);
}
if
(
!
doHide
)
{
LPSTR
ext
=
PathFindExtensionA
(
szPath
);
if
(
ext
)
{
HKEY
hkey
;
char
classname
[
MAX_PATH
];
LONG
classlen
=
MAX_PATH
;
if
(
!
RegQueryValueA
(
HKEY_CLASSES_ROOT
,
ext
,
classname
,
&
classlen
))
if
(
!
RegOpenKeyA
(
HKEY_CLASSES_ROOT
,
classname
,
&
hkey
))
{
if
(
!
RegQueryValueExA
(
hkey
,
"NeverShowExt"
,
0
,
NULL
,
NULL
,
NULL
))
doHide
=
TRUE
;
RegCloseKey
(
hkey
);
}
}
}
if
(
doHide
&&
szPath
[
0
]
!=
'.'
)
PathRemoveExtensionA
(
szPath
);
}
}
...
...
@@ -708,7 +736,8 @@ void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags)
*/
static
HRESULT
WINAPI
IShellFolder_fnGetDisplayNameOf
(
IShellFolder2
*
iface
,
LPCITEMIDLIST
pidl
,
DWORD
dwFlags
,
LPSTRRET
strRet
)
IShellFolder_fnGetDisplayNameOf
(
IShellFolder2
*
iface
,
LPCITEMIDLIST
pidl
,
DWORD
dwFlags
,
LPSTRRET
strRet
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
...
...
@@ -722,36 +751,40 @@ IShellFolder_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, DWOR
pdump
(
pidl
);
if
(
!
pidl
||
!
strRet
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
bSimplePidl
=
_ILIsPidlSimple
(
pidl
);
/* take names of special folders only if its only this folder */
if
(
_ILIsSpecialFolder
(
pidl
))
{
if
(
bSimplePidl
)
{
_ILSimpleGetText
(
pidl
,
szPath
,
MAX_PATH
);
/* append my own path */
}
else
{
FIXME
(
"special pidl
\n
"
);
}
if
(
bSimplePidl
)
{
_ILSimpleGetText
(
pidl
,
szPath
,
MAX_PATH
);
/* append my own path */
}
else
{
FIXME
(
"special pidl
\n
"
);
}
}
else
{
if
(
!
(
dwFlags
&
SHGDN_INFOLDER
)
&&
(
dwFlags
&
SHGDN_FORPARSING
)
&&
This
->
sPathTarget
)
{
lstrcpyA
(
szPath
,
This
->
sPathTarget
);
/* get path to root */
PathAddBackslashA
(
szPath
);
len
=
lstrlenA
(
szPath
);
}
_ILSimpleGetText
(
pidl
,
szPath
+
len
,
MAX_PATH
-
len
);
/* append my own path */
if
(
!
_ILIsFolder
(
pidl
))
SHELL_FS_ProcessDisplayFilename
(
szPath
,
dwFlags
);
if
(
!
(
dwFlags
&
SHGDN_INFOLDER
)
&&
(
dwFlags
&
SHGDN_FORPARSING
)
&&
This
->
sPathTarget
)
{
/* get path to root */
lstrcpyA
(
szPath
,
This
->
sPathTarget
);
PathAddBackslashA
(
szPath
);
len
=
lstrlenA
(
szPath
);
}
/* append my own path */
_ILSimpleGetText
(
pidl
,
szPath
+
len
,
MAX_PATH
-
len
);
if
(
!
_ILIsFolder
(
pidl
))
SHELL_FS_ProcessDisplayFilename
(
szPath
,
dwFlags
);
}
if
((
dwFlags
&
SHGDN_FORPARSING
)
&&
!
bSimplePidl
)
{
/* go deeper if needed */
PathAddBackslashA
(
szPath
);
len
=
lstrlenA
(
szPath
);
/* go deeper if needed */
if
((
dwFlags
&
SHGDN_FORPARSING
)
&&
!
bSimplePidl
)
{
PathAddBackslashA
(
szPath
);
len
=
lstrlenA
(
szPath
);
if
(
!
SUCCEEDED
(
SHELL32_GetDisplayNameOfChild
(
iface
,
pidl
,
dwFlags
|
SHGDN_INFOLDER
,
szPath
+
len
,
MAX_PATH
-
len
)))
return
E_OUTOFMEMORY
;
if
(
!
SUCCEEDED
(
SHELL32_GetDisplayNameOfChild
(
iface
,
pidl
,
dwFlags
|
SHGDN_INFOLDER
,
szPath
+
len
,
MAX_PATH
-
len
)))
return
E_OUTOFMEMORY
;
}
strRet
->
uType
=
STRRET_CSTR
;
lstrcpynA
(
strRet
->
u
.
cStr
,
szPath
,
MAX_PATH
);
...
...
@@ -772,8 +805,12 @@ IShellFolder_fnGetDisplayNameOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, DWOR
* DWORD dwFlags, //[in ] SHGNO formatting flags
* LPITEMIDLIST* ppidlOut) //[out] simple pidl returned
*/
static
HRESULT
WINAPI
IShellFolder_fnSetNameOf
(
IShellFolder2
*
iface
,
HWND
hwndOwner
,
LPCITEMIDLIST
pidl
,
/*simple pidl */
LPCOLESTR
lpName
,
DWORD
dwFlags
,
LPITEMIDLIST
*
pPidlOut
)
static
HRESULT
WINAPI
IShellFolder_fnSetNameOf
(
IShellFolder2
*
iface
,
HWND
hwndOwner
,
LPCITEMIDLIST
pidl
,
LPCOLESTR
lpName
,
DWORD
dwFlags
,
LPITEMIDLIST
*
pPidlOut
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
char
szSrc
[
MAX_PATH
],
...
...
@@ -781,89 +818,103 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, HWND hwnd
int
len
;
BOOL
bIsFolder
=
_ILIsFolder
(
ILFindLastID
(
pidl
));
TRACE
(
"(%p)->(%p,pidl=%p,%s,%lu,%p)
\n
"
,
This
,
hwndOwner
,
pidl
,
debugstr_w
(
lpName
),
dwFlags
,
pPidlOut
);
TRACE
(
"(%p)->(%p,pidl=%p,%s,%lu,%p)
\n
"
,
This
,
hwndOwner
,
pidl
,
debugstr_w
(
lpName
),
dwFlags
,
pPidlOut
);
/* build source path */
if
(
dwFlags
&
SHGDN_INFOLDER
)
{
strcpy
(
szSrc
,
This
->
sPathTarget
);
PathAddBackslashA
(
szSrc
);
len
=
strlen
(
szSrc
);
_ILSimpleGetText
(
pidl
,
szSrc
+
len
,
MAX_PATH
-
len
);
strcpy
(
szSrc
,
This
->
sPathTarget
);
PathAddBackslashA
(
szSrc
);
len
=
strlen
(
szSrc
);
_ILSimpleGetText
(
pidl
,
szSrc
+
len
,
MAX_PATH
-
len
);
}
else
{
/* FIXME: Can this work with a simple PIDL? */
SHGetPathFromIDListA
(
pidl
,
szSrc
);
/* FIXME: Can this work with a simple PIDL? */
SHGetPathFromIDListA
(
pidl
,
szSrc
);
}
/* build destination path */
strcpy
(
szDest
,
This
->
sPathTarget
);
PathAddBackslashA
(
szDest
);
len
=
strlen
(
szDest
);
WideCharToMultiByte
(
CP_ACP
,
0
,
lpName
,
-
1
,
szDest
+
len
,
MAX_PATH
-
len
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
lpName
,
-
1
,
szDest
+
len
,
MAX_PATH
-
len
,
NULL
,
NULL
);
szDest
[
MAX_PATH
-
1
]
=
0
;
TRACE
(
"src=%s dest=%s
\n
"
,
szSrc
,
szDest
);
if
(
MoveFileA
(
szSrc
,
szDest
))
{
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
if
(
pPidlOut
)
hr
=
_ILCreateFromPathA
(
szDest
,
pPidlOut
);
if
(
pPidlOut
)
hr
=
_ILCreateFromPathA
(
szDest
,
pPidlOut
);
SHChangeNotify
(
bIsFolder
?
SHCNE_RENAMEFOLDER
:
SHCNE_RENAMEITEM
,
SHCNF_PATHA
,
szSrc
,
szDest
);
SHChangeNotify
(
bIsFolder
?
SHCNE_RENAMEFOLDER
:
SHCNE_RENAMEITEM
,
SHCNF_PATHA
,
szSrc
,
szDest
);
return
hr
;
return
hr
;
}
return
E_FAIL
;
}
static
HRESULT
WINAPI
IShellFolder_fnGetDefaultSearchGUID
(
IShellFolder2
*
iface
,
GUID
*
pguid
)
static
HRESULT
WINAPI
IShellFolder_fnGetDefaultSearchGUID
(
IShellFolder2
*
iface
,
GUID
*
pguid
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
FIXME
(
"(%p)
\n
"
,
This
);
FIXME
(
"(%p)
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
IShellFolder_fnEnumSearches
(
IShellFolder2
*
iface
,
IEnumExtraSearch
**
ppenum
)
static
HRESULT
WINAPI
IShellFolder_fnEnumSearches
(
IShellFolder2
*
iface
,
IEnumExtraSearch
**
ppenum
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
FIXME
(
"(%p)
\n
"
,
This
);
FIXME
(
"(%p)
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
IShellFolder_fnGetDefaultColumn
(
IShellFolder2
*
iface
,
DWORD
dwRes
,
ULONG
*
pSort
,
ULONG
*
pDisplay
)
IShellFolder_fnGetDefaultColumn
(
IShellFolder2
*
iface
,
DWORD
dwRes
,
ULONG
*
pSort
,
ULONG
*
pDisplay
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
TRACE
(
"(%p)
\n
"
,
This
);
TRACE
(
"(%p)
\n
"
,
This
);
if
(
pSort
)
*
pSort
=
0
;
*
pSort
=
0
;
if
(
pDisplay
)
*
pDisplay
=
0
;
*
pDisplay
=
0
;
return
S_OK
;
}
static
HRESULT
WINAPI
IShellFolder_fnGetDefaultColumnState
(
IShellFolder2
*
iface
,
UINT
iColumn
,
DWORD
*
pcsFlags
)
static
HRESULT
WINAPI
IShellFolder_fnGetDefaultColumnState
(
IShellFolder2
*
iface
,
UINT
iColumn
,
DWORD
*
pcsFlags
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
TRACE
(
"(%p)
\n
"
,
This
);
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
pcsFlags
||
iColumn
>=
GENERICSHELLVIEWCOLUMNS
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
*
pcsFlags
=
GenericSFHeader
[
iColumn
].
pcsFlags
;
return
S_OK
;
}
static
HRESULT
WINAPI
IShellFolder_fnGetDetailsEx
(
IShellFolder2
*
iface
,
LPCITEMIDLIST
pidl
,
const
SHCOLUMNID
*
pscid
,
VARIANT
*
pv
)
IShellFolder_fnGetDetailsEx
(
IShellFolder2
*
iface
,
LPCITEMIDLIST
pidl
,
const
SHCOLUMNID
*
pscid
,
VARIANT
*
pv
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
FIXME
(
"(%p)
\n
"
,
This
);
FIXME
(
"(%p)
\n
"
,
This
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
IShellFolder_fnGetDetailsOf
(
IShellFolder2
*
iface
,
LPCITEMIDLIST
pidl
,
UINT
iColumn
,
SHELLDETAILS
*
psd
)
IShellFolder_fnGetDetailsOf
(
IShellFolder2
*
iface
,
LPCITEMIDLIST
pidl
,
UINT
iColumn
,
SHELLDETAILS
*
psd
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
HRESULT
hr
=
E_FAIL
;
...
...
@@ -871,41 +922,46 @@ IShellFolder_fnGetDetailsOf (IShellFolder2 * iface, LPCITEMIDLIST pidl, UINT iCo
TRACE
(
"(%p)->(%p %i %p)
\n
"
,
This
,
pidl
,
iColumn
,
psd
);
if
(
!
psd
||
iColumn
>=
GENERICSHELLVIEWCOLUMNS
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
if
(
!
pidl
)
{
/* the header titles */
psd
->
fmt
=
GenericSFHeader
[
iColumn
].
fmt
;
psd
->
cxChar
=
GenericSFHeader
[
iColumn
].
cxChar
;
psd
->
str
.
uType
=
STRRET_CSTR
;
LoadStringA
(
shell32_hInstance
,
GenericSFHeader
[
iColumn
].
colnameid
,
psd
->
str
.
u
.
cStr
,
MAX_PATH
);
return
S_OK
;
/* the header titles */
psd
->
fmt
=
GenericSFHeader
[
iColumn
].
fmt
;
psd
->
cxChar
=
GenericSFHeader
[
iColumn
].
cxChar
;
psd
->
str
.
uType
=
STRRET_CSTR
;
LoadStringA
(
shell32_hInstance
,
GenericSFHeader
[
iColumn
].
colnameid
,
psd
->
str
.
u
.
cStr
,
MAX_PATH
);
return
S_OK
;
}
else
{
/* the data from the pidl */
switch
(
iColumn
)
{
case
0
:
/* name */
hr
=
IShellFolder_GetDisplayNameOf
(
iface
,
pidl
,
SHGDN_NORMAL
|
SHGDN_INFOLDER
,
&
psd
->
str
);
break
;
case
1
:
/* size */
_ILGetFileSize
(
pidl
,
psd
->
str
.
u
.
cStr
,
MAX_PATH
);
break
;
case
2
:
/* type */
_ILGetFileType
(
pidl
,
psd
->
str
.
u
.
cStr
,
MAX_PATH
);
break
;
case
3
:
/* date */
_ILGetFileDate
(
pidl
,
psd
->
str
.
u
.
cStr
,
MAX_PATH
);
break
;
case
4
:
/* attributes */
_ILGetFileAttributes
(
pidl
,
psd
->
str
.
u
.
cStr
,
MAX_PATH
);
break
;
}
hr
=
S_OK
;
psd
->
str
.
uType
=
STRRET_CSTR
;
/* the data from the pidl */
switch
(
iColumn
)
{
case
0
:
/* name */
hr
=
IShellFolder_GetDisplayNameOf
(
iface
,
pidl
,
SHGDN_NORMAL
|
SHGDN_INFOLDER
,
&
psd
->
str
);
break
;
case
1
:
/* size */
_ILGetFileSize
(
pidl
,
psd
->
str
.
u
.
cStr
,
MAX_PATH
);
break
;
case
2
:
/* type */
_ILGetFileType
(
pidl
,
psd
->
str
.
u
.
cStr
,
MAX_PATH
);
break
;
case
3
:
/* date */
_ILGetFileDate
(
pidl
,
psd
->
str
.
u
.
cStr
,
MAX_PATH
);
break
;
case
4
:
/* attributes */
_ILGetFileAttributes
(
pidl
,
psd
->
str
.
u
.
cStr
,
MAX_PATH
);
break
;
}
hr
=
S_OK
;
psd
->
str
.
uType
=
STRRET_CSTR
;
}
return
hr
;
}
static
HRESULT
WINAPI
IShellFolder_fnMapColumnToSCID
(
IShellFolder2
*
iface
,
UINT
column
,
SHCOLUMNID
*
pscid
)
static
HRESULT
WINAPI
IShellFolder_fnMapColumnToSCID
(
IShellFolder2
*
iface
,
UINT
column
,
SHCOLUMNID
*
pscid
)
{
_ICOM_THIS_From_IShellFolder2
(
IGenericSFImpl
,
iface
)
FIXME
(
"(%p)
\n
"
,
This
);
...
...
@@ -914,34 +970,35 @@ static HRESULT WINAPI IShellFolder_fnMapColumnToSCID (IShellFolder2 * iface, UIN
static
IShellFolder2Vtbl
sfvt
=
{
IShellFolder_fnQueryInterface
,
IShellFolder_fnAddRef
,
IShellFolder_fnRelease
,
IShellFolder_fnParseDisplayName
,
IShellFolder_fnEnumObjects
,
IShellFolder_fnBindToObject
,
IShellFolder_fnBindToStorage
,
IShellFolder_fnCompareIDs
,
IShellFolder_fnCreateViewObject
,
IShellFolder_fnGetAttributesOf
,
IShellFolder_fnGetUIObjectOf
,
IShellFolder_fnGetDisplayNameOf
,
IShellFolder_fnSetNameOf
,
/* ShellFolder2 */
IShellFolder_fnGetDefaultSearchGUID
,
IShellFolder_fnEnumSearches
,
IShellFolder_fnGetDefaultColumn
,
IShellFolder_fnGetDefaultColumnState
,
IShellFolder_fnGetDetailsEx
,
IShellFolder_fnGetDetailsOf
,
IShellFolder_fnMapColumnToSCID
IShellFolder_fnQueryInterface
,
IShellFolder_fnAddRef
,
IShellFolder_fnRelease
,
IShellFolder_fnParseDisplayName
,
IShellFolder_fnEnumObjects
,
IShellFolder_fnBindToObject
,
IShellFolder_fnBindToStorage
,
IShellFolder_fnCompareIDs
,
IShellFolder_fnCreateViewObject
,
IShellFolder_fnGetAttributesOf
,
IShellFolder_fnGetUIObjectOf
,
IShellFolder_fnGetDisplayNameOf
,
IShellFolder_fnSetNameOf
,
/* ShellFolder2 */
IShellFolder_fnGetDefaultSearchGUID
,
IShellFolder_fnEnumSearches
,
IShellFolder_fnGetDefaultColumn
,
IShellFolder_fnGetDefaultColumnState
,
IShellFolder_fnGetDetailsEx
,
IShellFolder_fnGetDetailsOf
,
IShellFolder_fnMapColumnToSCID
};
/****************************************************************************
* ISFHelper for IShellFolder implementation
*/
static
HRESULT
WINAPI
ISFHelper_fnQueryInterface
(
ISFHelper
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
static
HRESULT
WINAPI
ISFHelper_fnQueryInterface
(
ISFHelper
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
_ICOM_THIS_From_ISFHelper
(
IGenericSFImpl
,
iface
);
...
...
@@ -974,7 +1031,8 @@ static ULONG WINAPI ISFHelper_fnRelease (ISFHelper * iface)
* creates a unique folder name
*/
static
HRESULT
WINAPI
ISFHelper_fnGetUniqueName
(
ISFHelper
*
iface
,
LPSTR
lpName
,
UINT
uLen
)
static
HRESULT
WINAPI
ISFHelper_fnGetUniqueName
(
ISFHelper
*
iface
,
LPSTR
lpName
,
UINT
uLen
)
{
_ICOM_THIS_From_ISFHelper
(
IGenericSFImpl
,
iface
)
IEnumIDList
*
penum
;
...
...
@@ -985,31 +1043,33 @@ static HRESULT WINAPI ISFHelper_fnGetUniqueName (ISFHelper * iface, LPSTR lpName
TRACE
(
"(%p)(%s %u)
\n
"
,
This
,
lpName
,
uLen
);
if
(
uLen
<
strlen
(
szNewFolder
)
+
4
)
return
E_POINTER
;
return
E_POINTER
;
strcpy
(
lpName
,
szNewFolder
);
hr
=
IShellFolder_fnEnumObjects
(
_IShellFolder2_
(
This
),
0
,
SHCONTF_FOLDERS
|
SHCONTF_NONFOLDERS
|
SHCONTF_INCLUDEHIDDEN
,
&
penum
);
SHCONTF_FOLDERS
|
SHCONTF_NONFOLDERS
|
SHCONTF_INCLUDEHIDDEN
,
&
penum
);
if
(
penum
)
{
LPITEMIDLIST
pidl
;
DWORD
dwFetched
;
int
i
=
1
;
next:
IEnumIDList_Reset
(
penum
);
while
(
S_OK
==
IEnumIDList_Next
(
penum
,
1
,
&
pidl
,
&
dwFetched
)
&&
dwFetched
)
{
_ILSimpleGetText
(
pidl
,
szText
,
MAX_PATH
);
if
(
0
==
strcasecmp
(
szText
,
lpName
))
{
sprintf
(
lpName
,
"%s %d"
,
szNewFolder
,
i
++
);
if
(
i
>
99
)
{
hr
=
E_FAIL
;
break
;
}
goto
next
;
}
}
IEnumIDList_Release
(
penum
);
LPITEMIDLIST
pidl
;
DWORD
dwFetched
;
int
i
=
1
;
next:
IEnumIDList_Reset
(
penum
);
while
(
S_OK
==
IEnumIDList_Next
(
penum
,
1
,
&
pidl
,
&
dwFetched
)
&&
dwFetched
)
{
_ILSimpleGetText
(
pidl
,
szText
,
MAX_PATH
);
if
(
0
==
strcasecmp
(
szText
,
lpName
))
{
sprintf
(
lpName
,
"%s %d"
,
szNewFolder
,
i
++
);
if
(
i
>
99
)
{
hr
=
E_FAIL
;
break
;
}
goto
next
;
}
}
IEnumIDList_Release
(
penum
);
}
return
hr
;
}
...
...
@@ -1020,7 +1080,9 @@ static HRESULT WINAPI ISFHelper_fnGetUniqueName (ISFHelper * iface, LPSTR lpName
* adds a new folder.
*/
static
HRESULT
WINAPI
ISFHelper_fnAddFolder
(
ISFHelper
*
iface
,
HWND
hwnd
,
LPCSTR
lpName
,
LPITEMIDLIST
*
ppidlOut
)
static
HRESULT
WINAPI
ISFHelper_fnAddFolder
(
ISFHelper
*
iface
,
HWND
hwnd
,
LPCSTR
lpName
,
LPITEMIDLIST
*
ppidlOut
)
{
_ICOM_THIS_From_ISFHelper
(
IGenericSFImpl
,
iface
)
char
lpstrNewDir
[
MAX_PATH
];
...
...
@@ -1034,22 +1096,24 @@ static HRESULT WINAPI ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCST
bRes
=
CreateDirectoryA
(
lpstrNewDir
,
NULL
);
if
(
bRes
)
{
SHChangeNotify
(
SHCNE_MKDIR
,
SHCNF_PATHA
,
lpstrNewDir
,
NULL
);
SHChangeNotify
(
SHCNE_MKDIR
,
SHCNF_PATHA
,
lpstrNewDir
,
NULL
);
hres
=
S_OK
;
hres
=
S_OK
;
if
(
ppidlOut
)
hres
=
_ILCreateFromPathA
(
lpstrNewDir
,
ppidlOut
);
if
(
ppidlOut
)
hres
=
_ILCreateFromPathA
(
lpstrNewDir
,
ppidlOut
);
}
else
{
char
lpstrText
[
128
+
MAX_PATH
];
char
lpstrTempText
[
128
];
char
lpstrCaption
[
256
];
/* Cannot Create folder because of permissions */
LoadStringA
(
shell32_hInstance
,
IDS_CREATEFOLDER_DENIED
,
lpstrTempText
,
sizeof
(
lpstrTempText
));
LoadStringA
(
shell32_hInstance
,
IDS_CREATEFOLDER_CAPTION
,
lpstrCaption
,
sizeof
(
lpstrCaption
));
sprintf
(
lpstrText
,
lpstrTempText
,
lpstrNewDir
);
MessageBoxA
(
hwnd
,
lpstrText
,
lpstrCaption
,
MB_OK
|
MB_ICONEXCLAMATION
);
char
lpstrText
[
128
+
MAX_PATH
];
char
lpstrTempText
[
128
];
char
lpstrCaption
[
256
];
/* Cannot Create folder because of permissions */
LoadStringA
(
shell32_hInstance
,
IDS_CREATEFOLDER_DENIED
,
lpstrTempText
,
sizeof
(
lpstrTempText
));
LoadStringA
(
shell32_hInstance
,
IDS_CREATEFOLDER_CAPTION
,
lpstrCaption
,
sizeof
(
lpstrCaption
));
sprintf
(
lpstrText
,
lpstrTempText
,
lpstrNewDir
);
MessageBoxA
(
hwnd
,
lpstrText
,
lpstrCaption
,
MB_OK
|
MB_ICONEXCLAMATION
);
}
return
hres
;
...
...
@@ -1060,7 +1124,8 @@ static HRESULT WINAPI ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCST
*
* deletes items in folder
*/
static
HRESULT
WINAPI
ISFHelper_fnDeleteItems
(
ISFHelper
*
iface
,
UINT
cidl
,
LPCITEMIDLIST
*
apidl
)
static
HRESULT
WINAPI
ISFHelper_fnDeleteItems
(
ISFHelper
*
iface
,
UINT
cidl
,
LPCITEMIDLIST
*
apidl
)
{
_ICOM_THIS_From_ISFHelper
(
IGenericSFImpl
,
iface
)
UINT
i
;
...
...
@@ -1071,42 +1136,42 @@ static HRESULT WINAPI ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPC
/* deleting multiple items so give a slightly different warning */
if
(
cidl
!=
1
)
{
char
tmp
[
8
];
char
tmp
[
8
];
snprintf
(
tmp
,
sizeof
(
tmp
),
"%d"
,
cidl
);
if
(
!
SHELL_ConfirmDialog
(
ASK_DELETE_MULTIPLE_ITEM
,
tmp
))
return
E_FAIL
;
bConfirm
=
FALSE
;
snprintf
(
tmp
,
sizeof
(
tmp
),
"%d"
,
cidl
);
if
(
!
SHELL_ConfirmDialog
(
ASK_DELETE_MULTIPLE_ITEM
,
tmp
))
return
E_FAIL
;
bConfirm
=
FALSE
;
}
for
(
i
=
0
;
i
<
cidl
;
i
++
)
{
strcpy
(
szPath
,
This
->
sPathTarget
);
PathAddBackslashA
(
szPath
);
_ILSimpleGetText
(
apidl
[
i
],
szPath
+
strlen
(
szPath
),
MAX_PATH
);
if
(
_ILIsFolder
(
apidl
[
i
]))
{
LPITEMIDLIST
pidl
;
TRACE
(
"delete %s
\n
"
,
szPath
);
if
(
!
SHELL_DeleteDirectoryA
(
szPath
,
bConfirm
))
{
TRACE
(
"delete %s failed, bConfirm=%d
\n
"
,
szPath
,
bConfirm
);
return
E_FAIL
;
}
pidl
=
ILCombine
(
This
->
pidlRoot
,
apidl
[
i
]);
SHChangeNotify
(
SHCNE_RMDIR
,
SHCNF_IDLIST
,
pidl
,
NULL
);
SHFree
(
pidl
);
}
else
if
(
_ILIsValue
(
apidl
[
i
]))
{
LPITEMIDLIST
pidl
;
TRACE
(
"delete %s
\n
"
,
szPath
);
if
(
!
SHELL_DeleteFileA
(
szPath
,
bConfirm
))
{
TRACE
(
"delete %s failed, bConfirm=%d
\n
"
,
szPath
,
bConfirm
);
return
E_FAIL
;
}
pidl
=
ILCombine
(
This
->
pidlRoot
,
apidl
[
i
]);
SHChangeNotify
(
SHCNE_DELETE
,
SHCNF_IDLIST
,
pidl
,
NULL
);
SHFree
(
pidl
);
}
strcpy
(
szPath
,
This
->
sPathTarget
);
PathAddBackslashA
(
szPath
);
_ILSimpleGetText
(
apidl
[
i
],
szPath
+
strlen
(
szPath
),
MAX_PATH
);
if
(
_ILIsFolder
(
apidl
[
i
]))
{
LPITEMIDLIST
pidl
;
TRACE
(
"delete %s
\n
"
,
szPath
);
if
(
!
SHELL_DeleteDirectoryA
(
szPath
,
bConfirm
))
{
TRACE
(
"delete %s failed, bConfirm=%d
\n
"
,
szPath
,
bConfirm
);
return
E_FAIL
;
}
pidl
=
ILCombine
(
This
->
pidlRoot
,
apidl
[
i
]);
SHChangeNotify
(
SHCNE_RMDIR
,
SHCNF_IDLIST
,
pidl
,
NULL
);
SHFree
(
pidl
);
}
else
if
(
_ILIsValue
(
apidl
[
i
]))
{
LPITEMIDLIST
pidl
;
TRACE
(
"delete %s
\n
"
,
szPath
);
if
(
!
SHELL_DeleteFileA
(
szPath
,
bConfirm
))
{
TRACE
(
"delete %s failed, bConfirm=%d
\n
"
,
szPath
,
bConfirm
);
return
E_FAIL
;
}
pidl
=
ILCombine
(
This
->
pidlRoot
,
apidl
[
i
]);
SHChangeNotify
(
SHCNE_DELETE
,
SHCNF_IDLIST
,
pidl
,
NULL
);
SHFree
(
pidl
);
}
}
return
S_OK
;
...
...
@@ -1118,7 +1183,8 @@ static HRESULT WINAPI ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPC
* copies items to this folder
*/
static
HRESULT
WINAPI
ISFHelper_fnCopyItems
(
ISFHelper
*
iface
,
IShellFolder
*
pSFFrom
,
UINT
cidl
,
LPCITEMIDLIST
*
apidl
)
ISFHelper_fnCopyItems
(
ISFHelper
*
iface
,
IShellFolder
*
pSFFrom
,
UINT
cidl
,
LPCITEMIDLIST
*
apidl
)
{
UINT
i
;
IPersistFolder2
*
ppf2
=
NULL
;
...
...
@@ -1129,44 +1195,49 @@ ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl, LPC
TRACE
(
"(%p)->(%p,%u,%p)
\n
"
,
This
,
pSFFrom
,
cidl
,
apidl
);
IShellFolder_QueryInterface
(
pSFFrom
,
&
IID_IPersistFolder2
,
(
LPVOID
*
)
&
ppf2
);
IShellFolder_QueryInterface
(
pSFFrom
,
&
IID_IPersistFolder2
,
(
LPVOID
*
)
&
ppf2
);
if
(
ppf2
)
{
LPITEMIDLIST
pidl
;
if
(
SUCCEEDED
(
IPersistFolder2_GetCurFolder
(
ppf2
,
&
pidl
)))
{
for
(
i
=
0
;
i
<
cidl
;
i
++
)
{
SHGetPathFromIDListA
(
pidl
,
szSrcPath
);
PathAddBackslashA
(
szSrcPath
);
_ILSimpleGetText
(
apidl
[
i
],
szSrcPath
+
strlen
(
szSrcPath
),
MAX_PATH
);
strcpy
(
szDstPath
,
This
->
sPathTarget
);
PathAddBackslashA
(
szDstPath
);
_ILSimpleGetText
(
apidl
[
i
],
szDstPath
+
strlen
(
szDstPath
),
MAX_PATH
);
MESSAGE
(
"would copy %s to %s
\n
"
,
szSrcPath
,
szDstPath
);
}
SHFree
(
pidl
);
}
IPersistFolder2_Release
(
ppf2
);
LPITEMIDLIST
pidl
;
if
(
SUCCEEDED
(
IPersistFolder2_GetCurFolder
(
ppf2
,
&
pidl
)))
{
for
(
i
=
0
;
i
<
cidl
;
i
++
)
{
SHGetPathFromIDListA
(
pidl
,
szSrcPath
);
PathAddBackslashA
(
szSrcPath
);
_ILSimpleGetText
(
apidl
[
i
],
szSrcPath
+
strlen
(
szSrcPath
),
MAX_PATH
);
strcpy
(
szDstPath
,
This
->
sPathTarget
);
PathAddBackslashA
(
szDstPath
);
_ILSimpleGetText
(
apidl
[
i
],
szDstPath
+
strlen
(
szDstPath
),
MAX_PATH
);
MESSAGE
(
"would copy %s to %s
\n
"
,
szSrcPath
,
szDstPath
);
}
SHFree
(
pidl
);
}
IPersistFolder2_Release
(
ppf2
);
}
return
S_OK
;
}
static
ISFHelperVtbl
shvt
=
{
ISFHelper_fnQueryInterface
,
ISFHelper_fnAddRef
,
ISFHelper_fnRelease
,
ISFHelper_fnGetUniqueName
,
ISFHelper_fnAddFolder
,
ISFHelper_fnDeleteItems
,
ISFHelper_fnCopyItems
ISFHelper_fnQueryInterface
,
ISFHelper_fnAddRef
,
ISFHelper_fnRelease
,
ISFHelper_fnGetUniqueName
,
ISFHelper_fnAddFolder
,
ISFHelper_fnDeleteItems
,
ISFHelper_fnCopyItems
};
/************************************************************************
*
IFSFldr_PersistFolder3_QueryInterface
*
IFSFldr_PersistFolder3_QueryInterface
*
*/
static
HRESULT
WINAPI
IFSFldr_PersistFolder3_QueryInterface
(
IPersistFolder3
*
iface
,
REFIID
iid
,
LPVOID
*
ppvObj
)
static
HRESULT
WINAPI
IFSFldr_PersistFolder3_QueryInterface
(
IPersistFolder3
*
iface
,
REFIID
iid
,
LPVOID
*
ppvObj
)
{
_ICOM_THIS_From_IPersistFolder3
(
IGenericSFImpl
,
iface
);
...
...
@@ -1176,10 +1247,11 @@ static HRESULT WINAPI IFSFldr_PersistFolder3_QueryInterface (IPersistFolder3 * i
}
/************************************************************************
*
IFSFldr_PersistFolder3_AddRef
*
IFSFldr_PersistFolder3_AddRef
*
*/
static
ULONG
WINAPI
IFSFldr_PersistFolder3_AddRef
(
IPersistFolder3
*
iface
)
static
ULONG
WINAPI
IFSFldr_PersistFolder3_AddRef
(
IPersistFolder3
*
iface
)
{
_ICOM_THIS_From_IPersistFolder3
(
IGenericSFImpl
,
iface
);
...
...
@@ -1189,10 +1261,11 @@ static ULONG WINAPI IFSFldr_PersistFolder3_AddRef (IPersistFolder3 * iface)
}
/************************************************************************
*
IFSFldr_PersistFolder3_Release
*
IFSFldr_PersistFolder3_Release
*
*/
static
ULONG
WINAPI
IFSFldr_PersistFolder3_Release
(
IPersistFolder3
*
iface
)
static
ULONG
WINAPI
IFSFldr_PersistFolder3_Release
(
IPersistFolder3
*
iface
)
{
_ICOM_THIS_From_IPersistFolder3
(
IGenericSFImpl
,
iface
);
...
...
@@ -1202,28 +1275,30 @@ static ULONG WINAPI IFSFldr_PersistFolder3_Release (IPersistFolder3 * iface)
}
/************************************************************************
*
IFSFldr_PersistFolder3_GetClassID
*
IFSFldr_PersistFolder3_GetClassID
*/
static
HRESULT
WINAPI
IFSFldr_PersistFolder3_GetClassID
(
IPersistFolder3
*
iface
,
CLSID
*
lpClassId
)
static
HRESULT
WINAPI
IFSFldr_PersistFolder3_GetClassID
(
IPersistFolder3
*
iface
,
CLSID
*
lpClassId
)
{
_ICOM_THIS_From_IPersistFolder3
(
IGenericSFImpl
,
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
lpClassId
)
return
E_POINTER
;
return
E_POINTER
;
*
lpClassId
=
*
This
->
pclsid
;
return
S_OK
;
}
/************************************************************************
*
IFSFldr_PersistFolder3_Initialize
*
IFSFldr_PersistFolder3_Initialize
*
* NOTES
* sPathTarget is not set. Don't know how to handle in a non rooted environment.
*/
static
HRESULT
WINAPI
IFSFldr_PersistFolder3_Initialize
(
IPersistFolder3
*
iface
,
LPCITEMIDLIST
pidl
)
static
HRESULT
WINAPI
IFSFldr_PersistFolder3_Initialize
(
IPersistFolder3
*
iface
,
LPCITEMIDLIST
pidl
)
{
char
sTemp
[
MAX_PATH
];
...
...
@@ -1232,16 +1307,16 @@ static HRESULT WINAPI IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
pidl
);
if
(
This
->
pidlRoot
)
SHFree
(
This
->
pidlRoot
);
/* free the old pidl */
This
->
pidlRoot
=
ILClone
(
pidl
);
/* set my pidl */
SHFree
(
This
->
pidlRoot
);
/* free the old pidl */
This
->
pidlRoot
=
ILClone
(
pidl
);
/* set my pidl */
if
(
This
->
sPathTarget
)
SHFree
(
This
->
sPathTarget
);
SHFree
(
This
->
sPathTarget
);
/* set my path */
if
(
SHGetPathFromIDListA
(
pidl
,
sTemp
))
{
This
->
sPathTarget
=
SHAlloc
(
strlen
(
sTemp
)
+
1
);
strcpy
(
This
->
sPathTarget
,
sTemp
);
This
->
sPathTarget
=
SHAlloc
(
strlen
(
sTemp
)
+
1
);
strcpy
(
This
->
sPathTarget
,
sTemp
);
}
TRACE
(
"--(%p)->(%s)
\n
"
,
This
,
This
->
sPathTarget
);
...
...
@@ -1249,9 +1324,11 @@ static HRESULT WINAPI IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface
}
/**************************************************************************
*
IFSFldr_PersistFolder3_GetCurFolder
*
IFSFldr_PersistFolder3_GetCurFolder
*/
static
HRESULT
WINAPI
IFSFldr_PersistFolder3_fnGetCurFolder
(
IPersistFolder3
*
iface
,
LPITEMIDLIST
*
pidl
)
static
HRESULT
WINAPI
IFSFldr_PersistFolder3_fnGetCurFolder
(
IPersistFolder3
*
iface
,
LPITEMIDLIST
*
pidl
)
{
_ICOM_THIS_From_IPersistFolder3
(
IGenericSFImpl
,
iface
);
...
...
@@ -1263,13 +1340,14 @@ static HRESULT WINAPI IFSFldr_PersistFolder3_fnGetCurFolder (IPersistFolder3 * i
}
/**************************************************************************
*
IFSFldr_PersistFolder3_InitializeEx
*
IFSFldr_PersistFolder3_InitializeEx
*
* FIXME: errorhandling
* FIXME: error
handling
*/
static
HRESULT
WINAPI
IFSFldr_PersistFolder3_InitializeEx
(
IPersistFolder3
*
iface
,
IBindCtx
*
pbc
,
LPCITEMIDLIST
pidlRoot
,
const
PERSIST_FOLDER_TARGET_INFO
*
ppfti
)
IBindCtx
*
pbc
,
LPCITEMIDLIST
pidlRoot
,
const
PERSIST_FOLDER_TARGET_INFO
*
ppfti
)
{
char
sTemp
[
MAX_PATH
];
...
...
@@ -1277,18 +1355,19 @@ IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface,
TRACE
(
"(%p)->(%p,%p,%p)
\n
"
,
This
,
pbc
,
pidlRoot
,
ppfti
);
if
(
ppfti
)
TRACE
(
"--%p %s %s 0x%08lx 0x%08x
\n
"
,
ppfti
->
pidlTargetFolder
,
debugstr_w
(
ppfti
->
szTargetParsingName
),
debugstr_w
(
ppfti
->
szNetworkProvider
),
ppfti
->
dwAttributes
,
ppfti
->
csidl
);
TRACE
(
"--%p %s %s 0x%08lx 0x%08x
\n
"
,
ppfti
->
pidlTargetFolder
,
debugstr_w
(
ppfti
->
szTargetParsingName
),
debugstr_w
(
ppfti
->
szNetworkProvider
),
ppfti
->
dwAttributes
,
ppfti
->
csidl
);
pdump
(
pidlRoot
);
if
(
ppfti
&&
ppfti
->
pidlTargetFolder
)
pdump
(
ppfti
->
pidlTargetFolder
);
pdump
(
ppfti
->
pidlTargetFolder
);
if
(
This
->
pidlRoot
)
__SHFreeAndNil
(
&
This
->
pidlRoot
);
/* free the old */
__SHFreeAndNil
(
&
This
->
pidlRoot
);
/* free the old */
if
(
This
->
sPathTarget
)
__SHFreeAndNil
(
&
This
->
sPathTarget
);
__SHFreeAndNil
(
&
This
->
sPathTarget
);
/*
* Root path and pidl
...
...
@@ -1296,20 +1375,22 @@ IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface,
This
->
pidlRoot
=
ILClone
(
pidlRoot
);
/*
* the target folder is spezified in csidl OR pidlTargetFolder OR szTargetParsingName
* the target folder is spezified in csidl OR pidlTargetFolder OR
* szTargetParsingName
*/
if
(
ppfti
)
{
if
(
ppfti
->
csidl
!=
-
1
)
{
if
(
SHGetSpecialFolderPathA
(
0
,
sTemp
,
ppfti
->
csidl
,
ppfti
->
csidl
&
CSIDL_FLAG_CREATE
))
{
__SHCloneStrA
(
&
This
->
sPathTarget
,
sTemp
);
}
}
else
if
(
ppfti
->
szTargetParsingName
[
0
])
{
__SHCloneStrWtoA
(
&
This
->
sPathTarget
,
ppfti
->
szTargetParsingName
);
}
else
if
(
ppfti
->
pidlTargetFolder
)
{
if
(
SHGetPathFromIDListA
(
ppfti
->
pidlTargetFolder
,
sTemp
))
{
__SHCloneStrA
(
&
This
->
sPathTarget
,
sTemp
);
}
}
if
(
ppfti
->
csidl
!=
-
1
)
{
if
(
SHGetSpecialFolderPathA
(
0
,
sTemp
,
ppfti
->
csidl
,
ppfti
->
csidl
&
CSIDL_FLAG_CREATE
))
{
__SHCloneStrA
(
&
This
->
sPathTarget
,
sTemp
);
}
}
else
if
(
ppfti
->
szTargetParsingName
[
0
])
{
__SHCloneStrWtoA
(
&
This
->
sPathTarget
,
ppfti
->
szTargetParsingName
);
}
else
if
(
ppfti
->
pidlTargetFolder
)
{
if
(
SHGetPathFromIDListA
(
ppfti
->
pidlTargetFolder
,
sTemp
))
{
__SHCloneStrA
(
&
This
->
sPathTarget
,
sTemp
);
}
}
}
TRACE
(
"--(%p)->(target=%s)
\n
"
,
This
,
debugstr_a
(
This
->
sPathTarget
));
...
...
@@ -1318,7 +1399,8 @@ IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface,
}
static
HRESULT
WINAPI
IFSFldr_PersistFolder3_GetFolderTargetInfo
(
IPersistFolder3
*
iface
,
PERSIST_FOLDER_TARGET_INFO
*
ppfti
)
IFSFldr_PersistFolder3_GetFolderTargetInfo
(
IPersistFolder3
*
iface
,
PERSIST_FOLDER_TARGET_INFO
*
ppfti
)
{
_ICOM_THIS_From_IPersistFolder3
(
IGenericSFImpl
,
iface
);
FIXME
(
"(%p)->(%p)
\n
"
,
This
,
ppfti
);
...
...
@@ -1328,20 +1410,22 @@ IFSFldr_PersistFolder3_GetFolderTargetInfo (IPersistFolder3 * iface, PERSIST_FOL
static
IPersistFolder3Vtbl
vt_FSFldr_PersistFolder3
=
{
IFSFldr_PersistFolder3_QueryInterface
,
IFSFldr_PersistFolder3_AddRef
,
IFSFldr_PersistFolder3_Release
,
IFSFldr_PersistFolder3_GetClassID
,
IFSFldr_PersistFolder3_Initialize
,
IFSFldr_PersistFolder3_fnGetCurFolder
,
IFSFldr_PersistFolder3_InitializeEx
,
IFSFldr_PersistFolder3_GetFolderTargetInfo
IFSFldr_PersistFolder3_QueryInterface
,
IFSFldr_PersistFolder3_AddRef
,
IFSFldr_PersistFolder3_Release
,
IFSFldr_PersistFolder3_GetClassID
,
IFSFldr_PersistFolder3_Initialize
,
IFSFldr_PersistFolder3_fnGetCurFolder
,
IFSFldr_PersistFolder3_InitializeEx
,
IFSFldr_PersistFolder3_GetFolderTargetInfo
};
/****************************************************************************
* ISFDropTarget implementation
*/
static
BOOL
ISFDropTarget_QueryDrop
(
IDropTarget
*
iface
,
DWORD
dwKeyState
,
LPDWORD
pdwEffect
)
static
BOOL
ISFDropTarget_QueryDrop
(
IDropTarget
*
iface
,
DWORD
dwKeyState
,
LPDWORD
pdwEffect
)
{
DWORD
dwEffect
=
*
pdwEffect
;
...
...
@@ -1349,18 +1433,19 @@ static BOOL ISFDropTarget_QueryDrop (IDropTarget * iface, DWORD dwKeyState, LPDW
*
pdwEffect
=
DROPEFFECT_NONE
;
if
(
This
->
fAcceptFmt
)
{
/* Does our interpretation of the keystate ... */
*
pdwEffect
=
KeyStateToDropEffect
(
dwKeyState
);
if
(
This
->
fAcceptFmt
)
{
/* Does our interpretation of the keystate ... */
*
pdwEffect
=
KeyStateToDropEffect
(
dwKeyState
);
/* ... matches the desired effect ? */
if
(
dwEffect
&
*
pdwEffect
)
{
return
TRUE
;
}
/* ... matches the desired effect ? */
if
(
dwEffect
&
*
pdwEffect
)
{
return
TRUE
;
}
}
return
FALSE
;
}
static
HRESULT
WINAPI
ISFDropTarget_QueryInterface
(
IDropTarget
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
static
HRESULT
WINAPI
ISFDropTarget_QueryInterface
(
IDropTarget
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
_ICOM_THIS_From_IDropTarget
(
IGenericSFImpl
,
iface
);
...
...
@@ -1388,7 +1473,8 @@ static ULONG WINAPI ISFDropTarget_Release (IDropTarget * iface)
}
static
HRESULT
WINAPI
ISFDropTarget_DragEnter
(
IDropTarget
*
iface
,
IDataObject
*
pDataObject
,
DWORD
dwKeyState
,
POINTL
pt
,
DWORD
*
pdwEffect
)
ISFDropTarget_DragEnter
(
IDropTarget
*
iface
,
IDataObject
*
pDataObject
,
DWORD
dwKeyState
,
POINTL
pt
,
DWORD
*
pdwEffect
)
{
FORMATETC
fmt
;
...
...
@@ -1398,21 +1484,24 @@ ISFDropTarget_DragEnter (IDropTarget * iface, IDataObject * pDataObject, DWORD d
InitFormatEtc
(
fmt
,
This
->
cfShellIDList
,
TYMED_HGLOBAL
);
This
->
fAcceptFmt
=
(
S_OK
==
IDataObject_QueryGetData
(
pDataObject
,
&
fmt
))
?
TRUE
:
FALSE
;
This
->
fAcceptFmt
=
(
S_OK
==
IDataObject_QueryGetData
(
pDataObject
,
&
fmt
))
?
TRUE
:
FALSE
;
ISFDropTarget_QueryDrop
(
iface
,
dwKeyState
,
pdwEffect
);
return
S_OK
;
}
static
HRESULT
WINAPI
ISFDropTarget_DragOver
(
IDropTarget
*
iface
,
DWORD
dwKeyState
,
POINTL
pt
,
DWORD
*
pdwEffect
)
static
HRESULT
WINAPI
ISFDropTarget_DragOver
(
IDropTarget
*
iface
,
DWORD
dwKeyState
,
POINTL
pt
,
DWORD
*
pdwEffect
)
{
_ICOM_THIS_From_IDropTarget
(
IGenericSFImpl
,
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
pdwEffect
)
return
E_INVALIDARG
;
return
E_INVALIDARG
;
ISFDropTarget_QueryDrop
(
iface
,
dwKeyState
,
pdwEffect
);
...
...
@@ -1431,7 +1520,8 @@ static HRESULT WINAPI ISFDropTarget_DragLeave (IDropTarget * iface)
}
static
HRESULT
WINAPI
ISFDropTarget_Drop
(
IDropTarget
*
iface
,
IDataObject
*
pDataObject
,
DWORD
dwKeyState
,
POINTL
pt
,
DWORD
*
pdwEffect
)
ISFDropTarget_Drop
(
IDropTarget
*
iface
,
IDataObject
*
pDataObject
,
DWORD
dwKeyState
,
POINTL
pt
,
DWORD
*
pdwEffect
)
{
_ICOM_THIS_From_IDropTarget
(
IGenericSFImpl
,
iface
);
...
...
@@ -1441,11 +1531,11 @@ ISFDropTarget_Drop (IDropTarget * iface, IDataObject * pDataObject, DWORD dwKeyS
}
static
struct
IDropTargetVtbl
dtvt
=
{
ISFDropTarget_QueryInterface
,
ISFDropTarget_AddRef
,
ISFDropTarget_Release
,
ISFDropTarget_DragEnter
,
ISFDropTarget_DragOver
,
ISFDropTarget_DragLeave
,
ISFDropTarget_Drop
ISFDropTarget_QueryInterface
,
ISFDropTarget_AddRef
,
ISFDropTarget_Release
,
ISFDropTarget_DragEnter
,
ISFDropTarget_DragOver
,
ISFDropTarget_DragLeave
,
ISFDropTarget_Drop
};
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