首页
社区
课程
招聘
[讨论]VC编译加上 /hotpatch 可插花?
发表于: 2007-9-24 21:32 5762

[讨论]VC编译加上 /hotpatch 可插花?

2007-9-24 21:32
5762
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

                C/C++ COMPILER OPTIONS

                    -OPTIMIZATION-

/O1 minimize space               /O2 maximize speed
/Ob<n> inline expansion (default n=0)   /Od disable optimizations (default)
/Og enable global optimization       /Oi[-] enable intrinsic functions
/Os favor code space             /Ot favor code speed
/Ox maximum optimizations           /Oy[-] enable frame pointer omission

                  -CODE GENERATION-

/GF enable read-only string pooling   /Gm[-] enable minimal rebuild
/Gy[-] separate functions for linker   /GS[-] enable security checks
/GR[-] enable C++ RTTI             /GX[-] enable C++ EH (same as /EHsc)
/EHs enable C++ EH (no SEH exceptions) /EHa enable C++ EH (w/ SEH exceptions)
/EHc extern "C" defaults to nothrow
/fp:<except[-]|fast|precise|strict> choose floating-point model:
  except[-] - consider floating-point exceptions when generating code
  fast - "fast" floating-point model; results are less predictable
(press <return> to continue)
  precise - "precise" floating-point model; results are predictable
  strict - "strict" floating-point model (implies /fp:except)
/GL[-] enable link-time code generation /GA optimize for Windows Application
/Ge force stack checking for all funcs /Gs[num] control stack checking calls
/Gh enable _penter function call     /GH enable _pexit function call
/GT generate fiber-safe TLS accesses   /RTC1 Enable fast checks (/RTCsu)
/RTCc Convert to smaller type checks   /RTCs Stack Frame runtime checking
/RTCu Uninitialized local usage checks
/clr[:option] compile for common language runtime, where option is:
  pure - produce IL-only output file (no native executable code)
  safe - produce IL-only verifiable output file
  oldSyntax - accept the Managed Extensions syntax from Visual C++ 2002/2003
  initialAppDomain - enable initial AppDomain behavior of Visual C++ 2002
  noAssembly - do not produce an assembly
/Gd __cdecl calling convention       /Gr __fastcall calling convention
/Gz __stdcall calling convention     /GZ Enable stack checks (/RTCs)
/QIfist[-] use FIST instead of ftol()
/hotpatch ensure function padding for hotpatchable images
/arch:<SSE|SSE2> minimum CPU architecture requirements, one of:
  SSE - enable use of instructions available with SSE enabled CPUs
  SSE2 - enable use of instructions available with SSE2 enabled CPUs

                    -OUTPUT FILES-

(press <return> to continue)

maybe you can use /hotpatch switch. [s:7]

[课程]Linux pwn 探索篇!

收藏
免费 0
支持
分享
最新回复 (4)
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
不知插花没插花,加上/hotpatch后的确有变化

(1)没加/hotpatch时:
_ ; int __cdecl main(int argc,const char **argv,const char *envp)
.text:00401000 _main           proc near               ; CODE XREF: __tmainCRTStartup+10Ap
.text:00401000                 push    offset aHelloJ  ; "hello 鸡蛋壳"
.text:00401005                 call    ds:__imp__printf
.text:0040100B                 add     esp, 4
.text:0040100E                 xor     eax, eax
.text:00401010                 retn
.text:00401010 _main           endp
.text:00401010

(2)加上/hotpatch时:
; int __cdecl main(int argc,const char **argv,const char *envp)
.text:00401010 _main           proc near               ; CODE XREF: ___tmainCRTStartup+15Ap
.text:00401010
.text:00401010 argc            = dword ptr  8
.text:00401010 argv            = dword ptr  0Ch
.text:00401010 envp            = dword ptr  10h
.text:00401010
.text:00401010                 mov     edi, edi
.text:00401012                 push    ebp
.text:00401013                 mov     ebp, esp
.text:00401015                 push    offset aHelloJ  ; "hello 鸡蛋壳"
.text:0040101A                 call    sub_40102B
.text:0040101F                 add     esp, 4
.text:00401022                 xor     eax, eax
.text:00401024                 pop     ebp
.text:00401025                 retn
.text:00401025 _main           endp
.text:00401025
2007-9-25 19:00
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
仅仅是为了微软打补丁方便吧,当然也为inline hook方便
2007-9-25 19:10
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
应该是这个样子的,解释上也说得比较清楚了。

主要是在函数调用之前插一些无关紧要的指令(当然在函数调用之后要平衡),以方便以后在这个函数调用之前插入JMP指令,而不至于破坏原来的代码结构。
2007-9-28 10:10
0
雪    币: 424
活跃值: (10)
能力值: ( LV9,RANK:850 )
在线值:
发帖
回帖
粉丝
5
插不了花。。。
2007-9-29 10:58
0
游客
登录 | 注册 方可回帖
返回
//