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.

Parents
  • 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.

Reply
  • 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.

Children
No Data