Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-07-2006, 07:16 PM
rab rab is offline
Member
 
Join Date: Oct 2005
Posts: 64
Default Error opening

I can not open the file 'C:\WINDOWS\system32\drivers\etc\hosts' it tells me it cannot be found but it will open when I use the open dialog. I've tryed setting it as a variable and just putting it in the filename part in the opendialog. It doesnt work. Anyone know how to get it to open.
Reply With Quote
  #2  
Old 01-07-2006, 08:01 PM
gLes gLes is offline
Senior Member
 
Join Date: Jan 2001
Posts: 2,273
Default RE: Error opening

Could you provide the exact code you are having problems with?

gLes
Reply With Quote
  #3  
Old 01-07-2006, 08:32 PM
rab rab is offline
Member
 
Join Date: Oct 2005
Posts: 64
Default RE: Error opening

host:='C:\WINDOWS\system32\drivers\etc\hosts';
peer:='peerchat';
block:='#';
FS:=FS.Create(host, fmOPENREAD or fmShareDenyNone);
Reply With Quote
  #4  
Old 01-07-2006, 10:09 PM
SourceCode SourceCode is offline
Senior Member
 
Join Date: Apr 2005
Posts: 810
Default RE: Error opening

Is this file 'C:\WINDOWS\system32\drivers\etc\hosts' a folder or a file
For instance you may have forgotten to include hosts extension eg hosts.exe?
Reply With Quote
  #5  
Old 01-08-2006, 12:50 AM
Thunderbolt Thunderbolt is offline
Senior Member
 
Join Date: Dec 2003
Posts: 166
Default RE: Error opening

I had a look and 'Hosts' is a file, but without an extension. So maybe the code is confusing hosts as a folder instead of a file because of it's extensionlessness.

What are you trying to do with the Hosts file? Some programs like Spybot Search and Destry allow you to read-only this file to prevent hijackings by spyware and such.
You should probably leave this file alone or atleast create a backup of it before messing with it, or you can screw up IE.

If I helped you, please click Accept as answer.
I will accept posts that answer my question effectively.

Help the local police, beat yourself up!

http://www.thunderbolttactical.net
[sup]From the mind, and keyboard of Thunderbolt[/sup]
Reply With Quote
  #6  
Old 01-08-2006, 04:14 AM
mp5 mp5 is offline
Member
 
Join Date: Nov 2003
Posts: 35
Default RE: Error opening

Here is what I'd do:

var
HostFile, Text2Add: String;
F: TextFile;
begin
HostFile:= 'C:\Windows\System32\drivers\etc\hosts';
AssignFile(F, HostFile);
Reset(F);
Append(F);
WriteLn(F, Text2Add);
{Text2Add is the text u wanna append at the end of the host file. I'd guess u wanna add new IP's to it.}
CloseFile(F);
end;

mp5
Reply With Quote
  #7  
Old 01-08-2006, 06:00 AM
rab rab is offline
Member
 
Join Date: Oct 2005
Posts: 64
Default RE: Error opening

Thankyou , And im not trying to ruin or hijack anything. Its a simple thing to set up a proxy.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 12:00 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.