<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>FeradZ Blog &#187; windows</title>
	<atom:link href="http://blog.feradz.com/category/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.feradz.com</link>
	<description>Ferad Zyulkyarov - personal blog</description>
	<lastBuildDate>Fri, 02 Jul 2010 15:50:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Convert (Export) Excel Chart to EPS Using Adobe Postscript</title>
		<link>http://blog.feradz.com/2010/06/convert-export-excel-chart-to-eps-using-adobe-postscript/</link>
		<comments>http://blog.feradz.com/2010/06/convert-export-excel-chart-to-eps-using-adobe-postscript/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 16:03:06 +0000</pubDate>
		<dc:creator>feradz</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Adobe Postscript]]></category>
		<category><![CDATA[Chart]]></category>
		<category><![CDATA[EPS]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Export]]></category>
		<category><![CDATA[Latex]]></category>

		<guid isPermaLink="false">http://blog.feradz.com/?p=267</guid>
		<description><![CDATA[
		
		
		
		You may need to export a nice chart from Excel to EPS so that you include it in your Latex project. Here is one way&#160;how you do it.
1. You need to install Adobe Universal PostScript Windows Driver Installer 1.0.6 (or newer). If you have Vista or Windows 7 or some newer version run the installer [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://blog.feradz.com/2010/06/convert-export-excel-chart-to-eps-using-adobe-postscript/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Convert+%28Export%29+Excel+Chart+to+EPS+Using+Adobe+Postscript";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>You may need to export a nice chart from Excel to EPS so that you include it in your Latex project. Here is one way&nbsp;how you do it.</p>
<p>1. You need to install <a href="http://www.adobe.com/support/downloads/product.jsp?platform=win&amp;product=pdrv" target="_blank">Adobe Universal PostScript Windows Driver Installer </a>1.0.6 (or newer). If you have Vista or Windows 7 or some newer version run the installer with&nbsp;compatibility for Windows XP SP3.</p>
<p>-&nbsp;To set the compatibility for the installer, right click the file and select &quot;Properties&quot;. Then from the &quot;Compatibility &quot; tab select &quot;Run this program in compatibility mode for:&quot; and select &quot;Windows XP (Service Pack 3)&quot;</p>
<p>&nbsp;<img alt="Select Compatability Mode" height="576" src="http://blog.feradz.com/wp-content/uploads/excel_chart_to_eps/select_compatability_mode.jpg" width="384" /></p>
<p>2. Open your Excel File.</p>
<p>3. Select your chart.</p>
<p>4. Select from the (File)&nbsp;menu print</p>
<p>5. Select the Adobe printer in my case this is &quot;Generic PostScript Printer&quot;</p>
<p>6. Ensure that &quot;Select Chart&quot; is the selected option in &quot;Print what&quot; area. If you did not selected the chart then this will option will not be selected. Go to Step 3.</p>
<p>7. Select print to file check box.</p>
<p>8. Go to Properties</p>
<p><img alt="Print Dialogue Box" height="365" src="http://blog.feradz.com/wp-content/uploads/excel_chart_to_eps/print_dialogue_box.jpg" width="495" /></p>
<p>9. In the properties dialog window select&nbsp;&quot;Layout&quot; tab&nbsp;then&nbsp;press &quot;Advanced&quot; button</p>
<p><img alt="" src="http://blog.feradz.com/wp-content/uploads/excel_chart_to_eps/printer_properties_dialogue.jpg" /></p>
<p>10. In the Advanced properties dialog window, under the node &quot;Postcript options:&quot; select &quot;Encapsulated Postscript (EPS)&quot;</p>
<p><img alt="" src="http://blog.feradz.com/wp-content/uploads/excel_chart_to_eps/advanced_dialogue.jpg" /></p>
<p>11. In the printer dialogue window, when you press &quot;Print&quot; you will be asked for the file name to be saved. You are not asked ensure that you have selected &quot;Print to file&quot; Step 7. Write the path and the file name something like &quot;c:\chart.ps&quot;. If you don&#39;t include the full path I don&#39;t know where the file will be saved by default.</p>
<p><img alt="" src="http://blog.feradz.com/wp-content/uploads/excel_chart_to_eps/output_file_name.jpg" /></p>
<p>12. Use ps2eps to convert the saved PS format file into EPS format.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.feradz.com/2010/06/convert-export-excel-chart-to-eps-using-adobe-postscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Translating Instruction Address to Source Line</title>
		<link>http://blog.feradz.com/2010/02/translating-instruction-address-to-source-line/</link>
		<comments>http://blog.feradz.com/2010/02/translating-instruction-address-to-source-line/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 10:01:51 +0000</pubDate>
		<dc:creator>feradz</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[address]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[DbgEng]]></category>
		<category><![CDATA[instruction]]></category>
		<category><![CDATA[interop]]></category>
		<category><![CDATA[managed]]></category>
		<category><![CDATA[native]]></category>
		<category><![CDATA[source]]></category>
		<category><![CDATA[source line]]></category>
		<category><![CDATA[translate]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[WinDbg]]></category>

		<guid isPermaLink="false">http://blog.feradz.com/?p=232</guid>
		<description><![CDATA[
		
		
		
		In this article I will describe how to programmatically translate an instruction address from a Win32 executable to a source line. The described approach uses the Microsoft debugger engine dbgeng.dll. Therefore you should have it installed. If you don&#8217;t have it, you can download and install the Windows debugger WinDbg which will install dbgeng.dll.
Requirements
To use [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://blog.feradz.com/2010/02/translating-instruction-address-to-source-line/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Translating+Instruction+Address+to+Source+Line";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>In this article I will describe how to programmatically translate an instruction address from a Win32 executable to a source line. The described approach uses the Microsoft debugger engine <a href="http://msdn.microsoft.com/en-us/library/cc265857.aspx" target="_blank">dbgeng.dll</a>. Therefore you should have it installed. If you don&rsquo;t have it, you can download and install the Windows debugger <a href="http://www.microsoft.com/whdc/Devtools/Debugging/default.mspx" target="_blank">WinDbg</a> which will install dbgeng.dll.</p>
<h1>Requirements</h1>
<p>To use this approach you will need to have installed windows debugger engine &ndash; dbgeng.dll. If you don&rsquo;t have it, install WinDbg debugger. This will install dbgeng.dll</p>
<h1>Approach</h1>
<p>Many debuggers support debugging at source code level. The debugger is capable to provide debugging at the source level by translating instruction addresses to lines in source code files. In our approach we use the same mechanisms that debuggers use. This particular solution, to translate an instruction address to a source line, uses functionality provided by the windows debugger engine dbgeng.dll.</p>
<p>In overview, we create a process from the Win32 executable file from which we want to translate instruction addresses. Then we attach the debugger engine to the created process. To create a process and attach the debugger to it we use <a href="http://msdn.microsoft.com/en-us/library/cc265984.aspx" target="_blank">CreateProcessAndAttach</a> function. When the debugger is attached, we call function <a href="http://msdn.microsoft.com/en-us/library/cc266196.aspx" target="_blank">GetLineByOffset</a> to do the actual translation. After we finish with the translation task we terminate the process with the function <a href="http://msdn.microsoft.com/en-us/library/cc265989.aspx" target="_blank">TerminateCurrentProcess</a>. Besides these procedures there are few more things that are necessary to do which&nbsp;I explain in the implementation.</p>
<h1>Implementation</h1>
<p>First we create objects that implement the following COM interfaces: IDebugControl , IDebugClient, IDebugSymbols. To create these objects we use function <a href="http://msdn.microsoft.com/en-us/library/cc265700.aspx" target="_blank">DebugCreate</a>.</p>
<pre>static IDebugClient5 *dbgClient5 = NULL;
static IDebugSymbols *dbgSymbols = NULL;
static IDebugControl *dbgControl = NULL;
...
DebugCreate(__uuidof(IDebugControl), (void**) &amp; dbgControl);
DebugCreate(__uuidof(IDebugClient), (void **) &amp; dbgClient5);
DebugCreate(__uuidof(IDebugSymbols), (void **) &amp; dbgSymbols);
</pre>
<p>Before crating the process from the executable we set the debugger engine filters so that the target process breaks into the debugger immediately after it is created. To set the debugger filters we use function <a href="http://msdn.microsoft.com/en-us/library/cc266083.aspx" target="_blank">SetSpecificFilterParameters</a>.</p>
<pre>DEBUG_SPECIFIC_FILTER_PARAMETERS filter[10];
for (int i = 0; i &lt; 10; i++) {
	filter[i].ExecutionOption = DEBUG_FILTER_BREAK;
	filter[i].ContinueOption = DEBUG_FILTER_GO_HANDLED;
	filter[i].TextSize = 0;
	filter[i].CommandSize = 0;
	filter[i].ArgumentSize = 0;
}

dbgControl-&gt;SetSpecificFilterParameters(0, 10, filter);
</pre>
<p>Using function <a href="http://msdn.microsoft.com/en-us/library/cc265984.aspx" target="_blank">CreateProcessAndAttach</a> we create a windows debug process and attach the debugger to it.</p>
<pre>ULONG64 server            = 0;
PSTR    commandLine       = executableName;
ULONG   processId         = 0;
ULONG   attachFlags       = 0; 

dbgClient5-&gt;CreateProcessAndAttach(
	server,
	commandLine,
	DEBUG_PROCESS,
	processId,
	attachFlags);
</pre>
<p>To translate the instruction address to a source line we call function <a href="http://msdn.microsoft.com/en-us/library/cc266196.aspx" target="_blank">GetLineByOffset</a>.</p>
<pre>ULONG64 offset = instrAddress;
ULONG fileNameBufferSize = MAX_FILE_NAME_SIZE;
memset(sourceInfo-&gt;fileName, 0, fileNameBufferSize);
sourceInfo-&gt;lineNo = 0;
sourceInfo-&gt;fileSize = 0;
sourceInfo-&gt;displacement = 0;

HRESULT isOk = dbgSymbols-&gt;GetLineByOffset(
	offset,
	&amp;sourceInfo-&gt;lineNo,
	sourceInfo-&gt;fileName,
	fileNameBufferSize,
	&amp;sourceInfo-&gt;fileSize,
	&amp;sourceInfo-&gt;displacement);
</pre>
<p>If we want to translate multiple addresses, we have to call function GetLineByOffset multiple times without repeating the earlier operations. After we finish with the translation we detatch the debugger from the process by terminating the process with function <a href="http://msdn.microsoft.com/en-us/library/cc265989.aspx" target="_blank">TerminateCurrentProcess</a>.</p>
<pre>HRESULT isOk = dbgClient5-&gt;TerminateCurrentProcess();
</pre>
<h1>Download</h1>
<p>The code complete source code is available for download from <a href="http://www.feradz.com/resources/InstructionToSourceLine.zip" target="_blank">InstructionToSourceLine.zip</a>. Note that the instruction address provided as input should be a decimal number but not hexadecimal.</p>
<h1>C# Version</h1>
<p>There is also a C# implementation of this tool that you can download from <a href="http://www.feradz.com/resources/InstructionToSourceLineCSharp.zip" target="_blank">InstructionToSourceLineCSharp.zip</a>. This C# implementation consists of 2 parts &#8211; DbgEngManaged and InstructionToSourceLineCSharp. DbgEngManaged is a managed c++ library wrapper for the debugger engine DbgEng.dll. InstructionToSourceLineCSharp is a C# console application that references DbgEngManaged library. Note that the error handling here is not done properly so don&#39;t judge me for it <img src='http://blog.feradz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The provided code here is something that I have quickly prototyped and decided to share for those who for some reason need to use the debugger engine. It can also serve as an example of using native and managed code together.&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.feradz.com/2010/02/translating-instruction-address-to-source-line/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Short and Comprehensive Tutorial on Windows API</title>
		<link>http://blog.feradz.com/2009/04/a-short-and-comprehensive-tutorial-on-windows-api/</link>
		<comments>http://blog.feradz.com/2009/04/a-short-and-comprehensive-tutorial-on-windows-api/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 12:24:20 +0000</pubDate>
		<dc:creator>feradz</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[controls]]></category>
		<category><![CDATA[drawing]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[graphics]]></category>

		<guid isPermaLink="false">http://blog.feradz.com/?p=170</guid>
		<description><![CDATA[
		
		
		
		I needed to write a simple native Win32&#160;windows application and after searching around I found very nice tutorial -&#160;easy to read and&#160;with rich examples. So here is the link &#34;Windows API Tutorial&#34;. The tutorial includes examples of how to write native (win32) applications with forms, drawgraphics and threading. The tutorial follows a good practice of [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://blog.feradz.com/2009/04/a-short-and-comprehensive-tutorial-on-windows-api/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "A+Short+and+Comprehensive+Tutorial+on+Windows+API";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>I needed to write a simple native Win32&nbsp;windows application and after searching around I found very nice tutorial -&nbsp;easy to read and&nbsp;with rich examples. So here is the link &quot;<a target="_blank" href="http://www.relisoft.com/win32/index.htm">Windows API Tutorial</a>&quot;. The tutorial includes examples of how to write native (win32) applications with forms, drawgraphics and threading. The tutorial follows a good practice of encapsulating the Win32 abstractions in C++ classes (something which is alredy done at MFC) and makes things to understand easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.feradz.com/2009/04/a-short-and-comprehensive-tutorial-on-windows-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>dumpbin &#8211; reading header files of windows binaries</title>
		<link>http://blog.feradz.com/2009/03/dumpbin-reading-header-files-of-windows-binaries/</link>
		<comments>http://blog.feradz.com/2009/03/dumpbin-reading-header-files-of-windows-binaries/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 13:00:13 +0000</pubDate>
		<dc:creator>feradz</dc:creator>
				<category><![CDATA[windows]]></category>
		<category><![CDATA[coff]]></category>
		<category><![CDATA[dumpbin]]></category>

		<guid isPermaLink="false">http://blog.feradz.com/?p=167</guid>
		<description><![CDATA[
		
		
		
		Using dumpbin /headers you can read the header of windows files and check for example for what architecture and addressing mode the binary is compiled for. 
]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://blog.feradz.com/2009/03/dumpbin-reading-header-files-of-windows-binaries/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "dumpbin+%26%238211%3B+reading+header+files+of+windows+binaries";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>Using dumpbin /headers you can read the header of windows files and check for example for what architecture and addressing mode the binary is compiled for. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.feradz.com/2009/03/dumpbin-reading-header-files-of-windows-binaries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Line Length Marker in Visual Studio</title>
		<link>http://blog.feradz.com/2009/02/add-line-length-marker-in-visual-studio/</link>
		<comments>http://blog.feradz.com/2009/02/add-line-length-marker-in-visual-studio/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 13:53:45 +0000</pubDate>
		<dc:creator>feradz</dc:creator>
				<category><![CDATA[windows]]></category>
		<category><![CDATA[line break]]></category>
		<category><![CDATA[line guide]]></category>
		<category><![CDATA[line length]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://blog.feradz.com/?p=161</guid>
		<description><![CDATA[
		
		
		
		To add a guiding verical line for the length of the lines in Visual Studio do as follows:

Open registry editor
Navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\*.0\Text Editor (* depends on your version of VS, 8.0 = VS 2005 and 9.0 = VS 2008)
On the right pane add a new string value and name it &#34;Guides&#34;
Double click on the newly [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; width: 42px; padding-right: 10px; margin: 0 0 0 10px;">
		<script type="text/javascript">
		<!--
		digg_url = "http://blog.feradz.com/2009/02/add-line-length-marker-in-visual-studio/";
		digg_bgcolor = "";
		digg_skin = "";
		digg_window = "";
		digg_title = "Add+Line+Length+Marker+in+Visual+Studio";
		digg_media = "";
		digg_topic = "";
		digg_bodytext = "";
		//-->
		</script>
		<script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script></div><p>To add a guiding verical line for the length of the lines in Visual Studio do as follows:</p>
<ol>
<li>Open registry editor</li>
<li>Navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\*.0\Text Editor (* depends on your version of VS, 8.0 = VS 2005 and 9.0 = VS 2008)</li>
<li>On the right pane add a new string value and name it &quot;Guides&quot;</li>
<li>Double click on the newly created string value &quot;Guides&quot; and put the following as its value &quot;RGB(255, 20, 147) 80&quot; including the apostrophes. The string specifies two properties &#8211; RGB(255, 20, 147) &#8211; the color of the line and 80 the line length. You can adjust them to suite your needs.</li>
<li>Close registry editor and restart the Visual Studio.</li>
</ol>
<p>&nbsp;<img width="600" height="299" alt="" src="http://blog.feradz.com/wp-content/uploads/image/vs_line_marker.JPG" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.feradz.com/2009/02/add-line-length-marker-in-visual-studio/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
