I am trying to both limit my application to a single instance and pass arguments to the existing instance if another instance is started by the end-user. I am using the technique of a named global mutex to detect another instance and then passing a windows message using PostMessage() to the other instance to pass arguments to it. When running on Vista with UAC enabled, the calls to PostMessage() fail with ERROR_ACCESS_DENIED. Other calls to ShowWindow() and SetForegroundWindow() are also failing the same way. Does anyone know of a solution/approach for solving for this when UAC on Vista is running?
Hi, What your are experiencing is certainly coming from the UIPI mechanism in Vista (User Interface Privilege Isolation). If my guess is correct, the two instances are NOT running under the same integrity level. In order to correct that, you should call, at the beginning of your program before any thing else, the function ChangeWindowMessageFilter with the value of the message to want to exchange and the parameter dwFlag specified as MSGFLT_ADD. Doing so will allow any instance of your program to accept receiving the given message even if it comes from processes with a lower integrity level. I hope my diagnosis is correct...tell me if you still experience the access denied error on PostMessage using my suggestion. Cheers, -- Mounir IDRASSI IDRIX http://www.idrix.fr to reach : mounir_idrix_fr (replace the underscores with the at and dot characters respectively) "Mike" wrote: > I am trying to both limit my application to a single instance and pass > arguments to the existing instance if another instance is started by the > end-user. > > I am using the technique of a named global mutex to detect another instance > and then passing a windows message using PostMessage() to the other instance > to pass arguments to it. > > When running on Vista with UAC enabled, the calls to PostMessage() fail with > ERROR_ACCESS_DENIED. Other calls to ShowWindow() and SetForegroundWindow() > are also failing the same way. > > Does anyone know of a solution/approach for solving for this when UAC on > Vista is running?
Thank you Mounir, this has solved my issue! "Mounir IDRASSI" wrote: > Hi, > > What your are experiencing is certainly coming from the UIPI mechanism in > Vista (User Interface Privilege Isolation). If my guess is correct, the two > instances are NOT running under the same integrity level. > In order to correct that, you should call, at the beginning of your program > before any thing else, the function ChangeWindowMessageFilter with the value > of the message to want to exchange and the parameter dwFlag specified as > MSGFLT_ADD. Doing so will allow any instance of your program to accept > receiving the given message even if it comes from processes with a lower > integrity level. > > I hope my diagnosis is correct...tell me if you still experience the access > denied error on PostMessage using my suggestion. > > Cheers, > -- > Mounir IDRASSI > IDRIX > http://www.idrix.fr > > to reach : mounir_idrix_fr (replace the underscores with the at and dot > characters respectively) > > > "Mike" wrote: > > > I am trying to both limit my application to a single instance and pass > > arguments to the existing instance if another instance is started by the > > end-user. > > > > I am using the technique of a named global mutex to detect another instance > > and then passing a windows message using PostMessage() to the other instance > > to pass arguments to it. > > > > When running on Vista with UAC enabled, the calls to PostMessage() fail with > > ERROR_ACCESS_DENIED. Other calls to ShowWindow() and SetForegroundWindow() > > are also failing the same way. > > > > Does anyone know of a solution/approach for solving for this when UAC on > > Vista is running?