Share
 

What do we mean by intrinsic?

Most functions are contained in libraries, but some functions are built in (that is, intrinsic) to the compiler. These are referred to as intrinsic functions or intrinsics.

Taken from MSDN…

The __noop intrinsic specifies that a function should be ignored and the argument list be parsed but no code be generated for the arguments. It is intended for use in global debug functions that take a variable number of arguments.

The compiler converts the __noop intrinsic to 0 at compile time. The following code shows how you could use __noop.
 

// compiler_intrinsics__noop.cpp
// compile with or without /DDEBUG
#include <stdio.h>

#if DEBUG
   #define PRINT   printf_s
#else
   #define PRINT   __noop
#endif

int main()
{
   PRINT("\nhello\n");
}

So if you have custom macros which should expand to nought in release version the proper way to do this would be via __noop. Remember this is Microsoft(R) specific.

Share
 

You have a managed application crash dump and you would like to load sos.dll, to use the powerful commands it provides to help with managed debugging, but the load of sos.dll always fails. The command that you are executing for loading sos.dll is…

0:015> .loadby sos clr
Unable to find module ‘clr’

On enter you see the above error and you are not sure what is going on. So in order to understand the error message it is important to understand what .loadby command does.

“.loadby sos clr” means load sos.dll from where clr.dll is loaded. So as you might have guessed by now if clr.dll is not loaded then sos.dll cannot be found. This is what the error means when it says “Unable to find module ‘clr’”. All it means is clr.dll is not in the loaded module list which means there is no path to locate clr.dll.

So how can I fix this error? In order to fix this error you must understand that clr.dll has been introduced into .net applications from .net 4.0 and prior to that we used to have mscorwks.dll. So if your .net application is not a 4.0 app then clr.dll won’t be loaded, yes you will have to use mscorwks.dll instead…

0:015> .loadby sos mscorwks

But you are damn sure that the application that crashed is a .net 4.0 application but you still see the error! All I can say is clr.dll is not loaded. Wait for it to load or break on its load and then execute .loadby sos clr.

So how to break on a module load…
0:015> sxe ld clr

This will for sure help!

Share
 

Did you ever want to know how a C++ class was laid out by VC++ compiler? There are few hidden switches which are not known to many hence would like to share those with my blog readers.

So I will blog about these switches one by one. So for today the switch I’m going to discuss is: /d1reportSingleClassLayoutSomeType. SomeType in the name is just a placeholder for actual class name.

So for a demo we know that there is a class called CDialog in MFC. So create a sample MFC project and add the following command line manually to the project’s settings. Goto C/C++->CommandLine->Additional Options and enter /d1reportSingleClassLayoutCDialog manually into the additional options edit control, as shown in the screenshot below…

MFC Project Properties

Once you are done rebuild your project. When I rebuild this is what I see in my output window. You will see the structure of CDialog laid out in the output window. Please know that CDialog is a huge class with several virtual functions hence the output is pretty long.

