https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8467d6edd111c8bd47a3ab...
commit 8467d6edd111c8bd47a3ab1d7970f386fa951b3b Author: Mark Jansen mark.jansen@reactos.org AuthorDate: Tue Feb 19 23:32:51 2019 +0300 Commit: Hermès BÉLUSCA - MAÏTO hermes.belusca-maito@reactos.org CommitDate: Wed Feb 20 13:57:44 2019 +0100
[SNDVOL32] Fix parsing dialog icons --- base/applications/sndvol32/dialog.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/base/applications/sndvol32/dialog.c b/base/applications/sndvol32/dialog.c index f0d5d39a84..781a59ea44 100644 --- a/base/applications/sndvol32/dialog.c +++ b/base/applications/sndvol32/dialog.c @@ -77,7 +77,8 @@ AddDialogControl( { RECT rect; LPWORD Offset; - LPWSTR ClassName, WindowName = NULL; + LPWSTR ClassName, WindowName; + WCHAR WindowIdBuf[sizeof("#65535")]; HWND hwnd; DWORD wID; INT nSteps, i; @@ -109,32 +110,42 @@ AddDialogControl( { case 0x80: ClassName = L"button"; - WindowName = (LPWSTR)(Offset + 1); break ; case 0x82: ClassName = L"static"; - WindowName = (LPWSTR)(Offset + 1); break; default: /* FIXME */ assert(0); ClassName = NULL; } + Offset++; } else { /* class name is encoded as string */ - ClassName = (LPWSTR)Offset; + ClassName = (LPWSTR)(Offset);
/* 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) { @@ -242,11 +253,6 @@ AddDialogControl( 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 */ if (*Offset == 0)