首页
社区
课程
招聘
[旧帖] [求助]内联汇编的问题 0.00雪花
发表于: 2008-10-6 12:07 7174

[旧帖] [求助]内联汇编的问题 0.00雪花

2008-10-6 12:07
7174
各位大哥,帮小弟看看下面的程序错在那里,怎样改:算法很简单,就想搞明白为什么不可以
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
void main()
{
  int len,i;
  int EBP_40,a2,EBP_44,EBP_38,EBP_4C,EBP_48,EBP_54,EBP_50;
  int EDI=0x64F4F0;
  char name[50]={0};
  printf("Please input your name:");
  scanf("%s",name);
  _asm
  {
  lea EDX,offset[name]
  ADD dword ptr[EBP-3C],EDX     //

  ADD DWORD PTR SS:[EBP-3C],EDX
  MOV EAX,EDX
  ADD EAX,5
  MOV DWORD PTR SS:[EBP-48],EAX
  XOR EAX,EAX
  MOV ECX,EDI
  ADD ECX,4
  MOV DWORD PTR SS:[EBP-4C],ECX
  XOR ECX,ECX
  ADD DWORD PTR SS:[EBP-44],EDX
  ADD DWORD PTR SS:[EBP-44],EDI
  IMUL EDI,EDI,3
  MOV DWORD PTR SS:[EBP-40],EDI
  XOR EDI,EDI
  MOVSX ECX,BYTE PTR SS:[EBP+EAX-BC]
  CMP ECX,61
  JL L024
  NOP
  NOP
  NOP
  NOP
  SUB ECX,20
L024:
  MOV ESI,ECX
  ADD EBX,ESI
  IMUL EBX,ECX
  DEC EDX
L028:
  MOVSX ECX,BYTE PTR DS:[EDI+EBP-BC]
  MOVSX ESI,BYTE PTR DS:[EDI+EBP-BB]
  CMP ECX,61
  JGE L046
  NOP
  NOP
  NOP
  NOP
L036:
  CMP ESI,61
  JGE L048
  NOP
  NOP
  NOP
  NOP
  JMP L049
  NOP
  NOP
  NOP
L046:
  SUB ECX,20
  JMP L036
L048:
  SUB ESI,20
L049:
  INC EDI
  ADD EBX,ESI
  IMUL EBX,ECX
  DEC EDX
  JNZ L028
  MOV DWORD PTR SS:[EBP-38],EBX
  XOR ECX,ECX
  XOR EDX,EDX
  XOR EBX,EBX
  XOR EAX,EAX
  CMP DWORD PTR SS:[EBP-2C],32
  JGE k4n2.0040122F
L061:
  MOVSX EAX,BYTE PTR SS:[EBP+ECX-BC]
  ADD EAX,ECX
  ADD EBX,EAX
  INC ECX
  CMP ECX,DWORD PTR SS:[EBP-2C]
  JNZ L061
  ROL EAX,1
  XOR EAX,1E240
  MOV DWORD PTR SS:[EBP-50],EAX
  XOR ECX,ECX
  XOR EDX,EDX
  XOR EBX,EBX
  XOR EAX,EAX
L074:
  MOVSX EAX,BYTE PTR SS:[EBP+ECX-BC]
  IMUL EDX,EAX,6
  XOR EAX,EDX
  ADD EBX,EAX
  INC ECX
  CMP ECX,DWORD PTR SS:[EBP-2C]
  JNZ L074
  ADD EBX,DWORD PTR SS:[EBP-50]
  MOV DWORD PTR SS:[EBP-54],EBX
  }

  printf("Your password is: %lX%lu-%lu%lX-%lu%lu-%lX%lX\n",
    EBP_50,EBP_54,EBP_48,EBP_4C,EBP_38,EBP_44,EBP_3C,EBP_40);
  printf("KeyGen by RoBa  Enjoy Cracking!\n");
}

还有下面的错误提示可不以可说说为什么?
-Configuration: k4n2 - Win32 Debug--------------------
Compiling...
k4n2.cpp
c:\documents and settings\administrator\桌面\k4n2.cpp(15) : error C2415: improper operand type
c:\documents and settings\administrator\桌面\k4n2.cpp(15) : error C2415: improper operand type
c:\documents and settings\administrator\桌面\k4n2.cpp(15) : error C2041: illegal digit 'C' for base '10'
c:\documents and settings\administrator\桌面\k4n2.cpp(17) : error C2041: illegal digit 'C' for base '10'
c:\documents and settings\administrator\桌面\k4n2.cpp(24) : error C2041: illegal digit 'C' for base '10'
c:\documents and settings\administrator\桌面\k4n2.cpp(31) : error C2425: '-' : non-constant expression in 'second operand'
c:\documents and settings\administrator\桌面\k4n2.cpp(45) : error C2425: '-' : non-constant expression in 'second operand'
c:\documents and settings\administrator\桌面\k4n2.cpp(46) : error C2425: '-' : non-constant expression in 'second operand'
c:\documents and settings\administrator\桌面\k4n2.cpp(80) : error C2041: illegal digit 'C' for base '10'
c:\documents and settings\administrator\桌面\k4n2.cpp(81) : error C2400: inline assembler syntax error in 'second operand'; found 'constant'
c:\documents and settings\administrator\桌面\k4n2.cpp(82) : error C2400: inline assembler syntax error in 'opcode'; found 'constant'
c:\documents and settings\administrator\桌面\k4n2.cpp(83) : error C2425: '-' : non-constant expression in 'second operand'
c:\documents and settings\administrator\桌面\k4n2.cpp(87) : error C2041: illegal digit 'C' for base '10'
c:\documents and settings\administrator\桌面\k4n2.cpp(90) : error C2041: illegal digit 'E' for base '10'
c:\documents and settings\administrator\桌面\k4n2.cpp(97) : error C2425: '-' : non-constant expression in 'second operand'
c:\documents and settings\administrator\桌面\k4n2.cpp(102) : error C2041: illegal digit 'C' for base '10'
c:\documents and settings\administrator\桌面\k4n2.cpp(129) : error C2065: 'EBP_3C' : undeclared identifier
执行 cl.exe 时出错.

k4n2.obj - 1 error(s), 0 warning(s)

小弟在此先谢过了。

[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 293
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
按照提示改就行了
lea EDX,offset[name] 改成 lea EDX,name
ADD dword ptr[EBP-3C],EDX 改成 ADD dword ptr[EBP-0x3C],EDX

把里面所有的16进制前面都加上0x

EBP_3C 没有定义

JGE k4n2.0040122F,这里看情况,自己写一个Label,然后改一下,让他跳到那个Label
2008-10-6 13:09
0
雪    币: 201
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
不行啊,
还有下面这句不能通过编译:
MOVSX EAX,BYTE PTR SS:[EBP+ECX-BC]
老是说什么第二个操作数是非恒量
2008-10-7 08:12
0
雪    币: 247
活跃值: (11)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
BYTE PTR SS:[EBP+ECX-0x0BC]
2008-10-7 08:47
0
游客
登录 | 注册 方可回帖
返回
//