1>------ Rebuild All started: Project: MFCTest, Configuration: Debug Win32 ------
1>  stdafx.cpp
1>  class CDialog size(148):
1>   +---
1>   | +--- (base class CWnd)
1>   | | +--- (base class CCmdTarget)
1>   | | | +--- (base class CObject)
1>   0 | | | | {vfptr}
1>   | | | +---
1>   4 | | | m_dwRef
1>   8 | | | m_pOuterUnknown
1>  12 | | | m_xInnerUnknown
1>  16 | | | XDispatch m_xDispatch
1>  20 | | | m_bResultExpected
1>  24 | | | XConnPtContainer m_xConnPtContainer
1>  28 | | | m_pModuleState
1>   | | +---
1>  32 | | m_hWnd
1>  36 | | m_bEnableActiveAccessibility
1>     | | <alignment member> (size=3)
1>  40 | | m_pStdObject
1>  44 | | m_pProxy
1>  48 | | XAccessible m_xAccessible
1>  52 | | XAccessibleServer m_xAccessibleServer
1>  56 | | m_bIsTouchWindowRegistered
1>  60 | | CPoint m_ptGestureFrom
1>  68 | | m_ulGestureArg
1>  76 | | m_bGestureInited
1>  80 | | m_pCurrentGestureInfo
1>  84 | | m_hWndOwner
1>  88 | | m_nFlags
1>  92 | | m_pfnSuper
1>  96 | | m_nModalResult
1>  100 | | m_pDropTarget
1>  104 | | m_pCtrlCont
1>  108 | | m_pCtrlSite
1>  112 | | m_pMFCCtrlContainer
1>   | +---
1>  116 | m_nIDHelp
1>  120 | m_lpszTemplateName
1>  124 | m_hDialogTemplate
1>  128 | m_lpDialogTemplate
1>  132 | m_lpDialogInit
1>  136 | m_pParentWnd
1>  140 | m_hWndTop
1>  144 | m_pOccDialogInfo
1>   +---
1> 
1>  CDialog::$vftable@:
1>   | &CDialog_meta
1>   |  0
1>   0 | &CDialog::GetRuntimeClass
1>   1 | &CDialog::{dtor}
1>   2 | &CObject::Serialize
1>   3 | &CDialog::AssertValid
1>   4 | &CDialog::Dump
1>   5 | &CDialog::OnCmdMsg
1>   6 | &CWnd::OnFinalRelease
1>   7 | &CCmdTarget::IsInvokeAllowed
1>   8 | &CCmdTarget::GetDispatchIID
1>   9 | &CCmdTarget::GetTypeInfoCount
1>  10 | &CCmdTarget::GetTypeLibCache
1>  11 | &CCmdTarget::GetTypeLib
1>  12 | &CDialog::GetMessageMap
1>  13 | &CCmdTarget::GetCommandMap
1>  14 | &CCmdTarget::GetDispatchMap
1>  15 | &CCmdTarget::GetConnectionMap
1>  16 | &CWnd::GetInterfaceMap
1>  17 | &CCmdTarget::GetEventSinkMap
1>  18 | &CCmdTarget::OnCreateAggregates
1>  19 | &CCmdTarget::GetInterfaceHook
1>  20 | &CCmdTarget::GetExtraConnectionPoints
1>  21 | &CCmdTarget::GetConnectionHook
1>  22 | &CWnd::PreSubclassWindow
1>  23 | &CWnd::Create
1>  24 | &CWnd::CreateEx
1>  25 | &CWnd::CreateEx
1>  26 | &CWnd::DestroyWindow
1>  27 | &CWnd::PreCreateWindow
1>  28 | &CWnd::CalcWindowRect
1>  29 | &CWnd::GetMenu
1>  30 | &CWnd::SetMenu
1>  31 | &CWnd::OnToolHitTest
1>  32 | &CWnd::GetScrollBarCtrl
1>  33 | &CWnd::WinHelpW
1>  34 | &CWnd::HtmlHelpW
1>  35 | &CWnd::WinHelpInternal
1>  36 | &CWnd::ContinueModal
1>  37 | &CWnd::EndModalLoop
1>  38 | &CWnd::OnDrawIconicThumbnailOrLivePreview
1>  39 | &CWnd::EnsureStdObj
1>  40 | &CWnd::get_accParent
1>  41 | &CWnd::get_accChildCount
1>  42 | &CWnd::get_accChild
1>  43 | &CWnd::get_accName
1>  44 | &CWnd::get_accValue
1>  45 | &CWnd::get_accDescription
1>  46 | &CWnd::get_accRole
1>  47 | &CWnd::get_accState
1>  48 | &CWnd::get_accHelp
1>  49 | &CWnd::get_accHelpTopic
1>  50 | &CWnd::get_accKeyboardShortcut
1>  51 | &CWnd::get_accFocus
1>  52 | &CWnd::get_accSelection
1>  53 | &CWnd::get_accDefaultAction
1>  54 | &CWnd::accSelect
1>  55 | &CWnd::accLocation
1>  56 | &CWnd::accNavigate
1>  57 | &CWnd::accHitTest
1>  58 | &CWnd::accDoDefaultAction
1>  59 | &CWnd::put_accName
1>  60 | &CWnd::put_accValue
1>  61 | &CWnd::SetProxy
1>  62 | &CWnd::CreateAccessibleProxy
1>  63 | &CWnd::OnCommand
1>  64 | &CWnd::OnNotify
1>  65 | &CWnd::GetSuperWndProcAddr
1>  66 | &CWnd::DoDataExchange
1>  67 | &CWnd::BeginModalState
1>  68 | &CWnd::EndModalState
1>  69 | &CDialog::PreTranslateMessage
1>  70 | &CWnd::OnAmbientProperty
1>  71 | &CWnd::WindowProc
1>  72 | &CWnd::OnWndMsg
1>  73 | &CWnd::DefWindowProcW
1>  74 | &CWnd::PostNcDestroy
1>  75 | &CWnd::OnChildNotify
1>  76 | &CWnd::OnTouchInputs
1>  77 | &CWnd::OnTouchInput
1>  78 | &CWnd::GetGestureStatus
1>  79 | &CWnd::OnGestureZoom
1>  80 | &CWnd::OnGesturePan
1>  81 | &CWnd::OnGestureRotate
1>  82 | &CWnd::OnGestureTwoFingerTap
1>  83 | &CWnd::OnGesturePressAndTap
1>  84 | &CDialog::CheckAutoCenter
1>  85 | &CWnd::IsFrameWnd
1>  86 | &CWnd::CreateControlContainer
1>  87 | &CWnd::CreateControlSite
1>  88 | &CDialog::SetOccDialogInfo
1>  89 | &CDialog::GetOccDialogInfo
1>  90 | &CDialog::Create
1>  91 | &CDialog::Create
1>  92 | &CDialog::CreateIndirect
1>  93 | &CDialog::CreateIndirect
1>  94 | &CDialog::DoModal
1>  95 | &CDialog::OnInitDialog
1>  96 | &CDialog::OnSetFont
1>  97 | &CDialog::OnOK
1>  98 | &CDialog::OnCancel
1>  99 | &CDialog::PreInitDialog
1> 
1>  CDialog::GetRuntimeClass this adjustor: 0
1>  CDialog::Create this adjustor: 0
1>  CDialog::Create this adjustor: 0
1>  CDialog::CreateIndirect this adjustor: 0
1>  CDialog::CreateIndirect this adjustor: 0
1>  CDialog::DoModal this adjustor: 0
1>  CDialog::OnInitDialog this adjustor: 0
1>  CDialog::OnSetFont this adjustor: 0
1>  CDialog::OnOK this adjustor: 0
1>  CDialog::OnCancel this adjustor: 0
1>  CDialog::{dtor} this adjustor: 0
1>  CDialog::AssertValid this adjustor: 0
1>  CDialog::Dump this adjustor: 0
1>  CDialog::PreTranslateMessage this adjustor: 0
1>  CDialog::OnCmdMsg this adjustor: 0
1>  CDialog::CheckAutoCenter this adjustor: 0
1>  CDialog::SetOccDialogInfo this adjustor: 0
1>  CDialog::GetOccDialogInfo this adjustor: 0
1>  CDialog::PreInitDialog this adjustor: 0
1>  CDialog::GetMessageMap this adjustor: 0
1>  CDialog::__delDtor this adjustor: 0
1>  CDialog::__vecDelDtor this adjustor: 0
1> 
1> 
1>  class CDialogBar size(200):
1>   +---
1>   | +--- (base class CControlBar)
1>   | | +--- (base class CWnd)
1>   | | | +--- (base class CCmdTarget)
1>   | | | | +--- (base class CObject)
1>   0 | | | | | {vfptr}
1>   | | | | +---
1>   4 | | | | m_dwRef
1>   8 | | | | m_pOuterUnknown
1>  12 | | | | m_xInnerUnknown
1>  16 | | | | XDispatch m_xDispatch
1>  20 | | | | m_bResultExpected
1>  24 | | | | XConnPtContainer m_xConnPtContainer
1>  28 | | | | m_pModuleState
1>   | | | +---
1>  32 | | | m_hWnd
1>  36 | | | m_bEnableActiveAccessibility
1>     | | | <alignment member> (size=3)
1>  40 | | | m_pStdObject
1>  44 | | | m_pProxy
1>  48 | | | XAccessible m_xAccessible
1>  52 | | | XAccessibleServer m_xAccessibleServer
1>  56 | | | m_bIsTouchWindowRegistered
1>  60 | | | CPoint m_ptGestureFrom
1>  68 | | | m_ulGestureArg
1>  76 | | | m_bGestureInited
1>  80 | | | m_pCurrentGestureInfo
1>  84 | | | m_hWndOwner
1>  88 | | | m_nFlags
1>  92 | | | m_pfnSuper
1>  96 | | | m_nModalResult
1>  100 | | | m_pDropTarget
1>  104 | | | m_pCtrlCont
1>  108 | | | m_pCtrlSite
1>  112 | | | m_pMFCCtrlContainer
1>   | | +---
1>  116 | | m_pInPlaceOwner
1>  120 | | m_bAutoDelete
1>  124 | | m_cxLeftBorder
1>  128 | | m_cxRightBorder
1>  132 | | m_cyTopBorder
1>  136 | | m_cyBottomBorder
1>  140 | | m_cxDefaultGap
1>  144 | | m_nMRUWidth
1>  148 | | m_nCount
1>  152 | | m_pData
1>  156 | | m_hReBarTheme
1>  160 | | m_nStateFlags
1>  164 | | m_dwStyle
1>  168 | | m_dwDockStyle
1>  172 | | m_pDockSite
1>  176 | | m_pDockBar
1>  180 | | m_pDockContext
1>   | +---
1>  184 | CSize m_sizeDefault
1>  192 | m_pOccDialogInfo
1>  196 | m_lpszTemplateName
1>   +---
1> 
1>  CDialogBar::$vftable@:
1>   | &CDialogBar_meta
1>   |  0
1>   0 | &CDialogBar::GetRuntimeClass
1>   1 | &CDialogBar::{dtor}
1>   2 | &CObject::Serialize
1>   3 | &CControlBar::AssertValid
1>   4 | &CControlBar::Dump
1>   5 | &CCmdTarget::OnCmdMsg
1>   6 | &CWnd::OnFinalRelease
1>   7 | &CCmdTarget::IsInvokeAllowed
1>   8 | &CCmdTarget::GetDispatchIID
1>   9 | &CCmdTarget::GetTypeInfoCount
1>  10 | &CCmdTarget::GetTypeLibCache
1>  11 | &CCmdTarget::GetTypeLib
1>  12 | &CDialogBar::GetMessageMap
1>  13 | &CCmdTarget::GetCommandMap
1>  14 | &CCmdTarget::GetDispatchMap
1>  15 | &CCmdTarget::GetConnectionMap
1>  16 | &CWnd::GetInterfaceMap
1>  17 | &CCmdTarget::GetEventSinkMap
1>  18 | &CCmdTarget::OnCreateAggregates
1>  19 | &CCmdTarget::GetInterfaceHook
1>  20 | &CCmdTarget::GetExtraConnectionPoints
1>  21 | &CCmdTarget::GetConnectionHook
1>  22 | &CWnd::PreSubclassWindow
1>  23 | &CWnd::Create
1>  24 | &CWnd::CreateEx
1>  25 | &CWnd::CreateEx
1>  26 | &CControlBar::DestroyWindow
1>  27 | &CControlBar::PreCreateWindow
1>  28 | &CWnd::CalcWindowRect
1>  29 | &CWnd::GetMenu
1>  30 | &CWnd::SetMenu
1>  31 | &CWnd::OnToolHitTest
1>  32 | &CWnd::GetScrollBarCtrl
1>  33 | &CWnd::WinHelpW
1>  34 | &CWnd::HtmlHelpW
1>  35 | &CWnd::WinHelpInternal
1>  36 | &CWnd::ContinueModal
1>  37 | &CWnd::EndModalLoop
1>  38 | &CWnd::OnDrawIconicThumbnailOrLivePreview
1>  39 | &CWnd::EnsureStdObj
1>  40 | &CWnd::get_accParent
1>  41 | &CWnd::get_accChildCount
1>  42 | &CWnd::get_accChild
1>  43 | &CWnd::get_accName
1>  44 | &CWnd::get_accValue
1>  45 | &CWnd::get_accDescription
1>  46 | &CWnd::get_accRole
1>  47 | &CWnd::get_accState
1>  48 | &CWnd::get_accHelp
1>  49 | &CWnd::get_accHelpTopic
1>  50 | &CWnd::get_accKeyboardShortcut
1>  51 | &CWnd::get_accFocus
1>  52 | &CWnd::get_accSelection
1>  53 | &CWnd::get_accDefaultAction
1>  54 | &CWnd::accSelect
1>  55 | &CWnd::accLocation
1>  56 | &CWnd::accNavigate
1>  57 | &CWnd::accHitTest
1>  58 | &CWnd::accDoDefaultAction
1>  59 | &CWnd::put_accName
1>  60 | &CWnd::put_accValue
1>  61 | &CWnd::SetProxy
1>  62 | &CWnd::CreateAccessibleProxy
1>  63 | &CWnd::OnCommand
1>  64 | &CWnd::OnNotify
1>  65 | &CWnd::GetSuperWndProcAddr
1>  66 | &CWnd::DoDataExchange
1>  67 | &CWnd::BeginModalState
1>  68 | &CWnd::EndModalState
1>  69 | &CControlBar::PreTranslateMessage
1>  70 | &CWnd::OnAmbientProperty
1>  71 | &CControlBar::WindowProc
1>  72 | &CWnd::OnWndMsg
1>  73 | &CWnd::DefWindowProcW
1>  74 | &CControlBar::PostNcDestroy
1>  75 | &CWnd::OnChildNotify
1>  76 | &CWnd::OnTouchInputs
1>  77 | &CWnd::OnTouchInput
1>  78 | &CWnd::GetGestureStatus
1>  79 | &CWnd::OnGestureZoom
1>  80 | &CWnd::OnGesturePan
1>  81 | &CWnd::OnGestureRotate
1>  82 | &CWnd::OnGestureTwoFingerTap
1>  83 | &CWnd::OnGesturePressAndTap
1>  84 | &CWnd::CheckAutoCenter
1>  85 | &CWnd::IsFrameWnd
1>  86 | &CWnd::CreateControlContainer
1>  87 | &CWnd::CreateControlSite
1>  88 | &CDialogBar::SetOccDialogInfo
1>  89 | &CWnd::GetOccDialogInfo
1>  90 | &CDialogBar::CalcFixedLayout
1>  91 | &CControlBar::CalcDynamicLayout
1>  92 | &CDialogBar::OnUpdateCmdUI
1>  93 | &CControlBar::CalcInsideRect
1>  94 | &CControlBar::DoPaint
1>  95 | &CControlBar::DrawBorders
1>  96 | &CControlBar::DrawGripper
1>  97 | &CControlBar::DrawNCGripper
1>  98 | &CControlBar::DrawThemedGripper
1>  99 | &CControlBar::DrawNonThemedGripper
1>  100 | &CControlBar::DelayShow
1>  101 | &CControlBar::IsVisible
1>  102 | &CControlBar::RecalcDelayShow
1>  103 | &CControlBar::IsDockBar
1>  104 | &CControlBar::OnBarStyleChange
1>  105 | &CControlBar::SetStatusText
1>  106 | &CDialogBar::Create
1>  107 | &CDialogBar::Create
1> 
1>  CDialogBar::GetRuntimeClass this adjustor: 0
1>  CDialogBar::Create this adjustor: 0
1>  CDialogBar::Create this adjustor: 0
1>  CDialogBar::{dtor} this adjustor: 0
1>  CDialogBar::CalcFixedLayout this adjustor: 0
1>  CDialogBar::OnUpdateCmdUI this adjustor: 0
1>  CDialogBar::SetOccDialogInfo this adjustor: 0
1>  CDialogBar::GetMessageMap this adjustor: 0
1>  CDialogBar::__delDtor this adjustor: 0
1>  CDialogBar::__vecDelDtor this adjustor: 0
1> 
1> 
1>  class CDialogImpl size(8):
1>   +---
1>   0 | {vfptr}
1>   4 | m_Dlg
1>   +---
1> 
1>  CDialogImpl::$vftable@:
1>   | &CDialogImpl_meta
1>   |  0
1>   0 | &CDialogImpl::{dtor}
1> 
1>  CDialogImpl::{dtor} this adjustor: 0
1>  CDialogImpl::__delDtor this adjustor: 0
1>  CDialogImpl::__vecDelDtor this adjustor: 0
1> 
1> 
1>  class CDialogEx size(184):
1>   +---
1>   | +--- (base class CDialog)
1>   | | +--- (base class CWnd)
1>   | | | +--- (base class CCmdTarget)
1>   | | | | +--- (base class CObject)
1>   0 | | | | | {vfptr}
1>   | | | | +---
1>   4 | | | | m_dwRef
1>   8 | | | | m_pOuterUnknown
1>  12 | | | | m_xInnerUnknown
1>  16 | | | | XDispatch m_xDispatch
1>  20 | | | | m_bResultExpected
1>  24 | | | | XConnPtContainer m_xConnPtContainer
1>  28 | | | | m_pModuleState
1>   | | | +---
1>  32 | | | m_hWnd
1>  36 | | | m_bEnableActiveAccessibility
1>     | | | <alignment member> (size=3)
1>  40 | | | m_pStdObject
1>  44 | | | m_pProxy
1>  48 | | | XAccessible m_xAccessible
1>  52 | | | XAccessibleServer m_xAccessibleServer
1>  56 | | | m_bIsTouchWindowRegistered
1>  60 | | | CPoint m_ptGestureFrom
1>  68 | | | m_ulGestureArg
1>  76 | | | m_bGestureInited
1>  80 | | | m_pCurrentGestureInfo
1>  84 | | | m_hWndOwner
1>  88 | | | m_nFlags
1>  92 | | | m_pfnSuper
1>  96 | | | m_nModalResult
1>  100 | | | m_pDropTarget
1>  104 | | | m_pCtrlCont
1>  108 | | | m_pCtrlSite
1>  112 | | | m_pMFCCtrlContainer
1>   | | +---
1>  116 | | m_nIDHelp
1>  120 | | m_lpszTemplateName
1>  124 | | m_hDialogTemplate
1>  128 | | m_lpDialogTemplate
1>  132 | | m_lpDialogInit
1>  136 | | m_pParentWnd
1>  140 | | m_hWndTop
1>  144 | | m_pOccDialogInfo
1>   | +---
1>  148 | m_hBkgrBitmap
1>  152 | CSize m_sizeBkgrBitmap
1>  160 | CBrush m_brBkgr
1>  168 | BackgroundLocation m_BkgrLocation
1>  172 | CDialogImpl m_Impl
1>  180 | m_bAutoDestroyBmp
1>   +---
1> 
1>  CDialogEx::$vftable@:
1>   | &CDialogEx_meta
1>   |  0
1>   0 | &CDialogEx::GetRuntimeClass
1>   1 | &CDialogEx::{dtor}
1>   2 | &CObject::Serialize
1>   3 | &CDialog::AssertValid
1>   4 | &CDialog::Dump
1>   5 | &CDialog::OnCmdMsg
1>   6 | &CWnd::OnFinalRelease
1>   7 | &CCmdTarget::IsInvokeAllowed
1>   8 | &CCmdTarget::GetDispatchIID
1>   9 | &CCmdTarget::GetTypeInfoCount
1>  10 | &CCmdTarget::GetTypeLibCache
1>  11 | &CCmdTarget::GetTypeLib
1>  12 | &CDialogEx::GetMessageMap
1>  13 | &CCmdTarget::GetCommandMap
1>  14 | &CCmdTarget::GetDispatchMap
1>  15 | &CCmdTarget::GetConnectionMap
1>  16 | &CWnd::GetInterfaceMap
1>  17 | &CCmdTarget::GetEventSinkMap
1>  18 | &CCmdTarget::OnCreateAggregates
1>  19 | &CCmdTarget::GetInterfaceHook
1>  20 | &CCmdTarget::GetExtraConnectionPoints
1>  21 | &CCmdTarget::GetConnectionHook
1>  22 | &CWnd::PreSubclassWindow
1>  23 | &CWnd::Create
1>  24 | &CWnd::CreateEx
1>  25 | &CWnd::CreateEx
1>  26 | &CWnd::DestroyWindow
1>  27 | &CWnd::PreCreateWindow
1>  28 | &CWnd::CalcWindowRect
1>  29 | &CWnd::GetMenu
1>  30 | &CWnd::SetMenu
1>  31 | &CWnd::OnToolHitTest
1>  32 | &CWnd::GetScrollBarCtrl
1>  33 | &CWnd::WinHelpW
1>  34 | &CWnd::HtmlHelpW
1>  35 | &CWnd::WinHelpInternal
1>  36 | &CWnd::ContinueModal
1>  37 | &CWnd::EndModalLoop
1>  38 | &CWnd::OnDrawIconicThumbnailOrLivePreview
1>  39 | &CWnd::EnsureStdObj
1>  40 | &CWnd::get_accParent
1>  41 | &CWnd::get_accChildCount
1>  42 | &CWnd::get_accChild
1>  43 | &CWnd::get_accName
1>  44 | &CWnd::get_accValue
1>  45 | &CWnd::get_accDescription
1>  46 | &CWnd::get_accRole
1>  47 | &CWnd::get_accState
1>  48 | &CWnd::get_accHelp
1>  49 | &CWnd::get_accHelpTopic
1>  50 | &CWnd::get_accKeyboardShortcut
1>  51 | &CWnd::get_accFocus
1>  52 | &CWnd::get_accSelection
1>  53 | &CWnd::get_accDefaultAction
1>  54 | &CWnd::accSelect
1>  55 | &CWnd::accLocation
1>  56 | &CWnd::accNavigate
1>  57 | &CWnd::accHitTest
1>  58 | &CWnd::accDoDefaultAction
1>  59 | &CWnd::put_accName
1>  60 | &CWnd::put_accValue
1>  61 | &CWnd::SetProxy
1>  62 | &CWnd::CreateAccessibleProxy
1>  63 | &CDialogEx::OnCommand
1>  64 | &CWnd::OnNotify
1>  65 | &CWnd::GetSuperWndProcAddr
1>  66 | &CWnd::DoDataExchange
1>  67 | &CWnd::BeginModalState
1>  68 | &CWnd::EndModalState
1>  69 | &CDialogEx::PreTranslateMessage
1>  70 | &CWnd::OnAmbientProperty
1>  71 | &CWnd::WindowProc
1>  72 | &CWnd::OnWndMsg
1>  73 | &CWnd::DefWindowProcW
1>  74 | &CWnd::PostNcDestroy
1>  75 | &CWnd::OnChildNotify
1>  76 | &CWnd::OnTouchInputs
1>  77 | &CWnd::OnTouchInput
1>  78 | &CWnd::GetGestureStatus
1>  79 | &CWnd::OnGestureZoom
1>  80 | &CWnd::OnGesturePan
1>  81 | &CWnd::OnGestureRotate
1>  82 | &CWnd::OnGestureTwoFingerTap
1>  83 | &CWnd::OnGesturePressAndTap
1>  84 | &CDialog::CheckAutoCenter
1>  85 | &CWnd::IsFrameWnd
1>  86 | &CWnd::CreateControlContainer
1>  87 | &CWnd::CreateControlSite
1>  88 | &CDialog::SetOccDialogInfo
1>  89 | &CDialog::GetOccDialogInfo
1>  90 | &CDialog::Create
1>  91 | &CDialog::Create
1>  92 | &CDialog::CreateIndirect
1>  93 | &CDialog::CreateIndirect
1>  94 | &CDialog::DoModal
1>  95 | &CDialog::OnInitDialog
1>  96 | &CDialog::OnSetFont
1>  97 | &CDialog::OnOK
1>  98 | &CDialog::OnCancel
1>  99 | &CDialog::PreInitDialog
1> 
1>  CDialogEx::GetRuntimeClass this adjustor: 0
1>  CDialogEx::PreTranslateMessage this adjustor: 0
1>  CDialogEx::OnCommand this adjustor: 0
1>  CDialogEx::GetMessageMap this adjustor: 0
1>  CDialogEx::{dtor} this adjustor: 0
1>  CDialogEx::__delDtor this adjustor: 0
1>  CDialogEx::__vecDelDtor this adjustor: 0
1> 
1> 
1>  class CDialogTemplate size(12):
1>   +---
1>   0 | m_hTemplate
1>   4 | m_dwTemplateSize
1>   8 | m_bSystemFont
1>   +---
1> 
1> 
1> 
1>  MFCTestDlg.cpp
1>  MFCTest.cpp
1>  Generating Code...
1>  MFCTest.vcxproj -> C:\MFCTraining\MFCTest\Debug\MFCTest.exe
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

