Just another site

Category Archives: Microsoft WIndows

Fix broken chm ( compiled HTML file ) files

I’ve had a bunch of docs in *.chm format.
Looked like they were broken on Win 8.

Just figured out that due to some security enhancements the links & authority of the files weer broken.

To enable it:
1. Select the file
2. Right-click select properties
3. Watch out for the Unblock button.
4. Click on it and close the dialog by clicking on the button OK.
5. Launch the file and voila! It works!

C# : Working with .cab (cabinet) files

.NET does not have any classes for creating cabinet files out-of-box, so today I had to look what else is available out there. There are a couple of solutions I found for creating a .cab file from the .NET code. The one that actually worked for me was a library developed by Microsoft(!) as part of their Windows Installer XML (WiX) toolset. This toolset is distributed with a bunch of dlls as part of its SDK. The library that allows to create cabinet files is called Microsoft.Deployment.Compression.Cab and located under <WIX_Installation_Folder>\SDK.

In your project you need to add a reference to the Microsoft.Deployment.Compression.Cab.dll and to Microsoft.Deployment.Compression.dll (located under the same folder and has some base classes for types defined in the Microsoft.Deployment.Compression.Cab).

After doing this you can add files to a cabinet file from .NET with just a couple of line of code:

using Microsoft.Deployment.Compression.Cab;

//create a instance of Microsoft.Deployment.Compression.Cab.CabInfo
//which provides file-based operations on the cabinet file
CabInfo cab = new CabInfo(@”C:\”);

//create a list with files and add them to a cab file
List<string> filesToArchive = new List<string>() { @”C:\file1″, @”C:\file2″ };
cab.PackFiles(null, filesToArchive, null);

//add a folder (including subdirectories) to another cab file with a maximum compression level
cab = new CabInfo(@”C:\”);
cab.Pack(@”C:\folder”, true, Microsoft.Deployment.Compression.CompressionLevel.Max, null);

//unpack a cab file into C:\Unpacked folder

The library has an MSDN style help file located under <WIX_Installation_Folder>\doc\DTFAPI.chm.

Another dll that also comes with WiX toolset SDK is Microsoft.Deployment.Compression.Zip.dll that provides similar functionality for packing and unpacking zip files.


C# : Credentials management on windows 2008

I was looking at options to save credentials on Wnidows platform.The traditional way is registry or DB or filesystem.But then one has to keep an eye on security issues & other headaches that follow.

Then i saw this feature in W2K8 ,”Credentials Manager”. The API for it are in C/C++ , but i needed a solution in C#. So I triaged a bit & came across a solution for the same .

Another one :


Add command prompt shortcut to Windows Explorer

  1. Click on Start=>Run & Open registry using “regedit”.
  2. Navigate to “HKEY_LOCAL_MACHINE/Software/Classes/Folder/Shell”.
  3. Create a Key called “command prompt”.Set the default string to value “CMD Prompt Here”.
  4. Under the key created above,create another key called “command”.Set the default string to “cmd.exe /k pushd %1”.
  5. It takes effect immedialtely try out in the windows explorer.

Enabling menu bar in windows explorer on windows 2008

  1. Open Windows Explorer
  2. Click on “Organize” menu option @ the top left hand corner
  3. Select “Layout” & from the sub-menu select Menu Toolbar

Installing centos on Hyper-V

Makes sure you select Legacy Network Adapter while configuring a network for the host OS.

Also a good blog to install Centos on hyper-v with mouse support