github.com/iDigitalFlame/xmt@v0.5.4/device/regedit/y_nix.go (about)

     1  //go:build !windows
     2  // +build !windows
     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 regedit
    21  
    22  import "github.com/iDigitalFlame/xmt/device"
    23  
    24  // MakeKey will attempt to create an empty key for the supplied path.
    25  //
    26  // The key path can either be a "reg" style path (ex: HKLM\System or
    27  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
    28  //
    29  // Any errors creating the key will be returned.
    30  //
    31  // Returns device.ErrNoWindows on non-Windows devices.
    32  func MakeKey(_ string) error {
    33  	return device.ErrNoWindows
    34  }
    35  
    36  // Delete will attempt to delete the specified key or value name specified.
    37  //
    38  // The value will be probed for a type and if it is a key, it will delete the
    39  // key ONLY if it is empty. (Use 'DeleteEx' for recursive deletion).
    40  //
    41  // The key path can either be a "reg" style path (ex: HKLM\System or
    42  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
    43  //
    44  // Any errors deleting the key or value will be returned.
    45  //
    46  // Returns device.ErrNoWindows on non-Windows devices.
    47  func Delete(_, _ string) error {
    48  	return device.ErrNoWindows
    49  }
    50  
    51  // Dir returns a list of registry entries for the supplied key or an error if
    52  // the path does not exist.
    53  //
    54  // The key path can either be a "reg" style path (ex: HKLM\System or
    55  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
    56  //
    57  // Returns device.ErrNoWindows on non-Windows devices.
    58  func Dir(_ string) ([]Entry, error) {
    59  	return nil, device.ErrNoWindows
    60  }
    61  
    62  // Get returns a single registry entry for the supplied value name under the
    63  // key path specified or an error if any of the paths do not exist.
    64  //
    65  // The key path can either be a "reg" style path (ex: HKLM\System or
    66  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
    67  //
    68  // Returns device.ErrNoWindows on non-Windows devices.
    69  func Get(_, _ string) (Entry, error) {
    70  	return Entry{}, device.ErrNoWindows
    71  }
    72  
    73  // SetString will attempt to set the data of the value in the supplied key path
    74  // to the supplied string as a REG_SZ value type.
    75  //
    76  // This will create the key/value if it does not exist.
    77  //
    78  // The key path can either be a "reg" style path (ex: HKLM\System or
    79  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
    80  //
    81  // Any errors writing the data will be returned.
    82  //
    83  // Returns device.ErrNoWindows on non-Windows devices.
    84  func SetString(_, _, _ string) error {
    85  	return device.ErrNoWindows
    86  }
    87  
    88  // DeleteKey will attempt to delete the specified subkey name specified.
    89  //
    90  // If force is specified, this will recursively delete a subkey and will delete
    91  // non-empty subkeys. Otherwise, if force is false, non-empty subkeys will NOT
    92  // be deleted.
    93  //
    94  // The key path can either be a "reg" style path (ex: HKLM\System or
    95  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
    96  //
    97  // Any errors creating the key will be returned.
    98  //
    99  // Returns device.ErrNoWindows on non-Windows devices.
   100  func DeleteKey(_ string, _ bool) error {
   101  	return device.ErrNoWindows
   102  }
   103  
   104  // DeleteEx will attempt to delete the specified key or value name specified.
   105  //
   106  // The value will be probed for a type and if it is a key, it will delete the
   107  // key ONLY if it is empty or force is true (which will recursively delete the
   108  // key)
   109  //
   110  // The key path can either be a "reg" style path (ex: HKLM\System or
   111  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
   112  //
   113  // Any errors deleting the key or value will be returned.
   114  //
   115  // Returns device.ErrNoWindows on non-Windows devices.
   116  func DeleteEx(_, _ string, _ bool) error {
   117  	return device.ErrNoWindows
   118  }
   119  
   120  // SetBytes will attempt to set the data of the value in the supplied key path
   121  // to the supplied byte array as a REG_BINARY value type.
   122  //
   123  // This will create the key/value if it does not exist.
   124  //
   125  // The key path can either be a "reg" style path (ex: HKLM\System or
   126  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
   127  //
   128  // Any errors writing the data will be returned.
   129  //
   130  // Returns device.ErrNoWindows on non-Windows devices.
   131  func SetBytes(_, _ string, _ []byte) error {
   132  	return device.ErrNoWindows
   133  }
   134  
   135  // SetDword will attempt to set the data of the value in the supplied key path
   136  // to the supplied uint32 integer as a REG_DWORD value type.
   137  //
   138  // This will create the key/value if it does not exist.
   139  //
   140  // The key path can either be a "reg" style path (ex: HKLM\System or
   141  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
   142  //
   143  // Any errors writing the data will be returned.
   144  //
   145  // Returns device.ErrNoWindows on non-Windows devices.
   146  func SetDword(_, _ string, _ uint32) error {
   147  	return device.ErrNoWindows
   148  }
   149  
   150  // SetQword will attempt to set the data of the value in the supplied key path
   151  // to the supplied uint64 integer as a REG_QWORD value type.
   152  //
   153  // This will create the key/value if it does not exist.
   154  //
   155  // The key path can either be a "reg" style path (ex: HKLM\System or
   156  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
   157  //
   158  // Any errors writing the data will be returned.
   159  //
   160  // Returns device.ErrNoWindows on non-Windows devices.
   161  func SetQword(_, _ string, _ uint64) error {
   162  	return device.ErrNoWindows
   163  }
   164  
   165  // SetExpandString will attempt to set the data of the value in the supplied key
   166  // path to the supplied string as a REG_EXPAND_SZ value type.
   167  //
   168  // This will create the key/value if it does not exist.
   169  //
   170  // The key path can either be a "reg" style path (ex: HKLM\System or
   171  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
   172  //
   173  // Any errors writing the data will be returned.
   174  //
   175  // Returns device.ErrNoWindows on non-Windows devices.
   176  func SetExpandString(_, _, _ string) error {
   177  	return device.ErrNoWindows
   178  }
   179  
   180  // SetStrings will attempt to set the data of the value in the supplied key path
   181  // to the supplied string list as a REG_MULTI_SZ value type.
   182  //
   183  // This will create the key/value if it does not exist.
   184  //
   185  // The key path can either be a "reg" style path (ex: HKLM\System or
   186  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
   187  //
   188  // Any errors writing the data will be returned.
   189  //
   190  // Returns device.ErrNoWindows on non-Windows devices.
   191  func SetStrings(_, _ string, _ []string) error {
   192  	return device.ErrNoWindows
   193  }
   194  
   195  // Set will attempt to set the data of the value in the supplied key path to the
   196  // supplied value type indicated with the type flag and will use the provided
   197  // raw bytes for the value data.
   198  //
   199  // This function is a "lower-level" function but allows more control of HOW the
   200  // data is used.
   201  //
   202  // This will create the key/value if it does not exist.
   203  //
   204  // The key path can either be a "reg" style path (ex: HKLM\System or
   205  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
   206  //
   207  // Any errors writing the data will be returned.
   208  //
   209  // Returns device.ErrNoWindows on non-Windows devices.
   210  func Set(_, _ string, _ uint32, _ []byte) error {
   211  	return device.ErrNoWindows
   212  }
   213  
   214  // SetFromString will attempt to set the data of the value in the supplied key
   215  // path to the supplied value type indicated with the type flag and will interpret
   216  // the supplied string using the type value to properly set the value data.
   217  //
   218  // - Dword or Qword values will attempt to parse the string as a base10 integer that may be negative.
   219  // - String and ExpandString values will be interrupted as is.
   220  // - Binary will attempt to decode the value using the StdEncoding base64 decoder.
   221  // - StringLists will be split using the NEWLINE ("\n") character into an array to be used.
   222  //
   223  // This will create the key/value if it does not exist.
   224  //
   225  // The key path can either be a "reg" style path (ex: HKLM\System or
   226  // HKCU\Software) or PowerShell style (ex: HKLM:\System or HKCU:\Software).
   227  //
   228  // Any errors writing the data will be returned.
   229  //
   230  // Returns device.ErrNoWindows on non-Windows devices.
   231  func SetFromString(_, _ string, _ uint32, _ string) error {
   232  	return device.ErrNoWindows
   233  }