@@ -40,16 +40,16 @@ public bool Add(Secret secret)
4040#pragma warning disable CA1416
4141 var stringPtr = Marshal . StringToHGlobalUni ( secret . Value ) ;
4242 var res = AdvApi32 . CredWrite ( new AdvApi32 . CREDENTIAL
43- {
44- AttributeCount = 0 ,
45- Attributes = nint . Zero ,
46- Type = AdvApi32 . CRED_TYPE . CRED_TYPE_GENERIC ,
47- Persist = AdvApi32 . CRED_PERSIST . CRED_PERSIST_LOCAL_MACHINE ,
48- TargetName = new StrPtrAuto ( secret . Name ) ,
49- UserName = new StrPtrAuto ( "default" ) ,
50- CredentialBlobSize = ( uint ) Encoding . Unicode . GetByteCount ( secret . Value ) ,
51- CredentialBlob = stringPtr
52- } ,
43+ {
44+ AttributeCount = 0 ,
45+ Attributes = nint . Zero ,
46+ Type = AdvApi32 . CRED_TYPE . CRED_TYPE_GENERIC ,
47+ Persist = AdvApi32 . CRED_PERSIST . CRED_PERSIST_LOCAL_MACHINE ,
48+ TargetName = new StrPtrAuto ( secret . Name ) ,
49+ UserName = new StrPtrAuto ( "default" ) ,
50+ CredentialBlobSize = ( uint ) Encoding . Unicode . GetByteCount ( secret . Value ) ,
51+ CredentialBlob = stringPtr
52+ } ,
5353 0 ) ;
5454 Marshal . FreeHGlobal ( stringPtr ) ;
5555 return res ;
@@ -114,16 +114,16 @@ public async Task<bool> AddAsync(Secret secret)
114114#pragma warning disable CA1416
115115 var stringPtr = Marshal . StringToHGlobalUni ( secret . Value ) ;
116116 var res = await Task . Run ( ( ) => AdvApi32 . CredWrite ( new AdvApi32 . CREDENTIAL
117- {
118- AttributeCount = 0 ,
119- Attributes = nint . Zero ,
120- Type = AdvApi32 . CRED_TYPE . CRED_TYPE_GENERIC ,
121- Persist = AdvApi32 . CRED_PERSIST . CRED_PERSIST_LOCAL_MACHINE ,
122- TargetName = new StrPtrAuto ( secret . Name ) ,
123- UserName = new StrPtrAuto ( "default" ) ,
124- CredentialBlobSize = ( uint ) Encoding . Unicode . GetByteCount ( secret . Value ) ,
125- CredentialBlob = stringPtr
126- } ,
117+ {
118+ AttributeCount = 0 ,
119+ Attributes = nint . Zero ,
120+ Type = AdvApi32 . CRED_TYPE . CRED_TYPE_GENERIC ,
121+ Persist = AdvApi32 . CRED_PERSIST . CRED_PERSIST_LOCAL_MACHINE ,
122+ TargetName = new StrPtrAuto ( secret . Name ) ,
123+ UserName = new StrPtrAuto ( "default" ) ,
124+ CredentialBlobSize = ( uint ) Encoding . Unicode . GetByteCount ( secret . Value ) ,
125+ CredentialBlob = stringPtr
126+ } ,
127127 0 ) ) ;
128128 Marshal . FreeHGlobal ( stringPtr ) ;
129129 return res ;
@@ -464,16 +464,16 @@ public bool Update(Secret secret)
464464 }
465465 var stringPtr = Marshal . StringToHGlobalUni ( secret . Value ) ;
466466 var res = AdvApi32 . CredWrite ( new AdvApi32 . CREDENTIAL
467- {
468- AttributeCount = 0 ,
469- Attributes = nint . Zero ,
470- Type = AdvApi32 . CRED_TYPE . CRED_TYPE_GENERIC ,
471- Persist = AdvApi32 . CRED_PERSIST . CRED_PERSIST_LOCAL_MACHINE ,
472- TargetName = new StrPtrAuto ( secret . Name ) ,
473- UserName = new StrPtrAuto ( "default" ) ,
474- CredentialBlobSize = ( uint ) Encoding . Unicode . GetByteCount ( secret . Value ) ,
475- CredentialBlob = stringPtr
476- } ,
467+ {
468+ AttributeCount = 0 ,
469+ Attributes = nint . Zero ,
470+ Type = AdvApi32 . CRED_TYPE . CRED_TYPE_GENERIC ,
471+ Persist = AdvApi32 . CRED_PERSIST . CRED_PERSIST_LOCAL_MACHINE ,
472+ TargetName = new StrPtrAuto ( secret . Name ) ,
473+ UserName = new StrPtrAuto ( "default" ) ,
474+ CredentialBlobSize = ( uint ) Encoding . Unicode . GetByteCount ( secret . Value ) ,
475+ CredentialBlob = stringPtr
476+ } ,
477477 0 ) ;
478478 Marshal . FreeHGlobal ( stringPtr ) ;
479479 return res ;
@@ -538,16 +538,16 @@ public async Task<bool> UpdateAsync(Secret secret)
538538 }
539539 var stringPtr = Marshal . StringToHGlobalUni ( secret . Value ) ;
540540 var res = await Task . Run ( ( ) => AdvApi32 . CredWrite ( new AdvApi32 . CREDENTIAL
541- {
542- AttributeCount = 0 ,
543- Attributes = nint . Zero ,
544- Type = AdvApi32 . CRED_TYPE . CRED_TYPE_GENERIC ,
545- Persist = AdvApi32 . CRED_PERSIST . CRED_PERSIST_LOCAL_MACHINE ,
546- TargetName = new StrPtrAuto ( secret . Name ) ,
547- UserName = new StrPtrAuto ( "default" ) ,
548- CredentialBlobSize = ( uint ) Encoding . Unicode . GetByteCount ( secret . Value ) ,
549- CredentialBlob = stringPtr
550- } ,
541+ {
542+ AttributeCount = 0 ,
543+ Attributes = nint . Zero ,
544+ Type = AdvApi32 . CRED_TYPE . CRED_TYPE_GENERIC ,
545+ Persist = AdvApi32 . CRED_PERSIST . CRED_PERSIST_LOCAL_MACHINE ,
546+ TargetName = new StrPtrAuto ( secret . Name ) ,
547+ UserName = new StrPtrAuto ( "default" ) ,
548+ CredentialBlobSize = ( uint ) Encoding . Unicode . GetByteCount ( secret . Value ) ,
549+ CredentialBlob = stringPtr
550+ } ,
551551 0 ) ) ;
552552 Marshal . FreeHGlobal ( stringPtr ) ;
553553 return res ;
0 commit comments