Ejemplo n.º 1
0
        private ErrorCode WalletGetRecordValueHandler(int storage_handle, int record_handle, ref IntPtr record_value_p,
                                                      ref IntPtr record_value_len_p)
        {
            try
            {
                var buffer = _storage.GetRecordValueAsync(storage_handle, record_handle).GetAwaiter().GetResult();

                IntPtr unmanagedMemoryPtr = Marshal.AllocHGlobal(buffer.Length);
                Marshal.Copy(buffer, 0, unmanagedMemoryPtr, buffer.Length);

                record_value_p     = unmanagedMemoryPtr;
                record_value_len_p = new IntPtr(buffer.Length);

                return(ErrorCode.Success);
            }
            catch
            {
                return(ErrorCode.WalletStorageError);
            }
        }