Пример #1
0
 internal bool TryAlterData(KeyIdentity key, string valueName,
                            IKeyImpl keyImpl, IntPtr pdwType, Data dst, DataTransformer.Operation operation)
 {
     // TODO: this is a specific check that
     // rewrite is done only for values in sandboxie reghive which is BASE_HIVE
     // and if values are copied, DIFF_HIVE is also supported
     // It should be put outside this generalized class
     if (keyImpl.GetDisposition() == KeyDisposition.WINDOWS_REG)
     {
         return(Win32Exception.CheckIfFoundAndNoError(operation(pdwType, dst)));
     }
     return(DataTransformer.TryAlterData(pdwType, dst, operation,
                                         (result, type) =>
     {
         DebugLogger.WriteLine(@"AlterData {0} {1}\{2} ({3}) Result: {4}",
                               keyImpl.GetDisposition(), key.ToString(), valueName, type, (int)result);
         return result == Win32Api.Error.ERROR_SUCCESS &&
         DataTransformer.IsStringType(type);
     },
                                         (type, pSrcData, cbSrcData) =>
                                         DataTransformer.TransformStringValue(
                                             type, pSrcData, cbSrcData, dst, str => CallStrAlterers(key, valueName, str),
                                             HookBarrier.IsLastInjectedFuncAnsi ? StringFormat.Ansi : StringFormat.Unicode)));
 }
Пример #2
0
 private bool TryAlterData(string subKey, string value, IKeyImpl keyImpl,
                           IntPtr pdwType, Data dst, DataTransformer.Operation operation)
 {
     return(alterer_.TryAlterData(new KeyIdentity(identity_, Win32Api.RegWow64Options.None, subKey),
                                  value, keyImpl, pdwType, dst, operation));
 }