This change breaks mIRC.
By the way:
1) Congratulations on the fact it took two weeks for someone to report this on BZ
And
2) Even more congratulations on the fact that it's been another week since then, and nobody has: 2.1) Emailed the ros-dev about this yet 2.2) And/or reverted this change.
Let's try to ignore this until 0.3.6, to make sure that we ship with a broken release.
On 25-May-08, at 1:36 AM, gbrunmar@svn.reactos.org wrote:
Author: gbrunmar Date: Sun May 25 03:36:30 2008 New Revision: 33689
URL: http://svn.reactos.org/svn/reactos?rev=33689&view=rev Log:
- Changed to correct signature of NtUserGetClassName()
- Implemented correct behaviour in GetRealWindowClass(), but in
reality just shifted the todo parts to NtUserGetClassName() instead.
Modified: trunk/reactos/dll/win32/user32/windows/class.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/ntuser/class.c
Modified: trunk/reactos/dll/win32/user32/windows/class.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/cl... = = = = = = = = ====================================================================== --- trunk/reactos/dll/win32/user32/windows/class.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/class.c [iso-8859-1] Sun May 25 03:36:30 2008 @@ -421,15 +421,22 @@ LPSTR lpClassName, int nMaxCount) {
- ANSI_STRING ClassName;
- int Result;
- ClassName.MaximumLength = nMaxCount;
- ClassName.Buffer = lpClassName;
- Result = NtUserGetClassName(hWnd,
(PUNICODE_STRING)&ClassName,TRUE);
- UNICODE_STRING ClassName;
- INT Result;
- ClassName.MaximumLength = nMaxCount * sizeof(WCHAR);
- ClassName.Buffer = LocalAlloc(LMEM_FIXED,
ClassName.MaximumLength);
- if (ClassName.Buffer == NULL)
- {
SetLastError(ERROR_NOT_ENOUGH_MEMORY);return 0;- }
- Result = NtUserGetClassName(hWnd, FALSE, &ClassName);
- WideCharToMultiByte(CP_ACP, 0, ClassName.Buffer, Result,
lpClassName, nMaxCount - 1, NULL, NULL);
lpClassName[nMaxCount - 1] = '\0';
LocalFree(ClassName.Buffer);
TRACE("%p class/atom: %s/%04x %x\n", hWnd, IS_ATOM(lpClassName) ? NULL : lpClassName,
@@ -456,9 +463,7 @@ ClassName.MaximumLength = nMaxCount * sizeof(WCHAR); ClassName.Buffer = lpClassName;
- Result = NtUserGetClassName(hWnd,
&ClassName,FALSE);
Result = NtUserGetClassName(hWnd, FALSE, &ClassName);
TRACE("%p class/atom: %S/%04x %x\n", hWnd, IS_ATOM(lpClassName) ? NULL : lpClassName,
@@ -629,12 +634,24 @@ UINT STDCALL RealGetWindowClassW(
- HWND hwnd,
- HWND hWnd, LPWSTR pszType, UINT cchType)
{
- /* FIXME: Implement correct functionality of RealGetWindowClass */
- return GetClassNameW(hwnd,pszType,cchType);
- UNICODE_STRING ClassName;
- UINT Length;
- ClassName.MaximumLength = cchType * sizeof(WCHAR);
- ClassName.Buffer = pszType;
- Length = NtUserGetClassName(hWnd, TRUE, &ClassName);
- TRACE("%p class/atom: %S/%04x %x\n", hWnd,
IS_ATOM(pszType) ? NULL : pszType,IS_ATOM(pszType) ? pszType : 0,cchType);- return Length;
}
@@ -644,12 +661,33 @@ UINT STDCALL RealGetWindowClassA(
- HWND hwnd,
- HWND hWnd, LPSTR pszType, UINT cchType)
{
- /* FIXME: Implement correct functionality of RealGetWindowClass */
- return GetClassNameA(hwnd,pszType,cchType);
- UNICODE_STRING ClassName;
- UINT Length;
- ClassName.MaximumLength = cchType * sizeof(WCHAR);
- ClassName.Buffer = LocalAlloc(LMEM_FIXED,
ClassName.MaximumLength);
- if (ClassName.Buffer == NULL)
- {
SetLastError(ERROR_NOT_ENOUGH_MEMORY);return 0;- }
- Length = NtUserGetClassName(hWnd, TRUE, &ClassName);
- WideCharToMultiByte(CP_ACP, 0, ClassName.Buffer, Length,
pszType, cchType - 1, NULL, NULL);
- pszType[cchType - 1] = '\0';
- LocalFree(ClassName.Buffer);
- TRACE("%p class/atom: %s/%04x %x\n", hWnd,
IS_ATOM(pszType) ? NULL : pszType,IS_ATOM(pszType) ? pszType : 0,cchType);- return Length;
}
/*
Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntus... = = = = = = = = ====================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Sun May 25 03:36:30 2008 @@ -1160,18 +1160,11 @@ LPWSTR *ppszMenuName, BOOL Ansi);
-INT +UINT NTAPI NtUserGetClassName(HWND hWnd,
PUNICODE_STRING ClassName,BOOL Ansi);-#if 0 // Real NtUserGetClassName -INT -NTAPI -NtUserGetClassName(HWND hWnd,
BOOL Unknown, // 0 GetClassNameW, 1RealGetWindowClassA/W
BOOL bGetRealClass, // 0 GetClassNameA/W, 1RealGetWindowClassA/W PUNICODE_STRING ClassName); -#endif
HANDLE NTAPI
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/class.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... = = = = = = = = ====================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/class.c [iso-8859-1] Sun May 25 03:36:30 2008 @@ -1255,118 +1255,39 @@
INT UserGetClassName(IN PWINDOWCLASS Class,
IN OUT PUNICODE_STRING ClassName,IN BOOL Ansi)
IN OUT PUNICODE_STRING ClassName){ NTSTATUS Status = STATUS_SUCCESS;
- WCHAR szStaticTemp[32];
- PWSTR szTemp = NULL;
- ULONG BufLen = sizeof(szStaticTemp);
ULONG BufLen; INT Ret = 0;
/* Note: Accessing the buffer in ClassName may raise an
exception! */
_SEH_TRY {
if (Ansi){PANSI_STRING AnsiClassName = (PANSI_STRING)ClassName;UNICODE_STRING UnicodeClassName;/* limit the size of the static buffer on the stack tothe
size of the buffer provided by the caller */if (BufLen / sizeof(WCHAR) > AnsiClassName-MaximumLength)
{BufLen = AnsiClassName->MaximumLength *sizeof(WCHAR);
}/* find out how big the buffer needs to be */Status = RtlQueryAtomInAtomTable(gAtomTable,Class->Atom,NULL,NULL,szStaticTemp,&BufLen);if (Status == STATUS_BUFFER_TOO_SMALL){if (BufLen / sizeof(WCHAR) > AnsiClassName-MaximumLength)
{/* the buffer required exceeds the ansi bufferprovided,
pretend like we're using the ansi buffer andlimit the
size to the buffer size provided */BufLen = AnsiClassName->MaximumLength *sizeof(WCHAR);
}/* allocate a temporary buffer that can hold theunicode class name */
szTemp = ExAllocatePool(PagedPool,BufLen);if (szTemp == NULL){SetLastWin32Error(ERROR_NOT_ENOUGH_MEMORY);_SEH_LEAVE;}/* query the class name */Status = RtlQueryAtomInAtomTable(gAtomTable,Class->Atom,NULL,NULL,szTemp,&BufLen);}elseszTemp = szStaticTemp;if (NT_SUCCESS(Status)){/* convert the atom name to ansi */RtlInitUnicodeString(&UnicodeClassName,szTemp);Status = RtlUnicodeStringToAnsiString(AnsiClassName,&UnicodeClassName,
FALSE);if (!NT_SUCCESS(Status)){SetLastNtError(Status);_SEH_LEAVE;}}Ret = BufLen / sizeof(WCHAR);}else /* !Ansi */{BufLen = ClassName->MaximumLength;/* query the atom name */Status = RtlQueryAtomInAtomTable(gAtomTable,Class->Atom,NULL,NULL,ClassName->Buffer,&BufLen);if (!NT_SUCCESS(Status)){SetLastNtError(Status);_SEH_LEAVE;}Ret = BufLen / sizeof(WCHAR);}
BufLen = ClassName->MaximumLength;/* query the atom name */Status = RtlQueryAtomInAtomTable(gAtomTable,Class->Atom,NULL,NULL,ClassName->Buffer,&BufLen);if (!NT_SUCCESS(Status)){SetLastNtError(Status);_SEH_LEAVE;} } _SEH_HANDLE { SetLastNtError(_SEH_GetExceptionCode()); } _SEH_END;Ret = BufLen / sizeof(WCHAR);
if (Ansi && szTemp != NULL && szTemp != szStaticTemp)
{
ExFreePool(szTemp);}
return Ret;
} @@ -2265,10 +2186,10 @@
-INT NTAPI -NtUserGetClassName (IN HWND hWnd,
OUT PUNICODE_STRING ClassName,IN BOOL Ansi)+UINT NTAPI +NtUserGetClassName(IN HWND hWnd,
IN BOOL bGetRealClass, // 0 GetClassNameA/W, 1RealGetWindowClassA/W
OUT PUNICODE_STRING ClassName){ PWINDOW_OBJECT Window; UNICODE_STRING CapturedClassName; @@ -2284,10 +2205,11 @@ ProbeForWriteUnicodeString(ClassName); CapturedClassName = *ClassName;
/* TODO: Get real class name here if bGetRealClass ==TRUE */
/* get the class name */ Ret = UserGetClassName(Window->Wnd->Class,
&CapturedClassName,Ansi);
&CapturedClassName); if (Ret != 0) {
Best regards, Alex Ionescu
Hi, I was working on fixing this, but no one on IRC pays attention to what I write.
Okay, to implement this properly, we will need to rewrite most of the way we handle classes. Which is a big step in the right direction and I think our developers are afraid to do too. ATM I do not have time but I will next year and you better be ready for big changes too! Gdi32 was never fully implemented so that was a easy thing to write. User32 was implemented on the presumptions of the developers own standards plus the research from wine. So it's NEAR-DO-WELL and broken and hack'ish and User mixed into Gdi~~~. Honestly, I'm constantly surprised 8^, that it all works...
Due to the Reduction In Force we have experienced at ReactOS, "getting it done" will take more time.
Thanks, James