VerQueryValue Bug?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Is there any known problem with VerQueryValue.

An example of how I am using it is:

wchar_t* pstrResult = NULL;
unsigned int VersionLength = 0;

if (VerQueryValue(p, L"\\StringFileInfo\\040904e4\\FileVersion",
pstrInfoName", (void **)&pstrResult, (unsigned int *)&VersionLength)) {
...
}

where p is a pointer to the resource.

As a side note, we do not use GetFileVersionInfo to get P but derive it. on
our own and allocate it.

The symptom is this -

If we make the call to VerQueryValue and then delete p, and only in debug
mode, we get a runtime error

HEAP[Test.exe]: HEAP: Free Heap block 8a34a8 modified at 8a3624 after it was
freed
Unhandled exception at 0x77f75a58 in Test.exe: User breakpoint

If we skip the call to VerQueryVal\lue and delete it all is well. It seems
VerQueryValue has an effect on the memory in debug mode

In (we are compiling multithreaded debug)

_CRTIMP void __cdecl _free_dbg(

at these lines:

/* fill the entire block including header with dead-land-fill */
memset(pHead, _bDeadLandFill, sizeof(_CrtMemBlockHeader) + pHead->nDataSize
+ nNoMansLandSize);
_free_base(pHead);

When _free_base(pHead) is called it calls

HeapFree(_crtheap, 0, pBlock);

Then we get the errors mentioned above.

Any information on if there is known issue would be most appreciated.
Again, the point is that the call to VerQueryValue is the only thing that
gets done and the problem appears. I have even copied the version block
into another buffer I allocated just before the call and did a delete after
and it causes the problem. By copying to a stack variable I made large
enough to handle the data all seemed fine.

Another note - no problem when running in debug mode using start without
debugging. Only when doing a normal start. VC 7 Visual C++.net

Thanks much for any help.


.



Relevant Pages

  • Re: VerQueryValue Bug?
    ... call to verqueryvalue was not called there was not problem. ... Allocated a buffer ... our own and allocate it. ... VerQueryValue has an effect on the memory in debug mode ...
    (microsoft.public.win32.programmer.kernel)
  • Re: VerQueryValue Bug?
    ... > Copy the resource block into the buffer ... > Call VerQueryValue ... > debug mode or the debug memory free has a problem. ... >>> our own and allocate it. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: VerQueryValue Bug?
    ... Copy the resource block into the buffer ... Call VerQueryValue ... debug mode or the debug memory free has a problem. ... >> our own and allocate it. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: VerQueryValue Bug?
    ... > Is there any known problem with VerQueryValue. ... > our own and allocate it. ... we get a runtime error ... > Another note - no problem when running in debug mode using start without ...
    (microsoft.public.win32.programmer.kernel)
  • VerQueryValue Bug?
    ... Is there any known problem with VerQueryValue. ... our own and allocate it. ... we get a runtime error ... Another note - no problem when running in debug mode using start without ...
    (microsoft.public.win32.programmer.kernel)