improved error handling Modified: trunk/reactos/subsys/system/sndvol32/misc.c Modified: trunk/reactos/subsys/system/sndvol32/mixer.c Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.c Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.h _____
Modified: trunk/reactos/subsys/system/sndvol32/misc.c --- trunk/reactos/subsys/system/sndvol32/misc.c 2005-09-28 12:26:33 UTC (rev 18133) +++ trunk/reactos/subsys/system/sndvol32/misc.c 2005-09-28 13:00:05 UTC (rev 18134) @@ -15,8 +15,6 @@
* You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * VMware is a registered trademark of VMware, Inc. */ /* $Id$ * _____
Modified: trunk/reactos/subsys/system/sndvol32/mixer.c --- trunk/reactos/subsys/system/sndvol32/mixer.c 2005-09-28 12:26:33 UTC (rev 18133) +++ trunk/reactos/subsys/system/sndvol32/mixer.c 2005-09-28 13:00:05 UTC (rev 18134) @@ -15,8 +15,6 @@
* You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * VMware is a registered trademark of VMware, Inc. */ /* $Id$ * _____
Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.c --- trunk/reactos/subsys/system/sndvol32/sndvol32.c 2005-09-28 12:26:33 UTC (rev 18133) +++ trunk/reactos/subsys/system/sndvol32/sndvol32.c 2005-09-28 13:00:05 UTC (rev 18134) @@ -15,8 +15,6 @@
* You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * VMware is a registered trademark of VMware, Inc. */ /* $Id$ * @@ -115,8 +113,6 @@ { PrefContext->SelectedLine = Line->dwLineID; } - - DPRINT("!%ws cControls: %d\n", Line->szName, Line->cControls); } else goto AddToOthersLines; @@ -132,7 +128,6 @@ { PrefContext->SelectedLine = Line->dwLineID; } - DPRINT("!%ws cControls: %d\n", Line->szName, Line->cControls); } else goto AddToOthersLines; @@ -550,7 +545,7 @@ { }
-BOOL +static BOOL RebuildMixerWindowControls(PMIXER_WINDOW MixerWindow) { DeleteMixerWindowControls(MixerWindow); @@ -558,7 +553,7 @@ return TRUE; }
-LRESULT CALLBACK +static LRESULT CALLBACK MainWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, @@ -658,6 +653,7 @@ { DPRINT("Rebuilding mixer window controls failed!\n"); SndMixerDestroy(MixerWindow->Mixer); + MixerWindow->Mixer = NULL; Result = -1; } } @@ -770,14 +766,16 @@ */
hWnd = NULL; - AllocAndLoadString(&lpErrMessage, - hAppInstance, - IDS_NOMIXERDEVICES); - MessageBox(NULL, - lpErrMessage, - lpAppTitle, - MB_ICONINFORMATION); - LocalFree(lpErrMessage); + if (AllocAndLoadString(&lpErrMessage, + hAppInstance, + IDS_NOMIXERDEVICES)) + { + MessageBox(NULL, + lpErrMessage, + lpAppTitle, + MB_ICONINFORMATION); + LocalFree(lpErrMessage); + } }
if (hWnd == NULL) @@ -797,59 +795,68 @@ int nCmdShow) { MSG Msg; + int Ret = 1;
hAppInstance = hInstance; hAppHeap = GetProcessHeap();
- if (!InitAppConfig()) + if (InitAppConfig()) { - DPRINT("Unable to open the Volume Control registry key!\n"); - return 1; - } - - /* load the application title */ - if (AllocAndLoadString(&lpAppTitle, - hAppInstance, - IDS_SNDVOL32) == 0) - { - lpAppTitle = NULL; - } + /* load the application title */ + if (!AllocAndLoadString(&lpAppTitle, + hAppInstance, + IDS_SNDVOL32)) + { + lpAppTitle = NULL; + }
- InitCommonControls(); + InitCommonControls();
- if (!RegisterApplicationClasses()) - { - DPRINT("Failed to register application classes (LastError: %d)!\n", GetLastError()); - return 1; - } + if (RegisterApplicationClasses()) + { + hMainWnd = CreateApplicationWindow(); + if (hMainWnd != NULL) + { + BOOL bRet; + while ((bRet =GetMessage(&Msg, + NULL, + 0, + 0)) != 0) + { + if (bRet != -1) + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } + }
- hMainWnd = CreateApplicationWindow(); - if (hMainWnd == NULL) - { - DPRINT("Failed to creat application window (LastError: %d)!\n", GetLastError()); - return 1; - } + DestroyWindow(hMainWnd); + Ret = 0; + } + else + { + DPRINT("Failed to creat application window (LastError: %d)!\n", GetLastError()); + }
- while (GetMessage(&Msg, - NULL, - 0, - 0)) - { - TranslateMessage(&Msg); - DispatchMessage(&Msg); - } + UnregisterApplicationClasses(); + } + else + { + DPRINT("Failed to register application classes (LastError: %d)!\n", GetLastError()); + }
- DestroyWindow(hMainWnd); + if (lpAppTitle != NULL) + { + LocalFree(lpAppTitle); + }
- UnregisterApplicationClasses(); - - if (lpAppTitle != NULL) + CloseAppConfig(); + } + else { - LocalFree(lpAppTitle); + DPRINT("Unable to open the Volume Control registry key!\n"); } - - CloseAppConfig();
- return 0; + return Ret; }
_____
Modified: trunk/reactos/subsys/system/sndvol32/sndvol32.h --- trunk/reactos/subsys/system/sndvol32/sndvol32.h 2005-09-28 12:26:33 UTC (rev 18133) +++ trunk/reactos/subsys/system/sndvol32/sndvol32.h 2005-09-28 13:00:05 UTC (rev 18134) @@ -18,10 +18,6 @@
UINT SelectedLine; } MIXER_WINDOW, *PMIXER_WINDOW;
-LRESULT CALLBACK MainWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); - -BOOL RebuildMixerWindowControls(PMIXER_WINDOW MixerWindow); - extern HINSTANCE hAppInstance; extern ATOM MainWindowClass; extern HWND hMainWnd;