LoadLibrary problem under NT4 
Author Message
 LoadLibrary problem under NT4

Hi all,

I am working on an application that needs to dynamically load a dll when
certain conditions are required. The main application uses MFC and dll
is a regular non MFC dll.

To load the library, I call LoadLibrary () with the full path name of
the dll module. Then I load API function using GetProcAddress ().
This works fine under Windows 98. However under Windows NT 4.0
LoadLibrary fails to load the dll module although the path name is
correct. As to understand what was happening, I made a call to
GetLastError () right after LoadLibrary () to get the error code. I end
up with this: 3,221,225,622 in the de{*filter*} window. Obviously this
number does not link to any known error code (cannot find it  in MSDN
that is).

I did replace the dll name by a dummy name to check that I would get the
error code 126 (cannot locate the module or something...) and I got that
error code. Hence I am sure that GetLastError () gives me the last
error. Now I cannot explain the error code I get in the other case.

I am working with debug build only (both application and dll).

Anyone got an idea???

Cheers

Greg Jokiel



Sun, 08 Dec 2002 03:00:00 GMT  
 LoadLibrary problem under NT4
Greg,

When getting BIG numbers like that, it is always a good idea to convert to
hex as well. In this case the conversion yields C0000096. Now, I do not
claim to be an expert in this area but it looks to me like this error code
indicates the LoadLibrary detected a protection violation when loading the
module. I would look at the DllMain and other dll initialization things
(global class declarations) for something that NT does not like......

HTH

Mike


Quote:
> Hi all,

> I am working on an application that needs to dynamically load a dll when
> certain conditions are required. The main application uses MFC and dll
> is a regular non MFC dll.

> To load the library, I call LoadLibrary () with the full path name of
> the dll module. Then I load API function using GetProcAddress ().
> This works fine under Windows 98. However under Windows NT 4.0
> LoadLibrary fails to load the dll module although the path name is
> correct. As to understand what was happening, I made a call to
> GetLastError () right after LoadLibrary () to get the error code. I end
> up with this: 3,221,225,622 in the de{*filter*} window. Obviously this
> number does not link to any known error code (cannot find it  in MSDN
> that is).

> I did replace the dll name by a dummy name to check that I would get the
> error code 126 (cannot locate the module or something...) and I got that
> error code. Hence I am sure that GetLastError () gives me the last
> error. Now I cannot explain the error code I get in the other case.

> I am working with debug build only (both application and dll).

> Anyone got an idea???

> Cheers

> Greg Jokiel



Sun, 08 Dec 2002 03:00:00 GMT  
 LoadLibrary problem under NT4
Thanks, I found the problem.

Accessing the parallel port directly is not a good idea under NT ;-D

Quote:

> Greg,

> When getting BIG numbers like that, it is always a good idea to convert to
> hex as well. In this case the conversion yields C0000096. Now, I do not
> claim to be an expert in this area but it looks to me like this error code
> indicates the LoadLibrary detected a protection violation when loading the
> module. I would look at the DllMain and other dll initialization things
> (global class declarations) for something that NT does not like......

> HTH

> Mike



> > Hi all,

> > I am working on an application that needs to dynamically load a dll when
> > certain conditions are required. The main application uses MFC and dll
> > is a regular non MFC dll.

> > To load the library, I call LoadLibrary () with the full path name of
> > the dll module. Then I load API function using GetProcAddress ().
> > This works fine under Windows 98. However under Windows NT 4.0
> > LoadLibrary fails to load the dll module although the path name is
> > correct. As to understand what was happening, I made a call to
> > GetLastError () right after LoadLibrary () to get the error code. I end
> > up with this: 3,221,225,622 in the de{*filter*} window. Obviously this
> > number does not link to any known error code (cannot find it  in MSDN
> > that is).

> > I did replace the dll name by a dummy name to check that I would get the
> > error code 126 (cannot locate the module or something...) and I got that
> > error code. Hence I am sure that GetLastError () gives me the last
> > error. Now I cannot explain the error code I get in the other case.

> > I am working with debug build only (both application and dll).

> > Anyone got an idea???

> > Cheers

> > Greg Jokiel



Sun, 08 Dec 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. LoadLibrary generates MessageBox when failing to loadlibrary in Managed C++

2. LoadLibrary() from within module loaded by LoadLibrary() ?

3. Problem:using LoadLibrary of API in WNet

4. Problem with Freelibrary and LoadLibrary

5. dll LoadLibrary/GetProcAddress problem (newbee)

6. Help!!!:Problem with LoadLibrary

7. LoadLibrary() Problems

8. LoadLibrary problem

9. loadlibrary problem

10. Age old Problem... DLL LoadLibrary()

11. LoadLibrary()/GetProcAddress() ESP problem

12. problem Loading 16-bit EXE using LoadLibrary!

 

 
Powered by phpBB® Forum Software