wininet.dll 中看似随机崩溃的原因?

发布于 2024-09-14 06:46:54 字数 1136 浏览 10 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

以酷 2024-09-21 06:46:54

检查lpdwNumberOfBytesRead的使用。应该是

DWORD *lpdwNumberOfBytesRead = &someDWORDsomewhere;
InternetReadFile (..., lpdwNumberOfBytesRead);

或者

DWORD NumBytes
InternetReadFile (..., &NumBytes);

我有一种感觉,您正在执行第一种方法,而没有将指针变量设置在有效的地方。

Check use of lpdwNumberOfBytesRead. It should be either

DWORD *lpdwNumberOfBytesRead = &someDWORDsomewhere;
InternetReadFile (..., lpdwNumberOfBytesRead);

or

DWORD NumBytes
InternetReadFile (..., &NumBytes);

I have a feeling you are doing the first method without setting the pointer variable somewhere valid.

莫相离 2024-09-21 06:46:54

我发现问题在于在其他线程中使用已关闭的句柄调用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文