[SNDVOL32] Fix parsing dialog icons

This commit is contained in:
Mark Jansen 2019-02-19 23:32:51 +03:00 committed by Hermès BÉLUSCA - MAÏTO
parent 0eaeb9de4c
commit 8467d6edd1

View file

@ -77,7 +77,8 @@ AddDialogControl(
{ {
RECT rect; RECT rect;
LPWORD Offset; LPWORD Offset;
LPWSTR ClassName, WindowName = NULL; LPWSTR ClassName, WindowName;
WCHAR WindowIdBuf[sizeof("#65535")];
HWND hwnd; HWND hwnd;
DWORD wID; DWORD wID;
INT nSteps, i; INT nSteps, i;
@ -109,32 +110,42 @@ AddDialogControl(
{ {
case 0x80: case 0x80:
ClassName = L"button"; ClassName = L"button";
WindowName = (LPWSTR)(Offset + 1);
break ; break ;
case 0x82: case 0x82:
ClassName = L"static"; ClassName = L"static";
WindowName = (LPWSTR)(Offset + 1);
break; break;
default: default:
/* FIXME */ /* FIXME */
assert(0); assert(0);
ClassName = NULL; ClassName = NULL;
} }
Offset++;
} }
else else
{ {
/* class name is encoded as string */ /* class name is encoded as string */
ClassName = (LPWSTR)Offset; ClassName = (LPWSTR)(Offset);
/* move offset to the end of class string */ /* move offset to the end of class string */
Offset += wcslen(ClassName); Offset += wcslen(ClassName) + 1;
}
/* get window name */
WindowName = (LPWSTR)(Offset + 1); if (*Offset == 0xFFFF)
{
/* Window name is encoded as ordinal */
Offset++;
wsprintf(WindowIdBuf, L"#%u", (DWORD)*Offset);
WindowName = WindowIdBuf;
Offset++;
}
else
{
/* window name is encoded as string */
WindowName = (LPWSTR)(Offset);
/* move offset to the end of class string */
Offset += wcslen(WindowName) + 1;
} }
/* move offset past class type/string */
Offset++;
if (DialogItem->id == MAXWORD) if (DialogItem->id == MAXWORD)
{ {
@ -242,11 +253,6 @@ AddDialogControl(
SendMessageW(hwnd, WM_SETFONT, (WPARAM)hFont, TRUE); SendMessageW(hwnd, WM_SETFONT, (WPARAM)hFont, TRUE);
} }
if (WindowName != NULL)
{
/* move offset past window name */
Offset += wcslen(WindowName) + 1;
}
/* check if there is additional data */ /* check if there is additional data */
if (*Offset == 0) if (*Offset == 0)