[client,windows] fix compilation issues

This commit is contained in:
akallabeth 2024-10-30 09:57:53 +01:00
parent 5ed5cfe7db
commit e37ec8e0fc
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -150,8 +150,8 @@ static UINT cliprdr_send_data_request(wfClipboard* clipboard, UINT32 format);
static UINT cliprdr_send_lock(wfClipboard* clipboard); static UINT cliprdr_send_lock(wfClipboard* clipboard);
static UINT cliprdr_send_unlock(wfClipboard* clipboard); static UINT cliprdr_send_unlock(wfClipboard* clipboard);
static UINT cliprdr_send_request_filecontents(wfClipboard* clipboard, const void* streamid, static UINT cliprdr_send_request_filecontents(wfClipboard* clipboard, const void* streamid,
ULONG index, UINT32 flag, DWORD positionhigh, ULONG index, UINT32 flag, UINT64 position,
DWORD positionlow, ULONG request); ULONG request);
static void CliprdrDataObject_Delete(CliprdrDataObject* instance); static void CliprdrDataObject_Delete(CliprdrDataObject* instance);
@ -239,8 +239,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrStream_Read(IStream* This, void* pv, ULO
return S_FALSE; return S_FALSE;
ret = cliprdr_send_request_filecontents(clipboard, (void*)This, instance->m_lIndex, ret = cliprdr_send_request_filecontents(clipboard, (void*)This, instance->m_lIndex,
FILECONTENTS_RANGE, instance->m_lOffset.HighPart, FILECONTENTS_RANGE, instance->m_lOffset.QuadPart, cb);
instance->m_lOffset.LowPart, cb);
if (ret < 0) if (ret < 0)
return E_FAIL; return E_FAIL;
@ -451,7 +450,7 @@ static CliprdrStream* CliprdrStream_New(ULONG index, void* pData, const FILEDESC
{ {
/* get content size of this stream */ /* get content size of this stream */
if (cliprdr_send_request_filecontents(clipboard, (void*)instance, if (cliprdr_send_request_filecontents(clipboard, (void*)instance,
instance->m_lIndex, FILECONTENTS_SIZE, 0, 0, instance->m_lIndex, FILECONTENTS_SIZE, 0,
8) == CHANNEL_RC_OK) 8) == CHANNEL_RC_OK)
{ {
success = TRUE; success = TRUE;
@ -462,8 +461,8 @@ static CliprdrStream* CliprdrStream_New(ULONG index, void* pData, const FILEDESC
} }
else else
{ {
instance->m_lSize.LowPart = instance->m_Dsc.nFileSizeLow; instance->m_lSize.QuadPart =
instance->m_lSize.HighPart = instance->m_Dsc.nFileSizeHigh; ((UINT64)instance->m_Dsc.nFileSizeHigh << 32) | instance->m_Dsc.nFileSizeLow;
success = TRUE; success = TRUE;
} }
} }
@ -588,7 +587,12 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject* This, FO
if (cliprdr_send_data_request(clipboard, remote) != 0) if (cliprdr_send_data_request(clipboard, remote) != 0)
return E_UNEXPECTED; return E_UNEXPECTED;
pMedium->hGlobal = clipboard->hmem; /* points to a FILEGROUPDESCRIPTOR structure */ #if defined(NONAMELESSUNION)
pMedium->u.hGlobal = clipboard->hmem;
#else
pMedium->hGlobal = clipboard->hmem;
#endif
/* points to a FILEGROUPDESCRIPTOR structure */
/* GlobalLock returns a pointer to the first byte of the memory block, /* GlobalLock returns a pointer to the first byte of the memory block,
* in which is a FILEGROUPDESCRIPTOR structure, whose first UINT member * in which is a FILEGROUPDESCRIPTOR structure, whose first UINT member
* is the number of FILEDESCRIPTOR's */ * is the number of FILEDESCRIPTOR's */
@ -624,7 +628,11 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject* This, FO
clipboard->hmem = NULL; clipboard->hmem = NULL;
} }
#if defined(NONAMELESSUNION)
pMedium->u.hGlobal = NULL;
#else
pMedium->hGlobal = NULL; pMedium->hGlobal = NULL;
#endif
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
} }
@ -632,7 +640,12 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject* This, FO
{ {
if ((pFormatEtc->lindex >= 0) && ((ULONG)pFormatEtc->lindex < instance->m_nStreams)) if ((pFormatEtc->lindex >= 0) && ((ULONG)pFormatEtc->lindex < instance->m_nStreams))
{ {
pMedium->pstm = instance->m_pStream[pFormatEtc->lindex]; #if defined(NONAMELESSUNION)
pMedium->u.pstm
#else
pMedium->pstm
#endif
= instance->m_pStream[pFormatEtc->lindex];
IDataObject_AddRef(instance->m_pStream[pFormatEtc->lindex]); IDataObject_AddRef(instance->m_pStream[pFormatEtc->lindex]);
} }
else else
@ -821,28 +834,24 @@ void CliprdrDataObject_Delete(CliprdrDataObject* instance)
static BOOL wf_create_file_obj(wfClipboard* clipboard, IDataObject** ppDataObject) static BOOL wf_create_file_obj(wfClipboard* clipboard, IDataObject** ppDataObject)
{ {
FORMATETC fmtetc[2]; FORMATETC fmtetc[2] = { 0 };
STGMEDIUM stgmeds[2]; STGMEDIUM stgmeds[2] = { 0 };
if (!ppDataObject) if (!ppDataObject)
return FALSE; return FALSE;
fmtetc[0].cfFormat = RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW); fmtetc[0].cfFormat = RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW);
fmtetc[0].dwAspect = DVASPECT_CONTENT; fmtetc[0].dwAspect = DVASPECT_CONTENT;
fmtetc[0].lindex = 0;
fmtetc[0].ptd = NULL;
fmtetc[0].tymed = TYMED_HGLOBAL; fmtetc[0].tymed = TYMED_HGLOBAL;
stgmeds[0].tymed = TYMED_HGLOBAL; stgmeds[0].tymed = TYMED_HGLOBAL;
stgmeds[0].hGlobal = NULL;
stgmeds[0].pUnkForRelease = NULL;
fmtetc[1].cfFormat = RegisterClipboardFormat(CFSTR_FILECONTENTS); fmtetc[1].cfFormat = RegisterClipboardFormat(CFSTR_FILECONTENTS);
fmtetc[1].dwAspect = DVASPECT_CONTENT; fmtetc[1].dwAspect = DVASPECT_CONTENT;
fmtetc[1].lindex = 0;
fmtetc[1].ptd = NULL;
fmtetc[1].tymed = TYMED_ISTREAM; fmtetc[1].tymed = TYMED_ISTREAM;
stgmeds[1].tymed = TYMED_ISTREAM; stgmeds[1].tymed = TYMED_ISTREAM;
stgmeds[1].pstm = NULL;
stgmeds[1].pUnkForRelease = NULL;
*ppDataObject = (IDataObject*)CliprdrDataObject_New(fmtetc, stgmeds, 2, clipboard); *ppDataObject = (IDataObject*)CliprdrDataObject_New(fmtetc, stgmeds, 2, clipboard);
return (*ppDataObject) ? TRUE : FALSE; return (*ppDataObject) ? TRUE : FALSE;
} }
@ -1305,8 +1314,7 @@ static UINT cliprdr_send_data_request(wfClipboard* clipboard, UINT32 formatId)
} }
UINT cliprdr_send_request_filecontents(wfClipboard* clipboard, const void* streamid, ULONG index, UINT cliprdr_send_request_filecontents(wfClipboard* clipboard, const void* streamid, ULONG index,
UINT32 flag, DWORD positionhigh, DWORD positionlow, UINT32 flag, UINT64 position, ULONG nreq)
ULONG nreq)
{ {
UINT rc; UINT rc;
CLIPRDR_FILE_CONTENTS_REQUEST fileContentsRequest; CLIPRDR_FILE_CONTENTS_REQUEST fileContentsRequest;
@ -1317,8 +1325,8 @@ UINT cliprdr_send_request_filecontents(wfClipboard* clipboard, const void* strea
fileContentsRequest.streamId = (UINT32)(ULONG_PTR)streamid; fileContentsRequest.streamId = (UINT32)(ULONG_PTR)streamid;
fileContentsRequest.listIndex = index; fileContentsRequest.listIndex = index;
fileContentsRequest.dwFlags = flag; fileContentsRequest.dwFlags = flag;
fileContentsRequest.nPositionLow = positionlow; fileContentsRequest.nPositionLow = position & 0xFFFFFFFF;
fileContentsRequest.nPositionHigh = positionhigh; fileContentsRequest.nPositionHigh = (position >> 32) & 0xFFFFFFFF;
fileContentsRequest.cbRequested = nreq; fileContentsRequest.cbRequested = nreq;
fileContentsRequest.clipDataId = 0; fileContentsRequest.clipDataId = 0;
fileContentsRequest.common.msgFlags = 0; fileContentsRequest.common.msgFlags = 0;
@ -2073,7 +2081,12 @@ static SSIZE_T wf_cliprdr_get_filedescriptor(wfClipboard* clipboard, BYTE** pDat
goto exit; goto exit;
} }
DROPFILES* dropFiles = (DROPFILES*)GlobalLock(stg_medium.hGlobal); #if defined(NONAMELESSUNION)
HGLOBAL hdl = stg_medium.u.hGlobal;
#else
HGLOBAL hdl = stg_medium.hGlobal;
#endif
DROPFILES* dropFiles = (DROPFILES*)GlobalLock(hdl);
if (!dropFiles) if (!dropFiles)
{ {
@ -2108,7 +2121,7 @@ static SSIZE_T wf_cliprdr_get_filedescriptor(wfClipboard* clipboard, BYTE** pDat
} }
} }
GlobalUnlock(stg_medium.hGlobal); GlobalUnlock(hdl);
ReleaseStgMedium(&stg_medium); ReleaseStgMedium(&stg_medium);
exit: exit:
{ {
@ -2319,7 +2332,11 @@ wf_cliprdr_server_file_contents_request(CliprdrClientContext* context,
if (hRet == S_OK) if (hRet == S_OK)
{ {
#if defined(NONAMELESSUNION)
pStreamStc = vStgMedium.u.pstm;
#else
pStreamStc = vStgMedium.pstm; pStreamStc = vStgMedium.pstm;
#endif
uStreamIdStc = fileContentsRequest->streamId; uStreamIdStc = fileContentsRequest->streamId;
bIsStreamFile = TRUE; bIsStreamFile = TRUE;
} }
@ -2340,8 +2357,8 @@ wf_cliprdr_server_file_contents_request(CliprdrClientContext* context,
if (hRet == S_OK) if (hRet == S_OK)
{ {
*((UINT32*)&pData[0]) = vStatStg.cbSize.LowPart; *((UINT32*)&pData[0]) = vStatStg.cbSize.QuadPart & 0xFFFFFFFF;
*((UINT32*)&pData[4]) = vStatStg.cbSize.HighPart; *((UINT32*)&pData[4]) = (vStatStg.cbSize.QuadPart >> 32) & 0xFFFFFFFF;
uSize = cbRequested; uSize = cbRequested;
} }
} }
@ -2349,8 +2366,8 @@ wf_cliprdr_server_file_contents_request(CliprdrClientContext* context,
{ {
LARGE_INTEGER dlibMove; LARGE_INTEGER dlibMove;
ULARGE_INTEGER dlibNewPosition; ULARGE_INTEGER dlibNewPosition;
dlibMove.HighPart = fileContentsRequest->nPositionHigh; dlibMove.QuadPart = (INT64)(((UINT64)fileContentsRequest->nPositionHigh << 32) |
dlibMove.LowPart = fileContentsRequest->nPositionLow; fileContentsRequest->nPositionLow);
hRet = IStream_Seek(pStreamStc, dlibMove, STREAM_SEEK_SET, &dlibNewPosition); hRet = IStream_Seek(pStreamStc, dlibMove, STREAM_SEEK_SET, &dlibNewPosition);
if (SUCCEEDED(hRet)) if (SUCCEEDED(hRet))