]> gitweb.factorcode.org Git - factor.git/commitdiff
flesh out windows implementation
authorCat Stevens <catb0t@protonmail.ch>
Sat, 19 May 2018 20:57:15 +0000 (16:57 -0400)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 25 Jan 2022 18:28:04 +0000 (10:28 -0800)
basis/elevate/windows/windows.factor

index 6d2934ab53044d959085b218506ee1cf0cc8ecac..404f1644c43eea822c6c13925cc312ad8d2d811d 100644 (file)
@@ -4,9 +4,20 @@ IN: elevate.windows
 
 <PRIVATE
 ! TODO
-M: windows elevated
-    3drop run-process ;
+M:: windows elevated ( command replace? win-console? posix-graphical? -- process )
+    already-root? [
+        <process> command >>command
+    ] [
+        ! hwnd lpOperation
+        f "runas"
+        command dup string? [ " " split ] when
+        ! lpFile lpParameters lpDirectory nShowCmd
+        [ first ] [ rest ] bi f win-console? 1 0 ?
+        ! call shell function
+        ShellExecuteW :> retval retval n>win32-error-check
+        retval replace? [ exit ] [ ] if
+    ] if ;
 
 ! no-op (not possible to lower)
-M: windows lowered ;
+M: windows lowered
 PRIVATE>
\ No newline at end of file