[winpr] Add initializer functions

* Add initializer for wStream
* Add initializer for ASN1 decoder
This commit is contained in:
Armin Novak
2026-02-24 21:23:47 +01:00
parent 48267edf2f
commit 208bcbd153
10 changed files with 63 additions and 40 deletions

View File

@@ -1355,8 +1355,8 @@ typedef enum
static BOOL nla_read_ts_credentials(rdpNla* nla, SecBuffer* data)
{
WinPrAsn1Decoder dec = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder dec2 = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder dec = WinPrAsn1Decoder_init();
WinPrAsn1Decoder dec2 = WinPrAsn1Decoder_init();
WinPrAsn1_OctetString credentials = WINPR_C_ARRAY_INIT;
BOOL error = FALSE;
WinPrAsn1_INTEGER credType = -1;
@@ -1423,7 +1423,7 @@ static BOOL nla_read_ts_credentials(rdpNla* nla, SecBuffer* data)
settings->PasswordIsSmartcardPin = TRUE;
/* cspData [1] TSCspDataDetail */
WinPrAsn1Decoder cspDetails = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder cspDetails = WinPrAsn1Decoder_init();
if (!WinPrAsn1DecReadContextualSequence(&dec, 1, &error, &cspDetails) && error)
return FALSE;
if (!nla_read_TSCspDataDetail(&cspDetails, settings))
@@ -1450,7 +1450,7 @@ static BOOL nla_read_ts_credentials(rdpNla* nla, SecBuffer* data)
.ServiceTicket = NULL,
.TicketGrantingTicket = NULL };
WinPrAsn1Decoder logonCredsSeq = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder logonCredsSeq = WinPrAsn1Decoder_init();
if (!WinPrAsn1DecReadContextualSequence(&dec2, 0, &error, &logonCredsSeq) || error)
return FALSE;
@@ -1474,12 +1474,12 @@ static BOOL nla_read_ts_credentials(rdpNla* nla, SecBuffer* data)
/* supplementalCreds [1] SEQUENCE OF TSRemoteGuardPackageCred OPTIONAL, */
MSV1_0_REMOTE_SUPPLEMENTAL_CREDENTIAL* suppCreds = NULL;
WinPrAsn1Decoder suppCredsSeq = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder suppCredsSeq = WinPrAsn1Decoder_init();
if (WinPrAsn1DecReadContextualSequence(&dec2, 1, &error, &suppCredsSeq) &&
Stream_GetRemainingLength(&suppCredsSeq.source))
{
WinPrAsn1Decoder ntlmCredsSeq = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder ntlmCredsSeq = WinPrAsn1Decoder_init();
if (!WinPrAsn1DecReadSequence(&suppCredsSeq, &ntlmCredsSeq))
return FALSE;
@@ -2065,8 +2065,8 @@ fail:
static int nla_decode_ts_request(rdpNla* nla, wStream* s)
{
WinPrAsn1Decoder dec = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder dec2 = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder dec = WinPrAsn1Decoder_init();
WinPrAsn1Decoder dec2 = WinPrAsn1Decoder_init();
BOOL error = FALSE;
WinPrAsn1_tagId tag = WINPR_C_ARRAY_INIT;
WinPrAsn1_INTEGER val = WINPR_C_ARRAY_INIT;
@@ -2108,7 +2108,7 @@ static int nla_decode_ts_request(rdpNla* nla, wStream* s)
while (WinPrAsn1DecReadContextualTag(&dec, &tag, &dec2) != 0)
{
WinPrAsn1Decoder dec3 = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder dec3 = WinPrAsn1Decoder_init();
WinPrAsn1_OctetString octet_string = WINPR_C_ARRAY_INIT;
switch (tag)