]> gitweb.factorcode.org Git - factor.git/blob - basis/elevate/windows/windows.factor
5f4aa8f60e6386da048e2f148b2534326cbd7948
[factor.git] / basis / elevate / windows / windows.factor
1 USING: accessors alien alien.c-types elevate io.launcher kernel
2 locals math sequences splitting strings system windows.errors
3 windows.shell32 ;
4 IN: elevate.windows
5
6 <PRIVATE
7 ! TODO
8 M: windows already-root?
9     f ;
10
11 M:: windows elevated ( command replace? win-console? posix-graphical? -- process )
12     already-root? [
13         <process> command >>command
14     ] [
15         ! hwnd lpOperation
16         f "runas"
17         command dup string? [ " " split ] when
18         ! lpFile lpParameters lpDirectory nShowCmd
19         [ first ] [ rest ] bi " " join f win-console? >c-bool
20         ! call shell function
21         ShellExecuteW alien-address :> retval retval 32 <= [ retval n>win32-error-check ] [ ] if
22         retval replace? [ exit ] [ ] if
23     ] if ;
24
25 ! no-op (not possible to lower)
26 M: windows lowered ;
27 PRIVATE>