API function
-
DavidCrow wrote: HKEY_LOCAL_MACHINE exists even when no one is logged in. True. But if I'm not mistaken, a "Run" entry in the
HKEY_LOCAL_MACHINE
subtree causes the application to start after any user logs in, as opposed to a corresponding entry for a specific user in theHKEY_USERS
subtree which causes the app to only start when that user logs in. Regardless, the user has to first login. <aside> I believe this mechanism is used by installers that ask "Do you want to install this program for all users or just yourself?". </aside> /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)comRavi Bhavnani wrote: But if I'm not mistaken, a "Run" entry in the HKEY_LOCAL_MACHINE subtree causes the application to start after any user logs in...Regardless, the user has to first login. Not so. I just verified this and without logging in to the machine, the applications in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run are indeed started. [edit] The jury is still out on this one. I'll keep looking... [/edit]
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
Ravi Bhavnani wrote: But if I'm not mistaken, a "Run" entry in the HKEY_LOCAL_MACHINE subtree causes the application to start after any user logs in...Regardless, the user has to first login. Not so. I just verified this and without logging in to the machine, the applications in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run are indeed started. [edit] The jury is still out on this one. I'll keep looking... [/edit]
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
DavidCrow wrote: without logging in to the machine, the applications in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run are indeed started. That's amazing. It seems to work exactly as I described on my Win XP Home SP1 box. I confirmed this by adding a
HKEY_LOCAL_MACHINE\...
entry to this test app:#include "stdafx.h"
#include "time.h"int main(int argc, char* argv[])
{
time_t tmNow;
time (&tmNow);
char szFilespec [255];
sprintf (szFilespec, "C:\\%d.txt", tmNow);FILE* fp = fopen (szFilespec, "w");
fclose (fp);
return 0;
}and rebooting and logging in a few seconds later. As I expected, there was only one file (
C:\1124224887.txt
) created. This matches Microsoft's documentation[^] of these keys. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com -
Ravi Bhavnani wrote: But if I'm not mistaken, a "Run" entry in the HKEY_LOCAL_MACHINE subtree causes the application to start after any user logs in...Regardless, the user has to first login. Not so. I just verified this and without logging in to the machine, the applications in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run are indeed started. [edit] The jury is still out on this one. I'll keep looking... [/edit]
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
DavidCrow wrote: without logging in to the machine, the applications in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run are indeed started. That's amazing. It seems to work exactly as I described on my Win XP Home SP1 box. I confirmed this by adding a
HKEY_LOCAL_MACHINE\...
entry to this test app:#include "stdafx.h"
#include "time.h"int main(int argc, char* argv[])
{
time_t tmNow;
time (&tmNow);
char szFilespec [255];
sprintf (szFilespec, "C:\\%d.txt", tmNow);FILE* fp = fopen (szFilespec, "w");
fclose (fp);
return 0;
}and rebooting and logging in a few seconds later. As I expected, there was only one file (
C:\1124224887.txt
) created. This matches Microsoft's documentation[^] of these keys. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)comRavi Bhavnani wrote: ...and rebooting and logging in a few seconds later. But the question is does your test application run if you don't log in?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
Ravi Bhavnani wrote: Did you mean RunServices instead of Run? No.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
Ravi Bhavnani wrote: ...and rebooting and logging in a few seconds later. But the question is does your test application run if you don't log in?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-
DavidCrow wrote: HKEY_LOCAL_MACHINE exists even when no one is logged in. True. But if I'm not mistaken, a "Run" entry in the
HKEY_LOCAL_MACHINE
subtree causes the application to start after any user logs in, as opposed to a corresponding entry for a specific user in theHKEY_USERS
subtree which causes the app to only start when that user logs in. Regardless, the user has to first login. <aside> I believe this mechanism is used by installers that ask "Do you want to install this program for all users or just yourself?". </aside> /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)comRavi Bhavnani wrote: But if I'm not mistaken, a "Run" entry in the HKEY_LOCAL_MACHINE subtree causes the application to start after any user logs in, as opposed to a corresponding entry for a specific user in the HKEY_USERS subtree which causes the app to only start when that user logs in. Regardless, the user has to first login. That's the way I've taken it to work, I always have to log in of HKLM\...\Run to take effect. One thing I suggest doing though, is use Winlogon Notification Packages (assuming you're programming for an NT-based version of windows), you can listen to startup/shutdown/login/logoff and other events. Check: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/winlogon\_notification\_packages.asp HTH
-
Ravi Bhavnani wrote: But if I'm not mistaken, a "Run" entry in the HKEY_LOCAL_MACHINE subtree causes the application to start after any user logs in, as opposed to a corresponding entry for a specific user in the HKEY_USERS subtree which causes the app to only start when that user logs in. Regardless, the user has to first login. That's the way I've taken it to work, I always have to log in of HKLM\...\Run to take effect. One thing I suggest doing though, is use Winlogon Notification Packages (assuming you're programming for an NT-based version of windows), you can listen to startup/shutdown/login/logoff and other events. Check: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/winlogon\_notification\_packages.asp HTH
-
-
Hi all, I wanna create a program that startup each time the pc started..which api i can used? :rolleyes:
One thing I suggest doing, is use Winlogon Notification Packages (assuming you're programming for an NT-based version of windows), you can listen to startup/shutdown/login/logoff and other events. Check: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthn/security/winlogon\_notification\_packages.asp HTH
-
-
why would there have to be two? if its started on startup it wouldnt create another process of itself for the user logging in. would it?
I booted the system at 2:30pm and logged in at 2:35pm. The file was timestamped 2:35pm. My point was, if the application ran on boot up, there would have been 2 files - one timestamped 2:30pm and the other 2:35pm. I also confirmed that the file is created every time I login. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com
-
I booted the system at 2:30pm and logged in at 2:35pm. The file was timestamped 2:35pm. My point was, if the application ran on boot up, there would have been 2 files - one timestamped 2:30pm and the other 2:35pm. I also confirmed that the file is created every time I login. /ravi My new year's resolution: 2048 x 1536 Home | Music | Articles | Freeware | Trips ravib(at)ravib(dot)com