Fixing the missing symbols problem when debugging 32-bit applications on Windows 64-bit using WinDbg

by APIJunkie 3/22/2008 7:34:00 AM

Last week we were trying to debug legacy 32-bit applications that were misbehaving on Windows 2008 64-bit.

Microsoft's debugging tools for windows information page states the following regarding When to Use 64-bit Debugging Tools.

"The 64-bit versions of Debugging Tools for Windows allow you to debug both 32-bit and 64-bit user-mode applications running on 64-bit processors. Use this package to debug both the application and the WOW64 emulator."

Unfortunately WinDbg 64-bit does not seem work properly on at least some of the 32-bit apps running on windows 2008 64-bit that we have tested.

The problem is that WindDbg does not seem to find the correct symbols for the 32 bit application you try to debug even though WinDbg finds the correct PDB symbol files.

To solve the problem we had to install the 32-bit version of the debugging tools for windows side by side with the 64-bit version (we did not have to uninstall the 64-bit version) and use the 32-bit version to debug the 32-bit applications running on the 64 bit version of windows. 

Note that the version of the debugging tools for windows we used for both 32 and 64 bit debugging was version 6.8.4.0 released on October 18, 2007.
 

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Win32 | PRB | Win64 | Debug

Automatically scrolling an MFC Rich Edit Control(CRichEditCtrl)

by APIJunkie 11/13/2007 9:55:00 PM

Some times it is convenient to use a Rich Edit Control as a scrolling text box. For example when using a Rich edit control as a log output window.

To do this we will need to do 2 things:

1. Make sure the selection in the Rich Edit Control is always visible.

You can change this Rich Edit Control property in both your resource editor and your code.

To do this in the resource editor you will need to set the "No hide selection" property of the Rich Edit Control to "true".

To do this in your code you can call the HideSelection Rich Edit Control member function:

// assuming CRichEditCtrl m_logCtrl; exists ...

 

// Show the selection and make it permanent

m_logCtrl.HideSelection(FALSE,TRUE);

2. Scroll the control to the last line of text by setting the selection to the last character in text.

To do this you can add the following code after updating the text you want to display:

// assuming CRichEditCtrl m_logCtrl; exists ...

long textLen = m_logCtrl.GetTextLength();

// set selection to last character...

m_logCtrl.SetSel(textLen-1,textLen-1);

Currently rated 4.1 by 10 people

  • Currently 4.1/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

MFC | Win32

Handling tree control check box selection/de-selection in Win32/MFC

by APIJunkie 11/11/2007 12:38:00 AM

Unfortunately, no direct notifications are sent when a check box gets selected or deselected in a win32 tree control.

 

While this is a gross oversight by Microsoft in the design of the tree control, there are ways to overcome this problem.

 

One simple way to overcome this problem is to catch the following messages that are sent to the parent window of a tree control:

 

TVN_KEYDOWN -> http://msdn2.microsoft.com/en-us/library/bb773540.aspx

 

NM_CLICK -> http://msdn2.microsoft.com/en-us/library/bb773466.aspx

 

When one of the above messages is sent, the state of the check box, next to the tree item, will be changed.

 

Below is an MFC code snippet that handles the above messages:

 

// CTreeCtrl *m_fileTreeCtrl is a member of CDemoTreeDlg dialog.

// CDemoTreeDlg dialog will handle the TVN_KEYDOWN and NM_CLICK messages

 

BEGIN_MESSAGE_MAP(CDemoTreeDlg, CDialog)

      ON_MESSAGE(TREE_VIEW_CHECK_STATE_CHANGE, OnTreeViewCheckStateChange)

      ON_NOTIFY(NM_CLICK, IDC_FILESYS_TREE, &CDemoTreeDlg::OnNMClickFileSysTree)

      ON_NOTIFY(TVN_KEYDOWN, IDC_FILESYS_TREE, &CDemoTreeDlg::OnTvnKeydownFileSysTree)

END_MESSAGE_MAP()

 

// handle mouse click on check box

void CDemoTreeDlg::OnNMClickFileSysTree(NMHDR *pNMHDR, LRESULT *pResult)

{

      // TODO: Add your control notification handler code here

      HTREEITEM item;

      UINT flags;

      // verify that we have a mouse click in the check box area

      DWORD pos = GetMessagePos();

      CPoint point(LOWORD(pos), HIWORD(pos));

      m_fileTreeCtrl->ScreenToClient(&point);

      item = m_fileTreeCtrl->HitTest(point, &flags);

      if(item && (flags & TVHT_ONITEMSTATEICON))

      {

            // handle state change here or post message to another handler

            // Post message state has changed…

            // PostMessage(TREE_VIEW_CHECK_STATE_CHANGE,0,(LPARAM)item);

      }

      *pResult = 0;

}

 

// handle key press on check box

void CDemoTreeDlg::OnTvnKeydownFileSysTree(NMHDR *pNMHDR, LRESULT *pResult)

{

      LPNMTVKEYDOWN pTVKeyDown = reinterpret_cast<LPNMTVKEYDOWN>(pNMHDR);

      // TODO: Add your control notification handler code here

      // we only want to handle the space key press

      if(pTVKeyDown->wVKey==VK_SPACE)

      {

            // Determine the selected tree item.

            HTREEITEM item = m_fileTreeCtrl->GetSelectedItem();

            if(item!=NULL)

            {

                  // handle state change here or post message to another handler

                  // Post message state has changed…

                  // PostMessage(TREE_VIEW_CHECK_STATE_CHANGE,0,(LPARAM)item);

            }

      }

      *pResult = 0;

}

 

In many cases it is better to handle the check box change in a central place after the change. To do this we can define a custom message that will be called when a check box state has changed:

 

// define a custom message

#define TREE_VIEW_CHECK_STATE_CHANGE (WM_USER + 100)

// implementation for TREE_VIEW_CHECK_STATE_CHANGE message handler

LRESULT CDemoTreeDlg::OnTreeViewCheckStateChange(WPARAM wParam, LPARAM lParam)

{

      // Handle message here…

      HTREEITEM   changedItem = (HTREEITEM)lParam;

      int checkState = m_fileTreeCtrl->GetCheck(changedItem);

      // Do something with check state change information…

}

Currently rated 4.4 by 14 people

  • Currently 4.357143/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

MFC | Win32 | GUI

Powered by BlogEngine.NET 1.2.0.0
Theme by Mads Kristensen

About the author

Name of author

My name is Bacon…James Bacon.

I am an API wars veteran I was wounded by x86 assembly, recovered and moved on to C. Following a long addiction to C++ and a short stint at rehab I decided to switch to a healthier addiction so I am now happily sniffing .NET and getting hooked on Silverlight.

I am mainly here to ramble about coding, various API’s, Junkies(me especially) and everything else that happens between coders and their significant other.

E-mail me Send mail


Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

Sign in