[warnings] fix a bunch of them
* fix uninitialized variable warnings * modivy ndr_context_* functions to utilize WINPR_ATTR_MALLOC * build_krbtgt use winpr_asprintf * add proper Stream_Write_UINT64_BE
This commit is contained in:
parent
3895cf9fd3
commit
71080e61b0
@ -365,11 +365,13 @@ static char* KERB_RPC_UNICODESTR_to_charptr(const RPC_UNICODE_STRING* src)
|
||||
|
||||
static BOOL extractAuthData(const KERB_ASN1_DATA* src, krb5_authdata* authData, BOOL* haveData)
|
||||
{
|
||||
WinPrAsn1Decoder dec, dec2, dec3;
|
||||
WinPrAsn1Decoder dec = { 0 };
|
||||
WinPrAsn1Decoder dec2 = { 0 };
|
||||
WinPrAsn1Decoder dec3 = { 0 };
|
||||
WinPrAsn1Decoder_InitMem(&dec, WINPR_ASN1_DER, src->Asn1Buffer, src->Asn1BufferHints.count);
|
||||
BOOL error = FALSE;
|
||||
WinPrAsn1_INTEGER adType;
|
||||
WinPrAsn1_OctetString os;
|
||||
WinPrAsn1_INTEGER adType = 0;
|
||||
WinPrAsn1_OctetString os = { 0 };
|
||||
|
||||
*haveData = FALSE;
|
||||
if (!WinPrAsn1DecReadSequence(&dec, &dec2))
|
||||
@ -395,7 +397,8 @@ static BOOL extractAuthData(const KERB_ASN1_DATA* src, krb5_authdata* authData,
|
||||
|
||||
static BOOL extractChecksum(const KERB_ASN1_DATA* src, krb5_checksum* dst)
|
||||
{
|
||||
WinPrAsn1Decoder dec, dec2;
|
||||
WinPrAsn1Decoder dec = { 0 };
|
||||
WinPrAsn1Decoder dec2 = { 0 };
|
||||
WinPrAsn1Decoder_InitMem(&dec, WINPR_ASN1_DER, src->Asn1Buffer, src->Asn1BufferHints.count);
|
||||
BOOL error = FALSE;
|
||||
WinPrAsn1_OctetString os;
|
||||
@ -403,7 +406,7 @@ static BOOL extractChecksum(const KERB_ASN1_DATA* src, krb5_checksum* dst)
|
||||
if (!WinPrAsn1DecReadSequence(&dec, &dec2))
|
||||
return FALSE;
|
||||
|
||||
WinPrAsn1_INTEGER cksumtype;
|
||||
WinPrAsn1_INTEGER cksumtype = 0;
|
||||
if (!WinPrAsn1DecReadContextualInteger(&dec2, 0, &error, &cksumtype) ||
|
||||
!WinPrAsn1DecReadContextualOctetString(&dec2, 1, &error, &os, FALSE))
|
||||
return FALSE;
|
||||
@ -449,9 +452,9 @@ static BOOL rdpear_kerb_CreateApReqAuthenticator(RDPEAR_PLUGIN* rdpear,
|
||||
!ndr_treat_deferred_read(rcontext, s))
|
||||
goto out;
|
||||
|
||||
krb5_authdata authdata;
|
||||
krb5_authdata authdata = { 0 };
|
||||
krb5_authdata* authDataPtr[2] = { &authdata, NULL };
|
||||
BOOL haveData;
|
||||
BOOL haveData = 0;
|
||||
|
||||
if (!extractAuthData(req.AuthData, &authdata, &haveData))
|
||||
{
|
||||
@ -566,11 +569,12 @@ out:
|
||||
|
||||
static BOOL rdpear_findEncryptedData(const KERB_ASN1_DATA* src, int* penctype, krb5_data* data)
|
||||
{
|
||||
WinPrAsn1Decoder dec, dec2;
|
||||
WinPrAsn1Decoder dec = { 0 };
|
||||
WinPrAsn1Decoder dec2 = { 0 };
|
||||
WinPrAsn1Decoder_InitMem(&dec, WINPR_ASN1_DER, src->Asn1Buffer, src->Asn1BufferHints.count);
|
||||
BOOL error = FALSE;
|
||||
WinPrAsn1_INTEGER encType;
|
||||
WinPrAsn1_OctetString os;
|
||||
WinPrAsn1_INTEGER encType = 0;
|
||||
WinPrAsn1_OctetString os = { 0 };
|
||||
|
||||
if (!WinPrAsn1DecReadSequence(&dec, &dec2) ||
|
||||
!WinPrAsn1DecReadContextualInteger(&dec2, 0, &error, &encType) ||
|
||||
@ -607,8 +611,8 @@ static BOOL rdpear_kerb_UnpackKdcReplyBody(RDPEAR_PLUGIN* rdpear,
|
||||
// winpr_HexDump(TAG, WLOG_DEBUG, req.EncryptedData->Asn1Buffer,
|
||||
// req.EncryptedData->Asn1BufferHints.count);
|
||||
|
||||
krb5_data asn1Data;
|
||||
int encType;
|
||||
krb5_data asn1Data = { 0 };
|
||||
int encType = 0;
|
||||
if (!rdpear_findEncryptedData(req.EncryptedData, &encType, &asn1Data) || !asn1Data.length)
|
||||
goto out;
|
||||
|
||||
@ -639,8 +643,8 @@ static BOOL rdpear_kerb_DecryptApReply(RDPEAR_PLUGIN* rdpear,
|
||||
// winpr_HexDump(TAG, WLOG_DEBUG, req.EncryptedReply->Asn1Buffer,
|
||||
// req.EncryptedReply->Asn1BufferHints.count);
|
||||
|
||||
krb5_data asn1Data;
|
||||
int encType;
|
||||
krb5_data asn1Data = { 0 };
|
||||
int encType = 0;
|
||||
if (!rdpear_findEncryptedData(req.EncryptedReply, &encType, &asn1Data) || !asn1Data.length)
|
||||
goto out;
|
||||
|
||||
@ -724,8 +728,9 @@ static UINT rdpear_decode_payload(RDPEAR_PLUGIN* rdpear,
|
||||
|
||||
Stream_Seek(s, 16); /* skip first 16 bytes */
|
||||
|
||||
wStream commandStream;
|
||||
UINT16 callId, callId2;
|
||||
wStream commandStream = { 0 };
|
||||
UINT16 callId = 0;
|
||||
UINT16 callId2 = 0;
|
||||
|
||||
context = ndr_read_header(s);
|
||||
if (!context || !ndr_read_constructed(context, s, &commandStream) ||
|
||||
@ -855,7 +860,9 @@ static UINT rdpear_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, 24))
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
UINT32 protocolMagic, Length, Version;
|
||||
UINT32 protocolMagic = 0;
|
||||
UINT32 Length = 0;
|
||||
UINT32 Version = 0;
|
||||
Stream_Read_UINT32(s, protocolMagic);
|
||||
if (protocolMagic != 0x4EACC3C8)
|
||||
return ERROR_INVALID_DATA;
|
||||
@ -880,17 +887,18 @@ static UINT rdpear_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
|
||||
if (!freerdp_nla_decrypt(rdpear->rdp_context, &inBuffer, &decrypted))
|
||||
goto out;
|
||||
|
||||
WinPrAsn1Decoder dec, dec2;
|
||||
wStream decodedStream;
|
||||
WinPrAsn1Decoder dec = { 0 };
|
||||
WinPrAsn1Decoder dec2 = { 0 };
|
||||
wStream decodedStream = { 0 };
|
||||
Stream_StaticInit(&decodedStream, decrypted.pvBuffer, decrypted.cbBuffer);
|
||||
WinPrAsn1Decoder_Init(&dec, WINPR_ASN1_DER, &decodedStream);
|
||||
|
||||
if (!WinPrAsn1DecReadSequence(&dec, &dec2))
|
||||
goto out;
|
||||
|
||||
WinPrAsn1_OctetString packageName;
|
||||
WinPrAsn1_OctetString payload;
|
||||
BOOL error;
|
||||
WinPrAsn1_OctetString packageName = { 0 };
|
||||
WinPrAsn1_OctetString payload = { 0 };
|
||||
BOOL error = 0;
|
||||
if (!WinPrAsn1DecReadContextualOctetString(&dec2, 1, &error, &packageName, FALSE))
|
||||
goto out;
|
||||
|
||||
@ -899,7 +907,7 @@ static UINT rdpear_on_data_received(IWTSVirtualChannelCallback* pChannelCallback
|
||||
if (!WinPrAsn1DecReadContextualOctetString(&dec2, 2, &error, &payload, FALSE))
|
||||
goto out;
|
||||
|
||||
wStream payloadStream;
|
||||
wStream payloadStream = { 0 };
|
||||
Stream_StaticInit(&payloadStream, payload.data, payload.len);
|
||||
|
||||
ret = rdpear_decode_payload(rdpear, pChannelCallback, packageType, &payloadStream);
|
||||
|
@ -104,17 +104,13 @@ NdrContext* ndr_context_copy(const NdrContext* src)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ndr_context_destroy(NdrContext** pcontext)
|
||||
void ndr_context_free(NdrContext* context)
|
||||
{
|
||||
WINPR_ASSERT(pcontext);
|
||||
|
||||
NdrContext* context = *pcontext;
|
||||
if (context)
|
||||
{
|
||||
HashTable_Free(context->refPointers);
|
||||
free(context);
|
||||
}
|
||||
*pcontext = NULL;
|
||||
}
|
||||
|
||||
void ndr_context_bytes_read(NdrContext* context, size_t len)
|
||||
@ -132,12 +128,9 @@ NdrContext* ndr_read_header(wStream* s)
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, 8))
|
||||
return NULL;
|
||||
|
||||
BYTE version, drep;
|
||||
Stream_Read_UINT8(s, version);
|
||||
Stream_Read_UINT8(s, drep);
|
||||
|
||||
UINT16 headerLen;
|
||||
Stream_Read_UINT16(s, headerLen);
|
||||
BYTE version = Stream_Get_UINT8(s);
|
||||
BYTE drep = Stream_Get_UINT8(s);
|
||||
UINT16 headerLen = Stream_Get_UINT16(s);
|
||||
|
||||
if (headerLen < 4 || !Stream_CheckAndLogRequiredLength(TAG, s, headerLen - 4))
|
||||
return NULL;
|
||||
@ -216,7 +209,7 @@ BOOL ndr_read_pickle(NdrContext* context, wStream* s)
|
||||
{
|
||||
WINPR_ASSERT(context);
|
||||
|
||||
UINT32 v;
|
||||
UINT32 v = 0;
|
||||
|
||||
/* NDR format label */
|
||||
if (!ndr_read_uint32(context, s, &v) || v != 0x20000)
|
||||
@ -241,7 +234,7 @@ BOOL ndr_read_constructed(NdrContext* context, wStream* s, wStream* target)
|
||||
{
|
||||
WINPR_ASSERT(context);
|
||||
|
||||
UINT32 len;
|
||||
UINT32 len = 0;
|
||||
|
||||
/* len */
|
||||
if (!ndr_read_uint32(context, s, &len))
|
||||
@ -315,11 +308,6 @@ static size_t ndr_hintsCount(NdrMessageType msgType, const void* hints)
|
||||
}
|
||||
}
|
||||
|
||||
void Stream_Write_UINT64_BE(wStream* _s, UINT64 _v)
|
||||
{
|
||||
WINPR_ASSERT(FALSE && "implement Stream_Write_UINT64_BE()");
|
||||
}
|
||||
|
||||
BOOL ndr_read_uint8(NdrContext* context, wStream* s, BYTE* v)
|
||||
{
|
||||
WINPR_ASSERT(context);
|
||||
@ -415,10 +403,12 @@ NdrMessageType ndr_uint8_descr(void)
|
||||
return ndr_write_##LOWERTYPE(context, s, *(const UPPERTYPE*)v); \
|
||||
} \
|
||||
\
|
||||
const NdrMessageDescr ndr_##LOWERTYPE##_descr_s = { \
|
||||
NDR_ARITY_SIMPLE, sizeof(UPPERTYPE), ndr_read_##LOWERTYPE##_, \
|
||||
ndr_write_##LOWERTYPE##_, (NDR_DESTROY_FN)NULL, (NDR_DUMP_FN)NULL \
|
||||
}; \
|
||||
const NdrMessageDescr ndr_##LOWERTYPE##_descr_s = { NDR_ARITY_SIMPLE, \
|
||||
sizeof(UPPERTYPE), \
|
||||
ndr_read_##LOWERTYPE##_, \
|
||||
ndr_write_##LOWERTYPE##_, \
|
||||
NULL, \
|
||||
NULL }; \
|
||||
\
|
||||
NdrMessageType ndr_##LOWERTYPE##_descr(void) \
|
||||
{ \
|
||||
@ -466,7 +456,7 @@ SIMPLE_TYPE_IMPL(UINT64, uint64)
|
||||
\
|
||||
const NdrMessageDescr ndr_##TYPE##Array_descr_s = { \
|
||||
NDR_ARITY_ARRAYOF, sizeof(UPPERTYPE), ndr_read_##TYPE##Array, \
|
||||
ndr_write_##TYPE##Array, ndr_destroy_##TYPE##Array, (NDR_DUMP_FN)NULL \
|
||||
ndr_write_##TYPE##Array, ndr_destroy_##TYPE##Array, NULL \
|
||||
}; \
|
||||
\
|
||||
NdrMessageType ndr_##TYPE##Array_descr(void) \
|
||||
@ -493,10 +483,12 @@ SIMPLE_TYPE_IMPL(UINT64, uint64)
|
||||
ndr_##TYPE##_descr(), v); \
|
||||
} \
|
||||
\
|
||||
const NdrMessageDescr ndr_##TYPE##VaryingArray_descr_s = { \
|
||||
NDR_ARITY_VARYING_ARRAYOF, sizeof(UPPERTYPE), ndr_read_##TYPE##VaryingArray, \
|
||||
ndr_write_##TYPE##VaryingArray, (NDR_DESTROY_FN)NULL, (NDR_DUMP_FN)NULL \
|
||||
}; \
|
||||
const NdrMessageDescr ndr_##TYPE##VaryingArray_descr_s = { NDR_ARITY_VARYING_ARRAYOF, \
|
||||
sizeof(UPPERTYPE), \
|
||||
ndr_read_##TYPE##VaryingArray, \
|
||||
ndr_write_##TYPE##VaryingArray, \
|
||||
NULL, \
|
||||
(NDR_DUMP_FN)NULL }; \
|
||||
\
|
||||
NdrMessageType ndr_##TYPE##VaryingArray_descr(void) \
|
||||
{ \
|
||||
@ -521,7 +513,9 @@ BOOL ndr_read_uconformant_varying_array(NdrContext* context, wStream* s,
|
||||
WINPR_ASSERT(itemType);
|
||||
WINPR_ASSERT(ptarget);
|
||||
|
||||
UINT32 maxCount, offset, length;
|
||||
UINT32 maxCount = 0;
|
||||
UINT32 offset = 0;
|
||||
UINT32 length = 0;
|
||||
|
||||
if (!ndr_read_uint32(context, s, &maxCount) || !ndr_read_uint32(context, s, &offset) ||
|
||||
!ndr_read_uint32(context, s, &length))
|
||||
@ -575,7 +569,7 @@ BOOL ndr_read_uconformant_array(NdrContext* context, wStream* s, const NdrArrayH
|
||||
WINPR_ASSERT(itemType);
|
||||
WINPR_ASSERT(vtarget);
|
||||
|
||||
UINT32 count;
|
||||
UINT32 count = 0;
|
||||
|
||||
if (!ndr_read_uint32(context, s, &count))
|
||||
return FALSE;
|
||||
@ -729,7 +723,7 @@ BOOL ndr_struct_write_fromDescr(NdrContext* context, wStream* s, const NdrStruct
|
||||
case NDR_POINTER_NON_NULL:
|
||||
{
|
||||
ndr_refid ptrId = NDR_PTR_NULL;
|
||||
BOOL isNew;
|
||||
BOOL isNew = 0;
|
||||
ptr = *(void**)ptr;
|
||||
|
||||
if (!ptr && field->pointerType == NDR_POINTER_NON_NULL)
|
||||
|
@ -96,13 +96,26 @@ extern "C"
|
||||
NdrMessageType msg;
|
||||
} NdrDeferredEntry;
|
||||
|
||||
void ndr_context_free(NdrContext* pcontext);
|
||||
|
||||
static INLINE void ndr_context_destroy(NdrContext** pcontext)
|
||||
{
|
||||
WINPR_ASSERT(pcontext);
|
||||
ndr_context_free(*pcontext);
|
||||
*pcontext = NULL;
|
||||
}
|
||||
|
||||
WINPR_ATTR_MALLOC(ndr_context_free, 1)
|
||||
NdrContext* ndr_context_new(BOOL bigEndianDrep, BYTE version);
|
||||
void ndr_context_destroy(NdrContext** pcontext);
|
||||
|
||||
void ndr_context_reset(NdrContext* context);
|
||||
|
||||
WINPR_ATTR_MALLOC(ndr_context_free, 1)
|
||||
NdrContext* ndr_context_copy(const NdrContext* src);
|
||||
|
||||
WINPR_ATTR_MALLOC(ndr_context_free, 1)
|
||||
NdrContext* ndr_read_header(wStream* s);
|
||||
|
||||
BOOL ndr_write_header(NdrContext* context, wStream* s);
|
||||
|
||||
BOOL ndr_write_uint8(NdrContext* context, wStream* s, BYTE v);
|
||||
|
@ -163,7 +163,8 @@ BOOL ndr_read_RPC_UNICODE_STRING(NdrContext* context, wStream* s, const void* hi
|
||||
{
|
||||
NdrDeferredEntry bufferDesc = { NDR_PTR_NULL, "RPC_UNICODE_STRING.Buffer", &res->lenHints,
|
||||
&res->Buffer, ndr_uint16VaryingArray_descr() };
|
||||
UINT16 Length, MaximumLength;
|
||||
UINT16 Length = 0;
|
||||
UINT16 MaximumLength = 0;
|
||||
|
||||
if (!ndr_read_uint16(context, s, &Length) || !ndr_read_uint16(context, s, &MaximumLength) ||
|
||||
!ndr_read_refpointer(context, s, &bufferDesc.ptrId) || Length > MaximumLength)
|
||||
@ -207,7 +208,7 @@ static const NdrMessageDescr RPC_UNICODE_STRING_descr_ = {
|
||||
NDR_ARITY_SIMPLE,
|
||||
sizeof(RPC_UNICODE_STRING),
|
||||
(NDR_READER_FN)ndr_read_RPC_UNICODE_STRING,
|
||||
(NDR_WRITER_FN) /*ndr_write_RPC_UNICODE_STRING*/ NULL,
|
||||
/*ndr_write_RPC_UNICODE_STRING*/ NULL,
|
||||
(NDR_DESTROY_FN)ndr_destroy_RPC_UNICODE_STRING,
|
||||
(NDR_DUMP_FN)ndr_dump_RPC_UNICODE_STRING
|
||||
};
|
||||
@ -260,7 +261,7 @@ BOOL ndr_read_KERB_RPC_INTERNAL_NAME(NdrContext* context, wStream* s, const void
|
||||
NdrDeferredEntry names = { NDR_PTR_NULL, "KERB_RPC_INTERNAL_NAME.Names", &res->nameHints,
|
||||
&res->Names, RPC_UNICODE_STRING_Array_descr() };
|
||||
|
||||
UINT16 nameCount;
|
||||
UINT16 nameCount = 0;
|
||||
if (!ndr_read_uint16(context, s, &res->NameType) || !ndr_read_uint16(context, s, &nameCount))
|
||||
return FALSE;
|
||||
|
||||
@ -297,7 +298,7 @@ NdrMessageDescr KERB_RPC_INTERNAL_NAME_descr_ = {
|
||||
NDR_ARITY_SIMPLE,
|
||||
sizeof(KERB_RPC_INTERNAL_NAME),
|
||||
(NDR_READER_FN)ndr_read_KERB_RPC_INTERNAL_NAME,
|
||||
(NDR_WRITER_FN)NULL,
|
||||
NULL,
|
||||
(NDR_DESTROY_FN)ndr_destroy_KERB_RPC_INTERNAL_NAME,
|
||||
(NDR_DUMP_FN)ndr_dump_KERB_RPC_INTERNAL_NAME
|
||||
};
|
||||
|
@ -127,6 +127,9 @@ int TestNdrEarWrite(int argc, char* argv[])
|
||||
|
||||
int TestNdrEarRead(int argc, char* argv[])
|
||||
{
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
int retCode = -2;
|
||||
|
||||
/* ====================================================================== */
|
||||
@ -134,8 +137,8 @@ int TestNdrEarRead(int argc, char* argv[])
|
||||
if (!context)
|
||||
return -1;
|
||||
|
||||
wStream staticS;
|
||||
wStream* s;
|
||||
wStream staticS = { 0 };
|
||||
wStream* s = NULL;
|
||||
|
||||
#if 0
|
||||
BYTE payload[] = {
|
||||
@ -302,7 +305,7 @@ int TestNdrEarRead(int argc, char* argv[])
|
||||
size_t sizeofPayload4 = sizeof(payload4);
|
||||
#endif
|
||||
#if 1
|
||||
size_t sizeofPayload4;
|
||||
size_t sizeofPayload4 = 0;
|
||||
BYTE* payload4 = parseHexBlock("03 01 03 01 \
|
||||
04 00 02 00 38 9e ef 6b 0c 00 02 00 18 00 02 00 \
|
||||
20 00 02 00 00 00 00 00 24 00 02 00 2c 00 02 00 \
|
||||
|
@ -171,8 +171,10 @@ UINT ecam_channel_write(CameraPlugin* ecam, GENERIC_CHANNEL_CALLBACK* hchannel,
|
||||
wStream* out, BOOL freeStream);
|
||||
|
||||
/* ecam device interface */
|
||||
void ecam_dev_destroy(CameraDevice* dev);
|
||||
|
||||
WINPR_ATTR_MALLOC(ecam_dev_destroy, 1)
|
||||
CameraDevice* ecam_dev_create(CameraPlugin* ecam, const char* deviceId, const char* deviceName);
|
||||
void ecam_dev_destroy(void* dev);
|
||||
|
||||
/* video encoding interface */
|
||||
BOOL ecam_encoder_context_init(CameraDeviceStream* stream);
|
||||
|
@ -316,6 +316,12 @@ static UINT ecam_on_new_channel_connection(IWTSListenerCallback* pListenerCallba
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
static void ecam_dev_destroy_pv(void* obj)
|
||||
{
|
||||
CameraDevice* dev = obj;
|
||||
ecam_dev_destroy(dev);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function description
|
||||
*
|
||||
@ -349,7 +355,7 @@ static UINT ecam_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage
|
||||
|
||||
wObject* obj = HashTable_ValueObject(ecam->devices);
|
||||
WINPR_ASSERT(obj);
|
||||
obj->fnObjectFree = ecam_dev_destroy;
|
||||
obj->fnObjectFree = ecam_dev_destroy_pv;
|
||||
|
||||
ecam->hlistener = (GENERIC_LISTENER_CALLBACK*)calloc(1, sizeof(GENERIC_LISTENER_CALLBACK));
|
||||
|
||||
|
@ -796,9 +796,8 @@ CameraDevice* ecam_dev_create(CameraPlugin* ecam, const char* deviceId, const ch
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void ecam_dev_destroy(void* obj)
|
||||
void ecam_dev_destroy(CameraDevice* dev)
|
||||
{
|
||||
CameraDevice* dev = (CameraDevice*)obj;
|
||||
if (!dev)
|
||||
return;
|
||||
|
||||
|
@ -142,10 +142,9 @@ static BOOL cam_v4l_format_supported(int fd, UINT32 format)
|
||||
*/
|
||||
static int cam_v4l_open_device(const char* deviceId, int flags)
|
||||
{
|
||||
UINT n;
|
||||
char device[20];
|
||||
char device[20] = { 0 };
|
||||
int fd = -1;
|
||||
struct v4l2_capability cap;
|
||||
struct v4l2_capability cap = { 0 };
|
||||
|
||||
if (!deviceId)
|
||||
return -1;
|
||||
@ -153,7 +152,7 @@ static int cam_v4l_open_device(const char* deviceId, int flags)
|
||||
if (0 == strncmp(deviceId, "/dev/video", 10))
|
||||
return open(deviceId, flags);
|
||||
|
||||
for (n = 0; n < 64; n++)
|
||||
for (UINT n = 0; n < 64; n++)
|
||||
{
|
||||
snprintf(device, sizeof(device), "/dev/video%d", n);
|
||||
if ((fd = open(device, flags)) == -1)
|
||||
@ -188,19 +187,19 @@ static INT16 cam_v4l_get_media_type_descriptions(ICamHal* hal, const char* devic
|
||||
CAM_MEDIA_TYPE_DESCRIPTION* mediaTypes,
|
||||
size_t* nMediaTypes)
|
||||
{
|
||||
int fd;
|
||||
size_t maxMediaTypes = *nMediaTypes;
|
||||
size_t nTypes = 0;
|
||||
int formatIndex;
|
||||
BOOL formatFound = FALSE;
|
||||
|
||||
if ((fd = cam_v4l_open_device(deviceId, O_RDONLY)) == -1)
|
||||
int fd = cam_v4l_open_device(deviceId, O_RDONLY);
|
||||
if (fd == -1)
|
||||
{
|
||||
WLog_ERR(TAG, "Unable to open device %s", deviceId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (formatIndex = 0; formatIndex < nSupportedFormats; formatIndex++)
|
||||
size_t formatIndex = 0;
|
||||
for (; formatIndex < nSupportedFormats; formatIndex++)
|
||||
{
|
||||
UINT32 pixelFormat = ecamToV4L2PixFormat(supportedFormats[formatIndex].inputFormat);
|
||||
WINPR_ASSERT(pixelFormat != 0);
|
||||
@ -268,7 +267,9 @@ error:
|
||||
|
||||
*nMediaTypes = nTypes;
|
||||
close(fd);
|
||||
return formatIndex;
|
||||
if (formatIndex > INT16_MAX)
|
||||
return -1;
|
||||
return (INT16)formatIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -279,16 +280,15 @@ error:
|
||||
static UINT cam_v4l_enumerate(ICamHal* ihal, ICamHalEnumCallback callback, CameraPlugin* ecam,
|
||||
GENERIC_CHANNEL_CALLBACK* hchannel)
|
||||
{
|
||||
UINT n, count = 0;
|
||||
char device[20];
|
||||
int fd = -1;
|
||||
struct v4l2_capability cap;
|
||||
char *deviceName, *deviceId;
|
||||
UINT count = 0;
|
||||
|
||||
for (n = 0; n < 64; n++)
|
||||
for (UINT n = 0; n < 64; n++)
|
||||
{
|
||||
char device[20] = { 0 };
|
||||
struct v4l2_capability cap = { 0 };
|
||||
snprintf(device, sizeof(device), "/dev/video%d", n);
|
||||
if ((fd = open(device, O_RDONLY)) == -1)
|
||||
int fd = open(device, O_RDONLY);
|
||||
if (fd == -1)
|
||||
continue;
|
||||
|
||||
/* query device capabilities and make sure this is a video capture device */
|
||||
@ -299,12 +299,10 @@ static UINT cam_v4l_enumerate(ICamHal* ihal, ICamHalEnumCallback callback, Camer
|
||||
}
|
||||
count++;
|
||||
|
||||
deviceName = (char*)cap.card;
|
||||
|
||||
const char* deviceName = (char*)cap.card;
|
||||
const char* deviceId = device;
|
||||
if (cap.bus_info[0] != 0) /* may not be available in all drivers */
|
||||
deviceId = (char*)cap.bus_info;
|
||||
else
|
||||
deviceId = device;
|
||||
|
||||
IFCALL(callback, ecam, hchannel, deviceId, deviceName);
|
||||
|
||||
@ -420,7 +418,7 @@ static UINT cam_v4l_stream_capture_thread(void* param)
|
||||
|
||||
do
|
||||
{
|
||||
int retVal;
|
||||
int retVal = 0;
|
||||
struct pollfd pfd = { 0 };
|
||||
|
||||
pfd.fd = fd;
|
||||
@ -540,8 +538,7 @@ UINT cam_v4l_stream_stop(CamV4lStream* stream)
|
||||
EnterCriticalSection(&stream->lock);
|
||||
|
||||
/* stop streaming */
|
||||
enum v4l2_buf_type type;
|
||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
if (ioctl(stream->fd, VIDIOC_STREAMOFF, &type) < 0)
|
||||
{
|
||||
WLog_ERR(TAG, "Failure in VIDIOC_STREAMOFF, errno %d", errno);
|
||||
@ -616,7 +613,8 @@ static UINT cam_v4l_stream_start(ICamHal* ihal, CameraDevice* dev, int streamInd
|
||||
}
|
||||
|
||||
/* trying to set frame rate, if driver supports it */
|
||||
struct v4l2_streamparm sp1 = { 0 }, sp2 = { 0 };
|
||||
struct v4l2_streamparm sp1 = { 0 };
|
||||
struct v4l2_streamparm sp2 = { 0 };
|
||||
sp1.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
if (ioctl(stream->fd, VIDIOC_G_PARM, &sp1) < 0 ||
|
||||
!(sp1.parm.capture.capability & V4L2_CAP_TIMEPERFRAME))
|
||||
@ -648,8 +646,7 @@ static UINT cam_v4l_stream_start(ICamHal* ihal, CameraDevice* dev, int streamInd
|
||||
stream->streaming = TRUE;
|
||||
|
||||
/* start streaming */
|
||||
enum v4l2_buf_type type;
|
||||
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
if (ioctl(stream->fd, VIDIOC_STREAMON, &type) < 0)
|
||||
{
|
||||
WLog_ERR(TAG, "Failure in VIDIOC_STREAMON, errno %d", errno);
|
||||
|
@ -250,10 +250,9 @@ static UINT sshagent_on_new_channel_connection(IWTSListenerCallback* pListenerCa
|
||||
BOOL* pbAccept,
|
||||
IWTSVirtualChannelCallback** ppCallback)
|
||||
{
|
||||
SSHAGENT_CHANNEL_CALLBACK* callback;
|
||||
GENERIC_CHANNEL_CALLBACK* generic;
|
||||
SSHAGENT_LISTENER_CALLBACK* listener_callback = (SSHAGENT_LISTENER_CALLBACK*)pListenerCallback;
|
||||
callback = (SSHAGENT_CHANNEL_CALLBACK*)calloc(1, sizeof(SSHAGENT_CHANNEL_CALLBACK));
|
||||
SSHAGENT_CHANNEL_CALLBACK* callback =
|
||||
(SSHAGENT_CHANNEL_CALLBACK*)calloc(1, sizeof(SSHAGENT_CHANNEL_CALLBACK));
|
||||
|
||||
if (!callback)
|
||||
{
|
||||
@ -272,7 +271,8 @@ static UINT sshagent_on_new_channel_connection(IWTSListenerCallback* pListenerCa
|
||||
}
|
||||
|
||||
InitializeCriticalSection(&callback->lock);
|
||||
generic = &callback->generic;
|
||||
|
||||
GENERIC_CHANNEL_CALLBACK* generic = &callback->generic;
|
||||
generic->iface.OnDataReceived = sshagent_on_data_received;
|
||||
generic->iface.OnClose = sshagent_on_close;
|
||||
generic->plugin = listener_callback->plugin;
|
||||
@ -348,8 +348,7 @@ static UINT sshagent_plugin_terminated(IWTSPlugin* pPlugin)
|
||||
FREERDP_ENTRY_POINT(UINT VCAPITYPE sshagent_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
SSHAGENT_PLUGIN* sshagent;
|
||||
sshagent = (SSHAGENT_PLUGIN*)pEntryPoints->GetPlugin(pEntryPoints, "sshagent");
|
||||
SSHAGENT_PLUGIN* sshagent = (SSHAGENT_PLUGIN*)pEntryPoints->GetPlugin(pEntryPoints, "sshagent");
|
||||
|
||||
if (!sshagent)
|
||||
{
|
||||
|
@ -205,14 +205,13 @@ static void log_dec_info(const CStreamInfo* info, void (*log)(const char* fmt, .
|
||||
|
||||
static void log_enc_info(const AACENC_InfoStruct* info, fdk_log_fkt_t log)
|
||||
{
|
||||
size_t x;
|
||||
char confBuf[1024] = { 0 };
|
||||
|
||||
assert(info);
|
||||
assert(log);
|
||||
|
||||
strcat(confBuf, "{");
|
||||
for (x = 0; x < 64; x++)
|
||||
for (size_t x = 0; x < 64; x++)
|
||||
{
|
||||
char tmp[12] = { 0 };
|
||||
sprintf(tmp, "0x%02x", (int)info->confBuf[x]);
|
||||
@ -407,8 +406,6 @@ int fdk_aac_dsp_impl_config(void* handle, size_t* pbuffersize, int encoder, unsi
|
||||
"fdk_aac_dsp_impl_config: samplerate: %ld, channels: %ld, bytes_pers_second: %ld",
|
||||
samplerate, channels, bytes_per_second);
|
||||
|
||||
size_t x;
|
||||
AACENC_ERROR err;
|
||||
struct t_param_pair
|
||||
{
|
||||
AACENC_PARAM param;
|
||||
@ -422,7 +419,7 @@ int fdk_aac_dsp_impl_config(void* handle, size_t* pbuffersize, int encoder, unsi
|
||||
{ AACENC_BITRATE, bytes_per_second * 8 },
|
||||
{ AACENC_TRANSMUX, 0 },
|
||||
{ AACENC_AFTERBURNER, 1 } };
|
||||
HANDLE_AACENCODER self;
|
||||
HANDLE_AACENCODER self = NULL;
|
||||
if (encoder)
|
||||
self = (HANDLE_AACENCODER)handle;
|
||||
else
|
||||
@ -435,11 +432,11 @@ int fdk_aac_dsp_impl_config(void* handle, size_t* pbuffersize, int encoder, unsi
|
||||
}
|
||||
}
|
||||
|
||||
for (x = 0; x < sizeof(params) / sizeof(params[0]); x++)
|
||||
for (size_t x = 0; x < sizeof(params) / sizeof(params[0]); x++)
|
||||
{
|
||||
const struct t_param_pair* param = ¶ms[x];
|
||||
|
||||
err = aacEncoder_SetParam(self, param->param, param->value);
|
||||
AACENC_ERROR err = aacEncoder_SetParam(self, param->param, param->value);
|
||||
if (err != AACENC_OK)
|
||||
{
|
||||
log(WLOG_ERROR, "aacEncoder_SetParam(%s, %d) failed with %s",
|
||||
@ -448,7 +445,7 @@ int fdk_aac_dsp_impl_config(void* handle, size_t* pbuffersize, int encoder, unsi
|
||||
}
|
||||
}
|
||||
|
||||
err = aacEncEncode(self, NULL, NULL, NULL, NULL);
|
||||
AACENC_ERROR err = aacEncEncode(self, NULL, NULL, NULL, NULL);
|
||||
if (err != AACENC_OK)
|
||||
{
|
||||
log(WLOG_ERROR, "aacEncEncode failed with %s", enc_err_str(err));
|
||||
@ -477,7 +474,6 @@ int fdk_aac_dsp_impl_config(void* handle, size_t* pbuffersize, int encoder, unsi
|
||||
|
||||
*pbuffersize = info.frameLength * info.inputChannels * sizeof(INT_PCM);
|
||||
|
||||
AAC_DECODER_ERROR decerr;
|
||||
HANDLE_AACDECODER aacdec = (HANDLE_AACDECODER)handle;
|
||||
|
||||
UCHAR* asc[] = { info.confBuf };
|
||||
@ -485,7 +481,7 @@ int fdk_aac_dsp_impl_config(void* handle, size_t* pbuffersize, int encoder, unsi
|
||||
|
||||
assert(handle);
|
||||
|
||||
decerr = aacDecoder_ConfigRaw(aacdec, asc, ascSize);
|
||||
AAC_DECODER_ERROR decerr = aacDecoder_ConfigRaw(aacdec, asc, ascSize);
|
||||
if (decerr != AAC_DEC_OK)
|
||||
{
|
||||
log(WLOG_ERROR, "aacDecoder_ConfigRaw failed with %s", dec_err_str(decerr));
|
||||
@ -501,15 +497,21 @@ ssize_t fdk_aac_dsp_impl_decode_fill(void* handle, const void* data, size_t size
|
||||
assert(log);
|
||||
|
||||
UINT leftBytes = size;
|
||||
AAC_DECODER_ERROR err;
|
||||
HANDLE_AACDECODER self = (HANDLE_AACDECODER)handle;
|
||||
UCHAR* pBuffer[] = { data };
|
||||
|
||||
union
|
||||
{
|
||||
const void* cpv;
|
||||
UCHAR* puc;
|
||||
} cnv;
|
||||
cnv.cpv = data;
|
||||
UCHAR* pBuffer[] = { cnv.puc };
|
||||
const UINT bufferSize[] = { size };
|
||||
|
||||
assert(handle);
|
||||
assert(data || (size == 0));
|
||||
|
||||
err = aacDecoder_Fill(self, pBuffer, bufferSize, &leftBytes);
|
||||
AAC_DECODER_ERROR err = aacDecoder_Fill(self, pBuffer, bufferSize, &leftBytes);
|
||||
if (err != AAC_DEC_OK)
|
||||
{
|
||||
log(WLOG_ERROR, "aacDecoder_Fill failed with %s", dec_err_str(err));
|
||||
@ -552,12 +554,16 @@ ssize_t fdk_aac_dsp_impl_stream_info(void* handle, int encoder, fdk_log_fkt_t lo
|
||||
ssize_t fdk_aac_dsp_impl_encode(void* handle, const void* data, size_t size, void* dst,
|
||||
size_t dstSize, fdk_log_fkt_t log)
|
||||
{
|
||||
AACENC_ERROR err;
|
||||
|
||||
INT inSizes[] = { size };
|
||||
INT inElSizes[] = { sizeof(INT_PCM) };
|
||||
INT inIdentifiers[] = { IN_AUDIO_DATA };
|
||||
void* inBuffers[] = { data };
|
||||
union
|
||||
{
|
||||
const void* cpv;
|
||||
void* pv;
|
||||
} cnv;
|
||||
cnv.cpv = data;
|
||||
void* inBuffers[] = { cnv.pv };
|
||||
|
||||
const AACENC_BufDesc inBufDesc = {
|
||||
.numBufs = 1,
|
||||
@ -587,7 +593,7 @@ ssize_t fdk_aac_dsp_impl_encode(void* handle, const void* data, size_t size, voi
|
||||
assert(handle);
|
||||
assert(log);
|
||||
|
||||
err = aacEncEncode(self, &inBufDesc, &outBufDesc, &inArgs, &outArgs);
|
||||
AACENC_ERROR err = aacEncEncode(self, &inBufDesc, &outBufDesc, &inArgs, &outArgs);
|
||||
if (err != AACENC_OK)
|
||||
{
|
||||
log(WLOG_ERROR, "aacEncEncode failed with %s", enc_err_str(err));
|
||||
|
@ -228,7 +228,7 @@ static int openh264_compress(H264_CONTEXT* WINPR_RESTRICT h264,
|
||||
return status;
|
||||
}
|
||||
|
||||
EUsageType usageType;
|
||||
EUsageType usageType = SCREEN_CONTENT_REAL_TIME;
|
||||
|
||||
switch (h264->UsageType)
|
||||
{
|
||||
@ -243,7 +243,6 @@ static int openh264_compress(H264_CONTEXT* WINPR_RESTRICT h264,
|
||||
break;
|
||||
case H264_SCREEN_CONTENT_REAL_TIME:
|
||||
default:
|
||||
usageType = SCREEN_CONTENT_REAL_TIME;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2096,42 +2096,36 @@ static BOOL rdp_write_bitmap_cache_v2_capability_set(wStream* s, const rdpSettin
|
||||
#ifdef WITH_DEBUG_CAPABILITIES
|
||||
static BOOL rdp_print_bitmap_cache_v2_capability_set(wStream* s)
|
||||
{
|
||||
UINT16 cacheFlags = 0;
|
||||
BYTE pad2 = 0;
|
||||
BYTE numCellCaches = 0;
|
||||
BITMAP_CACHE_V2_CELL_INFO bitmapCacheV2CellInfo[5];
|
||||
BITMAP_CACHE_V2_CELL_INFO bitmapCacheV2CellInfo[5] = { 0 };
|
||||
WLog_VRB(TAG, "BitmapCacheV2CapabilitySet (length %" PRIuz "):", Stream_GetRemainingLength(s));
|
||||
|
||||
if (!Stream_CheckAndLogRequiredLength(TAG, s, 36))
|
||||
return FALSE;
|
||||
|
||||
Stream_Read_UINT16(s, cacheFlags); /* cacheFlags (2 bytes) */
|
||||
Stream_Read_UINT8(s, pad2); /* pad2 (1 byte) */
|
||||
Stream_Read_UINT8(s, numCellCaches); /* numCellCaches (1 byte) */
|
||||
rdp_read_bitmap_cache_cell_info(s,
|
||||
&bitmapCacheV2CellInfo[0]); /* bitmapCache0CellInfo (4 bytes) */
|
||||
rdp_read_bitmap_cache_cell_info(s,
|
||||
&bitmapCacheV2CellInfo[1]); /* bitmapCache1CellInfo (4 bytes) */
|
||||
rdp_read_bitmap_cache_cell_info(s,
|
||||
&bitmapCacheV2CellInfo[2]); /* bitmapCache2CellInfo (4 bytes) */
|
||||
rdp_read_bitmap_cache_cell_info(s,
|
||||
&bitmapCacheV2CellInfo[3]); /* bitmapCache3CellInfo (4 bytes) */
|
||||
rdp_read_bitmap_cache_cell_info(s,
|
||||
&bitmapCacheV2CellInfo[4]); /* bitmapCache4CellInfo (4 bytes) */
|
||||
Stream_Seek(s, 12); /* pad3 (12 bytes) */
|
||||
const UINT16 cacheFlags = Stream_Get_UINT16(s); /* cacheFlags (2 bytes) */
|
||||
const UINT8 pad2 = Stream_Get_UINT8(s); /* pad2 (1 byte) */
|
||||
const UINT8 numCellCaches = Stream_Get_UINT8(s); /* numCellCaches (1 byte) */
|
||||
|
||||
for (size_t x = 0; x < ARRAYSIZE(bitmapCacheV2CellInfo); x++)
|
||||
{
|
||||
if (!rdp_read_bitmap_cache_cell_info(
|
||||
s, &bitmapCacheV2CellInfo[x])) /* bitmapCache0CellInfo (4 bytes) */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!Stream_SafeSeek(s, 12)) /* pad3 (12 bytes) */
|
||||
return FALSE;
|
||||
|
||||
WLog_VRB(TAG, "\tcacheFlags: 0x%04" PRIX16 "", cacheFlags);
|
||||
WLog_VRB(TAG, "\tpad2: 0x%02" PRIX8 "", pad2);
|
||||
WLog_VRB(TAG, "\tnumCellCaches: 0x%02" PRIX8 "", numCellCaches);
|
||||
WLog_VRB(TAG, "\tbitmapCache0CellInfo: numEntries: %" PRIu32 " persistent: %" PRId32 "",
|
||||
bitmapCacheV2CellInfo[0].numEntries, bitmapCacheV2CellInfo[0].persistent);
|
||||
WLog_VRB(TAG, "\tbitmapCache1CellInfo: numEntries: %" PRIu32 " persistent: %" PRId32 "",
|
||||
bitmapCacheV2CellInfo[1].numEntries, bitmapCacheV2CellInfo[1].persistent);
|
||||
WLog_VRB(TAG, "\tbitmapCache2CellInfo: numEntries: %" PRIu32 " persistent: %" PRId32 "",
|
||||
bitmapCacheV2CellInfo[2].numEntries, bitmapCacheV2CellInfo[2].persistent);
|
||||
WLog_VRB(TAG, "\tbitmapCache3CellInfo: numEntries: %" PRIu32 " persistent: %" PRId32 "",
|
||||
bitmapCacheV2CellInfo[3].numEntries, bitmapCacheV2CellInfo[3].persistent);
|
||||
WLog_VRB(TAG, "\tbitmapCache4CellInfo: numEntries: %" PRIu32 " persistent: %" PRId32 "",
|
||||
bitmapCacheV2CellInfo[4].numEntries, bitmapCacheV2CellInfo[4].persistent);
|
||||
for (size_t x = 0; x < ARRAYSIZE(bitmapCacheV2CellInfo); x++)
|
||||
{
|
||||
const BITMAP_CACHE_V2_CELL_INFO* info = &bitmapCacheV2CellInfo[x];
|
||||
WLog_VRB(TAG,
|
||||
"\tbitmapCache%" PRIuz "CellInfo: numEntries: %" PRIu32 " persistent: %" PRId32 "",
|
||||
x, info->numEntries, info->persistent);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
@ -1431,8 +1431,8 @@ BOOL nla_get_KERB_TICKET_LOGON(rdpNla* nla, KERB_TICKET_LOGON* logonTicket)
|
||||
WINPR_ASSERT(nla);
|
||||
WINPR_ASSERT(logonTicket);
|
||||
|
||||
SecurityFunctionTable* table;
|
||||
CtxtHandle context;
|
||||
SecurityFunctionTable* table = NULL;
|
||||
CtxtHandle context = { 0 };
|
||||
credssp_auth_tableAndContext(nla->auth, &table, &context);
|
||||
return table->QueryContextAttributes(&context, SECPKG_CRED_ATTR_TICKET_LOGON, logonTicket) ==
|
||||
SEC_E_OK;
|
||||
@ -2223,8 +2223,8 @@ SECURITY_STATUS nla_QueryContextAttributes(rdpNla* nla, DWORD ulAttr, PVOID pBuf
|
||||
{
|
||||
WINPR_ASSERT(nla);
|
||||
|
||||
SecurityFunctionTable* table;
|
||||
CtxtHandle context;
|
||||
SecurityFunctionTable* table = NULL;
|
||||
CtxtHandle context = { 0 };
|
||||
credssp_auth_tableAndContext(nla->auth, &table, &context);
|
||||
|
||||
return table->QueryContextAttributes(&context, ulAttr, pBuffer);
|
||||
|
@ -605,12 +605,13 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
|
||||
* when the user logs off like they should. Map DisconnectProviderUltimatum
|
||||
* to a ERRINFO_LOGOFF_BY_USER when the errinfo code is ERRINFO_SUCCESS.
|
||||
*/
|
||||
UINT32 errorInfo = ERRINFO_RPC_INITIATED_DISCONNECT;
|
||||
if (reason == Disconnect_Ultimatum_provider_initiated)
|
||||
rdp_set_error_info(rdp, ERRINFO_RPC_INITIATED_DISCONNECT);
|
||||
errorInfo = ERRINFO_RPC_INITIATED_DISCONNECT;
|
||||
else if (reason == Disconnect_Ultimatum_user_requested)
|
||||
rdp_set_error_info(rdp, ERRINFO_LOGOFF_BY_USER);
|
||||
else
|
||||
rdp_set_error_info(rdp, ERRINFO_RPC_INITIATED_DISCONNECT);
|
||||
errorInfo = ERRINFO_LOGOFF_BY_USER;
|
||||
|
||||
rdp_set_error_info(rdp, errorInfo);
|
||||
}
|
||||
|
||||
WLog_Print(rdp->log, WLOG_DEBUG, "DisconnectProviderUltimatum: reason: %d", reason);
|
||||
|
@ -921,15 +921,19 @@ extern "C"
|
||||
WINPR_ASSERT(_s);
|
||||
WINPR_ASSERT(_s->pointer);
|
||||
WINPR_ASSERT(Stream_GetRemainingCapacity(_s) >= 8);
|
||||
*_s->pointer++ = (_v)&0xFF;
|
||||
*_s->pointer++ = (_v >> 8) & 0xFF;
|
||||
*_s->pointer++ = (_v >> 16) & 0xFF;
|
||||
*_s->pointer++ = (_v >> 24) & 0xFF;
|
||||
*_s->pointer++ = (_v >> 32) & 0xFF;
|
||||
*_s->pointer++ = (_v >> 40) & 0xFF;
|
||||
*_s->pointer++ = (_v >> 48) & 0xFF;
|
||||
*_s->pointer++ = (_v >> 56) & 0xFF;
|
||||
Stream_Write_UINT32(_s, ((_v)&0xFFFFFFFFUL));
|
||||
Stream_Write_UINT32(_s, ((_v) >> 16 & 0xFFFFFFFFUL));
|
||||
}
|
||||
|
||||
static INLINE void Stream_Write_UINT64_BE(wStream* _s, UINT64 _v)
|
||||
{
|
||||
WINPR_ASSERT(_s);
|
||||
WINPR_ASSERT(_s->pointer);
|
||||
WINPR_ASSERT(Stream_GetRemainingCapacity(_s) >= 8);
|
||||
Stream_Write_UINT32_BE(_s, ((_v) >> 16 & 0xFFFFFFFFUL));
|
||||
Stream_Write_UINT32_BE(_s, ((_v)&0xFFFFFFFFUL));
|
||||
}
|
||||
|
||||
static INLINE void Stream_Write(wStream* _s, const void* _b, size_t _n)
|
||||
{
|
||||
if (_n > 0)
|
||||
|
@ -241,16 +241,19 @@ static BOOL isValidIP(const char* ipAddress)
|
||||
static int build_krbtgt(krb5_context ctx, krb5_data* realm, krb5_principal* ptarget)
|
||||
{
|
||||
/* "krbtgt/" + realm + "@" + realm */
|
||||
size_t len = 7ULL + realm->length + 1 + realm->length + 1;
|
||||
char* name = malloc(len);
|
||||
if (!name)
|
||||
return KRB5_CC_NOMEM;
|
||||
size_t len = 0;
|
||||
char* name = NULL;
|
||||
krb5_error_code rv = KRB5_CC_NOMEM;
|
||||
|
||||
(void)snprintf(name, len, "krbtgt/%s@%s", realm->data, realm->data);
|
||||
krb5_principal target;
|
||||
int rv = krb5_parse_name(ctx, name, &target);
|
||||
free(name);
|
||||
(void)winpr_asprintf(&name, &len, "krbtgt/%s@%s", realm->data, realm->data);
|
||||
if (!name || (len == 0))
|
||||
goto fail;
|
||||
|
||||
krb5_principal target = { 0 };
|
||||
rv = krb5_parse_name(ctx, name, &target);
|
||||
*ptarget = target;
|
||||
fail:
|
||||
free(name);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -234,6 +234,7 @@ static BOOL CALLBACK load_timezones(PINIT_ONCE once, PVOID param, PVOID* pvconte
|
||||
|
||||
#if defined(WITH_TIMEZONE_FROM_FILE) && defined(WITH_WINPR_JSON)
|
||||
{
|
||||
WINPR_JSON* json = NULL;
|
||||
char* filename = GetCombinedPath(WINPR_RESOURCE_ROOT, "TimeZoneNameMap.json");
|
||||
if (!filename)
|
||||
{
|
||||
@ -241,7 +242,7 @@ static BOOL CALLBACK load_timezones(PINIT_ONCE once, PVOID param, PVOID* pvconte
|
||||
goto end;
|
||||
}
|
||||
|
||||
WINPR_JSON* json = load_timezones_from_file(filename);
|
||||
json = load_timezones_from_file(filename);
|
||||
if (!json)
|
||||
goto end;
|
||||
|
||||
|
@ -5,12 +5,11 @@
|
||||
|
||||
int TestWtsApiExtraDisconnectSession(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
HANDLE hServer;
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
hServer = WTS_CURRENT_SERVER_HANDLE;
|
||||
|
||||
bSuccess = WTSDisconnectSession(hServer, WTS_CURRENT_SESSION, FALSE);
|
||||
HANDLE hServer = WTS_CURRENT_SERVER_HANDLE;
|
||||
BOOL bSuccess = WTSDisconnectSession(hServer, WTS_CURRENT_SESSION, FALSE);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
|
@ -5,16 +5,10 @@
|
||||
|
||||
int TestWtsApiExtraDynamicVirtualChannel(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
ULONG length;
|
||||
ULONG bytesRead;
|
||||
ULONG bytesWritten;
|
||||
BYTE buffer[1024];
|
||||
HANDLE hVirtualChannel;
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
length = sizeof(buffer);
|
||||
|
||||
hVirtualChannel =
|
||||
HANDLE hVirtualChannel =
|
||||
WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, "ECHO", WTS_CHANNEL_OPTION_DYNAMIC);
|
||||
|
||||
if (hVirtualChannel == INVALID_HANDLE_VALUE)
|
||||
@ -23,8 +17,10 @@ int TestWtsApiExtraDynamicVirtualChannel(int argc, char* argv[])
|
||||
return -1;
|
||||
}
|
||||
printf("WTSVirtualChannelOpen opend");
|
||||
bytesWritten = 0;
|
||||
bSuccess = WTSVirtualChannelWrite(hVirtualChannel, (PCHAR)buffer, length, &bytesWritten);
|
||||
ULONG bytesWritten = 0;
|
||||
char buffer[1024] = { 0 };
|
||||
size_t length = sizeof(buffer);
|
||||
BOOL bSuccess = WTSVirtualChannelWrite(hVirtualChannel, buffer, length, &bytesWritten);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
@ -33,7 +29,7 @@ int TestWtsApiExtraDynamicVirtualChannel(int argc, char* argv[])
|
||||
}
|
||||
printf("WTSVirtualChannelWrite written");
|
||||
|
||||
bytesRead = 0;
|
||||
ULONG bytesRead = 0;
|
||||
bSuccess = WTSVirtualChannelRead(hVirtualChannel, 5000, (PCHAR)buffer, length, &bytesRead);
|
||||
|
||||
if (!bSuccess)
|
||||
|
@ -5,12 +5,12 @@
|
||||
|
||||
int TestWtsApiExtraLogoffSession(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
HANDLE hServer;
|
||||
|
||||
hServer = WTS_CURRENT_SERVER_HANDLE;
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
bSuccess = WTSLogoffSession(hServer, WTS_CURRENT_SESSION, FALSE);
|
||||
HANDLE hServer = WTS_CURRENT_SERVER_HANDLE;
|
||||
BOOL bSuccess = WTSLogoffSession(hServer, WTS_CURRENT_SESSION, FALSE);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
|
@ -9,14 +9,13 @@
|
||||
|
||||
int TestWtsApiExtraSendMessage(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
HANDLE hServer;
|
||||
DWORD result;
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
hServer = WTS_CURRENT_SERVER_HANDLE;
|
||||
|
||||
bSuccess = WTSSendMessageA(hServer, WTS_CURRENT_SESSION, TITLE, strlen(TITLE) + 1, MESSAGE,
|
||||
strlen(MESSAGE) + 1, MB_CANCELTRYCONTINUE, 3, &result, TRUE);
|
||||
HANDLE hServer = WTS_CURRENT_SERVER_HANDLE;
|
||||
DWORD result = 0;
|
||||
BOOL bSuccess = WTSSendMessageA(hServer, WTS_CURRENT_SESSION, TITLE, strlen(TITLE) + 1, MESSAGE,
|
||||
strlen(MESSAGE) + 1, MB_CANCELTRYCONTINUE, 3, &result, TRUE);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
|
@ -7,12 +7,14 @@
|
||||
|
||||
int TestWtsApiExtraStartRemoteSessionEx(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
ULONG logonId = 0;
|
||||
char logonIdStr[10];
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
bSuccess = GetEnvironmentVariableA("TEST_SESSION_LOGON_ID", logonIdStr, 10);
|
||||
if (bSuccess)
|
||||
ULONG logonId = 0;
|
||||
char logonIdStr[10] = { 0 };
|
||||
|
||||
DWORD bSuccess = GetEnvironmentVariableA("TEST_SESSION_LOGON_ID", logonIdStr, 10);
|
||||
if (bSuccess > 0)
|
||||
{
|
||||
sscanf(logonIdStr, "%u\n", &logonId);
|
||||
}
|
||||
|
@ -5,16 +5,14 @@
|
||||
|
||||
int TestWtsApiExtraVirtualChannel(int argc, char* argv[])
|
||||
{
|
||||
BOOL bSuccess;
|
||||
ULONG length;
|
||||
ULONG bytesRead;
|
||||
ULONG bytesWritten;
|
||||
BYTE buffer[1024];
|
||||
HANDLE hVirtualChannel;
|
||||
|
||||
length = sizeof(buffer);
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
hVirtualChannel =
|
||||
char buffer[1024] = { 0 };
|
||||
const size_t length = sizeof(buffer);
|
||||
|
||||
HANDLE hVirtualChannel =
|
||||
WTSVirtualChannelOpen(WTS_CURRENT_SERVER_HANDLE, WTS_CURRENT_SESSION, "sample");
|
||||
|
||||
if (hVirtualChannel == INVALID_HANDLE_VALUE)
|
||||
@ -23,8 +21,8 @@ int TestWtsApiExtraVirtualChannel(int argc, char* argv[])
|
||||
return -1;
|
||||
}
|
||||
printf("WTSVirtualChannelOpen opend");
|
||||
bytesWritten = 0;
|
||||
bSuccess = WTSVirtualChannelWrite(hVirtualChannel, (PCHAR)buffer, length, &bytesWritten);
|
||||
ULONG bytesWritten = 0;
|
||||
BOOL bSuccess = WTSVirtualChannelWrite(hVirtualChannel, buffer, length, &bytesWritten);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
@ -33,8 +31,8 @@ int TestWtsApiExtraVirtualChannel(int argc, char* argv[])
|
||||
}
|
||||
printf("WTSVirtualChannelWrite written");
|
||||
|
||||
bytesRead = 0;
|
||||
bSuccess = WTSVirtualChannelRead(hVirtualChannel, 5000, (PCHAR)buffer, length, &bytesRead);
|
||||
ULONG bytesRead = 0;
|
||||
bSuccess = WTSVirtualChannelRead(hVirtualChannel, 5000, buffer, length, &bytesRead);
|
||||
|
||||
if (!bSuccess)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user