ReactOS 0.4.15-dev-7953-g1f49173
clipboard.c File Reference
#include <windef.h>
#include <winbase.h>
#include <shlobj.h>
#include <wine/debug.h>
#include <wine/unicode.h>
#include "shell32_main.h"
Include dependency graph for clipboard.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
HGLOBAL RenderHDROP (LPITEMIDLIST pidlRoot, LPITEMIDLIST *apidl, UINT cidl)
 
HGLOBAL RenderSHELLIDLIST (LPITEMIDLIST pidlRoot, LPITEMIDLIST *apidl, UINT cidl)
 
HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST *apidl, UINT cidl)
 
HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST *apidl, UINT cidl)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 39 of file clipboard.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 38 of file clipboard.c.

Function Documentation

◆ RenderFILENAMEA()

HGLOBAL RenderFILENAMEA ( LPITEMIDLIST  pidlRoot,
LPITEMIDLIST apidl,
UINT  cidl 
)

Definition at line 190 of file clipboard.c.

191{
192 int size = 0;
193 char szTemp[MAX_PATH], *szFileName;
194 LPITEMIDLIST pidl;
195 HGLOBAL hGlobal;
197
198 TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
199
200 /* get path of combined pidl */
201 pidl = ILCombine(pidlRoot, apidl[0]);
202 if (!pidl)
203 return 0;
204
205 bSuccess = SHGetPathFromIDListA(pidl, szTemp);
206 SHFree(pidl);
207 if (!bSuccess)
208 return 0;
209
210 size = strlen(szTemp) + 1;
211
212 /* fill the structure */
213 hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
214 if(!hGlobal) return hGlobal;
215 szFileName = GlobalLock(hGlobal);
216 memcpy(szFileName, szTemp, size);
217 GlobalUnlock(hGlobal);
218
219 return hGlobal;
220}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define MAX_PATH
Definition: compat.h:34
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:326
static BOOLEAN bSuccess
Definition: drive.cpp:433
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
Definition: pidl.c:712
BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST pidl, LPSTR pszPath)
Definition: pidl.c:1291
ITEMIDLIST UNALIGNED * LPITEMIDLIST
Definition: shtypes.idl:41
#define TRACE(s)
Definition: solgame.cpp:4
#define GHND
Definition: winbase.h:297
#define GMEM_SHARE
Definition: winbase.h:305

Referenced by CIDLDataObj::Initialize().

◆ RenderFILENAMEW()

HGLOBAL RenderFILENAMEW ( LPITEMIDLIST  pidlRoot,
LPITEMIDLIST apidl,
UINT  cidl 
)

Definition at line 222 of file clipboard.c.

223{
224 int size = 0;
225 WCHAR szTemp[MAX_PATH], *szFileName;
226 LPITEMIDLIST pidl;
227 HGLOBAL hGlobal;
229
230 TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
231
232 /* get path of combined pidl */
233 pidl = ILCombine(pidlRoot, apidl[0]);
234 if (!pidl)
235 return 0;
236
237 bSuccess = SHGetPathFromIDListW(pidl, szTemp);
238 SHFree(pidl);
239 if (!bSuccess)
240 return 0;
241
242 size = (strlenW(szTemp)+1) * sizeof(WCHAR);
243
244 /* fill the structure */
245 hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
246 if(!hGlobal) return hGlobal;
247 szFileName = GlobalLock(hGlobal);
248 memcpy(szFileName, szTemp, size);
249 GlobalUnlock(hGlobal);
250
251 return hGlobal;
252}
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
Definition: pidl.c:1353
#define strlenW(s)
Definition: unicode.h:28
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by CIDLDataObj::Initialize().

◆ RenderHDROP()

HGLOBAL RenderHDROP ( LPITEMIDLIST  pidlRoot,
LPITEMIDLIST apidl,
UINT  cidl 
)

Definition at line 56 of file clipboard.c.

