home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,694 of 243,242   
   Michael S to ldo@nz.invalid   
   Re: srand(0)   
   02 Jan 26 14:32:07   
   
   From: already5chosen@yahoo.com   
      
   On Thu, 1 Jan 2026 23:50:00 -0000 (UTC)   
   Lawrence D’Oliveiro  wrote:   
      
   > On Thu, 1 Jan 2026 21:53:20 +0200, Michael S wrote:   
   >    
   > > On Thu, 1 Jan 2026 19:02:49 -0000 (UTC)   
   > > Lawrence D’Oliveiro  wrote:   
   > >     
   > >> All those are at the sending end. But what would C code see at the   
   > >> receiving end?     
   > >   
   > > The first three cases look very simple.     
   >    
   > Is there some spec in Windows which describes how that works?   
      
   There is a spec that describes how that works in Microsoft's   
   implementation. That implementation is available free of charge to   
   other Windows compilers.   
   If vendor of Windows 'C' compiler decided to implement different   
   algorithm then nobody can stop him.   
      
   Through the years you were told so, by different people, and shown   
   the spec may be 100 times. But being the trolll you are, you continue   
   to ask.   
      
   Still, for the benefit of more sincere readers and also for myself, in   
   order to have both pieces in one place:   
   https://learn.microsoft.com/en-us/windows/win32/api/shellapi/nf-   
   hellapi-commandlinetoargvw   
   https://learn.microsoft.com/en-us/cpp/c-language/parsing-c-comma   
   d-line-arguments   
      
      
   More interesting and meaningful question is how to do the reverse.   
   I.e. how to convert an argv[] array into flat form in a way that   
   guarantees that CommandLineToArgvW() parses it back into original form?   
   Is it even possible in general case or there exist limitations   
   (ignoring, for sake of brevity, 2*15-1 size limit)?   
      
   Microsoft certainly has reverse conversion implemented, e.g. here:   
   https://learn.microsoft.com/en-us/cpp/c-runtime-library/referenc   
   /spawnv-wspawnv   
      
   But I am not aware of command line serialization part available as a   
   library call in isolation from process creation part.   
      
   I binged around and googled around, but all I was able to find was the   
   name of the function that performs the work:   
   __acrt_pack_wide_command_line_and_environment    
      
   I was not able to find the source code of the function.   
      
   [O.T.]   
   I am sure that 15, 10 or even 5 years ago Google would give me link to   
   the source in a second. Or, may be, 5 years ago Google already   
   wouldn't, but Bing still would.   
   But today both search engines are hopelessly crippled with AI and do not   
   appear to actually search the web. Instead, the try to guess the   
   answer I likely want to hear.   
   [/O.T.]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca