<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Bradleys DasBlog!</title>
  <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/" />
  <link rel="self" href="http://www.bradleysblog.net/Blog/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2010-02-27T09:00:59.6806575-07:00</updated>
  <author>
    <name>Chris Bradley, Andrea Bradley</name>
  </author>
  <subtitle>newtelligence powered</subtitle>
  <id>http://www.bradleysblog.net/Blog/</id>
  <generator uri="http://dasblog.info/" version="2.3.9074.18820">DasBlog</generator>
  <entry>
    <title>AppDomains in Windows Services</title>
    <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/2010/02/27/AppDomainsInWindowsServices.aspx" />
    <id>http://www.bradleysblog.net/Blog/PermaLink,guid,2e167928-3df0-4b4e-9f84-ab3b844956ea.aspx</id>
    <published>2010-02-27T09:00:42.161-07:00</published>
    <updated>2010-02-27T09:00:59.6806575-07:00</updated>
    <category term="Technical" label="Technical" scheme="http://www.bradleysblog.net/Blog/CategoryView,category,Technical.aspx" />
    <author>
      <name>chris.bradley</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I've been meaning to write down something on this for a couple weeks now but have
been having a tough time formulating a nice message on this. The short version is
be very carefull doing this. I believe that somehow AppDomain's rely on something
out of the Windows User Profile, and over time in a Windows Service when you're loading
and unloading AppDomain's stuff MAY get screwed up.
</p>
        <p>
We had a scheduler app which basically used AppDomain's as an isolation mechanism
for controlling when and how each scheduled component was called and then disposed.
Code looked something like this...
</p>
        <p>
for each s as ScheduledComponent in myList<br />
Dim d as new AppDomain<br />
try<br />
dim i as IExecutableInstance = d.CreateInstance("LaunchPad")<br />
i.Execute<br />
finally<br />
AppDomain.Unload(d)<br />
end try<br />
next<br /></p>
        <p>
Over time we'd eventually get into a state where the entire scheduler service which
just cause a windows segmentation fault and shut down. No nice dot net exception or
anything. Like I said, our best guess is that something gets out of sync between the
windows profile and whatever exists in a dot net AppDomain.
</p>
        <p>
Anyway, our solution was to create a wrapper layer which basically called each scheduled
component as a process instead. This seems to be working very reliably ever since.
</p>
        <img width="0" height="0" src="http://www.bradleysblog.net/Blog/aggbug.ashx?id=2e167928-3df0-4b4e-9f84-ab3b844956ea" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Windows 7 / Internet Explorer 8 Javascript</title>
    <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/2010/01/26/Windows7InternetExplorer8Javascript.aspx" />
    <id>http://www.bradleysblog.net/Blog/PermaLink,guid,470370c8-d4fa-48a7-b4df-5298685d68a7.aspx</id>
    <published>2010-01-26T08:39:45.706-07:00</published>
    <updated>2010-01-26T08:40:21.9313316-07:00</updated>
    <category term="Technical" label="Technical" scheme="http://www.bradleysblog.net/Blog/CategoryView,category,Technical.aspx" />
    <author>
      <name>chris.bradley</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
We were having some problems on our development machines at work as soon as we upgraded
to Windows 7 and IE8. The problem first manifested itself as a javascript "client
out of memory" error while using Outlook Web Access (OWA) but it seemed like randomly
we'd have javascript errors while navigating webpages.
</p>
        <p>
Our workaround was to switch over to Google Chrome but then you start finding all
the things that don't work with that so we just wanted to get this figured out.
</p>
        <p>
We ended up working microsoft support on this one and long story short, it looks like
one of our development tools is overwriting one of the IE classes. They had us re-register
a couple classes and now it's working awesome. Here's the registery changes required...
</p>
        <p>
[HKEY_CLASSES_ROOT\Interface\{79EAC9C5-BAF9-11CE-8C82-00AA004BA90B}]<br />
@="IHlinkFrame"<br /><br />
[HKEY_CLASSES_ROOT\Interface\{79EAC9C5-BAF9-11CE-8C82-00AA004BA90B}\NumMethods]<br />
@="8"<br /><br />
[HKEY_CLASSES_ROOT\Interface\{79EAC9C5-BAF9-11CE-8C82-00AA004BA90B}\ProxyStubClsid32]<br />
@="{A4A1A128-768F-41E0-BF75-E4FDDD701CBA}"<br /></p>
        <img width="0" height="0" src="http://www.bradleysblog.net/Blog/aggbug.ashx?id=470370c8-d4fa-48a7-b4df-5298685d68a7" />
      </div>
    </content>
  </entry>
  <entry>
    <title>VMWare - Slow Network Performance</title>
    <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/2009/09/09/VMWareSlowNetworkPerformance.aspx" />
    <id>http://www.bradleysblog.net/Blog/PermaLink,guid,a7eaa710-40b1-4d69-89de-fb75373851c3.aspx</id>
    <published>2009-09-08T21:04:12.427-07:00</published>
    <updated>2009-09-08T21:04:12.42725-07:00</updated>
    <author>
      <name>chris.bradley</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Some days it's amazing the types of things you get involved in... We've been
fighting some network issues on our VMWare box for the last couple monthes. Everything
on the VMWare community kept referencing Tcp Segment Offloading or TsoEnable. After
screwing around with this for a couple hours I got back to an idea someone else at
work had regarding the actual VMWare system configuration.
</p>
        <p>
Turns out the nic cards in VMWare were by default configured to only run at 100 mbps
instead of 1000mbps. You can re-configure these without even turning off the virtual
servers! Good thinking Andy! Here's a screen snap from the vmware management console
and our resulting performance gain.
</p>
        <p>
          <img src="http://www.bradleysblog.net/Blog/content/binary/vmware-nic-config.png" border="0" />
        </p>
        <img src="http://www.bradleysblog.net/Blog/content/binary/vmware-iperf-results.png" border="0" />
        <img width="0" height="0" src="http://www.bradleysblog.net/Blog/aggbug.ashx?id=a7eaa710-40b1-4d69-89de-fb75373851c3" />
      </div>
    </content>
  </entry>
  <entry>
    <title>BindingSource "Object reference not set to an instance of an object"</title>
    <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/2009/08/14/BindingSourceObjectReferenceNotSetToAnInstanceOfAnObject.aspx" />
    <id>http://www.bradleysblog.net/Blog/PermaLink,guid,17ceec3d-04bf-4a83-9505-64242c05ae9b.aspx</id>
    <published>2009-08-14T08:35:42.549-07:00</published>
    <updated>2009-08-14T08:35:42.5496493-07:00</updated>
    <category term="Technical" label="Technical" scheme="http://www.bradleysblog.net/Blog/CategoryView,category,Technical.aspx" />
    <author>
      <name>chris.bradley</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
We've had some problems with the Binding Source component in our Windows Forms development
and I wanted to jot down a note on here in case anyone else comes across this.
</p>
        <p>
The problem we were having was an IDE runtime error which looks like a NullReferenceException,
the specific message says "Object reference not set to an instance of an object".
</p>
        <p>
Apparently this has something to do with the .datasource files that are auto-generated
by visual studio for holding "default" values. You can remove these from the My Project
folder and then the error goes away. Not sure why these are even required since you
can still build without them.
</p>
        <img width="0" height="0" src="http://www.bradleysblog.net/Blog/aggbug.ashx?id=17ceec3d-04bf-4a83-9505-64242c05ae9b" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WebClient.DownloadFile</title>
    <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/2009/07/16/WebClientDownloadFile.aspx" />
    <id>http://www.bradleysblog.net/Blog/PermaLink,guid,7d7395a5-00d1-43b0-8976-9f56616969aa.aspx</id>
    <published>2009-07-16T10:59:23.914-07:00</published>
    <updated>2009-07-16T10:59:42.9293848-07:00</updated>
    <author>
      <name>chris.bradley</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
We've had some problems on our Windows 2008 servers integrating with a third party
web service. The exceptions we got were...
</p>
        <p>
WebException: an unexpected error occured on a send.
</p>
        <p>
IOException: authentication failed because the remote party has closed the transport
stream.
</p>
        <p>
These errors wouldn't occur on Windows 2000 or 2003 boxes but popped up on all our
2008 installs. Turns out security is managed a little differently on 2008 and if the
partner website is really strict with authentication you need to override the authentication
mechanism.
</p>
        <p>
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3
</p>
        <p>
It's only line of code but it's worth understanding the back story a little better.
Here's the blog entry that pointed me in the right direction.
</p>
        <p>
