LoadLibraryA & LoadLibraryW
-
Hi, My system is having two versions of same DLL located under C:\Windows & C:\Windows\System32 folders. According to LoadLibrary MSDN documentations, the search path to load DLL will consider System32 folder first and then Windows folder. But when I use LoadLibraryA, it default load the DLL from C:\Windows folder. Whereas, when I use LoadLibraryW, it default load the DLL from C:\Windows\System32 folder. I googled for the difference between LoadLibraryA & LoadLibraryW and found that one is ASCII version whereas other is UNICODE version. Now my question is, why LoadLibraryA loads DLL from C:\Windows folder and LoadLibraryW load DLL from C:\Windows\System32 folder??? Regards, Chirag.
-
Hi, My system is having two versions of same DLL located under C:\Windows & C:\Windows\System32 folders. According to LoadLibrary MSDN documentations, the search path to load DLL will consider System32 folder first and then Windows folder. But when I use LoadLibraryA, it default load the DLL from C:\Windows folder. Whereas, when I use LoadLibraryW, it default load the DLL from C:\Windows\System32 folder. I googled for the difference between LoadLibraryA & LoadLibraryW and found that one is ASCII version whereas other is UNICODE version. Now my question is, why LoadLibraryA loads DLL from C:\Windows folder and LoadLibraryW load DLL from C:\Windows\System32 folder??? Regards, Chirag.
small info from msdn : LoadLibraryA -ANSI and LoadLibraryW - Unicode ANSI controls, which work on all Win32 operating systems, allow for maximum portability between the various Win32 operating systems. Unicode controls work on only Windows NT (version 3.51 or later), but not on Windows 95 or Windows 98. If portability is your primary concern, ship ANSI controls. If your controls will run only on Windows NT, you can ship Unicode controls. You could also choose to ship both and have your application install the version most appropriate for the user's operating system.
-
Hi, My system is having two versions of same DLL located under C:\Windows & C:\Windows\System32 folders. According to LoadLibrary MSDN documentations, the search path to load DLL will consider System32 folder first and then Windows folder. But when I use LoadLibraryA, it default load the DLL from C:\Windows folder. Whereas, when I use LoadLibraryW, it default load the DLL from C:\Windows\System32 folder. I googled for the difference between LoadLibraryA & LoadLibraryW and found that one is ASCII version whereas other is UNICODE version. Now my question is, why LoadLibraryA loads DLL from C:\Windows folder and LoadLibraryW load DLL from C:\Windows\System32 folder??? Regards, Chirag.
LoadLibraryA and LoadLibraryW are exported by the same kernel32.dll and there will only be one copy of that in C:\Windows\System32.
«_Superman_» I love work. It gives me something to do between weekends.
-
LoadLibraryA and LoadLibraryW are exported by the same kernel32.dll and there will only be one copy of that in C:\Windows\System32.
«_Superman_» I love work. It gives me something to do between weekends.
Thanks for the reply. But still my confusion is: Why LoadLibraryA loads DLL from C:\Windows folder and LoadLibraryW loads DLL from C:\Windows\System32 folder?
-
Thanks for the reply. But still my confusion is: Why LoadLibraryA loads DLL from C:\Windows folder and LoadLibraryW loads DLL from C:\Windows\System32 folder?
I misinterpreted your question. Sorry about that.
«_Superman_» I love work. It gives me something to do between weekends.
-
Hi, My system is having two versions of same DLL located under C:\Windows & C:\Windows\System32 folders. According to LoadLibrary MSDN documentations, the search path to load DLL will consider System32 folder first and then Windows folder. But when I use LoadLibraryA, it default load the DLL from C:\Windows folder. Whereas, when I use LoadLibraryW, it default load the DLL from C:\Windows\System32 folder. I googled for the difference between LoadLibraryA & LoadLibraryW and found that one is ASCII version whereas other is UNICODE version. Now my question is, why LoadLibraryA loads DLL from C:\Windows folder and LoadLibraryW load DLL from C:\Windows\System32 folder??? Regards, Chirag.
Because of the A und the W at the end. They are resolving the input strings in different kind. You should explicitly call them with the approbiate string variable (without cast). ie: CStringA sa = "..."; CStringW sw = L"..."; You better use LoadLibrary() so the compilet will choose the right version :doh:
Press F1 for help or google it. Greetings from Germany