Merge branch 'mr-winhlp-fix-title' into 'master'

winhlp32: Fix main window title.

See merge request wine/wine!4758
This commit is contained in:
eric pouech 2024-11-19 22:36:43 +00:00
commit 42c015940f
2 changed files with 19 additions and 13 deletions

View file

@ -2055,9 +2055,16 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile)
if (hlpfile->version <= 16)
{
char *str = (char*)buf + 0x15;
char tmp[40];
LPCSTR filename = strrchr(hlpfile->lpszPath, '\\');
size_t len;
if (!filename) filename = hlpfile->lpszPath; else filename++;
LoadStringA(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp));
len = strlen(str) + 1 + strlen(tmp) + 3 + strlen(filename) + 1;
if (!(hlpfile->lpszTitle = malloc(len))) return FALSE;
_snprintf(hlpfile->lpszTitle, len, "%s %s - %s", str, tmp, filename);
hlpfile->lpszTitle = strdup(str);
if (!hlpfile->lpszTitle) return FALSE;
WINE_TRACE("Title: %s\n", debugstr_a(hlpfile->lpszTitle));
/* Nothing more to parse */
return TRUE;
@ -2069,7 +2076,14 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile)
{
case 1:
if (hlpfile->lpszTitle) {WINE_WARN("title\n"); break;}
hlpfile->lpszTitle = strdup(str);
if (*str)
hlpfile->lpszTitle = strdup(str);
else
{
char tmp[40];
LoadStringA(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp));
hlpfile->lpszTitle = strdup(tmp);
}
if (!hlpfile->lpszTitle) return FALSE;
WINE_TRACE("Title: %s\n", debugstr_a(hlpfile->lpszTitle));
break;
@ -2123,7 +2137,7 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile)
if (flags & 0x0002) strcpy(wi->name, &str[12]);
else wi->name[0] = '\0';
if (flags & 0x0004) strcpy(wi->caption, &str[21]);
else lstrcpynA(wi->caption, hlpfile->lpszTitle, sizeof(wi->caption));
else wi->caption[0] = '\0';
wi->origin.x = (flags & 0x0008) ? GET_USHORT(ptr, 76) : CW_USEDEFAULT;
wi->origin.y = (flags & 0x0010) ? GET_USHORT(ptr, 78) : CW_USEDEFAULT;
wi->size.cx = (flags & 0x0020) ? GET_USHORT(ptr, 80) : CW_USEDEFAULT;

View file

@ -271,15 +271,7 @@ HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name)
{
strcpy(mwi.type, "primary");
strcpy(mwi.name, "main");
if (hlpfile && hlpfile->lpszTitle[0])
{
char tmp[40];
LoadStringA(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp));
_snprintf(mwi.caption, sizeof(mwi.caption), "%s %s - %s",
hlpfile->lpszTitle, tmp, hlpfile->lpszPath);
}
else
LoadStringA(Globals.hInstance, STID_WINE_HELP, mwi.caption, sizeof(mwi.caption));
mwi.caption[0] = '\0';
mwi.origin.x = mwi.origin.y = mwi.size.cx = mwi.size.cy = CW_USEDEFAULT;
mwi.style = SW_SHOW;
mwi.win_style = WS_OVERLAPPEDWINDOW;