<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0" xml:base="http://www.red-gate.com/MessageBoard/" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Red Gate forums: PInvoke.Net</title>
 <link>http://www.red-gate.com/MessageBoard/</link>
 <description>Product Support and Discussion</description>
 <language>en</language>
 <copyright>Copyright Red Gate Software Ltd</copyright>
 <managingEditor>internalsupport@red-gate.com</managingEditor>
 <webMaster>internalsupport@red-gate.com</webMaster>
 <docs>http://blogs.law.harvard.edu/tech/rss</docs>
 <ttl>60</ttl>
 <lastBuildDate>Fri, 24 May 2013 00:57:35 GMT</lastBuildDate>
 <pubDate>Fri, 24 May 2013 00:57:35 GMT</pubDate>
 <image>
  <url>http://www.red-gate.com/messageboard/templates/subRed/images/logo_phpBB.gif</url>
  <title>Red Gate forums: PInvoke.Net</title>
  <link>http://www.red-gate.com/MessageBoard/</link>
 </image>
 <item>
  <title>RE: Request for version.dll</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=60749#60749</link>
  <description>You can add functions to &amp;quot;version&amp;quot; by typing in the banner on the top of the page you get when you expand the &amp;quot;version&amp;quot; node.</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=15771</comments>
  <dc:creator>Brian Donahue</dc:creator>
  <pubDate>Thu, 14 Mar 2013 10:03:52 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=60749#60749</guid>
 </item>
 <item>
  <title>RE: Request for version.dll</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=60748#60748</link>
  <description>Please feel free to edit - this is user-contributed content and not moderated by Red Gate.
&lt;br /&gt;

&lt;br /&gt;
There is a &amp;quot;version&amp;quot; module in PInvoke wiki, right there on the left-hand side.</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=15771</comments>
  <dc:creator>Brian Donahue</dc:creator>
  <pubDate>Thu, 14 Mar 2013 10:02:40 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=60748#60748</guid>
 </item>
 <item>
  <title>RE: Request for version.dll</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=60745#60745</link>
  <description>Hi guys,
&lt;br /&gt;
Several things:
&lt;br /&gt;

&lt;br /&gt;
1. The topic is here since August but this was not added to site, the &amp;quot;version&amp;quot; node on site is empty
&lt;br /&gt;

&lt;br /&gt;
2. The GetFileVersionInfo() added to wrong category - kernel32 , although it shows correct DllImport in signature - version.dll
&lt;br /&gt;

&lt;br /&gt;
3. The pinvoke stated here is wrong, it's not x64 bit compatible as handles (like in GetFileVersionInfoSize) should not be defined to int ans so on.</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=15771</comments>
  <dc:creator>Lord KiRon</dc:creator>
  <pubDate>Thu, 14 Mar 2013 07:47:37 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=60745#60745</guid>
 </item>
 <item>
  <title>RE: IMAGE_DOS_HEADER (Structures)</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=60566#60566</link>
  <description>I suppose the best thing to do would be to put this under &amp;quot;Notes&amp;quot; for the function...</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16568</comments>
  <dc:creator>Brian Donahue</dc:creator>
  <pubDate>Mon, 04 Mar 2013 10:00:07 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=60566#60566</guid>
 </item>
 <item>
  <title>RE: Propsys.dll P/Invoke module request</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=60552#60552</link>
  <description>Hello,
&lt;br /&gt;

&lt;br /&gt;
I have added the propsys module, so please feel free to add any signatures you want to that module.</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16566</comments>
  <dc:creator>Brian Donahue</dc:creator>
  <pubDate>Fri, 01 Mar 2013 16:14:25 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=60552#60552</guid>
 </item>
 <item>
  <title>IMAGE_DOS_HEADER (Structures)</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=60534#60534</link>
  <description>I think the previous definition of the IMAGE_DOS_HEADER Structure will not work. I added an &amp;quot;unsafe&amp;quot; C# definition. The other one will not work because it uses &amp;quot;char&amp;quot; and since the data is ASCII the char will use 16 bytes. The unsafe version uses &amp;quot;fixed&amp;quot; which allows use when references are not allowed.
