Bug 221429

Summary: KUniqueApplication doesn't work in windows
Product: kde-windows Reporter: Joris Guisson <joris.guisson>
Component: generalAssignee: KDE-Windows <kde-windows>
Status: RESOLVED FIXED    
Severity: normal CC: brandon.ml, krissn
Priority: NOR    
Version: 4.3   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Attachments: dbus-win32-kuniqueapplication.patch

Description Joris Guisson 2010-01-05 18:31:44 UTC
Version:            (using KDE 4.3.1)
OS:                MS Windows
Installed from:    MS Windows

Simply put you can open multiple instances of ktorrent on windows, in linux this is not possible and KUniqueApplication works as expected.
Comment 1 Christoph Feck 2010-01-05 20:05:21 UTC
Does DBus run?
Comment 2 Joris Guisson 2010-01-05 20:16:36 UTC
Yes dbus-daemon is running
Comment 3 Carlo Segato 2010-01-07 13:56:38 UTC
it works here with trunk
Comment 4 Krzysztof Nowicki 2010-04-19 11:04:06 UTC
Created attachment 42890 [details]
dbus-win32-kuniqueapplication.patch
Comment 5 Krzysztof Nowicki 2010-04-19 11:04:49 UTC
Hi,

I've been hunting down this bug and it seems that it's related to user privileges. I'm working on Windows XP without administrator rights and I hit this bug too.

I did some debugging and I tracked the problem down to DBus.

In bus/services.c, in function _dbus_process_exists() there is a call to OpenProcess(). The call requests PROCESS_ALL_ACCESS:

proc_handle = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid);

On my system this call fails with ERROR_ACCESS_DENIED.

If I change PROCESS_ALL_ACCESS to PROCESS_QUERY_INFORMATION it works.

The patch above contains the relevant code change.
Comment 6 Patrick Spendrin 2012-03-02 09:33:56 UTC
This works for a normal user in kontact (which is a KUniqueApplication) using mingw-w64 64bit on Windows 7 with the 4.8.0 release.
If that doesn't work, please reopen the bug report.