From fc0061f8f9f9c58b1e181773390f9c3897f103f8 Mon Sep 17 00:00:00 2001 From: Michael Jung Date: Mon, 14 Feb 2005 21:03:52 +0000 Subject: [PATCH] Added support for command line parameter '/D' to do drive detection from wineprefixcreate. --- programs/winecfg/main.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/programs/winecfg/main.c b/programs/winecfg/main.c index 6277dad2d0f..d1eb36aef87 100644 --- a/programs/winecfg/main.c +++ b/programs/winecfg/main.c @@ -190,6 +190,32 @@ doPropertySheet (HINSTANCE hInstance, HWND hOwner) return PropertySheet (&psh); } +/****************************************************************************** + * Name : ProcessCmdLine + * Description: Checks command line parameters for 'autodetect drives' option + * Parameters : lpCmdLine - the command line + * Returns : TRUE - if '/D' was found. Drive autodetection was carried out. + * FALSE - no '/D' option found in command line + * Notes : This is a very simple implementation, which only works + * correctly if the one and only cmd line option is '/D' or + * no option at all. Has to be reworked, if more options are to + * be supported. + */ +BOOL +ProcessCmdLine(LPSTR lpCmdLine) +{ + if ((lpCmdLine[0] == '/' || lpCmdLine[0] == '-') && + (lpCmdLine[1] == 'D' || lpCmdLine[1] == 'd')) + { + gui_mode = FALSE; + if (autodetect_drives()) { + apply_drive_changes(); + } + return TRUE; + } + + return FALSE; +} /***************************************************************************** * Name : WinMain @@ -203,7 +229,10 @@ doPropertySheet (HINSTANCE hInstance, HWND hOwner) int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow) { - + if (ProcessCmdLine(szCmdLine)) { + return 0; + } + /* Until winecfg is fully functional, warn users that it is incomplete and doesn't do anything */ if (!getenv("WINECFG_NOWARN")) { WINE_FIXME("The winecfg tool is not yet complete, and does not actually alter your configuration.\n");