&lt;br /&gt;

&lt;br /&gt;
I do not know how to add a note explaining that the unsafe version will work in situations where the other one will not.</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16568</comments>
  <dc:creator>Sam Hobbs</dc:creator>
  <pubDate>Thu, 28 Feb 2013 16:56:35 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=60534#60534</guid>
 </item>
 <item>
  <title>Propsys.dll P/Invoke module request</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=60531#60531</link>
  <description>[DllImport(&amp;quot;Propsys.dll&amp;quot;)]
&lt;br /&gt;
        static extern int PSGetItemPropertyHandler(IShellItem punkItem, bool fReadWrite, ref Guid riid, out IPropertyStore ppv);</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16566</comments>
  <dc:creator>jellever</dc:creator>
  <pubDate>Thu, 28 Feb 2013 14:48:13 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=60531#60531</guid>
 </item>
 <item>
  <title>RE: PInvoke SetupVerifyInfFile() C#</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=60197#60197</link>
  <description>The PInvoke forum is to ask for or comment on content of the PInvoke website, and does not offer any code help. Probably Stack Overflow is a better place to ask this sort of question.
&lt;br /&gt;

&lt;br /&gt;
In my experience, you have to be careful with structs and make sure the data length adds up. I've also used a lot of attributes that seem to help sometimes like &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&amp;#91;StructLayout&amp;#40;LayoutKind.Sequential, Pack = 1&amp;#41;&amp;#93;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public struct UNICODE_STRING...&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;
And trying to force Marshal to use certain unmanaged datatypes like this:&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;void DefineDocument&amp;#40;&amp;#91;MarshalAs&amp;#40;UnmanagedType.LPWStr&amp;#41;&amp;#93; String url,
&lt;br /&gt;
...
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#91;MarshalAs&amp;#40;UnmanagedType.Interface&amp;#41;&amp;#93; out ISymUnmanagedDocumentWriter RetVal&amp;#41;;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;

&lt;br /&gt;
Good luck!</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16450</comments>
  <dc:creator>Brian Donahue</dc:creator>
  <pubDate>Tue, 05 Feb 2013 12:32:33 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=60197#60197</guid>
 </item>
 <item>
  <title>PInvoke SetupVerifyInfFile() C#</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=60170#60170</link>
  <description>Hi everybody
&lt;br /&gt;

&lt;br /&gt;
I'm having problems with SetupVerifyInfFile() in C#, on &lt;span style=&quot;font-weight: bold&quot;&gt;pinvoke.net&lt;/span&gt; there are no examples so I'm here looking for some light
&lt;br /&gt;

&lt;br /&gt;
The function raises an exception &lt;span style=&quot;font-weight: bold&quot;&gt;PInvokeStackImbalance&lt;/span&gt;, after of a deep research on internet the exception it's raised because the Type of the variables
&lt;br /&gt;

&lt;br /&gt;
This is the C# code:
&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#91;StructLayout&amp;#40;LayoutKind.Sequential, CharSet = CharSet.Auto&amp;#41;&amp;#93;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public struct SP_ALTPLATFORM_INFO_V2
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint cbSize;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint Platform;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint MajorVersion;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint MinorVersion;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint ProcessorArchitecture;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint Flags;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint FirstValidatedMajorVersion;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public uint FirstValidatedMinorVersion;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#91;StructLayout&amp;#40;LayoutKind.Sequential, CharSet = CharSet.Auto&amp;#41;&amp;#93;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public struct SP_INF_SIGNER_INFO
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Int32 cbSize;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string CatalogFile;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string DigitalSigner;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string DigitalSignerVersion;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;
&amp;#91;DllImport&amp;#40;&amp;quot;setupapi.dll&amp;quot;, CharSet = CharSet.Auto, SetLastError = true&amp;#41;&amp;#93;
&lt;br /&gt;
public static extern bool SetupVerifyInfFile&amp;#40;&amp;#91;MarshalAs&amp;#40;UnmanagedType.LPTStr&amp;#41;&amp;#93; string InfName, 
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SP_ALTPLATFORM_INFO_V2 AltPlatformInfo, 
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; out SP_INF_SIGNER_INFO InfFileName&amp;#41;;
&lt;br /&gt;

