Changeset 5242
- Timestamp:
- Feb 22, 2001, 11:37:31 AM (24 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/user32/win32class.cpp ¶
r5084 r5242 1 /* $Id: win32class.cpp,v 1.2 2 2001-02-10 10:35:31sandervl Exp $ */1 /* $Id: win32class.cpp,v 1.23 2001-02-22 10:37:30 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class Managment Code for OS/2 … … 104 104 dprintf(("USER32: wndclass->hIconSm %X\n", wndclass->hIconSm)); 105 105 106 nrExtraClass Words = wndclass->cbClsExtra;107 nrExtraWindow Words = wndclass->cbWndExtra;106 nrExtraClassBytes = wndclass->cbClsExtra; 107 nrExtraWindowBytes = wndclass->cbWndExtra; 108 108 backgroundBrush = wndclass->hbrBackground; 109 109 hCursor = wndclass->hCursor; … … 123 123 124 124 //User data class words/longs 125 if(nrExtraClass Words) {126 userClass Long = (ULONG *)_smalloc(nrExtraClassWords);127 if(userClass Long== NULL) {128 dprintf(("Win32Class ctr: userClass Long== NULL!"));125 if(nrExtraClassBytes) { 126 userClassBytes = (char *)_smalloc(nrExtraClassBytes); 127 if(userClassBytes == NULL) { 128 dprintf(("Win32Class ctr: userClassBytes == NULL!")); 129 129 exit(1); 130 130 } 131 memset(userClass Long, 0, nrExtraClassWords);132 } 133 else userClass Long= NULL;131 memset(userClassBytes, 0, nrExtraClassBytes); 132 } 133 else userClassBytes = NULL; 134 134 135 135 cWindows = 0; … … 151 151 WINPROC_FreeProc(windowProc, WIN_PROC_CLASS); 152 152 153 if(userClass Long) free(userClassLong);153 if(userClassBytes) free(userClassBytes); 154 154 if(classNameA) free(classNameA); 155 155 if(classNameW) free(classNameW); … … 251 251 252 252 if(HIWORD(id)) { 253 254 } 255 else 253 lpszClassName = UnicodeToAsciiString((LPWSTR)id); 254 } 255 else lpszClassName = (LPSTR)id; 256 256 257 257 winclass = FindClass(hInstance, lpszClassName); … … 278 278 BOOL Win32WndClass::getClassInfo(WNDCLASSEXA *wndclass) 279 279 { 280 wndclass->cbClsExtra = nrExtraClass Words;281 wndclass->cbWndExtra = nrExtraWindow Words;280 wndclass->cbClsExtra = nrExtraClassBytes; 281 wndclass->cbWndExtra = nrExtraWindowBytes; 282 282 wndclass->hbrBackground = backgroundBrush; 283 283 wndclass->hCursor = hCursor; … … 295 295 BOOL Win32WndClass::getClassInfo(WNDCLASSEXW *wndclass) 296 296 { 297 wndclass->cbClsExtra = nrExtraClass Words;298 wndclass->cbWndExtra = nrExtraWindow Words;297 wndclass->cbClsExtra = nrExtraClassBytes; 298 wndclass->cbWndExtra = nrExtraWindowBytes; 299 299 wndclass->hbrBackground = backgroundBrush; 300 300 wndclass->hCursor = hCursor; … … 376 376 switch(index) { 377 377 case GCL_CBCLSEXTRA: 378 return nrExtraClass Words;378 return nrExtraClassBytes; 379 379 case GCL_CBWNDEXTRA: 380 return nrExtraWindow Words;380 return nrExtraWindowBytes; 381 381 case GCL_HBRBACKGROUND: 382 382 return backgroundBrush; … … 399 399 return 0; 400 400 default: 401 if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) { 402 return userClassLong[index]; 403 } 401 if(index >= 0 && index + sizeof(ULONG) <= nrExtraClassBytes) { 402 //Note: NT4, SP6 does not set the last error to 0 403 SetLastError(ERROR_SUCCESS); 404 return *(ULONG *)(userClassBytes + index); 405 } 406 if(classNameA) { 407 dprintf2(("WARNING: getClassLong %s: %d -> wrong INDEX", classNameA, index)); 408 } 409 else dprintf2(("WARNING: getClassLong %d: %d -> wrong INDEX", classAtom, index)); 404 410 SetLastError(ERROR_INVALID_INDEX); //verified in NT4, SP6 405 411 return 0; … … 414 420 return (WORD)classAtom; 415 421 default: 416 if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) { 417 return ((WORD *)userClassLong)[index]; 418 } 422 if(index >= 0 && index + sizeof(WORD) <= nrExtraClassBytes) { 423 //Note: NT4, SP6 does not set the last error to 0 424 SetLastError(ERROR_SUCCESS); 425 return *(WORD *)(userClassBytes + index); 426 } 427 if(classNameA) { 428 dprintf2(("WARNING: getClassWord %s: %d -> wrong INDEX", classNameA, index)); 429 } 430 else dprintf2(("WARNING: getClassWord %d: %d -> wrong INDEX", classAtom, index)); 419 431 SetLastError(ERROR_INVALID_INDEX); //verified in NT4, SP6 420 432 return 0; … … 430 442 switch(index) { 431 443 case GCL_CBCLSEXTRA: //TODO (doesn't affect allocated classes, so what does it do?) 432 rc = nrExtraClass Words;433 // nrExtraClass Words = lNewVal;444 rc = nrExtraClassBytes; 445 // nrExtraClassBytes = lNewVal; 434 446 break; 435 447 case GCL_CBWNDEXTRA: 436 rc = nrExtraWindow Words;437 nrExtraWindow Words = lNewVal;448 rc = nrExtraWindowBytes; 449 nrExtraWindowBytes = lNewVal; 438 450 break; 439 451 case GCL_HBRBACKGROUND: … … 466 478 break; 467 479 case GCL_WNDPROC: 468 480 //Note: Type of SetWindowLong determines new window proc type 469 481 // UNLESS the new window proc has already been registered 470 482 // (use the old type in that case) 471 483 // (VERIFIED in NT 4, SP6) 472 484 //TODO: Is that also true for GCL_WNDPROC??????????????? 473 485 rc = (LONG)WINPROC_GetProc(windowProc, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A ); 474 486 WINPROC_SetProc((HWINDOWPROC *)&windowProc, (WNDPROC)lNewVal, (fUnicode) ? WIN_PROC_32W : WIN_PROC_32A, WIN_PROC_CLASS ); … … 478 490 return 0; 479 491 default: 480 if(index > 0 && index < nrExtraClassWords - sizeof(ULONG)) {481 rc = userClassLong[index];482 userClassLong[index]= lNewVal;492 if(index >= 0 && index + sizeof(ULONG) <= nrExtraClassBytes) { 493 rc = *(ULONG *)(userClassBytes + index); 494 *(ULONG *)(userClassBytes + index) = lNewVal; 483 495 break; 484 496 } 485 497 SetLastError(ERROR_INVALID_INDEX); //verified in NT4, SP6 486 487 488 489 elsedprintf2(("WARNING: Win32WndClass::setClassLongA %d: %d %x -> wrong INDEX", classAtom, index, lNewVal));498 if(classNameA) { 499 dprintf2(("WARNING: Win32WndClass::setClassLongA %s: %d %x -> wrong INDEX", classNameA, index, lNewVal)); 500 } 501 else dprintf2(("WARNING: Win32WndClass::setClassLongA %d: %d %x -> wrong INDEX", classAtom, index, lNewVal)); 490 502 return 0; 491 503 } … … 509 521 return(rc); 510 522 default: 511 if(index > 0 && index < nrExtraClassWords - sizeof(WORD)) { 512 rc = ((WORD *)userClassLong)[index]; 513 ((WORD *)userClassLong)[index] = wNewVal; 523 if(index >= 0 && index + sizeof(WORD) <= nrExtraClassBytes) { 524 rc = *(WORD *)(userClassBytes + index); 525 *(WORD *)(userClassBytes + index) = wNewVal; 526 //Note: NT4, SP6 does not set the last error to 0 527 SetLastError(ERROR_SUCCESS); 514 528 return(rc); 515 529 } 516 530 SetLastError(ERROR_INVALID_INDEX); //verified in NT4, SP6 531 if(classNameA) { 532 dprintf2(("WARNING: setClassWord %s: %d %x -> wrong INDEX", classNameA, index, wNewVal)); 533 } 534 else dprintf2(("WARNING: setClassWord %d: %d %x -> wrong INDEX", classAtom, index, wNewVal)); 517 535 return 0; 518 536 } -
TabularUnified trunk/src/user32/win32class.h ¶
r5056 r5242 1 /* $Id: win32class.h,v 1.1 3 2001-02-02 19:04:02sandervl Exp $ */1 /* $Id: win32class.h,v 1.14 2001-02-22 10:37:30 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class Managment Code for OS/2 … … 42 42 WNDPROC getWindowProc() { return windowProc; }; 43 43 LPSTR getMenuNameA() { return menuNameA; }; 44 DWORD getExtraWnd Words() { return nrExtraWindowWords; };44 DWORD getExtraWndBytes() { return nrExtraWindowBytes; }; 45 45 46 46 HICON getIcon() { return hIcon; }; … … 77 77 //Standard class words/longs 78 78 ULONG windowStyle; //GCL_STYLE * must be offset 14h * 79 ULONG nrExtraClass Words; //GCL_CBCLSEXTRA80 ULONG nrExtraWindow Words; //GCL_CBWNDEXTRA79 ULONG nrExtraClassBytes; //GCL_CBCLSEXTRA 80 ULONG nrExtraWindowBytes; //GCL_CBWNDEXTRA 81 81 HBRUSH backgroundBrush; //GCL_HBRBACKGROUND 82 82 HCURSOR hCursor; //GCL_HCURSOR … … 93 93 HDC hdcClass; 94 94 95 //User data class words/longs96 ULONG *userClassLong;95 //User data class bytse 96 char *userClassBytes; 97 97 ULONG processId; 98 98 -
TabularUnified trunk/src/user32/win32wbase.cpp ¶
r5237 r5242 1 /* $Id: win32wbase.cpp,v 1.24 1 2001-02-21 21:30:43sandervl Exp $ */1 /* $Id: win32wbase.cpp,v 1.242 2001-02-22 10:37:31 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 110 110 wndNameLength = 0; 111 111 112 userWindow Long= NULL;;113 nrUserWindow Long= 0;112 userWindowBytes = NULL;; 113 nrUserWindowBytes= 0; 114 114 115 115 magic = WIN32PM_MAGIC; … … 214 214 HwFreeWindowHandle(Win32Hwnd); 215 215 216 if(userWindow Long)217 free(userWindow Long);216 if(userWindowBytes) 217 free(userWindowBytes); 218 218 219 219 if(windowNameA) { … … 393 393 394 394 //Allocate window words 395 nrUserWindow Long = windowClass->getExtraWndWords();396 if(nrUserWindow Long) {397 userWindow Long = (ULONG *)_smalloc(nrUserWindowLong);398 memset(userWindow Long, 0, nrUserWindowLong);395 nrUserWindowBytes = windowClass->getExtraWndBytes(); 396 if(nrUserWindowBytes) { 397 userWindowBytes = (char *)_smalloc(nrUserWindowBytes); 398 memset(userWindowBytes, 0, nrUserWindowBytes); 399 399 } 400 400 … … 3424 3424 3425 3425 default: 3426 if(index >= 0 && index /4 < nrUserWindowLong)3426 if(index >= 0 && index + sizeof(ULONG) <= nrUserWindowBytes) 3427 3427 { 3428 oldval = userWindowLong[index/4];3429 userWindowLong[index/4]= value;3428 oldval = *(ULONG *)(userWindowBytes + index); 3429 *(ULONG *)(userWindowBytes + index) = value; 3430 3430 break; 3431 3431 } … … 3468 3468 break; 3469 3469 default: 3470 if(index >= 0 && index /4 < nrUserWindowLong)3471 { 3472 value = userWindowLong[index/4];3470 if(index >= 0 && index + sizeof(ULONG) <= nrUserWindowBytes) 3471 { 3472 value = *(ULONG *)(userWindowBytes + index); 3473 3473 break; 3474 3474 } 3475 dprintf(("WARNING: GetWindowLong%c %x %d %x returned %x INVALID index!", (fUnicode) ? 'W' : 'A', getWindowHandle(), index, value)); 3475 3476 SetLastError(ERROR_INVALID_INDEX); //verified in NT4, SP6 3476 3477 return 0; 3477 3478 } 3478 dprintf2(("GetWindowLong A %x %d %x", getWindowHandle(), index, value));3479 dprintf2(("GetWindowLong%c %x %d %x", getWindowHandle(), (fUnicode) ? 'W' : 'A', index, value)); 3479 3480 //Note: NT4, SP6 does not set the last error to 0 3480 3481 SetLastError(ERROR_SUCCESS); … … 3487 3488 WORD oldval; 3488 3489 3489 if(index >= 0 && index/4 < nrUserWindowLong) 3490 { 3491 oldval = ((WORD *)userWindowLong)[index/2]; 3492 ((WORD *)userWindowLong)[index/2] = value; 3490 if(index >= 0 && index + sizeof(WORD) <= nrUserWindowBytes) 3491 { 3492 oldval = *(WORD *)(userWindowBytes + index); 3493 *(WORD *)(userWindowBytes + index) = value; 3494 //Note: NT4, SP6 does not set the last error to 0 3495 dprintf2(("SetWindowWord %x %d %x returned %x", getWindowHandle(), index, value, oldval)); 3496 SetLastError(ERROR_SUCCESS); 3497 return oldval; 3498 } 3499 dprintf(("WARNING: SetWindowWord %x %d %x returned %x INVALID index!", getWindowHandle(), index, value)); 3500 SetLastError(ERROR_INVALID_INDEX); //verified in NT4, SP6 3501 return 0; 3502 } 3503 //****************************************************************************** 3504 //****************************************************************************** 3505 WORD Win32BaseWindow::GetWindowWord(int index) 3506 { 3507 if(index >= 0 && index + sizeof(WORD) <= nrUserWindowBytes) 3508 { 3493 3509 //Note: NT4, SP6 does not set the last error to 0 3494 3510 SetLastError(ERROR_SUCCESS); 3495 return oldval; 3496 } 3497 SetLastError(ERROR_INVALID_INDEX); //verified in NT4, SP6 3498 return 0; 3499 } 3500 //****************************************************************************** 3501 //****************************************************************************** 3502 WORD Win32BaseWindow::GetWindowWord(int index) 3503 { 3504 if(index >= 0 && index/4 < nrUserWindowLong) 3505 { 3506 //Note: NT4, SP6 does not set the last error to 0 3507 SetLastError(ERROR_SUCCESS); 3508 return ((WORD *)userWindowLong)[index/2]; 3509 } 3511 dprintf2(("GetWindowWord %x %d %x", getWindowHandle(), index, *(WORD *)(userWindowBytes + index))); 3512 return *(WORD *)(userWindowBytes + index); 3513 } 3514 dprintf(("WARNING: GetWindowWord %x %d returned %x INVALID index!", getWindowHandle(), index)); 3510 3515 SetLastError(ERROR_INVALID_INDEX); //verified in NT4, SP6 3511 3516 return 0; -
TabularUnified trunk/src/user32/win32wbase.h ¶
r5237 r5242 1 /* $Id: win32wbase.h,v 1.1 09 2001-02-21 21:30:44sandervl Exp $ */1 /* $Id: win32wbase.h,v 1.110 2001-02-22 10:37:31 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Base Class for OS/2 … … 387 387 ULONG wndNameLength; //including 0 terminator 388 388 389 ULONG *userWindowLong;390 ULONG nrUserWindow Long;389 char *userWindowBytes; 390 ULONG nrUserWindowBytes; 391 391 392 392 RECT rectWindow; //relative to parent -
TabularUnified trunk/src/user32/windowclass.cpp ¶
r5056 r5242 1 /* $Id: windowclass.cpp,v 1.1 5 2001-02-02 19:04:03sandervl Exp $ */1 /* $Id: windowclass.cpp,v 1.16 2001-02-22 10:37:31 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class Code for OS/2 … … 363 363 Win32BaseWindow *wnd; 364 364 365 dprintf(("USER32: SetClassLongA %x %d %x", hwnd, nIndex, lNewVal)); 366 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 367 if(!wnd) { 368 dprintf(("SetClassLongA wnd == NULL")); 365 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 366 if(!wnd) { 367 dprintf(("SetClassLongA %x %d %x wnd == NULL", hwnd, nIndex, lNewVal)); 369 368 return(0); 370 369 } … … 377 376 Win32BaseWindow *wnd; 378 377 379 dprintf(("USER32: SetClassLongW\n")); 380 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 381 if(!wnd) { 382 dprintf(("SetClassLongW wnd == NULL")); 378 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 379 if(!wnd) { 380 dprintf(("SetClassLongW %x %d %x wnd == NULL", hwnd, nIndex, lNewVal)); 383 381 return(0); 384 382 } … … 391 389 Win32BaseWindow *wnd; 392 390 393 dprintf(("USER32: SetClassWord A\n"));394 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 395 if(!wnd) { 396 dprintf(("SetClassWordA wnd == NULL"));391 dprintf(("USER32: SetClassWord %x %d %x", hwnd, nIndex, (ULONG)wNewVal)); 392 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 393 if(!wnd) { 394 dprintf(("SetClassWordA %x %d %x wnd == NULL", hwnd, nIndex, wNewVal)); 397 395 return(0); 398 396 } … … 404 402 { 405 403 Win32BaseWindow *wnd; 406 407 dprintf(("USER32: GetClassWordA\n")); 408 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 409 if(!wnd) { 410 dprintf(("GetClassWordA wnd == NULL")); 411 return(0); 412 } 413 return (wnd->getClass())->getClassWord(nIndex); 404 WORD ret; 405 406 wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 407 if(!wnd) { 408 dprintf(("GetClassWordA %x %d wnd == NULL", hwnd, nIndex)); 409 return(0); 410 } 411 ret = (wnd->getClass())->getClassWord(nIndex); 412 dprintf(("USER32: GetClassWord %x %d returned %x", hwnd, nIndex, (ULONG)ret)); 413 return ret; 414 414 } 415 415 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.