自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(9)
  • 资源 (21)
  • 收藏
  • 关注

转载 进程及线程创建流程

今天在MuseHero的博客看到的资料,先收藏下来,以后慢慢学习,顺便了解一下WINDOWS的进程机制。;进程创建过程开始 CreateProcessAcall   kernel32!CreateProcessA ;10个参数; BOOL WINAPI CreateProcess(;   __in_opt     LPCTSTR lpApplicationName,;   __inout_op

2008-12-08 21:09:00 1558

转载 女孩,如果有个男孩为你哭

[转]女孩,如果有个男孩为你哭,请拉住他的手一个朋友告诉我,他哭了,为了一个女孩。    “你一定很爱很爱她吧。”    “是爱到不知道怎么办才好。”    “是吗?”    “男孩在你面前哭说明他已经快要窒息了,如果你拉住他的手,他真的可以陪你走完一生;如果你放弃了他,他会很难再回到以前的自己。”    他的话音刚落,我心中突然很压抑……想到了他——那个曾经为我哭泣的男孩。 

2008-11-18 22:36:00 514

转载 只想让你知道我喜欢你

在对你发脾气后转过身自己却在不断哭泣 其实你不知道, 我从来不会真正生你气, 因为我喜欢你.. 其实你不知道, 对你任性,不讲理, 是因为在乎你. 你要知道, 假如不喜欢你, 我根本不会在意你是怎么对我. 你要知道, 假如不喜欢你,我不会对你发脾,不会对你撒娇让你哄. 你要知道, 假如不喜欢你, 你根本没有本事让我为你流泪, 因为喜欢你, 就算你惹我生气了,我也不会气很久.

2008-11-17 22:25:00 691

转载 挂钩SSDT

一、原理篇1.            关于系统服务。系统服务是由操作系统提供一组函数,使得开发者能够通过APIs直接或间接的调用。一个API可以对应一个系统服务,也可以一个API依赖多个系统服务。比如,WriteFile API对应的系统服务是ntoskrnl.exe中的NtWriteFile。系统服务分发属于陷阱分发的范畴,更详细的资料可参考’Windows Internal(4th e

2008-11-16 22:54:00 1966

转载 消息钩子的反拦截

首先声明一下,标题所指的钩子是消息钩子,而不是API钩子(一种对API地址的替换技术)。若标题使您误解,请不要继续阅读。             消息钩子在Windows编程中有着非常广泛的应用,它可以任意拦截Windows系统,这个以消息为驱动的系统中的绝大多数消息类型。一方面这给编程者带来了巨大的灵活性,另一方面也埋下了巨大隐患,大多数窃密软件都使用这种方法。此篇文章给您提供一种钩子的反拦截方

2008-11-14 22:48:00 5167

转载 提高自己进程的权限

BOOL EnablePriv(){HANDLE hToken;if ( OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES,&hToken) ){       TOKEN_PRIVILEGES tkp;              LookupPrivilegeValue( NULL,SE_DEBUG_NAME,&tkp.Pri

2008-11-07 23:00:00 753

转载 mfc消息流动详解分析

一、传统SDK程序的消息循环 在传统的SDK程序中,消息循环是很简单的,也许你不信,那我们就看看下面这段代码吧: #include LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,           P

2008-11-06 12:23:00 1023

转载 根据窗口句柄如何取得其对应的应用程序名称和路径?

   DWORD   dwPID;                     String   strPID;                     void   *pTH;                     bool   bOK;                     HWND   hWindow;//根据这个名柄查找其可执行文件                     String  

2008-11-05 21:44:00 1207

转载 跨进程hook api的资料

 什么是“跨进程   API   Hook”?     众所周知Windows应用程序的各种系统功能是通过调用API函数来实现。API   Hook就是给系统的API附加上一段小程序,它能监视甚至控       制应用程序对API函数的调用。所谓跨进程也就是让自己的程序来控制别人程序的API调用了。         API   Hook   理论     通过对Win32   PE文件的分析(如果

2008-11-04 21:22:00 1345

水木清华破解精华.chm

如何学破解,的确是一言难尽。因为破解软件是一个很综合的技术,它不仅仅 需要掌握计算机软件硬件等各方面的知识,而且需要有极大的耐心。 我不可能再从汇编语言讲起,只好认为大家已经有汇编语言的基本知识,至少 你大概能看懂寄存器,比较,跳转,调用等语句吧,还得知道有个 debug软件。另 外,知道最常用的几个汇编代码: 90 -----> NOP (就是什么也不干啦!) 75 xx -----> JNZ xx 74 xx -----> JZ xx EB xx -----> JMP xx E9 xx -----> JMP xx EA xx -----> JMP xx (EA EB E9 是不同的跳转,长、短、中)

2008-12-05

软件加密技术内幕.chm

第1章 PE文件格式深入研究 1.1 PE文件格式格式纵览 1.1.1 区块(Section) 1.1.2 相对虚拟地址(Relative Virtual Addresses) 1.1.3 数据目录 1.1.4 输入函数(Importing Functions) 1.2 PE文件结构 1.2.1 The MS-DOS头部 1.2.2 IMAGE_NT_HEADERS头部 1.2.3 区块表(The Section Table) 1.2.4 各种块(Sections)的描述 1.2.5 输出表 1.2.6 输出转向(Export Forwarding) 1.2.7 输入表 1.2.8 绑定输入(Bound import) 1.2.9 延迟装入数据(Delayload Data) 1.2.10 资源 1.2.11 基址重定位(Base Relocations) 1.2.12 调试目录(DebugDirectory) 1.2.13 NET头部 1.2.14 TLS初始化 1.2.15 程序异常数据 第2章 PE分析工具编写 2.1 文件格式检查 2.2 FileHeader和OptionalHeader内容的读取 2.3 得到数据目录(Data Dircetory)信息 2.4 得到块表(SectionTable)信息 2.5 得到输出表(ExportTable)信息 2.6 得到输入表(ImportTable)信息 第3章 Win32 调试API 3.1 Win32调试API原理 3.1.1 调试相关函数简要说明 3.1.2 调试事件 3.1.3 如何在调试时创建并跟踪一个进程 3.1.4 最主要的循环体 3.1.5 如何处理调试事件 3.1.6 线程环境详解 3.1.7 如何在另一个进程中注入代码 3.2 利用调试API编写脱壳机 3.2.1 tElock 0.98脱壳简介 3.2.2 脱壳机的编写 3.3 利用调试API制作内存补丁 3.3.1 跨进程内存存取机制 3.3.2 Debug API机制 第4章 Windows下的异常处理 4.1 基本概念 4.1.1 Windows下的软件异常 4.1.2 未公开的可靠吗 4.2 结构化异常处理(SEH) 4.2.1 异常处理的基本过程 4.2.2 SEH的分类 4.2.3 相关API 4.2.4 SEH相关数据结构 4.3 异常处理程序设计 4.3.1 顶层(top-level)异常处理 4.3.2 线程异常处理 4.3.3 异常处理的堆栈展开(Stack unwind) 4.3.4 异常处理程序设计中的几个注意事项: 4.4 SEH的简单应用 4.4.1 Win9x下利用SEH进ring0 4.4.2 利用SEH实现对自身的单步自跟踪 4.4.3 其它应用 4.5 系统背后的秘密 4.6 VC是如何封装系统提供的SEH机制的 4.6.1 扩展的EXCEPTION_REGISTRATION级相关结构 4.6.2 数据结构组织 4.7 Windows XP下的向量化异常处理(VEH) 第5章 软件加密技术 5.1 反调试技术(Anti-Debug) 5.1.1 句柄检测 5.1.2 SoftICE后门指令 5.1.3 int68子类型 5.1.4 ICECream子类型 5.1.5 判断NTICE服务是否运行 5.1.6 INT 1 检测 5.1.7 利用UnhandledExceptionFilter检测 5.1.8 INT 41子类型 5.2 反跟踪技术(Anti-Trace) 5.2.1 断点检测 5.2.2 利用SEH反跟踪 5.2.3 SMC技术实现 5.3 反加载技术(Anti-Loader) 5.3.1 利用TEB检测 5.3.2 利用IsDebuggerPresent函数检测 5.3.3 检查父进程 5.4 反DUMP技术(Anti-Dump) 5.5 文件完整性检验 5.5.1 CRC校验实现 5.5.2 校验和(Checksum) 5.5.3 内存映像校验 5.6 反监视技术(Anti-Monitor) 5.6.1 窗口方法检测 5.6.2 句柄检测 5.7 反静态分析技术 5.7.1 扰乱汇编代码 5.7.2 花指令 5.7.3 信息隐藏 5.8 代码与数据结合技术 5.9 软件保护的若干忠告 第6章 加壳软件编写 6.1 外壳编写基础 6.1.1 判断文件是否是PE格式的EXE文件 6.1.2 文件基本数据的读入 6.1.3 额外数据保留 6.1.4 重定位数据的去除 6.1.5 文件的压缩 6.1.6 资源区块的处理 6.1.7 区块的融合 6.1.8 输入表的处理 6.1.9 外壳部分的编写 6.1.10 将外壳部分添加至原程序 6.1.10 小结 6.2 加壳程序综合运用的实例 6.2.1 程序简介 6.2.2 加壳子程序(WJQ_ShellBegin()) 6.2.3 PE外壳程序 6.2.4 加进Anti技术 6.2.5 通过外壳修改被加壳PE 6.2.6 VC++调用汇编子程序 第7章 如何让壳与程序融为一体 7.1 序 7.1.1 为何需要壳和程序一体化 7.1.2 为阅读此章节需要的知识 7.1.3 基于此章节用的的例子程序说明 7.2 欺骗检查壳的工具 7.2.1 fi是如何检查壳的 7.2.2 欺骗fi 7.3 判断自己是否给脱壳了 7.3.1 判断文件尺寸 7.3.2 检查标记 7.3.3 外部检测(使用dll) 7.3.4 hook 相关的api(防止loader和调试api) 7.4 使用sdk把程序和壳溶为一体 7.4.1 sdk的意义 7.4.2 做一个带sdk的壳 7.5 后记:关于壳和程序的思考 第8章 Visual Basic 6 逆向工程 8.1 简介 8.2 P-code传奇 8.3 VB编译奥秘 8.4 VB与COM 8.5 VB可执行程序结构研究 8.6 VB程序事件解读 8.7 VB程序图形界面(GUI)解读 8.8 VB程序执行代码研究 8.9 我们的工具 8.10 VB程序保护篇 附录A 在Visual C++中使用内联汇编 附录B 在Visual Basic中使用汇编

2008-12-05

风飘雪学员教程.CHM

第一课 壳 ************ 一.壳的概念 作者编好软件后,编译成exe可执行文件 1.有一些版权信息需要保护起来,不想让别人 随便改动,如作者的姓名等 2.需要把程序搞的小一点,从而方便使用 于是,需要用到一些软件,他们能将exe可执行文件压缩, 实现上述两个功能,这些软件称为加壳软件或压缩软件. 它不同于一般的winzip,winrar等压缩软件. 它是压缩exe可执行文件的,压缩后的文件可以直接运行. 二.加壳软件 最常见的加壳软件ASPACK ,UPX,PEcompact 不常用的加壳软件WWPACK32;PE-PACK ;PETITE ;NEOLITE 三.侦测壳和软件所用编写语言的软件 1.侦测壳的软件fileinfo.exe 简称fi.exe(侦测壳的能力极强) 使用方法: 第一种:待侦测壳的软件(如aa.exe)和fi.exe位于同一目录下,执行 windows起始菜单的运行,键入 fi aa 第二种:待侦测壳的软件(如aa.exe)和fi.exe位于同一目录下,将aa的图标拖到fi的图标上 2.侦测壳和软件所用编写语言的软件language.exe(两个功能 合为一体,很棒) 推荐language2000中文版,我的主页可下载 傻瓜式软件,运行后选取待侦测壳的软件即可(open)

2008-12-05

Think in Java 答案.chm

很好的资料! Chapter 2 Exercise 1 //: c02:E01_HelloWorld.java //+M java E01_HelloWorld /****************** Exercise 1 ****************** * Following the HelloDate.java example in this * chapter, create a "hello, world" program that * simply prints out that statement. You need * only a single method in your class (the "main" * one that gets executed when the program * starts). Remember to make it static and to * include the argument list, even though you * don't use the argument list. Compile the * program with javac and run it using java. If * you are using a different development * environment than the JDK, learn how to compile * and run programs in that environment. ***********************************************/ public class E01_HelloWorld { public static void main(String args[]) { System.out.println("Hello, world!"); } } ///:~ The +M directive tells my makefile builder tool to add this command (java HelloWorld) to the commands that it automatically runs while building the program. This way, if the execution fails for any reason then the make will abort and show that something is wrong for a particular program. This is a very simple form of built-in testing: automatically running the program to ensure no exceptions are thrown. You’ll see this on most of the programs in this solution guide, and the makefiles that come with the source code (that is packaged with this guide) will automatically run the programs. Exercise 2 //: c02:E02_ATypeName.java //+M java E02_ATypeName /****************** Exercise 2 ****************** * Find the code fragments involving ATypeName * and turn them into a program that compiles and * runs. ***********************************************/ public class E02_ATypeName { public static void main(String args[]) { E02_ATypeName a = new E02_ATypeName(); } } ///:~ Exercise 3 //: c02:E03_DataOnly.java //+M java E03_DataOnly /****************** Exercise 3 ****************** * Turn the DataOnly code fragments into a * program that compiles and runs. ***********************************************/ public class E03_DataOnly { int i; float f; boolean b; public static void main(String[] args) { E03_DataOnly d = new E03_DataOnly(); d.i = 47; d.f = 1.1f; d.b = false; } } ///:~ Exercise 4 //: c02:E04_DataOnly2.java //+M java E04_DataOnly2 /****************** Exercise 4 ****************** * Modify Exercise 3 so that the values of the * data in DataOnly are assigned to and printed * in main(). ***********************************************/ public class E04_DataOnly2 { int i; float f; boolean b; public static void main(String[] args) { E04_DataOnly2 d = new E04_DataOnly2(); d.i = 47; System.out.println("d.i = " + d.i); d.f = 1.1f; System.out.println("d.f = " + d.f); d.b = false; System.out.println("d.b = " + d.b); } } ///:~ Exercise 5 //: c02:E05_Storage.java //+M java E05_Storage /****************** Exercise 5 ****************** * Write a program that includes and calls the * storage() method defined as a code fragment in * this chapter. ***********************************************/ public class E05_Storage { String s = "Hello, World!"; int storage(String s) { return s.length() * 2; } void print() { System.out.println( "storage(s) = " + storage(s)); } public static void main(String[] args) { E05_Storage st = new E05_Storage(); st.print(); } } ///:~ You could have also made storage( ) a static method and just called it from main( ). Exercise 6 //: c02:E06_StaticFun.java //+M java E06_StaticFun /****************** Exercise 6 ****************** * Turn the StaticFun code fragments into a * working program. ***********************************************/ class StaticTest { static int i = 47; } public class E06_StaticFun { static void incr() { StaticTest.i++; } public static void main(String[] args) { E06_StaticFun sf = new E06_StaticFun(); sf.incr(); E06_StaticFun.incr(); } } ///:~

2008-11-17

MFC文档视图内幕.chm

初学VC,对文档视图编程原理始终不懂,终于找到这份资料了。真的很好!

2008-11-12

WINDOWS多线程编程.chm

刚刚才发现的,里面有好多关于多线程的资料和代码

2008-11-12

VC++技术内幕.chm

学习VC编程的必备书。位于MFC四大天王老大。足以说明它的重要性!

2008-10-27

windows编程资料大全

在编写程序的过程中,我遇到了这样的需求:在基于Windows 9x 或 Windows NT4.0 的程序中,要求确定键盘、鼠标处于空闲状态的时间。查询了有关资料文档以后,发现Windows 9x和Windows NT4.0 没有提供API或系统调用来实现这样的功能。但是,在Windows 2000中提供了一个新的函数:GetLastInputInfo(),这个函数使用结构 LASTINPUTINFO 作为参数: LASTINPUTINFO lpi; lpi.cbSize = sizeof(lpi); GetLastInputInfo(&lpi); 调用函数GetLastInputInfo()以后, 结构成员lpi.dwTime 中的值便是自上次输入事件发生以后的毫秒数。这个值也就是键盘、鼠标处于空闲状态的时间。可惜的是这个函数只能在Windows 2000中使用,Windows 9x 或Windows NT4.0不提供此API函数。那么,如何在Windows 9x 或Windows NT4.0中实现GetLastInputInfo()的功能呢?笔者的方法是利用系统钩子对键盘、鼠标进行监控。 Windows中的钩子实际上是一个回调函数,当用户有输入动作的时候,Windows要调用这个函数。比较典型的系统钩子应用就是键盘钩子和鼠标钩子: HHOOK g_hHookKbd = NULL; HHOOK g_hHookMouse = NULL; 在Windows中,一个系统(相对于一个特定进程而言)钩子必须用一个动态链接库(DLL)来实现。不妨将这个动态链接库命名为IdleUI.dll。 这个动态链接库在Windows 9x和Windows NT4.0 中实现了GetLastInputInfo()的功能。IdleUI.dll中有三个函数: BOOL IdleUIInit() void IdleUITerm(); DWORD IdleUIGetLastInputTime(); IdleUIInit()是环境初始化函数,IdleUITerm()是环境清理函数,分别在MFC应用程序的InitInstance() 和 ExitInstance()中调用它们。当用IdleUIInit()做完初始化后,就可以调用第三个函数IdleUIGetLastInputTime()来获取最后一次输入事件后的时钟。从而实现与GetLastInputInfo()一样的功能。程序TestIdleUI.exe是用来测试IdleUI动态库的,程序中调用了IdleUIInit 和 IdleUITerm,同时在程序的客户区中间显示键盘、鼠标空闲的秒数。 void CMainFrame::OnPaint() { CPaintDC dc(this); CString s; DWORD nsec = (GetTickCount() - IdleUIGetLastInputTime())/1000; s.Format( "鼠标或键盘空闲 %d 秒。",nsec); CRect rc; GetClientRect(&rc); dc.DrawText(s, &rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE); } 图一显示了TestIdleUI运行时的情形。 图一 TestIdleUI运行画面 为了连续的显示,TestIdleUI设置刷新定时器间隔为一秒。 void CMainFrame::OnTimer(UINT) { Invalidate(); UpdateWindow(); } 运行TestIdleUI,当键盘和鼠标什么也不做时,可以看到计时器跳动,当移动鼠标或按键时,计时器又恢复到零,这样就实现了对输入设备空闲状态的监控。实现细节请看下面对IdleUI.dll工作原理的描述: 首先调用IdleUIInit ()进行初始化,安装两个钩子:一个用于监控鼠标输入,一个用于监控键盘输入。 HHOOK g_hHookKbd; HHOOK g_hHookMouse; g_hHookKbd = SetWindowsHookEx(WH_KEYBOARD,MyKbdHook,hInst, 0); g_hHookMouse = SetWindowsHookEx(WH_MOUSE,MyMouseHook,hInst, 0); 当用户移动鼠标或按下键盘键时,Windows调用其中的一个钩子并且钩子函数开始记录时间: LRESULT CALLBACK MyMouseHook(in

2008-10-26

在win32下Hook系统API.txt

3.1 程序说明 当启动程序Try.EXE调用SetMouseHook()后,Windows系统将MouseHook.DLL映射入每一个有鼠标消息传入的进程地址空间。映射时将用DLL_PROCESS_ATTACH作为参数fdwReason的值调用DllEntryPoint(),DllEntryPoint()调用ModifyCall()搜索该进程对TextOutA()的调用并将其替换为调用MyTextOut()。这样当该进程调用GDI32.DLL的TextOutA()时实际调用的却是MouseHook.DLL的MyTextOut()。 ModifyCall()利用进程的HINSTANCE(也即HMODULE,对于Win32而言它们是一回事,即装载基址)找到DOS文件头结构IMAGE_DOS_HEADER,再利用IMAGE_DOS_HEADER中的e_lfanew成员找到Win32的IMAGE_NT_HEADERS结构,该结构含有动态连接所需的信息。IMAGE_NT_HEADERS中的OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]含有DLL函数引入表的RVA(相对虚拟地址)和大小。搜索该表所指向的DLL引入函数地址,值与GetProcAddress()返回值相同的单元就是对应的DLL函数地址存放单元,将MyTextOut()地址写入即可。详细情形请参阅有关PE文件格式的说明和Winnt.h中的定义。 当启动程序调用UnMouseHook()时,过程与之类似,只是此时是为了卸下WH_MOUSE全局钩子并恢复原来对TextOutA()的调用。 此处设置WH_MOUSE全局钩子的目的只是利用全局钩子的特性将MouseHook.DLL“挤进”其它进程的地址空间,因此钩子过程MouseProc()很简单,只是传递一下消息而已。 两个#pragma data_seg()编译器指令是为了定义一个名为.MouseHook的数据段(更确切地说是数据节),该数据段在MouseHook.DEF中被说明为共享,之所以如此是因为各个进程空间中的MouseProc()需要该钩子的句柄hMouseHook,而hMouseHook只在启动程序Try.EXE调用SetMouseHook()时得到一次,因此只能放在共享内存中,否则编程将变得复杂起来。至于每个进程中被替换下来的TextOutA()地址,是属于单个进程空间的,故放在局部数据中,Windows系统会为每次映射使用不同的内存。实际上,TextOutA()的引入地址在所有的进程中都是相同的,这是因为为了页面管理的简单和进程切换的效率,对每个进程Windows 9x将系统DLL映射在同一地址上,但这不是Windows对外保证的,而只是权宜之计,以后可能改变,且Windows NT的情况也可能不同。 MyTextOut()将截获的TextOutA()的参数lpText(即输出字符串)改变以后才输出,从而可以看到截获是否成功。之所以改变两个字符而不是简单的一个,是因为只改变一个字符将导致汉字输出乱码。 MyTextOut()源码中唯一的一条汇编语句__asm sub esp,14h是所有源码中最难写的语句。如果没有这条指令,MyTextOut()将无法正确返回到进程调用TextOutA()处的下一条指令上,出现的“意外”情况是:进程调用TextOutA()的最后一个参数、即输出字符串长度参数将作为返回地址从堆栈中弹出,从而使EIP为一个很小的值,程序进入Windows系统用作指针检查的低端内存,导致非法内存访问。在调试过程中发现导致这种现象的原因是MyTextOut()在临返回前使用了add esp,14h来清除并不需要清除的堆栈,从而破坏了堆栈。显然,原因在于函数调用说明使编译器产生了“错误”的堆栈管理代码,我不知道如何改正这一点,只好使用__asm sub esp,14h强行使堆栈指针指向“正确”的返回地址。有知晓个中奥妙的同志请与作者联系,多多指教。 以下程序在Windows 98、Microsoft Visual Studio 97中调试通过,由于编程中并未使用Windows 9x的特性,且程序依靠的PE文件格式在Windows 9x和Wiundows NT中是通用的,因此上述方法在Windows NT可能也是可行的,只是我并未验证(我没有装Windows NT的机器)。另外,某些方面的情况由于编译器和操作系统不同可能会有所不同(如编译器生成的指令),我的叙述会因此而偏颇甚至错误,在此先做个提醒,也欢迎来意见改进编程。

2008-10-26

windows钩子编程大全

二、API Hook的原理 这里的API既包括传统的Win32 APIs,也包括任何Module输出的函数调用。熟悉PE文件格 式的朋友都知道,PE文件将对外部Module输出函数的调用信息保存在输入表中,即.idata段。 下面首先介绍本段的结构。 输入表首先以一个IMAGE_IMPORT_DESCRIPTOR(简称IID)数组开始。每个被PE文件隐式链接 进来的DLL都有一个IID.在这个数组中的最后一个单元是NULL,可以由此计算出该数组的项数。 例如,某个PE文件从两个DLL中引入函数,就存在两个IID结构来描述这些DLL文件,并在两个 IID结构的最后由一个内容全为0的IID结构作为结束。几个结构定义如下: IMAGE_IMPORT_DESCRIPTOR struct union{ DWORD Characteristics; ;00h DWORD OriginalFirstThunk; }; TimeDateStamp DWORD ;04h ForwarderChain DWORD ;08h Name DWORD ;0Ch FirstThunk DWORD ;10h IMAGE_IMPROT_DESCRIPTOR ends typedef struct _IMAGE_THUNK_DATA{ union{ PBYTE ForwarderString; PDWORD Functions; DWORD Ordinal; PIMAGE_IMPORT_BY_NAME AddressOfData; }u1; } IMAGE_IMPORT_BY_NAME结构保存一个输入函数的相关信息: IMAGE_IMPORT_BY_NAME struct Hint WORD ? ;本函数在其所驻留DLL的输出表中的序号 Name BYTE ? ;输入函数的函数名,以NULL结尾的ASCII字符串 IMAGE_IMPORT_BY_NAME ends OriginalFirstThunk(Characteristics):这是一个IMAGE_THUNK_DATA数组的RVA(相对于PE文件 起始处)。其中每个指针都指向IMAGE_IMPORT_BY_NAME结构。 TimeDateStamp:一个32位的时间标志,可以忽略。 ForwarderChain:正向链接索引,一般为0。当程序引用一个DLL中的API,而这个API又引用别的 DLL的API时使用。 NameLL名字的指针。是个以00结尾的ASCII字符的RVA地址,如"KERNEL32.DLL"。 FirstThunk:通常也是一个IMAGE_THUNK_DATA数组的RVA。如果不是一个指针,它就是该功能在 DLL中的序号。 OriginalFirstThunk与FirstThunk指向两个本质相同的数组IMAGE_THUNK_DATA,但名称不同, 分别是输入名称表(Import Name Table,INT)和输入地址表(Import Address Table,IAT)。 IMAGE_THUNK_DATA结构是个双字,在不同时刻有不同的含义,当双字最高位为1时,表示函数以 序号输入,低位就是函数序号。当双字最高位为0时,表示函数以字符串类型的函数名 方式输入,这时它是指向IMAGE_IMPORT_BY_NAME结构的RVA。 三个结构关系如下图: IMAGE_IMPORT_DESCRIPTOR INT IMAGE_IMPORT_BY_NAME IAT -------------------- /-->---------------- ---------- ---------------- |01| 函数1 ||02| 函数2 || n| ... |"USER32.dll" | |--------------------| | | FirstThunk |---------------------------------------------------------------/ -------------------- 在PE文件中对DLL输出函数的调用,主要以这种形式出现: call dword ptr[xxxxxxxx] 或 jmp [xxxxxxxx] 其中地址xxxxxxxx就是IAT中一个IMAGE_THUNK_DATA结构的地址,[xxxxxxxx]取值为IMAGE_THUNK_DATA 的值,即IMAGE_IMPORT_BY_NAME的地址。在操作系统加载PE文件的过程中,通过IID中的Name加载相应 的DLL,然后根据INT或IAT所指向的IMAGE_IMPORT_BY_NAME中的输入函数信息,在DLL中确定函数地址, 然后将函数地址写到IAT中,此时IAT将不再指向IMAGE_IMPORT_BY_NAME数组。这样[xxxxxxxx]取到的 就是真正的API地址。 从以上分析可以看出,要拦截API的调用,可以通过改写IAT来实现,将自己函数的地址写到IAT中, 达到拦截目的。 另外一种方法的原理更简单,也更直接。我们不是要拦截吗,先在内存中定位要拦截的API的地址, 然后改写代码的前几个字节为 jmp xxxxxxxx,其中xxxxxxxx为我们的API的地址。这样对欲拦截API的 调用实际上就跳转到了咱们的API调用去了,完成了拦截。不拦截时,再改写回来就是了。 这都是自己从网上辛辛苦苦找来的,真的很好啊

2008-10-26

java多线程编程技巧

Copyright Acknowledgements Chapter 1. Concurrent Object-Oriented Programming Section 1.1. Using Concurrency Constructs Section 1.2. Objects and Concurrency Section 1.3. Design Forces Section 1.4. Before/After Patterns Chapter 2. Exclusion Section 2.1. Immutability Section 2.2. Synchronization Section 2.3. Confinement Section 2.4. Structuring and Refactoring Classes Section 2.5. Using Lock Utilities Chapter 3. State Dependence Section 3.1. Dealing with Failure Section 3.2. Guarded Methods Section 3.3. Structuring and Refactoring Classes Section 3.4. Using Concurrency Control Utilities Section 3.5. Joint Actions Section 3.6. Transactions Section 3.7. Implementing Utilities Chapter 4. Creating Threads Section 4.1. Oneway Messages Section 4.2. Composing Oneway Messages Section 4.3. Services in Threads Section 4.4. Parallel Decomposition Section 4.5. Active Objects

2008-10-25

JAVA精通事件处理程序设计

++ Swing程序设计 ++ 怎么计算中英文合并的字符串的长度 import java.io.*; public class StringTest { public static void main(String[] args) { String aString = "这是一个测试串,This is a test string."; String anotherString = null; try { anotherString = new String(aString.getBytes("GBK"), "ISO8859_1"); } catch (UnsupportedEncodingException ex) { } System.out.println(aString.length() + "," + anotherString.length()); } }

2008-10-25

Windows游戏编程大师技巧

第一部分 Windows编程基础   第一章 无尽之旅    历史一瞥    设计游戏    游戏类型    集思广益    设计文档和情节图板    使游戏具有趣味性    游戏的构成    常规游戏编程指导    使用工具    从准备到完成一使用编译器    实例:FreakOut    总结   第二章 Windows编程模型    Windows的历史    多任务和多线程    按照Microsoft方式编程:匈牙利符号表示法    世界上最简单的Windows程序    真实的Windows应用程序    Windows类    注册Windows类    创建窗口    事件处理程序    主事件循环    产生一个实时事件循环    打开多个窗口    总结   第三章 高级Windows编程    使用资源    使用菜单编程    图形设备接口GDI介绍    处理重要事件    将消息传递给自己    总结   第四章 WindowsGDI、控件和突发奇想    高级GDI图形    点、线、平面多边形和圆    关于文本和字体    定时的重要性    使用控件    获取信息    T3D游戏控制程序    总结   第二部分 DirectX和2D基础   第五章 DirectX基础和令人生畏的COM    DirectX基础    COM:这是Microsoft的工作,还是魔鬼的?    应用DirectXCOM对象    COM的前景    总结   第六章 首次接触:DirectDraw    DirectDraw界面    创建DirecDraw对象    和Windows协同工作    进入事件模式    巧妙的色彩    创建一个显示画面    总结   第七章 高级DirectDraw和位图图形    真彩色模式下工作    双缓冲    动态画面    页面变换    应用图形变换器    剪切基础    采用位图    备用画面    位图的放旋转和缩放    离散采样理论    色彩效果    人工色彩变换或者查询表    新的DirectX色彩和Gamma控制接口    GDI和DirectX混合使用    获取DirectDraw的真用    在画面上冲浪    使用调色板    在窗口模式下应用DirectDraw    总结   第八章 矢量光栅化及2D变换    绘制线条    线框多边形    2D平面的变换    矩阵引论    变换    缩放    旋转    填充实心多边形    多边形碰撞检测    定时与同步说解    滚动和视角场景    伪3D等角引擎    T3DLIB1库函数    BOB(变换对象)引擎    总结   第九章 用DirectInput和力反馈进行输入    输入循环回顾    DirectInput序曲    力反馈详述    编写通用的输入系统:T3DLIB2CPP    总结   第十章 用DriectSound和DirectMusic演奏乐曲    PC上的声音编程    声音产生的原因    数字与MIDI——发声大,填充少    发声硬件    数字化记录:工具和技术    DirectSound中的麦克风    启动DirectSound    主要与辅助的声音缓冲    播放声音    用DirectSound反馈信息    读取磁盘中数据    DirectMusic:伟大的试验    DirectMusic的结构    启动DirectMusic    加载MIDI段    操作MIDI段    T3DLIB3声音和音乐库    DirectSound API封装    总结   第三部分 编程核心   第十一章 算法、数据结构、内存管理及多线程    数据结构    算法分析    递归    树结构    优化理论    制作演示程序    保存游戏的策略    实现多人游戏    多线程编程技术    总结   第十二章 人工智能在游戏中的运用    人工智能入门    明确AI算法    模式和基础控制脚本    行为状态系统建模    应用软件对存储和学习建模    计划和决策树    导航    高级AI脚本    人工神经网络    遗传算法    模糊逻辑    在游戏中创建真正的AI    小结   第十三章 基本物理建模    物理学基本定律    线性动量的物理性质:守恒和传递    万有引力效果模型    磨擦力    基本的特殊碰撞响应(高级)    解决n-t坐标系统    简单运动学    微粒系统    游戏关键:创建游戏的物理模型    总结   第十四章 综合运用    Outpost的初步设计    编制游戏的工具    游戏领域:空间滚动    游戏者的飞船“鬼怪号”    行星领域    敌人    供给能量    HUD    微粒系统    执行游戏    编译Outpost    结束语

2008-10-25

vc编程经验总结.chm

CSDN VC编程经验总结 Version 1.0 Update 2004-03-09 此 CHM 文档的内容均为 CSDN 众网友共同收集而来,由网友们于 2004 年 3 月 7 日在 www.csdn.net 网站 VC/MFC 版的非技术类论坛上正式提出整理工作的倡议,经王国凡同志(sgnaw 李逍遥)整理而成,以供大家工作学习参考之用。 我自认为是一个比较热心的人,经常帮助同学同事们解决 IT 方面的问题,有时也逛逛 CSDN。我在武汉出身,也在武汉工作三年了,希望将来能为 IT 业的发展作出贡献。整理工作虽然辛苦,但也快乐,错漏之处再所难免,如有建议或意见请联系 [email protected]

2008-10-25

windows系统编程英文版

Copyright Praise for Windows System Programming, Third Edition Figures Tables Programs Preface Audience Changes in the Third Edition Organization UNIX and C Library Notes and Tables Examples The Web Site Acknowledgments Chapter 1. Getting Started with Win32 and Win64 Operating System Essentials Windows Evolution Windows Versions The Windows Market Role Windows, Standards, and Open Systems Windows Principles Getting Ready for Win64 The Standard C Library: When to Use It for File Processing What You Need to Use This Book Example: A Simple Sequential File Copy Summary Exercises Chapter 2. Using the Windows File System and Character I/O The Windows File Systems File Naming Opening, Reading, Writing, and Closing Files Interlude: Unicode and Generic Characters Unicode Strategies Standard Devices and Console I/O Example: Printing and Prompting Example: Error Processing Example: Copying Multiple Files to Standard Output Example: ASCII to Unicode Conversion File and Directory Management Example: Printing the Current Directory Summary Exercises Chapter 3. Advanced File and Directory Processing, and the Registry The 64-Bit File System File Pointers Getting the File Size Example: Random Record Updates File Attributes and Directory Processing Mount Points Example: Listing File Attributes Example: Setting File Times File Processing Strategies File Locking The Registry Registry Management Example: Listing Registry Keys and Contents Summary Exercises Chapter 4. Exception Handling Exceptions and Their Handlers Floating-Point Exceptions Errors and Exceptions Example: Treating Errors as Exceptions Termination Handlers Example: Using Termination Handlers to Improve Program Quality Example: Using a Filter Function Console Control Handlers Example: A Console Control Handler Vectored Exception Handling Summary Exercises Chapter 5. Memory Management, Memory-Mapped Files, and DLLs Win32 and Win64 Memory Management Architecture Heaps Managing Heap Memory Example: Sorting Files with a Binary Search Tree Memory-Mapped Files Example: Sequential File Processing with Mapped Files Example: Sorting a Memory-Mapped File Example: Using Based Pointers Dynamic Link Libraries Example: Explicitly Linking a File Conversion Function The DLL Entry Point DLL Version Management Summary Exercises Chapter 6. Process Management Windows Processes and Threads Process Creation Process Handle Counts Process Identities Duplicating Handles Exiting and Terminating a Process Waiting for a Process to Terminate Environment Blocks and Strings Example: Parallel Pattern Searching Processes in a Multiprocessor Environment Process Execution Times Example: Process Execution Times Generating Console Control Events Example: Simple Job Management Job Objects Summary Exercises Chapter 7. Threads and Scheduling Thread Overview Thread Basics Thread Management Using the C Library in Threads Example: Multithreaded Pattern Searching Performance Impact The Boss/Worker and Other Threading Models Example: Merge-SortDivide and Conquer to Exploit SMP Thread Local Storage Process and Thread Priority and Scheduling Thread States Pitfalls and Common Mistakes Timed Waits Fibers Summary Exercises Chapter 8. Thread Synchronization The Need for Thread Synchronization Thread Synchronization Objects The CRITICAL_SECTION Object A CRITICAL_SECTION for Protecting Shared Variables Example: A Simple Producer/Consumer System Mutexes Semaphores Events Example: A Producer/Consumer System More Mutex and CRITICAL_SECTION Guidelines More Interlocked Functions Memory Management Performance Considerations Summary Exercises Chapter 9. Synchronization Performance Impact and Guidelines Synchronization Performance Impact A Model Program for Performance Experimentation Tuning SMP Performance with CS Spin Counts Semaphore "Throttles" to Reduce Thread Contention Processor Affinity I/O Completion Ports Performance Guidelines and Pitfalls Summary Exercises Chapter 10. Advanced Thread Synchronization The Condition Variable Model and Safety Properties Using SignalObjectAndWait Example: A Threshold Barrier Object A Queue Object Example: Using Queues in a Multistage Pipeline Asynchronous Procedure Calls Queuing Asynchronous Procedure Calls Alertable Wait States Safe Thread Cancellation Pthreads for Application Portability Thread Stacks and the Number of Threads Hints for Designing, Debugging, and Testing Beyond the Windows API Summary Exercises Chapter 11. Interprocess Communication Anonymous Pipes Example: I/O Redirection Using an Anonymous Pipe Named Pipes Named Pipe Transaction Functions Example: A Client/Server Command Line Processor Comments on the Client/Server Command Line Processor Mailslots Pipe and Mailslot Creation, Connection, and Naming Example: A Server That Clients Can Locate Comments on Thread Models Summary Exercises Chapter 12. Network Programming with Windows Sockets Windows Sockets Socket Server Functions Socket Client Functions Comparing Named Pipes and Sockets Example: A Socket Message Receive Function Example: A Socket-Based Client Example: A Socket-Based Server with New Features In-Process Servers Line-Oriented Messages, DLL Entry Points, and TLS Example: A Thread-Safe DLL for Socket Messages Example: An Alternative Thread-Safe DLL Strategy Datagrams Berkeley Sockets vs. Windows Sockets Overlapped I/O with Windows Sockets Windows Sockets 2 Summary Exercises Chapter 13. Windows Services Writing Windows ServicesOverview The main() Function The ServiceMain() Functions The Service Control Handler Example: A Service "Wrapper" Managing Windows Services Summary: Service Operation and Management Example: A Service Control Shell Sharing Kernel Objects with a Service Event Logging Notes on Debugging a Service Summary Exercises Chapter 14. Asynchronous Input/Output and Completion Ports Overview of Windows Asynchronous I/O Overlapped I/O Example: Synchronizing on a File Handle Example: File Conversion with Overlapped I/O and Multiple Buffers Extended I/O with Completion Routines Example: File Conversion with Extended I/O Asynchronous I/O with Threads Waitable Timers Example: Using a Waitable Timer I/O Completion Ports Example: A Server Using I/O Completion Ports Summary Exercises Chapter 15. Securing Windows Objects Security Attributes Security Overview: The Security Descriptor Security Descriptor Control Flags Security Identifiers Managing ACLs Example: UNIX-Style Permission for NTFS Files Example: Initializing Security Attributes Reading and Changing Security Descriptors Example: Reading File Permissions Example: Changing File Permissions Securing Kernel and Communication Objects Example: Securing a Process and Its Threads Overview of Additional Security Features Summary Exercises Chapter 16. Win64 Programming Current Win64 Status 64-Bit Architecture Overview The Win64 Programming Model The Data Types Legacy Code Migration Example: Migrating sortMM (Program 5-5) Summary Exercises Appendix A. Using the Sample Programs Web Site Organization Include File Listings Additional Utility Programs Appendix B. Windows, UNIX, and C Library Comparisons Chapters 2 and 3: File and Directory Management Chapter 4: Exception Handling Chapter 5: Memory Management, Memory-Mapped Files, and DLLs Chapter 6: Process Management Chapter 7: Threads and Scheduling Chapters 810: Thread Synchronization Chapter 11: Interprocess Communication Chapter 14: Asynchronous I/O Chapter 15: Securing Windows Objects Appendix C. Performance Results Test Configurations Performance Measurements Running the Tests Bibliography Index

2008-10-25

Windows环境下32位汇编语言.chm

Windows环境下32位汇编语言是一种全新的编程语言。它使用与C++语言相同的API接口,不仅可以用来开发出大型的软件,而且是了解操作系统运行细节的最佳方式。本书从编写应用程序的角度,从“Hello World!”这个简单的例子开始到编写多线程、注册表和网络通信等复杂的程序,通过60多个实例逐渐深入Win32汇编语言的方方面面。本书作者罗云彬拥有十余年汇编语言编程经验,是汇编编程网站http://asm.yeah.net和汇编编程论坛http://win32asm.yeah.net的站长。本书是作者多年来编程工作的总结,适合于欲通过Win32汇编语言编写Windows程序的读者。

2008-10-25

Windows程序设计英文版

This book shows you how to write programs that run under Microsoft Windows 98, Microsoft Windows NT 4.0, and Windows NT 5.0. These programs are written in the C programming language and use the native Windows application programming interfaces (APIs). As I'll discuss later in this chapter, this is not the only way to write programs that run under Windows. However, it is important to understand the Windows APIs regardless of what you eventually use to write your code. As you probably know, Windows 98 is the latest incarnation of the graphical operating system that has become the de facto standard for IBM-compatible personal computers built around 32-bit Intel microprocessors such as the 486 and Pentium. Windows NT is the industrial-strength version of Windows that runs on PC compatibles as well as some RISC (reduced instruction set computing) workstations.

2008-10-25

windows核心编程英文版

Introduction Microsoft Windows is a complex operating system. It offers so many features and does so much that it's impossible for any one person to fully understand the entire system. This complexity also makes it difficult for someone to decide where to start concentrating the learning effort. Well, I always like to start at the lowest level by gaining a solid understanding of the system's basic building blocks. Once you understand the basics, it's easy to incrementally add any higher-level aspects of the system to your knowledge. For example, I don't explicitly discuss the Component Object Model (COM) in this book. But COM is an architecture built using processes, threads, memory management, DLLs, thread local storage, Unicode, and so on. If you know these basic building blocks, understanding COM is just a matter of understanding how the building blocks are used. I have great sympathy for people who attempt to jump-start into learning COM's architecture. They have a long road ahead and are bound to have gaping holes in their knowledge, which is bound to negatively affect their code and their schedules. So that's what this book is all about: the basic Windows building blocks that every Windows developer (at least in my opinion) should be intimately aware of. As each block is discussed, I also describe how the system uses these blocks and how your own applications can best take advantage of these blocks. In many chapters, I show you how to create building blocks of your own. These building blocks, typically implemented as generic functions or C++ classes, group a set of Windows building blocks together to create a whole that is much greater than the sum of its parts.

2008-10-25

深入理解LINUX内核英文版

是学习操作系统原理的好书。讲解了LINUX操作实现原理

2008-09-08

Undocumented Windows NT

深入解析了WINDOWS的内部机制,hook NATIVE APi

2008-09-08

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除