DLL change path

Here you can find everything you need to know about Dll-Files. You can also share your knowledge regarding the topic.

DLL change path

Postby Erjen » Mon Oct 24, 2011 9:35 am

Hello,

Nice forum! Hope you can answer my question.
I have a DLL file that points to C:\map and I can changed that directory (with Reflexil, plug-in for Reflector) and that works fine. But what I actually want is that it points to its current directory without defining C:\ etc.

Is that possible?

I really hope so!

Thanks!
Erjen
 
Posts: 6
Joined: Mon Oct 24, 2011 9:27 am

Re: DLL change path

Postby DllAdmin » Mon Oct 24, 2011 10:44 am

Try to change the C:\map to . (dot only, nothing else) usually . (dot) means the current directory.

Try that and let us know if that worked.


C:\map => .
DllAdmin
Site Admin
 
Posts: 58
Joined: Thu Mar 17, 2011 11:32 am

Re: DLL change path

Postby Erjen » Mon Oct 24, 2011 11:23 am

Thanks for your reply!

I changed it but it doesn't point to the current directory.
It points to:
C:\Windows\SysWOW64\inetsrv\

Do you know how to solve this?

Thanks again!
Erjen
 
Posts: 6
Joined: Mon Oct 24, 2011 9:27 am

Re: DLL change path

Postby Erjen » Mon Oct 24, 2011 11:55 am

And maybe this helps you a little:


private void InitialiseCatalogName()
{
string filename = Path.Combine(".", "settings.xml");
XmlDocument document = new XmlDocument();
document = this.Load(filename);
XmlNode node = document.SelectSingleNode(this.GetXmlLocationCatalogName());
if (node == null)

Thats the piece of code and as you can see I replaced C:\map with the dot.
Erjen
 
Posts: 6
Joined: Mon Oct 24, 2011 9:27 am

Re: DLL change path

Postby DllAdmin » Mon Oct 24, 2011 12:14 pm

Try this in

string filename = Path.Combine(Environment.CurrentDirectory, "settings.xml");
DllAdmin
Site Admin
 
Posts: 58
Joined: Thu Mar 17, 2011 11:32 am

Re: DLL change path

Postby Erjen » Mon Oct 24, 2011 12:42 pm

Pfft now it proudly points to
'C:\Windows\SysWOW64\inetsrv\Environment.CurrentDirectory\settings.xml'

Unbelievable right.

I did exactly what you said:
string filename = Path.Combine("Environment.CurrentDirectory", "settings.xml");

Are there any other options or am I still doing something wrong?

Thank you very much again for your reply!
Erjen
 
Posts: 6
Joined: Mon Oct 24, 2011 9:27 am

Re: DLL change path

Postby DllAdmin » Mon Oct 24, 2011 12:45 pm

Hi again,

Do not put quotes in Environment.CurrentDirectory , this is the Environment variable, there is no need for " " (quotes) around that!

Just copy and paste it like this:

Path.Combine(Environment.CurrentDirectory, "settings.xml");
DllAdmin
Site Admin
 
Posts: 58
Joined: Thu Mar 17, 2011 11:32 am

Re: DLL change path

Postby Erjen » Mon Oct 24, 2011 2:21 pm

I am trying to remove them but with Reflexil it’s impossible. And the dll file is compiled so when I decompile it with Visual Studio and the Reflector plug-in, I can change it like you said but impossible to compile again I think.

Are you sure that the problem is the quotes? Because if that’s what you think it is I will do everything to remove them.

Thank you very much again! I appreciate your replies
Erjen
 
Posts: 6
Joined: Mon Oct 24, 2011 9:27 am

Re: DLL change path

Postby DllAdmin » Mon Oct 24, 2011 2:28 pm

I think the problem is in the quotes because if you put a string in quotes that means that the path is that one in between quotes.

But what you need to do is add a variable instead of string. The variable Environment.CurrentDirectory is the dynamic variable for the current directory (obviously). If you can make it work without the quotes that I think would be a solution.

You can also try to leave the path empty like this "" but I doubt this will work.
DllAdmin
Site Admin
 
Posts: 58
Joined: Thu Mar 17, 2011 11:32 am

Re: DLL change path

Postby Erjen » Tue Oct 25, 2011 2:31 pm

I changed it but didn't work either :(

I solved it now but used a workaround.

Thanks for all your replies and your help!!
Erjen
 
Posts: 6
Joined: Mon Oct 24, 2011 9:27 am

Re: DLL change path

Postby DllAdmin » Thu Oct 27, 2011 10:48 am

Hi Erjen,

It would be the best if you could tell what was the workaround! Other people might find it useful. :)

Thanks.
DllAdmin
Site Admin
 
Posts: 58
Joined: Thu Mar 17, 2011 11:32 am


Return to Everything about Dll-Files

Who is online

Users browsing this forum: Debra, GymNGymnHon, heenlyphefe and 1 guest

cron