&lt;br /&gt;
static void Main&amp;#40;string&amp;#91;&amp;#93; args&amp;#41;
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; SP_ALTPLATFORM_INFO_V2 pinfo = new SP_ALTPLATFORM_INFO_V2&amp;#40;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; pinfo.cbSize =&amp;#40;uint&amp;#41;Marshal.SizeOf&amp;#40;pinfo&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; //pinfo.Platform = VER_PLATFORM_WIN32_NT;
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; SP_INF_SIGNER_INFO pfname = new SP_INF_SIGNER_INFO&amp;#40;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; pfname.cbSize = Marshal.SizeOf&amp;#40;pfname&amp;#41;;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if &amp;#40;SetupVerifyInfFile&amp;#40;@&amp;quot;C&amp;#58;\WINDOWS\INF\OEM12.INF&amp;quot;, pinfo, out pfname&amp;#41;&amp;#41; // &amp;lt;-- The exception PInvokeStackImbalance it's raised here!
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;
&amp;#125;
&lt;br /&gt;

&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;

&lt;br /&gt;
The problem is in &lt;span style=&quot;font-weight: bold&quot;&gt;SP_ALTPLATFORM_INFO_V2&lt;/span&gt; struct, if I comment all the inside variables it does not raise the exception so the &lt;span style=&quot;font-weight: bold&quot;&gt;SP_INF_SIGNER_INFO&lt;/span&gt; struct it's fine but obviously the function return FALSE
&lt;br /&gt;

&lt;br /&gt;
I have changed the variables types to uint, int, Int16, Int32, Int64... but without good results
&lt;br /&gt;

&lt;br /&gt;
Here is the C language code of the &lt;span style=&quot;font-weight: bold&quot;&gt;SP_ALTPLATFORM_INFO_V2&lt;/span&gt; struct
&lt;br /&gt;

&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa377636%28v=vs.85%29.aspx&quot; target=&quot;_blank&quot;&gt;http://msdn.microsoft.com/en-us/library/aa377636%28v=vs.85%29.aspx&lt;/a&gt;
&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
typedef struct _SP_ALTPLATFORM_INFO_V2 &amp;#123;
&lt;br /&gt;
&amp;nbsp; DWORD cbSize;
&lt;br /&gt;
&amp;nbsp; DWORD Platform;
&lt;br /&gt;
&amp;nbsp; DWORD MajorVersion;
&lt;br /&gt;
&amp;nbsp; DWORD MinorVersion;
&lt;br /&gt;
&amp;nbsp; WORD&amp;nbsp; ProcessorArchitecture;
&lt;br /&gt;
&amp;nbsp; WORD&amp;nbsp; Flags;
&lt;br /&gt;
&amp;nbsp; DWORD FirstValidatedMajorVersion;
&lt;br /&gt;
&amp;nbsp; DWORD FirstValidatedMinorVersion;
&lt;br /&gt;
&amp;#125; SP_ALTPLATFORM_INFO_V2, *PSP_ALTPLATFORM_INFO_V2;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;

&lt;br /&gt;
And the SetupVerifyInfFile() in C language:
&lt;br /&gt;

&lt;br /&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa377447%28v=vs.85%29.aspx&quot; target=&quot;_blank&quot;&gt;http://msdn.microsoft.com/en-us/library/aa377447%28v=vs.85%29.aspx&lt;/a&gt;
&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;BOOL SetupVerifyInfFile&amp;#40;
&lt;br /&gt;
&amp;nbsp; __in&amp;nbsp; &amp;nbsp;PCWSTR InfName,
&lt;br /&gt;
&amp;nbsp; __in&amp;nbsp; &amp;nbsp;PSP_ALTPLATFORM_FORM AltPlatformInfo,
&lt;br /&gt;
&amp;nbsp; __out&amp;nbsp; PSP_INF_SIGNER_INFO_W InfFileName
&lt;br /&gt;
&amp;#41;;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;

&lt;br /&gt;
Thanks in advance!</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16450</comments>
  <dc:creator>tttony</dc:creator>
  <pubDate>Sun, 03 Feb 2013 20:30:31 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=60170#60170</guid>
 </item>
 <item>
  <title>RE: Using C++ dll having header file in C#</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=59831#59831</link>
  <description>You are *much* better off asking this question here:
&lt;br /&gt;
&lt;a href=&quot;http://stackoverflow.com/questions&quot; target=&quot;_blank&quot;&gt;http://stackoverflow.com/questions&lt;/a&gt;
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
tag it with: C# interop</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16349</comments>
  <dc:creator>Chris.Allen</dc:creator>
  <pubDate>Wed, 16 Jan 2013 15:17:24 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=59831#59831</guid>
 </item>
 <item>
  <title>Using C++ dll having header file in C#</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=59767#59767</link>
  <description>I am totally new in C++ and I want to use C++ dll (having header file) in 
&lt;br /&gt;

&lt;br /&gt;
C# program. Please find below header file.
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;#pragma once
&lt;br /&gt;
#define DAILY_PERIOD 24*60
&lt;br /&gt;
#define MIN_PERIOD 1
&lt;br /&gt;

&lt;br /&gt;
#ifdef API_DLL 
&lt;br /&gt;
#define METHOD_TYPE __declspec&amp;#40;dllexport&amp;#41;
&lt;br /&gt;
#else
&lt;br /&gt;
#define METHOD_TYPE __declspec&amp;#40;dllimport&amp;#41;
&lt;br /&gt;
#endif
&lt;br /&gt;

&lt;br /&gt;
struct Quote &amp;#123;
&lt;br /&gt;
unsigned long Date;
&lt;br /&gt;
float Price;
&lt;br /&gt;
float Open;
&lt;br /&gt;
float High;
&lt;br /&gt;
float Low;
&lt;br /&gt;
float Volume;
&lt;br /&gt;
float OpenInterest; 
&lt;br /&gt;
&amp;#125;;
&lt;br /&gt;

&lt;br /&gt;
class METHOD_TYPE CMinuteApiCallback
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
public&amp;#58; 
&lt;br /&gt;

&lt;br /&gt;
virtual int quote_notify&amp;#40; const char* symbol, int interval, int nMaxSize, Quotation *pQuotes, unsigned long echo&amp;#41;=0;
&lt;br /&gt;

&lt;br /&gt;
&amp;#125;;
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
class METHOD_TYPE CMinuteApi
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
public&amp;#58;
&lt;br /&gt;
CMinuteApi&amp;#40;void&amp;#41;;
&lt;br /&gt;

&lt;br /&gt;
int Initialise&amp;#40;char *serialkey, CMinuteApiCallback* callback&amp;#41;;
&lt;br /&gt;

&lt;br /&gt;
int GetQuote&amp;#40;char * symbol, int periodicity, unsigned long lasttimeupdate, unsigned long echo&amp;#41;;
&lt;br /&gt;

&lt;br /&gt;
int DeleteQuote&amp;#40;char * symbol, int periodicity&amp;#41;;
&lt;br /&gt;

&lt;br /&gt;
~CMinuteApi&amp;#40;void&amp;#41;;
&lt;br /&gt;
&amp;#125;;&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;

&lt;br /&gt;

