views:

58

answers:

1

Currently I have an application that runs at startup when a user log's in to the account (administrative), as well as something under HKLM...\Run which is also executed - but I need to run something once and BEFORE both these things are executed.

My solution was to use HKLM...\RunOnce which is executed before the HKLM...\Run but the task can take 30-45 seconds which gives enough time for the user Startup to be executed and launch the application prematurely.

I thought of maybe including a SLEEP but RunOnce doesn't block the user account load... Then I considered the group policies but they do not have a RunOnce equivalent that I can use... Also I am not sure if Group Policy is run at the right time (never used it before).

Is there anyway to make my RunOnce delay the account startup of my application, or a better place where I can execute it before both HKLM...\Run and user Startup? Or any recommended alternatives?

Any ideas or help would be much appreciated... Thanks,

A: 

Do you actually need to delay user login or you just need to delay the secondary applications? Assuming the latter you can use a Mutex to synchronize the separate processes. The first can declare and acquire a named mutex. The later processes can block wait on the mutex.

Sam
True - I only need to delay the second application from starting ... My problem is that I cannot change the second application itself (Startup launches an EXE and this cannot be changed nor can the exe be modified to "wait" on the mutex).
Shaitan00
@Shaitan00, you can create a wrapper app for the 2nd app which waits on the mutex and when acquired launches the original 2nd app.
Sam
I don't think - I've been told that I cannot touch the STARTUP of the user is anyway (as it would require customer re-certification).
Shaitan00
@Shaitan00, sounds like you have a requirements/management problem, not a real technical problem.
Sam
That depends, is there no way to delay user login until RunOnce has completed? Or is there somewhere other then RunOnce where I can ensure my task is performed before HKLM\...\Run and user account startup?
Shaitan00