http://blogs.msdn.com/carloc/archive/2007/02/13/webclient-2-0-class-not-working-under-win2000-with-https.aspx
</p>
        <img width="0" height="0" src="http://www.bradleysblog.net/Blog/aggbug.ashx?id=7d7395a5-00d1-43b0-8976-9f56616969aa" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Active Reports Viewer IndexOutOfRangeException</title>
    <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/2009/05/07/ActiveReportsViewerIndexOutOfRangeException.aspx" />
    <id>http://www.bradleysblog.net/Blog/PermaLink,guid,64883720-4895-4c43-a99e-66e98b0e2e3a.aspx</id>
    <published>2009-05-06T19:10:29.355-07:00</published>
    <updated>2009-05-06T19:10:29.3555919-07:00</updated>
    <category term="Technical" label="Technical" scheme="http://www.bradleysblog.net/Blog/CategoryView,category,Technical.aspx" />
    <author>
      <name>chris.bradley</name>
    </author>
    <content type="html">&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 10pt"&gt;
&lt;span lang=EN-US style="mso-ansi-language: EN-US"&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;We’ve
been fighting an intermittent error with our report viewer for the last couple years
that’s been just terrible to track down and I think we finally made some progress
today. We use a reporting tool called Data Dynamics Active Reports to generate our
Screen and Paper reports. Their tool is basically a set of Dot Net assemblies that
allow you to design and code a component called an Active Report.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 10pt"&gt;
&lt;font color=#000000&gt;&lt;span lang=EN-US style="mso-ansi-language: EN-US"&gt;&lt;font face=Calibri size=3&gt;At
runtime, you execute this Active Report and then pass it into another component called
an Active Report Viewer for displaying to the user. We found occasionally our users
would get stuck in an infinite loop of error messages while displaying a report. Exceptions
would pop up looking like this…&lt;br&gt;
&lt;br&gt;
&lt;/font&gt;&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Segoe UI','sans-serif'; mso-ansi-language: EN-US"&gt;(IndexOutOfRangeException)
Index was outside the bounds of the array.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 'Segoe UI','sans-serif'; mso-ansi-language: EN-US"&gt;
&lt;o:p&gt;
&lt;font color=#000000&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/span&gt;&lt;span lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 'Segoe UI','sans-serif'; mso-ansi-language: EN-US"&gt;&lt;font color=#000000&gt;&amp;nbsp;
at DataDynamics.ActiveReports.Viewer.-0011.-3cbd()&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: normal"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 9pt; FONT-FAMILY: 'Segoe UI','sans-serif'; mso-ansi-language: EN-US"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;
at DataDynamics.ActiveReports.Viewer.-dabf.-31a1()&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 10pt"&gt;
&lt;span lang=EN-US style="FONT-SIZE: 9pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Segoe UI','sans-serif'; mso-ansi-language: EN-US"&gt;&lt;font color=#000000&gt;&amp;nbsp;&amp;nbsp;
at DataDynamics.ActiveReports.Viewer.-b212.-afcd()&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 10pt"&gt;
&lt;span lang=EN-US style="mso-bidi-font-family: 'Segoe UI'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;We
could never recreate this on demand, but probably five times a month we would get
a hundred error messages coming in from a client site like this. Eventually the client
would give up pressing “OK” on our error handler, and kill the process.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 10pt"&gt;
&lt;span lang=EN-US style="mso-bidi-font-family: 'Segoe UI'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;When
we’ve tried to troubleshoot this in the past it’s been extremely difficult because
Data Dynamics obfuscates their code so it can’t be decompiled. Obfuscation basically
takes design-time code, and mixes it up so that it’s unreadable, hence the funky function
names above. Unfortunately this gives you no sense of what’s actually happening in
their app.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 10pt"&gt;
&lt;span lang=EN-US style="mso-bidi-font-family: 'Segoe UI'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;font face=Calibri color=#000000 size=3&gt;A
little bit of digging on their support forums today did find a link to a similar issue
by another user - &lt;/font&gt;&lt;a href="http://www.datadynamics.com/forums/85506/ShowPost.aspx"&gt;&lt;font face=Calibri size=3&gt;http://www.datadynamics.com/forums/85506/ShowPost.aspx&lt;/font&gt;&lt;/a&gt;
&lt;o:p&gt;&lt;/o:p&gt;
&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 10pt"&gt;
&lt;span lang=EN-US style="mso-bidi-font-family: 'Segoe UI'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;Basically
what they’d found was that in a Terminal Services environment, their users would click
their “Print” button multiple times – the old adage, keep pressing the button until
something happens. What this causes in some instances is for the second “click” to
get handled by the newly created Active Report Viewer, even though it’s just in the
process of being displayed. Now, if the Viewer is in a funny spot, it can try and
interact with this click event while loading the document – that’s what seems to cause
the issue.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 10pt"&gt;
&lt;span lang=EN-US style="mso-bidi-font-family: 'Segoe UI'; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;font size=3&gt;&lt;font color=#000000&gt;&lt;font face=Calibri&gt;Once
we had a sense of what was causing the issue, it’s pretty simple to disable the ReportViewer
until the report has generated its first page and sure enough this causes the issue
to go away.&lt;o:p&gt;&lt;/o:p&gt;
&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p class=MsoNormal style="MARGIN: 0cm 0cm 10pt"&gt;
&lt;o:p&gt;
&lt;font face=Calibri color=#000000 size=3&gt;&amp;nbsp;&lt;/font&gt;
&lt;/o:p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.bradleysblog.net/Blog/aggbug.ashx?id=64883720-4895-4c43-a99e-66e98b0e2e3a" /&gt;</content>
  </entry>
  <entry>
    <title>Panama Canal Cruise Days 1-5</title>
    <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/2009/04/13/PanamaCanalCruiseDays15.aspx" />
    <id>http://www.bradleysblog.net/Blog/PermaLink,guid,98c5540b-a90b-49fd-bc1a-f9729f15db92.aspx</id>
    <published>2009-04-13T12:59:42.728-07:00</published>
    <updated>2009-04-13T12:59:42.7281982-07:00</updated>
    <author>
      <name>chris.bradley</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Five days after arriving on our cruise ship, I've just discovered how easy it is to
get on the internet. Bad news for Andrea...
</p>
        <p>
We boarded in Fort Lauderdale, and yes, average age on our cruise is around 85. None-the-less,
we've been having a great time.
</p>
        <p>
          <img src="http://www.bradleysblog.net/blog/content/binary/Cruise-Boat-foto.jpg" border="0" />
        </p>
        <p>
Our first port was half moon cay, a bahamian island currently being leased by Holland
America. It's still a little farther north so the water wasn't extremely warm but
I can vouch for the fact that if you forget to put suntan lotion on your legs, you'll
still burn.
</p>
        <p>
          <img src="http://www.bradleysblog.net/blog/content/binary/Cruise-HalfMoon-foto.jpg" border="0" />
        </p>
        <p>
Next stop was Aruba where we went Scuba diving. We dove on an old refining ship and
had a run in with an Eel. Later on our dive master informed us he was once bitten
by one and required 28 stiches.
</p>
        <p>
          <img src="http://www.bradleysblog.net/blog/content/binary/Cruise-Scuba-foto.jpg" border="0" />
        </p>
        <p>
Yesertday we went to Curacao, another less touristy, Dutch island. We did a tour of
the more remote eastern end of the island and got some good shots of the very colorful
capital - Willamstad.
</p>
        <p>
          <img src="http://www.bradleysblog.net/blog/content/binary/Cruise-Curacao-foto.jpg" border="0" />
        </p>
        <p>
          <img src="http://www.bradleysblog.net/blog/content/binary/Cruise-CuracaoCity-foto.jpg" border="0" />
        </p>
        <p>
We're at sea now and we should hit the Panama canal early tommorow morning.
</p>
        <img width="0" height="0" src="http://www.bradleysblog.net/Blog/aggbug.ashx?id=98c5540b-a90b-49fd-bc1a-f9729f15db92" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Source Code Version Control</title>
    <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/2009/03/24/SourceCodeVersionControl.aspx" />
    <id>http://www.bradleysblog.net/Blog/PermaLink,guid,4aeafaea-cf19-45b1-88fa-e18e79c39cbf.aspx</id>
    <published>2009-03-23T22:53:54.925-07:00</published>
    <updated>2009-03-23T22:53:54.9250669-07:00</updated>
    <category term="Technical" label="Technical" scheme="http://www.bradleysblog.net/Blog/CategoryView,category,Technical.aspx" />
    <author>
      <name>chris.bradley</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt">
          <font face="Calibri" color="#000000" size="3">One area of concern that I come up against
quite often is the issue of source code version control. At its most basic layer this
is nothing more than being able to control what a version of your software consists
of... version A versus version B, that sort of thing. This model works great and is
well documented on smaller isolated applications but tends to blur a little when working
with larger systems. Specifically we’ve had issues managing system dependencies, as
well as change requirements on a larger application consisting of about roughly 50
assemblies. I’ll spend just a few minutes here putting pen to paper on how we’ve structured
our development tree to accommodate this.</font>
        </p>
        <p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt">
          <font face="Calibri" color="#000000" size="3">We’ll start at a pretty simple level;
