2012年12月28日 星期五
How to create CMFCPropertySheet
1. First, "Project" -> "Class Wizard.."->"Add Class" --> Select "CPropertyPage". If you select "CMFCPropertyPage", it will get error, when you run it.
2.After class was created, we replace all "CPropertyPage" by "CMFCPropertyPage".
3. Add CMFCPropertySheet class. And add the code.
CMySheet.h
public:
CMySheet();
virtual ~CMySheet();
CMyPage m_page1;
CMySheet.cpp
CMySheet::CMySheet()
{
AddPage(&m_page1);
}
4.
//Cf9Dlg dlg;
CMySheet dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
-----------------------
1. The first step, we can check http://msdn.microsoft.com/en-us/library/bb981937.aspx about the MSDN CMFCCpropertySheet Class information (Remarks).
2. We can try to find the information in the http://support.microsoft.com/kb/325613/en-us to know how to add the CPropertySheet and CPropertyPage.
3. There is the http://blog.163.com/xu_chao2000/blog/static/277706102010430338431/ for the CMFCPropertySheet and CMFCPropertyPage. You will need to create new DIALOG resource to add "CPropertyPage" base class, because the Visual studio has the problem to use "CMFCPropertyPage" as the base class. After add OK, then change it to "CMFCPropertyPage".
4. More information about CMFCPropertySheet -- http://blog.csdn.net/tory75034/article/details/5404061
2012年12月26日 星期三
About National Language Support
The msdn document http://msdn.microsoft.com/en-us/library/dd317708(v=vs.85).aspx .
The National Language Support (NLS) functions permit applications to:
- Set the locale for the user
- Identify the language in which the user works
- Retrieve strings representing times, dates, and other information formatted correctly for the specified language and locale
There is also the http://stackoverflow.com/questions/953416/find-out-the-language-windows-was-installed-as talk about this. Two ways to get the OS installed language
1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language\InstallLanguage which returns a four digit language code.
2. The Win32 function is GetSystemDefaultUILanguage() http://msdn.microsoft.com/en-us/library/dd318123(VS.85).aspx.
1. Locale IDs, Input Locales, and Language Collections for Windows XP and Windows Server 2003.
http://msdn.microsoft.com/en-us/goglobal/bb895996.aspx.
2. Re: How to translate the LANGID into strings. http://www.tech-archive.net/Archive/VisualStudio/microsoft.public.vstudio.general/2004-08/0250.html
TCHAR szName[100];
if ( 0 != GetLocaleInfo( MAKELCID( MAKELANGID( 0x411, 0 ),
SORT_DEFAULT ),
LOCALE_SENGLANGUAGE,
szName, 100 ) )
{
printf( szName );
}
SORT_DEFAULT ),
LOCALE_SENGLANGUAGE,
szName, 100 ) )
{
printf( szName );
}
2012年11月7日 星期三
New a Dialog with CEdit and initial string problem
I want to DoModal() a new dialog with a CEdit, and there is one initial string inside the CEdit. It's not easy to put the string in the CEdit and show it when DoModal(). Anyway, the web link (http://stackoverflow.com/questions/11715888/domodal-does-not-show-dialog-but-does-its-work ) show us how to do it.
2012年11月5日 星期一
HTML can't use WMI(Windows Management Instrumentation)?
It's a Microsoft Windows technology for application easy to get the system information and communicate with the kernel driver. For some information about WMI, please check http://msdn.microsoft.com/en-us/library/windows/desktop/aa394582(v=vs.85).aspx
You can check http://msdn.microsoft.com/en-us/library/windows/desktop/aa384642(v=vs.85).aspx to know "About WMI". We can use VBscript to get the WMI information. But anyway, we can't use HTML to get the WMI information, and it seems only ASP can use WMI.
If we can use the HTML with VBScript page to read WMI information, it will be very powerful. But maybe it will also get some security concern.
Purpose
Windows Management Instrumentation (WMI) is the infrastructure for management data and operations on Windows-based operating systems. You can write WMI scripts or applications to automate administrative tasks on remote computers but WMI also supplies management data to other parts of the operating system and products, for example System Center Operations Manager, formerly Microsoft Operations Manager (MOM), or Windows Remote Management (WinRM).
You can check http://msdn.microsoft.com/en-us/library/windows/desktop/aa384642(v=vs.85).aspx to know "About WMI". We can use VBscript to get the WMI information. But anyway, we can't use HTML to get the WMI information, and it seems only ASP can use WMI.
If we can use the HTML with VBScript page to read WMI information, it will be very powerful. But maybe it will also get some security concern.
2012年11月3日 星期六
Putting Controls On Toolbars
You can learn how to add combo box into toolbar by http://msdn.microsoft.com/en-us/library/bb983718.aspx in the MFC project.
There is also the information in the http://msdn.microsoft.com/en-us/library/bb982770.aspx (
CMFCToolBarComboBoxButton Class). It also show some code in the Visual Studio Demo sample of the MFC sample codes. You can build the code and play it.
To add a combo box button to a toolbar, follow these steps:
There is also the information in the http://msdn.microsoft.com/en-us/library/bb982770.aspx (
CMFCToolBarComboBoxButton Class). It also show some code in the Visual Studio Demo sample of the MFC sample codes. You can build the code and play it.
To add a combo box button to a toolbar, follow these steps:
1. Reserve a dummy resource ID for the button in the parent toolbar resource.
2. Construct a CMFCToolBarComboBoxButton object.
3. In the message handler that processes the AFX_WM_RESETTOOLBAR message, replace the dummy button with the new combo box button by usingCMFCToolBar::ReplaceButton.
But anyway, it can't work. It take me several days to check this problem. After all, I find we can add m_wndToolBar.ResetAll (); in the SHOWMESSAGE or SIZE message to solve this problem.
2012年10月20日 星期六
ACPICA
ACPI is the basic infrastructure for the Windows and Linux now. It's the interface for the BIOS and OS.
If you want to study more about the ACPI structure, you should also study https://www.acpica.org
Please download and setup flex and bison from http://gnuwin32.sourceforge.net/.
You can install the bison and flex in the C:\GnuWin32.
After all, you will need to m4.exe and regex2.dll to the .\acpica\generate\msvc9 to build it OK.
If you want to study more about the ACPI structure, you should also study https://www.acpica.org
The ACPI Component Architecture Project
The ACPI Component Architecture (ACPICA) project provides an operating system (OS)-independent reference implementation of the Advanced Configuration and Power Interface Specification (ACPI). It can be easily adapted to execute under any host OS. The ACPICA code is meant to be directly integrated into the host OS as a kernel-resident subsystem. Hosting the ACPICA subsystem requires no changes to the core ACPICA code. Instead, a small OS-specific interface layer is written specifically for each host OS in order to interface the ACPICA code to the native OS services.
You can download the ACPICA windows source code in the https://www.acpica.org/downloads/source_code.php. You can build it by Visual studio and play it.
But the iASL(ASLCompiler) is more complex to build it. And it will need
For iASL, these versions of Flex and Bison are required:
flex: version 2.5.4 or greater
bison: version 2.4.1 or greater
Please download and setup flex and bison from http://gnuwin32.sourceforge.net/.
You can install the bison and flex in the C:\GnuWin32.
After all, you will need to m4.exe and regex2.dll to the .\acpica\generate\msvc9 to build it OK.
2012年9月17日 星期一
Break on a specific Win32 last error value
There are two documents discuss about this.
http://www.nynaeve.net/?p=147
http://blogs.msdn.com/b/danpear/archive/2007/04/06/2033100.aspx
http://www.nynaeve.net/?p=147
http://blogs.msdn.com/b/danpear/archive/2007/04/06/2033100.aspx
2012年8月21日 星期二
Just a record for server setup
Server Information
Server Name: server
Server IP: server.xxx.com
Server IP: server.xxx.com
If you are using an existing domain with your new hosting account, you will need to update the nameservers to point to the nameservers listed below.
Nameserver 1: xxxx
Nameserver 2: yyyy
Nameserver 2: yyyy
In the domain account
Nameservers
Nameservers: (Last update M/DD/YYYY) | |
xxxx yyyy | Set Nameservers Manage DS Records |
2012年8月4日 星期六
About MySQL SUM column
Database is important for the website. It can use the MySQL to setup database for PHP+MySQL. But if we want to sum all columns in the MySQL, it can not use the SUM(*). You just can use SUM(column1), SUM(column2).. or you will need a for loop for this.
2012年6月17日 星期日
How to use F12 Developer Tools to Debug your Webpages
http://msdn.microsoft.com/en-us/library/ie/gg589507(v=vs.85).aspx
Microsoft IE 9 support developer tool for developer to debug the HTML code. For more detail, you can check the MSDN web site.
Microsoft IE 9 support developer tool for developer to debug the HTML code. For more detail, you can check the MSDN web site.
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
http://blogs.msdn.com/b/murrays/archive/2009/08/31/automatic-richedit-hyperlinks.aspx
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.
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.
2012年4月21日 星期六
SMBIOS -- about the length
Some introduction for the SMBIOS in the http://en.wikipedia.org/wiki/System_Management_BIOS.
The SMBIOS spec is in the http://dmtf.org/standards/smbios
Anyway, the length for one SMBIOS type is only one byte. But the handle is 2 bytes. This is strange design. The SMBIOS designer think the SMBIOS data will never over 256 bytes, but the handles will over 256. I believe this is not a good design. The Length item will be re-design soon.
The SMBIOS spec is in the http://dmtf.org/standards/smbios
Anyway, the length for one SMBIOS type is only one byte. But the handle is 2 bytes. This is strange design. The SMBIOS designer think the SMBIOS data will never over 256 bytes, but the handles will over 256. I believe this is not a good design. The Length item will be re-design soon.
2012年4月5日 星期四
object management -- !object
There are some information about the object management in the
1. Windows internals Chapter 3.
The Windows Object Manager controls objects that are part of the kernel-mode operating system. An object is a collection of data that the operating system manages.
Kernel-mode objects can be referenced by pointers. An object may have an object name. For more information about object names, see Object Names.
User-mode programmers can reference objects only through indirection, using a handle. If an object has a name, you can use it to obtain the handle in user mode. For more information about handles, see Object Handles.
Kernel-mode objects have a very specific life-cycle. For more information about object life-cycles, see Life Cycle of an Object.
Object security is a prime concern for kernel-mode programming. For more information on object security, see Object Security.
There are two ways to investigate Windows Object.
1. WinObj.exe utility in the http://technet.microsoft.com/en-us/sysinternals/bb896657
2. !object command in the windbg utility
How to implement !object
Root Directory Object address: ObpRootDirectoryObject
//http://www.nirsoft.net/kernel_struct/vista/OBJECT_DIRECTORY.html
typedef struct _OBJECT_DIRECTORY { POBJECT_DIRECTORY_ENTRY HashBuckets[37]; EX_PUSH_LOCK Lock; PDEVICE_MAP DeviceMap; ULONG SessionId; PVOID NamespaceEntry; ULONG Flags; } OBJECT_DIRECTORY, *POBJECT_DIRECTORY;
typedef struct _OBJECT_DIRECTORY_ENTRY { POBJECT_DIRECTORY_ENTRY ChainLink; PVOID Object; ULONG HashValue; } OBJECT_DIRECTORY_ENTRY, *POBJECT_DIRECTORY_ENTRY;
typedef struct _OBJECT_HEADER_NAME_INFO { POBJECT_DIRECTORY Directory; UNICODE_STRING Name; ULONG QueryReferences; } OBJECT_HEADER_NAME_INFO, *POBJECT_HEADER_NAME_INFO;0: kd> dq ObpRootDirectoryObject fffff800`02e25790 fffff8a0`00005b40 fffffa80`03691c90 fffff800`02e257a0 fffffa80`03691de0 fffffa80`03691f30 fffff800`02e257b0 00000000`00000000 00000000`00000000 fffff800`02e257c0 fffffa80`03691f30 fffffa80`03691de0 fffff800`02e257d0 fffffa80`03691c90 fffffa80`03691980 fffff800`02e257e0 fffffa80`0368ba70 fffffa80`0368b920 fffff800`02e257f0 fffffa80`0368b7d0 fffffa80`0368b680 fffff800`02e25800 fffffa80`0368b530 fffffa80`0368b2e0 0: kd> dt _OBJECT_DIRECTORY 0xfffff8a0`00005b40 -b nt!_OBJECT_DIRECTORY +0x000 HashBuckets : [00] (null) [01] 0xfffff8a0`000059a0 [02] (null) [03] (null) [04] (null) [05] 0xfffff8a0`001e11e0 [06] 0xfffff8a0`00278a90 [07] (null) [08] 0xfffff8a0`0000be30 [09] 0xfffff8a0`000909f0 [10] 0xfffff8a0`00008bd0 [11] 0xfffff8a0`00276d00 [12] (null) [13] 0xfffff8a0`06fbb8d0 [14] 0xfffff8a0`001bf6b0 [15] 0xfffff8a0`004cc250 [16] 0xfffff8a0`000086d0 [17] 0xfffff8a0`038221c0 [18] 0xfffff8a0`0000b390 [19] 0xfffff8a0`00105bb0 [20] 0xfffff8a0`00074cc0 [21] 0xfffff8a0`015213b0 [22] 0xfffff8a0`0381f1c0 [23] 0xfffff8a0`00005770 [24] (null) [25] (null) [26] 0xfffff8a0`00008450 [27] (null) [28] 0xfffff8a0`0000a9a0 [29] 0xfffff8a0`01b3a830 [30] 0xfffff8a0`0000bc50 [31] (null) [32] (null) [33] (null) [34] 0xfffff8a0`00274050 [35] (null) [36] 0xfffff8a0`00073b00 +0x128 Lock : _EX_PUSH_LOCK +0x000 Locked : 0y0 +0x000 Waiting : 0y0 +0x000 Waking : 0y0 +0x000 MultipleShared : 0y0 +0x000 Shared : 0y000000000000000000000000000000000000000000000000000000000000 (0) +0x000 Value : 0 +0x000 Ptr : (null) +0x130 DeviceMap : (null) +0x138 SessionId : 0xffffffff +0x140 NamespaceEntry : (null) +0x148 Flags : 0
0: kd> dt _OBJECT_DIRECTORY_ENTRY 0xfffff8a0`000059a0
nt!_OBJECT_DIRECTORY_ENTRY
+0x000 ChainLink : (null)
+0x008 Object : 0xfffff8a0`00005560 Void
+0x010 HashValue : 0x6c1c47fb
0: kd> !object 0xfffff8a0`00005560
Object: fffff8a000005560 Type: (fffffa8003691de0) Directory
ObjectHeader: fffff8a000005530 (new version)
HandleCount: 0 PointerCount: 44
Directory Object: fffff8a000005b40 Name: ObjectTypes
Hash Address Type Name
---- ------- ---- ----
00 fffffa8003721f30 Type TmTm
01 fffffa8003718660 Type Desktop
fffffa800368b920 Type Process
03 fffffa800368b2e0 Type DebugObject
04 fffffa800371f080 Type TpWorkerFactory
05 fffffa800371ff30 Type Adapter
fffffa8003691980 Type Token
08 fffffa8003711570 Type EventPair
09 fffffa800514a620 Type PcwObject
fffffa8003750350 Type WmiGuid
11 fffffa8003752350 Type EtwRegistration
12 fffffa8003724570 Type Session
fffffa8003718ba0 Type Timer
13 fffffa800370f270 Type Mutant
16 fffffa800371f9f0 Type IoCompletion
17 fffffa80037187b0 Type WindowStation
fffffa8003718a50 Type Profile
18 fffffa800371f8a0 Type File
21 fffffa8003718cf0 Type Semaphore
23 fffffa8003753350 Type EtwConsumer
25 fffffa8003721de0 Type TmTx
fffffa8003691c90 Type SymbolicLink
26 fffffa800372b660 Type Key
fffffa8003718900 Type KeyedEvent
fffffa800370f120 Type Callback
fffffa8005108a80 Type FilterConnectionPort
28 fffffa800368b680 Type UserApcReserve
fffffa800368ba70 Type Job
29 fffffa800371fde0 Type Controller
fffffa800368b530 Type IoCompletionReserve
30 fffffa800371fc90 Type Device
fffffa8003691de0 Type Directory
31 fffffa8003723570 Type Section
fffffa8003721b40 Type TmEn
fffffa800368b7d0 Type Thread
32 fffffa8003691f30 Type Type
33 fffffa8005108930 Type FilterCommunicationPort
fffffa8003731840 Type PowerRequest
35 fffffa8003721c90 Type TmRm
fffffa8003710570 Type Event
36 fffffa8003730ba0 Type ALPC Port
fffffa800371fb40 Type Driver
2012年3月29日 星期四
!errlog
The !errlog extension displays the contents of any pending entries in the I/O system's error log.
Only entries that were queued by IoWriteErrorLogEntry but have not been committed to the error log will be displayed.
This command can be used as a diagnostic aid after a system crash because it reveals pending error information that was unable to be committed to the error log before the system halted.
nt!IoWriteErrorLogEntry+0x114:
fffff800`02d5de64 803d96b9110000 cmp byte ptr [nt!IopErrorLogSessionPending (fffff800`02e79801)],0
fffff800`02d5de6b 488b05e6c21100 mov rax,qword ptr [nt!IopErrorLogListHead+0x8 (fffff800`02e7a158)]
fffff800`02d5de72 488d4b08 lea rcx,[rbx+8]
fffff800`02d5de76 48894310 mov qword ptr [rbx+10h],rax
fffff800`02d5de7a 488d15cfc21100 lea rdx,[nt!IopErrorLogListHead (fffff800`02e7a150)]
fffff800`02d5de81 488911 mov qword ptr [rcx],rdx
fffff800`02d5de84 488908 mov qword ptr [rax],rcx
fffff800`02d5de87 48890dcac21100 mov qword ptr [nt!IopErrorLogListHead+0x8 (fffff800`02e7a158)],rcx
fffff800`02d5de8e 7533 jne nt!IoWriteErrorLogEntry+0x173 (fffff800`02d5dec3)
IDebugDataSpaces::ReadDebuggerData
Index: DEBUG_DATA_IopErrorLogListHeadAddr Returns the address of the kernel variable IopErrorLogListHead.
2012年3月7日 星期三
!vm --Physical memory
1: kd> !vm
*** Virtual Memory Usage ***
Physical Memory: 387422 ( 1549688 Kb)
The physical memory size is the MmNumberOfPhysicalPages * (page size)
You can implement it using the dbgeng.dll
IDebugDataSpaces::ReadDebuggerData
The ReadDebuggerData method returns information about the target that the debugger engine has queried or determined during the current session. The available information includes the locations of certain key target kernel locations, specific status values, and a number of other things.
HRESULT ReadDebuggerData( [in] ULONG Index, [out] PVOID Buffer, [in] ULONG BufferSize, [out, optional] PULONG DataSize );
DEBUG_DATA_MmNumberOfPhysicalPagesAddr
|
ULONG64
|
Returns the address of the kernel variableMmNumberOfPhysicalPages.
|
DEBUG_DATA_MmPageSize
|
ULONG64
|
Returns the page size.
|
2012年2月28日 星期二
!process -- Image name
PROCESS 852b8020 SessionId: 0 Cid: 1154 Peb: 7ffda000 ParentCid: 0ba4
DirBase: ad036740 ObjectTable: b4061630 HandleCount: 53.
Image: WerFault.exe
From the _KPROCESS, it can't find the image name information, and it can be found in the _EPROCESS structure.
0: kd> dt _EPROCESS
nt!_EPROCESS
+0x000 Pcb : _KPROCESS
+0x160 ProcessLock : _EX_PUSH_LOCK
+0x168 CreateTime : _LARGE_INTEGER
+0x170 ExitTime : _LARGE_INTEGER
+0x178 RundownProtect : _EX_RUNDOWN_REF
+0x180 UniqueProcessId : Ptr64 Void
+0x188 ActiveProcessLinks : _LIST_ENTRY
+0x198 ProcessQuotaUsage : [2] Uint8B
+0x1a8 ProcessQuotaPeak : [2] Uint8B
+0x1b8 CommitCharge : Uint8B
+0x1c0 QuotaBlock : Ptr64 _EPROCESS_QUOTA_BLOCK
+0x1c8 CpuQuotaBlock : Ptr64 _PS_CPU_QUOTA_BLOCK
+0x1d0 PeakVirtualSize : Uint8B
+0x1d8 VirtualSize : Uint8B
+0x1e0 SessionProcessLinks : _LIST_ENTRY
+0x1f0 DebugPort : Ptr64 Void
+0x1f8 ExceptionPortData : Ptr64 Void
+0x1f8 ExceptionPortValue : Uint8B
+0x1f8 ExceptionPortState : Pos 0, 3 Bits
+0x200 ObjectTable : Ptr64 _HANDLE_TABLE
+0x208 Token : _EX_FAST_REF
+0x210 WorkingSetPage : Uint8B
+0x218 AddressCreationLock : _EX_PUSH_LOCK
+0x220 RotateInProgress : Ptr64 _ETHREAD
+0x228 ForkInProgress : Ptr64 _ETHREAD
+0x230 HardwareTrigger : Uint8B
+0x238 PhysicalVadRoot : Ptr64 _MM_AVL_TABLE
+0x240 CloneRoot : Ptr64 Void
+0x248 NumberOfPrivatePages : Uint8B
+0x250 NumberOfLockedPages : Uint8B
+0x258 Win32Process : Ptr64 Void
+0x260 Job : Ptr64 _EJOB
+0x268 SectionObject : Ptr64 Void
+0x270 SectionBaseAddress : Ptr64 Void
+0x278 Cookie : Uint4B
+0x27c UmsScheduledThreads : Uint4B
+0x280 WorkingSetWatch : Ptr64 _PAGEFAULT_HISTORY
+0x288 Win32WindowStation : Ptr64 Void
+0x290 InheritedFromUniqueProcessId : Ptr64 Void
+0x298 LdtInformation : Ptr64 Void
+0x2a0 Spare : Ptr64 Void
+0x2a8 ConsoleHostProcess : Uint8B
+0x2b0 DeviceMap : Ptr64 Void
+0x2b8 EtwDataSource : Ptr64 Void
+0x2c0 FreeTebHint : Ptr64 Void
+0x2c8 FreeUmsTebHint : Ptr64 Void
+0x2d0 PageDirectoryPte : _HARDWARE_PTE
+0x2d0 Filler : Uint8B
+0x2d8 Session : Ptr64 Void
+0x2e0 ImageFileName : [15] UChar
2012年2月25日 星期六
CMFCMenuButton
The MFC examples are in the MFC\Visual C++ 2008 Feature Pack\NewControls. The menu button work fine. But it will meet the problem when I try it. It can find more information in the http://stackoverflow.com/questions/3151790/why-isnt-the-dropdown-arrow-drawn-for-an-cmfcmenubutton
Can't load bitmap: 42b8.GetLastError() = 716
> CMenuImages. Can't load menu images 3f01
2012年2月24日 星期五
Rich Edit Control initialization
If you are using a rich edit control in a dialog box (regardless of whether your application is SDI, MDI, or dialog-based), you must callAfxInitRichEdit once before the dialog box is displayed. A typical place to call this function is in your program's InitInstance member function. You do not need to call it for each time you display the dialog box, only the first time. You do not have to call AfxInitRichEdit if you are working with CRichEditView.
AfxInitRichEdit2 for RichEditCtrl2.0
Call this function to load the RICHED20.DLL and initialize version 2.0 of the rich edit control. If you call the Create method of CRichEditCtrl,CRichEditView, or CRichEditDoc, you typically don't need to call this function, but in some cases it might be necessary.
2012年2月18日 星期六
Module information -- !lmi
0: kd> !lmi hpdskflt
Loaded Module Info: [hpdskflt]
Module: hpdskflt
Base Address: fffffa6001a00000
Image Name: hpdskflt.sys
Machine Type: 34404 (X64)
Time Stamp: 47e0334b Tue Mar 18 14:25:31 2008
Size: a000
CheckSum: e730
Characteristics: 22
Debug Data Dirs: Type Size VA Pointer
CODEVIEW 55, 5220, 3a20 RSDS - GUID: {E531AC22-7E5E-4FC1-AB65-452496512564}
Age: 30, Pdb: c:\prog\vendors\osr\hp3dgsr_vista\Release\amd64\hpdskflt.pdb
Image Type: MEMORY - Image read successfully from loaded memory.
Symbol Type: NONE - PDB not found from symbol server.
Load Report: no symbols loaded
You can get more information in http://msdn.microsoft.com/en-us/library/windows/hardware/ff563955(v=vs.85).aspx.
The !lmi extension analyzes the module headers and displays a formatted summary of the information therein. If the module headers are paged out, an error message is displayed. To see a more extensive display of header information, use the !dh extension command.
You will need the PE and COFF knowledge for these two commands. You can download the specification in the http://msdn.microsoft.com/library/windows/hardware/gg463125.
There is also a good website http://www.godevtool.com/Other/pdb.htm.
How to implement it?
IDebugSymbols::GetModuleParameters
then you will get the structure
typedef struct _DEBUG_MODULE_PARAMETERS { ULONG64 Base; ULONG Size; ULONG TimeDateStamp; ULONG Checksum; ULONG Flags; ULONG SymbolType; ULONG ImageNameSize; ULONG ModuleNameSize; ULONG LoadedImageNameSize; ULONG SymbolFileNameSize; ULONG MappedImageNameSize; ULONG64 Reserved[2]; } DEBUG_MODULE_PARAMETERS, *PDEBUG_MODULE_PARAMETERS;
訂閱:
文章 (Atom)