&lt;br /&gt;
So please let me know how can I call all these methods in my C# program.  &lt;span style=&quot;font-weight: bold&quot;&gt; c# Example of above code is highly appreciated.&lt;/span&gt;Thanks in advance.</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16349</comments>
  <dc:creator>chaitu18</dc:creator>
  <pubDate>Tue, 15 Jan 2013 05:45:09 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=59767#59767</guid>
 </item>
 <item>
  <title>coredll P/Invoke</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=59661#59661</link>
  <description>I find out that there is missing GetStdioPathW and SetStdioPathW in Pinvoke.net Add-in
&lt;br /&gt;

&lt;br /&gt;
Is there any other method that can read stdout, stdin, stderror settings?</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16323</comments>
  <dc:creator>Petere</dc:creator>
  <pubDate>Wed, 09 Jan 2013 10:28:18 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=59661#59661</guid>
 </item>
 <item>
  <title>GetThreadId P/Invoke</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=59639#59639</link>
  <description>Dear community,
&lt;br /&gt;

&lt;br /&gt;
Another missed function :
&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
/// &amp;lt;summary&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Retrieves the thread identifier of the specified thread.
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&amp;quot;hThread&amp;quot;&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// A handle to the thread. The handle must have the THREAD_QUERY_INFORMATION or THREAD_QUERY_LIMITED_INFORMATION access right. 
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// For more information about access rights, see Thread Security and Access Rights.
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/param&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// If the function succeeds, the return value is a thread id to the specified handle.
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// If the function fails, the return value is zero. To get extended error information, call GetLastError.
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/returns&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#91;DllImport&amp;#40;&amp;quot;kernel32.dll&amp;quot;, SetLastError = true&amp;#41;&amp;#93;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static extern int GetThreadId&amp;#40;IntPtr hThread&amp;#41;;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;

&lt;br /&gt;
It can be added to the wiki.</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16316</comments>
  <dc:creator>ZenLulz</dc:creator>
  <pubDate>Tue, 08 Jan 2013 13:17:05 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=59639#59639</guid>
 </item>
 <item>
  <title>GetProcessId P/Invoke</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=59569#59569</link>
  <description>Dear community,
&lt;br /&gt;

&lt;br /&gt;
The function &lt;span style=&quot;font-style: italic&quot;&gt;DWORD WINAPI GetProcessId(HANDLE);&lt;/span&gt; is missing in your wiki.
&lt;br /&gt;

&lt;br /&gt;
This is the corresponding P/Invoke function :
&lt;br /&gt;

&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Retrieves the process identifier of the specified process.
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&amp;quot;hProcess&amp;quot;&amp;gt;A handle to the process. The handle must have the PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION access right. For more information, see Process Security and Access Rights.&amp;lt;/param&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;If the function succeeds, the return value is an open handle to the specified process. If the function fails, the return value is NULL. To get extended error information, call &amp;lt;see cref=&amp;quot;Marshal.GetLastWin32Error&amp;quot;/&amp;gt;.&amp;lt;/returns&amp;gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;#91;DllImport&amp;#40;&amp;quot;kernel32.dll&amp;quot;, SetLastError = true&amp;#41;&amp;#93;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static extern int GetProcessId&amp;#40;IntPtr hProcess&amp;#41;;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;
&lt;br /&gt;

&lt;br /&gt;
Feel free to add it.  &lt;img src=&quot;images/smiles/icon_smile.gif&quot; alt=&quot;Smile&quot; border=&quot;0&quot; /&gt;</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=16291</comments>
  <dc:creator>ZenLulz</dc:creator>
  <pubDate>Tue, 01 Jan 2013 19:51:52 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=59569#59569</guid>
 </item>
 <item>
  <title>RE: Request for version.dll</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=57669#57669</link>
  <description>I've added the version module to the PInvoke Wiki now, so if you want to contribute functions to that bit of the wiki, please feel free. 
&lt;br /&gt;

&lt;br /&gt;
Thanks!</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=15771</comments>
  <dc:creator>Brian Donahue</dc:creator>
  <pubDate>Mon, 03 Sep 2012 10:39:43 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=57669#57669</guid>
 </item>
</channel>
</rss>