Hope this helps you have a better understanding of how classes are laid out by the Visual C++ compiler.

Share
 

Are you having trouble converting VB6 project to VB.net Visual Studio 2010. Well just to be frank you should have long back converted this VB6 project of yours to VB.net. VB6 is ancient and just because your code works doesn’t mean that you won’t migrate it to a newer platform. In my opinion let your customers use the VB6 project of yours while you in the background should have converted a copy of it to VB.net. Now you might say it’s too much work… well how about it now. ;)

Just to be clear Visual Studio 2010 does NOT inherently support converting VB6 project to VB.net 2010. When I force a conversion (via project open dialog) I get the following error dialog…

VB6 to VB.net 2010 - Conversion Error

VB6 to VB.net 2010 - Conversion Error

Recently Mr. X asked me this question so I sent him an email with the steps on converting a VB6 project to VB.net Visual Studio 2010. So here are the steps (straight from the email I sent to the customer…)

  1. Make sure VB 6.0 with SP 6.0 installed on the machine.
  2. Make sure that all the referenced components (ActiveX dll, OCX) for the VB 6.0 application is available on the machine.
  3. Open the VB 6.0 project in VB 6.0 IDE and make sure that it opens fine. Build the project and make sure that the application executes without any errors.
  4. Run the Upgrade assessment tool on the visual basic 6 project:
    (Old one) http://www.microsoft.com/downloads/details.aspx?FamilyId=10C491A2-FC67-4509-BC10-60C5C039A272&displaylang=en
    (New one) http://www.artinsoft.com/visual-basic-upgrade-assessment-tool.aspx
  5. Keep a local copy of the VB 6.0 project
  6. There is no direct wizard conversion in Visual Studio 2010. You have to first use the conversion wizard available in Visual Studio 2005/2008 to convert to VB.net and then convert the same to Visual Studio 2010. As you don’t have Visual Studio 2008, you can download free version from following link.
    http://www.microsoft.com/visualstudio/en-us/products/2008-editions/express
  7. Once you are done with the conversion you can uninstall Visual Studio 2008 express edition.
  8. Also you can download a free guide which contains information about Upgrading Visual Basic 6.0 Applications to Visual Basic .NET and Visual Basic 2005 (Its bit old but it will give useful insights as and when you are migrating source code to .net).
    http://www.microsoft.com/downloads/details.aspx?FamilyId=7C3FE0A9-CBED-485F-BFD5-847FB68F785D&displaylang=en

 A general note:

 As per the upgrade guide, the effect of the changes and subtle differences in Visual Basic .NET is that, unlike previous versions of Visual Basic, most real-world projects cannot be upgraded 100 percent automatically. To understand why, consider that for a 100 percent upgrade there has to be a one-to-one correlation between every element of Visual Basic 6 and a corresponding element in Visual Basic .NET. Unfortunately, this correlation does not exist. The upgrade process is closer to 95 percent, meaning that the Visual Basic .NET Upgrade Wizard upgrades 95 percent of your application, and you modify 5 percent of the application to get it working. What does 5 percent mean? If it took you 100 days to write the original Visual Basic 6 application, you might expect to take 5 days to upgrade it. This number is not set in stone-some applications are easier to upgrade than others, and the experience of the person doing the upgrade is an important factor. To prepare yourself, make sure you familiarize yourself with Part IV of the upgrade guide. It discusses how to design your Visual Basic 6 applications to make the upgrade process much smoother.

