mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 05:01:31 +00:00
Patch by Pablo Borobia <pablog7@argentina.com>
Work on clipboard. svn path=/trunk/; revision=9590
This commit is contained in:
parent
08108f008e
commit
07320b09dd
1 changed files with 116 additions and 48 deletions
|
@ -29,14 +29,23 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#if 0
|
#define CHECK_LOCK \
|
||||||
|
if (ClipboardThread && ClipboardThread != PsGetWin32Thread()) \
|
||||||
|
{ \
|
||||||
|
SetLastWin32Error(ERROR_LOCKED); \
|
||||||
|
return FALSE; \
|
||||||
|
}
|
||||||
|
|
||||||
PW32THREAD ClipboardThread;
|
PW32THREAD ClipboardThread;
|
||||||
HWND ClipboardWindow;
|
HWND ClipboardWindow;
|
||||||
#endif
|
HWND tempClipboardWindow;
|
||||||
|
HANDLE hCBData;
|
||||||
|
UINT uCBFormat;
|
||||||
|
|
||||||
ULONG FASTCALL
|
ULONG FASTCALL
|
||||||
IntGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName)
|
IntGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName)
|
||||||
{
|
{
|
||||||
|
|
||||||
return IntGetAtomName((RTL_ATOM)format, FormatName->Buffer,
|
return IntGetAtomName((RTL_ATOM)format, FormatName->Buffer,
|
||||||
FormatName->MaximumLength);
|
FormatName->MaximumLength);
|
||||||
}
|
}
|
||||||
|
@ -44,44 +53,33 @@ IntGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName)
|
||||||
UINT FASTCALL
|
UINT FASTCALL
|
||||||
IntEnumClipboardFormats(UINT format)
|
IntEnumClipboardFormats(UINT format)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
|
||||||
return 0;
|
CHECK_LOCK
|
||||||
|
|
||||||
|
if (!hCBData)
|
||||||
|
return FALSE;
|
||||||
|
//UNIMPLEMENTED;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserOpenClipboard(HWND hWnd, DWORD Unknown1)
|
NtUserOpenClipboard(HWND hWnd, DWORD Unknown1)
|
||||||
{
|
{
|
||||||
#if 0
|
CHECK_LOCK
|
||||||
if (ClipboardThread && ClipboardThread != PsGetWin32Thread())
|
|
||||||
{
|
tempClipboardWindow = hWnd;
|
||||||
SetLastWin32Error(ERROR_LOCKED);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
ClipboardWindow = hWnd;
|
|
||||||
ClipboardThread = PsGetWin32Thread();
|
ClipboardThread = PsGetWin32Thread();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#else
|
|
||||||
DPRINT1("NtUserOpenClipboard is unimplemented\n");
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserCloseClipboard(VOID)
|
NtUserCloseClipboard(VOID)
|
||||||
{
|
{
|
||||||
#if 0
|
CHECK_LOCK
|
||||||
if (ClipboardThread && ClipboardThread != PsGetWin32Thread())
|
|
||||||
{
|
|
||||||
SetLastWin32Error(ERROR_LOCKED);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
ClipboardWindow = 0;
|
ClipboardWindow = 0;
|
||||||
ClipboardThread = NULL;
|
ClipboardThread = NULL;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#else
|
|
||||||
UNIMPLEMENTED
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -90,8 +88,11 @@ NtUserCloseClipboard(VOID)
|
||||||
HWND STDCALL
|
HWND STDCALL
|
||||||
NtUserGetOpenClipboardWindow(VOID)
|
NtUserGetOpenClipboardWindow(VOID)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
UNIMPLEMENTED
|
UNIMPLEMENTED
|
||||||
return 0;
|
return 0;
|
||||||
|
*/
|
||||||
|
return ClipboardWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
|
@ -111,22 +112,39 @@ NtUserCountClipboardFormats(VOID)
|
||||||
DWORD STDCALL
|
DWORD STDCALL
|
||||||
NtUserEmptyClipboard(VOID)
|
NtUserEmptyClipboard(VOID)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
CHECK_LOCK
|
||||||
return 0;
|
|
||||||
|
// if (!hCBData)
|
||||||
|
// return FALSE;
|
||||||
|
|
||||||
|
// FIXME!
|
||||||
|
// GlobalUnlock(hCBData);
|
||||||
|
// GlobalFree(hCBData);
|
||||||
|
hCBData = NULL;
|
||||||
|
uCBFormat = 0;
|
||||||
|
ClipboardWindow = tempClipboardWindow;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE STDCALL
|
HANDLE STDCALL
|
||||||
NtUserGetClipboardData(UINT uFormat, DWORD Unknown1)
|
NtUserGetClipboardData(UINT uFormat, DWORD Unknown1)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
CHECK_LOCK
|
||||||
return 0;
|
|
||||||
|
if ((uFormat==1 && uCBFormat==13) || (uFormat==13 && uCBFormat==1))
|
||||||
|
uCBFormat = uFormat;
|
||||||
|
|
||||||
|
if (uFormat != uCBFormat)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return hCBData;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT STDCALL
|
INT STDCALL
|
||||||
NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
|
NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
|
||||||
INT cchMaxCount)
|
INT cchMaxCount)
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PWSTR Buf;
|
PWSTR Buf;
|
||||||
UNICODE_STRING SafeFormatName, BufFormatName;
|
UNICODE_STRING SafeFormatName, BufFormatName;
|
||||||
|
@ -166,7 +184,15 @@ NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (format >= 0xC000)
|
||||||
|
{
|
||||||
Ret = IntGetClipboardFormatName(format, &BufFormatName);
|
Ret = IntGetClipboardFormatName(format, &BufFormatName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetLastNtError(NO_ERROR);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* copy the UNICODE_STRING buffer back to the user */
|
/* copy the UNICODE_STRING buffer back to the user */
|
||||||
Status = MmCopyToCaller(SafeFormatName.Buffer, BufFormatName.Buffer, BufFormatName.MaximumLength);
|
Status = MmCopyToCaller(SafeFormatName.Buffer, BufFormatName.Buffer, BufFormatName.MaximumLength);
|
||||||
|
@ -191,9 +217,6 @@ NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
|
||||||
|
|
||||||
ExFreePool(Buf);
|
ExFreePool(Buf);
|
||||||
return Ret;
|
return Ret;
|
||||||
#else
|
|
||||||
return IntGetClipboardFormatName(format, FormatName);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND STDCALL
|
HWND STDCALL
|
||||||
|
@ -227,15 +250,60 @@ NtUserGetPriorityClipboardFormat(UINT *paFormatPriorityList, INT cFormats)
|
||||||
BOOL STDCALL
|
BOOL STDCALL
|
||||||
NtUserIsClipboardFormatAvailable(UINT format)
|
NtUserIsClipboardFormatAvailable(UINT format)
|
||||||
{
|
{
|
||||||
DPRINT1("FIXME: NtUserIsClipboardFormatAvailable() is not implemented\n");
|
//UNIMPLEMENTED
|
||||||
return 0;
|
|
||||||
|
if (format != 1 && format != 13) {
|
||||||
|
DbgPrint("Clipboard Format unavailable (%d)\n", format);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((format==1 && uCBFormat==13) || (format==13 && uCBFormat==1))
|
||||||
|
uCBFormat = format;
|
||||||
|
|
||||||
|
if (format != uCBFormat)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//SetClipboardData(CF_UNICODETEXT, hdst);
|
||||||
HANDLE STDCALL
|
HANDLE STDCALL
|
||||||
NtUserSetClipboardData(UINT uFormat, HANDLE hMem, DWORD Unknown2)
|
NtUserSetClipboardData(UINT uFormat, HANDLE hMem, DWORD Unknown2)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED
|
// LPVOID pMem;
|
||||||
return 0;
|
CHECK_LOCK
|
||||||
|
|
||||||
|
|
||||||
|
if (uFormat != 1 && uFormat != 13) {
|
||||||
|
DbgPrint("Clipboard unsupported format (%d)\n", uFormat);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hMem)
|
||||||
|
{
|
||||||
|
uCBFormat = uFormat;
|
||||||
|
hCBData = hMem;
|
||||||
|
//pMem = GlobalLock(hMem);
|
||||||
|
/*
|
||||||
|
switch (uFormat) {
|
||||||
|
default:
|
||||||
|
DbgPrint("Clipboard unsupported format (%d)\n", uFormat);
|
||||||
|
return FALSE;
|
||||||
|
case CF_TEXT: // 1
|
||||||
|
break;
|
||||||
|
case CF_UNICODETEXT: // 13
|
||||||
|
break;
|
||||||
|
case CF_BITMAP: // 2
|
||||||
|
break;
|
||||||
|
case CF_OEMTEXT: // 7
|
||||||
|
break;
|
||||||
|
} */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//the window provides data in the specified format
|
||||||
|
}
|
||||||
|
return hMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
HWND STDCALL
|
HWND STDCALL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue