CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2000
    Location
    Indore (MP) INDIA.
    Posts
    356

    Telling the Application, Where to load the DLLs from

    Hi,

    I have a Win32 GUI application that is a COM client as well. It is built using ATL Static link option. We have build the application using Visual C++ 7.1. I want to ensure that the application should work on all machines it is deployed to. Thus we need to package all DLL the application depends on. I have created an MSI project that package the main project's output + all its dependencies that I am aware of.

    Do I also need to package C Runtime library 7.1 with the application ?
    Also, If yes, What all files I need to package (ATL71.dll, MSVCR71.dll, MSVCP71.dll, MSVCRT.dll, ...) ?

    Without packaging them, I tried to copy the DLL to application install directory- C:\Program Files\<My App>\

    Another question, I have is that- How do I force the application to load the VCRT DLL from the current directory, instead of the System32 folder ? I have copied the DLLs (ATL71.dll, MSVCR71.dll, MSVCP71.dll, MSVCRT.dll) to the same folder, where the application is installed and during the application runtime I try to rename these DLLs and succeed as well. This give me an impression that the DLL is not being used by the application. Instead the similar file at System32 folder is being used.

    Can some one help with the above 2 questions.

    Thanks,

    *(Vipul)() ;
    (*Vipul)() ;

  2. #2
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Telling the Application, Where to load the DLLs from

    The answer to your first question is to use Depends.exe to find out the application dependencies. Note, this does not negate the need in regular application test cycle.

    To your second question, the answer is to use 100% reliable method of loaded modules paths verification. Using ProcessExplorer utility would be the one, for example.

    BTW, renaming currently loaded dll locally cannot be the one - NTFS allows you do this with no problem. Surprise!
    Best regards,
    Igor

  3. #3
    Join Date
    May 2000
    Location
    Indore (MP) INDIA.
    Posts
    356

    Re: Telling the Application, Where to load the DLLs from

    I was using the Depends.exe utility that comes with Visual Studio to see if C Runtime is being used.

    (1)
    I found that MSVCRT.dll is being used instead of MSVCR71.dll (even if the project was built using Visual Studio 7.1).

    (2)
    For the second question, I tried to create a registry entry at the following location to tell the OS/Application that look in this directory for DLLs before trying other directory location:

    HKLM/Software/Microsoft/Windows/CurrentVersion/App Paths/<App.exe>
    |--- (Default) = <Full Path of Application's EXE file>
    |--- Path = <Full Directory Path of Application>

    But this doesn't worked out. It is still loading the DLLs from C:\WINNT\System32.

    (3)
    Can you elaborate on "loaded modules paths verification", and How to achieve that ?

    BTW, renaming currently loaded dll locally cannot be the one - NTFS allows you do this with no problem. Surprise!
    (4) Can you suggest how do I verify that the said DLL is actually being used by the Application and not the System32 one.

    Thanks,

    *(Vipul)() ;
    (*Vipul)() ;

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Telling the Application, Where to load the DLLs from

    Well, App Paths registry key serves to totally different purpose, and it never defines the application dll search path. Try to read the Dynamic-Link Library Search Order article.

    Regarding elaboration requested. I gave you a link to a ProcessExplorer and hoped you play with the utility first before continuing asking. Well, did you?
    Best regards,
    Igor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured