cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
AJungen
Level 6

Windows\System32\drivers\etc\services how to manipulate ?

Hello,

i have a very old Installer, wich i have to redesign.
This old Installation manipulates the file
C:\Windows\System32\drivers\etc\services
I have to add three lines if they don't exists.

Is it possible to do this with IS2009 and vista ????
(How? Where ?)

e.g.:
# Copyright (c) 1993-2004 Microsoft Corp.
#
# This file contains port numbers for well-known services defined by IANA
#
# Format:
#
# / [aliases...] [#]<BR />#<BR />systat 11/tcp users #Active users<BR />systat 11/udp users #Active users<BR /></div></div></div>
Labels (1)
0 Kudos
(4) Replies
HenryL
Level 5

We also have an installer to append a line into ...\drivers\etc\services, and it works fine on Vista with UAC turned on. Our installer only runs with admin privilege BTW.
We used the InstallScript to open the file in append mode ( OpenFileMode(FILE_MODE_APPEND) ) and then use WriteLine to add the content.
0 Kudos
AJungen
Level 6

Hello Henry

i tried the following code, but it fails to open the file.
I am using a Basic MSI Installation

Andreas
----------------------------------------------

strDirectory = WINSYSDIR^"Drivers"^"etc";
strFile = "Services";

OpenFileMode(FILE_MODE_APPEND);
// OpenFileMode(FILE_MODE_BINARY);

// Try to Open the File
if( OpenFile(nvFileHandle,strDirectory,strFile) < 0 ) then
MessageBox ("OpenFile failed.", SEVERE);
return -1;
endif;
0 Kudos
AJungen
Level 6

Are there any switches, start conditions etc. so the code above would work ?
Or anything else so i can write into the 'service' file ?

Andreas
0 Kudos
AJungen
Level 6

when executing the CA with In-Script Execution: '... System Context' he can write into the file 'services' 🙂
But ...
The Installer doesn't know any Properties anymore ...
(Global variables the same)

So i wrote all Properties in an ini File in FOLDER_TEMP ...
and read them within the CA ...

It works ...
Don't know if there is a better solution.


Andreas
0 Kudos