xref: /aosp_15_r20/external/cronet/base/win/winrt_storage_util.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef BASE_WIN_WINRT_STORAGE_UTIL_H_
6 #define BASE_WIN_WINRT_STORAGE_UTIL_H_
7 
8 #include <stdint.h>
9 #include <windows.storage.streams.h>
10 #include <wrl/client.h>
11 
12 #include "base/base_export.h"
13 
14 namespace base {
15 namespace win {
16 
17 // Gets an array of bytes in the |buffer|, |out| represents a array of
18 // bytes used by byte stream read and write.
19 BASE_EXPORT HRESULT
20 GetPointerToBufferData(ABI::Windows::Storage::Streams::IBuffer* buffer,
21                        uint8_t** out,
22                        UINT32* length);
23 
24 // Creates stream |buffer| from |data| that represents a array of bytes
25 // and the |length| of bytes.
26 BASE_EXPORT HRESULT CreateIBufferFromData(
27     const uint8_t* data,
28     UINT32 length,
29     Microsoft::WRL::ComPtr<ABI::Windows::Storage::Streams::IBuffer>* buffer);
30 
31 }  // namespace win
32 }  // namespace base
33 
34 #endif  // BASE_WIN_WINRT_STORAGE_UTIL_H_
35