Highlighted
Anon Absent Member.
Absent Member.
839 views

False positive "Bad pointer passed to global handle" in FreeLibrary() call.

 The below generates Bad pointer passed to global handle error.

 

HMODULE hModule;

hModule= LoadLibraryEx("Path//to//dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);

FreeLibrary(hModule);// generated here.

0 Likes
6 Replies
Rick Papo Absent Member.
Absent Member.

RE: False positive "Bad pointer passed to global handle" in FreeLibrary() call.

Constant strings like that are not tracked unless you build the module you are making the call from with instrumentation for error detection. Were you testing with or without compiler instrumentation?

--Rick Papo, the guy who maintains BoundsChecker.
0 Likes
Anon Absent Member.
Absent Member.

RE: False positive "Bad pointer passed to global handle" in FreeLibrary() call.

Its not about the constant string. Its about the FreeLibrary() call. Interestingly, HMODULE hModule = LoadLibraryEx() does not generate the error. I guess, Bounds Checker is not able to comprehend that hModule has been assigned a valid value after LoadLibraryEx() call.
0 Likes
Rick Papo Absent Member.
Absent Member.

RE: False positive "Bad pointer passed to global handle" in FreeLibrary() call.

Okay, but we've been tracking the handles returned from LoadLibraryEx() for at least this century, and probably a few years before that.  The following test code does not give any error, and I have verified that the module actually gets loaded here:

           void Test1 ( ) {

           HMODULE hModule = LoadLibraryEx ( "c:\\Windows\\System32\\XMLLite.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH ) ;

           if ( hModule ) {

               FreeLibrary ( hModule ) ;

           } /* endif */

       }

So the question becomes, what is different in your case?  If possible, could you share your test case?  You may e-mail me directly at Rick.Papo@MicroFocus.com.

0 Likes
Anon Absent Member.
Absent Member.

RE: False positive "Bad pointer passed to global handle" in FreeLibrary() call.

I checked with different dll's. This is reproduced only with a particular dll(proprietary) and not with any other. Are you aware of anything that might be wrong with that dll for which BC gives this error?
0 Likes
Rick Papo Absent Member.
Absent Member.

RE: False positive "Bad pointer passed to global handle" in FreeLibrary() call.

Not off the top of my head. Could you save the transcript/log from the error detection session and e-mail it to me?
0 Likes
Micro Focus Contributor
Micro Focus Contributor

RE: False positive "Bad pointer passed to global handle" in FreeLibrary() call.

Hello GauravSehgal,
Can you contact Micro Focus Support and open an incident? This will facilitate exchanging any needed data that would enable us to investigate further and resolve.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.