Guest_imported
New member
- Jan 1, 1970
- 0
I am trying to call a VB callback function from my VC++ program. The VB callback looks like this:
Public Function PacketRetriever(ByVal src_mac As String)
Form1.Label1 = Right(src_mac, 1)
End Function
I originally tried sending back the string from VC++ as a char*, then as a LPSTR, and finally found advice on MS TechNet that said I should send back a BSTR.
I still get an Access Violation, the assembly source being:
660243FF push dword ptr [edx-4]
(edx = 0x14)
Can anyone help with this? I am attempting to write a firewall like ZoneAlarm that will protect my entire network from outside IPs sending SYN packets. The offending code is in a worker thread that receives packets from the NIC, and is as follows:
void dispatcher_handler(u_char *temp1, const struct pcap_pkthdr *header, const u_char *pkt_data)
{
myPacket thePacket;
static BSTR src_mac_address;
static char dest_mac_address;
src_mac_address = (BSTR)malloc(21);
vswprintf(src_mac_address,L"100.200.300.400","%s"
Beep(500,1);
BSTR test = SysAllocString(src_mac_address);
PacketCallback( test );
}
I'm probably doing all kinds of stuff wrong because I haven't dealt with BSTR types before. I'm also faking the IP currently (instead of reading it from the packet).
Any help would be GREATLY appreciated, and will get an honorable mention in the final product (and a free copy!)
Regards,
Chris
cregister@yahoo.com
Public Function PacketRetriever(ByVal src_mac As String)
Form1.Label1 = Right(src_mac, 1)
End Function
I originally tried sending back the string from VC++ as a char*, then as a LPSTR, and finally found advice on MS TechNet that said I should send back a BSTR.
I still get an Access Violation, the assembly source being:
660243FF push dword ptr [edx-4]
(edx = 0x14)
Can anyone help with this? I am attempting to write a firewall like ZoneAlarm that will protect my entire network from outside IPs sending SYN packets. The offending code is in a worker thread that receives packets from the NIC, and is as follows:
void dispatcher_handler(u_char *temp1, const struct pcap_pkthdr *header, const u_char *pkt_data)
{
myPacket thePacket;
static BSTR src_mac_address;
static char dest_mac_address;
src_mac_address = (BSTR)malloc(21);
vswprintf(src_mac_address,L"100.200.300.400","%s"
Beep(500,1);
BSTR test = SysAllocString(src_mac_address);
PacketCallback( test );
}
I'm probably doing all kinds of stuff wrong because I haven't dealt with BSTR types before. I'm also faking the IP currently (instead of reading it from the packet).
Any help would be GREATLY appreciated, and will get an honorable mention in the final product (and a free copy!)
Regards,
Chris
cregister@yahoo.com