mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[User32|Win32k]
- Properly implement RealGetWindowClass, fixes the ApiTest. Keeping the Ansi support for now, will use it as a reference. svn path=/trunk/; revision=51187
This commit is contained in:
parent
827e75cb89
commit
0bf0c70444
3 changed files with 40 additions and 29 deletions
|
@ -696,22 +696,20 @@ GetClassNameA(
|
|||
LPSTR lpClassName,
|
||||
int nMaxCount)
|
||||
{
|
||||
ANSI_STRING ClassName;
|
||||
int Result;
|
||||
WCHAR tmpbuf[MAX_ATOM_LEN + 1];
|
||||
int len;
|
||||
|
||||
ClassName.MaximumLength = nMaxCount;
|
||||
ClassName.Buffer = lpClassName;
|
||||
|
||||
Result = NtUserGetClassName(hWnd,
|
||||
(PUNICODE_STRING)&ClassName,
|
||||
TRUE);
|
||||
if (nMaxCount <= 0) return 0;
|
||||
if (!GetClassNameW( hWnd, tmpbuf, sizeof(tmpbuf)/sizeof(WCHAR) )) return 0;
|
||||
RtlUnicodeToMultiByteN( lpClassName, nMaxCount - 1, (PULONG)&len, tmpbuf, strlenW(tmpbuf) * sizeof(WCHAR) );
|
||||
lpClassName[len] = 0;
|
||||
|
||||
TRACE("%p class/atom: %s/%04x %x\n", hWnd,
|
||||
IS_ATOM(lpClassName) ? NULL : lpClassName,
|
||||
IS_ATOM(lpClassName) ? lpClassName : 0,
|
||||
nMaxCount);
|
||||
|
||||
return Result;
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
@ -732,8 +730,8 @@ GetClassNameW(
|
|||
ClassName.Buffer = lpClassName;
|
||||
|
||||
Result = NtUserGetClassName(hWnd,
|
||||
&ClassName,
|
||||
FALSE);
|
||||
FALSE,
|
||||
&ClassName);
|
||||
|
||||
TRACE("%p class/atom: %S/%04x %x\n", hWnd,
|
||||
IS_ATOM(lpClassName) ? NULL : lpClassName,
|
||||
|
@ -914,8 +912,11 @@ RealGetWindowClassW(
|
|||
LPWSTR pszType,
|
||||
UINT cchType)
|
||||
{
|
||||
/* FIXME: Implement correct functionality of RealGetWindowClass */
|
||||
return GetClassNameW(hwnd,pszType,cchType);
|
||||
UNICODE_STRING ClassName;
|
||||
ClassName.MaximumLength = cchType * sizeof(WCHAR);
|
||||
ClassName.Buffer = (PWSTR)pszType;
|
||||
|
||||
return NtUserGetClassName(hwnd,TRUE,&ClassName);
|
||||
}
|
||||
|
||||
|
||||
|
@ -929,8 +930,14 @@ RealGetWindowClassA(
|
|||
LPSTR pszType,
|
||||
UINT cchType)
|
||||
{
|
||||
/* FIXME: Implement correct functionality of RealGetWindowClass */
|
||||
return GetClassNameA(hwnd,pszType,cchType);
|
||||
WCHAR tmpbuf[MAX_ATOM_LEN + 1];
|
||||
UINT len;
|
||||
|
||||
if (cchType <= 0) return 0;
|
||||
if (!RealGetWindowClassW( hwnd, tmpbuf, sizeof(tmpbuf)/sizeof(WCHAR) )) return 0;
|
||||
RtlUnicodeToMultiByteN( pszType, cchType - 1, (PULONG)&len, tmpbuf, strlenW(tmpbuf) * sizeof(WCHAR) );
|
||||
pszType[len] = 0;
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1761,18 +1761,11 @@ NtUserGetClassInfo(HINSTANCE hInstance,
|
|||
LPWSTR *ppszMenuName,
|
||||
BOOL Ansi);
|
||||
|
||||
INT
|
||||
NTAPI
|
||||
NtUserGetClassName(HWND hWnd,
|
||||
PUNICODE_STRING ClassName,
|
||||
BOOL Ansi);
|
||||
#if 0 // Real NtUserGetClassName
|
||||
INT
|
||||
NTAPI
|
||||
NtUserGetClassName(HWND hWnd,
|
||||
BOOL Real, // 0 GetClassNameW, 1 RealGetWindowClassA/W
|
||||
PUNICODE_STRING ClassName);
|
||||
#endif
|
||||
|
||||
HANDLE
|
||||
NTAPI
|
||||
|
|
|
@ -1398,6 +1398,7 @@ UserUnregisterClass(IN PUNICODE_STRING ClassName,
|
|||
INT
|
||||
UserGetClassName(IN PCLS Class,
|
||||
IN OUT PUNICODE_STRING ClassName,
|
||||
IN RTL_ATOM Atom,
|
||||
IN BOOL Ansi)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
@ -1451,7 +1452,7 @@ UserGetClassName(IN PCLS Class,
|
|||
|
||||
/* query the class name */
|
||||
Status = RtlQueryAtomInAtomTable(gAtomTable,
|
||||
Class->atomClassName,
|
||||
Atom ? Atom : Class->atomClassName,
|
||||
NULL,
|
||||
NULL,
|
||||
szTemp,
|
||||
|
@ -1485,7 +1486,7 @@ UserGetClassName(IN PCLS Class,
|
|||
|
||||
/* query the atom name */
|
||||
Status = RtlQueryAtomInAtomTable(gAtomTable,
|
||||
Class->atomClassName,
|
||||
Atom ? Atom : Class->atomClassName,
|
||||
NULL,
|
||||
NULL,
|
||||
ClassName->Buffer,
|
||||
|
@ -2376,18 +2377,27 @@ NtUserGetClassInfo(
|
|||
|
||||
INT APIENTRY
|
||||
NtUserGetClassName (IN HWND hWnd,
|
||||
OUT PUNICODE_STRING ClassName,
|
||||
IN BOOL Ansi)
|
||||
IN BOOL Real,
|
||||
OUT PUNICODE_STRING ClassName)
|
||||
{
|
||||
PWND Window;
|
||||
UNICODE_STRING CapturedClassName;
|
||||
INT Ret = 0;
|
||||
INT iCls, Ret = 0;
|
||||
RTL_ATOM Atom = 0;
|
||||
|
||||
UserEnterShared();
|
||||
|
||||
Window = UserGetWindowObject(hWnd);
|
||||
if (Window != NULL)
|
||||
{
|
||||
if (Real && Window->fnid && !(Window->fnid & FNID_DESTROY))
|
||||
{
|
||||
if (LookupFnIdToiCls(Window->fnid, &iCls))
|
||||
{
|
||||
Atom = gpsi->atomSysClass[iCls];
|
||||
}
|
||||
}
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
ProbeForWriteUnicodeString(ClassName);
|
||||
|
@ -2396,7 +2406,8 @@ NtUserGetClassName (IN HWND hWnd,
|
|||
/* get the class name */
|
||||
Ret = UserGetClassName(Window->pcls,
|
||||
&CapturedClassName,
|
||||
Ansi);
|
||||
Atom,
|
||||
FALSE);
|
||||
|
||||
if (Ret != 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue