From 1e4e44fc3b597a26d95a4e3c37f1755a9181f4de Mon Sep 17 00:00:00 2001 From: cracyc Date: Sun, 26 Jan 2025 15:24:44 -0600 Subject: [PATCH 1/7] return 2 fats for fixed disks chessmaster installer checks this --- krnl386/int21.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krnl386/int21.c b/krnl386/int21.c index 8ab6baceb3..7b71a5a78b 100644 --- a/krnl386/int21.c +++ b/krnl386/int21.c @@ -691,7 +691,7 @@ static BOOL INT21_FillDrivePB( BYTE drive ) } dpb->num_reserved = 0; - dpb->num_FAT = 1; + dpb->num_FAT = (drivetype == DRIVE_FIXED) ? 2 : 1; dpb->num_root_entries = 2; dpb->first_data_sector = 2; dpb->num_clusters1 = total_clusters; From fb72a77ac304b134dc533b730de8c48dbca6eaa8 Mon Sep 17 00:00:00 2001 From: cracyc Date: Sun, 26 Jan 2025 15:25:11 -0600 Subject: [PATCH 2/7] fix ansiprev as win31 only checks that start != current --- user/user.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/user/user.c b/user/user.c index 657babaad6..bca96fc150 100644 --- a/user/user.c +++ b/user/user.c @@ -3782,7 +3782,9 @@ void WINAPI DrawFocusRect16( HDC16 hdc, const RECT16* rc ) SEGPTR WINAPI AnsiNext16(SEGPTR current) { char *ptr = MapSL(current); - return current + (CharNextA(ptr) - ptr); + if (!*ptr) return current; + if (IsDBCSLeadByte( ptr[0] ) && ptr[1]) return current + 2; + return current + 1; } @@ -3791,9 +3793,10 @@ SEGPTR WINAPI AnsiNext16(SEGPTR current) */ SEGPTR WINAPI AnsiPrev16( SEGPTR sstart, SEGPTR current ) { - char *start = MapSL(sstart); char *ptr = MapSL(current); - return current - (ptr - CharPrevA( start, ptr )); + if (sstart == current) return current; + if ((sstart != (current - 1)) && IsDBCSLeadByte(ptr - 2)) return current - 2; + return current - 1; } From 1bb470e6e3827d88b06fb5aece3e82c4a419beda Mon Sep 17 00:00:00 2001 From: cracyc Date: Sun, 26 Jan 2025 15:26:01 -0600 Subject: [PATCH 3/7] fix measureitem and drawitem structs for menus, itemid for submenus is a menu handle --- user/message.c | 132 +++++++++++++++++++++++++++++++------------------ 1 file changed, 85 insertions(+), 47 deletions(-) diff --git a/user/message.c b/user/message.c index a73eb35752..2a62d373ed 100644 --- a/user/message.c +++ b/user/message.c @@ -85,6 +85,19 @@ struct timer32_wrapper LPARAM lParam; BOOL ref; }; + +struct measureitem_wrapper +{ + MEASUREITEMSTRUCT16 mis16; + UINT origitemID; +}; + +struct drawitem_wrapper +{ + DRAWITEMSTRUCT16 dis16; + UINT origitemID; +}; + #define TIMER32_WRAP_SIZE 400 static int timer32_count; static struct timer32_wrapper timer32[TIMER32_WRAP_SIZE]; @@ -371,8 +384,17 @@ WNDPROC16 WINPROC_GetProc16( WNDPROC proc, BOOL unicode ) } if (size) { - memcpy( &args.u, MapSL(lParam), size ); - lParam = PtrToUlong(getWOW32Reserved()) - size; + LPARAM lp = lParam; + __TRY // Chessmaster 4000 sends WM_CREATE without a pointer in LPARAM + { + memcpy( &args.u, MapSL(lParam), size ); + lParam = PtrToUlong(getWOW32Reserved()) - size; + } + __EXCEPT_ALL + { + lParam = lp; + } + __ENDTRY } } PVOID old = getWOW32Reserved(); @@ -1709,36 +1731,36 @@ LRESULT WINPROC_CallProc16To32A( winproc_callback_t callback, HWND16 hwnd, UINT1 break; case WM_MEASUREITEM: { - MEASUREITEMSTRUCT16* mis16 = MapSL(lParam); + struct measureitem_wrapper* mis16 = MapSL(lParam); MEASUREITEMSTRUCT mis; - mis.CtlType = mis16->CtlType; - mis.CtlID = mis16->CtlID; - mis.itemID = mis16->itemID; - mis.itemWidth = mis16->itemWidth; - mis.itemHeight = mis16->itemHeight; - mis.itemData = mis16->itemData; + mis.CtlType = mis16->mis16.CtlType; + mis.CtlID = mis16->mis16.CtlID; + mis.itemID = mis16->origitemID; + mis.itemWidth = mis16->mis16.itemWidth; + mis.itemHeight = mis16->mis16.itemHeight; + mis.itemData = mis16->mis16.CtlType == ODT_MENU ? MapSL(mis16->mis16.itemData) : mis16->mis16.itemData; ret = callback( hwnd32, msg, wParam, (LPARAM)&mis, result, arg ); - mis16->itemWidth = (UINT16)mis.itemWidth; - mis16->itemHeight = (UINT16)mis.itemHeight; + mis16->mis16.itemWidth = (UINT16)mis.itemWidth; + mis16->mis16.itemHeight = (UINT16)mis.itemHeight; } break; case WM_DRAWITEM: { - DRAWITEMSTRUCT16* dis16 = MapSL(lParam); + struct drawitem_wrapper* dis16 = MapSL(lParam); DRAWITEMSTRUCT dis; - dis.CtlType = dis16->CtlType; - dis.CtlID = dis16->CtlID; - dis.itemID = dis16->itemID == 0xFFFF ? ~0 : dis16->itemID; - dis.itemAction = dis16->itemAction; - dis.itemState = dis16->itemState; - dis.hwndItem = (dis.CtlType == ODT_MENU) ? (HWND)HMENU_32(dis16->hwndItem) - : WIN_Handle32( dis16->hwndItem ); - dis.hDC = HDC_32(dis16->hDC); - dis.itemData = dis16->itemData; - dis.rcItem.left = dis16->rcItem.left; - dis.rcItem.top = dis16->rcItem.top; - dis.rcItem.right = dis16->rcItem.right; - dis.rcItem.bottom = dis16->rcItem.bottom; + dis.CtlType = dis16->dis16.CtlType; + dis.CtlID = dis16->dis16.CtlID; + dis.itemID = dis16->origitemID; + dis.itemAction = dis16->dis16.itemAction; + dis.itemState = dis16->dis16.itemState; + dis.hwndItem = (dis.CtlType == ODT_MENU) ? (HWND)HMENU_32(dis16->dis16.hwndItem) + : WIN_Handle32( dis16->dis16.hwndItem ); + dis.hDC = HDC_32(dis16->dis16.hDC); + dis.itemData = dis16->dis16.itemData; + dis.rcItem.left = dis16->dis16.rcItem.left; + dis.rcItem.top = dis16->dis16.rcItem.top; + dis.rcItem.right = dis16->dis16.rcItem.right; + dis.rcItem.bottom = dis16->dis16.rcItem.bottom; ret = callback( hwnd32, msg, wParam, (LPARAM)&dis, result, arg ); } break; @@ -2345,39 +2367,55 @@ LRESULT WINPROC_CallProc32ATo16( winproc_callback16_t callback, HWND hwnd, UINT case WM_DRAWITEM: { DRAWITEMSTRUCT *dis32 = (DRAWITEMSTRUCT *)lParam; - DRAWITEMSTRUCT16 dis; - dis.CtlType = dis32->CtlType; - dis.CtlID = dis32->CtlID; - dis.itemID = dis32->itemID; - dis.itemAction = dis32->itemAction; - dis.itemState = dis32->itemState; - dis.hwndItem = HWND_16( dis32->hwndItem ); - dis.hDC = HDC_16(dis32->hDC); - dis.itemData = dis32->itemData; - dis.rcItem.left = dis32->rcItem.left; - dis.rcItem.top = dis32->rcItem.top; - dis.rcItem.right = dis32->rcItem.right; - dis.rcItem.bottom = dis32->rcItem.bottom; + struct drawitem_wrapper dis; + dis.dis16.CtlType = dis32->CtlType; + dis.dis16.CtlID = dis32->CtlID; + if ((dis32->CtlType == ODT_MENU) && (dis32->itemID > 0xffff)) + { + HMENU16 menu = HMENU_16(dis32->itemID); + if (menu) dis.dis16.itemID = menu; + else dis.dis16.itemID = dis32->itemID; + } + else dis.dis16.itemID = dis32->itemID; + dis.origitemID = dis32->itemID; + dis.dis16.itemAction = dis32->itemAction; + dis.dis16.itemState = dis32->itemState; + dis.dis16.hwndItem = HWND_16( dis32->hwndItem ); + dis.dis16.hDC = HDC_16(dis32->hDC); + dis.dis16.itemData = dis32->CtlType == ODT_MENU ? MapLS(dis32->itemData) : dis32->itemData; + dis.dis16.rcItem.left = dis32->rcItem.left; + dis.dis16.rcItem.top = dis32->rcItem.top; + dis.dis16.rcItem.right = dis32->rcItem.right; + dis.dis16.rcItem.bottom = dis32->rcItem.bottom; lParam = MapLS( &dis ); ret = callback( HWND_16(hwnd), msg, wParam, lParam, result, arg ); UnMapLS( lParam ); + if (dis32->CtlType == ODT_MENU) UnMapLS( dis.dis16.itemData ); } break; case WM_MEASUREITEM: { MEASUREITEMSTRUCT *mis32 = (MEASUREITEMSTRUCT *)lParam; - MEASUREITEMSTRUCT16 mis; - mis.CtlType = mis32->CtlType; - mis.CtlID = mis32->CtlID; - mis.itemID = mis32->itemID; - mis.itemWidth = mis32->itemWidth; - mis.itemHeight = mis32->itemHeight; - mis.itemData = mis32->itemData; + struct measureitem_wrapper mis; + mis.mis16.CtlType = mis32->CtlType; + mis.mis16.CtlID = mis32->CtlID; + if ((mis32->CtlType == ODT_MENU) && (mis32->itemID > 0xffff)) + { + HMENU16 menu = HMENU_16(mis32->itemID); + if (menu) mis.mis16.itemID = menu; + else mis.mis16.itemID = mis32->itemID; + } + else mis.mis16.itemID = mis32->itemID; + mis.origitemID = mis32->itemID; + mis.mis16.itemWidth = mis32->itemWidth; + mis.mis16.itemHeight = mis32->itemHeight; + mis.mis16.itemData = mis32->CtlType == ODT_MENU ? MapLS(mis32->itemData) : mis32->itemData; lParam = MapLS( &mis ); ret = callback( HWND_16(hwnd), msg, wParam, lParam, result, arg ); UnMapLS( lParam ); - mis32->itemWidth = (INT16)mis.itemWidth; - mis32->itemHeight = mis.itemHeight; + if (mis32->CtlType == ODT_MENU) UnMapLS( mis.mis16.itemData ); + mis32->itemWidth = (INT16)mis.mis16.itemWidth; + mis32->itemHeight = mis.mis16.itemHeight; } break; case WM_COPYDATA: From fb2b876d0fba8a0252dd26e5732c13abf0a5802e Mon Sep 17 00:00:00 2001 From: cracyc Date: Sun, 26 Jan 2025 15:26:30 -0600 Subject: [PATCH 4/7] set ax=ds in enumchildwindows cb --- user/window.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/user/window.c b/user/window.c index f7d997de7c..1f9e579955 100644 --- a/user/window.c +++ b/user/window.c @@ -93,11 +93,21 @@ static BOOL CALLBACK wnd_enum_callback( HWND hwnd, LPARAM param ) const struct wnd_enum_info *info = (struct wnd_enum_info *)param; WORD args[3]; DWORD ret; + CONTEXT context = {0}; + context.SegDs = context.SegEs = SELECTOROF(getWOW32Reserved()); + context.SegFs = wine_get_fs(); + context.SegGs = wine_get_gs(); + context.Eax = context.SegDs; + context.SegCs = SELECTOROF((DWORD)info->proc); + context.Eip = OFFSETOF((DWORD)info->proc); + context.Ebp = OFFSETOF(getWOW32Reserved()) + FIELD_OFFSET(STACK16FRAME, bp); args[2] = HWND_16(hwnd); args[1] = HIWORD(info->param); args[0] = LOWORD(info->param); - WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL, sizeof(args), args, &ret ); + WOWCallback16Ex( (DWORD)info->proc, WCB16_PASCAL | WCB16_REGS, sizeof(args), args, (LPDWORD)&context ); + + ret = MAKELONG(LOWORD(context.Eax), LOWORD(context.Edx)); return LOWORD(ret); } From 31e13f719b9666d9a455d80b99edf3a06730392d Mon Sep 17 00:00:00 2001 From: cracyc Date: Sun, 26 Jan 2025 21:19:39 -0600 Subject: [PATCH 5/7] lbs_ownerdrawfixed can be nonintegral height and make sure fixlistbox isn't applied twice --- user/message.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/user/message.c b/user/message.c index 2a62d373ed..8e20c4e6d0 100644 --- a/user/message.c +++ b/user/message.c @@ -1056,7 +1056,7 @@ static LRESULT listbox_proc_CallProc16To32A(winproc_callback_t callback, HWND hw less than the height of the nonclient area, round to the *next* number of items */ - if (!(style & LBS_NOINTEGRALHEIGHT) && !(style & LBS_OWNERDRAWVARIABLE)) + if (!(style & LBS_NOINTEGRALHEIGHT) && !(style & LBS_OWNERDRAWVARIABLE) && !(style & LBS_OWNERDRAWFIXED)) { GetClientRect(hwnd, &rect); height = rect.bottom - rect.top; @@ -1076,8 +1076,7 @@ static LRESULT listbox_proc_CallProc16To32A(winproc_callback_t callback, HWND hw } } } - ret = callback(hwnd, msg, wParam, lParam, result, arg); - break; + return callback(hwnd, msg, wParam, lParam, result, arg); // return wow_handlers32.listbox_proc(hwnd, msg, wParam, lParam, unicode); case LB_RESETCONTENT16: @@ -1573,7 +1572,7 @@ LRESULT WINPROC_CallProc16To32A( winproc_callback_t callback, HWND16 hwnd, UINT1 CLIENTCREATESTRUCT c32; BOOL mdichild = GetWindowLongW(hwnd32, GWL_EXSTYLE) & WS_EX_MDICHILD ? TRUE : FALSE; BOOL mdiclient = is_mdiclient(hwnd, hwnd32) || (call_window_proc_callback == callback && is_mdiclient_wndproc(arg)); - BOOL fixlistbox = (get_windows_build() >= 26100) && (window_type_table[hwnd] == (BYTE)WINDOW_TYPE_LISTBOX) && (msg == WM_CREATE); + BOOL fixlistbox = (get_windows_build() >= 26100) && (window_type_table[hwnd] == (BYTE)WINDOW_TYPE_LISTBOX) && (msg == WM_CREATE) && (callback != call_window_proc_callback); CREATESTRUCT16to32A( hwnd32, cs16, &cs ); if (mdichild) @@ -2299,10 +2298,10 @@ LRESULT WINPROC_CallProc32ATo16( winproc_callback16_t callback, HWND hwnd, UINT UnMapLS( lParam ); if (fixborder) { - nc.rgrc[0].top--; - nc.rgrc[0].left--; - nc.rgrc[0].bottom++; - nc.rgrc[0].right++; + nc.rgrc[0].top--; + nc.rgrc[0].left--; + nc.rgrc[0].bottom++; + nc.rgrc[0].right++; } RECT16to32( &nc.rgrc[0], &nc32->rgrc[0] ); if (wParam) From c091e49f1599dfa85f719af316b382e2dff3a65a Mon Sep 17 00:00:00 2001 From: cracyc Date: Mon, 27 Jan 2025 12:34:11 -0600 Subject: [PATCH 6/7] revert wrapper change. --- user/message.c | 116 ++++++++++++++++++++++--------------------------- 1 file changed, 51 insertions(+), 65 deletions(-) diff --git a/user/message.c b/user/message.c index 8e20c4e6d0..e9561bb260 100644 --- a/user/message.c +++ b/user/message.c @@ -86,18 +86,6 @@ struct timer32_wrapper BOOL ref; }; -struct measureitem_wrapper -{ - MEASUREITEMSTRUCT16 mis16; - UINT origitemID; -}; - -struct drawitem_wrapper -{ - DRAWITEMSTRUCT16 dis16; - UINT origitemID; -}; - #define TIMER32_WRAP_SIZE 400 static int timer32_count; static struct timer32_wrapper timer32[TIMER32_WRAP_SIZE]; @@ -1730,36 +1718,36 @@ LRESULT WINPROC_CallProc16To32A( winproc_callback_t callback, HWND16 hwnd, UINT1 break; case WM_MEASUREITEM: { - struct measureitem_wrapper* mis16 = MapSL(lParam); + MEASUREITEMSTRUCT16* mis16 = MapSL(lParam); MEASUREITEMSTRUCT mis; - mis.CtlType = mis16->mis16.CtlType; - mis.CtlID = mis16->mis16.CtlID; - mis.itemID = mis16->origitemID; - mis.itemWidth = mis16->mis16.itemWidth; - mis.itemHeight = mis16->mis16.itemHeight; - mis.itemData = mis16->mis16.CtlType == ODT_MENU ? MapSL(mis16->mis16.itemData) : mis16->mis16.itemData; + mis.CtlType = mis16->CtlType; + mis.CtlID = mis16->CtlID; + mis.itemID = mis16->itemID; + mis.itemWidth = mis16->itemWidth; + mis.itemHeight = mis16->itemHeight; + mis.itemData = mis16->CtlType == ODT_MENU ? MapSL(mis16->itemData) : mis16->itemData; ret = callback( hwnd32, msg, wParam, (LPARAM)&mis, result, arg ); - mis16->mis16.itemWidth = (UINT16)mis.itemWidth; - mis16->mis16.itemHeight = (UINT16)mis.itemHeight; + mis16->itemWidth = (UINT16)mis.itemWidth; + mis16->itemHeight = (UINT16)mis.itemHeight; } break; case WM_DRAWITEM: { - struct drawitem_wrapper* dis16 = MapSL(lParam); + DRAWITEMSTRUCT16* dis16 = MapSL(lParam); DRAWITEMSTRUCT dis; - dis.CtlType = dis16->dis16.CtlType; - dis.CtlID = dis16->dis16.CtlID; - dis.itemID = dis16->origitemID; - dis.itemAction = dis16->dis16.itemAction; - dis.itemState = dis16->dis16.itemState; - dis.hwndItem = (dis.CtlType == ODT_MENU) ? (HWND)HMENU_32(dis16->dis16.hwndItem) - : WIN_Handle32( dis16->dis16.hwndItem ); - dis.hDC = HDC_32(dis16->dis16.hDC); - dis.itemData = dis16->dis16.itemData; - dis.rcItem.left = dis16->dis16.rcItem.left; - dis.rcItem.top = dis16->dis16.rcItem.top; - dis.rcItem.right = dis16->dis16.rcItem.right; - dis.rcItem.bottom = dis16->dis16.rcItem.bottom; + dis.CtlType = dis16->CtlType; + dis.CtlID = dis16->CtlID; + dis.itemID = dis16->itemID; + dis.itemAction = dis16->itemAction; + dis.itemState = dis16->itemState; + dis.hwndItem = (dis.CtlType == ODT_MENU) ? (HWND)HMENU_32(dis16->hwndItem) + : WIN_Handle32( dis16->hwndItem ); + dis.hDC = HDC_32(dis16->hDC); + dis.itemData = dis16->itemData; + dis.rcItem.left = dis16->rcItem.left; + dis.rcItem.top = dis16->rcItem.top; + dis.rcItem.right = dis16->rcItem.right; + dis.rcItem.bottom = dis16->rcItem.bottom; ret = callback( hwnd32, msg, wParam, (LPARAM)&dis, result, arg ); } break; @@ -2366,55 +2354,53 @@ LRESULT WINPROC_CallProc32ATo16( winproc_callback16_t callback, HWND hwnd, UINT case WM_DRAWITEM: { DRAWITEMSTRUCT *dis32 = (DRAWITEMSTRUCT *)lParam; - struct drawitem_wrapper dis; - dis.dis16.CtlType = dis32->CtlType; - dis.dis16.CtlID = dis32->CtlID; + DRAWITEMSTRUCT16 dis; + dis.CtlType = dis32->CtlType; + dis.CtlID = dis32->CtlID; if ((dis32->CtlType == ODT_MENU) && (dis32->itemID > 0xffff)) { HMENU16 menu = HMENU_16(dis32->itemID); - if (menu) dis.dis16.itemID = menu; - else dis.dis16.itemID = dis32->itemID; + if (menu) dis.itemID = menu; + else dis.itemID = dis32->itemID; } - else dis.dis16.itemID = dis32->itemID; - dis.origitemID = dis32->itemID; - dis.dis16.itemAction = dis32->itemAction; - dis.dis16.itemState = dis32->itemState; - dis.dis16.hwndItem = HWND_16( dis32->hwndItem ); - dis.dis16.hDC = HDC_16(dis32->hDC); - dis.dis16.itemData = dis32->CtlType == ODT_MENU ? MapLS(dis32->itemData) : dis32->itemData; - dis.dis16.rcItem.left = dis32->rcItem.left; - dis.dis16.rcItem.top = dis32->rcItem.top; - dis.dis16.rcItem.right = dis32->rcItem.right; - dis.dis16.rcItem.bottom = dis32->rcItem.bottom; + else dis.itemID = dis32->itemID; + dis.itemAction = dis32->itemAction; + dis.itemState = dis32->itemState; + dis.hwndItem = HWND_16( dis32->hwndItem ); + dis.hDC = HDC_16(dis32->hDC); + dis.itemData = dis32->CtlType == ODT_MENU ? MapLS(dis32->itemData) : dis32->itemData; + dis.rcItem.left = dis32->rcItem.left; + dis.rcItem.top = dis32->rcItem.top; + dis.rcItem.right = dis32->rcItem.right; + dis.rcItem.bottom = dis32->rcItem.bottom; lParam = MapLS( &dis ); ret = callback( HWND_16(hwnd), msg, wParam, lParam, result, arg ); UnMapLS( lParam ); - if (dis32->CtlType == ODT_MENU) UnMapLS( dis.dis16.itemData ); + if (dis32->CtlType == ODT_MENU) UnMapLS( dis.itemData ); } break; case WM_MEASUREITEM: { MEASUREITEMSTRUCT *mis32 = (MEASUREITEMSTRUCT *)lParam; - struct measureitem_wrapper mis; - mis.mis16.CtlType = mis32->CtlType; - mis.mis16.CtlID = mis32->CtlID; + MEASUREITEMSTRUCT16 mis; + mis.CtlType = mis32->CtlType; + mis.CtlID = mis32->CtlID; if ((mis32->CtlType == ODT_MENU) && (mis32->itemID > 0xffff)) { HMENU16 menu = HMENU_16(mis32->itemID); - if (menu) mis.mis16.itemID = menu; - else mis.mis16.itemID = mis32->itemID; + if (menu) mis.itemID = menu; + else mis.itemID = mis32->itemID; } - else mis.mis16.itemID = mis32->itemID; - mis.origitemID = mis32->itemID; - mis.mis16.itemWidth = mis32->itemWidth; - mis.mis16.itemHeight = mis32->itemHeight; - mis.mis16.itemData = mis32->CtlType == ODT_MENU ? MapLS(mis32->itemData) : mis32->itemData; + else mis.itemID = mis32->itemID; + mis.itemWidth = mis32->itemWidth; + mis.itemHeight = mis32->itemHeight; + mis.itemData = mis32->CtlType == ODT_MENU ? MapLS(mis32->itemData) : mis32->itemData; lParam = MapLS( &mis ); ret = callback( HWND_16(hwnd), msg, wParam, lParam, result, arg ); UnMapLS( lParam ); - if (mis32->CtlType == ODT_MENU) UnMapLS( mis.mis16.itemData ); - mis32->itemWidth = (INT16)mis.mis16.itemWidth; - mis32->itemHeight = mis.mis16.itemHeight; + if (mis32->CtlType == ODT_MENU) UnMapLS( mis.itemData ); + mis32->itemWidth = (INT16)mis.itemWidth; + mis32->itemHeight = mis.itemHeight; } break; case WM_COPYDATA: From 9b7f1889f6f463138058e4e2a751c0d7208f92d8 Mon Sep 17 00:00:00 2001 From: cracyc Date: Thu, 30 Jan 2025 18:43:48 -0600 Subject: [PATCH 7/7] force lbs_noinegralheight for lbs_ownerdrawfixed listboxes on 24H2 --- user/message.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/user/message.c b/user/message.c index e9561bb260..9a78435413 100644 --- a/user/message.c +++ b/user/message.c @@ -5000,6 +5000,14 @@ LRESULT CALLBACK CBTHook(int nCode, WPARAM wParam, LPARAM lParam) WNDPROC origwndproc = SetWindowLongW(hWnd, GWL_WNDPROC, UB_WndProc); SetPropA(hWnd, "origwndproc", (HANDLE)origwndproc); } + // 24H2 will make integral height listboxes the wrong size + // TODO: correct the height + if ((get_windows_build() >= 26100) && (window_type_table[HWND_16(hWnd)] == (BYTE)WINDOW_TYPE_LISTBOX) && (create->lpcs->style & LBS_OWNERDRAWFIXED)) + { + create->lpcs->style |= LBS_NOINTEGRALHEIGHT; + SetWindowLongA(hWnd, GWL_STYLE, create->lpcs->style); + } + } else if((nCode == HCBT_MINMAX) && (lParam == SW_MAXIMIZE) && (GetWindowLongA(wParam, GWL_STYLE) & WS_MAXIMIZE)) SetPropA(wParam, "WindowMaximized", 1);