]> gitweb.factorcode.org Git - factor.git/commitdiff
fix bugs in windows implementation
authorCat Stevens <catb0t@protonmail.ch>
Sat, 19 May 2018 21:32:14 +0000 (17:32 -0400)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 25 Jan 2022 18:28:04 +0000 (10:28 -0800)
basis/elevate/windows/windows.factor

index 404f1644c43eea822c6c13925cc312ad8d2d811d..5f4aa8f60e6386da048e2f148b2534326cbd7948 100644 (file)
@@ -1,9 +1,13 @@
-USING: io.launcher elevate ;
+USING: accessors alien alien.c-types elevate io.launcher kernel
+locals math sequences splitting strings system windows.errors
+windows.shell32 ;
 IN: elevate.windows
 
-
 <PRIVATE
 ! TODO
+M: windows already-root?
+    f ;
+
 M:: windows elevated ( command replace? win-console? posix-graphical? -- process )
     already-root? [
         <process> command >>command
@@ -12,12 +16,12 @@ M:: windows elevated ( command replace? win-console? posix-graphical? -- process
         f "runas"
         command dup string? [ " " split ] when
         ! lpFile lpParameters lpDirectory nShowCmd
-        [ first ] [ rest ] bi f win-console? 1 0 ?
+        [ first ] [ rest ] bi " " join f win-console? >c-bool
         ! call shell function
-        ShellExecuteW :> retval retval n>win32-error-check
+        ShellExecuteW alien-address :> retval retval 32 <= [ retval n>win32-error-check ] [ ] if
         retval replace? [ exit ] [ ] if
     ] if ;
 
 ! no-op (not possible to lower)
-M: windows lowered
-PRIVATE>
\ No newline at end of file
+M: windows lowered ;
+PRIVATE>