Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Cannot set a reg entry by installing from an INF file

- - - - -

  • Please log in to reply
8 replies to this topic

#1
LeveL

LeveL

    Senior Member

  • Member
  • PipPipPipPip
  • 551 posts
I searched Google and this forum, nothing I have tried works.

I want to add a reg entry under:

HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce

This should be straightforward - just put this line in HIVESFT.INF where RunOnce appears:

HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","MyEntry",0x00000000,"MyFile.bat"

1 - MyFile.bat is already in %systemroot%\
2 - It doesn't need the path, just referencing the bat file has worked in the past.

I have been trying for hours now, over 2 days and nothing works.

I put an INF file on the desktop that says:

[Version]
Signature = "$Windows NT$"

[DefaultInstall]
AddReg = StartRunOnce

[StartRunOnce]
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","MyEntry",0x00000000,"MyFile.bat"

But if I right click this INF and check in the registry under that key, the entry "MyEntry" is not there.

I have tried every single way I can think now, searched Google, searched here, no one seems to have this problem.

What do I need in the INF file to make it work?

Be prepared for every single suggestion to fail by the way. Thats if anyone even has anything to suggest, theres only one way to do this and I have tried so many varied lines now, I must have used the correct syntax at least once!


How to remove advertisement from MSFN

#2
Noise

Noise

    Windows Guru

  • Member
  • PipPipPip
  • 425 posts
The batch file needs to go in to %SystemRoot%\System32 if you don't want to specify a path.

#3
LeveL

LeveL

    Senior Member

  • Member
  • PipPipPipPip
  • 551 posts

The batch file needs to go in to %SystemRoot%\System32 if you don't want to specify a path.


Aside from that having nothing to do with it entering data under a reg key from an INF file, you're wrong anyway.

It doesn't, it goes in %systemroot% and that doesn't need any path.

I already know this looking for example at the file in my WINDOWS folder called "RTHDCPL.EXE" that is a program for my sound card - see, pathless and it does run...

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"RTHDCPL"="RTHDCPL.EXE"

Thats all that says plus I know it works because I have done it before, thats why I am doing it this way now.

Please stop confusing things. Or don't reply if you don't know!

But for now I am not even at that point and don't want to jump the gun here when the very initial thing isn't even working.

Just downloaded this from RyanVM:
[Tool] Reg2Inf converter v0.46
http://www.ryanvm.ne...opic.php?t=2169

It gave me this converted to INF (from a reg file I know for certain does work to put the entry in, as a reg file)

[Version]
Signature = "$Windows NT$"

[DefaultInstall]
AddReg = REGEntries.AddReg

[REGEntries.AddReg]
HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce","MyEntry",0x0,"MyFile.bat"

Nice, the 0x00000000 has changed to 0x0, I had my hopes up there for a minute but guess what - does not work.

Nothing anyone can suggest could make it work, I don't even know why I am asking. :}

Thats not to say people here are daft I am saying there IS no answer.

All I can think is the registry is broken, or locked down in some way even though I am the Administrator logged in as Administrator, why oh why isn't any of this working?

I have tried countless times now right clicking an INF to "install" it into the registry and its not working.

PS yes if I do "REG ADD" in a batch file that works perfectly, but even then the batch file is being deleted from the WINDOWS folder and I don't know why. Its supposed to run on next reboot not just vanish off the face of the earth, but nevermind, I am not even at that point yet, all I want to solve is this INF and to make it put the entry in.

No, the answer isn't anything other than putting a line in HIVESFT.INF it must go there, please don't suggest anything else when this is what I need to do. People always say do this and do that but I tried it hours ago, or can't do it.

Edited by LeveL, 30 March 2009 - 09:21 AM.


#4
iamtheky

iamtheky

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 866 posts
Is the batch file in place after install (just no execute), or did it not copy over at all?
iamtheKy

#5
Noise

Noise

    Windows Guru

  • Member
  • PipPipPip
  • 425 posts
[Version]

Signature = "$Windows NT$"



[DefaultInstall]

AddReg = REGEntries.AddReg



[REGEntries.AddReg]

HKLM,%RunOnce%

HKLM,%RunOnce%,"MyEntry",,"MyFile.bat"



[Strings]

RunOnce="SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"


#6
LeveL

LeveL

    Senior Member

  • Member
  • PipPipPipPip
  • 551 posts
Thanks but I found out that the RunOnce key cannot "hold" an entry, thats why it does not appear there, it does appear but vanishes in like 0.00001 seconds.

Im doing it under another key now and will just have to fix it later to stop it running on every reboot.

So there you go - the RunOnce key might as well not be there because you can't add anything to it, not using an INF anyway.

#7
IcemanND

IcemanND

    MSFN Junkie

  • Super Moderator
  • 3,266 posts
  • OS:Windows 7 x64
  • Country: Country Flag
When adding RunOnce keys via an INF install they are run immediately after the INF install completes.

From: http://support.microsoft.com/kb/281820

All RunOnce entries in the registry are run in the following cases:

1. At the end of installation through InstallFromHinfSection even in the cases where you must restart the computer.
2. After the default processing of DIF_INSTALLDEVICE even if you must restart the computer (with the exception of server-side processing).
3. After the system has been restarted.


Further down the same page:

Programs that must run once when the computer is restarted should be specified through RunOnceEx entries.


You should be seeing one of two things when you run the INF you provided, either an error that myfile.bat is not a valid win32 application, or you see you bat file flash on the screen as it runs.

#8
iamtheky

iamtheky

    Friend of MSFN

  • Member
  • PipPipPipPipPip
  • 866 posts
I never got the exclamation point trick to work with runonce, but placing it before your key is supposed to prevent deletion.
iamtheKy

#9
LeveL

LeveL

    Senior Member

  • Member
  • PipPipPipPip
  • 551 posts
OK thanks, yes I will probably switch to RunOnceEx at some point.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN