<?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: WinAPI, RPC 1702 and FindFirstFileW</title>
	<atom:link href="http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/</link>
	<description>The everyday life of a Dynamics AX developer</description>
	<lastBuildDate>Wed,  1 Feb 2012 16:29:10 +0100</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: Ajit</title>
		<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/comment-page-1/#comment-14806</link>
		<dc:creator>Ajit</dc:creator>
		<pubDate>Thu, 24 Nov 2011 17:03:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.artofcreation.be/?p=46#comment-14806</guid>
		<description>Thanks Klaas for your reply. Issue has been resolved. There was an issue with AOS service account.</description>
		<content:encoded><![CDATA[<p>Thanks Klaas for your reply. Issue has been resolved. There was an issue with AOS service account.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Klaas Deforche</title>
		<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/comment-page-1/#comment-14774</link>
		<dc:creator>Klaas Deforche</dc:creator>
		<pubDate>Wed, 23 Nov 2011 19:14:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.artofcreation.be/?p=46#comment-14774</guid>
		<description>Hi Ajit, 

What is the error you&#039;re getting?
Are you using a local path (C:\...) or UNC path (\\server\...)?
Is it possible to copy your code here?</description>
		<content:encoded><![CDATA[<p>Hi Ajit, </p>
<p>What is the error you&#8217;re getting?<br />
Are you using a local path (C:\&#8230;) or UNC path (\\server\&#8230;)?<br />
Is it possible to copy your code here?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajit</title>
		<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/comment-page-1/#comment-14771</link>
		<dc:creator>Ajit</dc:creator>
		<pubDate>Wed, 23 Nov 2011 14:43:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.artofcreation.be/?p=46#comment-14771</guid>
		<description>I want to delete files using WINAPIServer in AX 2012. When I change class run on type to &quot;Client&quot; then its is working but when I am changing to server, it doesn&#039;t work. Any pointer would be helpful.

Thanks,
Ajit</description>
		<content:encoded><![CDATA[<p>I want to delete files using WINAPIServer in AX 2012. When I change class run on type to &#8220;Client&#8221; then its is working but when I am changing to server, it doesn&#8217;t work. Any pointer would be helpful.</p>
<p>Thanks,<br />
Ajit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Klaas Deforche</title>
		<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/comment-page-1/#comment-12807</link>
		<dc:creator>Klaas Deforche</dc:creator>
		<pubDate>Tue, 06 Sep 2011 20:48:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.artofcreation.be/?p=46#comment-12807</guid>
		<description>Leandrolopesp, glad it helped :)</description>
		<content:encoded><![CDATA[<p>Leandrolopesp, glad it helped :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leandrolopesp</title>
		<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/comment-page-1/#comment-12803</link>
		<dc:creator>Leandrolopesp</dc:creator>
		<pubDate>Tue, 06 Sep 2011 18:39:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.artofcreation.be/?p=46#comment-12803</guid>
		<description>Oh man! You saved my day :)</description>
		<content:encoded><![CDATA[<p>Oh man! You saved my day :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Klaas Deforche</title>
		<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/comment-page-1/#comment-10173</link>
		<dc:creator>Klaas Deforche</dc:creator>
		<pubDate>Mon, 30 May 2011 09:06:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.artofcreation.be/?p=46#comment-10173</guid>
		<description>Hi Ajit,

Can you try the same as Micheal (comment 8), a try/catch to capture the .net exception. 
This might point you to the problem. 

This could help:
http://axatluegisdorf.blogspot.com/2010/05/decode-clr-exception-message.html 
And:
http://msdn.microsoft.com/en-us/library/ee677495.aspx</description>
		<content:encoded><![CDATA[<p>Hi Ajit,</p>
<p>Can you try the same as Micheal (comment 8), a try/catch to capture the .net exception.<br />
This might point you to the problem. </p>
<p>This could help:<br />
<a href="http://axatluegisdorf.blogspot.com/2010/05/decode-clr-exception-message.html" rel="nofollow">http://axatluegisdorf.blogspot.com/2010/05/decode-clr-exception-message.html</a><br />
And:<br />
<a href="http://msdn.microsoft.com/en-us/library/ee677495.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ee677495.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajit</title>
		<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/comment-page-1/#comment-10011</link>
		<dc:creator>Ajit</dc:creator>
		<pubDate>Mon, 23 May 2011 17:03:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.artofcreation.be/?p=46#comment-10011</guid>
		<description>Hi Klass,

I am using below code for moving file from one location to another location. Location defined on parameters

In Location  - \\ServerName\FolderName
Out Location - \\ServerName\Out Folder Name

But I am getting - ClrObject static method invocation error. 
I am ruuning code on server. Any help will be appreciated.
Tell me if I am doing something wrong here.


permissionSet.add(new FileIOPermission(fileName,#io_read));
        permissionSet.add(new InteropPermission(InteropKind::ClrInterop));
        
        [path, filenameL,fileExt] = fileNameSplit(filename);
        fileNameTo = CustParameters::find().CSVArchieveLocation +&#039;\\&#039;+ fileNameL + &#039;_&#039; +strrem(strrem(date2str(SystemDateGet(),213,2,1,2,1,4),&#039;//&#039;),&#039; &#039;) + &#039;_&#039; + time2str(timenow(),3,3)+&#039;.csv&#039;;

        permissionSet.add(new FileIOPermission(fileNameTo,#io_Write));
        CodeAccessPermission::assertMultiple(permissionSet);
        System.IO.File::Move(fileName,fileNameTo);
        CodeAccessPermission::revertAssert();

Thanks,
Ajit</description>
		<content:encoded><![CDATA[<p>Hi Klass,</p>
<p>I am using below code for moving file from one location to another location. Location defined on parameters</p>
<p>In Location  &#8211; \\ServerName\FolderName<br />
Out Location &#8211; \\ServerName\Out Folder Name</p>
<p>But I am getting &#8211; ClrObject static method invocation error.<br />
I am ruuning code on server. Any help will be appreciated.<br />
Tell me if I am doing something wrong here.</p>
<p>permissionSet.add(new FileIOPermission(fileName,#io_read));<br />
        permissionSet.add(new InteropPermission(InteropKind::ClrInterop));</p>
<p>        [path, filenameL,fileExt] = fileNameSplit(filename);<br />
        fileNameTo = CustParameters::find().CSVArchieveLocation +&#8217;\\&#8217;+ fileNameL + &#8216;_&#8217; +strrem(strrem(date2str(SystemDateGet(),213,2,1,2,1,4),&#8217;//&#8217;),&#8217; &#8216;) + &#8216;_&#8217; + time2str(timenow(),3,3)+&#8217;.csv&#8217;;</p>
<p>        permissionSet.add(new FileIOPermission(fileNameTo,#io_Write));<br />
        CodeAccessPermission::assertMultiple(permissionSet);<br />
        System.IO.File::Move(fileName,fileNameTo);<br />
        CodeAccessPermission::revertAssert();</p>
<p>Thanks,<br />
Ajit</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/comment-page-1/#comment-9184</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 20 Apr 2011 17:23:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.artofcreation.be/?p=46#comment-9184</guid>
		<description>I am having this warning being logged in the Event Viewer. Does this problem may cause stability issues in the server? Because after a number of entries, it goes down unexpectedly ...

Any help will be appreciated.</description>
		<content:encoded><![CDATA[<p>I am having this warning being logged in the Event Viewer. Does this problem may cause stability issues in the server? Because after a number of entries, it goes down unexpectedly &#8230;</p>
<p>Any help will be appreciated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matic</title>
		<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/comment-page-1/#comment-9178</link>
		<dc:creator>Matic</dc:creator>
		<pubDate>Wed, 20 Apr 2011 09:24:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.artofcreation.be/?p=46#comment-9178</guid>
		<description>It&#039;s kinda strange. 
You are right, @&quot;C:\&quot; works fine.

But for example @&quot;\\serverName\Share&quot; does not.
In windows explorer I can access those shares and share permissions are set for Everyone.

It&#039;s clearly a network permissions problem.

I&#039;ll do some more research and keep you posted.</description>
		<content:encoded><![CDATA[<p>It&#8217;s kinda strange.<br />
You are right, @&#8221;C:\&#8221; works fine.</p>
<p>But for example @&#8221;\\serverName\Share&#8221; does not.<br />
In windows explorer I can access those shares and share permissions are set for Everyone.</p>
<p>It&#8217;s clearly a network permissions problem.</p>
<p>I&#8217;ll do some more research and keep you posted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Klaas Deforche</title>
		<link>http://www.artofcreation.be/2009/04/08/winapi-rpc-1702-and-findfirstfilew/comment-page-1/#comment-9177</link>
		<dc:creator>Klaas Deforche</dc:creator>
		<pubDate>Wed, 20 Apr 2011 09:03:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.artofcreation.be/?p=46#comment-9177</guid>
		<description>Hi Matic,

I tested you code like this and it ran fine:

[cc lang=&quot;xpp&quot;]static void klForGetDirs(Args _args)
{
    Set permissionSet;
    System.Array files;
    int i, j;
    container fList;
    str filename;
    ;
    
    permissionSet = new Set(Types::Class);
    permissionSet.add(new FileIOPermission(@&quot;C:\&quot;, &quot;r&quot;));
    permissionSet.add(new InteropPermission(InteropKind::ClrInterop));
    CodeAccessPermission::assertMultiple(permissionSet);
 
    files = System.IO.Directory::GetDirectories(@&quot;C:\&quot;);

     for( i=0; i&lt;ClrInterop::getAnyTypeForObject(files.get_Length()); i++ )
     {
         fList = conins(fList, conlen(fList)+1, ClrInterop::getAnyTypeForObject(files.GetValue(i)));
     }

    for(j=1;j&lt;= conlen(fList); j++)
    {
         fileName = conpeek(fList, j);
         info(fileName);
    }
}[/cc]

I think the error &quot;ClrObject static method invocation error.&quot; indicates that the parameter you provide to the function is incorrect. Try a fixed path &#039;like @&quot;C:\&quot; to see if that works. Then you know that is (or isn&#039;t) the problem. As I&#039;ve said in previous comments, AX behaves a bit strange when it come to filepaths (and escaping those slashes), I have trouble figuring that out too :).</description>
		<content:encoded><![CDATA[<p>Hi Matic,</p>
<p>I tested you code like this and it ran fine:</p>
<div class="codecolorer-container xpp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> klForGetDirs<span style="color: #000000;">&#40;</span>Args _args<span style="color: #000000;">&#41;</span><br />
<span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; Set permissionSet;<br />
&nbsp; &nbsp; System.<span style="color: #000000;">Array</span> files;<br />
&nbsp; &nbsp; <span style="color: #0000ff;">int</span> i<span style="color: #00007f;">,</span> j;<br />
&nbsp; &nbsp; <span style="color: #0000ff;">container</span> fList;<br />
&nbsp; &nbsp; <span style="color: #0000ff;">str</span> filename;<br />
&nbsp; &nbsp; ;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; permissionSet <span style="color: #00007f;">=</span> <span style="color: #0000ff;">new</span> Set<span style="color: #000000;">&#40;</span>Types<span style="color: #00007f;">::</span><span style="color: #0000ff;">Class</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; permissionSet.<span style="color: #000000;">add</span><span style="color: #000000;">&#40;</span><span style="color: #0000ff;">new</span> FileIOPermission<span style="color: #000000;">&#40;</span>@<span style="color: #ff0000;">&quot;C:<span style="color: #000000;">\&quot;</span>, &quot;</span>r<span style="color: #ff0000;">&quot;));<br />
&nbsp; &nbsp; permissionSet.add(new InteropPermission(InteropKind::ClrInterop));<br />
&nbsp; &nbsp; CodeAccessPermission::assertMultiple(permissionSet);<br />
&nbsp;<br />
&nbsp; &nbsp; files = System.IO.Directory::GetDirectories(@&quot;</span>C<span style="color: #00007f;">:</span>\<span style="color: #ff0000;">&quot;);<br />
<br />
&nbsp; &nbsp; &nbsp;for( i=0; i&lt;ClrInterop::getAnyTypeForObject(files.get_Length()); i++ )<br />
&nbsp; &nbsp; &nbsp;{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fList = conins(fList, conlen(fList)+1, ClrInterop::getAnyTypeForObject(files.GetValue(i)));<br />
&nbsp; &nbsp; &nbsp;}<br />
<br />
&nbsp; &nbsp; for(j=1;j&lt;= conlen(fList); j++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fileName = conpeek(fList, j);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;info(fileName);<br />
&nbsp; &nbsp; }<br />
}</span></div></div>
<p>I think the error &#8220;ClrObject static method invocation error.&#8221; indicates that the parameter you provide to the function is incorrect. Try a fixed path &#8216;like @&#8221;C:\&#8221; to see if that works. Then you know that is (or isn&#8217;t) the problem. As I&#8217;ve said in previous comments, AX behaves a bit strange when it come to filepaths (and escaping those slashes), I have trouble figuring that out too :).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

