Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. LoadLibraryA & LoadLibraryW

LoadLibraryA & LoadLibraryW

Scheduled Pinned Locked Moved C / C++ / MFC
questionannouncement
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chirag_chauhan
    wrote on last edited by
    #1

    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.

    P _ K 3 Replies Last reply
    0
    • C chirag_chauhan

      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.

      P Offline
      P Offline
      Pops8002
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • C chirag_chauhan

        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.

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        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.

        C 1 Reply Last reply
        0
        • _ _Superman_

          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.

          C Offline
          C Offline
          chirag_chauhan
          wrote on last edited by
          #4

          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?

          _ 1 Reply Last reply
          0
          • C chirag_chauhan

            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?

            _ Offline
            _ Offline
            _Superman_
            wrote on last edited by
            #5

            I misinterpreted your question. Sorry about that.

            «_Superman_» I love work. It gives me something to do between weekends.

            1 Reply Last reply
            0
            • C chirag_chauhan

              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.

              K Offline
              K Offline
              KarstenK
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups