github.com/iDigitalFlame/xmt@v0.5.4/com/pipe/xy_windows_crypt.go (about) 1 //go:build windows && crypt 2 // +build windows,crypt 3 4 // Copyright (C) 2020 - 2023 iDigitalFlame 5 // 6 // This program is free software: you can redistribute it and/or modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation, either version 3 of the License, or 9 // any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with this program. If not, see <https://www.gnu.org/licenses/>. 18 // 19 20 package pipe 21 22 import "github.com/iDigitalFlame/xmt/util/crypt" 23 24 var ( 25 // PermEveryone is the SDDL string used in Windows Pipes to allow anyone to 26 // write and read to the listening Pipe 27 // 28 // This can be used for Pipe communication between privilege boundaries. 29 // 30 // Can be applied with the ListenPerm function. 31 PermEveryone = crypt.Get(22) // D:PAI(A;;FA;;;WD)(A;;FA;;;SY) 32 33 // ErrTimeout is an error returned by the 'Dial*' functions when the 34 // specified timeout was reached when attempting to connect to a Pipe. 35 ErrTimeout = &errno{m: crypt.Get(23), t: true} // connection timeout 36 // ErrEmptyConn is an error received when the 'Listen' function receives a 37 // shortly lived Pipe connection. 38 // 39 // This error is only temporary and does not indicate any Pipe server failures. 40 ErrEmptyConn = &errno{m: crypt.Get(24), t: true} // empty connection 41 ) 42 43 // Format will ensure the path for this Pipe socket fits the proper OS based 44 // pathname. Valid path names will be returned without any changes. 45 func Format(s string) string { 46 if len(s) > 2 && s[0] == '\\' && s[1] == '\\' { 47 return s 48 } 49 return crypt.Get(25) + s // \\.\pipe\ 50 }