(转)如何解释 InternetQueryOption的INTERNET_VERSION_INFO 结构的结果
2012-03-16 15:55
225 查看
您可以使用 InternetQueryOption 函数检索
WinInet DLL 的版本。返回的版本信息不是版本标记 WinInet.dll 文件的 DLL 的内部版本号。
您可以使用 INTERNET_VERSION_INFO 结构 (省略检查代码错误)
如下:
的平台 SDK 包含 INTERNET_OPTION_VERSION 标志可用于与 InternetQueryOption 函数的下列说明:
检索一个 INTERNET_VERSION_INFO 结构,它包含 Wininet.dll 的版本号。可以使用此选项通过 InternetQueryOption NULL HINTERNET 句柄。
此函数调用返回 INTERNET_VERSION_INFO 结构可以解释如下:
可以通过使用版本的 api,如下所示获得精确的 Wininet.dll 版本信息 (如文件属性中所示):
#define SWAPWORDS(X) ( (X<<16) | (X>>16) )
...
if (! (dwSize = GetFileVersionInfoSize (TEXT("wininet.dll"), &dwHandle) ) )
{
dwError = GetLastError();
if (dwError == 2)
// 2 is file no found error
cerr << "Wininet.dll is not found" << endl;
else if (dwError == 1812)<BR/>
// 1812 means no resource section information, very unlikely case
cerr << "Wininet.dll does contain resource section" << endl;
else
cerr << "GetFileVersionInfoSize failed: " <<
GetLastError() << endl;
return 0;
}
lpBuffer = new TCHAR [dwSize];
if (!GetFileVersionInfo (TEXT ("wininet.dll"), 0,
dwSize, (LPVOID) lpBuffer) )
{
cerr << "GetFileVersionInfo failed: "
<< GetLastError() << endl;
return 0;
}
LPDWORD lpdwLangCp;
if (!VerQueryValue(lpBuffer, TEXT("\\VarFileInfo\\Translation"),
(LPVOID*) &lpdwLangCp, &dwUint) )
{
cerr << "VerQueryValue failed: " << GetLastError() << endl;
return 0;
}
TCHAR szLangCp[9];
wsprintf( szLangCp, TEXT ("%08X"),SWAPWORDS( *lpdwLangCp ));
TCHAR SubBlock [2048];
wsprintf( SubBlock, TEXT("\\StringFileInfo\\%s\\FileVersion"), szLangCp );
if (!VerQueryValue(lpBuffer, SubBlock, (LPVOID*)&Buffer, &dwUint) )
{
cerr << "No file version info available" << endl;
return 0;
}
else
cout << "File Version: " << Buffer << endl;
wsprintf( SubBlock, TEXT("\\StringFileInfo\\%s\\ProductVersion"),
szLangCp );
if (!VerQueryValue(lpBuffer, SubBlock, (LPVOID*)&Buffer, &dwUint) )
{
cerr << "No produce version info available" << endl;
return 0;
}
else
cout << "Product Version: " << Buffer << endl;
wsprintf( SubBlock, TEXT("\\StringFileInfo\\%s\\FileDescription"),
szLangCp );
if (!VerQueryValue(lpBuffer, SubBlock, (LPVOID*)&Buffer, &dwUint) )
{
cerr << "No File Description info available" << endl;
return 0;
}
else
cout << "File Description: " << Buffer << endl;
delete [] lpBuffer;
转自:http://support.microsoft.com/kb/244857/zh-cn
WinInet DLL 的版本。返回的版本信息不是版本标记 WinInet.dll 文件的 DLL 的内部版本号。
您可以使用 INTERNET_VERSION_INFO 结构 (省略检查代码错误)
如下:
INTERNET_VERSION_INFO structVI; DWORD dwStructSize = sizeof(INTERNET_VERSION_INFO); InternetQueryOption (NULL, INTERNET_OPTION_VERSION, (LPVOID)&structVI, &dwStructSize); printf("WinINet Major Version: %d\n", structVI.dwMajorVersion); printf("WinINet Minor Version: %d\n", structVI.dwMinorVersion);
的平台 SDK 包含 INTERNET_OPTION_VERSION 标志可用于与 InternetQueryOption 函数的下列说明:
检索一个 INTERNET_VERSION_INFO 结构,它包含 Wininet.dll 的版本号。可以使用此选项通过 InternetQueryOption NULL HINTERNET 句柄。
此函数调用返回 INTERNET_VERSION_INFO 结构可以解释如下:
dwMajorVersion | dwMinorVersion | WinInet 版本 |
---|---|---|
1 | 0 | Internet 3 Explorer |
1 | 1 | Internet 4 Explorer |
1 | 2 | Internet 5 Explorer |
#define SWAPWORDS(X) ( (X<<16) | (X>>16) )
...
if (! (dwSize = GetFileVersionInfoSize (TEXT("wininet.dll"), &dwHandle) ) )
{
dwError = GetLastError();
if (dwError == 2)
// 2 is file no found error
cerr << "Wininet.dll is not found" << endl;
else if (dwError == 1812)<BR/>
// 1812 means no resource section information, very unlikely case
cerr << "Wininet.dll does contain resource section" << endl;
else
cerr << "GetFileVersionInfoSize failed: " <<
GetLastError() << endl;
return 0;
}
lpBuffer = new TCHAR [dwSize];
if (!GetFileVersionInfo (TEXT ("wininet.dll"), 0,
dwSize, (LPVOID) lpBuffer) )
{
cerr << "GetFileVersionInfo failed: "
<< GetLastError() << endl;
return 0;
}
LPDWORD lpdwLangCp;
if (!VerQueryValue(lpBuffer, TEXT("\\VarFileInfo\\Translation"),
(LPVOID*) &lpdwLangCp, &dwUint) )
{
cerr << "VerQueryValue failed: " << GetLastError() << endl;
return 0;
}
TCHAR szLangCp[9];
wsprintf( szLangCp, TEXT ("%08X"),SWAPWORDS( *lpdwLangCp ));
TCHAR SubBlock [2048];
wsprintf( SubBlock, TEXT("\\StringFileInfo\\%s\\FileVersion"), szLangCp );
if (!VerQueryValue(lpBuffer, SubBlock, (LPVOID*)&Buffer, &dwUint) )
{
cerr << "No file version info available" << endl;
return 0;
}
else
cout << "File Version: " << Buffer << endl;
wsprintf( SubBlock, TEXT("\\StringFileInfo\\%s\\ProductVersion"),
szLangCp );
if (!VerQueryValue(lpBuffer, SubBlock, (LPVOID*)&Buffer, &dwUint) )
{
cerr << "No produce version info available" << endl;
return 0;
}
else
cout << "Product Version: " << Buffer << endl;
wsprintf( SubBlock, TEXT("\\StringFileInfo\\%s\\FileDescription"),
szLangCp );
if (!VerQueryValue(lpBuffer, SubBlock, (LPVOID*)&Buffer, &dwUint) )
{
cerr << "No File Description info available" << endl;
return 0;
}
else
cout << "File Description: " << Buffer << endl;
delete [] lpBuffer;
转自:http://support.microsoft.com/kb/244857/zh-cn
相关文章推荐
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- Android开发如何在getContentResolver().query()方法中实现结果去重
- 如何使用API函数GetFileVersionInfo,获得版本信息
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 关于 byte 接收 超byte 范围的数值,输出我们想不到的结果 如何解释
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- C# winform webbrowser如何指定内核为IE11? 输出 this.webbrowser.Version 显示版本是IE11的,但实际版本不是啊! 网上打的修改注册表HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULA
- query的结构某字段如何在WEIBI上单独定义格式
- jstl中的sql:query标签获取的结果如何格式化输出
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 如何使用API函数GetFileVersionInfo,获得版本信息
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重
- 如何设计PHP业务模块(函数/方法)返回结果的结构?
- 如何在ORACLE中实现将查询结果存到一个新表中,包括表结构和查询结果?
- 思考: 如何设计 输出结果 具有对称性 的 网络结构
- 如何循环遍历document.querySelectorAll()方法返回的结果
- 计算机网络复习:主题1 Internet是如何组织其连接结构的
- (转)检测计算机的 Internet 连接状态(InternetCheckConnection与InternetQueryOption)
- 如何在managedQuery()和getContentResolver().query()方法中实现结果去重