2 * executable drop target handler
4 * Copyright 2014 Huw Campbell
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 WINE_DEFAULT_DEBUG_CHANNEL (shell
);
25 CExeDropHandler::CExeDropHandler()
27 pclsid
= (CLSID
*)&CLSID_ExeDropHandler
;
30 CExeDropHandler::~CExeDropHandler()
36 HRESULT WINAPI
CExeDropHandler::DragEnter(IDataObject
*pDataObject
, DWORD dwKeyState
, POINTL pt
, DWORD
*pdwEffect
)
38 TRACE ("(%p)\n", this);
39 *pdwEffect
= DROPEFFECT_COPY
;
43 HRESULT WINAPI
CExeDropHandler::DragOver(DWORD dwKeyState
, POINTL pt
, DWORD
*pdwEffect
)
45 TRACE ("(%p)\n", this);
46 *pdwEffect
= DROPEFFECT_COPY
;
50 HRESULT WINAPI
CExeDropHandler::DragLeave()
52 TRACE ("(%p)\n", this);
56 HRESULT WINAPI
CExeDropHandler::Drop(IDataObject
*pDataObject
, DWORD dwKeyState
, POINTL pt
, DWORD
*pdwEffect
)
58 TRACE ("(%p)\n", this);
62 InitFormatEtc (fmt
, CF_HDROP
, TYMED_HGLOBAL
);
63 WCHAR wszBuf
[MAX_PATH
* 2 + 8], *pszEnd
= wszBuf
;
64 size_t cchRemaining
= _countof(wszBuf
);
66 if (SUCCEEDED(pDataObject
->GetData(&fmt
, &medium
)) /* && SUCCEEDED(pDataObject->GetData(&fmt2, &medium))*/)
68 LPDROPFILES lpdf
= (LPDROPFILES
) GlobalLock(medium
.hGlobal
);
71 ERR("Error locking global\n");
74 pszSrcList
= (LPWSTR
) (((byte
*) lpdf
) + lpdf
->pFiles
);
77 if (StrChrW(pszSrcList
, L
' ') && cchRemaining
> 3)
78 StringCchPrintfExW(pszEnd
, cchRemaining
, &pszEnd
, &cchRemaining
, 0, L
"\"%ls\" ", pszSrcList
);
80 StringCchPrintfExW(pszEnd
, cchRemaining
, &pszEnd
, &cchRemaining
, 0, L
"%ls ", pszSrcList
);
82 pszSrcList
+= wcslen(pszSrcList
) + 1;
86 ShellExecute(NULL
, L
"open", sPathTarget
, wszBuf
, NULL
,SW_SHOWNORMAL
);
93 HRESULT WINAPI
CExeDropHandler::GetCurFile(LPOLESTR
*ppszFileName
)
95 FIXME ("(%p)\n", this);
99 HRESULT WINAPI
CExeDropHandler::IsDirty()
101 FIXME ("(%p)\n", this);
105 HRESULT WINAPI
CExeDropHandler::Load(LPCOLESTR pszFileName
, DWORD dwMode
)
107 UINT len
= strlenW(pszFileName
);
108 sPathTarget
= (WCHAR
*)SHAlloc((len
+ 1) * sizeof(WCHAR
));
109 memcpy(sPathTarget
, pszFileName
, (len
+ 1) * sizeof(WCHAR
));
113 HRESULT WINAPI
CExeDropHandler::Save(LPCOLESTR pszFileName
, BOOL fRemember
)
115 FIXME ("(%p)\n", this);
119 HRESULT WINAPI
CExeDropHandler::SaveCompleted(LPCOLESTR pszFileName
)
121 FIXME ("(%p)\n", this);
125 /************************************************************************
126 * CFSFolder::GetClassID
128 HRESULT WINAPI
CExeDropHandler::GetClassID(CLSID
* lpClassId
)
130 TRACE ("(%p)\n", this);
135 *lpClassId
= *pclsid
;