mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Merge pull request #5327 from akallabeth/sign_compare_fixes_v3
Leak and warning fixes for 2.0
This commit is contained in:
@@ -316,7 +316,7 @@ FREERDP_ADDIN** freerdp_channels_list_addins(LPCSTR pszName, LPCSTR pszSubsystem
|
||||
|
||||
void freerdp_channels_addin_list_free(FREERDP_ADDIN** ppAddins)
|
||||
{
|
||||
int index;
|
||||
size_t index;
|
||||
|
||||
if (!ppAddins)
|
||||
return;
|
||||
|
||||
@@ -1299,16 +1299,17 @@ static LONG smartcard_Transmit_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD_OPERA
|
||||
call->cbSendLength, ret.pioRecvPci, ret.pbRecvBuffer, &(ret.cbRecvLength));
|
||||
smartcard_trace_transmit_return(smartcard, &ret);
|
||||
|
||||
if ((status = smartcard_pack_transmit_return(smartcard, irp->output, &ret)))
|
||||
{
|
||||
WLog_ERR(TAG, "smartcard_pack_transmit_return failed with error %"PRId32"", status);
|
||||
return status;
|
||||
}
|
||||
|
||||
status = smartcard_pack_transmit_return(smartcard, irp->output, &ret);
|
||||
free(call->pbSendBuffer);
|
||||
free(ret.pbRecvBuffer);
|
||||
free(call->pioSendPci);
|
||||
free(call->pioRecvPci);
|
||||
|
||||
if (status)
|
||||
{
|
||||
WLog_ERR(TAG, "smartcard_pack_transmit_return failed with error %"PRId32"", status);
|
||||
return status;
|
||||
}
|
||||
return ret.ReturnCode;
|
||||
}
|
||||
|
||||
@@ -1539,7 +1540,10 @@ static LONG smartcard_LocateCardsByATRA_Call(SMARTCARD_DEVICE* smartcard,
|
||||
ret.rgReaderStates = (ReaderState_Return*) calloc(ret.cReaders, sizeof(ReaderState_Return));
|
||||
|
||||
if (!ret.rgReaderStates)
|
||||
{
|
||||
free(states);
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
for (i = 0; i < ret.cReaders; i++)
|
||||
{
|
||||
|
||||
@@ -450,7 +450,7 @@ LONG smartcard_unpack_establish_context_call(SMARTCARD_DEVICE* smartcard, wStrea
|
||||
}
|
||||
|
||||
void smartcard_trace_establish_context_call(SMARTCARD_DEVICE* smartcard,
|
||||
EstablishContext_Call* call)
|
||||
const EstablishContext_Call* call)
|
||||
{
|
||||
WINPR_UNUSED(smartcard);
|
||||
|
||||
@@ -481,7 +481,7 @@ LONG smartcard_pack_establish_context_return(SMARTCARD_DEVICE* smartcard, wStrea
|
||||
}
|
||||
|
||||
void smartcard_trace_establish_context_return(SMARTCARD_DEVICE* smartcard,
|
||||
EstablishContext_Return* ret)
|
||||
const EstablishContext_Return* ret)
|
||||
{
|
||||
BYTE* pb;
|
||||
WINPR_UNUSED(smartcard);
|
||||
@@ -525,7 +525,7 @@ LONG smartcard_unpack_context_call(SMARTCARD_DEVICE* smartcard, wStream* s, Cont
|
||||
return status;
|
||||
}
|
||||
|
||||
void smartcard_trace_context_call(SMARTCARD_DEVICE* smartcard, Context_Call* call, const char* name)
|
||||
void smartcard_trace_context_call(SMARTCARD_DEVICE* smartcard, const Context_Call* call, const char* name)
|
||||
{
|
||||
BYTE* pb;
|
||||
WINPR_UNUSED(smartcard);
|
||||
@@ -551,7 +551,7 @@ void smartcard_trace_context_call(SMARTCARD_DEVICE* smartcard, Context_Call* cal
|
||||
WLog_DBG(TAG, "}");
|
||||
}
|
||||
|
||||
void smartcard_trace_long_return(SMARTCARD_DEVICE* smartcard, Long_Return* ret, const char* name)
|
||||
void smartcard_trace_long_return(SMARTCARD_DEVICE* smartcard, const Long_Return* ret, const char* name)
|
||||
{
|
||||
WINPR_UNUSED(smartcard);
|
||||
|
||||
@@ -591,7 +591,7 @@ LONG smartcard_unpack_list_reader_groups_call(SMARTCARD_DEVICE* smartcard, wStre
|
||||
}
|
||||
|
||||
void smartcard_trace_list_reader_groups_call(SMARTCARD_DEVICE* smartcard,
|
||||
ListReaderGroups_Call* call, BOOL unicode)
|
||||
const ListReaderGroups_Call* call, BOOL unicode)
|
||||
{
|
||||
BYTE* pb;
|
||||
WINPR_UNUSED(smartcard);
|
||||
@@ -644,7 +644,7 @@ LONG smartcard_pack_list_reader_groups_return(SMARTCARD_DEVICE* smartcard, wStre
|
||||
}
|
||||
|
||||
void smartcard_trace_list_reader_groups_return(SMARTCARD_DEVICE* smartcard,
|
||||
ListReaderGroups_Return* ret, BOOL unicode)
|
||||
const ListReaderGroups_Return* ret, BOOL unicode)
|
||||
{
|
||||
int index;
|
||||
int length;
|
||||
@@ -753,7 +753,7 @@ LONG smartcard_unpack_list_readers_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
||||
void smartcard_trace_list_readers_call(SMARTCARD_DEVICE* smartcard, ListReaders_Call* call,
|
||||
void smartcard_trace_list_readers_call(SMARTCARD_DEVICE* smartcard, const ListReaders_Call* call,
|
||||
BOOL unicode)
|
||||
{
|
||||
BYTE* pb;
|
||||
@@ -830,7 +830,7 @@ LONG smartcard_pack_list_readers_return(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
||||
void smartcard_trace_list_readers_return(SMARTCARD_DEVICE* smartcard, ListReaders_Return* ret,
|
||||
void smartcard_trace_list_readers_return(SMARTCARD_DEVICE* smartcard, const ListReaders_Return* ret,
|
||||
BOOL unicode)
|
||||
{
|
||||
size_t index;
|
||||
@@ -953,7 +953,7 @@ LONG smartcard_unpack_connect_a_call(SMARTCARD_DEVICE* smartcard, wStream* s, Co
|
||||
return status;
|
||||
}
|
||||
|
||||
void smartcard_trace_connect_a_call(SMARTCARD_DEVICE* smartcard, ConnectA_Call* call)
|
||||
void smartcard_trace_connect_a_call(SMARTCARD_DEVICE* smartcard, const ConnectA_Call* call)
|
||||
{
|
||||
BYTE* pb;
|
||||
WINPR_UNUSED(smartcard);
|
||||
@@ -1026,7 +1026,7 @@ LONG smartcard_unpack_connect_w_call(SMARTCARD_DEVICE* smartcard, wStream* s, Co
|
||||
return status;
|
||||
}
|
||||
|
||||
void smartcard_trace_connect_w_call(SMARTCARD_DEVICE* smartcard, ConnectW_Call* call)
|
||||
void smartcard_trace_connect_w_call(SMARTCARD_DEVICE* smartcard, const ConnectW_Call* call)
|
||||
{
|
||||
BYTE* pb;
|
||||
char* szReaderA = NULL;
|
||||
@@ -1089,7 +1089,7 @@ LONG smartcard_pack_connect_return(SMARTCARD_DEVICE* smartcard, wStream* s, Conn
|
||||
return status;
|
||||
}
|
||||
|
||||
void smartcard_trace_connect_return(SMARTCARD_DEVICE* smartcard, Connect_Return* ret)
|
||||
void smartcard_trace_connect_return(SMARTCARD_DEVICE* smartcard, const Connect_Return* ret)
|
||||
{
|
||||
BYTE* pb;
|
||||
WINPR_UNUSED(smartcard);
|
||||
@@ -1172,7 +1172,7 @@ LONG smartcard_unpack_reconnect_call(SMARTCARD_DEVICE* smartcard, wStream* s, Re
|
||||
return status;
|
||||
}
|
||||
|
||||
void smartcard_trace_reconnect_call(SMARTCARD_DEVICE* smartcard, Reconnect_Call* call)
|
||||
void smartcard_trace_reconnect_call(SMARTCARD_DEVICE* smartcard, const Reconnect_Call* call)
|
||||
{
|
||||
BYTE* pb;
|
||||
WINPR_UNUSED(smartcard);
|
||||
@@ -1224,7 +1224,7 @@ LONG smartcard_pack_reconnect_return(SMARTCARD_DEVICE* smartcard, wStream* s, Re
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
||||
void smartcard_trace_reconnect_return(SMARTCARD_DEVICE* smartcard, Reconnect_Return* ret)
|
||||
void smartcard_trace_reconnect_return(SMARTCARD_DEVICE* smartcard, const Reconnect_Return* ret)
|
||||
{
|
||||
WINPR_UNUSED(smartcard);
|
||||
|
||||
@@ -1448,7 +1448,7 @@ LONG smartcard_unpack_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, wStr
|
||||
}
|
||||
|
||||
void smartcard_trace_get_status_change_a_call(SMARTCARD_DEVICE* smartcard,
|
||||
GetStatusChangeA_Call* call)
|
||||
const GetStatusChangeA_Call* call)
|
||||
{
|
||||
BYTE* pb;
|
||||
UINT32 index;
|
||||
@@ -1691,7 +1691,7 @@ LONG smartcard_pack_get_status_change_return(SMARTCARD_DEVICE* smartcard, wStrea
|
||||
}
|
||||
|
||||
void smartcard_trace_get_status_change_return(SMARTCARD_DEVICE* smartcard,
|
||||
GetStatusChange_Return* ret, BOOL unicode)
|
||||
const GetStatusChange_Return* ret, BOOL unicode)
|
||||
{
|
||||
UINT32 index;
|
||||
char* rgbAtr;
|
||||
@@ -1821,7 +1821,7 @@ LONG smartcard_unpack_status_call(SMARTCARD_DEVICE* smartcard, wStream* s, Statu
|
||||
return status;
|
||||
}
|
||||
|
||||
void smartcard_trace_status_call(SMARTCARD_DEVICE* smartcard, Status_Call* call, BOOL unicode)
|
||||
void smartcard_trace_status_call(SMARTCARD_DEVICE* smartcard, const Status_Call* call, BOOL unicode)
|
||||
{
|
||||
BYTE* pb;
|
||||
WINPR_UNUSED(smartcard);
|
||||
@@ -1892,7 +1892,7 @@ LONG smartcard_pack_status_return(SMARTCARD_DEVICE* smartcard, wStream* s, Statu
|
||||
return status;
|
||||
}
|
||||
|
||||
void smartcard_trace_status_return(SMARTCARD_DEVICE* smartcard, Status_Return* ret, BOOL unicode)
|
||||
void smartcard_trace_status_return(SMARTCARD_DEVICE* smartcard, const Status_Return* ret, BOOL unicode)
|
||||
{
|
||||
size_t index;
|
||||
size_t length;
|
||||
@@ -2069,7 +2069,7 @@ LONG smartcard_pack_get_attrib_return(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
return status;
|
||||
}
|
||||
|
||||
void smartcard_trace_get_attrib_return(SMARTCARD_DEVICE* smartcard, GetAttrib_Return* ret,
|
||||
void smartcard_trace_get_attrib_return(SMARTCARD_DEVICE* smartcard, const GetAttrib_Return* ret,
|
||||
DWORD dwAttrId)
|
||||
{
|
||||
WINPR_UNUSED(smartcard);
|
||||
@@ -2173,7 +2173,7 @@ LONG smartcard_unpack_control_call(SMARTCARD_DEVICE* smartcard, wStream* s, Cont
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
||||
void smartcard_trace_control_call(SMARTCARD_DEVICE* smartcard, Control_Call* call)
|
||||
void smartcard_trace_control_call(SMARTCARD_DEVICE* smartcard, const Control_Call* call)
|
||||
{
|
||||
BYTE* pb;
|
||||
WINPR_UNUSED(smartcard);
|
||||
@@ -2256,7 +2256,7 @@ LONG smartcard_pack_control_return(SMARTCARD_DEVICE* smartcard, wStream* s, Cont
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
||||
void smartcard_trace_control_return(SMARTCARD_DEVICE* smartcard, Control_Return* ret)
|
||||
void smartcard_trace_control_return(SMARTCARD_DEVICE* smartcard, const Control_Return* ret)
|
||||
{
|
||||
WINPR_UNUSED(smartcard);
|
||||
|
||||
@@ -2528,7 +2528,7 @@ LONG smartcard_unpack_transmit_call(SMARTCARD_DEVICE* smartcard, wStream* s, Tra
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
||||
void smartcard_trace_transmit_call(SMARTCARD_DEVICE* smartcard, Transmit_Call* call)
|
||||
void smartcard_trace_transmit_call(SMARTCARD_DEVICE* smartcard, const Transmit_Call* call)
|
||||
{
|
||||
BYTE* pb;
|
||||
UINT32 cbExtraBytes;
|
||||
@@ -2691,7 +2691,7 @@ LONG smartcard_pack_transmit_return(SMARTCARD_DEVICE* smartcard, wStream* s, Tra
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
||||
void smartcard_trace_transmit_return(SMARTCARD_DEVICE* smartcard, Transmit_Return* ret)
|
||||
void smartcard_trace_transmit_return(SMARTCARD_DEVICE* smartcard, const Transmit_Return* ret)
|
||||
{
|
||||
UINT32 cbExtraBytes;
|
||||
BYTE* pbExtraBytes;
|
||||
@@ -2912,7 +2912,7 @@ LONG smartcard_unpack_locate_cards_by_atr_a_call(SMARTCARD_DEVICE* smartcard, wS
|
||||
}
|
||||
|
||||
void smartcard_trace_locate_cards_by_atr_a_call(SMARTCARD_DEVICE* smartcard,
|
||||
LocateCardsByATRA_Call* call)
|
||||
const LocateCardsByATRA_Call* call)
|
||||
{
|
||||
BYTE* pb;
|
||||
UINT32 index;
|
||||
|
||||
@@ -481,54 +481,54 @@ LONG smartcard_pack_redir_scard_handle_ref(SMARTCARD_DEVICE* smartcard, wStream*
|
||||
LONG smartcard_unpack_establish_context_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
EstablishContext_Call* call);
|
||||
void smartcard_trace_establish_context_call(SMARTCARD_DEVICE* smartcard,
|
||||
EstablishContext_Call* call);
|
||||
const EstablishContext_Call* call);
|
||||
|
||||
LONG smartcard_pack_establish_context_return(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
EstablishContext_Return* ret);
|
||||
void smartcard_trace_establish_context_return(SMARTCARD_DEVICE* smartcard,
|
||||
EstablishContext_Return* ret);
|
||||
const EstablishContext_Return* ret);
|
||||
|
||||
LONG smartcard_unpack_context_call(SMARTCARD_DEVICE* smartcard, wStream* s, Context_Call* call);
|
||||
void smartcard_trace_context_call(SMARTCARD_DEVICE* smartcard, Context_Call* call,
|
||||
void smartcard_trace_context_call(SMARTCARD_DEVICE* smartcard, const Context_Call* call,
|
||||
const char* name);
|
||||
|
||||
void smartcard_trace_long_return(SMARTCARD_DEVICE* smartcard, Long_Return* ret, const char* name);
|
||||
void smartcard_trace_long_return(SMARTCARD_DEVICE* smartcard, const Long_Return* ret, const char* name);
|
||||
|
||||
LONG smartcard_unpack_list_reader_groups_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
ListReaderGroups_Call* call);
|
||||
void smartcard_trace_list_reader_groups_call(SMARTCARD_DEVICE* smartcard,
|
||||
ListReaderGroups_Call* call, BOOL unicode);
|
||||
const ListReaderGroups_Call* call, BOOL unicode);
|
||||
|
||||
LONG smartcard_pack_list_reader_groups_return(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
ListReaderGroups_Return* ret);
|
||||
void smartcard_trace_list_reader_groups_return(SMARTCARD_DEVICE* smartcard,
|
||||
ListReaderGroups_Return* ret, BOOL unicode);
|
||||
const ListReaderGroups_Return* ret, BOOL unicode);
|
||||
|
||||
LONG smartcard_unpack_list_readers_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
ListReaders_Call* call);
|
||||
void smartcard_trace_list_readers_call(SMARTCARD_DEVICE* smartcard, ListReaders_Call* call,
|
||||
void smartcard_trace_list_readers_call(SMARTCARD_DEVICE* smartcard, const ListReaders_Call* call,
|
||||
BOOL unicode);
|
||||
|
||||
LONG smartcard_pack_list_readers_return(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
ListReaders_Return* ret);
|
||||
void smartcard_trace_list_readers_return(SMARTCARD_DEVICE* smartcard, ListReaders_Return* ret,
|
||||
void smartcard_trace_list_readers_return(SMARTCARD_DEVICE* smartcard, const ListReaders_Return* ret,
|
||||
BOOL unicode);
|
||||
|
||||
LONG smartcard_unpack_connect_a_call(SMARTCARD_DEVICE* smartcard, wStream* s, ConnectA_Call* call);
|
||||
void smartcard_trace_connect_a_call(SMARTCARD_DEVICE* smartcard, ConnectA_Call* call);
|
||||
void smartcard_trace_connect_a_call(SMARTCARD_DEVICE* smartcard, const ConnectA_Call* call);
|
||||
|
||||
LONG smartcard_unpack_connect_w_call(SMARTCARD_DEVICE* smartcard, wStream* s, ConnectW_Call* call);
|
||||
void smartcard_trace_connect_w_call(SMARTCARD_DEVICE* smartcard, ConnectW_Call* call);
|
||||
void smartcard_trace_connect_w_call(SMARTCARD_DEVICE* smartcard, const ConnectW_Call* call);
|
||||
|
||||
LONG smartcard_pack_connect_return(SMARTCARD_DEVICE* smartcard, wStream* s, Connect_Return* ret);
|
||||
void smartcard_trace_connect_return(SMARTCARD_DEVICE* smartcard, Connect_Return* ret);
|
||||
void smartcard_trace_connect_return(SMARTCARD_DEVICE* smartcard, const Connect_Return* ret);
|
||||
|
||||
LONG smartcard_unpack_reconnect_call(SMARTCARD_DEVICE* smartcard, wStream* s, Reconnect_Call* call);
|
||||
void smartcard_trace_reconnect_call(SMARTCARD_DEVICE* smartcard, Reconnect_Call* call);
|
||||
void smartcard_trace_reconnect_call(SMARTCARD_DEVICE* smartcard, const Reconnect_Call* call);
|
||||
|
||||
LONG smartcard_pack_reconnect_return(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
Reconnect_Return* ret);
|
||||
void smartcard_trace_reconnect_return(SMARTCARD_DEVICE* smartcard, Reconnect_Return* ret);
|
||||
void smartcard_trace_reconnect_return(SMARTCARD_DEVICE* smartcard, const Reconnect_Return* ret);
|
||||
|
||||
LONG smartcard_unpack_hcard_and_disposition_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
HCardAndDisposition_Call* call);
|
||||
@@ -538,7 +538,7 @@ void smartcard_trace_hcard_and_disposition_call(SMARTCARD_DEVICE* smartcard,
|
||||
LONG smartcard_unpack_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
GetStatusChangeA_Call* call);
|
||||
void smartcard_trace_get_status_change_a_call(SMARTCARD_DEVICE* smartcard,
|
||||
GetStatusChangeA_Call* call);
|
||||
const GetStatusChangeA_Call* call);
|
||||
|
||||
LONG smartcard_unpack_get_status_change_w_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
GetStatusChangeW_Call* call);
|
||||
@@ -548,16 +548,16 @@ void smartcard_trace_get_status_change_w_call(SMARTCARD_DEVICE* smartcard,
|
||||
LONG smartcard_pack_get_status_change_return(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
GetStatusChange_Return* ret);
|
||||
void smartcard_trace_get_status_change_return(SMARTCARD_DEVICE* smartcard,
|
||||
GetStatusChange_Return* ret, BOOL unicode);
|
||||
const GetStatusChange_Return* ret, BOOL unicode);
|
||||
|
||||
LONG smartcard_unpack_state_call(SMARTCARD_DEVICE* smartcard, wStream* s, State_Call* call);
|
||||
LONG smartcard_pack_state_return(SMARTCARD_DEVICE* smartcard, wStream* s, State_Return* ret);
|
||||
|
||||
LONG smartcard_unpack_status_call(SMARTCARD_DEVICE* smartcard, wStream* s, Status_Call* call);
|
||||
void smartcard_trace_status_call(SMARTCARD_DEVICE* smartcard, Status_Call* call, BOOL unicode);
|
||||
void smartcard_trace_status_call(SMARTCARD_DEVICE* smartcard, const Status_Call* call, BOOL unicode);
|
||||
|
||||
LONG smartcard_pack_status_return(SMARTCARD_DEVICE* smartcard, wStream* s, Status_Return* ret);
|
||||
void smartcard_trace_status_return(SMARTCARD_DEVICE* smartcard, Status_Return* ret, BOOL unicode);
|
||||
void smartcard_trace_status_return(SMARTCARD_DEVICE* smartcard, const Status_Return* ret, BOOL unicode);
|
||||
|
||||
LONG smartcard_unpack_get_attrib_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
GetAttrib_Call* call);
|
||||
@@ -565,25 +565,25 @@ void smartcard_trace_get_attrib_call(SMARTCARD_DEVICE* smartcard, GetAttrib_Call
|
||||
|
||||
LONG smartcard_pack_get_attrib_return(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
GetAttrib_Return* ret);
|
||||
void smartcard_trace_get_attrib_return(SMARTCARD_DEVICE* smartcard, GetAttrib_Return* ret,
|
||||
void smartcard_trace_get_attrib_return(SMARTCARD_DEVICE* smartcard, const GetAttrib_Return* ret,
|
||||
DWORD dwAttrId);
|
||||
|
||||
LONG smartcard_unpack_control_call(SMARTCARD_DEVICE* smartcard, wStream* s, Control_Call* call);
|
||||
void smartcard_trace_control_call(SMARTCARD_DEVICE* smartcard, Control_Call* call);
|
||||
void smartcard_trace_control_call(SMARTCARD_DEVICE* smartcard, const Control_Call* call);
|
||||
|
||||
LONG smartcard_pack_control_return(SMARTCARD_DEVICE* smartcard, wStream* s, Control_Return* ret);
|
||||
void smartcard_trace_control_return(SMARTCARD_DEVICE* smartcard, Control_Return* ret);
|
||||
void smartcard_trace_control_return(SMARTCARD_DEVICE* smartcard, const Control_Return* ret);
|
||||
|
||||
LONG smartcard_unpack_transmit_call(SMARTCARD_DEVICE* smartcard, wStream* s, Transmit_Call* call);
|
||||
void smartcard_trace_transmit_call(SMARTCARD_DEVICE* smartcard, Transmit_Call* call);
|
||||
void smartcard_trace_transmit_call(SMARTCARD_DEVICE* smartcard, const Transmit_Call* call);
|
||||
|
||||
LONG smartcard_pack_transmit_return(SMARTCARD_DEVICE* smartcard, wStream* s, Transmit_Return* ret);
|
||||
void smartcard_trace_transmit_return(SMARTCARD_DEVICE* smartcard, Transmit_Return* ret);
|
||||
void smartcard_trace_transmit_return(SMARTCARD_DEVICE* smartcard, const Transmit_Return* ret);
|
||||
|
||||
LONG smartcard_unpack_locate_cards_by_atr_a_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||
LocateCardsByATRA_Call* call);
|
||||
void smartcard_trace_locate_cards_by_atr_a_call(SMARTCARD_DEVICE* smartcard,
|
||||
LocateCardsByATRA_Call* call);
|
||||
const LocateCardsByATRA_Call* call);
|
||||
|
||||
|
||||
#endif /* FREERDP_CHANNEL_SMARTCARD_CLIENT_PACK_H */
|
||||
|
||||
@@ -170,7 +170,8 @@ static int testAbort(int port)
|
||||
|
||||
static int testSuccess(int port)
|
||||
{
|
||||
int rc;
|
||||
int r;
|
||||
int rc = -2;
|
||||
STARTUPINFOA si;
|
||||
PROCESS_INFORMATION process;
|
||||
char arg1[] = "/v:127.0.0.1:XXXXX";
|
||||
@@ -182,66 +183,42 @@ static int testSuccess(int port)
|
||||
"/rfx",
|
||||
NULL
|
||||
};
|
||||
char* commandLine;
|
||||
char* commandLine = NULL;
|
||||
int commandLineLen;
|
||||
int argc = 4;
|
||||
char* path = TESTING_OUTPUT_DIRECTORY;
|
||||
char* wpath = TESTING_SRC_DIRECTORY;
|
||||
char* exe = GetCombinedPath(path, "server");
|
||||
char* wexe = GetCombinedPath(wpath, "server");
|
||||
char* path = NULL;
|
||||
char* wpath = NULL;
|
||||
char* exe = GetCombinedPath(TESTING_OUTPUT_DIRECTORY, "server");
|
||||
char* wexe = GetCombinedPath(TESTING_SRC_DIRECTORY, "server");
|
||||
_snprintf(arg1, 18, "/v:127.0.0.1:%d", port);
|
||||
clientArgs[1] = arg1;
|
||||
|
||||
if (!exe || !wexe)
|
||||
{
|
||||
free(exe);
|
||||
free(wexe);
|
||||
return -2;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
path = GetCombinedPath(exe, "Sample");
|
||||
wpath = GetCombinedPath(wexe, "Sample");
|
||||
free(exe);
|
||||
free(wexe);
|
||||
|
||||
if (!path || !wpath)
|
||||
{
|
||||
free(path);
|
||||
free(wpath);
|
||||
return -2;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
exe = GetCombinedPath(path, "sfreerdp-server");
|
||||
|
||||
if (!exe)
|
||||
{
|
||||
free(path);
|
||||
free(wpath);
|
||||
return -2;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
printf("Sample Server: %s\n", exe);
|
||||
printf("Workspace: %s\n", wpath);
|
||||
|
||||
if (!PathFileExistsA(exe))
|
||||
{
|
||||
free(path);
|
||||
free(wpath);
|
||||
free(exe);
|
||||
return -2;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
// Start sample server locally.
|
||||
commandLineLen = strlen(exe) + strlen("--local-only --port=XXXXX") + 1;
|
||||
commandLine = malloc(commandLineLen);
|
||||
|
||||
if (!commandLine)
|
||||
{
|
||||
free(path);
|
||||
free(wpath);
|
||||
free(exe);
|
||||
return -2;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
_snprintf(commandLine, commandLineLen, "%s --local-only --port=%d", exe, port);
|
||||
memset(&si, 0, sizeof(si));
|
||||
@@ -249,33 +226,29 @@ static int testSuccess(int port)
|
||||
|
||||
if (!CreateProcessA(exe, commandLine, NULL, NULL, FALSE, 0, NULL,
|
||||
wpath, &si, &process))
|
||||
{
|
||||
free(exe);
|
||||
free(path);
|
||||
free(wpath);
|
||||
return -2;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
free(exe);
|
||||
free(path);
|
||||
free(wpath);
|
||||
free(commandLine);
|
||||
Sleep(1 * 1000); /* let the server start */
|
||||
rc = runInstance(argc, clientArgs, NULL);
|
||||
r = runInstance(argc, clientArgs, NULL);
|
||||
|
||||
if (!TerminateProcess(process.hProcess, 0))
|
||||
return -2;
|
||||
goto fail;
|
||||
|
||||
WaitForSingleObject(process.hProcess, INFINITE);
|
||||
CloseHandle(process.hProcess);
|
||||
CloseHandle(process.hThread);
|
||||
printf("%s: returned %d!\n", __FUNCTION__, rc);
|
||||
printf("%s: returned %d!\n", __FUNCTION__, r);
|
||||
rc = r;
|
||||
|
||||
if (rc)
|
||||
return -1;
|
||||
if (rc == 0)
|
||||
printf("%s: Success!\n", __FUNCTION__);
|
||||
|
||||
printf("%s: Success!\n", __FUNCTION__);
|
||||
return 0;
|
||||
fail:
|
||||
free(exe);
|
||||
free(path);
|
||||
free(wpath);
|
||||
free(commandLine);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int TestConnect(int argc, char* argv[])
|
||||
|
||||
@@ -421,7 +421,7 @@ static BOOL process_uri(const char* uri, size_t uri_len, wArrayList* files)
|
||||
const char* prefix = "file://";
|
||||
BOOL result = FALSE;
|
||||
char* name = NULL;
|
||||
const size_t prefixLen = strnlen(prefix, sizeof (prefix));
|
||||
const size_t prefixLen = strnlen(prefix, sizeof(prefix));
|
||||
WLog_VRB(TAG, "processing URI: %.*s", uri_len, uri);
|
||||
|
||||
if ((uri_len < prefixLen) || strncmp(uri, prefix, prefixLen))
|
||||
|
||||
@@ -118,10 +118,11 @@ void string_hexdump(BYTE* data, int length)
|
||||
|
||||
int convert_utf8_to_utf16(BYTE* lpMultiByteStr, BYTE* expected_lpWideCharStr, int expected_cchWideChar)
|
||||
{
|
||||
int rc = -1;
|
||||
int length;
|
||||
int cbMultiByte;
|
||||
int cchWideChar;
|
||||
LPWSTR lpWideCharStr;
|
||||
LPWSTR lpWideCharStr = NULL;
|
||||
|
||||
cbMultiByte = strlen((char*) lpMultiByteStr);
|
||||
cchWideChar = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) lpMultiByteStr, -1, NULL, 0);
|
||||
@@ -135,14 +136,14 @@ int convert_utf8_to_utf16(BYTE* lpMultiByteStr, BYTE* expected_lpWideCharStr, in
|
||||
{
|
||||
printf("MultiByteToWideChar unexpected cchWideChar: actual: %d expected: %d\n",
|
||||
cchWideChar, expected_cchWideChar);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
lpWideCharStr = (LPWSTR) calloc(cchWideChar, sizeof(WCHAR));
|
||||
if (!lpWideCharStr)
|
||||
{
|
||||
printf("MultiByteToWideChar: unable to allocate memory for test\n");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
lpWideCharStr[cchWideChar - 1] = 0xFFFF; /* should be overwritten if null terminator is inserted properly */
|
||||
length = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) lpMultiByteStr, cbMultiByte + 1, lpWideCharStr, cchWideChar);
|
||||
@@ -153,14 +154,14 @@ int convert_utf8_to_utf16(BYTE* lpMultiByteStr, BYTE* expected_lpWideCharStr, in
|
||||
{
|
||||
DWORD error = GetLastError();
|
||||
printf("MultiByteToWideChar error: 0x%08"PRIX32"\n", error);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (length != expected_cchWideChar)
|
||||
{
|
||||
printf("MultiByteToWideChar unexpected converted length (WCHAR): actual: %d expected: %d\n",
|
||||
length, expected_cchWideChar);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (_wcscmp(lpWideCharStr, (WCHAR*) expected_lpWideCharStr) != 0)
|
||||
@@ -176,20 +177,23 @@ int convert_utf8_to_utf16(BYTE* lpMultiByteStr, BYTE* expected_lpWideCharStr, in
|
||||
printf("UTF16 String (expected):\n");
|
||||
string_hexdump((BYTE*) expected_lpWideCharStr, expected_cchWideChar * sizeof(WCHAR));
|
||||
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
printf("MultiByteToWideChar Output UTF16 String:\n");
|
||||
string_hexdump((BYTE*) lpWideCharStr, length * sizeof(WCHAR));
|
||||
printf("\n");
|
||||
|
||||
rc = length;
|
||||
fail:
|
||||
free(lpWideCharStr);
|
||||
|
||||
return length;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int convert_utf16_to_utf8(BYTE* lpWideCharStr, BYTE* expected_lpMultiByteStr, int expected_cbMultiByte)
|
||||
{
|
||||
int rc = -1;
|
||||
int length;
|
||||
int cchWideChar;
|
||||
int cbMultiByte;
|
||||
@@ -207,14 +211,14 @@ int convert_utf16_to_utf8(BYTE* lpWideCharStr, BYTE* expected_lpMultiByteStr, in
|
||||
{
|
||||
printf("WideCharToMultiByte unexpected cbMultiByte: actual: %d expected: %d\n",
|
||||
cbMultiByte, expected_cbMultiByte);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
lpMultiByteStr = (LPSTR) malloc(cbMultiByte);
|
||||
if (!lpMultiByteStr)
|
||||
{
|
||||
printf("WideCharToMultiByte: unable to allocate memory for test\n");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
lpMultiByteStr[cbMultiByte - 1] = (CHAR)0xFF; /* should be overwritten if null terminator is inserted properly */
|
||||
length = WideCharToMultiByte(CP_UTF8, 0, (LPCWSTR) lpWideCharStr, cchWideChar + 1, lpMultiByteStr, cbMultiByte, NULL, NULL);
|
||||
@@ -225,14 +229,14 @@ int convert_utf16_to_utf8(BYTE* lpWideCharStr, BYTE* expected_lpMultiByteStr, in
|
||||
{
|
||||
DWORD error = GetLastError();
|
||||
printf("WideCharToMultiByte error: 0x%08"PRIX32"\n", error);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (length != expected_cbMultiByte)
|
||||
{
|
||||
printf("WideCharToMultiByte unexpected converted length (BYTE): actual: %d expected: %d\n",
|
||||
length, expected_cbMultiByte);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (strcmp(lpMultiByteStr, (char*) expected_lpMultiByteStr) != 0)
|
||||
@@ -248,16 +252,18 @@ int convert_utf16_to_utf8(BYTE* lpWideCharStr, BYTE* expected_lpMultiByteStr, in
|
||||
printf("UTF8 String (expected):\n");
|
||||
string_hexdump((BYTE*) expected_lpMultiByteStr, expected_cbMultiByte);
|
||||
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
printf("WideCharToMultiByte Output UTF8 String:\n");
|
||||
string_hexdump((BYTE*) lpMultiByteStr, cbMultiByte);
|
||||
printf("\n");
|
||||
|
||||
rc = length;
|
||||
fail:
|
||||
free(lpMultiByteStr);
|
||||
|
||||
return length;
|
||||
return rc;
|
||||
}
|
||||
|
||||
BOOL test_unicode_uppercasing(BYTE* lower, BYTE* upper)
|
||||
|
||||
@@ -6,133 +6,130 @@
|
||||
|
||||
int TestEnvironmentGetSetEB(int argc, char* argv[])
|
||||
{
|
||||
int rc = 0;
|
||||
#ifndef _WIN32
|
||||
char test[1024];
|
||||
TCHAR* p;
|
||||
TCHAR* p = NULL;
|
||||
DWORD length;
|
||||
LPTCH lpszEnvironmentBlock = "SHELL=123\0test=1\0test1=2\0DISPLAY=WINPR_TEST_VALUE\0\0";
|
||||
LPTCH lpszEnvironmentBlockNew = NULL;
|
||||
|
||||
rc = -1;
|
||||
/* Get length of an variable */
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock,"DISPLAY", NULL, 0);
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock, "DISPLAY", NULL, 0);
|
||||
|
||||
if (0 == length)
|
||||
return -1;
|
||||
|
||||
/* Get the variable itself */
|
||||
p = (LPSTR) malloc(length);
|
||||
|
||||
if (!p)
|
||||
return -1;
|
||||
goto fail;
|
||||
|
||||
if (GetEnvironmentVariableEBA(lpszEnvironmentBlock,"DISPLAY", p, length) != length - 1)
|
||||
return -1;
|
||||
if (GetEnvironmentVariableEBA(lpszEnvironmentBlock, "DISPLAY", p, length) != length - 1)
|
||||
goto fail;
|
||||
|
||||
printf("GetEnvironmentVariableA(WINPR_TEST_VARIABLE) = %s\n" , p);
|
||||
printf("GetEnvironmentVariableA(WINPR_TEST_VARIABLE) = %s\n", p);
|
||||
|
||||
if (strcmp(p, "WINPR_TEST_VALUE") != 0)
|
||||
{
|
||||
free(p);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(p);
|
||||
goto fail;
|
||||
|
||||
/* Get length of an non-existing variable */
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock,"BLA", NULL, 0);
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock, "BLA", NULL, 0);
|
||||
|
||||
if (0 != length)
|
||||
{
|
||||
printf("Unset variable returned\n");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Get length of an similar called variables */
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock,"XDISPLAY", NULL, 0);
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock, "XDISPLAY", NULL, 0);
|
||||
|
||||
if (0 != length)
|
||||
{
|
||||
printf("Similar named variable returned (XDISPLAY, length %d)\n", length);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock,"DISPLAYX", NULL, 0);
|
||||
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock, "DISPLAYX", NULL, 0);
|
||||
|
||||
if (0 != length)
|
||||
{
|
||||
printf("Similar named variable returned (DISPLAYX, length %d)\n", length);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock,"DISPLA", NULL, 0);
|
||||
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock, "DISPLA", NULL, 0);
|
||||
|
||||
if (0 != length)
|
||||
{
|
||||
printf("Similar named variable returned (DISPLA, length %d)\n", length);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock,"ISPLAY", NULL, 0);
|
||||
|
||||
length = GetEnvironmentVariableEBA(lpszEnvironmentBlock, "ISPLAY", NULL, 0);
|
||||
|
||||
if (0 != length)
|
||||
{
|
||||
printf("Similar named variable returned (ISPLAY, length %d)\n", length);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Set variable in empty environment block */
|
||||
if (SetEnvironmentVariableEBA(&lpszEnvironmentBlockNew, "test", "5"))
|
||||
{
|
||||
if (GetEnvironmentVariableEBA(lpszEnvironmentBlockNew,"test", test, 1023))
|
||||
if (GetEnvironmentVariableEBA(lpszEnvironmentBlockNew, "test", test, 1023))
|
||||
{
|
||||
if (strcmp(test,"5") != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(test, "5") != 0)
|
||||
goto fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Clear variable */
|
||||
if (SetEnvironmentVariableEBA(&lpszEnvironmentBlockNew, "test", NULL))
|
||||
{
|
||||
if (GetEnvironmentVariableEBA(lpszEnvironmentBlockNew,"test", test, 1023))
|
||||
{
|
||||
free(lpszEnvironmentBlockNew);
|
||||
return -1;
|
||||
}
|
||||
if (GetEnvironmentVariableEBA(lpszEnvironmentBlockNew, "test", test, 1023))
|
||||
goto fail;
|
||||
else
|
||||
{
|
||||
// not found .. this is expected
|
||||
}
|
||||
}
|
||||
|
||||
free(lpszEnvironmentBlockNew);
|
||||
|
||||
lpszEnvironmentBlockNew = (LPTCH) calloc(1024, sizeof(TCHAR));
|
||||
if (!lpszEnvironmentBlockNew)
|
||||
return -1;
|
||||
|
||||
memcpy(lpszEnvironmentBlockNew,lpszEnvironmentBlock,length);
|
||||
if (!lpszEnvironmentBlockNew)
|
||||
goto fail;
|
||||
|
||||
memcpy(lpszEnvironmentBlockNew, lpszEnvironmentBlock, length);
|
||||
|
||||
/* Set variable in empty environment block */
|
||||
if (SetEnvironmentVariableEBA(&lpszEnvironmentBlockNew, "test", "5"))
|
||||
{
|
||||
if (0 != GetEnvironmentVariableEBA(lpszEnvironmentBlockNew,"testr", test, 1023))
|
||||
if (0 != GetEnvironmentVariableEBA(lpszEnvironmentBlockNew, "testr", test, 1023))
|
||||
{
|
||||
printf("GetEnvironmentVariableEBA returned unset variable\n");
|
||||
free(lpszEnvironmentBlockNew);
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
if (GetEnvironmentVariableEBA(lpszEnvironmentBlockNew,"test", test, 1023))
|
||||
|
||||
if (GetEnvironmentVariableEBA(lpszEnvironmentBlockNew, "test", test, 1023))
|
||||
{
|
||||
if (strcmp(test,"5") != 0)
|
||||
{
|
||||
free(lpszEnvironmentBlockNew);
|
||||
return -1;
|
||||
}
|
||||
if (strcmp(test, "5") != 0)
|
||||
goto fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
free(lpszEnvironmentBlockNew);
|
||||
return -1;
|
||||
}
|
||||
goto fail;
|
||||
}
|
||||
|
||||
rc = 0;
|
||||
fail:
|
||||
free(p);
|
||||
free(lpszEnvironmentBlockNew);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
#define TEST_VALUE "WINPR_TEST_VALUE"
|
||||
int TestEnvironmentSetEnvironmentVariable(int argc, char* argv[])
|
||||
{
|
||||
int rc = -1;
|
||||
DWORD nSize;
|
||||
LPSTR lpBuffer;
|
||||
LPSTR lpBuffer = NULL;
|
||||
DWORD error = 0;
|
||||
|
||||
SetEnvironmentVariableA(TEST_NAME, TEST_VALUE);
|
||||
|
||||
nSize = GetEnvironmentVariableA(TEST_NAME, NULL, 0);
|
||||
|
||||
/* check if value returned is len + 1 ) */
|
||||
if (nSize != strlen(TEST_VALUE) + 1)
|
||||
{
|
||||
@@ -24,6 +24,7 @@ int TestEnvironmentSetEnvironmentVariable(int argc, char* argv[])
|
||||
}
|
||||
|
||||
lpBuffer = (LPSTR) malloc(nSize);
|
||||
|
||||
if (!lpBuffer)
|
||||
return -1;
|
||||
|
||||
@@ -32,33 +33,37 @@ int TestEnvironmentSetEnvironmentVariable(int argc, char* argv[])
|
||||
if (nSize != strlen(TEST_VALUE))
|
||||
{
|
||||
printf("GetEnvironmentVariableA wrong size returned\n");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (strcmp(lpBuffer, TEST_VALUE) != 0)
|
||||
{
|
||||
printf("GetEnvironmentVariableA returned value doesn't match\n");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
nSize = GetEnvironmentVariableA("__xx__notset_",lpBuffer, nSize);
|
||||
nSize = GetEnvironmentVariableA("__xx__notset_", lpBuffer, nSize);
|
||||
error = GetLastError();
|
||||
|
||||
if (0 != nSize || ERROR_ENVVAR_NOT_FOUND != error)
|
||||
{
|
||||
printf("GetEnvironmentVariableA not found error\n");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
free(lpBuffer);
|
||||
|
||||
/* clear variable */
|
||||
SetEnvironmentVariableA(TEST_NAME, NULL);
|
||||
nSize = GetEnvironmentVariableA(TEST_VALUE, NULL, 0);
|
||||
if ( 0 != nSize)
|
||||
|
||||
if (0 != nSize)
|
||||
{
|
||||
printf("SetEnvironmentVariableA failed to clear variable\n");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
return 0;
|
||||
|
||||
rc = 0;
|
||||
fail:
|
||||
free(lpBuffer);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user