each major release is placed in a named folder based on the version name. Our first
branch within that folder is named Major.Minor.Zero, Major and Minor are related to
the version name while the Zero indicated this is the opening development branch.
Here’s how that looks when we start a new major release... our friendly version name
is Jupiler and the Major.Minor associated with this is 5.1.</font>
        </p>
        <p>
        </p>
        <p>
          <img src="http://www.bradleysblog.net/blog/content/binary/SVC1.JPG" border="0" />
        </p>
        <p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt">
          <font face="Calibri" color="#000000" size="3">Notice that within the 5.1.0 folder
we have a number of sub-folders. These are what we call modules and basically relate
to a VS.Net solution; each one consists of roughly 5-6 projects and can be thought
of as a sub-system. These sub-systems collaborate to provide our applications functionality. </font>
        </p>
        <p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt">
          <font size="3">
            <font color="#000000">
              <font face="Calibri">Now, when we release our
major version, Jupiler, we’ll typically LOCK the 5.1.0 folder so that no further changes
can be made. This code is set in stone and we want to force all new changes to be
done in an isolated environment until they’re tested and ready to go. Invariable though,
something critical comes up during rollout and we need to make code changes to address
those concerns. When this situation arises we BRANCH into a new folder called Major.Minor.One.
This code folder consists of all the new development changes required to add what
we call a Service Pack to the release. Here’s how this looks. <span style="mso-spacerun: yes"> </span></font>
            </font>
          </font>
        </p>
        <p>
          <img src="http://www.bradleysblog.net/blog/content/binary/SVC2.JPG" border="0" />
        </p>
        <p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt">
          <font face="Calibri" color="#000000" size="3">One interesting aspect of this layout
