Thursday, September 20, 2012

How to extract msu/msp/msi/exe files from the command line


http://www.windowswiki.info/2009/02/19/how-to-extract-msumspmsiexe-files-from-the-command-line/
I find these commands quite helpful — maybe you know them already — if not, here you go:

Microsoft Hotfix Installer (.exe)

setup.exe /t:C:\<target_dir>\ /c

Microsoft Update Standalone Package (.msu)

expand -F:* update.msu C:\<target_dir>
cd <target_dir>
expand -F:* update.cab C:\<target_dir>

Microsoft Patch File (.msp)

msix patch.msp /out C:\<target_dir>
msix.zip

Windows Installer Package (.msi)

msiexec /a setup.msi /qb TARGETDIR=C:\<target_dir>

Friday, June 1, 2012

WinDBG: How to load specific version of mscordacwks.dll for debugging crash dumps



http://geekswithblogs.net/rupreet/archive/2012/03/12/148966.aspx


To solve this, we need this specific version of the assembly to continue debugging. The minor version of the framework changes whenever Microsoft releases some patches, hot fixes or service packs. Depending on what patch or hot fix is applied on that machine, the version of the assembly will differ.
One of the easy ways to resolve is to copy the mscordacwks.dll from the machine the dump was taken and copy in the “discoverable” folder (path which is part of .sympath).
But there are times when that machine is not available or don’t have access to it or simply you are not able to get your hands on the specific assembly.
This site(http://www.mskbfiles.com/mscorwks.dll.php) details out each and every hotfix/patch with specific framework version number associated to it so that when we need a specific version, we can download the patch and extract the required assemblies.
Once the update/hotfix is downloaded, we extract the required assemblies using the below commands –
c:\ >expand.exe -f:* C:\Windows6.0-KB983589-x64.msu C:\temp
c:\ >expand.exe -f:* C:\temp\Windows6.0-KB983589-x64.cab C:\temp\cab
In the cab folder, the required assembly would be present.
The other way to extract the files is to use Winzip or some compression tool which lets you extract files from *.cab.
Just rename the assembly in mscordacwks_<arch>_<arch>_<version>.dll format and place it in the discoverable path of the debugger (path which is part of .sympath).

Thursday, February 2, 2012

android open contextmenu when click on listview item

package androidTest.app;

import android.app.Activity;
import android.app.ListActivity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class AndroidTestActivity extends Activity implements
OnItemLongClickListener {

       private Activity activity = null;

       private ListView _listview;

       private String _selectedItem;

   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);

       activity = this;

       _listview = (ListView)findViewById(R.id.lvTagValues);

       ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,
               android.R.layout.simple_list_item_1, PENS);
       _listview.setAdapter(arrayAdapter);

       this.registerForContextMenu(_listview);

       _listview.setOnItemLongClickListener(this);

       _listview.setOnItemClickListener(
               new android.widget.AdapterView.OnItemClickListener()
           {
               public void onItemClick(AdapterView<?> arg0, View view,
                               int position, long id) {
                       //Take action here.
                       _selectedItem = (String) _listview.getItemAtPosition(position);
                       activity.openContextMenu(_listview);
                   System.out.println("...context is called");
               }
               }
        );
   }

   @Override
   public void onConfigurationChanged(Configuration newConfig) {
       // TODO Auto-generated method stub

       super.onConfigurationChanged(newConfig);
       System.out.println("...11configuration is changed...");
   }

   static final String[] PENS = new String[]{
       "MONT Blanc",
       "Gucci",
       "Parker",
       "Sailor",
       "Porsche Design",
       "item1",
       "item2",
       "item3",
       "item4",
       "item5",
       "item6",
       "item7",
       "item8",
       "item9",
       "item10",
       "item11"



   };

   @Override
   public void onCreateContextMenu(ContextMenu menu, View v,
           ContextMenuInfo menuInfo) {
       // TODO Auto-generated method stub
       System.out.println("...on create context menu...");
       super.onCreateContextMenu(menu, v, menuInfo);
       menu.setHeaderTitle("Context Menu");
       menu.add(0, v.getId(), 0, "Action 1");
       menu.add(0, v.getId(), 0, "Action 2");
   }

   @Override
   public boolean onContextItemSelected(MenuItem item) {
       if(item.getTitle()=="Action 1"){
               function1(item.getItemId());
               }
       else if(item.getTitle()=="Action 2"){
               function2(item.getItemId());
               }
       else {return false;}
   return true;
   }

   private void function1(int itemID){
       System.out.println("...menu 1 is clicked" + Integer.toString(itemID));

   }

   private void function2(int itemID){
       System.out.println("...menu 2 is clicked" + Integer.toString(itemID));
   }

   public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int arg2,
           long arg3) {
       System.out.println("...on long click close context menu...");
       activity.closeContextMenu();
       // TODO Auto-generated method stub

       return false;
   }
}