Microsoft Visual Basic 6.0 Migration Resource Center
http://msdn.microsoft.com/hi-in/vbrun/ms788233(en-us).aspx

Share
 

There’s a new C++ Standard and a new version of Visual C++, and it’s time to reveal those features. Read more here…

http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx 

 

Share
 

Enjoy maadi: :)

http://www.buildwindows.com/

Share
 

Found a nice article which describes how to take native/managed crash dumps automatically using CDB as soon as a crash takes place. We know that for CLR 2.0 we’ve got to configure crash handler settings at two places in the registry for a native and managed application.

For native

  1. HKLM\Software\Microsoft\Windows NT\Current Version\AeDebug\Debugger
  2. HKLM\Software\Microsoft\Windows NT\Current Version\AeDebug\Auto

For managed

  1. HKLM\Software\Microsoft\.NETFramework\DbgManagedDebugger
  2. HKLM\Software\Microsoft\.NETFramework\DbgJITDebugLaunchSetting

This article from MSDN explains in detail on how to configure registry entries to take automatic crash dumps using CDB…

http://blogs.msdn.com/b/clrteam/archive/2009/10/15/automatically-capturing-a-dump-when-a-process-crashes.aspx

Share
 

Read the following article in MSDN:

http://msdn.microsoft.com/en-us/library/5hs4b7a6.aspx

