[MSIEXEC]
[reactos.git] / reactos / base / system / msiexec / msiexec.c
index 9f20b5b..fe19d98 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * msiexec.exe implementation
  *
- * Copyright 2004 Vincent Béron
+ * Copyright 2004 Vincent Béron
  * Copyright 2005 Mike McCormack
  *
  * This library is free software; you can redistribute it and/or
@@ -47,6 +47,7 @@ static const char UsageStr[] =
 "  Install a product:\n"
 "    msiexec {package|productcode} [property]\n"
 "    msiexec /i {package|productcode} [property]\n"
+"    msiexec /package {package|productcode} [property]\n"
 "    msiexec /a package [property]\n"
 "  Repair an installation:\n"
 "    msiexec /f[p|o|e|d|c|a|u|m|s|v] {package|productcode}\n"
@@ -69,7 +70,7 @@ static const char UsageStr[] =
 "    msiexec {/h|/?}\n"
 "NOTE: Product code on commandline unimplemented as of yet\n"
 "\n"
-"Copyright 2004 Vincent Béron\n";
+"Copyright 2004 Vincent Béron\n";
 
 static const WCHAR ActionAdmin[] = {
    'A','C','T','I','O','N','=','A','D','M','I','N',0 };
@@ -388,9 +389,9 @@ enum chomp_state
 
 static int chomp( WCHAR *str )
 {
-       enum chomp_state state = cs_whitespace;
+       enum chomp_state state = cs_token;
        WCHAR *p, *out;
-       int count = 0, ignore;
+       int count = 1, ignore;
 
        for( p = str, out = str; *p; p++ )
        {
@@ -493,7 +494,7 @@ static BOOL process_args_from_reg( LPWSTR ident, int *pargc, WCHAR ***pargv )
        return ret;
 }
 
-int main(int argc, char **argv)
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
 {
        int i;
        BOOL FunctionInstall = FALSE;
@@ -529,9 +530,10 @@ int main(int argc, char **argv)
 
        LPWSTR DllName = NULL;
        DWORD ReturnCode;
+       int argc;
        LPWSTR *argvW = NULL;
 
-       /* overwrite the command line */
+       /* parse the command line */
        process_args( GetCommandLineW(), &argc, &argvW );
 
        /*
@@ -561,12 +563,13 @@ int main(int argc, char **argv)
                {
                        FunctionUnregServer = TRUE;
                }
-               else if(msi_option_prefix(argvW[i], "i"))
+               else if(msi_option_prefix(argvW[i], "i") || msi_option_prefix(argvW[i], "package"))
                {
                        LPWSTR argvWi = argvW[i];
+                       int argLen = (msi_option_prefix(argvW[i], "i") ? 2 : 8);
                        FunctionInstall = TRUE;
-                       if(lstrlenW(argvWi) > 2)
-                               argvWi += 2;
+                       if(lstrlenW(argvW[i]) > argLen)
+                               argvWi += argLen;
                        else
                        {
                                i++;