Added __wine_get_main_args to retrieve command-line arguments for the
application.
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec
index 1c66a3c..c76c4a9 100644
--- a/dlls/ntdll/ntdll.spec
+++ b/dlls/ntdll/ntdll.spec
@@ -1023,3 +1023,6 @@
@ cdecl __wine_dbg_header_trace(ptr str) __wine_dbg_header_trace
@ cdecl wine_dbg_vprintf(str ptr) wine_dbg_vprintf
@ varargs wine_dbg_printf(str) wine_dbg_printf
+
+# Command-line
+@ cdecl __wine_get_main_args(ptr) __wine_get_main_args
diff --git a/misc/options.c b/misc/options.c
index 3b4c0fc..a79b147 100644
--- a/misc/options.c
+++ b/misc/options.c
@@ -25,11 +25,6 @@
const char *usage;
};
-/* Most Windows C/C++ compilers use something like this to */
-/* access argc and argv globally: */
-int _ARGC;
-char **_ARGV;
-
/* default options */
struct options Options =
{
@@ -46,6 +41,9 @@
static char *inherit_str; /* options to pass to child processes */
+static int app_argc; /* argc/argv to pass to application */
+static char **app_argv;
+
static void out_of_memory(void) WINE_NORETURN;
static void out_of_memory(void)
{
@@ -342,7 +340,21 @@
}
/* count the resulting arguments */
- _ARGV = argv;
- _ARGC = 0;
- while (argv[_ARGC]) _ARGC++;
+ app_argv = argv;
+ app_argc = 0;
+ while (argv[app_argc]) app_argc++;
}
+
+
+/***********************************************************************
+ * __wine_get_main_args
+ *
+ * Return the argc/argv that the application should see.
+ * Used by the startup code generated in the .spec.c file.
+ */
+int __wine_get_main_args( char ***argv )
+{
+ *argv = app_argv;
+ return app_argc;
+}
+