Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SO easy, It's almost embarassing

Posted on 1999-07-23
22
Medium Priority
?
169 Views
Last Modified: 2010-04-04
those uninstall(or install) programs have an INI file where they put filenames for WIndows to rename or remove after windows restart.
I forgot the name of the INI. :)
0
Comment
Question by:duke_n
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 14
  • 4
  • 2
  • +1
22 Comments
 
LVL 2

Expert Comment

by:CalvinDay
ID: 1390767
It's in the registry.

  fRun:='command.com /c del c:\windows\Uninstall.EXE';
  with TRegIniFile.Create('') do
    begin
    RootKey:=HKEY_LOCAL_MACHINE;
    WriteString('Software\Microsoft\Windows\CurrentVersion\RunOnce'+#0,'Uninstall',fRun);
    Free;
    end;

0
 
LVL 1

Expert Comment

by:rpetruni
ID: 1390768
Hi,
you think registry entry?
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce
This is the place you put applications that run only once :o)
                                           Robert
0
 
LVL 1

Expert Comment

by:rpetruni
ID: 1390769
oops, seems like we two have write this together :o)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 17

Accepted Solution

by:
inthe earned 400 total points
ID: 1390770
and to answer the question...Wininit.ini.
example of usage:
this will delete the exe running this code(ie project1)on the next reboot.

procedure TForm1.Button2Click(Sender: TObject);
  var tmp:array[0..1024] of char;
      appshortname,windir,buffer:string;
      f:textfile;
      backupfile:tstringlist;
      c:word;
      doit:boolean;
begin
   getshortpathname(pchar(application.exename),tmp,1025);
    appshortname:=string(tmp);
    getwindowsdirectory(tmp,1025);
    windir:=string(tmp);
    if length(windir)>3 then windir:=windir+'\';
    assignfile(f,windir+'wininit.ini');
    if fileexists(windir+'wininit.ini')=false then
    begin
      rewrite(f);
      writeln(f,'[Rename]');
      writeln(f,'nul='+appshortname);
    end else
    begin
      backupfile:=tstringlist.create;
      reset(f);
      while not eof(f) do
      begin
        readln(f,buffer);
        backupfile.add(buffer);
      end;
      closefile(f);
      doit:=false;
      for c:=0 to backupfile.count-1 do
      if uppercase(backupfile.strings[c])='[RENAME]' then
      begin
        backupfile.insert(c+1,'nul='+appshortname);
        doit:=true;
        break;
      end;
      rewrite(f);
      for c:=0 to backupfile.count-1 do writeln(f,backupfile.strings[c]);
      if doit=false then
      begin
        writeln(f,'[Rename]');
        writeln(f,'nul='+appshortname);
      end;
      backupfile.free;
    end;
    closefile(f);
end;


see :
http://www.zdnet.com/pcmag/pctech/content/solutions/uu1718a.htm 


Regards Barry





0
 
LVL 1

Author Comment

by:duke_n
ID: 1390771
I see...
(actually I remember someone here gave me the INI file. Using it makes windows show "Updating system files... this might take a few minutes" and "Completed Updating, Continuing to load windows" or something like this messages)

ANyway, this is as good as the INI method.

Only one more thing if you don't mind(if ye do, I'll raise the points): It denies my access when I try to delete my ALREADY EMPTY Dir in the C:\Program files\. probably this happens 'cause of the "speciality" of the dir C:\Program files\.
How to delete it, anyway?
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390772
Oh, my god, BROTHER!!!!
I believe this could be written in at least 3 times less lines.
one sec...
all under "Rename" section will be DELETED or RENAMED?
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390773
Ahh.
I see.. Renamed to "Nul"=deleted. Right?
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390774
Ahh.
I see.. Renamed to "Nul"=deleted. Right?
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390775
Ahh.
I see.. Renamed to "Nul"=deleted. Right?
0
 
LVL 2

Expert Comment

by:CalvinDay
ID: 1390776
Please, your filling up my email box! Just kidding.
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390777
whoops...
sorry!
that was accidental.
so what about "c:\program files\mydir"?
0
 
LVL 17

Expert Comment

by:inthe
ID: 1390778
email overflow ;-)

>>>"Nul"=deleted. Right?

yep :-)
and i suspect that about half the code is not needed...
it was cut n paste from dejanews for another question also about same issue and i never bothered ot change anything as it seems to work and im not short of disk space :-)
Regards Barry
ps be interesting to see just how short you can get it to..

0
 
LVL 17

Expert Comment

by:inthe
ID: 1390779
"c:\program files\mydir"  ???

what about it?
what do you mean?

0
 
LVL 1

Author Comment

by:duke_n
ID: 1390780
When I try to delete it , windows shows an "Access Denied" exception.
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390781
P.S. I thought: it ain't a regular INI. it can have 50 values with name "Nul". so I wouldn't be able to short it much(or at all)
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390782
P.S. I thought: it ain't a regular INI. it can have 50 values with name "Nul". so I wouldn't be able to short it much(or at all)
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390783
This wasn't so easy after all.
You showed me an error I might have made if I only had the name of the INI
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390784
(so I increased the points, if you noticed. they are yers as soon as we'll get it over with "Access denied" on deleting dir)
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390785
(so I increased the points, if you noticed. they are yers as soon as we'll get it over with "Access denied" on deleting dir)
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390786
sh*t. messages post themselves more than once ! I sware I pressed "Submit" only once
0
 
LVL 17

Expert Comment

by:inthe
ID: 1390787
Hi Duke_n
make a demo project that causes the error
and send to me at legend@enterprise.net
that is my home address which i'll be there in about 25-30 mins (dont have delphi where i am now to test)

i'll fix it and send back to you.
await the mail.
Regards Barry
0
 
LVL 1

Author Comment

by:duke_n
ID: 1390788
I'm sorry.
When I tried to make a dummy project that does that, It worked...

So I'll have to find the sh*t myself.
you've been VERY helpful, thanx
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question