07 2009 档案

摘要:1.Owner Draw当Button控件被设置成OwnerDraw属性时,父窗体就会接受到WM_DRAWITEM、WM_MEASUREITEM、WM_COMPAREITEM、WM_DELETEITEM四个消息。除了Button空间外,还有ListBox控件设置CBS_OWNERDRAWVARIABLE属性。The WM_DRAWITEM message is sent to the owner ... 阅读全文
posted @ 2009-07-30 23:48 Fan Zhang 阅读(1110) 评论(0) 推荐(0)
摘要:一.常见问题 a.可以编译,不能执行的 AfxInitRichEdit(); b.升级默认的Riched版本(默认的有一些bug),如 可在InitInstance中添加 LoadLibrary("RICHED20.DLL") 最后注意 FreeLibrary 如果是CRichEditView基类的可用 BOOL CXXXXXXView::PreCreateWindow(CREATESTRUCT&... 阅读全文
posted @ 2009-07-30 18:38 Fan Zhang 阅读(5826) 评论(0) 推荐(0)
摘要:Windbg/KD配置可以参见xIkUg的文章1,调试动态加载的驱动,如果有符号,则可以在驱动加载前,在Windbg/KD中执行如下命令 bu mydriver!DriverEntry,驱动在载入的时候就会被断在DriverEntry函数入口. 2,如果没有符号,1种办法是,在系统调用DriverEntry处下断,因为操作系统不同,所以其具体位置也不一样, 不过目前win2k,xp,2k3 都在n... 阅读全文
posted @ 2009-07-28 10:11 Fan Zhang 阅读(524) 评论(0) 推荐(0)
摘要:bp 命令是在某个地址下断点, 可以 bp 0x7783FEB 也可以 bp MyApp!SomeFunction 。 对于后者,WinDBG 会自动找到MyApp!SomeFunction 对应的地址并设置断点。但是使用bp的问题在于:1)当代码修改之后,函数地址改变,该断点仍然保持在相同位置,不一定继续有效; 2)WinDBG 不会把bp断点保存工作空间中 。 所以,我比较喜欢用bu 命令。b... 阅读全文
posted @ 2009-07-28 10:06 Fan Zhang 阅读(1022) 评论(0) 推荐(0)
摘要:Windbg对过滤驱动DriverEntry函数下断点技巧 方法1: 1> 先用DeviceTree.exe查看指定的过滤驱动的Load Address(加载地址) 2> 再用LordPE.EXE查看指定过滤驱动文件的入口点地址 3> 计算过滤驱动的DriverEntry函数内存地址 DriverEntry函数内存地址 = Load Address + 入口点地址 例子: 1&g... 阅读全文
posted @ 2009-07-28 10:05 Fan Zhang 阅读(1000) 评论(0) 推荐(0)
摘要:MSDN=>Platform SDK Document=>User Interface Services=>Windows Common Controls这里可以查看平常不常用的一些控件,如Toolbar Controls、ToolTip Controls等。 阅读全文
posted @ 2009-07-27 16:07 Fan Zhang 阅读(314) 评论(0) 推荐(0)
摘要:CommandBar是可以移动的ToolBarRebar不仅可以有按钮,还可以加入其它控件,如ComboBox等。是加强的ToolBar 阅读全文
posted @ 2009-07-27 15:42 Fan Zhang 阅读(329) 评论(0) 推荐(0)
摘要:C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib 阅读全文
posted @ 2009-07-27 15:32 Fan Zhang 阅读(495) 评论(0) 推荐(0)
摘要:WTL提供一个机制,允许对同一个消息或命令,派发至不同的类。 BEGIN_MSG_MAP( CBase )//默认处理0号消息映射 MESSAGE_HANDLER( WM_DESTROY, OnDestroy1 ) ALT_MSG_MAP( 100 )//处理来自100的消息映射 MESSAGE_HANDLER( WM_DESTROY, OnDestroy2 ) END_MSG_MAP()在BEG... 阅读全文
posted @ 2009-07-27 14:51 Fan Zhang 阅读(206) 评论(0) 推荐(0)
摘要:CButton bOk = GetDlgItem(IDOK)); CButton bCancel = GetDlgItem(IDCANCEL)); 阅读全文
posted @ 2009-07-27 12:57 Fan Zhang 阅读(252) 评论(0) 推荐(0)
摘要:MessageFilter可以在处理消息之前,提前将消息修改一下。其中CMessageFilter封装了MessageFilterclass CMessageFilter {public: virtual BOOL PreTranslateMessage(MSG* pMsg) = 0;};CMainFrame之所以能响应PreTranslateMessage,是因为CMainFrame继承了CMe... 阅读全文
posted @ 2009-07-27 11:24 Fan Zhang 阅读(542) 评论(0) 推荐(0)
摘要:怎么让View来响应菜单事件? 在WTL里面,CMainFrame的消息循环是这样的: 程序代码BEGIN_MSG_MAP(CMainFrame) MESSAGE_HANDLER(WM_Create, OnCreate) CHAIN_MSG_MAP(CUpdateUI<CMainFrame>) CHAIN_MSG_MAP(CFrameWindowImpl<CMainFrame&g... 阅读全文
posted @ 2009-07-27 10:07 Fan Zhang 阅读(569) 评论(0) 推荐(0)
摘要:CHAIN_MSG_MAP_MEMBER BEGIN_MSG_MAP(CMainFrame) MESSAGE_HANDLER(WM_CREATE, OnCreate) COMMAND_ID_HANDLER(ID_APP_EXIT, OnFileExit) COMMAND_ID_HANDLER(ID_VIEW_TOOLBAR, OnViewToolBar) COMMAND_ID_HANDLER(ID... 阅读全文
posted @ 2009-07-26 23:26 Fan Zhang 阅读(1239) 评论(0) 推荐(0)
摘要:#define STRICT#define WIN32_LEAN_AND_MEAN#define _WTL_USE_CSTRING #include <atlbase.h> // base ATL classes#include <atlapp.h> // base WTL classesextern CAppModule _Module; // WTL version o... 阅读全文
posted @ 2009-07-26 22:13 Fan Zhang 阅读(334) 评论(0) 推荐(0)
摘要:设置EDIT属性为readonly SetSel(0,0);//选中光标位置 ReplaceSel("MyString\r\n");//插入字符 阅读全文
posted @ 2009-07-26 21:41 Fan Zhang 阅读(418) 评论(0) 推荐(0)
摘要:#define _WTL_USE_CSTRING 阅读全文
posted @ 2009-07-26 21:30 Fan Zhang 阅读(221) 评论(0) 推荐(0)
摘要:CWindow封装了Windows的大部分API,且CWindows只有一个变量m_hWnd。 还有一个类是CWindowImpl,它封装了class registration、 window subclassing、 message maps、和 一个基本的WindowProc()。 The WTL classes can be divided into a few major catego... 阅读全文
posted @ 2009-07-26 18:25 Fan Zhang 阅读(303) 评论(0) 推荐(0)
摘要:ListBox control vs ComboBoxListBox可以选择多行ComboBox类似ListBox和Edit的组合,比ComboBox节省大小。ComboBox可以设置成三种状态,Simple(此时类似于ListBox),Drop-down(节省空间的ListBox),Drop-down list(节省空间的ListBox,且不可修改内容)可以发一堆消息,来控制ComboBox,在... 阅读全文
posted @ 2009-07-25 06:54 Fan Zhang 阅读(321) 评论(0) 推荐(0)
摘要:CRegKey key; CString strKey = _T("SYSTEM\\CurrentControlSet\\Control\\StorageDevicePolicies"); if(key.Open(HKEY_LOCAL_MACHINE, strKey, KEY_READ) != ERROR_SUCCESS) { if (ERROR_SUCCESS != key.Create(HKE... 阅读全文
posted @ 2009-07-25 05:47 Fan Zhang 阅读(497) 评论(0) 推荐(0)
摘要:import urllib2req = urllib2.Request("http://localhost:8080")res = urllib2.urlopen( req )headers = str(res.info())print(headers)html=res.read()print(html) 阅读全文
posted @ 2009-07-24 17:53 Fan Zhang 阅读(485) 评论(0) 推荐(0)
摘要:conf\web.xml这里记录着很多<servlet>,servlet的程序可以参看tomcat中的例子。使用这些servlet事通过<servlet-mapping>来指定运行的。可以看出jsp也是通过servlet引擎运行的。WEB-INF\web.xml在每个WEB应用程序都有个WEB-INF目录,在这个目录里同样 有个web.xml文件。conf\server.x... 阅读全文
posted @ 2009-07-23 11:25 Fan Zhang 阅读(157) 评论(0) 推荐(0)
摘要:1.AT命令AT time /interactive command2.psexecpsexec -s –d –i command 阅读全文
posted @ 2009-07-22 23:00 Fan Zhang 阅读(206) 评论(0) 推荐(0)
摘要:The operating system, drivers, and device installation components store information about drivers and devices in the registry. In general, drivers and device installation components should use the reg... 阅读全文
posted @ 2009-07-22 11:10 Fan Zhang 阅读(509) 评论(0) 推荐(0)
摘要:会注册GUID_DEVINTERFACE_HID(GUID_CLASS_INPUT),和GUID_DEVINTERFACE_USB_DEVICE(GUID_CLASS_USB_DEVICE)其中USBView就是利用注册GUID_CLASS_USB_DEVICE来实现观察USB设备的 阅读全文
posted @ 2009-07-22 00:52 Fan Zhang 阅读(279) 评论(0) 推荐(0)
摘要:安装设备时候可以用这个命令devcon install xx.inf “hardward id”注册表HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class,代表这个设备所属的类别HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses,代表... 阅读全文
posted @ 2009-07-22 00:29 Fan Zhang 阅读(241) 评论(0) 推荐(0)
摘要:HKCRAbbreviation for HKEY_CLASSES_ROOTHKCUAbbreviation for HKEY_CURRENT_USERHKLMAbbreviation for HKEY_LOCAL_MACHINEHKUAbbreviation for HKEY_USERSHKRRelative root − that is, keys specified using ... 阅读全文
posted @ 2009-07-20 14:39 Fan Zhang 阅读(458) 评论(0) 推荐(0)
摘要:在Interface Descriptor中,Class被设为HID,SubClass被设为Subclass Code Description 0 No Subclass 1 Boot Interface Subclass 2 - 255 Reserved而具体是鼠标还是键盘,这些不用Class描述,而用HID Report Descriptor描述 阅读全文
posted @ 2009-07-20 10:24 Fan Zhang 阅读(329) 评论(0) 推荐(0)
摘要:USB HID设备所需要的描述符 其中 Physical descriptor是可选的,一般不用。 阅读全文
posted @ 2009-07-17 17:58 Fan Zhang 阅读(577) 评论(0) 推荐(0)
摘要:Using USB terminology, a device may send or receive a transaction every USB frame (1 millisecond). A transaction may be made up of multiple packets (token, data, handshake) but is limited in size to 8... 阅读全文
posted @ 2009-07-17 17:36 Fan Zhang 阅读(316) 评论(0) 推荐(0)
摘要:software key A system-generated, device-specific, registry subkey that contains information about the driver software associated with a device. Also called a driver key.hardware key A system-generated... 阅读全文
posted @ 2009-07-16 14:47 Fan Zhang 阅读(272) 评论(0) 推荐(0)
摘要:The following trees in the registry are of particular interest to driver writers (where HKLM represents HKEY_LOCAL_MACHINE):The HKLM\SYSTEM\CurrentControlSet\Services TreeThe HKLM\SYSTEM\CurrentContro... 阅读全文
posted @ 2009-07-16 14:39 Fan Zhang 阅读(247) 评论(0) 推荐(0)
摘要:1.Registry Key Object RoutinesA driver can manipulate a registry-key object by performing the following steps:Open a handle to the registry-key object. For more information, see Opening a Handle to a ... 阅读全文
posted @ 2009-07-16 14:28 Fan Zhang 阅读(400) 评论(0) 推荐(0)
摘要:在逆向的时候发现有KeTickCount,它其实是应该调用KeQueryTickCount时产生的。KeQueryTickCount其实是个宏#define KeQueryTickCount(CurrentCount ) { \ volatile PKSYSTEM_TIME _TickCount = *((PKSYSTEM_TIME *)(&KeTickCount)); \ while (... 阅读全文
posted @ 2009-07-13 15:33 Fan Zhang 阅读(1616) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2009-07-13 10:47 Fan Zhang 阅读(147) 评论(0) 推荐(0)
摘要:malloccalloc,初始化每个元素都为0realloc 重新分配新的地址,将旧地址拷贝到新地址里 阅读全文
posted @ 2009-07-07 15:35 Fan Zhang 阅读(190) 评论(0) 推荐(0)
摘要:[] 列表() 元组{} 字典 阅读全文
posted @ 2009-07-06 16:15 Fan Zhang 阅读(160) 评论(0) 推荐(0)
摘要:# -*- coding:gb2312 -*- #必须在第一行或者第二行 print u"吴".encode("gb18030") print "吴" print len(u"吴") print len("吴") 阅读全文
posted @ 2009-07-03 23:27 Fan Zhang 阅读(147) 评论(0) 推荐(0)
摘要:#!/usr/bin/env python'makeTextFile.py -- create text file'import osls = os.linesep# get filenamewhile True: if os.path.exists(fname): print"*** ERROR: '%s' already exists" % fname else: break# get fil... 阅读全文
posted @ 2009-07-03 17:54 Fan Zhang 阅读(825) 评论(0) 推荐(0)
摘要:1.字符串用单引号2.print不用括号3.print用%例如 print "%s is number %d!" % ("Python", 1)4.不用大括号,而用缩进5.if判断时,不用小括号括起条件,然后加上冒号:6.字符串用[]提取时,-1代表结束的字符7.if语句if expression: if_suiteif expression: if_suite else: else_suitei... 阅读全文
posted @ 2009-07-02 17:43 Fan Zhang 阅读(177) 评论(0) 推荐(0)