2012年5月31日 星期四

CRichEditCtrl to show the hyperlink text

The key point is

CRichEditCtrl::SetAutoURLDetect

Sets the rich edit control to automatically detect a URL.


SetEventMask to ENM_LINK 



pmyRichEditCtrl->SetEventMask(pmyRichEditCtrl->GetEventMask() |
    ENM_CHANGE);



http://blogs.msdn.com/b/murrays/archive/2009/08/31/automatic-richedit-hyperlinks.aspx

2012年5月18日 星期五

Windbg --Local Kernel Debugging

You can get more information here..http://msdn.microsoft.com/en-us/library/windows/hardware/ff553382(v=vs.85).aspx
















You will see "bcdedit -debug on" error message.  Actually, you can use LiveKD to run windbg to solve this probem.




Difficulties in Performing Local Kernel Debugging

Local kernel debugging is a very delicate operation. Be careful that you do not corrupt or crash the system.
One of the most difficult aspects of local kernel debugging is that the machine state is constantly changing. Memory is paged in and out, the active process constantly changes, and virtual address contexts do not remain constant. However, under these conditions, you can effectively analyze things that change slowly, such as certain device states.
Kernel-mode drivers and the Windows operating system frequently send messages to the kernel debugger by using DbgPrint and related functions. These messages are not automatically displayed during local kernel debugging. You can display them by using the !dbgprint extension.

LiveKD

The LiveKD tool simulates local kernel debugging. This tool creates a "snapshot" dump file of the kernel memory, without actually stopping the kernel while this snapshot is made. (Therefore, the snapshot might not actually show a single instant state of the computer.)
LiveKD is not part of the Debugging Tools for Windows package. You can download LiveKd from the Windows Sysinternals site.

2012年5月12日 星期六

PCI device extension


This show you the DeviceExtension of the PCI device object.

0: kd> !devobj 0xfffffa8002108a10
Device object (fffffa8002108a10) is for:
 NTPNP_PCI0022 \Driver\pci DriverObject fffffa80012201c0
Current Irp 00000000 RefCount 0 Type 00000023 Flags 00001840
Dacl fffff9a1092d5981 DevExt fffffa8002108b60 DevObjExt fffffa8002108f88 DevNode fffffa8002109990
ExtensionFlags (0000000000)
AttachedDevice (Upper) fffffa8002109e40 \Driver\ACPI
Device queue is not busy.
0: kd> dt nt!_device_object 0xfffffa8002108a10
   +0x000 Type             : 0n3
   +0x002 Size             : 0x578
   +0x004 ReferenceCount   : 0n0
   +0x008 DriverObject     : 0xfffffa80`012201c0 _DRIVER_OBJECT
   +0x010 NextDevice       : 0xfffffa80`02103910 _DEVICE_OBJECT
   +0x018 AttachedDevice   : 0xfffffa80`02109e40 _DEVICE_OBJECT
   +0x020 CurrentIrp       : (null)
   +0x028 Timer            : (null)
   +0x030 Flags            : 0x1840
   +0x034 Characteristics  : 0x100
   +0x038 Vpb              : (null)
   +0x040 DeviceExtension  : 0xfffffa80`02108b60 Void
   +0x048 DeviceType       : 0x23
   +0x04c StackSize        : 1 ''
   +0x050 Queue            : <unnamed-tag>
   +0x098 AlignmentRequirement : 0
   +0x0a0 DeviceQueue      : _KDEVICE_QUEUE
   +0x0c8 Dpc              : _KDPC
   +0x108 ActiveThreadCount : 0
   +0x110 SecurityDescriptor : 0xfffff8a0`092d5980 Void
   +0x118 DeviceLock       : _KEVENT
   +0x130 SectorSize       : 0
   +0x132 Spare1           : 1
   +0x138 DeviceObjectExtension : 0xfffffa80`02108f88 _DEVOBJ_EXTENSION
   +0x140 Reserved         : (null)
