Fix padded Wine review strings

This commit is contained in:
deedra committed 2026-10-11 22:07:14 -07:00
1 parent a8cb350467
commit f40e471938
7 files changed
+416 -33

No files matched your search

+100 -1
View File
@@ -11,6 +11,7 @@
#define REVIEW_PRIVACY_CHECK (WM_APP + 14)
#define REVIEW_REMOTE_CHECK (WM_APP + 15)
static HWND editor, output, password, hidden;
static HWND mdi, mdi_active, mdi_background;
static WCHAR *large;
static WNDPROC original_edit;
static BOOL replace_during_read;
@@ -24,6 +25,27 @@ static WNDPROC original_list;
static WNDPROC original_table;
static BOOL replace_table_during_read;
static BOOL delay_table_read, freed_table_memory, scroll_during_position;
static BOOL frame_pump;
static BOOL delay_batch;
static unsigned int synthetic_containers;
static LRESULT CALLBACK status_proc(HWND window,UINT message,WPARAM wp,LPARAM lp) {
// Like MUSHclient's status bar, report a length beyond the first NUL.
// The standard MSAA fallback retains that padding in its BSTR name.
const WCHAR text[]=L"Ready\0Connected";
if(message==WM_GETTEXTLENGTH)return (sizeof(text)/sizeof(*text))-1;
if(message==WM_GETTEXT && wp) {
size_t copied=(sizeof(text)/sizeof(*text))-1;
if(copied>wp-1)copied=wp-1;
memcpy((void*)lp,text,copied*sizeof(*text));
((WCHAR*)lp)[copied]=0;
return copied;
}
return DefWindowProcW(window,message,wp,lp);
}
static LRESULT CALLBACK container_proc(HWND window,UINT message,WPARAM wp,LPARAM lp) {
if(message==WM_GETOBJECT && lp==OBJID_QUERYCLASSNAMEIDX){++synthetic_containers;Sleep(25);}
return DefWindowProcW(window,message,wp,lp);
}
static LRESULT CALLBACK table_proc(HWND window, UINT message, WPARAM wp, LPARAM lp) {
if (message == LVM_GETITEMTEXTW && delay_table_read) {
delay_table_read=FALSE;
@@ -59,6 +81,7 @@ static LRESULT CALLBACK stall_proc(HWND window, UINT message, WPARAM wp, LPARAM
return DefWindowProcW(window,message,wp,lp);
}
static LRESULT CALLBACK edit_proc(HWND window, UINT message, WPARAM wp, LPARAM lp) {
if(message==EM_LINEINDEX && delay_batch){delay_batch=FALSE;Sleep(650);}
if (message == WM_GETTEXT && (GetWindowLongPtrW(window,GWL_STYLE) & ES_PASSWORD)) ++protected_text_reads;
if (message == WM_KEYDOWN) ++key_down;
if (message == WM_KEYUP) ++key_up;
@@ -87,6 +110,12 @@ static LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wp, LPARAM
return 0;
}
if (message == REVIEW_CONFIG) {
frame_pump=FALSE;
delay_batch=FALSE;
synthetic_containers=0;
ShowWindow(GetDlgItem(window,112),SW_HIDE);
ShowWindow(GetDlgItem(window,114),SW_HIDE);
ShowWindow(mdi,SW_HIDE);
SendMessageW(editor,EM_SETPASSWORDCHAR,0,0);
protect_during_length = replace_list_during_read = FALSE;
replace_table_during_read=FALSE;
@@ -105,6 +134,55 @@ static LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wp, LPARAM
SendMessageW(editor, EM_SETSEL, 0, 0);
MoveWindow(editor, 20, 35, 320, 90, TRUE);
switch (wp) {
case 33: ShowWindow(GetDlgItem(window,114),SW_SHOW); break;
case 32: {
WCHAR text[16384]; unsigned used = 0;
for (unsigned row = 0; row < 400; ++row) {
const WCHAR line[] = L"deep clipped visible line\r\n";
for (unsigned j = 0; j < (sizeof(line)/sizeof(*line))-1; ++j) text[used++] = line[j];
}
text[used] = 0;
SetWindowTextW(editor, text);
MoveWindow(editor, 20, -5000, 320, 5100, TRUE);
break;
}
case 30:
ShowWindow(mdi,SW_SHOW);
SendMessageW(mdi,WM_MDIACTIVATE,(WPARAM)mdi_active,0);
SendMessageW(mdi,WM_MDIMAXIMIZE,(WPARAM)mdi_active,0);
break;
case 31:
ShowWindow(mdi,SW_SHOW);
SendMessageW(mdi,WM_MDIRESTORE,(WPARAM)mdi_active,0);
SendMessageW(mdi,WM_MDIRESTORE,(WPARAM)mdi_background,0);
MoveWindow(mdi_background,0,0,240,300,TRUE);
MoveWindow(mdi_active,245,0,240,300,TRUE);
SendMessageW(mdi,WM_MDIACTIVATE,(WPARAM)mdi_active,0);
break;
case 28: {
WCHAR text[4096];unsigned used=0;
for(unsigned row=0;row<80;++row) {
const WCHAR line[]=L"top clipped visible line\r\n";
for(unsigned j=0;j<(sizeof(line)/sizeof(*line))-1;++j)text[used++]=line[j];
}
text[used]=0;SetWindowTextW(editor,text);
MoveWindow(editor,20,-250,320,380,TRUE);
break;
}
case 29:ShowWindow(GetDlgItem(window,112),SW_SHOW);break;
case 27:delay_batch=TRUE;break;
case 26: {
WCHAR text[4096];unsigned used=0;
for(unsigned row=0;row<80;++row) {
const WCHAR line[]=L"stable buffered output line\r\n";
for(unsigned j=0;j<(sizeof(line)/sizeof(*line))-1;++j)text[used++]=line[j];
}
text[used]=0;SetWindowTextW(editor,text);
MoveWindow(editor,20,35,320,380,TRUE);
ShowWindow(output,SW_HIDE);ShowWindow(GetDlgItem(window,106),SW_HIDE);
frame_pump=TRUE;
break;
}
case 1: // surrogate before first displayed row, absolute offsets
SetWindowTextW(editor, L"\U0001f600alpha\r\nbeta\r\nlast");
SendMessageW(editor, EM_LINESCROLL, 0, 1);
@@ -166,6 +244,7 @@ static LRESULT CALLBACK window_proc(HWND window, UINT message, WPARAM wp, LPARAM
return 1;
}
if (message == REVIEW_PRIVACY_CHECK) return protected_text_reads == 0;
if (message == WM_APP+16) return synthetic_containers==0;
if (message == REVIEW_REMOTE_CHECK) return !freed_table_memory;
if (message == REVIEW_CHECK || message == REVIEW_CHECK_RIGHT || message == REVIEW_CHECK_STRICT) {
DWORD start = 0, end = 0;
@@ -243,11 +322,31 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE previous, LPSTR args, int show)
CreateWindowW(L"Static",L"literal & label",WS_CHILD|SS_NOPREFIX,
20,365,200,20,window,(HMENU)111,instance,NULL);
CreateWindowW(stall.lpszClassName,L"",WS_CHILD|WS_VISIBLE,350,150,150,20,window,NULL,instance,NULL);
WNDCLASSW container={0};container.lpfnWndProc=container_proc;container.hInstance=instance;container.lpszClassName=L"WineAccessNativeContainer";
RegisterClassW(&container);
HWND parent=CreateWindowW(container.lpszClassName,L"",WS_CHILD,20,35,320,100,window,(HMENU)112,instance,NULL);
for(unsigned level=0;level<8;++level)parent=CreateWindowW(container.lpszClassName,L"",WS_CHILD|WS_VISIBLE,0,0,320,100,parent,NULL,instance,NULL);
CreateWindowW(L"Edit",L"nested output ready",WS_CHILD|WS_VISIBLE|ES_READONLY,0,0,320,80,parent,NULL,instance,NULL);
WNDCLASSW mdi_child={0};mdi_child.lpfnWndProc=DefMDIChildProcW;mdi_child.hInstance=instance;mdi_child.lpszClassName=L"WineAccessMdiChild";
RegisterClassW(&mdi_child);
CLIENTCREATESTRUCT client_create={NULL,200};
mdi=CreateWindowW(L"MDIClient",L"",WS_CHILD|WS_CLIPCHILDREN,20,35,500,350,window,(HMENU)113,instance,&client_create);
mdi_background=CreateMDIWindowW(mdi_child.lpszClassName,L"Background",WS_OVERLAPPEDWINDOW|WS_VISIBLE,0,0,240,300,mdi,instance,0);
CreateWindowW(L"Edit",L"covered mdi text",WS_CHILD|WS_VISIBLE|ES_READONLY,0,0,220,100,mdi_background,NULL,instance,NULL);
mdi_active=CreateMDIWindowW(mdi_child.lpszClassName,L"Active",WS_OVERLAPPEDWINDOW|WS_VISIBLE,245,0,240,300,mdi,instance,0);
CreateWindowW(L"Edit",L"active mdi text",WS_CHILD|WS_VISIBLE|ES_READONLY,0,0,220,100,mdi_active,NULL,instance,NULL);
WNDCLASSW status=cls;status.lpszClassName=L"WineAccessStatusFixture";status.lpfnWndProc=status_proc;
RegisterClassW(&status);
CreateWindowW(status.lpszClassName,L"",WS_CHILD,20,420,480,20,window,(HMENU)114,instance,NULL);
ShowWindow(window, SW_SHOW);
SendMessageW(window, REVIEW_CONFIG, 0, 0);
if (secondary) SetTimer(window,1,400,NULL);
MSG message;
while (GetMessageW(&message, NULL, 0, 0) > 0) {
for (;;) {
if (frame_pump) {
if (!PeekMessageW(&message,NULL,0,0,PM_REMOVE)) { Sleep(16);continue; }
if (message.message==WM_QUIT)break;
} else if (GetMessageW(&message,NULL,0,0)<=0)break;
TranslateMessage(&message); DispatchMessageW(&message);
}
return 0;