From a300682f5345e35dae580892f69bf8fbd19268b9 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Thu, 9 Oct 2003 19:45:54 +0000 Subject: [PATCH] Handle quoting on the command line in uninstaller. --- programs/uninstaller/Makefile.in | 2 +- programs/uninstaller/main.c | 50 +++++++++++++++++++------------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/programs/uninstaller/Makefile.in b/programs/uninstaller/Makefile.in index bc0f072c2c5..bc6b84963b6 100644 --- a/programs/uninstaller/Makefile.in +++ b/programs/uninstaller/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = uninstaller.exe -APPMODE = gui +APPMODE = cui IMPORTS = user32 gdi32 advapi32 kernel32 C_SRCS = \ diff --git a/programs/uninstaller/main.c b/programs/uninstaller/main.c index 246da848b1e..80e55e266d7 100644 --- a/programs/uninstaller/main.c +++ b/programs/uninstaller/main.c @@ -121,33 +121,43 @@ void RemoveSpecificProgram(char *name) } } - -int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmdshow ) +int main( int argc, char *argv[]) { MSG msg; WNDCLASS wc; HWND hWnd; + LPSTR token = NULL; + int i = 1; + HINSTANCE hInst = NULL; - /*------------------------------------------------------------------------ - ** Handle requests just to list the programs - **----------------------------------------------------------------------*/ - if (cmdline && strlen(cmdline) >= 6 && memcmp(cmdline, "--list", 6) == 0) + while( i= argc ) + { + WINE_ERR( "The remove option requires a parameter.\n"); + return 1; + } + + RemoveSpecificProgram( argv[i++] ); + return 0; + } + else + { + WINE_ERR( "unknown option %s\n",token); + return 1; + } } - /*------------------------------------------------------------------------ - ** Handle requests to remove one program - **----------------------------------------------------------------------*/ - if (cmdline && strlen(cmdline) > 9 && memcmp(cmdline, "--remove ", 9) == 0) - { - RemoveSpecificProgram(cmdline + 9); - return(0); - } - - - LoadString( hInst, IDS_APPNAME, appname, sizeof(appname)); wc.style = 0; @@ -169,7 +179,7 @@ int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdline, int cmd if (!hWnd) exit(1); - ShowWindow( hWnd, cmdshow ); + ShowWindow( hWnd, SW_SHOW ); UpdateWindow( hWnd ); while( GetMessage(&msg, NULL_HANDLE, 0, 0) ) {