mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:53:02 +00:00
- Implementation of [NtUser]GetClipboardFormatName[A/W].
svn path=/trunk/; revision=7044
This commit is contained in:
parent
ca0cd5480e
commit
41b0a75f9a
6 changed files with 133 additions and 25 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: clipboard.c,v 1.8 2003/12/14 13:55:01 weiden Exp $
|
||||
/* $Id: clipboard.c,v 1.9 2003/12/14 17:59:15 navaraf Exp $
|
||||
*
|
||||
* PROJECT: ReactOS user32.dll
|
||||
* FILE: lib/user32/windows/input.c
|
||||
|
@ -110,8 +110,10 @@ GetClipboardFormatNameA(UINT format, LPSTR lpszFormatName, int cchMaxCount)
|
|||
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
|
||||
FormatName.Buffer = lpBuffer;
|
||||
Length = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
||||
DbgPrint("GetClipboardFormatNameA(%x): %S\n", format, lpBuffer);
|
||||
HEAP_strcpyWtoA(lpszFormatName, lpBuffer, Length);
|
||||
HEAP_free(lpBuffer);
|
||||
DbgPrint("GetClipboardFormatNameA(%x): returning %s\n", format, lpszFormatName);
|
||||
|
||||
return Length;
|
||||
}
|
||||
|
@ -123,11 +125,14 @@ INT STDCALL
|
|||
GetClipboardFormatNameW(UINT format, LPWSTR lpszFormatName, INT cchMaxCount)
|
||||
{
|
||||
UNICODE_STRING FormatName;
|
||||
ULONG Ret;
|
||||
|
||||
FormatName.Length = 0;
|
||||
FormatName.MaximumLength = cchMaxCount * sizeof(WCHAR);
|
||||
FormatName.Buffer = (PWSTR)lpszFormatName;
|
||||
return NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
||||
Ret = NtUserGetClipboardFormatName(format, &FormatName, cchMaxCount);
|
||||
DbgPrint("GetClipboardFormatNameW(%x): returning %S\n", format, lpszFormatName);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -190,7 +195,9 @@ IsClipboardFormatAvailable(UINT format)
|
|||
UINT STDCALL
|
||||
RegisterClipboardFormatA(LPCSTR lpszFormat)
|
||||
{
|
||||
return RegisterWindowMessageA(lpszFormat);
|
||||
ULONG Ret = RegisterWindowMessageA(lpszFormat);
|
||||
DbgPrint("RegisterClipboardFormatA(%s) - %x\n", lpszFormat, Ret);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -199,7 +206,9 @@ RegisterClipboardFormatA(LPCSTR lpszFormat)
|
|||
UINT STDCALL
|
||||
RegisterClipboardFormatW(LPCWSTR lpszFormat)
|
||||
{
|
||||
return RegisterClipboardFormatW(lpszFormat);
|
||||
ULONG Ret = RegisterClipboardFormatW(lpszFormat);
|
||||
DbgPrint("RegisterClipboardFormatW(%S) - %x\n", lpszFormat, Ret);
|
||||
return Ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
11
reactos/subsys/win32k/include/useratom.h
Normal file
11
reactos/subsys/win32k/include/useratom.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef _WIN32K_USERATOM_H
|
||||
#define _WIN32K_USERATOM_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
RTL_ATOM FASTCALL
|
||||
IntAddAtom(LPWSTR AtomName);
|
||||
ULONG FASTCALL
|
||||
IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize);
|
||||
|
||||
#endif /* _WIN32K_USERATOM_H */
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.89 2003/12/14 12:39:32 navaraf Exp $
|
||||
# $Id: makefile,v 1.90 2003/12/14 17:59:16 navaraf Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
|
@ -54,8 +54,9 @@ NTUSER_OBJECTS = ntuser/accelerator.o ntuser/callback.o ntuser/caret.o ntuser/cl
|
|||
ntuser/hook.o ntuser/hotkey.o ntuser/input.o ntuser/keyboard.o \
|
||||
ntuser/menu.o ntuser/message.o ntuser/metric.o ntuser/misc.o \
|
||||
ntuser/msgqueue.o ntuser/painting.o ntuser/prop.o ntuser/scrollbar.o \
|
||||
ntuser/stubs.o ntuser/timer.o ntuser/vis.o ntuser/windc.o \
|
||||
ntuser/window.o ntuser/winlock.o ntuser/winpos.o ntuser/winsta.o
|
||||
ntuser/stubs.o ntuser/timer.o ntuser/useratom.o ntuser/vis.o \
|
||||
ntuser/windc.o ntuser/window.o ntuser/winlock.o ntuser/winpos.o \
|
||||
ntuser/winsta.o
|
||||
|
||||
OBJECTS_OBJECTS = objects/bitmaps.o objects/brush.o objects/cliprgn.o \
|
||||
objects/color.o objects/coord.o objects/dc.o \
|
||||
|
|
|
@ -24,14 +24,13 @@
|
|||
* PROGRAMER: Filip Navara <xnavara@volny.cz>
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ddk/ntddmou.h>
|
||||
#include <win32k/win32k.h>
|
||||
#include <windows.h>
|
||||
#include <internal/safe.h>
|
||||
#include <include/clipboard.h>
|
||||
#include <include/cleanup.h>
|
||||
#include <include/error.h>
|
||||
#include <include/useratom.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
@ -40,11 +39,11 @@ PW32THREAD ClipboardThread;
|
|||
HWND ClipboardWindow;
|
||||
#endif
|
||||
|
||||
INT FASTCALL
|
||||
ULONG FASTCALL
|
||||
IntGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
return IntGetAtomName((RTL_ATOM)format, FormatName->Buffer,
|
||||
FormatName->MaximumLength);
|
||||
}
|
||||
|
||||
UINT FASTCALL
|
||||
|
@ -132,10 +131,11 @@ INT STDCALL
|
|||
NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
|
||||
INT cchMaxCount)
|
||||
{
|
||||
INT Ret;
|
||||
#if 1
|
||||
NTSTATUS Status;
|
||||
PWSTR Buf;
|
||||
UNICODE_STRING SafeFormatName, BufFormatName;
|
||||
ULONG Ret;
|
||||
|
||||
if((cchMaxCount < 1) || !FormatName)
|
||||
{
|
||||
|
@ -196,6 +196,9 @@ NtUserGetClipboardFormatName(UINT format, PUNICODE_STRING FormatName,
|
|||
|
||||
ExFreePool(Buf);
|
||||
return Ret;
|
||||
#else
|
||||
return IntGetClipboardFormatName(format, FormatName);
|
||||
#endif
|
||||
}
|
||||
|
||||
HWND STDCALL
|
||||
|
|
85
reactos/subsys/win32k/ntuser/useratom.c
Normal file
85
reactos/subsys/win32k/ntuser/useratom.c
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* ReactOS W32 Subsystem
|
||||
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 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.
|
||||
*/
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* PURPOSE: User Atom helper routines
|
||||
* FILE: subsys/win32k/ntuser/useratom.c
|
||||
* PROGRAMER: Filip Navara <xnavara@volny.cz>
|
||||
*/
|
||||
|
||||
#include <include/useratom.h>
|
||||
#include <include/winsta.h>
|
||||
#include <include/error.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
RTL_ATOM FASTCALL
|
||||
IntAddAtom(LPWSTR AtomName)
|
||||
{
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
NTSTATUS Status;
|
||||
RTL_ATOM Atom;
|
||||
|
||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||
KernelMode, 0, &WinStaObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return (RTL_ATOM)0;
|
||||
}
|
||||
Status = RtlAddAtomToAtomTable(WinStaObject->AtomTable,
|
||||
AtomName, &Atom);
|
||||
ObDereferenceObject(WinStaObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return (RTL_ATOM)0;
|
||||
}
|
||||
return Atom;
|
||||
}
|
||||
|
||||
ULONG FASTCALL
|
||||
IntGetAtomName(RTL_ATOM nAtom, LPWSTR lpBuffer, ULONG nSize)
|
||||
{
|
||||
PWINSTATION_OBJECT WinStaObject;
|
||||
NTSTATUS Status;
|
||||
ULONG Size = nSize;
|
||||
|
||||
Status = IntValidateWindowStationHandle(PROCESS_WINDOW_STATION(),
|
||||
KernelMode, 0, &WinStaObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return 0;
|
||||
}
|
||||
Status = RtlQueryAtomInAtomTable(WinStaObject->AtomTable,
|
||||
nAtom, NULL, NULL, lpBuffer, &Size);
|
||||
if (Size < nSize)
|
||||
*(lpBuffer + Size) = 0;
|
||||
ObDereferenceObject(WinStaObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastNtError(Status);
|
||||
return 0;
|
||||
}
|
||||
return Size;
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: window.c,v 1.162 2003/12/14 14:26:50 weiden Exp $
|
||||
/* $Id: window.c,v 1.163 2003/12/14 17:59:16 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -51,6 +51,7 @@
|
|||
#include <include/hotkey.h>
|
||||
#include <include/focus.h>
|
||||
#include <include/hook.h>
|
||||
#include <include/useratom.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <win32k/debug1.h>
|
||||
|
@ -58,18 +59,8 @@
|
|||
|
||||
#define TAG_WNAM TAG('W', 'N', 'A', 'M')
|
||||
|
||||
typedef struct _REGISTERED_MESSAGE
|
||||
{
|
||||
LIST_ENTRY ListEntry;
|
||||
WCHAR MessageName[1];
|
||||
} REGISTERED_MESSAGE, *PREGISTERED_MESSAGE;
|
||||
|
||||
static LIST_ENTRY RegisteredMessageListHead;
|
||||
static WndProcHandle *WndProcHandlesArray = 0;
|
||||
static WORD WndProcHandlesArraySize = 0;
|
||||
|
||||
#define REGISTERED_MESSAGE_MIN 0xc000
|
||||
#define REGISTERED_MESSAGE_MAX 0xffff
|
||||
#define WPH_SIZE 0x40 /* the size to add to the WndProcHandle array each time */
|
||||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
@ -83,7 +74,6 @@ static WORD WndProcHandlesArraySize = 0;
|
|||
NTSTATUS FASTCALL
|
||||
InitWindowImpl(VOID)
|
||||
{
|
||||
InitializeListHead(&RegisteredMessageListHead);
|
||||
WndProcHandlesArray = ExAllocatePool(PagedPool,WPH_SIZE * sizeof(WndProcHandle));
|
||||
WndProcHandlesArraySize = WPH_SIZE;
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -2790,6 +2780,7 @@ NtUserRealChildWindowFromPoint(DWORD Unknown0,
|
|||
UINT STDCALL
|
||||
NtUserRegisterWindowMessage(PUNICODE_STRING MessageNameUnsafe)
|
||||
{
|
||||
#if 0
|
||||
PLIST_ENTRY Current;
|
||||
PREGISTERED_MESSAGE NewMsg, RegMsg;
|
||||
UINT Msg = REGISTERED_MESSAGE_MIN;
|
||||
|
@ -2851,6 +2842,14 @@ NtUserRegisterWindowMessage(PUNICODE_STRING MessageNameUnsafe)
|
|||
InsertTailList(&RegisteredMessageListHead, &(NewMsg->ListEntry));
|
||||
|
||||
return Msg;
|
||||
#else
|
||||
/*
|
||||
* Notes:
|
||||
* - There's no need to call MmSafe*, because it should be done in kernel.
|
||||
* - The passed UNICODE_STRING is expected to be NULL-terminated.
|
||||
*/
|
||||
return (UINT)IntAddAtom(MessageNameUnsafe->Buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue