<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Sorry it took me so long to respond.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">What this actually does is it changes the ps output so that the wine binary doesn't show up in the command line. Naturally, it relies on the argv block being one huge null-null-terminated list of strings (as most UNIX-like systems do, apparently). If you're not building your argv this way, then yes, wine will crash. Also, if wine's idea of the argv block isn't the one that the OS gave to main(), the ps output won't be affected.<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">The code that manipulates the argv block existed in the Linux case. I surmise, then, that we'd have this same problem there.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">I'd kinda like to keep it, but then we'd need some way to detect that the argv we have isn't the block that was passed to main(), or isn't a null-null-terminated string list. (Or, maybe I can use _NSGetArgv() on Mac OS... but then all the other systems we support will still have this problem, and since you've written your own loader, we can't really rely on the order of arguments being "wine" "program" "...".) If you'd like me to just gut that piece of code, I'll be happy to write a patch to do that.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Chip</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 6, 2016 at 4:03 PM, Theodore Dubois <span dir="ltr"><<a href="mailto:tblodt@icloud.com" target="_blank">tblodt@icloud.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I CC’d him on the original email.<br>
<br>
It would be neat if the wine program name could show up in Activity Monitor on OSX, so I can tell one wine process apart from another. There is a way to do it (<a href="http://stackoverflow.com/questions/4217947/setting-process-name-on-mac-os-x-at-runtime" rel="noreferrer" target="_blank">http://stackoverflow.com/questions/4217947/setting-process-name-on-mac-os-x-at-runtime</a>) but it requires undocumented APIs. (Damn.)<br>
<span class="HOEnZb"><font color="#888888"><br>
~Theodore<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> On Apr 6, 2016, at 3:35 PM, Ken Thomases <<a href="mailto:ken@codeweavers.com">ken@codeweavers.com</a>> wrote:<br>
><br>
> Ah, I see.  Yeah, that's weird.  Have you tried asking Chip directly?  I'm CC'ing him.<br>
><br>
> -Ken<br>
><br>
>> On Apr 6, 2016, at 4:53 PM, Theodore Dubois <<a href="mailto:tblodt@icloud.com">tblodt@icloud.com</a>> wrote:<br>
>><br>
>> Yes, I did. The problem is that the code assumes that argv[0] - argv[1] (= offset) is a meaningful quantity, which it isn’t because each string in the argv array came from strdup.<br>
>><br>
>> ~Theodore<br>
>><br>
>>> On Apr 6, 2016, at 2:14 PM, Ken Thomases <<a href="mailto:ken@codeweavers.com">ken@codeweavers.com</a>> wrote:<br>
>>><br>
>>> Did you allocate one more entry in your argv than is needed for actual arguments and put a terminating NULL?  You're supposed to.<br>
>>><br>
>>> -Ken<br>
>>><br>
>>>> On Apr 6, 2016, at 3:41 PM, Theodore Dubois <<a href="mailto:tblodt@icloud.com">tblodt@icloud.com</a>> wrote:<br>
>>>><br>
>>>> This patch causes a segfault in the event that __wine_main_argv is not the argv that got passed to main. This happened in a program I wrote that acts as a custom wine loader. It creates an argv by using malloc, then passes that to wine_init.<br>
>>>><br>
>>>> Why wouldn’t setprogname(argv[1]) be adequate?<br>
>>>><br>
>>>> ~Theodore<br>
>>>><br>
>>>>> On Feb 19, 2016, at 2:33 PM, Charles Davis <<a href="mailto:cdavis5x@gmail.com">cdavis5x@gmail.com</a>> wrote:<br>
>>>>><br>
>>>>> Signed-off-by: Charles Davis <<a href="mailto:cdavis5x@gmail.com">cdavis5x@gmail.com</a>><br>
>>><br>
>><br>
><br>
<br>
</div></div></blockquote></div><br></div>