mirror of
https://github.com/reactos/reactos.git
synced 2024-07-05 12:15:46 +00:00
Merge clipboard branch to trunk
svn path=/trunk/; revision=26029
This commit is contained in:
parent
52913c361c
commit
59736af42b
|
@ -431,8 +431,8 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
||||||
TCHAR szBuffer[MAX_PATH];
|
TCHAR szBuffer[MAX_PATH];
|
||||||
_sntprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), _T("My Computer\\%s\\%s"), rootName, keyPath);
|
_sntprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), _T("My Computer\\%s\\%s"), rootName, keyPath);
|
||||||
|
|
||||||
if (RegOpenKey(HKEY_CURRENT_USER,
|
if (RegCreateKey(HKEY_CURRENT_USER,
|
||||||
_T("Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit"),
|
g_szGeneralRegKey,
|
||||||
&hKey) == ERROR_SUCCESS)
|
&hKey) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
RegSetValueEx(hKey, _T("LastKey"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) _tcslen(szBuffer) * sizeof(szBuffer[0]));
|
RegSetValueEx(hKey, _T("LastKey"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) _tcslen(szBuffer) * sizeof(szBuffer[0]));
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* file system folder
|
* file system folder
|
||||||
*
|
*
|
||||||
|
@ -55,6 +54,8 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL (shell);
|
WINE_DEFAULT_DEBUG_CHANNEL (shell);
|
||||||
|
|
||||||
|
extern BOOL fileMoving;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* IShellFolder implementation
|
* IShellFolder implementation
|
||||||
*/
|
*/
|
||||||
|
@ -1232,11 +1233,14 @@ ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl,
|
||||||
|
|
||||||
IShellFolder_QueryInterface (pSFFrom, &IID_IPersistFolder2,
|
IShellFolder_QueryInterface (pSFFrom, &IID_IPersistFolder2,
|
||||||
(LPVOID *) & ppf2);
|
(LPVOID *) & ppf2);
|
||||||
if (ppf2) {
|
if (ppf2)
|
||||||
|
{
|
||||||
LPITEMIDLIST pidl;
|
LPITEMIDLIST pidl;
|
||||||
|
|
||||||
if (SUCCEEDED (IPersistFolder2_GetCurFolder (ppf2, &pidl))) {
|
if (SUCCEEDED (IPersistFolder2_GetCurFolder (ppf2, &pidl)))
|
||||||
for (i = 0; i < cidl; i++) {
|
{
|
||||||
|
for (i = 0; i < cidl; i++)
|
||||||
|
{
|
||||||
SHGetPathFromIDListA (pidl, szSrcPath);
|
SHGetPathFromIDListA (pidl, szSrcPath);
|
||||||
PathAddBackslashA (szSrcPath);
|
PathAddBackslashA (szSrcPath);
|
||||||
_ILSimpleGetText (apidl[i], szSrcPath + strlen (szSrcPath),
|
_ILSimpleGetText (apidl[i], szSrcPath + strlen (szSrcPath),
|
||||||
|
@ -1246,7 +1250,43 @@ ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl,
|
||||||
PathAddBackslashA (szDstPath);
|
PathAddBackslashA (szDstPath);
|
||||||
_ILSimpleGetText (apidl[i], szDstPath + strlen (szDstPath),
|
_ILSimpleGetText (apidl[i], szDstPath + strlen (szDstPath),
|
||||||
MAX_PATH);
|
MAX_PATH);
|
||||||
MESSAGE ("would copy %s to %s\n", szSrcPath, szDstPath);
|
_ILSimpleGetText (apidl[i], szDstPath + strlen (szDstPath), MAX_PATH);
|
||||||
|
DPRINT1 ("copy %s to %s\n", szSrcPath, szDstPath);
|
||||||
|
|
||||||
|
if (fileMoving)
|
||||||
|
{
|
||||||
|
fileMoving = FALSE;
|
||||||
|
SHNotifyMoveFileA(szSrcPath, szDstPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SHNotifyCopyFileA(szSrcPath, szDstPath, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: to work with folders we need SHFileOperation!
|
||||||
|
SHFILEOPSTRUCTA op;
|
||||||
|
|
||||||
|
if (fileMoving)
|
||||||
|
{
|
||||||
|
op.wFunc = FO_MOVE;
|
||||||
|
fileMoving = FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
op.wFunc = FO_COPY;
|
||||||
|
}
|
||||||
|
|
||||||
|
op.pTo = szDstPath;
|
||||||
|
op.pFrom = szSrcPath;
|
||||||
|
op.fFlags = FOF_SIMPLEPROGRESS;
|
||||||
|
op.hwnd = NULL;
|
||||||
|
op.hNameMappings = NULL;
|
||||||
|
op.lpszProgressTitle = NULL;
|
||||||
|
|
||||||
|
UINT bRes = SHFileOperationA(&op);
|
||||||
|
DbgPrint("CopyItems SHFileOperationA 0x%08x\n", bRes);
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
SHFree (pidl);
|
SHFree (pidl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,6 +478,65 @@ static DWORD SHNotifyCopyFileW(LPCWSTR src, LPCWSTR dest, BOOL bFailIfExists)
|
||||||
return GetLastError();
|
return GetLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWORD SHNotifyMoveFileA(LPCSTR src, LPCSTR dest)
|
||||||
|
{
|
||||||
|
BOOL ret;
|
||||||
|
LPWSTR destW;
|
||||||
|
|
||||||
|
ret = MoveFileA(src, dest);
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
DWORD dwAttr;
|
||||||
|
|
||||||
|
SHELL32_AnsiToUnicodeBuf(dest, &destW, 0);
|
||||||
|
dwAttr = SHFindAttrW(destW, FALSE);
|
||||||
|
SHELL32_FreeUnicodeBuf(destW);
|
||||||
|
if (INVALID_FILE_ATTRIBUTES == dwAttr)
|
||||||
|
{
|
||||||
|
/* Source file may be write protected or a system file */
|
||||||
|
dwAttr = GetFileAttributesA(src);
|
||||||
|
if (IsAttrib(dwAttr, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM))
|
||||||
|
if (SetFileAttributesA(src, dwAttr & ~(FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_SYSTEM)))
|
||||||
|
ret = MoveFileA(src, dest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
//SHChangeNotify(SHCNE_RENAMEITEM, SHCNF_PATHA, src, dest);
|
||||||
|
SHChangeNotify(SHCNE_CREATE, SHCNF_PATHA, dest, NULL);
|
||||||
|
SHChangeNotify(SHCNE_DELETE, SHCNF_PATHA, src, NULL);
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
return GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* SHNotifyCopyFile [internal]
|
||||||
|
*
|
||||||
|
* Copies a file. Also triggers a change notify if one exists.
|
||||||
|
*
|
||||||
|
* PARAMS
|
||||||
|
* src [I] path to source file to move
|
||||||
|
* dest [I] path to target file to move to
|
||||||
|
* bFailIfExists [I] if TRUE, the target file will not be overwritten if
|
||||||
|
* a file with this name already exists
|
||||||
|
*
|
||||||
|
* RETURNS
|
||||||
|
* ERROR_SUCCESS if successful
|
||||||
|
*/
|
||||||
|
DWORD SHNotifyCopyFileA(LPCSTR src, LPCSTR dest, BOOL bFailIfExists)
|
||||||
|
{
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
|
ret = CopyFileA(src, dest, bFailIfExists);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
SHChangeNotify(SHCNE_CREATE, SHCNF_PATHA, dest, NULL);
|
||||||
|
return ERROR_SUCCESS;
|
||||||
|
}
|
||||||
|
return GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* SHCreateDirectory [SHELL32.165]
|
* SHCreateDirectory [SHELL32.165]
|
||||||
*
|
*
|
||||||
|
@ -650,6 +709,30 @@ static DWORD SHFindAttrW(LPCWSTR pName, BOOL fileOnly)
|
||||||
return dwAttr;
|
return dwAttr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
DWORD SHFindAttrA(LPSTR pName, BOOL fileOnly)
|
||||||
|
{
|
||||||
|
WIN32_FIND_DATAA wfd;
|
||||||
|
BOOL b_FileMask = fileOnly && (NULL != StrPBrkA(pName, wWildcardChars));
|
||||||
|
DWORD dwAttr = INVALID_FILE_ATTRIBUTES;
|
||||||
|
HANDLE hFind = FindFirstFileA(pName, &wfd);
|
||||||
|
|
||||||
|
if (INVALID_HANDLE_VALUE != hFind)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (b_FileMask && IsAttribDir(wfd.dwFileAttributes))
|
||||||
|
continue;
|
||||||
|
dwAttr = wfd.dwFileAttributes;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (FindNextFileA(hFind, &wfd));
|
||||||
|
FindClose(hFind);
|
||||||
|
}
|
||||||
|
return dwAttr;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
*
|
*
|
||||||
* SHFileStrICmp HelperFunction for SHFileOperationW
|
* SHFileStrICmp HelperFunction for SHFileOperationW
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* License along with this library; if not, write to the Free Software
|
* License along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
|
@ -38,6 +39,8 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||||
|
|
||||||
|
extern BOOL fileMoving;
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* IContextMenu Implementation
|
* IContextMenu Implementation
|
||||||
*/
|
*/
|
||||||
|
@ -215,6 +218,192 @@ static void DoNewFolder(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
static BOOL DoLink(LPCSTR pSrcFile, LPCSTR pDstFile)
|
||||||
|
{
|
||||||
|
IShellLinkA *psl = NULL;
|
||||||
|
IPersistFile *pPf = NULL;
|
||||||
|
HRESULT hres;
|
||||||
|
WCHAR widelink[MAX_PATH];
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
CoInitialize(0);
|
||||||
|
|
||||||
|
hres = CoCreateInstance( &CLSID_ShellLink,
|
||||||
|
NULL,
|
||||||
|
CLSCTX_INPROC_SERVER,
|
||||||
|
&IID_IShellLinkA,
|
||||||
|
(LPVOID )&psl);
|
||||||
|
|
||||||
|
if(SUCCEEDED(hres))
|
||||||
|
{
|
||||||
|
hres = IShellLinkA_QueryInterface(psl, &IID_IPersistFile, (LPVOID *)&pPf);
|
||||||
|
if(FAILED(hres))
|
||||||
|
{
|
||||||
|
ERR("failed QueryInterface for IPersistFile %08lx\n", hres);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT1("shortcut point to %s\n", pSrcFile);
|
||||||
|
|
||||||
|
hres = IShellLinkA_SetPath(psl, pSrcFile);
|
||||||
|
|
||||||
|
if(FAILED(hres))
|
||||||
|
{
|
||||||
|
ERR("failed Set{IDList|Path} %08lx\n", hres);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
MultiByteToWideChar(CP_ACP, 0, pDstFile, -1, widelink, MAX_PATH);
|
||||||
|
|
||||||
|
/* create the short cut */
|
||||||
|
hres = IPersistFile_Save(pPf, widelink, TRUE);
|
||||||
|
|
||||||
|
if(FAILED(hres))
|
||||||
|
{
|
||||||
|
ERR("failed IPersistFile::Save %08lx\n", hres);
|
||||||
|
IPersistFile_Release(pPf);
|
||||||
|
IShellLinkA_Release(psl);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
hres = IPersistFile_SaveCompleted(pPf, widelink);
|
||||||
|
IPersistFile_Release(pPf);
|
||||||
|
IShellLinkA_Release(psl);
|
||||||
|
DPRINT1("shortcut %s has been created, result=%08lx\n", pDstFile, hres);
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT1("CoCreateInstance failed, hres=%08lx\n", hres);
|
||||||
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
|
CoUninitialize();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static BOOL MakeLink(IContextMenu2 *iface)
|
||||||
|
{
|
||||||
|
|
||||||
|
BgCmImpl *This = (BgCmImpl *)iface;
|
||||||
|
BOOL bSuccess = FALSE;
|
||||||
|
IDataObject * pda;
|
||||||
|
|
||||||
|
TRACE("\n");
|
||||||
|
|
||||||
|
if(SUCCEEDED(OleGetClipboard(&pda)))
|
||||||
|
{
|
||||||
|
STGMEDIUM medium;
|
||||||
|
FORMATETC formatetc;
|
||||||
|
|
||||||
|
TRACE("pda=%p\n", pda);
|
||||||
|
|
||||||
|
/* Set the FORMATETC structure*/
|
||||||
|
InitFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL);
|
||||||
|
|
||||||
|
/* Get the pidls from IDataObject */
|
||||||
|
if(SUCCEEDED(IDataObject_GetData(pda, &formatetc, &medium)))
|
||||||
|
{
|
||||||
|
LPITEMIDLIST * apidl;
|
||||||
|
LPITEMIDLIST pidl;
|
||||||
|
IShellFolder *psfFrom = NULL, *psfDesktop;
|
||||||
|
|
||||||
|
LPIDA lpcida = GlobalLock(medium.u.hGlobal);
|
||||||
|
TRACE("cida=%p\n", lpcida);
|
||||||
|
|
||||||
|
apidl = _ILCopyCidaToaPidl(&pidl, lpcida);
|
||||||
|
|
||||||
|
/* bind to the source shellfolder */
|
||||||
|
SHGetDesktopFolder(&psfDesktop);
|
||||||
|
if(psfDesktop)
|
||||||
|
{
|
||||||
|
IShellFolder_BindToObject(psfDesktop, pidl, NULL, &IID_IShellFolder, (LPVOID*)&psfFrom);
|
||||||
|
IShellFolder_Release(psfDesktop);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (psfFrom)
|
||||||
|
{
|
||||||
|
/* get source and destination shellfolder */
|
||||||
|
IPersistFolder2 *ppfdst = NULL;
|
||||||
|
IPersistFolder2 *ppfsrc = NULL;
|
||||||
|
IShellFolder_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&ppfdst);
|
||||||
|
IShellFolder_QueryInterface(psfFrom, &IID_IPersistFolder2, (LPVOID*)&ppfsrc);
|
||||||
|
|
||||||
|
DPRINT1("[%p,%p]\n",ppfdst,ppfsrc);
|
||||||
|
|
||||||
|
/* do the link/s */
|
||||||
|
/* hack to get desktop path */
|
||||||
|
if ( (ppfdst && ppfsrc) || (This->bDesktop && ppfsrc) )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char szSrcPath[MAX_PATH];
|
||||||
|
char szDstPath[MAX_PATH];
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
LPITEMIDLIST pidl2;
|
||||||
|
char filename[MAX_PATH];
|
||||||
|
char linkFilename[MAX_PATH];
|
||||||
|
char srcFilename[MAX_PATH];
|
||||||
|
|
||||||
|
IPersistFolder2_GetCurFolder(ppfsrc, &pidl2);
|
||||||
|
SHGetPathFromIDListA (pidl2, szSrcPath);
|
||||||
|
|
||||||
|
if (This->bDesktop)
|
||||||
|
{
|
||||||
|
SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, &pidl2);
|
||||||
|
SHGetPathFromIDListA (pidl2, szDstPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IPersistFolder2_GetCurFolder(ppfdst, &pidl2);
|
||||||
|
SHGetPathFromIDListA (pidl2, szDstPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < lpcida->cidl; i++)
|
||||||
|
{
|
||||||
|
_ILSimpleGetText (apidl[i], filename, MAX_PATH);
|
||||||
|
|
||||||
|
DPRINT1("filename %s\n", filename);
|
||||||
|
|
||||||
|
lstrcpyA(linkFilename, szDstPath);
|
||||||
|
PathAddBackslashA(linkFilename);
|
||||||
|
lstrcatA(linkFilename, "Shortcut to ");
|
||||||
|
lstrcatA(linkFilename, filename);
|
||||||
|
lstrcatA(linkFilename, ".lnk");
|
||||||
|
|
||||||
|
DPRINT1("linkFilename %s\n", linkFilename);
|
||||||
|
|
||||||
|
lstrcpyA(srcFilename, szSrcPath);
|
||||||
|
PathAddBackslashA(srcFilename);
|
||||||
|
lstrcatA(srcFilename, filename);
|
||||||
|
|
||||||
|
DPRINT1("srcFilename %s\n", srcFilename);
|
||||||
|
|
||||||
|
ret = DoLink(srcFilename, linkFilename);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
SHChangeNotify(SHCNE_CREATE, SHCNF_PATHA, linkFilename, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ppfdst) IPersistFolder2_Release(ppfdst);
|
||||||
|
if(ppfsrc) IPersistFolder2_Release(ppfsrc);
|
||||||
|
IShellFolder_Release(psfFrom);
|
||||||
|
}
|
||||||
|
|
||||||
|
_ILFreeaPidl(apidl, lpcida->cidl);
|
||||||
|
SHFree(pidl);
|
||||||
|
|
||||||
|
/* release the medium*/
|
||||||
|
ReleaseStgMedium(&medium);
|
||||||
|
}
|
||||||
|
IDataObject_Release(pda);
|
||||||
|
}
|
||||||
|
return bSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* DoPaste
|
* DoPaste
|
||||||
*/
|
*/
|
||||||
|
@ -261,16 +450,27 @@ static BOOL DoPaste(
|
||||||
{
|
{
|
||||||
/* get source and destination shellfolder */
|
/* get source and destination shellfolder */
|
||||||
ISFHelper *psfhlpdst, *psfhlpsrc;
|
ISFHelper *psfhlpdst, *psfhlpsrc;
|
||||||
|
|
||||||
|
if (This->bDesktop)
|
||||||
|
{
|
||||||
|
/* unimplemented
|
||||||
|
SHGetDesktopFolder(&psfDesktop);
|
||||||
|
IFSFolder_Constructor(psfDesktop, &IID_ISFHelper, (LPVOID*)&psfhlpdst);
|
||||||
|
IShellFolder_QueryInterface(psfhlpdst, &IID_ISFHelper, (LPVOID*)&psfhlpdst);
|
||||||
|
*/
|
||||||
IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlpdst);
|
IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlpdst);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlpdst);
|
||||||
|
}
|
||||||
|
|
||||||
IShellFolder_QueryInterface(psfFrom, &IID_ISFHelper, (LPVOID*)&psfhlpsrc);
|
IShellFolder_QueryInterface(psfFrom, &IID_ISFHelper, (LPVOID*)&psfhlpsrc);
|
||||||
|
|
||||||
/* do the copy/move */
|
/* do the copy/move */
|
||||||
if (psfhlpdst && psfhlpsrc)
|
if (psfhlpdst && psfhlpsrc)
|
||||||
{
|
{
|
||||||
ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, (LPCITEMIDLIST*)apidl);
|
ISFHelper_CopyItems(psfhlpdst, psfFrom, lpcida->cidl, (LPCITEMIDLIST*)apidl);
|
||||||
/* FIXME handle move
|
|
||||||
ISFHelper_DeleteItems(psfhlpsrc, lpcida->cidl, apidl);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
|
if(psfhlpdst) ISFHelper_Release(psfhlpdst);
|
||||||
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
|
if(psfhlpsrc) ISFHelper_Release(psfhlpsrc);
|
||||||
|
@ -285,30 +485,7 @@ static BOOL DoPaste(
|
||||||
}
|
}
|
||||||
IDataObject_Release(pda);
|
IDataObject_Release(pda);
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
HGLOBAL hMem;
|
|
||||||
|
|
||||||
OpenClipboard(NULL);
|
|
||||||
hMem = GetClipboardData(CF_HDROP);
|
|
||||||
|
|
||||||
if(hMem)
|
|
||||||
{
|
|
||||||
char * pDropFiles = (char *)GlobalLock(hMem);
|
|
||||||
if(pDropFiles)
|
|
||||||
{
|
|
||||||
int len, offset = sizeof(DROPFILESTRUCT);
|
|
||||||
|
|
||||||
while( pDropFiles[offset] != 0)
|
|
||||||
{
|
|
||||||
len = strlen(pDropFiles + offset);
|
|
||||||
TRACE("%s\n", pDropFiles + offset);
|
|
||||||
offset += len+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GlobalUnlock(hMem);
|
|
||||||
}
|
|
||||||
CloseClipboard();
|
|
||||||
#endif
|
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,6 +550,10 @@ static HRESULT WINAPI ISVBgCm_fnInvokeCommand(
|
||||||
DoPaste(iface);
|
DoPaste(iface);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FCIDM_SHVIEW_INSERTLINK:
|
||||||
|
MakeLink(iface);
|
||||||
|
break;
|
||||||
|
|
||||||
case FCIDM_SHVIEW_PROPERTIES:
|
case FCIDM_SHVIEW_PROPERTIES:
|
||||||
if (This->bDesktop) {
|
if (This->bDesktop) {
|
||||||
ShellExecuteA(lpcmi->hwnd, "open", "rundll32.exe shell32.dll,Control_RunDLL desk.cpl", NULL, NULL, SW_SHOWNORMAL);
|
ShellExecuteA(lpcmi->hwnd, "open", "rundll32.exe shell32.dll,Control_RunDLL desk.cpl", NULL, NULL, SW_SHOWNORMAL);
|
||||||
|
|
|
@ -39,6 +39,9 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||||
|
|
||||||
|
/* ugly hack for cut&psate files */
|
||||||
|
BOOL fileMoving = FALSE;
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* IContextMenu Implementation
|
* IContextMenu Implementation
|
||||||
*/
|
*/
|
||||||
|
@ -373,6 +376,8 @@ static BOOL DoCopyOrCut(
|
||||||
LPSHELLVIEW lpSV;
|
LPSHELLVIEW lpSV;
|
||||||
LPDATAOBJECT lpDo;
|
LPDATAOBJECT lpDo;
|
||||||
|
|
||||||
|
fileMoving = bCut;
|
||||||
|
|
||||||
TRACE("(%p)->(wnd=%p,bCut=0x%08x)\n",This, hwnd, bCut);
|
TRACE("(%p)->(wnd=%p,bCut=0x%08x)\n",This, hwnd, bCut);
|
||||||
|
|
||||||
/* get the active IShellView */
|
/* get the active IShellView */
|
||||||
|
|
|
@ -76,8 +76,10 @@
|
||||||
#define NtUserSetCaretBlinkTime(uMSeconds) \
|
#define NtUserSetCaretBlinkTime(uMSeconds) \
|
||||||
(BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)
|
(BOOL)NtUserCallOneParam((DWORD)uMSeconds, ONEPARAM_ROUTINE_SETCARETBLINKTIME)
|
||||||
|
|
||||||
|
/*
|
||||||
#define NtUserEnumClipboardFormats(format) \
|
#define NtUserEnumClipboardFormats(format) \
|
||||||
(UINT)NtUserCallOneParam(format, ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS)
|
(UINT)NtUserCallOneParam(format, ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS)
|
||||||
|
*/
|
||||||
|
|
||||||
#define NtUserWindowFromDC(hDC) \
|
#define NtUserWindowFromDC(hDC) \
|
||||||
(HWND)NtUserCallOneParam((DWORD)hDC, ONEPARAM_ROUTINE_WINDOWFROMDC)
|
(HWND)NtUserCallOneParam((DWORD)hDC, ONEPARAM_ROUTINE_WINDOWFROMDC)
|
||||||
|
|
|
@ -1,37 +1,25 @@
|
||||||
/*
|
|
||||||
* ReactOS kernel
|
|
||||||
* Copyright (C) 1998, 1999, 2000, 2001 ReactOS Team
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
/* $Id$
|
/* $Id$
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS user32.dll
|
* PROJECT: ReactOS user32.dll
|
||||||
* FILE: lib/user32/windows/clipboard.c
|
* FILE: lib/user32/windows/clipboard.c
|
||||||
* PURPOSE: Input
|
* PURPOSE: Input
|
||||||
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||||
|
* Pablo Borobia <pborobia@gmail.com>
|
||||||
* UPDATE HISTORY:
|
* UPDATE HISTORY:
|
||||||
* 09-05-2001 CSH Created
|
* 09-05-2001 CSH Created
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES ******************************************************************/
|
/* INCLUDES ******************************************************************/
|
||||||
|
|
||||||
#include <user32.h>
|
#include <user32.h>
|
||||||
|
|
||||||
|
#define NDEBUG
|
||||||
|
|
||||||
#include <wine/debug.h>
|
#include <wine/debug.h>
|
||||||
|
|
||||||
|
#define QUERY_SIZE 0
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -40,7 +28,8 @@
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
OpenClipboard(HWND hWndNewOwner)
|
OpenClipboard(HWND hWndNewOwner)
|
||||||
{
|
{
|
||||||
return NtUserOpenClipboard(hWndNewOwner, 0);
|
BOOL ret = NtUserOpenClipboard(hWndNewOwner, 0);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -49,7 +38,9 @@ OpenClipboard(HWND hWndNewOwner)
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
CloseClipboard(VOID)
|
CloseClipboard(VOID)
|
||||||
{
|
{
|
||||||
return NtUserCloseClipboard();
|
BOOL ret;
|
||||||
|
ret = NtUserCloseClipboard();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -58,7 +49,8 @@ CloseClipboard(VOID)
|
||||||
INT STDCALL
|
INT STDCALL
|
||||||
CountClipboardFormats(VOID)
|
CountClipboardFormats(VOID)
|
||||||
{
|
{
|
||||||
return NtUserCountClipboardFormats();
|
INT ret = NtUserCountClipboardFormats();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -76,7 +68,8 @@ EmptyClipboard(VOID)
|
||||||
UINT STDCALL
|
UINT STDCALL
|
||||||
EnumClipboardFormats(UINT format)
|
EnumClipboardFormats(UINT format)
|
||||||
{
|
{
|
||||||
return NtUserEnumClipboardFormats(format);
|
UINT ret = NtUserEnumClipboardFormats(format);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -85,7 +78,31 @@ EnumClipboardFormats(UINT format)
|
||||||
HANDLE STDCALL
|
HANDLE STDCALL
|
||||||
GetClipboardData(UINT uFormat)
|
GetClipboardData(UINT uFormat)
|
||||||
{
|
{
|
||||||
return NtUserGetClipboardData(uFormat, 0);
|
HGLOBAL hGlobal = NULL;
|
||||||
|
PVOID pGlobal = NULL;
|
||||||
|
DWORD size = 0;
|
||||||
|
|
||||||
|
/* dealing with bitmap object */
|
||||||
|
if (uFormat != CF_BITMAP)
|
||||||
|
{
|
||||||
|
size = (DWORD)NtUserGetClipboardData(uFormat, QUERY_SIZE);
|
||||||
|
|
||||||
|
if (size)
|
||||||
|
{
|
||||||
|
hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, size);
|
||||||
|
pGlobal = GlobalLock(hGlobal);
|
||||||
|
|
||||||
|
size = (DWORD)NtUserGetClipboardData(uFormat, (DWORD)pGlobal);
|
||||||
|
|
||||||
|
GlobalUnlock(hGlobal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hGlobal = NtUserGetClipboardData(CF_BITMAP, !QUERY_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hGlobal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -97,8 +114,13 @@ GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
|
||||||
LPWSTR lpBuffer;
|
LPWSTR lpBuffer;
|
||||||
UNICODE_STRING FormatName;
|
UNICODE_STRING FormatName;
|
||||||
INT Length;
|
INT Length;
|
||||||
|
ANSI_STRING ClassName;
|
||||||
|
|
||||||
|
ClassName.MaximumLength = cchMaxCount;
|
||||||
|
ClassName.Buffer = lpszFormatName;
|
||||||
|
|
||||||
lpBuffer = HEAP_alloc(cchMaxCount * sizeof(WCHAR));
|
lpBuffer = HEAP_alloc(cchMaxCount * sizeof(WCHAR));
|
||||||
|
|
||||||
if (!lpBuffer)
|
if (!lpBuffer)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_OUTOFMEMORY);
|
SetLastError(ERROR_OUTOFMEMORY);
|
||||||
|
@ -109,13 +131,12 @@ GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
|
||||||
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
|
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
|
||||||
FormatName.Buffer = lpBuffer;
|
FormatName.Buffer = lpBuffer;
|
||||||
|
|
||||||
|
/* we need a UNICODE string */
|
||||||
Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
||||||
DPRINT("GetClipboardFormatNameA(%x): %S\n", format, lpBuffer);
|
|
||||||
HEAP_strcpyWtoA(lpszFormatName, lpBuffer, Length);
|
|
||||||
HEAP_free(lpBuffer);
|
|
||||||
DPRINT("GetClipboardFormatNameA(%x): returning %s\n", format, lpszFormatName);
|
|
||||||
|
|
||||||
return Length;
|
HEAP_strcpyWtoA(lpszFormatName, FormatName.Buffer, Length);
|
||||||
|
|
||||||
|
return strlen(lpszFormatName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -131,8 +152,8 @@ GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount)
|
||||||
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
|
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
|
||||||
FormatName.Buffer = (PWSTR)lpszFormatName;
|
FormatName.Buffer = (PWSTR)lpszFormatName;
|
||||||
Ret = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
Ret = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
||||||
DPRINT("GetClipboardFormatNameW(%x): returning %S\n", format, lpszFormatName);
|
|
||||||
return Ret;
|
return Ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -177,7 +198,8 @@ GetOpenClipboardWindow(VOID)
|
||||||
INT STDCALL
|
INT STDCALL
|
||||||
GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats)
|
GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats)
|
||||||
{
|
{
|
||||||
return NtUserGetPriorityClipboardFormat(paFormatPriorityList, cFormats);
|
INT ret = NtUserGetPriorityClipboardFormat(paFormatPriorityList, cFormats);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -186,18 +208,41 @@ GetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats)
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
IsClipboardFormatAvailable(UINT format)
|
IsClipboardFormatAvailable(UINT format)
|
||||||
{
|
{
|
||||||
return NtUserIsClipboardFormatAvailable(format);
|
BOOL ret = NtUserIsClipboardFormatAvailable(format);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
||||||
UINT STDCALL
|
UINT STDCALL
|
||||||
RegisterClipboardFormatA(LPCSTR lpszFormat)
|
RegisterClipboardFormatA(LPCSTR lpszFormat)
|
||||||
{
|
{
|
||||||
ULONG Ret = RegisterWindowMessageA(lpszFormat);
|
UINT ret = 0;
|
||||||
DPRINT("RegisterClipboardFormatA(%s) - %x\n", lpszFormat, Ret);
|
UNICODE_STRING usFormat = {0};
|
||||||
return Ret;
|
|
||||||
|
if (lpszFormat == NULL)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check for "" */
|
||||||
|
if (*lpszFormat == 0) //NULL
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_NAME);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = RtlCreateUnicodeStringFromAsciiz(&usFormat, lpszFormat);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
ret = NtUserRegisterClipboardFormat(&usFormat); //(LPCWSTR)
|
||||||
|
RtlFreeUnicodeString(&usFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -206,9 +251,48 @@ RegisterClipboardFormatA(LPCSTR lpszFormat)
|
||||||
UINT STDCALL
|
UINT STDCALL
|
||||||
RegisterClipboardFormatW(LPCWSTR lpszFormat)
|
RegisterClipboardFormatW(LPCWSTR lpszFormat)
|
||||||
{
|
{
|
||||||
ULONG Ret = RegisterWindowMessageW(lpszFormat);
|
UINT ret = 0;
|
||||||
DPRINT("RegisterClipboardFormatW(%S) - %x\n", lpszFormat, Ret);
|
UNICODE_STRING usFormat = {0};
|
||||||
return Ret;
|
|
||||||
|
if (lpszFormat == NULL)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* check for "" */
|
||||||
|
if (*lpszFormat == 0) //NULL
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_NAME);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
RtlInitUnicodeString(&usFormat, lpszFormat);
|
||||||
|
ret = NtUserRegisterClipboardFormat(&usFormat);
|
||||||
|
RtlFreeUnicodeString(&usFormat);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
HGLOBAL renderLocale (DWORD Locale)
|
||||||
|
{
|
||||||
|
DWORD* pLocale;
|
||||||
|
HGLOBAL hGlobal;
|
||||||
|
|
||||||
|
hGlobal = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE, sizeof(DWORD));
|
||||||
|
|
||||||
|
if(!hGlobal)
|
||||||
|
{
|
||||||
|
return hGlobal;
|
||||||
|
}
|
||||||
|
|
||||||
|
pLocale = (DWORD*)GlobalLock(hGlobal);
|
||||||
|
|
||||||
|
*pLocale = Locale;
|
||||||
|
|
||||||
|
GlobalUnlock(hGlobal);
|
||||||
|
|
||||||
|
return hGlobal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -217,7 +301,54 @@ RegisterClipboardFormatW(LPCWSTR lpszFormat)
|
||||||
HANDLE STDCALL
|
HANDLE STDCALL
|
||||||
SetClipboardData(UINT uFormat, HANDLE hMem)
|
SetClipboardData(UINT uFormat, HANDLE hMem)
|
||||||
{
|
{
|
||||||
return NtUserSetClipboardData(uFormat, hMem, 0);
|
DWORD size;
|
||||||
|
LPVOID pMem;
|
||||||
|
HANDLE ret = NULL;
|
||||||
|
|
||||||
|
if (hMem == NULL)
|
||||||
|
{
|
||||||
|
return NtUserSetClipboardData(uFormat, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uFormat == CF_BITMAP)
|
||||||
|
{
|
||||||
|
/* GlobalLock should return 0 for GDI handles
|
||||||
|
pMem = GlobalLock(hMem);
|
||||||
|
if (pMem)
|
||||||
|
{
|
||||||
|
// not a GDI handle
|
||||||
|
GlobalUnlock(hMem);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*/
|
||||||
|
/* check if this GDI handle is a HBITMAP */
|
||||||
|
/* GetObject for HBITMAP not implemented in ReactOS */
|
||||||
|
//if (GetObject(hMem, 0, NULL) == sifeof(BITMAP))
|
||||||
|
//{
|
||||||
|
return NtUserSetClipboardData(CF_BITMAP, hMem, 0);
|
||||||
|
//}
|
||||||
|
/*}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
size = GlobalSize(hMem);
|
||||||
|
pMem = GlobalLock(hMem);
|
||||||
|
|
||||||
|
if ((pMem) && (size))
|
||||||
|
{
|
||||||
|
size = GlobalSize(hMem);
|
||||||
|
ret = NtUserSetClipboardData(uFormat, pMem, size);
|
||||||
|
//should i unlock hMem?
|
||||||
|
GlobalUnlock(hMem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DPRINT1("SetClipboardData failed\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -237,3 +368,35 @@ ChangeClipboardChain(HWND hWndRemove, HWND hWndNewNext)
|
||||||
{
|
{
|
||||||
return NtUserChangeClipboardChain(hWndRemove, hWndNewNext);
|
return NtUserChangeClipboardChain(hWndRemove, hWndNewNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
BOOL STDCALL
|
||||||
|
AddClipboardFormatListener(HWND hwnd)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
BOOL STDCALL
|
||||||
|
RemoveClipboardFormatListener(HWND hwnd)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @unimplemented
|
||||||
|
*/
|
||||||
|
BOOL STDCALL
|
||||||
|
GetUpdatedClipboardFormats(
|
||||||
|
PUINT lpuiFormats,
|
||||||
|
UINT cFormats,
|
||||||
|
PUINT pcFormatsOut)
|
||||||
|
{
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -984,6 +984,30 @@ static void DefWndPrint( HWND hwnd, HDC hdc, ULONG uFlags)
|
||||||
VOID FASTCALL
|
VOID FASTCALL
|
||||||
DefWndScreenshot(HWND hWnd)
|
DefWndScreenshot(HWND hWnd)
|
||||||
{
|
{
|
||||||
|
RECT rect;
|
||||||
|
|
||||||
|
OpenClipboard(hWnd);
|
||||||
|
EmptyClipboard();
|
||||||
|
|
||||||
|
HDC hdc = GetWindowDC(hWnd);
|
||||||
|
GetWindowRect(hWnd, &rect);
|
||||||
|
INT w = rect.right - rect.left;
|
||||||
|
INT h = rect.bottom - rect.top;
|
||||||
|
|
||||||
|
HBITMAP hbitmap = CreateCompatibleBitmap(hdc, w, h);
|
||||||
|
HDC hdc2 = CreateCompatibleDC(hdc);
|
||||||
|
SelectObject(hdc2, hbitmap);
|
||||||
|
|
||||||
|
BitBlt(hdc2, 0, 0, w, h,
|
||||||
|
hdc, 0, 0,
|
||||||
|
SRCCOPY);
|
||||||
|
|
||||||
|
SetClipboardData(CF_BITMAP, hbitmap);
|
||||||
|
|
||||||
|
ReleaseDC(hWnd, hdc);
|
||||||
|
ReleaseDC(hWnd, hdc2);
|
||||||
|
|
||||||
|
CloseClipboard();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1349,7 +1373,12 @@ User32DefWindowProc(HWND hWnd,
|
||||||
}
|
}
|
||||||
else if (wParam == VK_SNAPSHOT)
|
else if (wParam == VK_SNAPSHOT)
|
||||||
{
|
{
|
||||||
DefWndScreenshot(hWnd);
|
HWND hwnd = hWnd;
|
||||||
|
while (GetParent(hwnd) != NULL)
|
||||||
|
{
|
||||||
|
hwnd = GetParent(hwnd);
|
||||||
|
}
|
||||||
|
DefWndScreenshot(hwnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( wParam == VK_F10 )
|
else if( wParam == VK_F10 )
|
||||||
|
|
|
@ -54,6 +54,8 @@ extern "C" {
|
||||||
#define HCBT_KEYSKIPPED 7
|
#define HCBT_KEYSKIPPED 7
|
||||||
#define HCBT_SYSCOMMAND 8
|
#define HCBT_SYSCOMMAND 8
|
||||||
#define HCBT_SETFOCUS 9
|
#define HCBT_SETFOCUS 9
|
||||||
|
|
||||||
|
/* Predefined Clipboard Formats */
|
||||||
#define CF_TEXT 1
|
#define CF_TEXT 1
|
||||||
#define CF_BITMAP 2
|
#define CF_BITMAP 2
|
||||||
#define CF_METAFILEPICT 3
|
#define CF_METAFILEPICT 3
|
||||||
|
@ -68,9 +70,24 @@ extern "C" {
|
||||||
#define CF_WAVE 12
|
#define CF_WAVE 12
|
||||||
#define CF_UNICODETEXT 13
|
#define CF_UNICODETEXT 13
|
||||||
#define CF_ENHMETAFILE 14
|
#define CF_ENHMETAFILE 14
|
||||||
|
|
||||||
|
#if(WINVER >= 0x0400)
|
||||||
#define CF_HDROP 15
|
#define CF_HDROP 15
|
||||||
#define CF_LOCALE 16
|
#define CF_LOCALE 16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if(WINVER >= 0x0500)
|
||||||
|
#define CF_DIBV5 17
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if(WINVER >= 0x0500)
|
||||||
|
#define CF_MAX 18
|
||||||
|
#elif(WINVER >= 0x0400)
|
||||||
#define CF_MAX 17
|
#define CF_MAX 17
|
||||||
|
#else
|
||||||
|
#define CF_MAX 15
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CF_OWNERDISPLAY 128
|
#define CF_OWNERDISPLAY 128
|
||||||
#define CF_DSPTEXT 129
|
#define CF_DSPTEXT 129
|
||||||
#define CF_DSPBITMAP 130
|
#define CF_DSPBITMAP 130
|
||||||
|
@ -80,6 +97,7 @@ extern "C" {
|
||||||
#define CF_PRIVATELAST 767
|
#define CF_PRIVATELAST 767
|
||||||
#define CF_GDIOBJFIRST 768
|
#define CF_GDIOBJFIRST 768
|
||||||
#define CF_GDIOBJLAST 1023
|
#define CF_GDIOBJLAST 1023
|
||||||
|
|
||||||
#define HKL_NEXT 1
|
#define HKL_NEXT 1
|
||||||
#define HKL_PREV 0
|
#define HKL_PREV 0
|
||||||
#define KLF_ACTIVATE 1
|
#define KLF_ACTIVATE 1
|
||||||
|
|
|
@ -123,6 +123,11 @@ NtUserEnableMenuItem(
|
||||||
UINT uIDEnableItem,
|
UINT uIDEnableItem,
|
||||||
UINT uEnable);
|
UINT uEnable);
|
||||||
|
|
||||||
|
UINT
|
||||||
|
NTAPI
|
||||||
|
NtUserEnumClipboardFormats(
|
||||||
|
UINT format);
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
NTAPI
|
NTAPI
|
||||||
NtUserInsertMenuItem(
|
NtUserInsertMenuItem(
|
||||||
|
@ -1038,6 +1043,11 @@ NTAPI
|
||||||
NtUserGetKeyState(
|
NtUserGetKeyState(
|
||||||
DWORD Unknown0);
|
DWORD Unknown0);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
NTAPI
|
||||||
|
NtUserGetLastInputInfo(
|
||||||
|
PLASTINPUTINFO plii);
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
NTAPI
|
NTAPI
|
||||||
NtUserGetListBoxInfo(
|
NtUserGetListBoxInfo(
|
||||||
|
@ -1440,6 +1450,11 @@ NtUserRegisterClassEx(
|
||||||
DWORD Flags,
|
DWORD Flags,
|
||||||
HMENU hMenu);
|
HMENU hMenu);
|
||||||
|
|
||||||
|
UINT
|
||||||
|
NTAPI
|
||||||
|
NtUserRegisterClipboardFormat(
|
||||||
|
PUNICODE_STRING format);
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
NTAPI
|
NTAPI
|
||||||
NtUserRegisterHotKey(HWND hWnd,
|
NtUserRegisterHotKey(HWND hWnd,
|
||||||
|
|
|
@ -1,7 +1,48 @@
|
||||||
#ifndef _WIN32K_CLIPBOARD_H
|
#ifndef _WIN32K_CLIPBOARD_H
|
||||||
#define _WIN32K_CLIPBOARD_H
|
#define _WIN32K_CLIPBOARD_H
|
||||||
|
|
||||||
|
#include "window.h"
|
||||||
|
|
||||||
|
VOID FASTCALL IntIncrementSecuenceNumber(VOID);
|
||||||
|
|
||||||
|
typedef struct _ClipboardChainElement
|
||||||
|
{
|
||||||
|
PWINDOW_OBJECT window;
|
||||||
|
struct _ClipboardChainElement *next;
|
||||||
|
} CLIPBOARDCHAINELEMENT, *PCLIPBOARDCHAINELEMENT;
|
||||||
|
|
||||||
|
typedef struct _ClipboardElement
|
||||||
|
{
|
||||||
|
UINT format;
|
||||||
|
HANDLE hData;
|
||||||
|
DWORD size; // data may be delayed o synth render
|
||||||
|
struct _ClipboardElement *next;
|
||||||
|
} CLIPBOARDELEMENT, *PCLIPBOARDELEMENT;
|
||||||
|
|
||||||
|
typedef struct _CLIPBOARDSYSTEM
|
||||||
|
{
|
||||||
|
PW32THREAD ClipboardThread;
|
||||||
|
PW32THREAD ClipboardOwnerThread;
|
||||||
|
PWINDOW_OBJECT ClipboardWindow;
|
||||||
|
PWINDOW_OBJECT ClipboardViewerWindow;
|
||||||
|
PWINDOW_OBJECT ClipboardOwnerWindow;
|
||||||
|
BOOL sendDrawClipboardMsg;
|
||||||
|
BOOL recentlySetClipboard;
|
||||||
|
BOOL delayedRender;
|
||||||
|
UINT lastEnumClipboardFormats;
|
||||||
|
DWORD ClipboardSequenceNumber;
|
||||||
|
|
||||||
|
PCLIPBOARDCHAINELEMENT WindowsChain;
|
||||||
|
PCLIPBOARDELEMENT ClipboardData;
|
||||||
|
|
||||||
|
PCHAR synthesizedData;
|
||||||
|
DWORD synthesizedDataSize;
|
||||||
|
|
||||||
|
} CLIPBOARDSYSTEM, *PCLIPBOARDSYSTEM;
|
||||||
|
|
||||||
|
/*
|
||||||
UINT FASTCALL
|
UINT FASTCALL
|
||||||
IntEnumClipboardFormats(UINT format);
|
IntEnumClipboardFormats(UINT format);
|
||||||
|
*/
|
||||||
|
|
||||||
#endif /* _WIN32K_CLIPBOARD_H */
|
#endif /* _WIN32K_CLIPBOARD_H */
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define _WIN32K_WINSTA_H
|
#define _WIN32K_WINSTA_H
|
||||||
|
|
||||||
#include "msgqueue.h"
|
#include "msgqueue.h"
|
||||||
|
#include "clipboard.h"
|
||||||
|
|
||||||
#define WINSTA_ROOT_NAME L"\\Windows\\WindowStations"
|
#define WINSTA_ROOT_NAME L"\\Windows\\WindowStations"
|
||||||
#define WINSTA_ROOT_NAME_LENGTH 23
|
#define WINSTA_ROOT_NAME_LENGTH 23
|
||||||
|
@ -45,7 +46,10 @@ typedef struct _WINSTATION_OBJECT
|
||||||
|
|
||||||
ULONG Flags;
|
ULONG Flags;
|
||||||
struct _DESKTOP_OBJECT* ActiveDesktop;
|
struct _DESKTOP_OBJECT* ActiveDesktop;
|
||||||
/* FIXME: Clipboard */
|
|
||||||
|
PCLIPBOARDSYSTEM Clipboard;
|
||||||
|
DWORD ClipboardSequenceNumber;
|
||||||
|
|
||||||
} WINSTATION_OBJECT, *PWINSTATION_OBJECT;
|
} WINSTATION_OBJECT, *PWINSTATION_OBJECT;
|
||||||
|
|
||||||
extern WINSTATION_OBJECT *InputWindowStation;
|
extern WINSTATION_OBJECT *InputWindowStation;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -308,10 +308,10 @@ NtUserCallOneParam(
|
||||||
|
|
||||||
case ONEPARAM_ROUTINE_SETCARETBLINKTIME:
|
case ONEPARAM_ROUTINE_SETCARETBLINKTIME:
|
||||||
RETURN( (DWORD)IntSetCaretBlinkTime((UINT)Param));
|
RETURN( (DWORD)IntSetCaretBlinkTime((UINT)Param));
|
||||||
|
/*
|
||||||
case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS:
|
case ONEPARAM_ROUTINE_ENUMCLIPBOARDFORMATS:
|
||||||
RETURN( (DWORD)IntEnumClipboardFormats((UINT)Param));
|
RETURN( (DWORD)NtUserEnumClipboardFormats((UINT)Param));
|
||||||
|
*/
|
||||||
case ONEPARAM_ROUTINE_GETWINDOWINSTANCE:
|
case ONEPARAM_ROUTINE_GETWINDOWINSTANCE:
|
||||||
{
|
{
|
||||||
PWINDOW_OBJECT Window;
|
PWINDOW_OBJECT Window;
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
RTL_ATOM FASTCALL
|
RTL_ATOM FASTCALL
|
||||||
IntAddAtom(LPWSTR AtomName)
|
IntAddAtom(LPWSTR AtomName)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
RTL_ATOM Atom;
|
RTL_ATOM Atom;
|
||||||
|
|
||||||
|
@ -41,9 +40,9 @@ IntAddAtom(LPWSTR AtomName)
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return (RTL_ATOM)0;
|
return (RTL_ATOM)0;
|
||||||
}
|
}
|
||||||
WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
|
||||||
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
|
Status = RtlAddAtomToAtomTable(gAtomTable, AtomName, &Atom);
|
||||||
AtomName, &Atom);
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
|
@ -55,7 +54,6 @@ IntAddAtom(LPWSTR AtomName)
|
||||||
ULONG FASTCALL
|
ULONG FASTCALL
|
||||||
IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize)
|
IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize)
|
||||||
{
|
{
|
||||||
PWINSTATION_OBJECT WinStaObject;
|
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
ULONG Size = nSize;
|
ULONG Size = nSize;
|
||||||
|
|
||||||
|
@ -64,9 +62,9 @@ IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize)
|
||||||
SetLastNtError(Status);
|
SetLastNtError(Status);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
WinStaObject = PsGetCurrentThreadWin32Thread()->Desktop->WindowStation;
|
|
||||||
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
Status = RtlQueryAtomInAtomTable(gAtomTable, nAtom, NULL, NULL, lpBuffer, &Size);
|
||||||
nAtom, NULL, NULL, lpBuffer, &Size);
|
|
||||||
if (Size < nSize)
|
if (Size < nSize)
|
||||||
*(lpBuffer + Size) = 0;
|
*(lpBuffer + Size) = 0;
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <w32k.h>
|
#include <w32k.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define YDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
/* dialog resources appear to pass this in 16 bits, handle them properly */
|
/* dialog resources appear to pass this in 16 bits, handle them properly */
|
||||||
|
@ -461,6 +461,8 @@ static LRESULT co_UserFreeWindow(PWINDOW_OBJECT Window,
|
||||||
|
|
||||||
UserDerefObject(Window);
|
UserDerefObject(Window);
|
||||||
|
|
||||||
|
IntClipboardFreeWindow(Window);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1888,17 +1890,19 @@ co_IntCreateWindowEx(DWORD dwExStyle,
|
||||||
/* Calculate the non-client size. */
|
/* Calculate the non-client size. */
|
||||||
MaxPos.x = Window->WindowRect.left;
|
MaxPos.x = Window->WindowRect.left;
|
||||||
MaxPos.y = Window->WindowRect.top;
|
MaxPos.y = Window->WindowRect.top;
|
||||||
|
|
||||||
|
|
||||||
DPRINT("IntCreateWindowEx(): About to get non-client size.\n");
|
DPRINT("IntCreateWindowEx(): About to get non-client size.\n");
|
||||||
/* WinPosGetNonClientSize SENDS THE WM_NCCALCSIZE message */
|
/* WinPosGetNonClientSize SENDS THE WM_NCCALCSIZE message */
|
||||||
Result = co_WinPosGetNonClientSize(Window,
|
Result = co_WinPosGetNonClientSize(Window,
|
||||||
&Window->WindowRect,
|
&Window->WindowRect,
|
||||||
&Window->ClientRect);
|
&Window->ClientRect);
|
||||||
|
|
||||||
|
|
||||||
IntGdiOffsetRect(&Window->WindowRect,
|
IntGdiOffsetRect(&Window->WindowRect,
|
||||||
MaxPos.x - Window->WindowRect.left,
|
MaxPos.x - Window->WindowRect.left,
|
||||||
MaxPos.y - Window->WindowRect.top);
|
MaxPos.y - Window->WindowRect.top);
|
||||||
|
|
||||||
|
|
||||||
if (NULL != ParentWindow)
|
if (NULL != ParentWindow)
|
||||||
{
|
{
|
||||||
/* link the window into the parent's child list */
|
/* link the window into the parent's child list */
|
||||||
|
|
|
@ -970,6 +970,8 @@ co_WinPosSetWindowPos(
|
||||||
|
|
||||||
WvrFlags = co_WinPosDoNCCALCSize(Window, &WinPos, &NewWindowRect, &NewClientRect);
|
WvrFlags = co_WinPosDoNCCALCSize(Window, &WinPos, &NewWindowRect, &NewClientRect);
|
||||||
|
|
||||||
|
//DPRINT1("co_WinPosDoNCCALCSize");
|
||||||
|
|
||||||
/* Relink windows. (also take into account shell window in hwndShellWindow) */
|
/* Relink windows. (also take into account shell window in hwndShellWindow) */
|
||||||
if (!(WinPos.flags & SWP_NOZORDER) && WinPos.hwnd != UserGetShellWindow())
|
if (!(WinPos.flags & SWP_NOZORDER) && WinPos.hwnd != UserGetShellWindow())
|
||||||
{
|
{
|
||||||
|
@ -1385,7 +1387,8 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SW_SHOWNOACTIVATE:
|
case SW_SHOWNOACTIVATE:
|
||||||
Swp |= SWP_NOZORDER;
|
//Swp |= SWP_NOZORDER;
|
||||||
|
Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
case SW_SHOWNORMAL:
|
case SW_SHOWNORMAL:
|
||||||
case SW_SHOWDEFAULT:
|
case SW_SHOWDEFAULT:
|
||||||
|
@ -1408,6 +1411,7 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowFlag = (Cmd != SW_HIDE);
|
ShowFlag = (Cmd != SW_HIDE);
|
||||||
|
|
||||||
if (ShowFlag != WasVisible)
|
if (ShowFlag != WasVisible)
|
||||||
{
|
{
|
||||||
co_IntSendMessage(Window->hSelf, WM_SHOWWINDOW, ShowFlag, 0);
|
co_IntSendMessage(Window->hSelf, WM_SHOWWINDOW, ShowFlag, 0);
|
||||||
|
@ -1477,6 +1481,7 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
|
||||||
MAKELONG(Window->ClientRect.left,
|
MAKELONG(Window->ClientRect.left,
|
||||||
Window->ClientRect.top));
|
Window->ClientRect.top));
|
||||||
IntEngWindowChanged(Window, WOC_RGN_CLIENT);
|
IntEngWindowChanged(Window, WOC_RGN_CLIENT);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Activate the window if activation is not requested and the window is not minimized */
|
/* Activate the window if activation is not requested and the window is not minimized */
|
||||||
|
|
|
@ -518,6 +518,12 @@ NtUserCreateWindowStation(
|
||||||
|
|
||||||
WindowStationObject->SystemCursor = CurInfo;
|
WindowStationObject->SystemCursor = CurInfo;
|
||||||
|
|
||||||
|
|
||||||
|
if (!IntSetupClipboard(WindowStationObject))
|
||||||
|
{
|
||||||
|
DPRINT1("WindowStation: Error Setting up the clipboard!!!\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (!IntSetupCurIconHandles(WindowStationObject))
|
if (!IntSetupCurIconHandles(WindowStationObject))
|
||||||
{
|
{
|
||||||
DPRINT1("Setting up the Cursor/Icon Handle table failed!\n");
|
DPRINT1("Setting up the Cursor/Icon Handle table failed!\n");
|
||||||
|
|
|
@ -342,6 +342,7 @@ NtUserEnableScrollBar 3
|
||||||
NtUserEndDeferWindowPosEx 2
|
NtUserEndDeferWindowPosEx 2
|
||||||
NtUserEndMenu 0
|
NtUserEndMenu 0
|
||||||
NtUserEndPaint 2
|
NtUserEndPaint 2
|
||||||
|
NtUserEnumClipboardFormats 1
|
||||||
NtUserEnumDisplayDevices 4
|
NtUserEnumDisplayDevices 4
|
||||||
NtUserEnumDisplayMonitors 5
|
NtUserEnumDisplayMonitors 5
|
||||||
NtUserEnumDisplaySettings 4
|
NtUserEnumDisplaySettings 4
|
||||||
|
@ -461,6 +462,7 @@ NtUserReleaseDC 2
|
||||||
NtUserRealChildWindowFromPoint 3
|
NtUserRealChildWindowFromPoint 3
|
||||||
NtUserRedrawWindow 4
|
NtUserRedrawWindow 4
|
||||||
NtUserRegisterClassEx 6
|
NtUserRegisterClassEx 6
|
||||||
|
NtUserRegisterClipboardFormat 1
|
||||||
NtUserRegisterHotKey 4
|
NtUserRegisterHotKey 4
|
||||||
NtUserRegisterTasklist 1
|
NtUserRegisterTasklist 1
|
||||||
NtUserRegisterWindowMessage 1
|
NtUserRegisterWindowMessage 1
|
||||||
|
|
Loading…
Reference in a new issue