May 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5926



--- Comment #10 from Denis <verylonglogin.reg@gmail.com> 2011-05-04 22:04:18 PDT ---
argv is in windows multi byte format and just can't store every UTF-16 symbol. But, in old windows there are no *W functions to create a process with UTF-16 argumants. Maybe it is possible, but we don't want to support such unusual cases. So, the reasonable solution, I think, is just to use argv for old windows with MultiByteToWideChar instead of CommandLineToArgvW.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5926



--- Comment #11 from Walter Bright <bugzilla@digitalmars.com> 2011-05-04 22:30:42 PDT ---
Sounds reasonable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5926


Denis <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #960 is|0                           |1
           obsolete|                            |


--- Comment #12 from Denis <verylonglogin.reg@gmail.com> 2011-05-04 23:18:12 PDT ---
Created an attachment (id=961)
changes in rt.dmain2, version (Windows) section (from line 371)

If there is no mistakes, it should help. For CommandLineToArgvW case the only change is that it really suppose "wargc == argc". For added case in loop "&wargs[i][0]" is just replaced with big enough "warg" with UTF-16 version of argv[i].

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5926



--- Comment #13 from Denis <verylonglogin.reg@gmail.com> 2011-05-04 23:24:27 PDT ---
(From update of attachment 961)
    version (Windows)
    {
        wchar_t*  wcbuf = GetCommandLineW();
        size_t    wclen = wcslen(wcbuf);

        char*     cargp = null;
        size_t    cargl = WideCharToMultiByte(65001, 0, wcbuf, wclen, null, 0,
null, 0);

        cargp = cast(char*) alloca(cargl);
        args  = ((cast(char[]*) alloca(argc * (char[]).sizeof)))[0 .. argc];

        if(GetVersion() < 0x80000000) //useWfuncs
        {
            int       wargc = 0;
            wchar_t** wargs = CommandLineToArgvW(wcbuf, &wargc);
            assert(wargc == argc);

            for (size_t i = 0, p = 0; i < wargc; i++)
            {
                int wlen = wcslen(wargs[i]);
                int clen = WideCharToMultiByte(65001, 0, &wargs[i][0], wlen,
null, 0, null, 0);
                args[i]  = cargp[p .. p+clen];
                p += clen; assert(p <= cargl);
                WideCharToMultiByte(65001, 0, &wargs[i][0], wlen, &args[i][0],
clen, null, 0);
            }
            LocalFree(wargs);
        }
        else
        {
            size_t   wargSize = (wclen + 1) * wchar_t.sizeof;
            wchar_t* warg = cast(wchar_t*) malloc(wargSize); //or alloca is
better?
            for (size_t i = 0, p = 0; i < argc; i++)
            {
                int wlen = MultiByteToWideChar(0, 0, argv[i], -1, warg,
wargSize);
                int clen = WideCharToMultiByte(65001, 0, &warg[0], wlen, null,
0, null, 0);
                args[i]  = cargp[p .. p+clen];
                p += clen; assert(p <= cargl);
                WideCharToMultiByte(65001, 0, &warg[0], wlen, &args[i][0],
clen, null, 0);
            }
            free(warg); //if alloca isn't better
        }
    }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 05, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5926


Denis <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #961 is|0                           |1
           obsolete|                            |


--- Comment #14 from Denis <verylonglogin.reg@gmail.com> 2011-05-04 23:38:53 PDT ---
Created an attachment (id=962)
changes (v2) in rt.dmain2, version (Windows) section (from line 371)

Same thing, but without stupid trying to free() alloca's stack memory. Now with separate function to free alloca. Is it good? Does it work?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 10, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5926


Denis <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P5
           Severity|major                       |minor


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 21, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5926



--- Comment #15 from Walter Bright <bugzilla@digitalmars.com> 2012-01-20 22:00:30 PST ---
(In reply to comment #14)
> Created an attachment (id=962) [details]
> Is it good? Does it work?

Would you like to make a github pull request for this?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5926



--- Comment #16 from Denis <verylonglogin.reg@gmail.com> 2012-01-22 20:40:18 MSK ---
Personally I would vote for marking Windows prior to 2000 as unsupported because this support doesn't worth making druntime/Phobos more complicated. Phobos already contains lots of things like `std.__fileinit` that can be removed to make it easier to support.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5926


Denis Shelomovskij <verylonglogin.reg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |WONTFIX


--- Comment #17 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2012-07-02 11:57:06 MSD ---
Marked as WONTFIX because of a rid of Win9x support since 2.059.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
1 2
Next ›   Last »