简体   繁体   English

ASM到C - 有人可以解释一下这是什么结构吗?

[英]ASM to C - Can someone explain me what structure this is?

I am having the following ASM code (OllyDbg) which should contain a structure developed in c. 我有以下ASM代码(OllyDbg),它应该包含在c中开发的结构。 Can someone tell me how the structure looks like in c programming language? 有人能告诉我结构在c编程语言中是怎么样的吗? Maybe with a little explanation how you figured out what is stored where in the structure and so on... 也许稍微解释一下你如何弄清楚结构中存储的内容等等......

Thank you very much! 非常感谢你!

CPU Disasm
Address   Hex dump          Command                           Comments
6A27F058  /$  68 E9A6286A   PUSH 6A28A6E9                     ; Entry point
6A27F05D  |.  64:FF35 00000 PUSH DWORD PTR FS:[0]
6A27F064  |.  8B4424 10     MOV EAX,DWORD PTR SS:[ESP+10]
6A27F068  |.  896C24 10     MOV DWORD PTR SS:[ESP+10],EBP
6A27F06C  |.  8D6C24 10     LEA EBP,[ESP+10]
6A27F070  |.  2BE0          SUB ESP,EAX
6A27F072  |.  53            PUSH EBX
6A27F073  |.  56            PUSH ESI
6A27F074  |.  57            PUSH EDI
6A27F075  |.  A1 E067336A   MOV EAX,DWORD PTR DS:[6A3367E0]
6A27F07A  |.  3145 FC       XOR DWORD PTR SS:[EBP-4],EAX
6A27F07D  |.  33C5          XOR EAX,EBP
6A27F07F  |.  50            PUSH EAX
6A27F080  |.  8965 E8       MOV DWORD PTR SS:[EBP-18],ESP
6A27F083  |.  FF75 F8       PUSH DWORD PTR SS:[EBP-8]
6A27F086  |.  8B45 FC       MOV EAX,DWORD PTR SS:[EBP-4]
6A27F089  |.  C745 FC FEFFF MOV DWORD PTR SS:[EBP-4],-2
6A27F090  |.  8945 F8       MOV DWORD PTR SS:[EBP-8],EAX
6A27F093  |.  8D45 F0       LEA EAX,[EBP-10]
6A27F096  |.  64:A3 0000000 MOV DWORD PTR FS:[0],EAX
6A27F09C  \.  C3            RETN

This is the function __SEH_prolog4 which is a compiler helper used to set up per-function exception handler. 这是函数__SEH_prolog4 ,它是用于设置每个函数异常处理程序的编译器帮助程序。 Here's the listing from the library (RunTmChk.lib/sehprolg4.obj): 这是库中的列表(RunTmChk.lib / sehprolg4.obj):

.text:00000000                   __SEH_prolog4   proc near
.text:00000000
.text:00000000                   arg_4           = dword ptr  8
.text:00000000
.text:00000000 68 60 00 00 00      push    offset __except_handler4
.text:00000005 64 FF 35 00 00 00+  push    large dword ptr fs:0
.text:0000000C 8B 44 24 10         mov     eax, [esp+8+arg_4]
.text:00000010 89 6C 24 10         mov     [esp+8+arg_4], ebp
.text:00000014 8D 6C 24 10         lea     ebp, [esp+8+arg_4]
.text:00000018 2B E0               sub     esp, eax
.text:0000001A 53                  push    ebx
.text:0000001B 56                  push    esi
.text:0000001C 57                  push    edi
.text:0000001D A1 64 00 00 00      mov     eax, ds:___security_cookie
.text:00000022 31 45 FC            xor     [ebp-4], eax
.text:00000025 33 C5               xor     eax, ebp
.text:00000027 50                  push    eax
.text:00000028 89 65 E8            mov     [ebp-18h], esp
.text:0000002B FF 75 F8            push    dword ptr [ebp-8]
.text:0000002E 8B 45 FC            mov     eax, [ebp-4]
.text:00000031 C7 45 FC FE FF FF+  mov     dword ptr [ebp-4], 0FFFFFFFEh
.text:00000038 89 45 F8            mov     [ebp-8], eax
.text:0000003B 8D 45 F0            lea     eax, [ebp-10h]
.text:0000003E 64 A3 00 00 00 00   mov     large fs:0, eax
.text:00000044 C3                  retn
.text:00000044                   __SEH_prolog4   endp

See here for more details. 有关详细信息,请参见此处

This is not code written by the programmer, you're looking in the wrong place. 这不是程序员编写的代码,你看错了地方。

If this is really your code, you can make OllyDbg display the corresponding C code by rightclicking into the CPU window, entering the Comments submenu and selecting Show source . 如果这确实是您的代码,您可以通过右键单击CPU窗口,进入“ Comments子菜单并选择“ Show source ,使OllyDbg显示相应的C代码。 To make that work you'll need the pdb file belonging to the executable. 要完成这项工作,您需要属于可执行文件的pdb文件。

I'm unsure if Olly1.X does already support that, but the 2.X versions are definitely able to do so. 我不确定Olly1.X是否已经支持,但2.X版本肯定能够这样做。

I'm not entirely sure, it's been a while since I've looked at C/ASM. 我不完全确定,因为我看过C / ASM已经有一段时间了。 But here are some thoughts after taking a glance. 但是在看了一眼之后,这里有一些想法。 Keep in mind, I wouldn't rely on this too heavily, but it may help. 请记住,我不会过分依赖它,但它可能有所帮助。

Looking at this section of ASM: 看看ASM的这一部分:

6A27F07F  |.  50            PUSH EAX
6A27F080  |.  8965 E8       MOV DWORD PTR SS:[EBP-18],ESP
6A27F083  |.  FF75 F8       PUSH DWORD PTR SS:[EBP-8]
6A27F086  |.  8B45 FC       MOV EAX,DWORD PTR SS:[EBP-4]
6A27F089  |.  C745 FC FEFFF MOV DWORD PTR SS:[EBP-4],-2
6A27F090  |.  8945 F8       MOV DWORD PTR SS:[EBP-8],EAX
6A27F093  |.  8D45 F0       LEA EAX,[EBP-10]

Based on the frame pointer offsets, I'm guessing the structure contains 2 INT's and 1 LONG or DOUBLE. 基于帧指针偏移,我猜测结构包含2个INT和1个LONG或DOUBLE。

Unfortunately, I'm not currently fluent enough in X86 to give you better clarification. 不幸的是,我目前在X86中不够流利,无法为您提供更好的说明。 Again, I wouldn't rely on this too heavily as I could be completely wrong. 同样,我不会过分依赖这一点,因为我可能完全错了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM