GetFileVersionInfoSize总是返回0 c ++

时间:2019-07-26 10:20:21

标签: c++ windows winapi

我想使用GetFileVersionInfoSize和GetFileVersionInfo Windows方法。问题在于GetFileVersionInfoSize方法始终返回0。

DWORD dwDummy;
DWORD dwResult;
LPCWSTR pcwMyFile = L"myFile.txt";
LPVOID buffer;

dwResult = GetFileVersionInfoSize(pcwMyFile, &dwDummy);
//dwResult always 0

buffer = static_cast<LPVOID>(malloc(dwResult));

bool bResultInfo = GetFileVersion(pcwMyFile, 0, dwResult, buffer);
//bResultInfo always false
//I think the error comes from the GetFileVersionInfoSize method.
//But I do not understand or I make the mistake.

0 个答案:

没有答案