https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f6e819fcb82eea5db0e8ff...
commit f6e819fcb82eea5db0e8ff39e2817dde4fff45c7 Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Mon Feb 11 23:44:01 2019 +0100 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Mon Feb 11 23:44:01 2019 +0100
[SNDVOL32] Read the Style value from the registry and use it as the default display mode. The /n option is no longer needed.
CORE-15743 --- base/applications/sndvol32/misc.c | 30 ++++++++++++++++++++++++++++-- base/applications/sndvol32/sndvol32.c | 14 ++++++-------- base/applications/sndvol32/sndvol32.h | 3 +++ 3 files changed, 37 insertions(+), 10 deletions(-)
diff --git a/base/applications/sndvol32/misc.c b/base/applications/sndvol32/misc.c index 1f0ff8496d..670fa12f25 100644 --- a/base/applications/sndvol32/misc.c +++ b/base/applications/sndvol32/misc.c @@ -128,9 +128,9 @@ LoadAndFormatString(IN HINSTANCE hInstance, }
static const TCHAR AppRegSettings[] = TEXT("Software\Microsoft\Windows\CurrentVersion\Applets\Volume Control"); -//static const TCHAR AppOptionsKey[] = TEXT("Options"); +static const TCHAR AppOptionsKey[] = TEXT("Options"); static const TCHAR LineStatesValue[] = TEXT("LineStates"); -//static const TCHAR StyleValue[] = TEXT("Style"); +static const TCHAR StyleValue[] = TEXT("Style");
HKEY hAppSettingsKey = NULL;
@@ -273,3 +273,29 @@ ExitClose:
return Ret; } + +DWORD +GetStyleValue(VOID) +{ + HKEY hOptionsKey; + DWORD dwStyle = 0, dwSize; + + if (RegOpenKeyEx(hAppSettingsKey, + AppOptionsKey, + 0, + KEY_READ, + &hOptionsKey) == ERROR_SUCCESS) + { + dwSize = sizeof(DWORD); + RegQueryValueEx(hOptionsKey, + StyleValue, + NULL, + NULL, + (LPBYTE)&dwStyle, + &dwSize); + + RegCloseKey(hOptionsKey); + } + + return dwStyle; +} diff --git a/base/applications/sndvol32/sndvol32.c b/base/applications/sndvol32/sndvol32.c index 29e6dcf367..011bec2f12 100644 --- a/base/applications/sndvol32/sndvol32.c +++ b/base/applications/sndvol32/sndvol32.c @@ -1322,13 +1322,14 @@ CreateApplicationWindow( static BOOL HandleCommandLine(LPTSTR cmdline, + DWORD dwStyle, PWINDOW_MODE pMode, PUINT pMixerId) { TCHAR option;
*pMixerId = 0; - *pMode = SMALL_MODE; + *pMode = (dwStyle & 0x20) ? SMALL_MODE : NORMAL_MODE;
while (*cmdline == _T(' ') || *cmdline == _T('-') || *cmdline == _T('/')) { @@ -1347,11 +1348,6 @@ HandleCommandLine(LPTSTR cmdline, case 'D': break;
- case 'n': /* Normal size */ - case 'N': - *pMode = NORMAL_MODE; - break; - case 's': /* Small size */ case 'S': *pMode = SMALL_MODE; @@ -1391,6 +1387,7 @@ _tWinMain(HINSTANCE hInstance, INITCOMMONCONTROLSEX Controls; WINDOW_MODE WindowMode = SMALL_MODE; UINT MixerId = 0; + DWORD dwStyle;
UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(nCmdShow); @@ -1398,10 +1395,11 @@ _tWinMain(HINSTANCE hInstance, hAppInstance = hInstance; hAppHeap = GetProcessHeap();
- HandleCommandLine(lpszCmdLine, &WindowMode, &MixerId); - if (InitAppConfig()) { + dwStyle = GetStyleValue(); + HandleCommandLine(lpszCmdLine, dwStyle, &WindowMode, &MixerId); + /* load the application title */ if (!AllocAndLoadString(&lpAppTitle, hAppInstance, diff --git a/base/applications/sndvol32/sndvol32.h b/base/applications/sndvol32/sndvol32.h index cf20366480..65fcb36176 100644 --- a/base/applications/sndvol32/sndvol32.h +++ b/base/applications/sndvol32/sndvol32.h @@ -185,6 +185,9 @@ WriteLineConfig(IN LPTSTR szDeviceName, IN PSNDVOL_REG_LINESTATE LineState, IN DWORD cbSize);
+DWORD +GetStyleValue(VOID); + /* tray.c */
INT_PTR