Documentation
¶
Index ¶
- Variables
- func AdjustPrivileges(_ ...string) error
- func AdjustTokenPrivileges(_ uintptr, _ ...string) error
- type RegistryFile
- func (RegistryFile) Close() error
- func (r RegistryFile) IsDir() bool
- func (r RegistryFile) ModTime() time.Time
- func (r RegistryFile) Mode() os.FileMode
- func (r RegistryFile) Name() string
- func (r *RegistryFile) Read(b []byte) (int, error)
- func (r RegistryFile) Size() int64
- func (r RegistryFile) String() string
- func (r RegistryFile) Sys() interface{}
- type Service
Constants ¶
This section is empty.
Variables ¶
var ErrNoWindows = xerr.New("only supported on Windows devices")
ErrNoWindows is an error that is returned when a non-Windows device attempts a Windows specific function.
Functions ¶
func AdjustPrivileges ¶
AdjustPrivileges will attempt to enable the supplied Windows privilege values on the current process's Token. Errors during encoding, lookup or assignment will be returned and not all privileges will be assigned, if they occur. Always returns 'ErrNoWindows' on non-Windows devices.
func AdjustTokenPrivileges ¶
AdjustTokenPrivileges will attempt to enable the supplied Windows privilege values on the supplied process Token. Errors during encoding, lookup or assignment will be returned and not all privileges will be assigned, if they occur. Always returns 'ErrNoWindows' on non-Windows devices.
Types ¶
type RegistryFile ¶
type RegistryFile struct {
// contains filtered or unexported fields
}
RegistryFile is a struct that is returned from a Registry function call on Windows devices. This interface is a combinaton of the io.Reader and os.FileInfo interfaces.
func Registry ¶
func Registry(_, _ string) (*RegistryFile, error)
Registry attempts to open a registry value or key, value pair on Windows devices. Returns err if the system is not a Windows device or an error occurred during the open. Always returns 'ErrNoWindows' on non-windows devices.
func (RegistryFile) Close ¶
func (RegistryFile) Close() error
Close fulfills the io.Closer interface. For this struct, this function does nothing and always returns nil.
func (RegistryFile) IsDir ¶
func (r RegistryFile) IsDir() bool
IsDir returns true if the specified registry path represents a key.
func (RegistryFile) ModTime ¶
func (r RegistryFile) ModTime() time.Time
ModTime returns the RegistryFile's last modified time, if avaliable.
func (RegistryFile) Mode ¶
func (r RegistryFile) Mode() os.FileMode
Mode returns the file mode of this RegistryFile. This will return a ModeDir is this represents a key.
func (RegistryFile) Name ¶
func (r RegistryFile) Name() string
Name returns the full path of this RegistryFile.
func (*RegistryFile) Read ¶
func (r *RegistryFile) Read(b []byte) (int, error)
Read will attempt to read the data from this RegistryFile into the supplied buffer. This will return io.EOF if this struct represents a key.
func (RegistryFile) Size ¶
func (r RegistryFile) Size() int64
Size returns the size of the data enclosed in this RegistryFile. This function returns 0 if the path is to a registry key or there is not data to read.
func (RegistryFile) String ¶
func (r RegistryFile) String() string
Similar to the Name function, this returns the full path of this RegistryFile.
func (RegistryFile) Sys ¶
func (r RegistryFile) Sys() interface{}
Sys will return a pointer to the underlying buffer if the RegistryFile represents a value.
type Service ¶
Service is a struct that assists in running a Windows service. This struct can be created and given functions to run (Exec - the function to run for each Timeout when greater than zero, Start - function to run on service start, End - function to run on service shutdown.) Trigger the service to start by using the 'Service.Run' function. The 'Run' function always returns 'ErrNoWindows' on non-Windows devices.
func (*Service) Run ¶
Run will trigger the service to start and will block until the service completes. Will always returns 'ErrNoWindows' on non-Windows devices.
func (*Service) RunContext ¶
RunContext will trigger the service to start and will block until the service completes. Will always returns 'ErrNoWindows' on non-Windows devices. This function allows to pass a Context to cancel the running service.