lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Sep 9, 2008 at 1:07 PM, Chris <coderight@gmail.com> wrote:
> On Tue, Sep 9, 2008 at 4:33 AM, Robert Raschke <rtrlists@googlemail.com> wrote:
>>                LPTSTR szCmdline = lua_tostring(L, 1);
>>
>> <...snip...>
>>
>>                if (! CreateProcess(NULL, szCmdline, NULL, NULL, FALSE, DETACHED_PROCESS,
>
> I'm surprised that using szCmdLine like that works.  The second
> parameter to CreateProcess is not const (it's an in/out parameter) and
> on my system CreateProcess modifies it which sometimes causes a crash.

Ah, you are right. I'd forgotten about that, since I always run in
Ansi mode. It's the Unicode one that rewrites the string. So for that,
you need to take a copy.

Thanks for pointing that out.

Robby