예제 #1
0
        public bool TryGetValue(
            string lpValue,
            Win32Api.RegRestrictionFlags dwFlags,
            /*ref UInt32*/ IntPtr pdwType,
            IntPtr pvData,
            /*ref UInt32*/ IntPtr pcbData)
        {
            if (!DoUni2AnsiConversion)
            {
                return(Win32Exception.CheckIfFoundAndNoError((int)key_.TryGetValueUnmanaged(lpValue, pdwType, pvData, pcbData)));
            }
            Data dst = new Data(pvData, pcbData, Data.CountIn.Bytes);

            // Sandboxie-generated reghives might contain REG_SZ values stored in ansi format
            // we need to detect them and avoid conversion for them

            return(DataTransformer.TryAlterData(pdwType, dst,
                                                (newpdwType, newDst) =>
                                                (int)key_.TryGetValueUnmanaged(lpValue, newpdwType, newDst.Ptr, newDst.PCount),
                                                (result, type) => result == Win32Api.Error.ERROR_SUCCESS &&
                                                DataTransformer.IsStringType(type),
                                                (type, pSrcData, cbSrcData) =>
                                                dst.FillWithString(new BytesString(pSrcData, cbSrcData), StringFormat.Ansi,
                                                                   Data.NullCharHandling.NotAddingIfNotPresent)));
        }
예제 #2
0
 // TODO: group parameters of every operation function and put them into separate classes
 // This overload is to implement IKey
 public void GetValue(
     string lpValue,
     Win32Api.RegRestrictionFlags dwFlags,
     /*ref UInt32*/ IntPtr pdwType,
     IntPtr pvData,
     /*ref UInt32*/ IntPtr pcbData)
 {
     GetValue(null, lpValue, dwFlags, pdwType, pvData, pcbData);
 }
예제 #3
0
 public bool TryGetValue(
     string lpValue,
     Win32Api.RegRestrictionFlags dwFlags,
     /*ref UInt32*/ IntPtr pdwType,
     IntPtr pvData,
     /*ref UInt32*/ IntPtr pcbData)
 {
     return(Win32Exception.CheckIfFoundAndNoError(
                Win32Api.RegGetValue(handle_, null, lpValue, dwFlags,
                                     pdwType, pvData, pcbData)));
 }
예제 #4
0
 internal void GetValue(
     string lpSubKey,
     string lpValue,
     Win32Api.RegRestrictionFlags dwFlags,
     /*ref UInt32*/ IntPtr pdwType,
     IntPtr pvData,
     /*ref UInt32*/ IntPtr pcbData)
 {
     ApplyReadOperation(lpSubKey, new KeySecurity(Win32Api.KeySecurity.KEY_QUERY_VALUE),
                        keyImpl =>
                        TryAlterData(lpSubKey, lpValue, keyImpl, pdwType,
                                     new Data(pvData, pcbData, Data.CountIn.Bytes),
                                     (newpdwType, dst) =>
                                     Win32Exception.CatchError(
                                         () => keyImpl.TryGetValue(lpValue, dwFlags, newpdwType,
                                                                   dst.Ptr, dst.PCount))));
 }
예제 #5
0
 public bool TryGetValue(string lpValue, Win32Api.RegRestrictionFlags dwFlags, IntPtr pdwType, IntPtr pvData, IntPtr pcbData)
 {
     return(decorated_.TryGetValue(lpValue, dwFlags, pdwType, pvData, pcbData));
 }