<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Windows and .NET Programming</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/cobold/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/cobold/feed.xml</link>
    <description>Programming Debugging WinDBG</description>
    <lastBuildDate>Tue, 07 Mar 2017 08:42:17 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Extracting Information from Crash and Hang Dumps</title>
      <link>https://docs.microsoft.com/archive/blogs/cobold/ax_dmp_analysis</link>
      <pubDate>Wed, 01 Mar 2017 16:28:49 GMT</pubDate>
      <dc:creator><![CDATA[Costin Boldisor]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cobold/?p=765</guid>
      <description><![CDATA[In order to understand the causes for crashes and hangs, specific information needs to be collected...]]></description>
      <content:encoded><![CDATA[In order to understand the causes for crashes and hangs, specific information needs to be collected and analyzed. This article describes the four phases of this process.

<a href="https://msdnshared.blob.core.windows.net/media/2017/03/phases.png"><img width="1024" height="343" class="alignnone size-large wp-image-846" alt="phases" src="https://msdnshared.blob.core.windows.net/media/2017/03/phases-1024x343.png" /></a><a href="https://msdnshared.blob.core.windows.net/media/2017/03/Analysis.png"></a>
<h1>Phase 1: Collect crash or hang dump</h1>
&nbsp;

There are multiple ways to achieve this, please check this <a href="https://blogs.msdn.microsoft.com/cobold/2010/03/01/collecting-crash-dumps/">blog post</a> for details.

&nbsp;
<h1>Phase 2: Install debugging tools</h1>
&nbsp;
<ol>
 	<li>Download the Windows 10 SDK from: <a href="https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk">https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk</a></li>
 	<li>Please note that this SDK works for all Windows versions starting Windows Server 2008, not only for Windows 10.</li>
 	<li>Run the installer</li>
 	<li>At first step, specify an easily accessible location, since we'll need to work from the Command Prompt<a href="https://msdnshared.blob.core.windows.net/media/2017/03/location.png"><img width="693" height="178" class="alignnone size-full wp-image-825" alt="location" src="https://msdnshared.blob.core.windows.net/media/2017/03/location.png" /></a></li>
 	<li>At the step that asks for features to install, select only "Debugging Tools for Windows"<a href="https://msdnshared.blob.core.windows.net/media/2017/03/debuggingOption.png"><img width="699" height="263" class="alignnone size-full wp-image-775" alt="debuggingoption" src="https://msdnshared.blob.core.windows.net/media/2017/03/debuggingOption.png" /></a></li>
 	<li><i>Optional</i>: Set symbol path. Debugging symbols are files generated at compile time which link variable and method addresses to names. By default, the debugger downloads symbols from the Microsoft public symbols server. To cache symbols locally, you may specify a System Environment Variable:       _NT_SYMBOL_PATH=srv*c:\Symbols*https://msdl.microsoft.com/download/symbols. More information here: <a href="https://msdn.microsoft.com/en-us/library/windows/hardware/ff552208(v=vs.85).aspx">https://msdn.microsoft.com/en-us/library/windows/hardware/ff552208(v=vs.85).aspx</a></li>
</ol>
<h1>Phase 3: Analyze DMP</h1>
The questions that crash / hang dump analysis needs to answer are:
<ul type="disc">
 	<li><span>What is the </span><strong>crashing signature</strong><span>?</span></li>
 	<li><span>What is the </span><strong>call stack</strong><span>?</span></li>
</ul>
The general rule of thumb is that<span> one crashing signature and call stack identify one problem</span>. In other words, if an application crashes with two or more different signatures, it's very likely that the application has two or more different defects and resolving only one will not prevent all crashes.

The tool we'll be using for analysing DMP files is <strong>WinDBG</strong>. CDB, which comes as part of the same package, Debugging Tools for Windows, has similar functionality but is designed to be used from the command line. The instructions below apply to AOS as well as Client dump files.

The crashing signature includes the following elements:
<ul type="disc">
 	<li><span>Faulting process / application name</span></li>
 	<li><span>Faulting module</span></li>
 	<li><span>Faulting offset</span></li>
 	<li><span>Exception code</span></li>
</ul>
We'll be using a simple Job (see <a href="https://msdnshared.blob.core.windows.net/media/2017/03/Job_Kaboom.zip">job_kaboom</a>) that triggers an AX client crash.

After a crash occurs, an event 1000 should be logged to the Application event log:

<a href="https://msdnshared.blob.core.windows.net/media/2017/03/event1000.png"><img width="518" height="68" class="alignnone size-full wp-image-795" alt="event1000" src="https://msdnshared.blob.core.windows.net/media/2017/03/event1000.png" /></a>

The event includes all the information for the crashing signature:

<a href="https://msdnshared.blob.core.windows.net/media/2017/03/signature.png"><img width="572" height="270" class="alignnone size-full wp-image-855" alt="signature" src="https://msdnshared.blob.core.windows.net/media/2017/03/signature.png" /></a>

To open a crash dump in WinDBG:

&nbsp;
<ol type="1">
 	<li value="1"><span>Run WinDBG. Should be located under: C:\debuggers\Debuggers\x64\windbg.exe</span></li>
 	<li><span>File - Open Crash Dump…</span></li>
 	<li><span>Search for the DMP file stored during Phase 1 - collection</span></li>
 	<li><span>Now the DMP file is loaded in WinDBG and commands can be executed to perform the analysis</span></li>
</ol>
<a href="https://msdnshared.blob.core.windows.net/media/2017/03/loadDMP.png"><img width="705" height="403" class="alignnone size-full wp-image-816" alt="loaddmp" src="https://msdnshared.blob.core.windows.net/media/2017/03/loadDMP.png" /></a>

&nbsp;

Analysis - crash signature and call stack from DMP
<ol>
 	<li><span>Find the </span><strong>faulting module</strong><span>. It should be shown as the penultimate line in the command window. Running the </span><span style="font-family: 'Courier New';font-size: 11pt;font-style: normal;font-weight: normal">.ecxr </span><span>command also displays it. In this example, the faulting module is ntdll<a href="https://msdnshared.blob.core.windows.net/media/2017/03/eip.png"><img width="1024" height="216" class="alignnone size-large wp-image-785" alt="eip" src="https://msdnshared.blob.core.windows.net/media/2017/03/eip-1024x216.png" /></a></span></li>
 	<li><span>Find the</span><span><strong> faulting offset</strong>: </span><span style="font-family: 'Courier New'">?eip - &lt;faulting module name&gt;  <a href="https://msdnshared.blob.core.windows.net/media/2017/03/offset1.png"><img width="520" height="155" class="size-full wp-image-885 aligncenter" alt="offset" src="https://msdnshared.blob.core.windows.net/media/2017/03/offset1.png" /></a></span></li>
 	<li><span>Find the</span><strong> faulting process</strong><span> and its command line: </span><span style="font-family: 'Courier New'">!peb<a href="https://msdnshared.blob.core.windows.net/media/2017/03/peb.png"><img width="1024" height="113" class="alignnone size-large wp-image-836" alt="peb" src="https://msdnshared.blob.core.windows.net/media/2017/03/peb-1024x113.png" /></a></span></li>
 	<li><span>Find the <strong>call stack</strong> that leads to the crash: </span><span style="font-family: 'Courier New';font-size: 11pt;font-style: normal;font-weight: normal">k <a href="https://msdnshared.blob.core.windows.net/media/2017/03/k.png"><img width="538" height="147" class="size-full wp-image-805 aligncenter" alt="k" src="https://msdnshared.blob.core.windows.net/media/2017/03/k.png" /></a></span></li>
 	<li><span>Find the <strong>exception code</strong>: </span><span style="font-family: 'Courier New'">.lastevent <a href="https://msdnshared.blob.core.windows.net/media/2017/03/lastevent.png"><img width="1024" height="149" class="alignnone size-large wp-image-815" alt="lastevent" src="https://msdnshared.blob.core.windows.net/media/2017/03/lastevent-1024x149.png" /></a></span></li>
 	<li>Please refer to <a href="https://blogs.msdn.microsoft.com/axsa/2013/03/11/finding-the-x-stack-and-ax-user-with-public-symbols-in-ax2012/">this post</a>, which explains how to retrieve the X++ call stack.</li>
</ol>
An easier way of getting all this information and much more is the extension command:
<p style="margin: 0in;padding-left: 30px;font-family: 'Courier New';font-size: 11pt">!analyze -v</p>
More information about each of these commands, as well as their more advanced parameters can be found in the WinDBG help section: Help - Search.
<h1>Phase 4. Take action</h1>
Once we know how to extract information from a crash dump, there are multiple courses of action.
<h2><span>1. Determine frequency of particular crash</span></h2>
By filtering the event log for event 1000 and checking the crashing signatures, you can see if the process crashes with the same signature every time (i.e. are we dealing with only one problem?) and how often that happens.
<h2><span>2. Determine if the crash is resolved</span></h2>
Once we know the names of the methods in the crashing call stack, we can use LCS Issue Search to see if the method is mentioned in the title or description of resolved defects. You can start with methods on the top of the call stack and move further down if no matches are found.

<a href="https://fix.lcs.dynamics.com/Issue/Results?q=DMFGenerateSSISPackage%3A%3AgenerateStagingData">https://fix.lcs.dynamics.com/Issue/Results?q=DMFGenerateSSISPackage%3A%3AgenerateStagingData</a>

It is a common practice for parts of the call stack to be included in the LCS descriptions.

<a href="https://msdnshared.blob.core.windows.net/media/2017/03/issueSearch.png"><img width="1024" height="485" class="alignnone size-large wp-image-796" alt="issuesearch" src="https://msdnshared.blob.core.windows.net/media/2017/03/issueSearch-1024x485.png" /></a>
<h2>3. Call Support</h2>
If Issue Search doesn't give any matches, more in-depth analysis may be required. Microsoft Support will be able to assist you further. You can easily create a new Support ticket by using the Support tile on a Microsoft Dynamics AX 2012 project dashboard in LCS and selecting "New Incident":

<a href="https://msdnshared.blob.core.windows.net/media/2017/03/supportTile.png"><img width="213" height="222" class="alignnone size-full wp-image-905" alt="supporttile" src="https://msdnshared.blob.core.windows.net/media/2017/03/supportTile.png" /></a>]]></content:encoded>
    </item>
    <item>
      <title>Building a large text file editor – Part II</title>
      <link>https://docs.microsoft.com/archive/blogs/cobold/building-a-large-text-file-editor-part-ii</link>
      <pubDate>Fri, 02 Mar 2012 07:56:00 GMT</pubDate>
      <dc:creator><![CDATA[Costin Boldisor]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cobold/2012/03/02/building-a-large-text-file-editor-part-ii/</guid>
      <description><![CDATA[In the previous post I created a class that was going to be used as an interface between a large...]]></description>
      <content:encoded><![CDATA[<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7750.image5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7750.image5.png"></a>In the <a title="previous post" href="https://blogs.msdn.com/b/cobold/archive/2012/01/25/building-a-large-text-file-editor-part-i.aspx">previous post</a> I created a class that was going to be used as an interface between a large file editor and the file on the disk.</p>
<p>Since then I've been implementing the user interface and, obviously, the RevisionStream also needed some readjustment. Here are some major changes that were done:</p>
<p>- detecting encoding of text file</p>
<p>- support for Unicode (2-bytes characters)</p>
<p>- some bugs related to addition and deletion</p>
<p>&nbsp;</p>
<p>Until now I've managed to repair most of the visible bugs but I'm pretty sure there are some also remaining. Which is why, apart from the UserControl that holds the large file editor, I've also created a Form for testing the control. The source code is available so everyone interested and go ahead and fix the bugs they discover. I will also appreciate if you post comments with feedback.</p>
<p>The UserControl LargeTextBox contains a RichTextBox and a vertical scroll bar.</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/6114.image1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/6114.image1.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/6114.image1.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/6114.image1.png" width="242" height="220" /></a></p>
<p>Apart from the RevisionStream, the LargeTextBox control also contains:</p>
<p>&nbsp;- &nbsp;long topPosition; // The position in the changed stream of first line in RTB</p>
<p>&nbsp;- char[][] displayedLines; // The list of currently displayed text lines</p>
<p>&nbsp;- int[] lineLengths; // The list of lengths of currently displayed text lines&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>The most delicate part of the whole process is to detect the changes done by the user in the RichTextBox and update them in the Revision Stream. This is implemented in the method SynchDifferences where the cached lines are compared with the lines from the RichTextBox and Insertions and Deletions are added accordingly.</p>
<p>Let's see how this works on an Excel file. I create a Workbook with as many rows as Excel allows, namely 1,048,576. I saved this to Book2.xlsx and extracted the sheet1.xml. I then indented the XML to make more human-readable and loded it into the editor.</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7357.image2.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7357.image2.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7357.image2.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7357.image2.png" width="310" height="184" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7144.image3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7144.image3.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7144.image3.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7144.image3.png" width="473" height="266" /></a></p>
<p>I then scrolled down to row 511,386 and added a new cell on the B column with the value of "0".</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/2063.image4.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/2063.image4.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/2063.image4.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/2063.image4.png" width="473" height="271" /></a><br />&nbsp;</p>
<p>I saved the XML as sheet2.xml and then renamed it back to sheet1.xml (minor&nbsp;bug remaining - can't save to same file name). After repackaging the file in Excel, here's the result:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7750.image5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7750.image5.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7750.image5.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7750.image5.png" width="312" height="117" /></a></p>
<p>&nbsp;</p>
<p></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/27/65/31/LFETester.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-27-65-31/LFETester.zip">LFETester.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Building a large text file editor – Part I</title>
      <link>https://docs.microsoft.com/archive/blogs/cobold/building-a-large-text-file-editor-part-i</link>
      <pubDate>Wed, 25 Jan 2012 02:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Costin Boldisor]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cobold/2012/01/25/building-a-large-text-file-editor-part-i/</guid>
      <description><![CDATA[The purpose of this series of two blog posts is to illustrate how an editor for large files can be...]]></description>
      <content:encoded><![CDATA[<p>The purpose of this series of two blog posts is to illustrate how an editor for large files can be implemented. The first part will address the model behind the editor whereas the second part will include an actual UserControl that allows users to view and edit large files.</p>
<p>The basic idea behind a large file viewer is that you can&rsquo;t load a very large file into a TextBox or RichTextBox control because the memory usage as well as the time to load the file will be enormous. Moreover, the user can only see a very small portion of the file on the screen at once, so it doesn&rsquo;t make sense to load all the data in the file at once.</p>
<p>As such, what is needed from a large file viewer is to only display some small parts of the file in order to fill at least a screen. This is pretty straightforward and will be addressed in the second post. What is a bit more complex is to enable the user to edit the file (i.e. make insertions and deletions). The problem with editing the file is that edits need to be taken into account when computing the position in the stream. If the user deletes say the first 10 characters and then wants to read two characters at offset 4, what actually needs to be read is the two characters at offset 14 from the original file:</p>
<ul>
<li>Original string: "0123456789abcdefgh"</li>
<li>String after deleting 10 characters: "abcdefgh"</li>
<li>Character at offset 4 (zero-based): "e"</li>
<li>Offset in initial string: 14.</li>
</ul>
<p>Obviously, things get more complicated when the user starts to randomly delete and insert text at various locations in the file.</p>
<p>The solution I&rsquo;m proposing is the class RevisionStream (see attached code). This class is wrapper around the FileStream class and supports four public methods:</p>
<ul>
<li><strong>AddDeletion</strong> &ndash; the caller signals that a deletion has been made by the user</li>
<li><strong>AddInsertion</strong> &ndash; the caller signals that the user has inserted some text</li>
<li><strong>Read</strong> &ndash; reads some bytes from the revised stream</li>
<li><strong>SaveTo</strong> &ndash; saves revised stream to file</li>
</ul>
<p>The basic idea behind this approach is that normally the largest part of the text will remain identical to the original stream and only some minor changes will be done by the user. So it makes sense to leave the original text on disk and only load to memory the parts that we need together with the changes the user makes.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/0143.RevStream.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/0143.RevStream.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/0143.RevStream.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/0143.RevStream.png" width="326" height="251" /></a></p>
<p>Under the hood, the RevisionStream uses a list of Segments. A segment is either a reference to a contiguous section of the original text or a newly added text. The really difficult part is to adjust the segments from the RevisionStream when an insertion or a deletion is made.</p>
<p>Getting back to the previous example, the RevisionStream initially contains all the text from the original file, which is "0123456789abcdefgh". The list of segments will contain only one segment, [0, 17] (where 17 = the offset of the last character).</p>
<p><br /><span style="text-decoration: underline;"><strong>Scenario #1</strong></span>: The user deletes the first 10 characters</p>
<p style="padding-left: 30px;">Resulting list of segments: [10, 17]. <br />Resulting string: "abcdefgh"</p>
<p><br /><span style="text-decoration: underline;"><strong>Scenario #2</strong></span>: The user deletes the character &lsquo;b&rsquo;, which is located at offset 11.</p>
<p style="padding-left: 30px;">Resulting list of segments: [0, 10], [12, 17]. <br />Resulting string: "0123456789acdefgh".</p>
<p><span style="text-decoration: underline;"><strong>Scenario #3</strong></span>: The user deletes the character &lsquo;b&rsquo;, which is located at offset 11, and writes "ZZZ" at the same offset.</p>
<p style="padding-left: 30px;">Resulting list of segments: [0, 10],["ZZZ"],[12, 17]. <br />Resulting string: "0123456789aZZZcdefgh".</p>
<p>The real challenge here is to deal with all the possible scenarios of deleting and inserting text (delete from more consecutive segments, delete at end of segment, etc.). Hopefully I&rsquo;ve covered all the possible scenarios in the implementations of the private methods AdjustForInsertion and AdjustForDeletion but if you find any case that hasn&rsquo;t been covered, please post a comment here.</p>
<p><br />There&rsquo;s still some work to do here: using only long indices to ensure really large files can be read, making the Insertions encoding-independent, etc. However, up to this point, we can go ahead and build a pretty decent Large File Editor based on this Revision Stream.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/26/04/73/RevisionStream.cs" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-26-04-73/RevisionStream.cs">RevisionStream.cs</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Monitoring when registry keys are modified</title>
      <link>https://docs.microsoft.com/archive/blogs/cobold/monitoring-when-registry-keys-are-modified</link>
      <pubDate>Tue, 29 Nov 2011 08:06:00 GMT</pubDate>
      <dc:creator><![CDATA[Costin Boldisor]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cobold/2011/11/29/monitoring-when-registry-keys-are-modified/</guid>
      <description><![CDATA[Let&rsquo;s say you want to see where a certain setting from Word Options is saved in...]]></description>
      <content:encoded><![CDATA[<p>Let&rsquo;s say you want to see where a certain setting from Word Options is saved in Registry.<br />&nbsp;&nbsp;<br />&nbsp;<br />The easiest method is using Process Monitor.<br />&nbsp;<br />Add a filter on Process Name and Operation, start Word and that&rsquo;s that:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7446.filters.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7446.filters.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7446.filters.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7446.filters.png" /></a><br />&nbsp;<br />If we uncheck &ldquo;Allow background saves&rdquo; from Word Options &ndash; Advanced &ndash; Save, this is what appears in Process Monitor:</p>
<p></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/1106.RegSEtVal.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/1106.RegSEtVal.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/1106.RegSEtVal.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/1106.RegSEtVal.png" /></a><br />&nbsp;<br />&nbsp;The problem with Process Monitor is that we can&rsquo;t leave it running for a long time because the page file will become too large and it will not be able to continue the capture.<br />&nbsp;<br />So the alternative is Registry Auditing.<br />&nbsp;<br />What we need to do is:<br />&nbsp;</p>
<p>1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Run the following command from Command Prompt:</p>
<p><span style="font-family: courier new,courier;">auditpol /set /subcategory:"Registry" /success:enable</span><br />&nbsp;</p>
<p>Note: if the OS has a different language pack, the name &ldquo;Registry&rdquo; might differ. For instance, on a German Windows, the name is &ldquo;Registrierung&rdquo;. To see what the name of the subcategory is you can run:<br />&nbsp;<br /><span style="font-family: courier new,courier;">auditpol /list /subcategory:*</span><br />&nbsp;</p>
<p>2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Open Registry Editor and navigate to the key which we want to audit (HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Word)<br />3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Right-click on the key and choose &ldquo;Permissions&hellip;&rdquo;<br />4.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Click &ldquo;Advanced&rdquo; and switch to the Auditing tab<br />5.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add a user or group and select Access: Set Value<br />6.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Apply settings<br />&nbsp;<br />Now the registry changes are visible in the Event Viewer under Windows Logs\Security:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/5148.eventv.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/5148.eventv.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/5148.eventv.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/5148.eventv.png" /></a></p>
<p>&nbsp;</p>
<p>More detailed information on this topic:</p>
<p>- <a href="https://support.microsoft.com/kb/921469">https://support.microsoft.com/kb/921469</a> How to use Group Policy to configure detailed security auditing settings for Windows Vista-based and Windows Server 2008-based computers in a Windows Server 2008 domain, in a Windows Server 2003 domain, or in a Windows 2000 domain.</p>
<p>- <a href="https://technet.microsoft.com/en-us/library/cc755264(WS.10).aspx">https://technet.microsoft.com/en-us/library/cc755264(WS.10).aspx</a> Auditpol set</p>
<p>- <a href="https://support.microsoft.com/kb/324739">https://support.microsoft.com/kb/324739</a>&nbsp;How to use Group Policy to audit registry keys in Windows Server 2003<br />&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Back to school - Office art geometry</title>
      <link>https://docs.microsoft.com/archive/blogs/cobold/back-to-school-office-art-geometry</link>
      <pubDate>Mon, 31 Oct 2011 06:05:00 GMT</pubDate>
      <dc:creator><![CDATA[Costin Boldisor]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cobold/2011/10/31/back-to-school-office-art-geometry/</guid>
      <description><![CDATA[Let's start off with the following observation- the following two shapes have the same Left and Top...]]></description>
      <content:encoded><![CDATA[<p>Let's start off with the following observation- the following two shapes have the same Left and Top coordinates:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/3414.rot0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/3414.rot0.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/3414.rot0.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/3414.rot0.png" width="334" height="241" /></a>&nbsp; <a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/3108.rot50.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/3108.rot50.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/3108.rot50.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/3108.rot50.png" width="332" height="235" /></a></p>
<p>What's different is obviously the rotation. What Office saves for a shape is the Left and Top coordinates together with a Rotation. So the Top coordinate, for instance, is not necessarily&nbsp;the uppermost part of a shape.</p>
<p>&nbsp;</p>
<p>So let's solve the following problem: to which shape is the following arrow pointing?</p>
<p>&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7673.arrow.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7673.arrow.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7673.arrow.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7673.arrow.png" width="323" height="182" /></a></p>
<p><strong>Input data:</strong></p>
<p>Arrow:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Left = &nbsp;98.74763&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Top = 67.08575&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Width = 162&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Height = 60&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rotation = 45</p>
<p>Upper shape:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;Left = 264&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Top =&nbsp;36&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Width = 168&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Height =&nbsp;72&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rotation = 0</p>
<p>Lower&nbsp;shape:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Left = 264&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Top = 114&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Width = 168&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Height = 72&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Rotation = 0</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>The code for computing the "From" and "To" points:</p>
<pre class="scroll"><code class="csharp"> public static void GetFromAndTo(RectangleF bounds, double rot, <br /> ref PointF from, ref PointF to)<br /> {<br /> <br /> double La, Ta, Wa, Ha, alpha;<br /> La = bounds.Left;<br /> Ta = bounds.Top;<br /> Wa = bounds.Width;<br /> Ha = bounds.Height;<br /> <br /> alpha = (rot * Math.PI) / 180;<br /> <br /> from.X = (float)(La + Wa * (1 - Math.Cos(alpha)) / 2);<br /> from.Y = (float)(Ta + (Ha / 2) - (Wa * Math.Sin(alpha)) / 2);<br /> to.X = (float)(La + Wa * (1 + Math.Cos(alpha)) / 2);<br /> to.Y = (float)(Ta + (Ha / 2) + (Wa * Math.Sin(alpha)) / 2);<br /> }<br /> </code></pre>
<p>&nbsp;The "From" point&nbsp;has coordinates: (122.512 ; 39.8101) and the "To" point&nbsp;has coordinates:(237.0633 ; 154.3614)</p>
<p>&nbsp;&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7140.arrow%20-%20Copy.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7140.arrow-_2D00_-Copy.png"><img border="0" alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/7140.arrow%20-%20Copy.png" original-url="https://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65/7140.arrow-_2D00_-Copy.png" width="367" height="213" /></a></p>
<p>&nbsp;</p>
<p>What needs to be determined now is the distance between the "To" point and each rectangle. For that, we'll need to determine where the segment between "To" and the center of the rectangle intersects the bounds of the rectangle.</p>
<p>The line between "To" and the center intersects the bounds in found points at most. So we'll need to determine which one of&nbsp;these&nbsp;points is inside the bounds and between "To" and the center.</p>
<p>We start off by computing the line equation for the line that contains "To" and the center (Y = m * X + b). Then we find out the intersection by substituting the points on the bounds (e.g. Y = Top or X = Left + Width).</p>
<pre class="scroll"><code class="csharp">//Line equation between point and center<br /> double m = (cen.Y - src.Y) / (cen.X - src.X);<br /> double b = cen.Y - (cen.X * m);<br /> <br /> PointF[] pis = new PointF[4];<br /> pis[0] = new PointF((float)((bounds.Top - b) / m), bounds.Top);<br /> pis[1] = new PointF((float)(bounds.Left + bounds.Width), (float)((bounds.Left + bounds.Width) * m + b));<br /> pis[2] = new PointF((float)((bounds.Top + bounds.Height - b) / m), (float)(bounds.Top + bounds.Height));<br /> pis[3] = new PointF(bounds.Left, (float)(bounds.Left * m + b));<br /> sqdist = double.NaN;<br /> <br /> //Select the intersection with the bounds which is inside the bounds and between the two points<br /> for (int i = 0; i &lt; 4; ++i)<br /> {<br /> <br /> if (IsInsideAndBetwen(pis[i], src, cen, bounds))<br /> {<br /> sqdist = Math.Pow(src.X - pis[i].X, 2) + Math.Pow(src.Y - pis[i].Y, 2);<br /> <br /> return;<br /> }<br /> }</code></pre>
<p>&nbsp;</p>
<p>The method IsInsideAndBetween(pi, src,cen, bounds) returns true if pi is between cen and src and if pi is inside the bounds.</p>
<pre class="scroll"><code class="csharp"> private bool IsInsideAndBetwen(PointF pi, PointF src, PointF cen, RectangleF bounds)<br /> {<br /> <br /> if (pi.X &lt; bounds.Left ||<br /> pi.X &gt; bounds.Left + bounds.Width ||<br /> pi.Y &lt; bounds.Top ||<br /> pi.Y &gt; bounds.Top + bounds.Height)<br /> return false; //It's outside bounds<br /> <br /> if (cen.X == pi.X)<br /> {<br /> if ((src.Y - cen.Y) / (pi.Y - cen.Y) &lt; 1)<br /> return false;<br /> }<br /> <br /> else<br /> if (cen.Y == pi.Y)<br /> {<br /> if ((src.X - cen.X) / (pi.X - cen.X) &lt; 1)<br /> return false;<br /> }<br /> else<br /> if ((src.X - cen.X) / (pi.X - cen.X) &lt; 1 ||<br /> (src.Y - cen.Y) / (pi.Y - cen.Y) &lt; 1)<br /> return false; //It's not between the two points.<br /> <br /> return true;<br /> }</code></pre>
<p>&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-size: xx-small;">Disclaimer: Sample </span><span style="font-size: xx-small;">Code is provided for the purpose of illustration only and is not intended to be</span><br /><span style="font-size: xx-small;">used in a production environment. THIS SAMPLE CODE AND ANY RELATED INFORMATION</span><br /><span style="font-size: xx-small;">ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED</span><br /><span style="font-size: xx-small;">OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF</span><br /><span style="font-size: xx-small;">MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. We grant You a</span><br /><span style="font-size: xx-small;">nonexclusive, royalty-free right to use and modify the Sample Code and to</span><br /><span style="font-size: xx-small;">reproduce and distribute the object code form of the Sample Code, provided</span><br /><span style="font-size: xx-small;">that. You agree: (i) to not use Our name, logo, or trademarks to market Your</span><br /><span style="font-size: xx-small;">software product in which the Sample Code is embedded; (ii) to include a valid</span><br /><span style="font-size: xx-small;">copyright notice on Your software product in which the Sample Code is embedded;</span><br /><span style="font-size: xx-small;">and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and</span><br /><span style="font-size: xx-small;">against any claims or lawsuits, including attorneys&rsquo; fees, that arise or result</span><br /><span style="font-size: xx-small;">from the use or distribution of the Sample Code</span></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Using DDE in C# for Office automation</title>
      <link>https://docs.microsoft.com/archive/blogs/cobold/using-dde-in-c-for-office-automation</link>
      <pubDate>Tue, 26 Jul 2011 05:11:00 GMT</pubDate>
      <dc:creator><![CDATA[Costin Boldisor]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cobold/2011/07/26/using-dde-in-c-for-office-automation/</guid>
      <description><![CDATA[&nbsp;
Looking for some code samples how to pass DDE messages from a .NET program I found out that...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p>Looking for some code samples how to pass DDE messages from a .NET program I found out that there&lsquo;s a great library already in place that facilitates working with DDE: the NDde project from Codeplex: <a title="https://ndde.codeplex.com/" href="https://ndde.codeplex.com/">https://ndde.codeplex.com/</a></p>
<p>However, I just needed to make one call and including a new DLL into my code would have been too much.</p>
<p>So I just created a sample C# program derived from the NDde code that imports only the necessary functions from the Win32 API to pass an Open DDE message to Excel for opening a workbook.</p>
<p><code class="csharp">Workbook wb = DDEHelper.OpenWorkbook(_excel, args[0]);</code></p>
<p><code class="csharp"></code>&nbsp;</p>
<p>Compilation:</p>
<pre class="scroll"><code class="cplusplus">D:\Projects\DDE&gt;csc /r:C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\</code><code class="cplusplus">14.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll DDEOpen.cs</code></pre>
<pre class="scroll"><code class="csharp"></code>&nbsp;</pre>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/18/98/40/DDEOpen.cs" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-18-98-40/DDEOpen.cs">DDEOpen.cs</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Using .NET library in VBA</title>
      <link>https://docs.microsoft.com/archive/blogs/cobold/using-net-library-in-vba</link>
      <pubDate>Wed, 01 Jun 2011 07:56:00 GMT</pubDate>
      <dc:creator><![CDATA[Costin Boldisor]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cobold/2011/06/01/using-net-library-in-vba/</guid>
      <description><![CDATA[Three easy steps for exporting .NET functionality to VBA:
1. Write a source file:
&nbsp;
using...]]></description>
      <content:encoded><![CDATA[<p>Three easy steps for exporting .NET functionality to VBA:</p>
<p>1. Write a source file:</p>
<p>&nbsp;</p>
<pre class="scroll"><code class="csharp">using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Runtime.InteropServices;<br />
using System.Windows.Forms;<br />
<br />
namespace InteropTest<br />
{<br />
    [Guid("BEB2C62D-5646-4B08-81DF-670314BFEE4A")]<br />
    public class InteropTestClass<br />
    {<br />
        public void Help()<br />
        {<br />
            MessageBox.Show("Hello From .NET!");<br />
        }<br />
<br />
    }<br />
}<br />
</code></pre>
<p>The GUID needs to be unique.</p>
<p>2. Generate a strong key to sign the assembly:</p>
<p><span style="font-family: courier new,courier;">sn -k MyKey.snk </span></p>
<p>3. Compile the C# file using CSC:</p>
<p><span style="font-family: courier new,courier;">csc /target:library /out:tstint.dll MyClass.cs /keyfile:MyKey.snk</span></p>
<p>&nbsp;</p>
<p>We now have a DLL that can be exported to another machine with the .NET Framework installed. On the target machnie, the assembly needs to be registered:</p>
<p><strong><span style="font-family: courier new,courier;">regasm tstint.dll /codebase /tlb:tstint.tlb</span></strong></p>
<p>&nbsp;</p>
<p>Now the library can be used in Office by selecting it from the list of references in VBA:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/0118.image_60CD21D3.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65-metablogapi/0118.image_5F00_60CD21D3.png"><img height="130" width="146" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/5808.image_thumb_2C88D2C0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65-metablogapi/5808.image_5F00_thumb_5F00_2C88D2C0.png" alt="image" border="0" title="image" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" /></a></p>]]></content:encoded>
    </item>
    <item>
      <title>Recovering the pictures from a PPT file</title>
      <link>https://docs.microsoft.com/archive/blogs/cobold/recovering-the-pictures-from-a-ppt-file</link>
      <pubDate>Fri, 13 May 2011 07:13:00 GMT</pubDate>
      <dc:creator><![CDATA[Costin Boldisor]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cobold/2011/05/13/recovering-the-pictures-from-a-ppt-file/</guid>
      <description><![CDATA[&nbsp;
The PPT file format is very well documented as per Microsoft&rsquo;s Open Specification...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p>The PPT file format is <a target="_blank" href="https://www.microsoft.com/interop/docs/OfficeBinaryFormats.mspx">very well documented</a> as per Microsoft&rsquo;s Open Specification Promise. However, accessing any part of a PPT file isn&rsquo;t really a snap.</p>
<p>I&rsquo;ve created a small C# program which parses the \Pictures stream from a PPT file. For that, one needs to:</p>
<ul>
<li>Extract the Pictures stream from the PPT OLE storage</li>
<li>Parse the stream according to the OfficeArtFBSE format</li>
<li>Extract all the binary pictures according to format: WMF, EMF, PNG, JPG </li>
</ul>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/8156.image_3EADEB10.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65-metablogapi/8156.image_5F00_3EADEB10.png"><img height="451" width="583" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/5428.image_thumb_29AC42D0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65-metablogapi/5428.image_5F00_thumb_5F00_29AC42D0.png" alt="image" border="0" title="image" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" /></a></p>
<p>This can be used for damaged PPT files where the shapes that contain pictures can&rsquo;t be viewed anymore.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/16/42/12/ParsePictures.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-16-42-12/ParsePictures.zip">ParsePictures.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Complex editing of XLSX files</title>
      <link>https://docs.microsoft.com/archive/blogs/cobold/complex-editing-of-xlsx-files</link>
      <pubDate>Fri, 29 Apr 2011 02:21:00 GMT</pubDate>
      <dc:creator><![CDATA[Costin Boldisor]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cobold/2011/04/29/complex-editing-of-xlsx-files/</guid>
      <description><![CDATA[&nbsp;
Editing Excel OpenXML documents using the OpenXML 2.0 SDK offers better performace and...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p>Editing Excel OpenXML documents using the OpenXML 2.0 SDK offers better performace and improved supportability compared to normal Office automation (e.g. VBA). There are also great examples on the Internet to get started: <a target="_blank" href="https://msdn.microsoft.com/en-us/library/bb508943.aspx">Office Open XML Formats: Inserting Values into Excel 2007 Cells</a>.</p>
<p>What I haven&rsquo;t found until now is some clarifications as to how one can edit multiple Excel cells without corrupting the workbook. This is what I&rsquo;m presenting in this blog post.</p>
<p>The fact is that whenever rows and cells need to be added to an Excel worksheet, they need to be sorted upon insertion. Take for instance the XML for the following worksheet where A1 = 1, B1 = 2 and B2 = 3. Here is the only way the XML should be saved like:</p>
<blockquote>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/7750.image_60C32A4A.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65-metablogapi/7750.image_5F00_60C32A4A.png"><img height="181" width="244" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/6170.image_thumb_06F55DD6.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65-metablogapi/6170.image_5F00_thumb_5F00_06F55DD6.png" alt="image" border="0" title="image" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" /></a></p>
</blockquote>
<p>If we inserted say cell B1 before cell A1, Excel would show a corruption error when opening the XLSX.</p>
<p>The program that I&rsquo;m attaching here does exactly this: the input is a worksheet, a row and a column and the output is a modified worksheet that contains the row and the cell required for that cell to be edited.</p>
<p>Other useful features:</p>
<p>- Convert column index to colum name (e.g. 28 to AB)</p>
<p>- Get the column index from cell reference (e.g. AB23 to 28)</p>
<p>- Selecting cells based on argument value using LINQ</p>
<p>&nbsp;</p>
<p>Sample edited worksheet:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/7752.image_6046D188.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65-metablogapi/7752.image_5F00_6046D188.png"><img height="192" width="417" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/3173.image_thumb_1D1B535B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-28-65-metablogapi/3173.image_5F00_thumb_5F00_1D1B535B.png" alt="image" border="0" title="image" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border: 0px;" /></a></p>
<p>Note: The sample program does not create a blank workbook, you will need to save one from Excel and pass the full path and the name of the worksheet to the program. </p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/15/94/15/ModifyWorksheet.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-15-94-15/ModifyWorksheet.zip">ModifyWorksheet.zip</a></p>]]></content:encoded>
    </item>
    <item>
      <title>Indenting XML files</title>
      <link>https://docs.microsoft.com/archive/blogs/cobold/indenting-xml-files</link>
      <pubDate>Thu, 17 Mar 2011 05:38:00 GMT</pubDate>
      <dc:creator><![CDATA[Costin Boldisor]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/cobold/2011/03/17/indenting-xml-files/</guid>
      <description><![CDATA[&nbsp;
The operation of indenting XML files is pretty trivial when using the classes from the...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p>
<p>The operation of indenting XML files is pretty trivial when using the classes from the System.XML namespace. However, I often find myself trying to read canonical XML code from files. As such, a created a very simple tool that converts XML files to indented XML.</p>
<p>All you need to do is to drag and drop an XML file into the WPF window and there you have it!</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/8032.image_705C42D5.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-28-65-metablogapi/8032.image_5F00_705C42D5.png"><img height="150" width="392" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/0624.image_thumb_5EDBBC30.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-28-65-metablogapi/0624.image_5F00_thumb_5F00_5EDBBC30.png" alt="image" border="0" title="image" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" /></a></p>
<p>And the difference:</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/6087.image_1C88A3ED.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-28-65-metablogapi/6087.image_5F00_1C88A3ED.png"><img height="219" width="325" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/28/65/metablogapi/6428.image_thumb_19FF722F.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-01-28-65-metablogapi/6428.image_5F00_thumb_5F00_19FF722F.png" alt="image" border="0" title="image" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" /></a></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Components.PostAttachments/00/10/14/26/02/Canonical.zip" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-components-postattachments/00-10-14-26-02/Canonical.zip">Canonical.zip</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>