44using Microsoft . Win32 ;
55using System . Runtime . CompilerServices ;
66using Windows . Win32 ;
7+ using Windows . Win32 . Foundation ;
78using Windows . Win32 . System . Com ;
89using Windows . Win32 . System . WinRT ;
910using WinRT ;
@@ -19,30 +20,30 @@ private static unsafe (bool Success, ulong Capacity, ulong Used) GetSyncRootQuot
1920 ! Guid . TryParse ( factoryClsidString , out var factoryClsid ) )
2021 return ( false , 0 , 0 ) ;
2122
23+ HRESULT hr = default ;
2224 ulong ulTotalSize = 0ul , ulUsedSize = 0ul ;
2325 using ComPtr < IStorageProviderStatusUISourceFactory > pStorageProviderStatusUISourceFactory = default ;
2426 using ComPtr < IStorageProviderStatusUISource > pStorageProviderStatusUISource = default ;
2527 using ComPtr < IStorageProviderStatusUI > pStorageProviderStatusUI = default ;
2628 using ComPtr < IStorageProviderQuotaUI > pStorageProviderQuotaUI = default ;
2729
28- var hr = PInvoke . CoCreateInstance (
30+ if ( PInvoke . CoCreateInstance (
2931 & factoryClsid ,
3032 null ,
3133 CLSCTX . CLSCTX_LOCAL_SERVER ,
3234 ( Guid * ) Unsafe . AsPointer ( ref Unsafe . AsRef ( in IStorageProviderStatusUISourceFactory . Guid ) ) ,
33- ( void * * ) pStorageProviderStatusUISourceFactory . GetAddressOf ( ) ) ;
34- if ( hr . Failed )
35+ ( void * * ) pStorageProviderStatusUISourceFactory . GetAddressOf ( ) ) . ThrowIfFailedOnDebug ( ) . Failed )
3536 return ( false , 0 , 0 ) ;
3637
3738 var syncRootIdHString = new MarshalString . Pinnable ( syncRootId ) ;
3839 fixed ( char * pSyncRootIdHString = syncRootIdHString )
3940 {
40- hr = pStorageProviderStatusUISourceFactory . Get ( ) ->GetStatusUISource ( syncRootIdHString . GetAbi ( ) , pStorageProviderStatusUISource . GetAddressOf ( ) ) . ThrowOnFailure ( ) ;
41- hr = pStorageProviderStatusUISource . Get ( ) ->GetStatusUI ( pStorageProviderStatusUI . GetAddressOf ( ) ) . ThrowOnFailure ( ) ;
42- hr = pStorageProviderStatusUI . Get ( ) ->GetQuotaUI ( pStorageProviderQuotaUI . GetAddressOf ( ) ) . ThrowOnFailure ( ) ;
43-
44- hr = pStorageProviderQuotaUI . Get ( ) ->GetQuotaTotalInBytes ( & ulTotalSize ) ;
45- hr = pStorageProviderQuotaUI . Get ( ) -> GetQuotaUsedInBytes ( & ulUsedSize ) ;
41+ if ( pStorageProviderStatusUISourceFactory . Get ( ) ->GetStatusUISource ( syncRootIdHString . GetAbi ( ) , pStorageProviderStatusUISource . GetAddressOf ( ) ) . ThrowIfFailedOnDebug ( ) . Failed ||
42+ pStorageProviderStatusUISource . Get ( ) ->GetStatusUI ( pStorageProviderStatusUI . GetAddressOf ( ) ) . ThrowIfFailedOnDebug ( ) . Failed ||
43+ pStorageProviderStatusUI . Get ( ) ->GetQuotaUI ( pStorageProviderQuotaUI . GetAddressOf ( ) ) . ThrowIfFailedOnDebug ( ) . Failed ||
44+ pStorageProviderQuotaUI . Get ( ) -> GetQuotaTotalInBytes ( & ulTotalSize ) . ThrowIfFailedOnDebug ( ) . Failed ||
45+ pStorageProviderQuotaUI . Get ( ) ->GetQuotaUsedInBytes ( & ulUsedSize ) . ThrowIfFailedOnDebug ( ) . Failed )
46+ return ( false , 0 , 0 ) ;
4647 }
4748
4849 return ( true , ulTotalSize , ulUsedSize ) ;
0 commit comments