[virt-tools-list] [PATCH virt-viewer] Use a mutex to check if VirtViewer running, v2

Marc-André Lureau marcandre.lureau at gmail.com
Fri Oct 19 23:26:28 UTC 2012


On Sat, Oct 20, 2012 at 1:21 AM, Marc-André Lureau
<marcandre.lureau at gmail.com> wrote:
> We need to warn user that installer can't proceed if there is already
> a running instance of VirtViewer or of the installer.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=864033
> ---
>  data/virt-viewer.nsis.in | 11 +++++++++++
>  src/virt-viewer-util.c   |  9 +++++++++
>  2 files changed, 20 insertions(+)
>
> diff --git a/data/virt-viewer.nsis.in b/data/virt-viewer.nsis.in
> index 45af104..1ff49d9 100644
> --- a/data/virt-viewer.nsis.in
> +++ b/data/virt-viewer.nsis.in
> @@ -45,6 +45,17 @@ Function RegisterApplication
>      WriteRegDWord HKCU "${REG_IEPOLICY}" "Policy" 3
>  FunctionEnd
>
> +Function .onInit
> +retry:
> + System::Call 'kernel32::CreateMutexA(i 0, i 0, t "VirtViewerMutex") i .r1 ?e'
> + Pop $R0
> + StrCmp $R0 0 end
> +   System::Call 'kernel32::CloseHandle(i r1) i.s'
> +   MessageBox MB_ICONEXCLAMATION|MB_RETRYCANCEL "VirtViewer is already running, quit any instance and retry." IDRETRY retry IDCANCEL cancel
> +cancel:
> +   Abort

Doh! Sorry it's late. There is a missing end: here. Fixed

> +FunctionEnd


-- 
Marc-André Lureau




More information about the virt-tools-list mailing list