The easiest way to disable JIT debugger is via the Tools->Options dialog in Visual Studio. For other options read the article.

Enable/Disable Just in Time Debugger in Visual Studio Options dialog

Enable/Disable Just in Time Debugger in Visual Studio Options dialog

Share
 

Recently a customer of mine faced this issue. So he had an ActiveX control and when displaying the ActiveX control in browser a string is displayed right in the middle of the control: “ATL 9.0″.

So this issue happens because you didn’t override CComControlBase::OnDraw  function. The default code for CComControlBase::OnDraw looks like the following…

HRESULT CComControlBase::YourClassName::OnDraw(_In_ ATL_DRAWINFO& di)
{
  ::SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
  LPCTSTR pszText = _T("ATL ") _T(_ATL_VER_RBLD); // "ATL 9.0"
  ::TextOut(di.hdcDraw,
            di.prcBounds->left + (di.prcBounds->right - di.prcBounds->left) / 2,
            di.prcBounds->top + (di.prcBounds->bottom - di.prcBounds->top) / 2,
            pszText,
            lstrlen(pszText)); 
   return S_OK;
}

MSDN documentation for CComControlBase::OnDraw function confirms this behavior. Quote…

The wizard’s default OnDraw draws a rectangle with the label “ATL 8.0″.

The solution for this is to override CComControlBase::OnDraw function in your derived class and provide your own drawing or just return S_OK.

Share
© 2012 bits and bytes Suffusion theme by Sayontan Sinha