这串分隔字符的代码有错吗:
getline(cin,n);
len=n.length()-1;
string temps_to_n_44_temp;
cout<<n.length()<<endl;
int sp=9;
for(int i=0;i<=len;i+=sp)
{
if(i+sp>len)
{
string temps;
temps=n.substr(i,len-i);
temps_to_n_44_temp+=temps;
break;
}
else
{
string temps;
temps=n.substr(i,sp);
temps_to_n_44_temp+=temps;
cout<<temps_to_n_44_temp<<endl;
}
}
n=temps_to_n_44_temp;
cout<<n;
参考GPT和自己的思路:这段代码没有语法错误,但是存在逻辑错误。在第6行的for循环中,步长(sp)应该是可变的,以使得最后一段字符串长度不会超过指定的分隔长度。而在代码中,步长固定为9,这可能会导致最后一段字符串长度超过分隔长度。另外,在第3行,变量名中的下划线可能是因为在编辑器中没有正确显示空格所致,应该修改为"temps_to_n_44_temp"。
SetDisplayMode方法是一个接口(虚函数),是通过DirectDrawCreate创建的类对象进行访问的,没法直接下断点
上述逆向的过程中,因为有debug调试信息作为参考,所以很快定位到了该函数,那么如果没有信息提示的情况下,如何快速定位该函数地址呢?
答案是编写代码反汇编自己的代码 去定位 SetDisplayMode 函数的地址
如图我们可以得到SetDisplayMode 的函数地址是66618220,在OD中查看,此时依然很快可以得到关键代码段,如下所示