To do this the "right way" you'd need to write a test case to show what happens on Windows when somebody tries to set the title of another window.
This test case has already been written. Almost all Diablo II bots change the window title of the Diablo II process. That's the whole reason why I started editing the SetWindowText() function, because before my edit, no D2 bots would work because it couldn't change the window title of D2. Now that I editted it, almost all D2 bots work.
properly by Wine, so though the above may work for a few applications, it doesn't seem like a solution that will work for everything.
I don't know of any app that that this will "screw up". In fact, looks like it'll fix more than just D2 bots, as seen on the FreeNode #winehq channel:
FreeNode-#winehq.log:Jun 05 22:36:14 <hikenboot> fixme:win:SetWindowTextW cannot set text L"The dynamic link library MFC42.DLL could not be found in the specified path" of other process window (nil)
FreeNode-#winehq.log:Jun 06 08:19:16 <Cham_> hmm weird... running it as root doesn't give that error but "fixme:win:SetWindowTextA cannot set text "Mozilla ActiveX Control v1.7.7 Setup""
The first log excerpt is in SetWindowTextW() which I haven't touched, but my patch could easily be applied in the W(), as mine is the A().
If this now works, you shouldn't just comment out the code in the if() statement, but instead remove the if() statement and FIXME all together.
The reason I commented it out instead of removing it is because I was thinking the function could test if a process is a child of another process, and if it is, then set the window text. And if it wasn't, don't set it. (Possibly this is what Windows really does, I'm not sure?) If it was editted to this then the function would still require:
SetLastError( ERROR_ACCESS_DENIED );
And possibly still require the FIXME I commented out. So instead of having to recode everything (granted it's an easy function/FIXME), all that would be needed is to remove the comments and add the parent/child checking code.
Jason Campbell jason@sysk-net.com