a***@gmail.com
2007-01-17 19:42:37 UTC
Hello,
I'm experiencing a funny crash right now where a call to WriteFileEx
followed by a WSAConnect (or regular connect) crashes in the connect
call with an access violation.
Here is the stack and the error from CDB:
(820.200): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
00000000 ?? ???
0:000> k
ChildEBP RetAddr
WARNING: Frame IP not in any known module. Following frames may be
wrong.
0012f218 7c82bd0b 0x0
0012f230 7c90eac7 kernel32!ReadFileEx+0xb0
0012f54c 71a556e8 ntdll!KiUserApcDispatcher+0x7
0012f5d8 71a555af mswsock+0x56e8
0012f680 71a5542c mswsock+0x55af
0012f6b0 71ac0cc5 mswsock+0x542c
0012f6e4 0053ac99 WS2_32!WSAConnect+0x5c
...
0:000> !gle
LastErrorValue: (Win32) 0 (0) - The operation completed successfully.
LastStatusValue: (NTSTATUS) 0 - STATUS_WAIT_0
============================================================
Here is the code:
fw->hfile =
CreateFile(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,create_flag,FILE_FLAG_OVERLAPPED,NULL);
// FILE_SHARE_READ : just for debug, so you can see what is being
written when open
if(fw->hfile == INVALID_HANDLE_VALUE)
return NULL;
ZeroStruct(&fw->ol);
fw->ol.Offset = GetFileSize(fw->hfile,&fw->ol.OffsetHigh);
if(!WriteFileEx(fw->hfile,fw->output,estrLength((char**)&fw->output),&fw->ol,0))
return false;
link->socket = socket(AF_INET,SOCK_STREAM,0);
if (link->socket < 0)
return 0;
sockSetAddr(&link->addr,ipFromString(address),port);
//ret = connect(link->socket,(struct sockaddr
*)&link->addr,sizeof(link->addr));
ret = WSAConnect(link->socket,(struct sockaddr
*)&link->addr,sizeof(link->addr),NULL,NULL,NULL,NULL);
==================================================
The 'connect' call works on our other apps, its only crashing in this
new one with the use of WriteFileEx. and WriteFileEx works just fine by
itself.
Any feedback is appreciated.
Best regards,
Brady
I'm experiencing a funny crash right now where a call to WriteFileEx
followed by a WSAConnect (or regular connect) crashes in the connect
call with an access violation.
Here is the stack and the error from CDB:
(820.200): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
00000000 ?? ???
0:000> k
ChildEBP RetAddr
WARNING: Frame IP not in any known module. Following frames may be
wrong.
0012f218 7c82bd0b 0x0
0012f230 7c90eac7 kernel32!ReadFileEx+0xb0
0012f54c 71a556e8 ntdll!KiUserApcDispatcher+0x7
0012f5d8 71a555af mswsock+0x56e8
0012f680 71a5542c mswsock+0x55af
0012f6b0 71ac0cc5 mswsock+0x542c
0012f6e4 0053ac99 WS2_32!WSAConnect+0x5c
...
0:000> !gle
LastErrorValue: (Win32) 0 (0) - The operation completed successfully.
LastStatusValue: (NTSTATUS) 0 - STATUS_WAIT_0
============================================================
Here is the code:
fw->hfile =
CreateFile(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,create_flag,FILE_FLAG_OVERLAPPED,NULL);
// FILE_SHARE_READ : just for debug, so you can see what is being
written when open
if(fw->hfile == INVALID_HANDLE_VALUE)
return NULL;
ZeroStruct(&fw->ol);
fw->ol.Offset = GetFileSize(fw->hfile,&fw->ol.OffsetHigh);
if(!WriteFileEx(fw->hfile,fw->output,estrLength((char**)&fw->output),&fw->ol,0))
return false;
link->socket = socket(AF_INET,SOCK_STREAM,0);
if (link->socket < 0)
return 0;
sockSetAddr(&link->addr,ipFromString(address),port);
//ret = connect(link->socket,(struct sockaddr
*)&link->addr,sizeof(link->addr));
ret = WSAConnect(link->socket,(struct sockaddr
*)&link->addr,sizeof(link->addr),NULL,NULL,NULL,NULL);
==================================================
The 'connect' call works on our other apps, its only crashing in this
new one with the use of WriteFileEx. and WriteFileEx works just fine by
itself.
Any feedback is appreciated.
Best regards,
Brady