X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=dll%2Fwin32%2Fuser32%2Fwindows%2Fclass.c;h=1c66fd7606f6f6b696c2a5e10b202a904d71742a;hp=f546aa4595270b3b578456495c13ce11534bec14;hb=6bc4e97d08e98b103d59c709c371c73c469c1fad;hpb=cf73dc7621eea9580a83c262c8c0088f05e23bfe diff --git a/dll/win32/user32/windows/class.c b/dll/win32/user32/windows/class.c index f546aa45952..1c66fd7606f 100644 --- a/dll/win32/user32/windows/class.c +++ b/dll/win32/user32/windows/class.c @@ -423,22 +423,15 @@ GetClassLongA(HWND hWnd, int nIndex) } else { - /* This is a race condition! Call win32k to make sure we're getting - the correct result */ - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ - WARN("Invalid class for hwnd 0x%p!\n", hWnd); } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ + Ret = 0; } _SEH2_END; - if (Wnd == NULL) - Ret = NtUserGetClassLong(hWnd, nIndex, TRUE); - return Ret; } @@ -534,22 +527,14 @@ GetClassLongW ( HWND hWnd, int nIndex ) } else { - /* This is a race condition! Call win32k to make sure we're getting - the correct result */ - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ - WARN("Invalid class for hwnd 0x%p!\n", hWnd); } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - Wnd = NULL; /* Make sure we call NtUserGetClassLong */ } _SEH2_END; - if (Wnd == NULL) - Ret = NtUserGetClassLong(hWnd, nIndex, FALSE); - return Ret; } @@ -617,18 +602,28 @@ GetClassNameW( WORD WINAPI GetClassWord( - HWND hWnd, - int nIndex) -/* - * NOTE: Obsoleted in 32-bit windows - */ + HWND hwnd, + int offset) { - TRACE("%p %x\n", hWnd, nIndex); + PWND Wnd; + PCLS class; + WORD retvalue = 0; - if ((nIndex < 0) && (nIndex != GCW_ATOM)) + if (offset < 0) return GetClassLongA( hwnd, offset ); + + Wnd = ValidateHwnd(hwnd); + if (!Wnd) return 0; - return (WORD) NtUserGetClassLong ( hWnd, nIndex, TRUE ); + class = DesktopPtrToUser(Wnd->pcls); + if (class == NULL) return 0; + + if (offset <= class->cbclsExtra - sizeof(WORD)) + memcpy( &retvalue, (char *)(class + 1) + offset, sizeof(retvalue) ); + else + SetLastError( ERROR_INVALID_INDEX ); + + return retvalue; }