delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/29/18:57:50

Message-ID: <3B3CD4FB.2050300@earthlink.net>
Date: Fri, 29 Jun 2001 14:20:27 -0500
From: Jonathon Merz <jmerz42 AT earthlink DOT net>
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:0.9.1) Gecko/20010607
X-Accept-Language: en,pdf
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Incorrect resolution of COMSPEC environment variable on WinNT
References: <3B3CADA3 DOT 4000506 AT earthlink DOT net> <6923-Fri29Jun2001215309+0300-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii wrote:

> 
> However, why is this a problem in your case?  DOS programs in general
> and DJGPP programs in particular should not normally care about this.


My trouble is that I'm doing some small work on the Vim editor, improving the 
DOS/Windows installer for it.  For Windows versions, we make a call to 
regedit.exe to add a context menu entry for Vim via a generated .reg file.  I 
realize that it is strange to be using DJGPP to generate Windows executables, 
but in the interest of keeping things uniform, I am trying to keep the 
installer functioning the same way for all builds that will run on a Windows 
OS, even if they are technically DOS builds.  The trouble is that with a 
system("regedit ... "), regedit executes asynchronously, so we cannot know 
when it has completed, thus, it is unsafe to delete the .reg file.  As a way 
around this, with most of the compiler platforms Vim builds on, we can make 
the line system("start /wait regedit ..."), so that the installer does not 
regain control until regedit has finished, then we can delete the file.  That 
works fine on Win9x, ME, and 2000, where there is a start.exe executable that 
does that.  On WinNT, though, it turns out that start is a shell built-in for 
cmd.exe, but is not in command.com, thus the trouble.

 
> 
>>if there is a way to identify the operating system the program is
>>running under
>>
> 
> It's not easy.  For example, there's no easy way we know of to
> distinguish NT from Windows 2000.  But if you don't care about the
> difference, call _get_dos_version(1), and if it returns the version
> 5.50, you are on NT.
> 


That could work satisfactorily I think.  Windows 2000 should have a cmd.exe 
also, so calling cmd.exe explicitly shouldn't cause any headaches.


Thanks!


-Jon

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019