<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: CreateProcess Declaration</title>
	<atom:link href="http://blog.delphi-jedi.net/2009/11/11/createprocess-declaration/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.delphi-jedi.net/2009/11/11/createprocess-declaration/</link>
	<description>Joint Endeavor of Delphi Innovators of Windows Programming</description>
	<lastBuildDate>Thu, 24 Nov 2011 17:58:16 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Christian Wimmer</title>
		<link>http://blog.delphi-jedi.net/2009/11/11/createprocess-declaration/comment-page-1/#comment-29567</link>
		<dc:creator>Christian Wimmer</dc:creator>
		<pubDate>Thu, 12 Nov 2009 19:41:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=573#comment-29567</guid>
		<description>@Krystian
Yes, you can make things safe in this way but it also means you need to know how. By using the compiler programmers won&#039;t make this error from the beginning because the compiler shows an error.</description>
		<content:encoded><![CDATA[<p>@Krystian<br />
Yes, you can make things safe in this way but it also means you need to know how. By using the compiler programmers won&#8217;t make this error from the beginning because the compiler shows an error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Javier Santo Domingo</title>
		<link>http://blog.delphi-jedi.net/2009/11/11/createprocess-declaration/comment-page-1/#comment-29566</link>
		<dc:creator>Javier Santo Domingo</dc:creator>
		<pubDate>Thu, 12 Nov 2009 19:04:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=573#comment-29566</guid>
		<description>I vote for the &quot;var&quot; modificator, a pointer can be nil.</description>
		<content:encoded><![CDATA[<p>I vote for the &#8220;var&#8221; modificator, a pointer can be nil.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Krystian</title>
		<link>http://blog.delphi-jedi.net/2009/11/11/createprocess-declaration/comment-page-1/#comment-29563</link>
		<dc:creator>Krystian</dc:creator>
		<pubDate>Thu, 12 Nov 2009 18:48:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=573#comment-29563</guid>
		<description>Simple way to make it safe is to use UniqueString:

const
  cCmdLine: string = ‘notepad.exe’;
var
  sCmdLine: string;
begin
  sCmdLine := cCmdLine;
  UniqueString(sCmdLine); // This line can be surrounded by {$IFDEF UNICODE}...{$ENDIF}, but not required
  CreateProcess(nil, PChar(sCmdLine), ...</description>
		<content:encoded><![CDATA[<p>Simple way to make it safe is to use UniqueString:</p>
<p>const<br />
  cCmdLine: string = ‘notepad.exe’;<br />
var<br />
  sCmdLine: string;<br />
begin<br />
  sCmdLine := cCmdLine;<br />
  UniqueString(sCmdLine); // This line can be surrounded by {$IFDEF UNICODE}&#8230;{$ENDIF}, but not required<br />
  CreateProcess(nil, PChar(sCmdLine), &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remko</title>
		<link>http://blog.delphi-jedi.net/2009/11/11/createprocess-declaration/comment-page-1/#comment-29550</link>
		<dc:creator>Remko</dc:creator>
		<pubDate>Thu, 12 Nov 2009 11:18:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=573#comment-29550</guid>
		<description>Yes as long as the string has a reference count it&#039;s safe. This would not be safe though:

const
   cCmdLine: string = &#039;notepad.exe&#039;;

var
   sCmdLine: string;

begin
  sCmdLine := cCmdLine;
  CreateProcess(nil, PChar(sCmdLine)</description>
		<content:encoded><![CDATA[<p>Yes as long as the string has a reference count it&#8217;s safe. This would not be safe though:</p>
<p>const<br />
   cCmdLine: string = &#8216;notepad.exe&#8217;;</p>
<p>var<br />
   sCmdLine: string;</p>
<p>begin<br />
  sCmdLine := cCmdLine;<br />
  CreateProcess(nil, PChar(sCmdLine)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stebi</title>
		<link>http://blog.delphi-jedi.net/2009/11/11/createprocess-declaration/comment-page-1/#comment-29546</link>
		<dc:creator>Stebi</dc:creator>
		<pubDate>Thu, 12 Nov 2009 09:38:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=573#comment-29546</guid>
		<description>Is this safe?

var
  CmdLine: string;
[...]
  CreateProcess(&#039;&#039;, PChar(CmdLine), ...);</description>
		<content:encoded><![CDATA[<p>Is this safe?</p>
<p>var<br />
  CmdLine: string;<br />
[...]<br />
  CreateProcess(&#8221;, PChar(CmdLine), &#8230;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remko</title>
		<link>http://blog.delphi-jedi.net/2009/11/11/createprocess-declaration/comment-page-1/#comment-29541</link>
		<dc:creator>Remko</dc:creator>
		<pubDate>Thu, 12 Nov 2009 07:42:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=573#comment-29541</guid>
		<description>Well it&#039;s just a thought to improve this part where existing code might produce an access violation. I didn&#039;t have the idea to change many functions like this... That said: if you have concrete examples of functions where it is a problem we can always correct those specific ones.

Indeed the idea is to translate pointer type  to var *unless* nil may be passed. I don&#039;t know if this was originally done because it&#039;s convenient or make the translations close to the delphi ones.

I didn&#039;t think about dynamically loaded functions at all, so this is a useful comment. I am open for suggestions ;-)</description>
		<content:encoded><![CDATA[<p>Well it&#8217;s just a thought to improve this part where existing code might produce an access violation. I didn&#8217;t have the idea to change many functions like this&#8230; That said: if you have concrete examples of functions where it is a problem we can always correct those specific ones.</p>
<p>Indeed the idea is to translate pointer type  to var *unless* nil may be passed. I don&#8217;t know if this was originally done because it&#8217;s convenient or make the translations close to the delphi ones.</p>
<p>I didn&#8217;t think about dynamically loaded functions at all, so this is a useful comment. I am open for suggestions <img src='http://blog.delphi-jedi.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick van Logchem</title>
		<link>http://blog.delphi-jedi.net/2009/11/11/createprocess-declaration/comment-page-1/#comment-29540</link>
		<dc:creator>Patrick van Logchem</dc:creator>
		<pubDate>Thu, 12 Nov 2009 07:31:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.delphi-jedi.net/?p=573#comment-29540</guid>
		<description>Nice idea - but there are many more functions that are originally declared as having pointer argument(s), but are instead declared as having &#039;var&#039; arguments in Jwa, which indeed prevents passing nil pointers (like GetModuleHandleEx).

Why exactly did you choose for &#039;var&#039; arguments in the first place? Because the Delphi RTL does the same? And why is that exactly?
And how are we supposed to call those methods when all we have is a pointer? Passing ({var}aPointer^) seems rather messy... especially when the pointer could be a nil value!

And in this situation, how should we retrieve the address of one specific overloaded function?

Also, are you planning to overload all API&#039;s that have the same possible problem? (That is, given we can determine which ones they are.)</description>
		<content:encoded><![CDATA[<p>Nice idea &#8211; but there are many more functions that are originally declared as having pointer argument(s), but are instead declared as having &#8216;var&#8217; arguments in Jwa, which indeed prevents passing nil pointers (like GetModuleHandleEx).</p>
<p>Why exactly did you choose for &#8216;var&#8217; arguments in the first place? Because the Delphi RTL does the same? And why is that exactly?<br />
And how are we supposed to call those methods when all we have is a pointer? Passing ({var}aPointer^) seems rather messy&#8230; especially when the pointer could be a nil value!</p>
<p>And in this situation, how should we retrieve the address of one specific overloaded function?</p>
<p>Also, are you planning to overload all API&#8217;s that have the same possible problem? (That is, given we can determine which ones they are.)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

