wininet.dll 中看似随机崩溃的原因?
我在 wininet.dll 深处遇到崩溃。 尝试读取 HTTP_REQUEST_HANDLE_OBJECT::ReleaseConnection
中的零内存位置时崩溃,
这是实际 DLL 中的错误,而不是由不当使用引起的吗?
wininet!HTTP_REQUEST_HANDLE_OBJECT::ReleaseConnection+0x60
wininet!HTTP_REQUEST_HANDLE_OBJECT::CloseConnection+0x84
wininet!HTTP_REQUEST_HANDLE_OBJECT::ReadData_Fsm+0x5e8
wininet!CFsm_ReadData::RunSM+0x2e
wininet!CFsm::运行+0x39
wininet!DoFsm+0x25
wininet!HTTP_REQUEST_HANDLE_OBJECT::ReadData+0x38
wininet!HTTP_REQUEST_HANDLE_OBJECT::HttpReadData_Fsm+0x43
wininet!CFsm_HttpReadData::RunSM+0x2e
wininet!CFsm::运行+0x39
wininet!DoFsm+0x25
wininet!HttpReadData+0x67
wininet!ReadFile_Fsm+0x2d
wininet!CFsm_ReadFile::RunSM+0x2b
wininet!CFsm::运行+0x39
wininet!DoFsm+0x25
wininet!InternetReadFile+0x3ca
上下文是我正在尝试下载文件。我正在调用
InternetReadFile (hFile, lpBuffer, dwNumberOfBytesToRead, lpdwNumberOfBytesRead);
hFile HINTERNET 句柄似乎很好(值是 0x00cc0024,这似乎是合法的)dwNumberOfBytesToRead 是 20000。
我的缓冲区大小是 131000,这也很好。
问题是我的代码在 99.9999% 的时间内都可以工作!
I am getting crashes deep in wininet.dll.
It crashed trying to read the zero memory location in HTTP_REQUEST_HANDLE_OBJECT::ReleaseConnection
Is this a bug in the actual DLL and not caused by improper usage?
wininet!HTTP_REQUEST_HANDLE_OBJECT::ReleaseConnection+0x60
wininet!HTTP_REQUEST_HANDLE_OBJECT::CloseConnection+0x84
wininet!HTTP_REQUEST_HANDLE_OBJECT::ReadData_Fsm+0x5e8
wininet!CFsm_ReadData::RunSM+0x2e
wininet!CFsm::Run+0x39
wininet!DoFsm+0x25
wininet!HTTP_REQUEST_HANDLE_OBJECT::ReadData+0x38
wininet!HTTP_REQUEST_HANDLE_OBJECT::HttpReadData_Fsm+0x43
wininet!CFsm_HttpReadData::RunSM+0x2e
wininet!CFsm::Run+0x39
wininet!DoFsm+0x25
wininet!HttpReadData+0x67
wininet!ReadFile_Fsm+0x2d
wininet!CFsm_ReadFile::RunSM+0x2b
wininet!CFsm::Run+0x39
wininet!DoFsm+0x25
wininet!InternetReadFile+0x3ca
The context is I am trying to download a file. I am calling
InternetReadFile (hFile, lpBuffer, dwNumberOfBytesToRead, lpdwNumberOfBytesRead);
The hFile HINTERNET handle seems fine (value is 0x00cc0024 which seems legit) the dwNumberOfBytesToRead is 20000.
My buffer size is 131000 which is fine too.
The thing is my code works 99.9999% of the time!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查
lpdwNumberOfBytesRead
的使用。应该是或者
我有一种感觉,您正在执行第一种方法,而没有将指针变量设置在有效的地方。
Check use of
lpdwNumberOfBytesRead
. It should be eitheror
I have a feeling you are doing the first method without setting the pointer variable somewhere valid.
我发现问题在于在其他线程中使用已关闭的句柄调用 InternetCloseHandle 。通常这只会返回 ERROR_INVALID_HANDLE,但在某些情况下会导致 wininet 在 InternetCloseHandle 中或在本例中崩溃。
I found the problem was in calling InternetCloseHandle in other threads with an already closed handle. Normally this just returns ERROR_INVALID_HANDLE but in some circumstances makes wininet crash either in InternetCloseHandle or as in this case.