is that we only branch the modules that require changes. These Service Pack’s generally
don’t require a lot of wholesale change; they`re usually small isolated bugs/features
which can be addressed in a single module. You can see in the above diagram that our
5.1.1 only has changes for Accounting, all the other modules are identical to how
they were developed in 5.1.0. This gives us a few key benefits.</font>
        </p>
        <p class="MsoListParagraphCxSpFirst" style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1">
          <font color="#000000">
            <span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin">
              <span style="mso-list: Ignore">
                <font face="Calibri" size="3">1.</font>
                <span style="FONT: 7pt 'Times New Roman'">       </span>
              </span>
            </span>
            <font face="Calibri" size="3">It
limits the amount of open source code.</font>
          </font>
        </p>
        <p class="MsoListParagraphCxSpMiddle" style="MARGIN: 0cm 0cm 0pt 36pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1">
          <font color="#000000">
            <span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin">
              <span style="mso-list: Ignore">
                <font face="Calibri" size="3">2.</font>
                <span style="FONT: 7pt 'Times New Roman'">       </span>
              </span>
            </span>
            <font face="Calibri" size="3">It
makes it easier to identify what code is actively being changed for a service pack.</font>
          </font>
        </p>
        <p class="MsoListParagraphCxSpLast" style="MARGIN: 0cm 0cm 10pt 36pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo1">
          <font color="#000000">
            <span style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin">
              <span style="mso-list: Ignore">
                <font face="Calibri" size="3">3.</font>
                <span style="FONT: 7pt 'Times New Roman'">       </span>
              </span>
            </span>
            <font face="Calibri" size="3">It
leaves the original branch open so that it can be reviewed/modified for OTHER unanticipated
issues.</font>
          </font>
        </p>
        <p class="MsoNormal" style="MARGIN: 0cm 0cm 10pt">
          <font face="Calibri" color="#000000" size="3">Final rollout of the new changes is
done by releasing 5.1.1 of Accounting with all the previous versions of the other
modules.</font>
        </p>
        <img width="0" height="0" src="http://www.bradleysblog.net/Blog/aggbug.ashx?id=4aeafaea-cf19-45b1-88fa-e18e79c39cbf" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Congratulations, you've installed dasBlog with Web Deploy!</title>
    <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/2009/03/11/CongratulationsYouveInstalledDasBlogWithWebDeploy.aspx" />
    <id>http://www.bradleysblog.net/Blog/PermaLink,guid,b705c37b-b47f-4e8d-8f8b-091efc4cb684.aspx</id>
    <published>2009-03-11T00:00:00-07:00</published>
    <updated>2009-03-11T23:10:18.9161264-07:00</updated>
    <category term="dasBlog" label="dasBlog" scheme="http://www.bradleysblog.net/Blog/CategoryView,category,dasBlog.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
After <a href="Login.aspx">logging in</a>, be sure to visit all the options under <a href="EditConfig.aspx">Configuration</a> in
the Admin Menu Bar above. There are <a href="http://dasblog.info/ThemeScreenShots.aspx">26
themes to choose from</a>, and you can also <a href="http://dasblog.info/ThemesAndMacros.aspx">create
your own</a>.
</p>
        <p>
        </p>
        <img width="0" height="0" src="http://www.bradleysblog.net/Blog/aggbug.ashx?id=b705c37b-b47f-4e8d-8f8b-091efc4cb684" />
      </div>
    </content>
  </entry>
  <entry>
    <title>MSTSC Username/Password</title>
    <link rel="alternate" type="text/html" href="http://www.bradleysblog.net/Blog/2009/03/06/MSTSCUsernamePassword.aspx" />
    <id>http://www.bradleysblog.net/Blog/PermaLink,guid,9b6bb97b-15d8-4959-a658-a7b5b3f8b88b.aspx</id>
    <published>2009-03-06T14:50:17.913-07:00</published>
    <updated>2009-03-06T14:50:17.9138645-07:00</updated>
    <category term="Technical" label="Technical" scheme="http://www.bradleysblog.net/Blog/CategoryView,category,Technical.aspx" />
    <author>
      <name>chris.bradley</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Not that this is necessarily a good idea. But after way too much time googling this,
I think I'll clear up the fact that it IS possible call the Microsoft RDP client with
a username and password parameter.
</p>
        <p>
Now, everyone out there will say, yeah - we know that. You key in the username and
password and if you check off the "remember credentials" checkbox it will store that
data.
</p>
        <p>
Well the trick is that this data is stored in a place that's not easily accessed -Windows
Stored UserNames and Passwords. This area is basically a secured area of windows where
passwords are stored for remote connections. You can access this by going Control
Panel\User Accounts\Manager your network passwords. Here's a screen snap.
</p>
        <p>
          <img src="http://www.bradleysblog.net/blog/content/binary/blog-stored%20passwords.JPG" border="0" />
        </p>
        <p>
Our management infrastructure tracks this username and password in a seperate secured
database, and then when we call MSTSC.exe from our software we want to pass this information.
Now, a little more information on how you can pass parameters to MSTSC is in order.
When you call MSTSC you can pass as a parameter a .RDP file which contains information
about how you want to connect to the remote computer. Same idea as every other document
type in Windows, a .RDP file is associated with MSTSC and is used to contain information
for that application. Fortunately the .RDP files are basically key value pairs. Check
it out...
</p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font color="#0000ff">screen
mode id:i:1<br />
desktopwidth:i:1024<br />
desktopheight:i:768<br />
session bpp:i:16<br />
winposstr:s:0,1,526,61,1566,865<br />
full address:s:SomeIpAddress<br />
compression:i:1<br />
keyboardhook:i:2<br />
audiomode:i:0<br />
redirectdrives:i:0<br />
redirectprinters:i:1<br />
redirectcomports:i:0<br />
redirectsmartcards:i:1<br />
displayconnectionbar:i:0<br />
autoreconnection enabled:i:1<br />
alternate <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">shell</span>:s:<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">shell</span> working
directory:s:<br />
disable wallpaper:i:0<br />
disable full window drag:i:1<br />
disable menu anims:i:1<br />
disable themes:i:0<br />
disable cursor setting:i:0<br />
bitmapcachepersistenable:i:1<br />
allow desktop composition:i:1<br />
allow font smoothing:i:0<br />
redirectclipboard:i:1<br />
redirectposdevices:i:0<br />
authentication level:i:2<br />
prompt <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">for</span> credentials:i:0<br />
negotiate security layer:i:1<br />
remoteapplicationmode:i:0<br />
gatewayhostname:s:<br />
gatewayusagemethod:i:4<br />
gatewaycredentialssource:i:4<br />
gatewayprofileusagemethod:i:0<br />
promptcredentialonce:i:1<br />
drivestoredirect:s:</font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana" size="2">The
imporant pieces here is the "full address" line... this points to the server we're
connecting to.</font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana" size="2">Well...
it turns out you can also pass parameters for domain, username, and password. You
just need to add them to the bottom of your .rdp file like this</font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font color="#0000ff">domain:s:MyDomain<br />
username:s:MyUserName<br />
password 51:b:MyPassword</font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana" size="2">But
wait a second, saving a password in plain text in a .rdp file sounds like just about
the worst security hole you could use! And you're right - you can't actually pass
the password parameter as straight text. It needs to be encrypted binary. </font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana" size="2">(As
an aside, that's what the second part of these key/value pairs is... the s, or b,
or i character. That indicates whether the data is String, Binary or Integer).</font>
          </span>
        </p>
        <p>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <font face="Verdana" size="2">Well
it turns out that taking a straight text password and encrypting it ain't too bad.
I'm not going to take credit for this code but the following vb dot net code uses
the windows api to do just that.</font>
          </span>
        </p>
        <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
          <p>
            <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Imports</span> System<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Imports</span> System.Text<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Imports</span> System.Runtime.InteropServices<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Imports</span> System.ComponentModel<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Imports</span> Microsoft.VisualBasic<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Class</span> DPAPI<br />
&lt;DllImport(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Crypt32.dll"</span>,
SetLastError:=<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">True</span>,
CharSet:=System.Runtime.InteropServices.CharSet.<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Auto</span>)&gt; <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Shared</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Function</span> CryptProtectData(
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> pPlainText <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DATA_BLOB,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> szDescription <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> pEntropy <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DATA_BLOB,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> pReserved <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> IntPtr,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> pPrompt <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> CRYPTPROTECT_PROMPTSTRUCT,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> dwFlags <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Integer</span>,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> pCipherText <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DATA_BLOB
_<br />
) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Boolean</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Function</span><br /><br />
&lt;DllImport(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Crypt32.dll"</span>,
SetLastError:=<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">True</span>,
CharSet:=System.Runtime.InteropServices.CharSet.<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Auto</span>)&gt;
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Shared</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Function</span> CryptUnprotectData(
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> pCipherText <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DATA_BLOB,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> pszDescription <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> pEntropy <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DATA_BLOB,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> pReserved <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> IntPtr,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> pPrompt <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> CRYPTPROTECT_PROMPTSTRUCT,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> dwFlags <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Integer</span>,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> pPlainText <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DATA_BLOB
_<br />
) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Boolean</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Function</span><br /><br />
&lt;StructLayout(LayoutKind.Sequential, CharSet:=CharSet.<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Unicode</span>)&gt;
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Friend</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Structure</span> DATA_BLOB<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span> cbData <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Integer</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span> pbData <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> IntPtr<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Structure</span><br /><br />
&lt;StructLayout(LayoutKind.Sequential, CharSet:=CharSet.<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Unicode</span>)&gt;
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Friend</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Structure</span> CRYPTPROTECT_PROMPTSTRUCT<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span> cbSize <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Integer</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span> dwPromptFlags <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Integer</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span> hwndApp <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> IntPtr<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span> szPrompt <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Structure</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Const</span> CRYPTPROTECT_UI_FORBIDDEN <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Integer</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 1<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Const</span> CRYPTPROTECT_LOCAL_MACHINE <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Integer</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 4<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Shared</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Sub</span> InitPrompt
_<br />
( _<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> ps <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> CRYPTPROTECT_PROMPTSTRUCT
_<br />
)<br />
ps.cbSize <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Marshal.SizeOf(<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">GetType</span>(CRYPTPROTECT_PROMPTSTRUCT))<br />
ps.dwPromptFlags <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 0<br />
ps.hwndApp <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> IntPtr.Zero<br />
ps.szPrompt <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Nothing</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Sub</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Shared</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Sub</span> InitBLOB
_<br />
( _<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> data <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Byte</span>(),
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByRef</span> blob <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DATA_BLOB
_<br />
)<br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'
Use empty array for null parameter.</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> data <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Is</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Nothing</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br />
data <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Byte</span>(0)
{}<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'
Allocate memory for the BLOB data.</span><br />
blob.pbData <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Marshal.AllocHGlobal(data.Length)<br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'
Make sure that memory allocation was successful.</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> blob.pbData.Equals(IntPtr.Zero) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> Exception(
_<br /><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Unable
to allocate data buffer for BLOB structure."</span>)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">'
Specify number of bytes in the BLOB.</span><br />
blob.cbData <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> data.Length<br />
Marshal.Copy(data, 0, blob.pbData, data.Length)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Sub</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Enum</span> KeyType<br />
UserKey <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 1<br />
MachineKey<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Enum</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Private</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Shared</span> defaultKeyType <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> KeyType <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> KeyType.UserKey<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Shared</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Function</span> Encrypt
_<br />
( _<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> keyType <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> KeyType,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> plainText <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> entropy <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">description</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span> _<br />
) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> plainText <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Is</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Nothing</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br />
plainText <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>.Empty<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> entropy <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Is</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Nothing</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br />
entropy <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>.Empty<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> result <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Byte</span>()<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> encrypted <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">""</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> i <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Integer</span><br />
result <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Encrypt(keyType,
_<br />
Encoding.<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Unicode</span>.GetBytes(plainText),
_<br />
Encoding.<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Unicode</span>.GetBytes(entropy),
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">description</span>)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">For</span> i <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> 0 <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">To</span> result.Length <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">-</span> 1<br />
encrypted <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> encrypted
&amp; Convert.ToString(result(i), 16).PadLeft(2, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"0"</span>).ToUpper()<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Next</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Return</span> encrypted.ToString()<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Function</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Shared</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Function</span> Encrypt
_<br />
( _<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> keyType <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> KeyType,
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> plainTextBytes <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Byte</span>(),
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> entropyBytes <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Byte</span>(),
_<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">description</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span> _<br />
) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Byte</span>()<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> plainTextBytes <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Is</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Nothing</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br />
plainTextBytes <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Byte</span>(0)
{}<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> entropyBytes <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Is</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Nothing</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br />
entropyBytes <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Byte</span>(0)
{}<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">description</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Is</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Nothing</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">description</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>.Empty<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> plainTextBlob <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DATA_BLOB <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> DATA_BLOB<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> cipherTextBlob <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DATA_BLOB <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> DATA_BLOB<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> entropyBlob <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> DATA_BLOB <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> DATA_BLOB<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> prompt <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> _<br />
CRYPTPROTECT_PROMPTSTRUCT <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> CRYPTPROTECT_PROMPTSTRUCT<br />
InitPrompt(prompt)<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Try</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Try</span><br />
InitBLOB(plainTextBytes, plainTextBlob)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Catch</span> ex <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> Exception<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> Exception(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Cannot
initialize plaintext BLOB."</span>, ex)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Try</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Try</span><br />
InitBLOB(entropyBytes, entropyBlob)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Catch</span> ex <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> Exception<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> Exception(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Cannot
initialize entropy BLOB."</span>, ex)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Try</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> flags <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Integer</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> CRYPTPROTECT_UI_FORBIDDEN<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> keyType <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> keyType.MachineKey <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br />
flags <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> flags <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Or</span> (CRYPTPROTECT_LOCAL_MACHINE)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> success <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Boolean</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> CryptProtectData(
_<br />
plainTextBlob, _<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">description</span>,
_<br />
entropyBlob, _<br />
IntPtr.Zero, _<br />
prompt, _<br />
flags, _<br />
cipherTextBlob)<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Not</span> success <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> errCode <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Integer</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Marshal.GetLastWin32Error()<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> Exception(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"CryptProtectData
failed."</span>, _<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> Win32Exception(errCode))<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> cipherTextBytes(cipherTextBlob.cbData) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Byte</span><br /><br />
Marshal.Copy(cipherTextBlob.pbData, cipherTextBytes, 0, _<br />
cipherTextBlob.cbData)<br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Return</span> cipherTextBytes<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Catch</span> ex <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> Exception<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Throw</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> Exception(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"DPAPI
was unable to encrypt data."</span>, ex)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Finally</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Not</span> (plainTextBlob.pbData.Equals(IntPtr.Zero)) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br />
Marshal.FreeHGlobal(plainTextBlob.pbData)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Not</span> (cipherTextBlob.pbData.Equals(IntPtr.Zero)) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br />
Marshal.FreeHGlobal(cipherTextBlob.pbData)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Not</span> (entropyBlob.pbData.Equals(IntPtr.Zero)) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><br />
Marshal.FreeHGlobal(entropyBlob.pbData)<br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Try</span><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Function</span><br /><br /><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Class</span></span>
          </p>
          <br />
          <font face="Verdana" color="#000000" size="2">Then in our .RDP file generator we just
call out to our dot net encryptor like this.</font>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
              <font size="2">
                <p>
                  <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">DPAPI.Encrypt(DPAPI.KeyType.MachineKey,
"MyPassword", <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Nothing</span>, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"psw"</span>)</span>
                </p>
                <p>
                  <font face="Verdana" color="#000000">Now, this is worth stressing again that exposing
passwords for RDP clients can be a very dangerous idea. Someone can grab ahold of
those and cause all sorts of havoc so your management of these security tools needs
to be very well understood. Storage, access, and management of this data is one of
the most critical components of your security strategy and anytime your exposing this
information you need to be aware of the ramifications of that action.</font>
                </p>
              </font>
            </span>
          </span>
        </span>
        <img width="0" height="0" src="http://www.bradleysblog.net/Blog/aggbug.ashx?id=9b6bb97b-15d8-4959-a658-a7b5b3f8b88b" />
      </div>
    </content>
  </entry>
</feed>