2012-07-21 01:05:06 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2012-07-21 01:05:06 +04:00
|
|
|
* Windows Clipboard Redirection
|
|
|
|
*
|
|
|
|
* Copyright 2012 Jason Champion
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
#ifndef __WF_CLIPRDR_H
|
|
|
|
#define __WF_CLIPRDR_H
|
|
|
|
|
2014-03-10 10:20:53 +04:00
|
|
|
#define CINTERFACE
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include <Ole2.h>
|
|
|
|
#include <ShlObj.h>
|
2014-09-13 00:30:57 +04:00
|
|
|
|
2014-10-23 23:38:19 +04:00
|
|
|
typedef struct wf_clipboard wfClipboard;
|
|
|
|
|
2014-09-13 00:30:57 +04:00
|
|
|
#include "wf_client.h"
|
2014-10-23 23:38:19 +04:00
|
|
|
|
2014-09-12 19:13:01 +04:00
|
|
|
#include <freerdp/log.h>
|
2012-07-21 01:05:06 +04:00
|
|
|
|
2013-11-05 06:52:17 +04:00
|
|
|
#ifdef WITH_DEBUG_CLIPRDR
|
2014-10-23 23:38:19 +04:00
|
|
|
#define DEBUG_CLIPRDR(fmt, ...) WLog_DBG(TAG, fmt, ## __VA_ARGS__)
|
2013-11-05 06:52:17 +04:00
|
|
|
#else
|
2014-09-12 19:13:01 +04:00
|
|
|
#define DEBUG_CLIPRDR(fmt, ...) do { } while (0)
|
2013-11-05 06:52:17 +04:00
|
|
|
#endif
|
|
|
|
|
2014-10-23 21:11:20 +04:00
|
|
|
struct _CliprdrStream
|
|
|
|
{
|
|
|
|
IStream iStream;
|
|
|
|
|
|
|
|
LONG m_lRefCount;
|
|
|
|
LONG m_lIndex;
|
|
|
|
ULARGE_INTEGER m_lSize;
|
|
|
|
ULARGE_INTEGER m_lOffset;
|
|
|
|
void* m_pData;
|
|
|
|
};
|
|
|
|
typedef struct _CliprdrStream CliprdrStream;
|
|
|
|
|
|
|
|
CliprdrStream* CliprdrStream_New(LONG index, void* pData);
|
|
|
|
void CliprdrStream_Delete(CliprdrStream* instance);
|
|
|
|
|
|
|
|
struct _CliprdrDataObject
|
|
|
|
{
|
|
|
|
IDataObject iDataObject;
|
|
|
|
|
|
|
|
LONG m_lRefCount;
|
|
|
|
FORMATETC* m_pFormatEtc;
|
|
|
|
STGMEDIUM* m_pStgMedium;
|
|
|
|
LONG m_nNumFormats;
|
|
|
|
LONG m_nStreams;
|
|
|
|
IStream** m_pStream;
|
|
|
|
void* m_pData;
|
|
|
|
};
|
|
|
|
typedef struct _CliprdrDataObject CliprdrDataObject;
|
|
|
|
|
|
|
|
CliprdrDataObject* CliprdrDataObject_New(FORMATETC* fmtetc, STGMEDIUM* stgmed, int count, void* data);
|
|
|
|
void CliprdrDataObject_Delete(CliprdrDataObject* instance);
|
|
|
|
|
|
|
|
struct _CliprdrEnumFORMATETC
|
|
|
|
{
|
|
|
|
IEnumFORMATETC iEnumFORMATETC;
|
|
|
|
|
|
|
|
LONG m_lRefCount;
|
|
|
|
LONG m_nIndex;
|
|
|
|
LONG m_nNumFormats;
|
|
|
|
FORMATETC* m_pFormatEtc;
|
|
|
|
};
|
|
|
|
typedef struct _CliprdrEnumFORMATETC CliprdrEnumFORMATETC;
|
|
|
|
|
|
|
|
CliprdrEnumFORMATETC* CliprdrEnumFORMATETC_New(int nFormats, FORMATETC* pFormatEtc);
|
|
|
|
void CliprdrEnumFORMATETC_Delete(CliprdrEnumFORMATETC* This);
|
|
|
|
|
2014-10-23 06:32:55 +04:00
|
|
|
struct format_mapping
|
|
|
|
{
|
2013-11-05 06:52:17 +04:00
|
|
|
UINT32 remote_format_id;
|
|
|
|
UINT32 local_format_id;
|
2014-10-23 21:11:20 +04:00
|
|
|
void* name; /* Unicode or ASCII characters with NULL terminator */
|
2013-11-05 06:52:17 +04:00
|
|
|
};
|
2014-10-23 06:32:55 +04:00
|
|
|
typedef struct format_mapping formatMapping;
|
2013-11-05 06:52:17 +04:00
|
|
|
|
2014-10-23 23:38:19 +04:00
|
|
|
struct wf_clipboard
|
2014-10-23 06:32:55 +04:00
|
|
|
{
|
2014-10-23 23:38:19 +04:00
|
|
|
wfContext* wfc;
|
2014-10-23 06:32:55 +04:00
|
|
|
rdpChannels* channels;
|
2014-10-24 02:17:53 +04:00
|
|
|
CliprdrClientContext* context;
|
2013-11-05 06:52:17 +04:00
|
|
|
|
2014-10-24 02:17:53 +04:00
|
|
|
BOOL sync;
|
2013-11-05 06:52:17 +04:00
|
|
|
UINT32 capabilities;
|
|
|
|
|
|
|
|
int map_size;
|
2014-10-23 06:32:55 +04:00
|
|
|
int map_capacity;
|
|
|
|
formatMapping* format_mappings;
|
2013-11-05 06:52:17 +04:00
|
|
|
|
2014-10-24 17:55:48 +04:00
|
|
|
UINT32 requestedFormatId;
|
2013-11-05 06:52:17 +04:00
|
|
|
|
2014-10-23 23:38:19 +04:00
|
|
|
HWND hwnd;
|
2013-11-05 06:52:17 +04:00
|
|
|
HANDLE hmem;
|
2014-10-23 23:38:19 +04:00
|
|
|
HANDLE thread;
|
2013-11-05 06:52:17 +04:00
|
|
|
HANDLE response_data_event;
|
2014-03-10 10:20:53 +04:00
|
|
|
|
|
|
|
/* file clipping */
|
|
|
|
CLIPFORMAT ID_FILEDESCRIPTORW;
|
|
|
|
CLIPFORMAT ID_FILECONTENTS;
|
|
|
|
CLIPFORMAT ID_PREFERREDDROPEFFECT;
|
|
|
|
|
|
|
|
LPDATAOBJECT data_obj;
|
|
|
|
ULONG req_fsize;
|
2014-10-23 06:32:55 +04:00
|
|
|
char* req_fdata;
|
2014-03-10 10:20:53 +04:00
|
|
|
HANDLE req_fevent;
|
|
|
|
|
|
|
|
int nFiles;
|
|
|
|
int file_array_size;
|
2014-10-23 06:32:55 +04:00
|
|
|
WCHAR** file_names;
|
|
|
|
FILEDESCRIPTORW** fileDescriptor;
|
2013-11-05 06:52:17 +04:00
|
|
|
};
|
|
|
|
|
2014-10-23 23:38:19 +04:00
|
|
|
void wf_cliprdr_init(wfContext* wfc, CliprdrClientContext* cliprdr);
|
|
|
|
void wf_cliprdr_uninit(wfContext* wfc, CliprdrClientContext* cliprdr);
|
|
|
|
|
|
|
|
int cliprdr_send_data_request(wfClipboard* clipboard, UINT32 format);
|
|
|
|
int cliprdr_send_lock(wfClipboard* clipboard);
|
|
|
|
int cliprdr_send_unlock(wfClipboard* clipboard);
|
|
|
|
int cliprdr_send_request_filecontents(wfClipboard* clipboard, void* streamid,
|
2014-10-23 06:32:55 +04:00
|
|
|
int index, int flag, DWORD positionhigh, DWORD positionlow, ULONG request);
|
2014-03-10 10:20:53 +04:00
|
|
|
|
2012-07-21 01:05:06 +04:00
|
|
|
#endif /* __WF_CLIPRDR_H */
|