CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Location
    India
    Posts
    10

    LoadLibrary with Short Path & Execute EXE with long path

    Hi,

    I have encountered a very strange situation. I have an MFC EXE developed using VC2008 that simply displays a dialog with a "Show Dialog" button. When I click on "Show Dialog" button, it shows another model dialog that comes from an MFC Extension DLL. The Extension DLL is loaded in EXE in OnInitDialog() by converting the DLL path to short path using GetShortPathName() API.

    Now the EXE is built and deployed on another machine where VC2008 is not installed. The deployment directory is provided with CRT and MFC redistributable DLLs with manifest from VC2008 redist directory. I mean I provide all the dependent DLLs and manifest in the application's folder.

    Now I run the EXE. Then click on "Show Dialog" button; the application hangs.

    But if I load the DLL in EXE's OnInitDialog() with long path (I mean fully qualified path), this situation does not occur.

    ================================================

    I solved the problem by reading following blog:

    http://blog.kalmbach-software.de/200...redist_x86exe/

    But still I am not able to figure it out what is the actual problem?

    Is it because of redistributable?

    Is there a bug in GetShortPathName() API or does this API not work with redistributable?

    Can anyone please show some light?

    Thanks & Regards,
    -Abhay
    Attached Files Attached Files

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: LoadLibrary with Short Path & Execute EXE with long path

    Is there any reason to use a short pathname instead of a long one?
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2009
    Location
    India
    Posts
    10

    Re: LoadLibrary with Short Path & Execute EXE with long path

    Hi,

    There is not an obvious reason, but I did it for fun. Furthermore, this problem occurs on XP Service Pack 2 only. I tested it on Vista HP, it's working fine. For further information please check the following thread

    http://social.msdn.microsoft.com/For...?prof=required

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: LoadLibrary with Short Path & Execute EXE with long path

    Quote Originally Posted by abhaykumar View Post
    Hi,

    There is not an obvious reason, but I did it for fun. Furthermore, this problem occurs on XP Service Pack 2 only.
    Well, it is one more reason to install SP3!
    Victor Nijegorodov

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