🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #914

Re: TILDE-ONE file names ?

#914
From: Remy Lebeau (TeamB)
Date: Wed, 12 Dec 2007 23:35
56 lines
3402 bytes
"Mike K" <nospam@nospam.net> wrote in message 
news:47605d31$1@newsgroups.borland.com...

> First: why does this call work:
<snip>

Because it is using 8.3 naming that do not have any embedded spaces inside 
the folder/file names.

> but this one does not?
<snip>

Because that one is not using 8.3 names, and the folder/file names have 
spaces in them.  When spaces are present, You have to wrap such names in 
quotation marks, otherwise the system will interpret the spaces as parameter 
delimiters instead, ie:

    r = spawnl(P_WAIT, "c:\\windows\\system32\\rundll32.exe", 
"c:\\windows\\system32\\rundll32.exe", "\"C:\\Program files\\Common 
Files\\system\\Ole DB\\oledb32.dll\",OpenDSLFile c:\\temp.udl", NULL);

> The 'old' "C" calls to spawnl can't handle arguments with embedded spaces 
> in spite of the enclosing quotes?

You are not using enclosing quotes.  You are only using quotes that are 
required by the C++ language syntax to indicate string literals, but the 
*contents* of those literals need their own embedded quotes when passing LFN 
path/file names with spaces in them as command-line parameter to a new 
application process.  Not even the Win32 API WinExec(), ShellExecute(), and 
CreateProcess() functions can handle embedded spaces in their filename 
parameters without using embedded quotes.  This is not a general string 
handling requirement.  It is specific to launching a new process, as the 
underlying command interpreter uses spaces as a delimiter between 
command-line parameters for the new process.  So there had to be a way of 
allowing parameters with embedded spaces that were not treated as 
delimiters, hense the extra set of quotes that are needed.  You have to do 
the same thing when typing commands at the DOS command prompt.

> I have an Activex Server EXE with a long filename 
> ("NMSService_AlarmService.exe") that displays its full name
> on the Processes tab on Windows Task Manager.
> The same exe, when I load and run it on a customer machine,
> shows "NMSServ~1.exe" in the TM.

That happens if you use an 8.3 filename to spawn the new process.  It also 
depends on which OS version you are using, as not all versions are spart 
enough to automatically convert a 8.3 name to a LFN name.

> This is a problem for me because I have a suite of these services
> that all have long filenames that start with "NMSService_".

That is not a problem at all.


Gambit 
Technical Details
Message-ID: <47607080$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <47605d31$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d7e0ee90e3a8c37e
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <47605d31$1@newsgroups.borland.com>
Subject: Re: TILDE-ONE file names ?
Date: Wed, 12 Dec 2007 15:35:08 -0800
Lines: 58
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
NNTP-Posting-Host: 207.178.157.90
Message-ID: <47607080$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1197502592 207.178.157.90 (12 Dec 2007 15:36:32 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail