changeset 436:efc7757f7652

Call uac dialog, get admin permission and perform priviliged actions.
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Mon, 31 Oct 2011 01:28:02 +0200
parents a19d7b7ed2bc
children f2ca93785a54
files admin/win/reg/Makefile
diffstat 1 files changed, 19 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/admin/win/reg/Makefile	Mon Oct 31 00:36:52 2011 +0200
+++ b/admin/win/reg/Makefile	Mon Oct 31 01:28:02 2011 +0200
@@ -20,13 +20,25 @@
 .PHONY: install
 install:
 ifeq 'windows' '$(host_os)'
-	reg import cmd.reg
-	reg import gooddies.reg
-	if EMACSCLIENT_PATH=`command -v emacsclientw`; then \
-		EMACSCLIENT_PATH=`cygpath -w $$EMACSCLIENT_PATH | sed 's=\\\\=&&&&=g'`; \
-		sed "s=@@path-to-emacsclient@@=$$EMACSCLIENT_PATH=g" <emacs.reg >emacs.tmp.reg; \
-		reg import emacs.tmp.reg; rm emacs.tmp.reg; \
-	fi
+	{ \
+  echo 'cd /d %1'; \
+  echo reg import cmd.reg; \
+  echo reg import gooddies.reg; \
+  if EMACSCLIENT_PATH=`command -v emacsclientw`; then \
+    EMACSCLIENT_PATH=`cygpath -w $$EMACSCLIENT_PATH | sed 's=\\\\=&&&&=g'`; \
+    sed "s=@@path-to-emacsclient@@=$$EMACSCLIENT_PATH=g" <emacs.reg >emacs.tmp.reg; \
+    echo reg import emacs.tmp.reg; \
+  fi; \
+  echo 'pause'; \
+} >regimport.bat; \
+{ \
+  echo 'var fso = new ActiveXObject("Scripting.FileSystemObject");'; \
+  echo 'var curdir = fso.GetParentFolderName(WScript.ScriptFullName);'; \
+  echo 'var objShell = new ActiveXObject("shell.application");'; \
+  echo 'objShell.ShellExecute("regimport.bat", curdir, "", "runas", 1);'; \
+} >runas.js; \
+cscript runas.js;
+	rm -f regimport.bat runas.js emacs.tmp.reg;
 endif
 
 .PHONY: uninstall