<?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>Sat, 25 May 2013 06:28:14 GMT</lastBuildDate>
 <pubDate>Sat, 25 May 2013 06:28:14 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>Request for XpsPrint.dll</title>
  <link>http://www.red-gate.com/MessageBoard/viewtopic.php?p=62150#62150</link>
  <description>I have a signature for XpsPrint.dll - StartXpsPrintJob, but nowhere to put it.  I was hoping someone could create the new module.  Thank you again for the great service provided to the .Net community.
&lt;br /&gt;

&lt;br /&gt;
I will post the signature below until the topic is created.
&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;
#region P/Invokes
&lt;br /&gt;

&lt;br /&gt;
public static void StartXpsPrintJobSafe&amp;#40;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; string printerName, string jobName, string outputFileName,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; SafeWaitHandle progressEvent, SafeWaitHandle completeEvent,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; bool&amp;#91;&amp;#93; pagesToPrint,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; bool getPrintJob, out IXpsPrintJob printJob,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; out IXpsPrintJobStream documentStream,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; bool getTicketStream, out IXpsPrintJobStream ticketStream&amp;#41;
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if &amp;#40;string.IsNullOrWhiteSpace&amp;#40;printerName&amp;#41;&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new ArgumentNullException&amp;#40;&amp;quot;printerName&amp;quot;&amp;#41;;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; byte&amp;#91;&amp;#93; pagesToPrintB = null;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; UInt32 cpagesToPrintB = 0;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if &amp;#40;pagesToPrint != null &amp;amp;&amp;amp; pagesToPrint.Length &amp;gt; 0&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pagesToPrintB = pagesToPrint
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .Select&amp;#40;b =&amp;gt; b ? &amp;#40;byte&amp;#41;1 &amp;#58; &amp;#40;byte&amp;#41;0&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .ToArray&amp;#40;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cpagesToPrintB = &amp;#40;UInt32&amp;#41;pagesToPrintB.Length;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; IntPtr ppPrintJob = IntPtr.Zero;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; IntPtr ppTicketStream = IntPtr.Zero;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // memory is allocated by StartXpsPrintJob, we just specify we want something
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if &amp;#40;getPrintJob&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ppPrintJob = Marshal.AllocCoTaskMem&amp;#40;Marshal.SizeOf&amp;#40;typeof&amp;#40;IntPtr&amp;#41;&amp;#41;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Marshal.StructureToPtr&amp;#40;IntPtr.Zero, ppPrintJob, false&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if &amp;#40;getTicketStream&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ppTicketStream = Marshal.AllocCoTaskMem&amp;#40;Marshal.SizeOf&amp;#40;typeof&amp;#40;IntPtr&amp;#41;&amp;#41;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Marshal.StructureToPtr&amp;#40;IntPtr.Zero, ppTicketStream, false&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // take references on safehandles
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; IntPtr pProgressEvent = IntPtr.Zero;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; IntPtr pCompleteEvent = IntPtr.Zero;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if &amp;#40;progressEvent != null&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bool success = false;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; progressEvent.DangerousAddRef&amp;#40;ref success&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;!success&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new ObjectDisposedException&amp;#40;&amp;quot;progressEvent&amp;quot;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pProgressEvent = progressEvent.DangerousGetHandle&amp;#40;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if &amp;#40;completeEvent != null&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bool success = false;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; completeEvent.DangerousAddRef&amp;#40;ref success&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;!success&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new ObjectDisposedException&amp;#40;&amp;quot;completeEvent&amp;quot;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pCompleteEvent = completeEvent.DangerousGetHandle&amp;#40;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RuntimeHelpers.PrepareConstrainedRegions&amp;#40;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; try
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Preservesig is set, so this will throw on failure
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; StartXpsPrintJob&amp;#40;printerName, jobName, outputFileName,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pProgressEvent, pCompleteEvent,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pagesToPrintB, cpagesToPrintB,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ppPrintJob, out documentStream, ppTicketStream&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; finally
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;pProgressEvent != IntPtr.Zero&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; progressEvent.DangerousRelease&amp;#40;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if &amp;#40;pCompleteEvent != IntPtr.Zero&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; completeEvent.DangerousRelease&amp;#40;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if &amp;#40;getPrintJob&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr pPrintJob = &amp;#40;IntPtr&amp;#41;Marshal.PtrToStructure&amp;#40;ppPrintJob, typeof&amp;#40;IntPtr&amp;#41;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printJob = &amp;#40;IXpsPrintJob&amp;#41;Marshal.GetTypedObjectForIUnknown&amp;#40;pPrintJob, typeof&amp;#40;IXpsPrintJob&amp;#41;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Marshal.FreeCoTaskMem&amp;#40;ppPrintJob&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; printJob = null;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;

&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if &amp;#40;getTicketStream&amp;#41;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; IntPtr pTicketStream = &amp;#40;IntPtr&amp;#41;Marshal.PtrToStructure&amp;#40;ppTicketStream, typeof&amp;#40;IntPtr&amp;#41;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ticketStream = &amp;#40;IXpsPrintJobStream&amp;#41;Marshal.GetTypedObjectForIUnknown&amp;#40;pTicketStream, typeof&amp;#40;IXpsPrintJobStream&amp;#41;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Marshal.FreeCoTaskMem&amp;#40;ppTicketStream&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; else
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ticketStream = null;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#125;
&lt;br /&gt;
&amp;#125;
&lt;br /&gt;