57{
58 UINT i;
59#ifdef __REACTOS__
60 int size = 0;
61#else
62 int rootlen = 0,size = 0;
63 WCHAR wszRootPath[MAX_PATH];
64#endif
66 HGLOBAL hGlobal = NULL;
67 DROPFILES *pDropFiles;
68 int offset;
69#ifdef __REACTOS__
70 LPITEMIDLIST *pidls;
71#endif
72
73 TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
74
75#ifdef __REACTOS__
76 pidls = (LPITEMIDLIST *)HeapAlloc(GetProcessHeap(), 0, cidl * sizeof(*pidls));
77 if (!pidls)
78 goto cleanup;
79#endif
80
81 /* get the size needed */
82 size = sizeof(DROPFILES);
83
84#ifndef __REACTOS__
85 SHGetPathFromIDListW(pidlRoot, wszRootPath);
86 PathAddBackslashW(wszRootPath);
87 rootlen = strlenW(wszRootPath);
88#endif
89
90 for (i=0; i<cidl;i++)
91 {
92#ifdef __REACTOS__
93 pidls[i] = ILCombine(pidlRoot, apidl[i]);
95 size += (wcslen(wszFileName) + 1) * sizeof(WCHAR);
96#else
98 size += (rootlen + strlenW(wszFileName) + 1) * sizeof(WCHAR);
99#endif
100 }
101
102 size += sizeof(WCHAR);
103
104 /* Fill the structure */
105 hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
106#ifdef __REACTOS__
107 if(!hGlobal) goto cleanup;
108#else
109 if(!hGlobal) return hGlobal;
110#endif
111
112 pDropFiles = GlobalLock(hGlobal);
113 offset = (sizeof(DROPFILES) + sizeof(WCHAR) - 1) / sizeof(WCHAR);
114 pDropFiles->pFiles = offset * sizeof(WCHAR);
115 pDropFiles->fWide = TRUE;
116
117#ifndef __REACTOS__
118 strcpyW(wszFileName, wszRootPath);
119#endif
120
121 for (i=0; i<cidl;i++)
122 {
123
124#ifdef __REACTOS__
126 wcscpy(((WCHAR*)pDropFiles)+offset, wszFileName);
127 offset += wcslen(wszFileName) + 1;
128 ILFree(pidls[i]);
129#else
130 _ILSimpleGetTextW(apidl[i], wszFileName + rootlen, MAX_PATH - rootlen);
131 strcpyW(((WCHAR*)pDropFiles)+offset, wszFileName);
132 offset += strlenW(wszFileName) + 1;
133#endif
134 }
135
136 ((WCHAR*)pDropFiles)[offset] = 0;
137 GlobalUnlock(hGlobal);
138
139#ifdef __REACTOS__
140cleanup:
141 if(pidls)
142 HeapFree(GetProcessHeap(), 0, pidls);
143#endif
144
145 return hGlobal;
146}
static WCHAR wszFileName[MAX_PATH]
Definition: wordpad.c:71
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
static void cleanup(void)
Definition: main.c:1335
GLintptr offset
Definition: glext.h:5920
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
unsigned int UINT
Definition: ndis.h:50
#define PathAddBackslashW
Definition: pathcch.h:301
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:938
DWORD _ILSimpleGetTextW(LPCITEMIDLIST pidl, LPWSTR szOut, UINT uOutSize)
Definition: pidl.c:2151
#define strcpyW(d, s)
Definition: unicode.h:29
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
struct _DROPFILES DROPFILES
DWORD pFiles
Definition: shlobj.h:2292
BOOL fWide
Definition: shlobj.h:2295

Referenced by CIDLDataObj::Initialize().

◆ RenderSHELLIDLIST()

HGLOBAL RenderSHELLIDLIST ( LPITEMIDLIST  pidlRoot,
LPITEMIDLIST apidl,
UINT  cidl 
)

Definition at line 148 of file clipboard.c.

149{
150 UINT i;
151 int offset = 0, sizePidl, size;
152 HGLOBAL hGlobal;
153 LPIDA pcida;
154
155 TRACE("(%p,%p,%u)\n", pidlRoot, apidl, cidl);
156
157 /* get the size needed */
158 size = sizeof(CIDA) + sizeof (UINT)*(cidl); /* header */
159 size += ILGetSize (pidlRoot); /* root pidl */
160 for(i=0; i<cidl; i++)
161 {
162 size += ILGetSize(apidl[i]); /* child pidls */
163 }
164
165 /* fill the structure */
166 hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
167 if(!hGlobal) return hGlobal;
168 pcida = GlobalLock (hGlobal);
169 pcida->cidl = cidl;
170
171 /* root pidl */
172 offset = sizeof(CIDA) + sizeof (UINT)*(cidl);
173 pcida->aoffset[0] = offset; /* first element */
174 sizePidl = ILGetSize (pidlRoot);
175 memcpy(((LPBYTE)pcida)+offset, pidlRoot, sizePidl);
176 offset += sizePidl;
177
178 for(i=0; i<cidl; i++) /* child pidls */
179 {
180 pcida->aoffset[i+1] = offset;
181 sizePidl = ILGetSize(apidl[i]);
182 memcpy(((LPBYTE)pcida)+offset, apidl[i], sizePidl);
183 offset += sizePidl;
184 }
185
186 GlobalUnlock(hGlobal);
187 return hGlobal;
188}
#define ILGetSize
Definition: shellclasses.h:638
Definition: shlobj.h:565
UINT aoffset[1]
Definition: shlobj.h:566
UINT cidl
Definition: shlobj.h:565
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by CIDLDataObj::Initialize().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )