[PATCH 3/6] CMD.EXE: Handle command line as Unicode

Ann & Jason Edmeades us at edmeades.me.uk
Fri May 25 16:06:14 CDT 2007


> int main (int argc, char *argv[])
> {
> +  LPWSTR *argvW = NULL;
> +  int     args;
> +  WCHAR  *cmdW  = NULL;

>If you will start using wmain() instead of main() you get unicode args for
>free, and that will help to avoid changing the command line parsing code.

Hi, Sorry for the delayed response - been away...

I'd never heard of that, but looking it up in google makes it look like this
should work, but when I change it all I get is a failure at build time:

Change was:
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -100,9 +100,8 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start);
  * winmain().
  */
 
-int main (int argc, char *argv[])
+int wmain (int argc, WCHAR *argvW[])
 {
-  LPWSTR *argvW = NULL;
   int     args;
   WCHAR  *cmd   = NULL;
   WCHAR string[1024];
@@ -122,7 +121,6 @@ int main (int argc, char *argv[])
   strcpyW(anykey, WCMD_LoadMessage(WCMD_ANYKEY));
 
   /* Get a Unicode command line */
-  argvW = CommandLineToArgvW( GetCommandLineW(), &argc );
   args  = argc;
 
   opt_c=opt_k=opt_q=opt_s=0;

Compile error was:

../../tools/winegcc/winegcc .....
../../dlls/winecrt0/libwinecrt0.a(exe_main.o): In function `main':
/home/wine/wine/dlls/winecrt0/exe_main.c:48: undefined reference to
`WinMain'

Does wine support this? I initially did it this way copying from
programs/msiexec

Jason





More information about the wine-devel mailing list