&lt;br /&gt;
&amp;#91;DllImport&amp;#40;&amp;quot;XpsPrint.dll&amp;quot;, EntryPoint = &amp;quot;StartXpsPrintJob&amp;quot;, PreserveSig = false&amp;#41;&amp;#93;
&lt;br /&gt;
private static extern void StartXpsPrintJob&amp;#40;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // 0
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#91;MarshalAs&amp;#40;UnmanagedType.LPWStr&amp;#41;&amp;#93; String printerName,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#91;MarshalAs&amp;#40;UnmanagedType.LPWStr&amp;#41;&amp;#93; String jobName,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // 2
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#91;MarshalAs&amp;#40;UnmanagedType.LPWStr&amp;#41;&amp;#93; String outputFileName,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; IntPtr progressEvent,&amp;nbsp; &amp;nbsp;// HANDLE
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // 4
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; IntPtr completionEvent, // HANDLE
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;#91;MarshalAs&amp;#40;UnmanagedType.LPArray, SizeParamIndex = 6&amp;#41;&amp;#93; byte&amp;#91;&amp;#93; printablePagesOn,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // 6
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; UInt32 printablePagesOnCount,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; IntPtr xpsPrintJob,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; // 8
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; out IXpsPrintJobStream documentStream,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; IntPtr printTicketStream&amp;#41;;
&lt;br /&gt;

&lt;br /&gt;
#endregion
&lt;br /&gt;

&lt;br /&gt;
#region Structures
&lt;br /&gt;

&lt;br /&gt;
&amp;#91;Guid&amp;#40;&amp;quot;7a77dc5f-45d6-4dff-9307-d8cb846347ca&amp;quot;&amp;#41;&amp;#93;
&lt;br /&gt;
&amp;#91;InterfaceType&amp;#40;ComInterfaceType.InterfaceIsIUnknown&amp;#41;&amp;#93;
&lt;br /&gt;
internal interface IXpsPrintJobStream
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; void Read&amp;#40;&amp;#91;MarshalAs&amp;#40;UnmanagedType.LPArray&amp;#41;&amp;#93; byte&amp;#91;&amp;#93; pv, uint cb, out uint pcbRead&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; void Write&amp;#40;&amp;#91;MarshalAs&amp;#40;UnmanagedType.LPArray&amp;#41;&amp;#93; byte&amp;#91;&amp;#93; pv, uint cb, out uint pcbWritten&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; void Close&amp;#40;&amp;#41;;
&lt;br /&gt;
&amp;#125;
&lt;br /&gt;

&lt;br /&gt;
&amp;#91;Guid&amp;#40;&amp;quot;5ab89b06-8194-425f-ab3b-d7a96e350161&amp;quot;&amp;#41;&amp;#93;
&lt;br /&gt;
&amp;#91;InterfaceType&amp;#40;ComInterfaceType.InterfaceIsIUnknown&amp;#41;&amp;#93;
&lt;br /&gt;
internal interface IXpsPrintJob
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; void Cancel&amp;#40;&amp;#41;;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; void GetJobStatus&amp;#40;out XPS_JOB_STATUS jobStatus&amp;#41;;
&lt;br /&gt;
&amp;#125;
&lt;br /&gt;

&lt;br /&gt;
&amp;#91;StructLayout&amp;#40;LayoutKind.Sequential&amp;#41;&amp;#93;
&lt;br /&gt;
internal struct XPS_JOB_STATUS
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public UInt32 jobId;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public Int32 currentDocument;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public Int32 currentPage;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public Int32 currentPageTotal;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public XPS_JOB_COMPLETION completion;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public Int32 jobStatus; 
&lt;br /&gt;
&amp;#125;;
&lt;br /&gt;

&lt;br /&gt;
internal enum XPS_JOB_COMPLETION
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; XPS_JOB_IN_PROGRESS = 0,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; XPS_JOB_COMPLETED = 1,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; XPS_JOB_CANCELLED = 2,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; XPS_JOB_FAILED = 3
&lt;br /&gt;
&amp;#125;
&lt;br /&gt;

&lt;br /&gt;
internal enum WAIT_RESULT
&lt;br /&gt;
&amp;#123;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; WAIT_OBJECT_0 = 0,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; WAIT_ABANDONED = 0x80,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; WAIT_TIMEOUT = 0x102,
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; WAIT_FAILED = -1
&lt;br /&gt;
&amp;#125;
&lt;br /&gt;

&lt;br /&gt;
#endregion
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
  <category>PInvoke.Net</category>
  <comments>http://www.red-gate.com/MessageBoard/posting.php?mode=reply&amp;t=17258</comments>
  <dc:creator>mgaffigan</dc:creator>
  <pubDate>Sat, 25 May 2013 00:06:15 GMT</pubDate>
  <guid isPermaLink="true">http://www.red-gate.com/MessageBoard/viewtopic.php?p=62150#62150</guid>
 </item>
 <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>
</channel>
</rss>
