<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.simple-talk.com/community/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>David Connell</title><link>http://www.simple-talk.com/community/blogs/davidc/default.aspx</link><description>Software Developer - Red Gate Software</description><dc:language>en-GB</dc:language><generator>CommunityServer 2.0 (Debug Build: 60217.2664)</generator><item><title>How to add to the list of available SQL Servers </title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2008/03/10/47811.aspx</link><pubDate>Mon, 10 Mar 2008 16:03:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:47811</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/47811.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=47811</wfw:commentRss><description>&lt;P&gt;Have you ever wanted to add to the list of SQL Servers found in Red Gate's SQL Compare, SQL Data Compare, SQL Doc or even SQL Data Generator? &lt;/P&gt;
&lt;P&gt;If so, here goes. &lt;/P&gt;
&lt;P&gt;All you need to do is add the name of the SQL Server instance to the registry. The application looks for servers named 0,1,2,3.... under ‘HKCU\Software\Red Gate\Shared\Servers'. You will also need to add an offset which has a limit of 10. If you are adding more than one server, increment the offset by 1 and add a new key for each subsequent server with the next consecutive number upto a maximum of 9.&lt;/P&gt;
&lt;P&gt;In the following example I will add a new server with a customized connection string to specify a port number over TCP/IP. &lt;/P&gt;
&lt;P&gt;Start up your regedit.exe, and navigate to ‘HKCU\Software\Red Gate\Shared\Servers'. (You may need to create the last part.)&lt;/P&gt;
&lt;P&gt;Add "0" as a string with the server that you wish to add eg:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="/blogbits/david_connell//DCHowtoaddImage1.png"&gt;&lt;/P&gt;
&lt;P&gt;Add or modify "offset" (DWORD) to 1&lt;/P&gt;
&lt;P&gt;&lt;IMG src="/blogbits/david_connell//DCHowtoaddImage2.png"&gt;&lt;/P&gt;
&lt;P&gt;So now my registry looks like&lt;/P&gt;
&lt;P&gt;&lt;IMG src="/blogbits/david_connell//HowtoaddImage3.png"&gt;&lt;/P&gt;
&lt;P&gt;Now Refresh your list of SQL Servers and this new item has been added.&lt;/P&gt;
&lt;P&gt;There you go, it was that simple.&lt;/P&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=47811" width="1" height="1"&gt;</description></item><item><title>How to write a Generator for SQL Data Generator 1.0 Beta </title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2008/01/15/47814.aspx</link><pubDate>Tue, 15 Jan 2008 17:09:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:47814</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/47814.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=47814</wfw:commentRss><description>&lt;P&gt;In this article we will develop our own generator and understand the basic concepts and ideas behind developing generators for SQL Data Generator. Specifically we will write an ISBN number generator for SQL Data Generator 1.0 Beta, that can generate unique ISBN-10 style strings. You will see that writing and developing your own Generators is simple and easy. &lt;/P&gt;
&lt;P&gt;It is assumed that you are proficient at C# 2.0, have a good understanding of.NET and have access to SQL Data Generator on your machine.&lt;/P&gt;
&lt;P&gt;To test your code you will also need access to either Microsoft SQL Server 2000 or Microsoft SQL Server 2005.&lt;/P&gt;
&lt;P&gt;(Please note that there may be some changes between Beta and final release, as a result any generators developed may need to be modified and rebuilt for the final release.)&lt;/P&gt;
&lt;P&gt;All the code is available in the attached C# project.&lt;/P&gt;
&lt;H2&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Architecture&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/H2&gt;
&lt;P class=MsoNormal&gt;Here is a simple diagram of the architecture of the product.&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;(insert image)&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;This discussion is about the plug-in architecture for the generators.&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;The engine defines a series of interfaces and a generator must implement a series of interfaces in order for the engine to consider it to be a Generator. At start-up a specified directory is scanned for DLLs. Each of these DLLs in turn is loaded up and reflection is used to see if any public classes implement these interfaces. If this is the case then they are considered to be generators and accessible to the rest of the system.&lt;o:p&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;There are a series of interfaces defined by the engine. Each interface is very light-weight. As the developer of the generator, it's up to you to decide how many of these interfaces you wish to implement.&lt;/P&gt;
&lt;H2&gt;&lt;EM&gt;&lt;FONT face=Arial&gt;Basic Interface "IGenerator"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/H2&gt;
&lt;P class=MsoNormal&gt;This interface must be implemented in order to consider that your class is a generator. Here is the definition of the interface:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color=blue&gt;namespace&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;RedGate.SQLDataGenerator.Engine.Generators
&lt;BR&gt;{
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;public&amp;nbsp;interface&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;IGenerator&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=gray&gt;:&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;IEnumerable
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&lt;BR&gt;
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;BR&gt;}
&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT color=black&gt;You must also implement a special constructor that takes a single parameter of type GeneratorParameters. This parameter describes the SQL field in the Table that is being assigned. You are at liberty to throw exceptions etc within your constructor if your code decides for some reason that it is not happy.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=black&gt;In order for you generator to appear within the UI you must also add a simple Generator attribute to your class.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=black&gt;You will also need to add the SupportSqlType for non string based generators. (This will probably not be required for the final version.). This attribute can be added multiple times and is used to define the targeted SQL Type. Currently the enumeration is based on the SqlTypes defined in the SQL Compare Engine.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=black&gt;Here is the code for producing random values for the 8 times table, between 0 and 1024.&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;&lt;FONT color=blue&gt;namespace&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;MyNameSpace
&lt;BR&gt;{
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[SupportSqlType(SqlType.Integer64)]
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[Generator(typeof(int),&amp;nbsp;"Generic",&amp;nbsp;"8&amp;nbsp;times&amp;nbsp;table",&amp;nbsp;"8,&amp;nbsp;0,&amp;nbsp;16,&amp;nbsp;256,&amp;nbsp;...")]
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;public&amp;nbsp;class&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;SimpleGenerator1&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=gray&gt;:&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;IGenerator
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;public&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;SimpleGenerator1&lt;/FONT&gt;&lt;FONT color=gray&gt;(&lt;/FONT&gt;&lt;FONT color=black&gt;GeneratorParameters&amp;nbsp;parameters&lt;/FONT&gt;&lt;FONT color=gray&gt;)
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;{
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;BR&gt;
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;public&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;System.Collections.IEnumerator&amp;nbsp;GetEnumerator&lt;/FONT&gt;&lt;FONT color=gray&gt;()
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&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;Random&amp;nbsp;r&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;new&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;Random&lt;/FONT&gt;&lt;FONT color=gray&gt;(&lt;/FONT&gt;&lt;FONT color=black&gt;0&lt;/FONT&gt;&lt;FONT color=gray&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;&lt;/FONT&gt;&lt;FONT color=black&gt;while&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=gray&gt;(&lt;/FONT&gt;&lt;FONT color=blue&gt;true&lt;/FONT&gt;&lt;FONT color=gray&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;&lt;/FONT&gt;&lt;FONT color=black&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;yield&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;return&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;r.Next&lt;/FONT&gt;&lt;FONT color=gray&gt;(&lt;/FONT&gt;&lt;FONT color=black&gt;0&lt;/FONT&gt;&lt;FONT color=gray&gt;,&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;1024&lt;/FONT&gt;&lt;FONT color=gray&gt;)&amp;nbsp;*&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;8&lt;/FONT&gt;&lt;FONT color=gray&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;&lt;/FONT&gt;&lt;FONT color=black&gt;}
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;BR&gt;}
&lt;BR&gt;
&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P class=MsoNormal&gt;The Generator attribute should only be defined once per class and defines the the type of the .NET result, the Category that the generator is placed in, the name and the description of the generator in the UI.&lt;/P&gt;
&lt;H3&gt;&lt;FONT face=Arial&gt;Constructor&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal&gt;The GeneratorParameters gives access to the actual field. This allows the code to verify that lengths and types are consistent. This is likely to change for the final release.&lt;/P&gt;
&lt;H3&gt;&lt;FONT face=Arial&gt;GetEnumerator&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal&gt;The easiest way to implement this code is via the yield statement. As a result the code is very straightforward. The example here never runs out of values. However in reality this is not always possible. The engine is designed to cater for a limited number of values from the GetEnumerator. In addition it is fine for the GetEnumerator to throw exceptions in order communicate errors.&lt;/P&gt;
&lt;H3&gt;&lt;FONT face=Arial&gt;Interface "ISeedableGenerator"&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal&gt;This interface allows the generator to specify a seed. This allows the generator to generate different random data each time. &lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;Here is the definition of the interface:&lt;/P&gt;&lt;PRE&gt;&lt;FONT color=black&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;public&amp;nbsp;interface&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;ISeedableGenerator
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&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;&lt;/FONT&gt;&lt;FONT color=blue&gt;int&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;Seed&amp;nbsp;{&amp;nbsp;get&lt;/FONT&gt;&lt;FONT color=gray&gt;;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;set&lt;/FONT&gt;&lt;FONT color=gray&gt;;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;}
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/FONT&gt;&lt;/PRE&gt;&lt;FONT color=black&gt;&lt;PRE class=MsoNormal&gt;&lt;FONT face="Times New Roman" size=3&gt;A typical implementation would be:&lt;/FONT&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;
&lt;/PRE&gt;&lt;PRE&gt;&lt;FONT color=black&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;public&amp;nbsp;int&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;Seed
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&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;get&amp;nbsp;{&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;return&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;m_Seed&lt;/FONT&gt;&lt;FONT color=gray&gt;;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&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;set&amp;nbsp;{&amp;nbsp;m_Seed&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;value&lt;/FONT&gt;&lt;FONT color=gray&gt;;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;}
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;
&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;This seed is then used to initialize the Random class, in the GetEnumerator.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;The engine will automatically define a seed to the generator at initialization.&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;(Each column will have its own seed, hence allowing the same generator being&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;assigned multiple times within a table, but each column producing differing results.)&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;SPAN&gt;&lt;/SPAN&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;Please see SimpleGenerator2.cs for the full code implementation.&lt;/FONT&gt;&lt;/PRE&gt;
&lt;H3&gt;&lt;FONT size=4&gt;&lt;FONT face=Arial&gt;Interface "IUniqueableGenerator"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/H3&gt;&lt;PRE class=MsoNormal&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;This interface allows the generator to specify if the data generated is unique. This allows the&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;generator to generate a unique value. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/PRE&gt;&lt;PRE class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;Here is the definition of the interface:&lt;/FONT&gt;&lt;/PRE&gt;&lt;FONT size=3&gt;&lt;FONT color=black&gt;&lt;PRE&gt;&lt;FONT face="Times New Roman"&gt;&lt;FONT color=black&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;public&amp;nbsp;interface&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman"&gt;&lt;FONT color=black&gt;IUniqueableGenerator
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&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;&lt;/FONT&gt;&lt;FONT color=blue&gt;bool&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;Unique&amp;nbsp;{&amp;nbsp;get&lt;/FONT&gt;&lt;FONT color=gray&gt;;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;set&lt;/FONT&gt;&lt;FONT color=gray&gt;;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman" color=black&gt;}
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;
&lt;BR&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P class=MsoNormal&gt;A typical implementation would be:&lt;/P&gt;&lt;PRE&gt;&lt;FONT face="Times New Roman"&gt;&lt;FONT color=black&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;public&amp;nbsp;bool&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman"&gt;&lt;FONT color=black&gt;Unique
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&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;get&amp;nbsp;{&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;return&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;m_Unique&lt;/FONT&gt;&lt;FONT color=gray&gt;;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Times New Roman"&gt;&lt;FONT color=black&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;set&amp;nbsp;{&amp;nbsp;m_Unique&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=blue&gt;=&amp;nbsp;&lt;/FONT&gt;&lt;FONT color=black&gt;value&lt;/FONT&gt;&lt;FONT color=gray&gt;;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=black&gt;&lt;FONT face="Times New Roman"&gt;}
&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;
&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;The GetEnumerator code now becomes more &lt;/FONT&gt;&lt;FONT face="Times New Roman"&gt;complex as there are two versions.&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;The non-unique version, as before, and the new Unique version. For the unique version&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;we just iterate in increments of one over the whole range. Please see SimpleGenerator3.cs&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;for the full code implementation.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;This generator can now be assigned to unique fields. The engine automatically configures&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;the Unique flag on when the generator is assigned.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;A grid Control is used for the UI . This can be controlled via the standard Microsoft Attributes.&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman"&gt;There are some examples in this code.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=3&gt;&lt;FONT color=black&gt;&lt;FONT color=black&gt;&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;H2&gt;&lt;EM&gt;&lt;FONT face="Times New Roman"&gt;Putting this altogther - ISBN Generator&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/H2&gt;&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;The ISBN number generator is very simple and takes a similar approach to the&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;previous examples. However there is one point of interest which is how to&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;define unique values.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;The engine has a particularly useful set of classes in the namespace&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;RedGate.SQLDataGenerator.Engine.Generators.Support, called UniqueValues&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;and RandomValues. These classes generate either a unique or non-unique sequence&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;from a specified seed from zero up to 1 billion.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;This number is then used as the basis of the ISBN. Extra random numbers are added&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;the end of the ISBN to make up the required length. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;This tack-tick allows a better distribution of random unique values as compared&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;to SimpleGenerator3 example.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Please check out ISBNGenerator.cs for a full copy of the source code.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;This example is not complete and for example could be extended to support&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;the newer style ISBN-13.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;H2&gt;&lt;EM&gt;&lt;FONT face="Times New Roman"&gt;Other Bits And Bobs&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/H2&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;The INullableGenerator interface allows the generator to generate a certain&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;percentage of SQL Null values. There is a base abstract class called BaseGenerator&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;which does a lot of work for the developer, however it may or may not make it into&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;the final release. (See SimpleGenerator4.cs for an example, this code is a fully fledged&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Times Table Generator that allows Nulls etc to be generated.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;H2&gt;&lt;EM&gt;&lt;FONT face="Times New Roman"&gt;Summary to write your own Generator&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/H2&gt;&lt;OL&gt;&lt;LI class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Start up Visual Studio &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Create a Class Library .NET Project &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Add references to RedGate.SQLDataGenerator.Engine and RedGate.SQLCompare.Engine &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI class=MsoNormal&gt;&lt;FONT face="Times New Roman" size=3&gt;Point the output DLL to %Program Files%\Red Gate\SQL Data Generator 1\Generators\ .&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;(Assuming a standard installation) &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Create a public class that implements IGenerator &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Add the class attributes &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Implement the constructor &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face="Times New Roman"&gt;Implement the method GetEnumerator&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;LI class=MsoNormal&gt;&lt;FONT face="Times New Roman" size=3&gt;Link to download .NET Project&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;BR&gt;
&lt;BR&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=47814" width="1" height="1"&gt;</description></item><item><title>SQL Data Generator 1 (Beta) - Adding UK Style Address Generators </title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2008/01/10/45721.aspx</link><pubDate>Thu, 10 Jan 2008 18:42:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:45721</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/45721.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=45721</wfw:commentRss><description>&lt;P&gt;We are currently running a Beta of SQL Data Generator, and some people have requested UK style data generators. So I have put together a small zip file that generates the following data:-&lt;/P&gt;
&lt;P&gt;UK Post Codes&lt;BR&gt;UK Counties&lt;BR&gt;UK Cities&lt;BR&gt;UK Towns&lt;BR&gt;In order to install this add in, please carry out the following:&lt;/P&gt;
&lt;P&gt;Stop SQL Data Generator &lt;BR&gt;Download the following file UKConfig.zip&lt;BR&gt;Unzip the contents into the folder "%Program Files%\Red Gate\SQL Data Generator 1\Config"&lt;BR&gt;Restart SQL Data Generator and the new generators are now ready to be used.&lt;BR&gt;We are thinking about setting up mechanisms to allow users to share generators.&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;David Connell&lt;/P&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=45721" width="1" height="1"&gt;</description></item><item><title>Performance and Multiple Assigment in C#</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2006/01/25/183.aspx</link><pubDate>Wed, 25 Jan 2006 23:13:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:183</guid><dc:creator>David Connell</dc:creator><slash:comments>1</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/183.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=183</wfw:commentRss><description>I was recently thinking if I really liked to use the Multiple assignment in 'C#' or if it was less readable. In 'C' this syntax was popular as it tended to lead to smaller and quicker code.&lt;BR&gt;So I wondered in C# if the multiple assigment also lead to quicker code. So I quickly wrote some test cases to see which style of code was quicker to execute...&lt;BR&gt;&lt;BR&gt;I took a rather simplistic model to profile, in order to make the tests more repeatable and easy to follow.&lt;BR&gt;&lt;BR&gt;The .NET code followed the followed the structure:&lt;BR&gt;&lt;CODE&gt;&lt;PRE&gt;[STAThread] static void Main(string[] args) 
            int Count1;
            int  Count2;
            int  Count3;
            int  Count4;
            int  Count5;
            int  Count6;
            int  Count7;
            int  Count8;

            Count1 =
            Count2 =
            Count3 =
            Count4 =
            Count5 =
            Count6 =
            Count7 =
            Count8 = 100;
            
			
            DateTime time = DateTime.Now;
            for (long i = 0; i &amp;lt; 1000000000; i++)
            {
                int  x = 100;
                Count1 = 
                Count2 = 
                Count3 = 
                Count4 = 
                Count5 = 
                Count6 = 
                Count7 = 
                Count8 = x;
            }

            TimeSpan span = DateTime.Now - time;
            Console.WriteLine("Time taken{0}", span.TotalMilliseconds / 1000.0);
} &lt;/PRE&gt;&lt;/CODE&gt;&lt;BR&gt;
&lt;TABLE&gt;

&lt;TR&gt;
&lt;TD&gt;Test&lt;/TD&gt;
&lt;TD&gt;.NET 1.1&lt;BR&gt;Debug Mode&lt;/TD&gt;
&lt;TD&gt;.NET 1.1 &lt;BR&gt;under the debugger&lt;/TD&gt;
&lt;TD&gt;.NET 1.1 &lt;BR&gt;Release Mode&lt;/TD&gt;
&lt;TR&gt;
&lt;TD&gt;Count1=x;Count2=x;.....&lt;/TD&gt;
&lt;TD align=right&gt;7&lt;/TD&gt;
&lt;TD align=right&gt;7&lt;/TD&gt;
&lt;TD align=right&gt;4.5&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Count1=Count2=Count3 ...=x;&lt;/TD&gt;
&lt;TD align=right&gt;9.5&lt;/TD&gt;
&lt;TD align=right&gt;9.5&lt;/TD&gt;
&lt;TD align=right&gt;4.5&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;Results are in seconds&lt;BR&gt;I did test out directly setting the values eg Count1=100; Count2=100; etc as well as using strings. These variations appeared to give similar results. I carried out the same expermiment under .NET 2 and the results were similar just slightly slower in debug mode. &lt;BR&gt;The machine that carried out the tests was an Intel 3.4Ghz P4 running XP SP2 with 1GB RAM.&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;I guess as ever this proves that it is more important to write readable code that requires the minimum of maintanance, rather than trying to outwit the compiler/CLR. &lt;BR&gt;So would I use the multiple assignment? Probably not as much as I used to, but when it leads to easier to read code then yes.&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=183" width="1" height="1"&gt;</description></item><item><title>Adding your own .NET exceptions to Visual Studio</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2006/01/09/112.aspx</link><pubDate>Mon, 09 Jan 2006 19:01:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:112</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/112.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=112</wfw:commentRss><description>You can easily add your own exceptions into Visual Studio so that you do not need to add them in each time into your project when debugging your code.&lt;BR&gt;&lt;BR&gt;I have only checked this against Visual Studio 2003, but it looks like it would works the same in Visual Studio 2000 and Visual Studio 2005. BR&amp;gt;Start up regedit and go to &lt;PRE&gt;&lt;CODE&gt;
My Computer\HKLM\SOFTWARE\Microsoft\VisualStudio\7.1\&lt;BR&gt;   AD7Metrics\Exception\{449EC4CC-30D2-4032-9256-EE18EB41B62B}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then &lt;/P&gt;
&lt;LI&gt;add in the new Folder, eg MyCustomExceptions. 
&lt;LI&gt;Add in two DWORD keys, State and Code. 
&lt;LI&gt;Now add in the new exceptions as folders each with their own keys of State and Code. &lt;BR&gt;Here is an example registry exported file for two exceptions generated by the ANTLR system…&lt;BR&gt;&lt;BR&gt;&lt;PRE&gt;&lt;CODE&gt;
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\AD7Metrics\&lt;BR&gt;    Exception\{449EC4CC-30D2-4032-9256-EE18EB41B62B}\&lt;BR&gt;    Common Language Runtime Exceptions\Antlr]
"Code"=dword:00000000
"State"=dword:0000000c

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\AD7Metrics\&lt;BR&gt;   Exception\{449EC4CC-30D2-4032-9256-EE18EB41B62B}\&lt;BR&gt;   Common Language Runtime Exceptions\Antlr\antlr.MismatchedTokenException]
"Code"=dword:00000000
"State"=dword:0000000c

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.1\AD7Metrics\&lt;BR&gt;   Exception\{449EC4CC-30D2-4032-9256-EE18EB41B62B}\&lt;BR&gt;   Common Language Runtime Exceptions\Antlr\antlr.NoViableAltException]
"Code"=dword:00000000
"State"=dword:0000000c

&lt;/PRE&gt;&lt;/CODE&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;/LI&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=112" width="1" height="1"&gt;</description></item><item><title>Copying File Security Attributes</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2005/12/20/77.aspx</link><pubDate>Tue, 20 Dec 2005 17:49:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:77</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/77.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=77</wfw:commentRss><description>&lt;CODE&gt;&lt;CODE&gt;&lt;SPAN&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman" size=3&gt;Last week I was investigating writing out files and what happens if I over-write an existing file.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman" size=3&gt;I remembered back from my MFC days that CDocument makes up a little internal C++ class called CMirrorFile. This is a very clever class that when overwriting an existing file, it copies the original file to a temporary file, writes out the new file and then deletes the temporary file. (However if the serialization of the data fails then the user has an existing copy of their original file. For more information check out doccore.cpp in the MFC source code.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman" size=3&gt;When developing a .NET version of this code I found that the original MFC code did not work as expected. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman" size=3&gt;The MFC code made two calls to GetFileSecurity. The first to find out how much space is needed to be allocated in order to get the security information. The second call then gets the security information.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman" size=3&gt;Unfortunately the call to GetFileSecurity returned back 0 (Last Error Code was set to 0x7a - The data area passed to a system call is too small). However the resultant length was set correctly.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT face="Times New Roman" size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;FONT face="Times New Roman" size=3&gt;Below is .NET version of how to copy file securities. So far I have only tested this code on XP.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/CODE&gt;&lt;CODE&gt;&lt;CODE&gt;&lt;SPAN&gt;using System;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;PRE&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;using System.Runtime.InteropServices;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;namespace Test&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;using DWORD = System.UInt32;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;using PSECURITY_DESCRIPTOR = System.IntPtr;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;public class Security&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;enum SECURITY_INFORMATION&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;: int&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;DACL_SECURITY_INFORMATION = 4, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[DllImport("advapi32.dll", SetLastError=true)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;[return: MarshalAs(UnmanagedType.Bool)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/library/en-us/%20secauthz/security/getfilesecurity.asp"&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" size=2&gt;static extern bool GetFileSecurity(&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;string lpszUsername,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SECURITY_INFORMATION info,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;PSECURITY_DESCRIPTOR descriptor,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;DWORD val2,&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;out uint length);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[DllImport("advapi32.dll", SetLastError=true)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;[return: MarshalAs(UnmanagedType.Bool)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/library/en-us/%20secauthz/security/setfilesecurity.asp"&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;static extern bool SetFileSecurity(string lpszUsername,&lt;/SPAN&gt;&lt;SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;A href="http://msdn.microsoft.com/library/en-us/%20secauthz/security/setfilesecurity.asp"&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" size=2&gt;SECURITY_INFORMATION info, PSECURITY_DESCRIPTOR descriptor);&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;static public void CopyFileSecurity(string fileName,&lt;BR&gt;                                         string targetFileName)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;uint dwLength = 0;&lt;SPAN&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; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;bool result = GetFileSecurity(fileName, &lt;/SPAN&gt;&lt;/CODE&gt;&lt;BR&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SECURITY_INFORMATION.DACL_SECURITY_INFORMATION,&lt;/SPAN&gt;&lt;/CODE&gt;&lt;BR&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;IntPtr.Zero, 0, out dwLength);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;int lastError = &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemruntimeinteropservicesmarshalclassgetlastwin32errortopic.asp"&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" size=2&gt;Marshal.GetLastWin32Error()&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt; ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;//Console.WriteLine(string.Format("Last Error = {0}", lastError)); &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if ( ( result || lastError == 0x7a) &amp;amp;&amp;amp; dwLength &amp;gt; 0)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;PSECURITY_DESCRIPTOR pSecurityDescriptor = &lt;/SPAN&gt;&lt;/CODE&gt;&lt;BR&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemruntimeinteropservicesmarshalclassallochglobaltopic1.asp"&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" size=2&gt;System.Runtime.InteropServices.Marshal.&lt;BR&gt;          AllocHGlobal((int) dwLength);&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if (GetFileSecurity(fileName,&lt;/SPAN&gt;&lt;/CODE&gt;&lt;BR&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;SECURITY_INFORMATION.DACL_SECURITY_INFORMATION, &lt;/SPAN&gt;&lt;/CODE&gt;&lt;BR&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;pSecurityDescriptor, dwLength, out dwLength))&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;SetFileSecurity(targetFileName,&lt;/SPAN&gt;&lt;/CODE&gt;&lt;BR&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;SECURITY_INFORMATION.DACL_SECURITY_INFORMATION,&lt;/SPAN&gt;&lt;/CODE&gt;&lt;BR&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;pSecurityDescriptor);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemruntimeinteropservicesmarshalclassallochglobaltopic.asp"&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" size=2&gt;System.Runtime.InteropServices.Marshal.FreeHGlobal&lt;BR&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;(pSecurityDescriptor);&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P class=MsoNormal&gt;&lt;CODE&gt;&lt;SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;/CODE&gt;&lt;CODE&gt; &lt;/CODE&gt;&lt;/P&gt;&lt;/PRE&gt;For some more information check out Microsoft Article Q163253 and &lt;A href="http://www.microsoft.com/msj/1197/c1197.aspx"&gt;Paul DiLascia’s article&lt;/A&gt;. &lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=77" width="1" height="1"&gt;</description></item><item><title>Mapping of .NET Assembly attributes to File Version Information Attributes.</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2005/11/30/53.aspx</link><pubDate>Wed, 30 Nov 2005 18:43:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:53</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/53.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=53</wfw:commentRss><description>.NET automatically generates a FileInformation resource when building the assembly. Here is a mapping of the .NET attribute to the corresponding named element in VersionInformation and the name that Windows Explorer puts on its UI. &lt;BR&gt;&lt;BR&gt;
&lt;TABLE&gt;

&lt;TR&gt;
&lt;TD&gt;Assembly Attribute&lt;/TD&gt;
&lt;TD&gt;VersionInfo&lt;/TD&gt;
&lt;TD&gt;Windows Explore name&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;AssemblyTitle&lt;/TD&gt;
&lt;TD&gt;FileDescription&lt;/TD&gt;
&lt;TD&gt;Description&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;AssemblyDescription&lt;/TD&gt;
&lt;TD&gt;Comments&lt;/TD&gt;
&lt;TD&gt;Comments&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;AssemblyConfiguration&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;AssemblyCompany&lt;/TD&gt;
&lt;TD&gt;CompanyName&lt;/TD&gt;
&lt;TD&gt;Company&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;AssemblyCopyright&lt;/TD&gt;
&lt;TD&gt;LegalCopyright&lt;/TD&gt;
&lt;TD&gt;Copyright&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;AssemblyTrademark&lt;/TD&gt;
&lt;TD&gt;LegalTrademarks&lt;/TD&gt;
&lt;TD&gt;Legal Trademarks&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;AssemblyCulture&lt;/TD&gt;
&lt;TD colSpan=2&gt;Makes up Block header.(Typically Language Neutral)&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;AssemblyVersion&lt;/TD&gt;
&lt;TD&gt;&lt;/TD&gt;
&lt;TD&gt;Assembly Version&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;/TD&gt;
&lt;TD&gt;FILEVERSION&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;/TD&gt;
&lt;TD&gt;PRODUCTVERSION&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;/TD&gt;
&lt;TD&gt;FileVersion&lt;/TD&gt;
&lt;TD&gt;File version/File Version&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;/TD&gt;
&lt;TD&gt;ProductVerion&lt;/TD&gt;
&lt;TD&gt;Product Version&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;AssemblyProduct&lt;/TD&gt;
&lt;TD&gt;ProductName&lt;/TD&gt;
&lt;TD&gt;Product Name&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Project/OutputFile&lt;/TD&gt;
&lt;TD&gt;OriginalFilename&lt;/TD&gt;
&lt;TD&gt;InternalName&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=53" width="1" height="1"&gt;</description></item><item><title>Visual Studio &amp; Zoomin.....</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2005/11/24/48.aspx</link><pubDate>Thu, 24 Nov 2005 17:26:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:48</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/48.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=48</wfw:commentRss><description>I used to like the old Zoomin utility that came with Visual Studio 6.... Anyway looks like this little applet is no longer shipped in Visual Studio 2003 or Visual Studio 2005. I have recently come across a replacement utility at &lt;A href="http://www.codeproject.com/tools/betterzoomin.asp"&gt;code project - better zoomin&lt;/A&gt;.&lt;br&gt; 
It does allow you to zoomin a specific part of the screen, and in my opinion is easier to use than the accessibility magnifier. &lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=48" width="1" height="1"&gt;</description></item><item><title>Wild card registering COM dlls</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2005/11/23/39.aspx</link><pubDate>Wed, 23 Nov 2005 19:04:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:39</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/39.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=39</wfw:commentRss><description>When developing a COM based application sometimes it’s sometimes useful to register all the DLLs/OCX at once.&lt;BR&gt;From a command prompt &lt;PRE&gt;&lt;B&gt;C:\develep\project\release\&amp;gt;&lt;/B&gt;for %i in (*.dll,*.ocx) do regsvr32.exe %i /s&lt;/PRE&gt;This will try to register all dll’s even if they are not COM dlls. This is fine as the registration will fail silently.You can change the above command to register COM servers eg &lt;PRE&gt;&lt;B&gt;C:\develep\project\release\&amp;gt;&lt;/B&gt;for %i in (*.exe) do %i -RegServer 
&lt;/PRE&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=39" width="1" height="1"&gt;</description></item><item><title>Debugging Arbitrary thread stacks in .NET</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2005/11/23/36.aspx</link><pubDate>Wed, 23 Nov 2005 15:21:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:36</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/36.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=36</wfw:commentRss><description>Check out &lt;A href="http://msdn.microsoft.com/msdnmag/issues/05/11/bugslayer/default.aspx"&gt;John Robbins November 05 Bugslayer article.&lt;/A&gt;. He has ported his excellent SUPERASSRT code from native C++ into C#. &lt;BR&gt;Part of his solution uses CDB.(a command line version of WinDBG)&lt;BR&gt;I have previously found producing minidump files very useful in tracking down native code problems, so I will be trying out his new C# implementation very soon.&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=36" width="1" height="1"&gt;</description></item><item><title>Explorer and Environment variables</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2005/11/23/34.aspx</link><pubDate>Wed, 23 Nov 2005 15:05:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:34</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/34.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=34</wfw:commentRss><description>&lt;P&gt;You can type environment variables into the the Explorer Address bar and it is expanded into its full path.&lt;BR&gt;Typical examples include:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;

&lt;TR&gt;
&lt;TH align=left&gt;Environment Variable&amp;nbsp;&lt;/TD&gt; 
&lt;TH align=left&gt;Meaning&lt;/TD&gt; 
&lt;TH align=left&gt;Example&lt;/TD&gt;&lt;/TR&gt; 
&lt;TR&gt;
&lt;TD&gt;%TEMP%&lt;/TD&gt;
&lt;TD&gt;Temp directory&lt;/TD&gt;
&lt;TD&gt;C:\TEMP&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;%TMP%&lt;/TD&gt;
&lt;TD&gt;Temp directory&lt;/TD&gt;
&lt;TD&gt;C:\TEMP&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;%USERPROFILE%&lt;/TD&gt;
&lt;TD&gt;Current Profile &lt;/TD&gt;
&lt;TD&gt;C:\Documents and Settings\David Connell&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;%WINDIR%&lt;/TD&gt;
&lt;TD&gt;Windows&amp;nbsp;Directory&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;C:\Windows&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;
&lt;P&gt;You may have some company specific enviroment variables, check it out by going to a command prompt and typing in "SET"&lt;BR&gt;These variables can also be used in a command prompt eg&lt;BR&gt;&lt;/P&gt;&lt;PRE&gt;C:\&amp;gt;MD %USERPROFILE%\TEST&lt;BR&gt;
&lt;/PRE&gt;But be warned when using environment variables on a command line with the TAB key the system always seemed to scan the temporary directory!&lt;BR&gt;Thanks to &lt;a href="http://blogs.red-gate.com/blogs/dana/"&gt;Dan A&lt;/A&gt; for showing me that.&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=34" width="1" height="1"&gt;</description></item><item><title>Always set Warnings as Errors</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2005/11/18/23.aspx</link><pubDate>Fri, 18 Nov 2005 22:08:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:23</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/23.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=23</wfw:commentRss><description>&lt;P&gt;How many of us have developed some code only to find the compiler outputs some warnings such as unused parameter, or unreachable code and just thought “yup, I’ll fix it tomorrow”. Unfortunately tomorrow never comes and the warning just get left in. Before you know it when you build a project there are hundreds of warnings and the new ones just get missed.&lt;BR&gt;&lt;BR&gt;As a result I have found that the only way forward is to set warnings as errors and crank the warning level as high as possible. &lt;/P&gt;
&lt;P&gt;It’s a bit radical however developers must then either fix the warnings or suppress them.(Developers will only suppress warnings when there is no way round and do not suppress warnings unnecessarily.)&lt;/P&gt;
&lt;P&gt;&lt;BR&gt;It maybe a painful road but in the end the builds are always better and easier to understand because there are never any warnings. &lt;/P&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=23" width="1" height="1"&gt;</description></item><item><title>Testing for empty String</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2005/11/18/22.aspx</link><pubDate>Fri, 18 Nov 2005 19:14:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:22</guid><dc:creator>David Connell</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/22.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=22</wfw:commentRss><description>I was speaking with James a few days ago about strings and testing for them being empty, and as usual we had an interesting discussion. At the end of it I thought I better go off and write some test code to find out some real numbers. I investigated three environments. .NET 1.1 .NET 2.0 and MFC7.1. &lt;BR&gt;I took a rather simplistic model to profile, in order to make the tests more repeatable and easy to follow.&lt;BR&gt;&lt;BR&gt;The .NET code followed the followed the structure:&lt;BR&gt;&lt;CODE&gt;&lt;PRE&gt;[STAThread] static void Main(string[] args) 
{ 
    DateTime time = DateTime.Now; 
    string stringVal = ""; 
    for (int nIndex = 0; nIndex &amp;lt; 1000000000; nIndex++) 
    { 
        if (stringVal == string.Empty) 
        { 
        } 
    } 
    double TimeTaken = (DateTime.Now-time).TotalMilliseconds; 
    Console.WriteLine(string.Format("Taken {0}", TimeTaken)); 
} &lt;/PRE&gt;&lt;/CODE&gt;&lt;BR&gt;Yes that’s right the loop is 1 billion. &lt;BR&gt;The results were as follows rounded to the nearest second. (Nb. An empty loop took around 0.5 second). The C++ code was very similar bar using things like CString etc.... &lt;BR&gt;&lt;BR&gt;
&lt;TABLE&gt;

&lt;TR&gt;
&lt;TD&gt;Test&lt;/TD&gt;
&lt;TD&gt;.NET 1.1&lt;/TD&gt;
&lt;TD&gt;.NET 2.0&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;stringVal.Length == 0&lt;/TD&gt;
&lt;TD&gt;7&lt;/TD&gt;
&lt;TD&gt;4&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;stringVal == “”&lt;/TD&gt;
&lt;TD&gt;11&lt;/TD&gt;
&lt;TD&gt;11&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;stringVal == String.Empty&lt;/TD&gt;
&lt;TD&gt;11&lt;/TD&gt;
&lt;TD&gt;17&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;string.IsNullOrEmpty(stringVal)&lt;/TD&gt;
&lt;TD&gt;13.5*&lt;/TD&gt;
&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Test&lt;/TD&gt;
&lt;TD&gt;Native C++/MFC &amp;amp; CString&lt;/TD&gt;
&lt;TD&gt;&lt;/TD&gt;
&lt;TR&gt;
&lt;TD&gt;stringVal.IsEmpty()&lt;/TD&gt;
&lt;TD&gt;17&lt;/TD&gt;
&lt;TD&gt;&lt;/TD&gt;
&lt;TR&gt;
&lt;TD&gt;string.GetLength==0&lt;/TD&gt;
&lt;TD&gt;13&lt;/TD&gt;
&lt;TD&gt;&lt;/TD&gt;
&lt;TR&gt;
&lt;TD&gt;stringVal[0] == ‘\0’&lt;/TD&gt;
&lt;TD&gt;25&lt;/TD&gt;
&lt;TD&gt;&lt;/TD&gt;
&lt;TR&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Test&lt;/TD&gt;
&lt;TD&gt;Native C++/MFC &amp;amp; TCHAR&lt;/TD&gt;
&lt;TD&gt;&lt;/TD&gt;
&lt;TR&gt;
&lt;TD&gt;strVal[0] == ‘\0’&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;BR&gt;(Nb. (*) For the .NET 1.1 IsNullOrEmpty test, I wrote a small class to simulate this function) &lt;BR&gt;The machine that carried out the tests was an Intel 3.4Ghz P4 running XP SP2 with 1GB RAM.&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;This showed me a few things 
&lt;LI&gt;NET performs exceedingly well in comparison to native code&lt;BR&gt;
&lt;LI&gt;Writing easy to read and maintainable code is better than trying to write optimum performing code&lt;BR&gt;
&lt;LI&gt;I would use IsNullOrEmpty(stringVal) because it is the most readable and explicit.&lt;BR&gt;&lt;/LI&gt;&lt;BR&gt;For additional information check out &lt;A href="http://www.gotdotnet.com/team/fxcop/Docs/Rules/Performance/TestForEmptyStringsUsingStringLength.html"&gt;www.gotdotnet.com&lt;/A&gt;. &lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=22" width="1" height="1"&gt;</description></item><item><title>XP SP1/SP2 system DLL's</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2005/11/09/8.aspx</link><pubDate>Wed, 09 Nov 2005 15:44:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:8</guid><dc:creator>James</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/8.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=8</wfw:commentRss><description>&lt;p&gt;Last week&amp;nbsp;I&amp;nbsp;found out that&amp;nbsp;sometimes XP SP1 dlls are labelled as xpsp2. &lt;/p&gt;
&lt;p&gt;A client had DLLs that were labelled xpsp2 for example&lt;/p&gt;
&lt;p&gt;comctl32.dll&amp;nbsp;&amp;nbsp;6.0 (xpsp2.050831-1533) c:\windows\winsxs\&lt;br&gt;x86_microsoft.windows
&lt;br&gt;.common-controls_6595b64144ccf1df_6.0.2600.
&lt;br&gt;1740_x-ww_7cb8ab44\comctl32.dll&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However just because the DLLs are labelled xpsp2 this does not mean
that they are Service Packl 2.Infact they are late XP Service Pack 1
DLLs!&lt;/p&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=8" width="1" height="1"&gt;</description></item><item><title>Common Controls and "invalid window class name"</title><link>http://www.simple-talk.com/community/blogs/davidc/archive/2005/11/09/9.aspx</link><pubDate>Wed, 09 Nov 2005 18:09:00 GMT</pubDate><guid isPermaLink="false">f46e5dea-70cd-4a69-a7e1-fd07a313bd4d:9</guid><dc:creator>James</dc:creator><slash:comments>0</slash:comments><comments>http://www.simple-talk.com/community/blogs/davidc/comments/9.aspx</comments><wfw:commentRss>http://www.simple-talk.com/community/blogs/davidc/commentrss.aspx?PostID=9</wfw:commentRss><description>Last week came across a weird issue. A .NET 1.1 program was throwing up a weird exception when running on XP SP1, with a manifest. (The problem disappeared if the manifest was removed). We were sent the stack trace &lt;BR&gt;&lt;PRE&gt;exception name: System.ComponentModel.Win32Exception
description: Invalid window class name.
handler: user interface
------------------------------ STACK TRACE BEGINS
------------------------------
   at System.Windows.Forms.WindowClass.RegisterClass()
   at System.Windows.Forms.WindowClass.Create(&lt;BR&gt;                                   String className, Int32 classStyle)
   at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
   at System.Windows.Forms.Control.CreateHandle()
   at System.Windows.Forms.ProgressBar.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(&lt;BR&gt;                                             Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(&lt;BR&gt;                                             Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.ScrollableControl.OnVisibleChanged(&lt;BR&gt;                                                    EventArgs e)
   at System.Windows.Forms.Control.OnParentVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.ScrollableControl.OnVisibleChanged(&lt;BR&gt;                                                    EventArgs e)
   at System.Windows.Forms.Form.OnVisibleChanged(EventArgs e)
   at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
   at System.Windows.Forms.Control.set_Visible(Boolean value)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
&lt;/PRE&gt;&lt;BR&gt;This highlighted several issues. Firstly that native windows are only created in .NET when they are needed and not in the constructor or InitializeComponent. Which seems to makes sense given that Windows are a precious resources and should only be created at the last moment, just surprising. The next issue was that it was apparent from the stack trace that the ProgressBar was failing to be created but why? So we dusted down Lutz Roeder’s excellent reflector tool and found out exactly what was going on in RegisterClass. It is as follows &lt;BR&gt;&lt;PRE&gt;&lt;CODE&gt;private void RegisterClass()
{ 
  NativeMethods.WNDCLASS_D wndclass_d1 = new NativeMethods.WNDCLASS_D(); 
  if (NativeWindow.userDefWindowProc == IntPtr.Zero) 
  { 
    string text1 = (Marshal.SystemDefaultCharSize == 1) ? &lt;BR&gt;        "DefWindowProcA" : "DefWindowProcW";
    NativeWindow.userDefWindowProc = 
               UnsafeNativeMethods.GetProcAddress(
                 UnsafeNativeMethods.GetModuleHandle("user32.dll"), 
                 text1); 
    if (NativeWindow.userDefWindowProc == IntPtr.Zero) 
    { 
      throw new Win32Exception(); 
    } 
  } 
  if (this.className == null) 
  { 
      wndclass_d1.hbrBackground = &lt;BR&gt;                           UnsafeNativeMethods.GetStockObject(5); 
      wndclass_d1.style = this.classStyle; 
      this.defWindowProc = NativeWindow.userDefWindowProc; 
      this.windowClassName = "Window." + &lt;BR&gt;                          Convert.ToString(this.classStyle, 0x10); 
      this.hashCode = 0; 
  } 
  else 
  { 
    NativeMethods.WNDCLASS_I wndclass_i1 = &lt;BR&gt;                           new NativeMethods.WNDCLASS_I(); 
    bool flag1 = UnsafeNativeMethods.GetClassInfo(&lt;BR&gt;                           IntPtr.Zero, this.className, wndclass_i1); 
    int num1 = SafeNativeMethods.GetLastError(); 
    if (!flag1) 
    { 
      throw new Win32Exception(num1, SR.GetString("InvalidWndClsName")); 
    } 
    wndclass_d1.style = wndclass_i1.style; 
    wndclass_d1.cbClsExtra = wndclass_i1.cbClsExtra; 
    wndclass_d1.cbWndExtra = wndclass_i1.cbWndExtra; 
    wndclass_d1.hIcon = wndclass_i1.hIcon; 
    wndclass_d1.hCursor = wndclass_i1.hCursor; 
    wndclass_d1.hbrBackground = wndclass_i1.hbrBackground; 
    wndclass_d1.lpszMenuName = &lt;BR&gt;                     Marshal.PtrToStringAuto(wndclass_i1.lpszMenuName); 
    this.defWindowProc = wndclass_i1.lpfnWndProc; 
    this.windowClassName = this.className; 
    this.hashCode = this.className.GetHashCode(); 
  } 
  string[] textArray1 = new string[5] 
  { 
    Application.WindowsFormsVersion, 
      ".", 
      this.windowClassName, 
      ".app", 
      Convert.ToString(AppDomain.CurrentDomain.GetHashCode(), 0x10) 
  } ; 
  this.windowClassName = string.Concat(textArray1); 
  this.windowProc = new NativeMethods.WndProc(this.Callback); 
  wndclass_d1.lpfnWndProc = this.windowProc; 
  wndclass_d1.hInstance = UnsafeNativeMethods.GetModuleHandle(null); 
  wndclass_d1.lpszClassName = this.windowClassName; 
  if (UnsafeNativeMethods.RegisterClass(wndclass_d1) == IntPtr.Zero) 
  { 
    this.windowProc = null; 
    throw new Win32Exception(); 
  } 
  this.registered = true;
} 
&lt;/CODE&gt;&lt;/PRE&gt;After a couple of false starts we realized that the exception was being thrown by the code UnsafeNativeMethods.GetClassInfo. You may be wondering how we were able to get in and find out what was going on? &lt;BR&gt;Well the answer was given by &lt;A href="/community/blogs/dana/default.aspx"&gt;Dan Archer&lt;/A&gt; and he pointed us in the direction of Detours. (Check out &lt;A href="http://research.microsoft.com/sn/detours/"&gt;research.microsoft.com/sn/detours/&lt;/A&gt; for more information. There are some example detours projects on code projects.) &lt;BR&gt;The Detours project effectively allows the developer to log any Win32 API call. &lt;BR&gt;&lt;BR&gt;So we decided to log the following API calls LoadLibraryExW, LoadLibraryExA, LoadLibraryW, LoadLibraryA, FreeLibrary, RegisterClassW, GetClassInfoW, UnregisterClassW. We then asked the customer to re-run the program but with this logging enabled. &lt;BR&gt;We were then sent back the following log (I have sumerized it for ease of reading. Comments are in &lt;SPAN class=cs-comment&gt;different color&lt;/SPAN&gt;.) &lt;PRE&gt;&lt;SPAN class=cs-comment&gt;&lt;FONT color=#006400&gt;Load default DLLs (eg ole32.dll, msvcrt.dll, mscoree.dll, kernel32.dll …) &lt;/FONT&gt;&lt;/SPAN&gt;
&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp"&gt;LoadLibraryExW&lt;/A&gt;(&lt;BR&gt;         C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll,0,8)
 &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp"&gt;LoadLibraryA&lt;/A&gt;(SHLWAPI.dll)
   &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibraryEx.asp"&gt;LoadLibraryExW&lt;/A&gt;(comctl32.dll,0,0)
    &lt;FONT color=#006400&gt;&lt;SPAN class=cs-comment&gt;Register Common Control Window classes&lt;/SPAN&gt;
&lt;/FONT&gt;    &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/windowclassreference/windowclassfunctions/registerclass.asp"&gt;RegisterClassW&lt;/A&gt;(12e58c) Style 4003, menu class msctls_progress32
   &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibraryEx.asp"&gt;LoadLibraryExW&lt;/A&gt;(comctl32.dll,0,0) &lt;SPAN class=cs-comment&gt;&lt;FONT color=#006400&gt;(loaded many times but fine as it &lt;BR&gt;                                  return back Handler to the original)&lt;/FONT&gt;
   Lots of stuff……&lt;/SPAN&gt;
  &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibraryEx.asp"&gt;LoadLibraryExW&lt;/A&gt;(C:\WINDOWS\System32\SQLSRV32.dll,0,8)
   &lt;SPAN class=cs-comment&gt;Load loads of DLLs&lt;/SPAN&gt;
   &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp"&gt;LoadLibraryA&lt;/A&gt;(C:\WINDOWS\System32\COMCTL32.DLL)
    &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp"&gt;LoadLibraryExA&lt;/A&gt;(C:\WINDOWS\System32\COMCTL32.DLL,0,0)
     &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibraryEx.asp"&gt;LoadLibraryExW&lt;/A&gt;(C:\WINDOWS\System32\COMCTL32.DLL,0,0)
      &lt;SPAN class=cs-comment&gt;Gets the windows class of the common controls….&lt;/SPAN&gt;
      GetClassInfoW(77340000,msctls_progress32,12c9b0)
   &lt;SPAN class=cs-comment&gt;&lt;FONT color=#006400&gt;Does some more stuff&lt;/FONT&gt;&lt;/SPAN&gt;
   &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/freelibrary.asp"&gt;FreeLibrary&lt;/A&gt; (C:\WINDOWS\System32\SQLSRV32.dll)
    &lt;SPAN class=cs-comment&gt;&lt;FONT color=#006400&gt;Free all allocated libs&lt;/FONT&gt;&lt;/SPAN&gt;
    &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/freelibrary.asp"&gt;FreeLibrary&lt;/A&gt;(c:\Windows\system32\comctl32.dll) &lt;BR&gt;                                &lt;SPAN class=cs-comment&gt;(&lt;FONT color=#006400&gt;Unregisters all common controls)&lt;/FONT&gt;&lt;/SPAN&gt;
     &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/windowclassreference/windowclassfunctions/getclassinfo.asp"&gt;GetClassInfoW&lt;/A&gt;(77340000,msctls_progress32,12e730)
     &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/windowclassreference/windowclassfunctions/getclassinfo.asp"&gt;GetClassInfoW&lt;/A&gt;(,,) -&amp;gt; c04f Error = 0
    &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/windowclassreference/windowclassfunctions/unregisterclass.asp"&gt;UnregisterClassW&lt;/A&gt;(msctls_progress32,77340000)
&lt;SPAN class=cs-comment&gt;&lt;FONT color=#006400&gt;Program then continued until attempted to display the progress bar&lt;/FONT&gt;&lt;/SPAN&gt;
 &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/windowclassreference/windowclassfunctions/getclassinfo.asp"&gt;GetClassInfoW&lt;/A&gt;(0,msctls_progress32,1074de0)
 &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windowclasses/windowclassreference/windowclassfunctions/getclassinfo.asp"&gt;GetClassInfoW&lt;/A&gt;(,,) -&amp;gt; 0 Error = 1411 &lt;SPAN class=cs-comment&gt;&lt;FONT color=#006400&gt;(class not registered)&lt;/FONT&gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;BR&gt;It was now apparent that SQKSRV32.DLL directly loaded up the old/un-themed common controls dll, which had the nasty side effect of registering and then un-registering the common controls windows classes when the DLL was unloaded. Unfortunately the program had not finished and so it failed when trying to access the common controls for the first time. (This then explained why running without a manifest the program worked correctly.) &lt;BR&gt;We were able to verify that this was the problem by asking the user for their version of MDAC, (which happened to be MDAC 2.8) and then installing it on our test machine. At last we were able to then replicate this user issue. It appears to be XP SP1a/MDAC 2.8 issue. &lt;/SPAN&gt;&lt;img src="http://www.simple-talk.com/community/aggbug.aspx?PostID=9" width="1" height="1"&gt;</description></item></channel></rss>