0: kd> dt pci!_PCI_DEVICE  0xfffffa80`02108b60 
   +0x000 Signature        : 0x44696350
   +0x004 DeviceState      : 0x1 ''
   +0x005 TentativeNextState : 0x1 ''
   +0x008 DeviceUsage      : _PCI_DEVICE_USAGE
   +0x014 BusNumber        : 1
   +0x018 Slot             : _PCI_SLOT_NUMBER
   +0x01c VendorID         : 0x1002
   +0x01e DeviceID         : 0x6840
   +0x020 RevisionID       : 0 ''
   +0x021 BaseClass        : 0x3 ''
   +0x022 SubClass         : 0 ''
   +0x023 ProgIf           : 0 ''
   +0x024 SubVendorID      : 0x1043
   +0x026 SubSystemID      : 0x10dc
   +0x028 HeaderType       : 0 ''
   +0x029 InterruptPin     : 0x1 ''
   +0x02a FirstCapability  : 0x50 'P'
   +0x02b PowerCapability  : 0x50 'P'
   +0x02c SubIDsCapability : 0 ''
   +0x02d AgpCapability    : 0 ''
   +0x02e PciXCapability   : 0 ''
   +0x02f MsiCapability    : 0xa0 ''
   +0x030 MsiXCapability   : 0 ''
   +0x031 FirstHtCapability : 0 ''
   +0x032 HtMsiMapCapability : 0 ''
   +0x033 ExpressCapability : 0x58 'X'
   +0x034 PossibleDecodes  : 4
   +0x036 ResourceDecodes  : 7
   +0x038 PreviousCommand  : 0
   +0x040 DeviceObject     : 0xfffffa80`02108a10 _DEVICE_OBJECT
   +0x048 Root             : 0xfffffa80`020cebb0 _PCI_ROOT
   +0x050 Parent           : 0xfffffa80`020fee00 _PCI_BUS
   +0x058 Sibling          : (null)
   +0x060 RemoveLock       : _IO_REMOVE_LOCK
   +0x080 ExpressCompatibilityPort : 0xfffffa80`020df850 _EXPRESS_COMPATIBILITY_PORT
   +0x088 ExpressPort      : (null)
   +0x090 HotPlugSlot      : (null)
   +0x098 InstanceIdSerialNumber : 0
   +0x0a0 Resources        : _PCI_DEVICE_RESOURCES
   +0x190 Requirements     : _PCI_DEVICE_REQUIREMENTS
   +0x310 InterruptResource : _PCI_DEVICE_INTERRUPT_RESOURCE
   +0x360 InterruptRequirement : _PCI_DEVICE_INTERRUPT_REQUIREMENT
   +0x3a8 SavedRegisters   : _PCI_SAVE_RESTORE_DATA
   +0x3b4 CapturedProcessorCount : 4
   +0x3b8 LogicalPowerState : 4 ( PowerDeviceD3 )
   +0x3bc WakeLevel        : 0 ( PowerDeviceUnspecified )
   +0x3c0 PowerSupport     : _PM_SUPPORT
   +0x3c8 WakeIrp          : (null)
   +0x3d0 WakeIrpState     : 0n0
   +0x3d8 WakeIrpLock      : 0
   +0x3e0 ConfigureMwi     : 0y0
   +0x3e0 BusNumbersConfigured : 0y0
   +0x3e0 OnDebugPath      : 0y0
   +0x3e0 MovedDeviceResources : 0y1
   +0x3e0 LegacyDriver     : 0y0
   +0x3e0 NativeIdeSwitchAllowed : 0y0
   +0x3e0 IdeInNativeMode  : 0y0
   +0x3e0 IdeInterfaceActive : 0y0
   +0x3e0 Present          : 0y1
   +0x3e0 ReportedMissing  : 0y0
   +0x3e0 Connected        : 0y1
   +0x3e0 PmeOwned         : 0y1
   +0x3e0 HyperTransport   : 0y0
   +0x3e0 MsiHtConverter   : 0y0
   +0x3e0 ExtendedConfigAvailable : 0y1
   +0x3e0 B2On66MHzSegmentIllegal : 0y0
   +0x3e0 Device66MHzCapable : 0y0
   +0x3e0 DsmToIgnoreBootConfigEvaluated : 0y1
   +0x3e0 IgnoreBootConfig : 0y0
   +0x3e0 Reserved         : 0y0000000000000 (0)
   +0x3e4 BridgeFlags      : <unnamed-tag>
   +0x3e8 HackFlags        : 0x20`00000002
   +0x3f0 Operations       : 0xfffff880`00e8d1c8 _PCI_HEADER_OPERATIONS
   +0x3f8 InterruptRoutingToken : ROUTING_TOKEN
   +0x408 PciBusInterfaceCount : 0n2
   +0x40c AgpTargetInterfaceRefCount : 0n0
   +0x410 PciCardBusInterfaceCount : 0n0
   +0x414 PciDevicePresentInterfaceCount : 0n1
   +0x418 PciNativeIdeInterfaceCount : 0n0
   +0x41c PciLocationInterfaceCount : 0n0
   +0x420 EnumFailureCode  : 0

2012年5月11日 星期五

Explorer like utility sample code

I try to search the Windows explorer.exe sample code in the google and codeproject, but I don't find it.  Finally, I find it in the MFC sample code (\C++\MFC\Visual C++ 2008 Feature Pack\Explorer).

There is one useful MFC class CMFCShellListCtrl (http://msdn.microsoft.com/zh-tw/library/bb983966.aspx) in the Explorer sample code.  The CMFCShellListCtrl class provides Windows list control functionality and expands it by including the ability to display a list of shell items. 


You can find more in the MFC Explorer sample code.