Reformatted changed files.
This commit is contained in:
parent
a5ca75c3ab
commit
b22b897389
@ -299,18 +299,23 @@ static int rdpdr_server_receive_core_capability_response(RdpdrServerContext *con
|
||||
case CAP_GENERAL_TYPE:
|
||||
rdpdr_server_read_general_capability_set(context, s, &capabilityHeader);
|
||||
break;
|
||||
|
||||
case CAP_PRINTER_TYPE:
|
||||
rdpdr_server_read_printer_capability_set(context, s, &capabilityHeader);
|
||||
break;
|
||||
|
||||
case CAP_PORT_TYPE:
|
||||
rdpdr_server_read_port_capability_set(context, s, &capabilityHeader);
|
||||
break;
|
||||
|
||||
case CAP_DRIVE_TYPE:
|
||||
rdpdr_server_read_drive_capability_set(context, s, &capabilityHeader);
|
||||
break;
|
||||
|
||||
case CAP_SMARTCARD_TYPE:
|
||||
rdpdr_server_read_smartcard_capability_set(context, s, &capabilityHeader);
|
||||
break;
|
||||
|
||||
default:
|
||||
CLOG_DBG("Unknown capabilityType %d\n", capabilityHeader.CapabilityType);
|
||||
Stream_Seek(s, capabilityHeader.CapabilityLength - RDPDR_CAPABILITY_HEADER_LENGTH);
|
||||
@ -367,14 +372,19 @@ static int rdpdr_server_receive_device_list_announce_request(RdpdrServerContext
|
||||
{
|
||||
case RDPDR_DTYP_FILESYSTEM:
|
||||
break;
|
||||
|
||||
case RDPDR_DTYP_PRINT:
|
||||
break;
|
||||
|
||||
case RDPDR_DTYP_SERIAL:
|
||||
break;
|
||||
|
||||
case RDPDR_DTYP_PARALLEL:
|
||||
break;
|
||||
|
||||
case RDPDR_DTYP_SMARTCARD:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -416,10 +426,12 @@ static int rdpdr_server_receive_pdu(RdpdrServerContext *context, wStream *s, RDP
|
||||
case PAKID_CORE_CLIENTID_CONFIRM:
|
||||
rdpdr_server_receive_announce_response(context, s, header);
|
||||
break;
|
||||
|
||||
case PAKID_CORE_CLIENT_NAME:
|
||||
rdpdr_server_receive_client_name_request(context, s, header);
|
||||
rdpdr_server_send_core_capability_request(context);
|
||||
break;
|
||||
|
||||
case PAKID_CORE_CLIENT_CAPABILITY:
|
||||
rdpdr_server_receive_core_capability_response(context, s, header);
|
||||
rdpdr_server_send_client_id_confirm(context);
|
||||
@ -428,17 +440,23 @@ static int rdpdr_server_receive_pdu(RdpdrServerContext *context, wStream *s, RDP
|
||||
rdpdr_server_send_user_logged_on(context);
|
||||
|
||||
break;
|
||||
|
||||
case PAKID_CORE_DEVICELIST_ANNOUNCE:
|
||||
rdpdr_server_receive_device_list_announce_request(context, s, header);
|
||||
break;
|
||||
|
||||
case PAKID_CORE_DEVICE_REPLY:
|
||||
break;
|
||||
|
||||
case PAKID_CORE_DEVICE_IOREQUEST:
|
||||
break;
|
||||
|
||||
case PAKID_CORE_DEVICE_IOCOMPLETION:
|
||||
break;
|
||||
|
||||
case PAKID_CORE_DEVICELIST_REMOVE:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -449,8 +467,10 @@ static int rdpdr_server_receive_pdu(RdpdrServerContext *context, wStream *s, RDP
|
||||
{
|
||||
case PAKID_PRN_CACHE_DATA:
|
||||
break;
|
||||
|
||||
case PAKID_PRN_USING_XPS:
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -46,100 +46,148 @@ const char *smartcard_get_ioctl_string(UINT32 ioControlCode, BOOL funcName)
|
||||
{
|
||||
case SCARD_IOCTL_ESTABLISHCONTEXT:
|
||||
return funcName ? "SCardEstablishContext" : "SCARD_IOCTL_ESTABLISHCONTEXT";
|
||||
|
||||
case SCARD_IOCTL_RELEASECONTEXT:
|
||||
return funcName ? "SCardReleaseContext" : "SCARD_IOCTL_RELEASECONTEXT";
|
||||
|
||||
case SCARD_IOCTL_ISVALIDCONTEXT:
|
||||
return funcName ? "SCardIsValidContext" : "SCARD_IOCTL_ISVALIDCONTEXT";
|
||||
|
||||
case SCARD_IOCTL_LISTREADERGROUPSA:
|
||||
return funcName ? "SCardListReaderGroupsA" : "SCARD_IOCTL_LISTREADERGROUPSA";
|
||||
|
||||
case SCARD_IOCTL_LISTREADERGROUPSW:
|
||||
return funcName ? "SCardListReaderGroupsW" : "SCARD_IOCTL_LISTREADERGROUPSW";
|
||||
|
||||
case SCARD_IOCTL_LISTREADERSA:
|
||||
return funcName ? "SCardListReadersA" : "SCARD_IOCTL_LISTREADERSA";
|
||||
|
||||
case SCARD_IOCTL_LISTREADERSW:
|
||||
return funcName ? "SCardListReadersW" : "SCARD_IOCTL_LISTREADERSW";
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERGROUPA:
|
||||
return funcName ? "SCardIntroduceReaderGroupA" : "SCARD_IOCTL_INTRODUCEREADERGROUPA";
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERGROUPW:
|
||||
return funcName ? "SCardIntroduceReaderGroupW" : "SCARD_IOCTL_INTRODUCEREADERGROUPW";
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERGROUPA:
|
||||
return funcName ? "SCardForgetReaderGroupA" : "SCARD_IOCTL_FORGETREADERGROUPA";
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERGROUPW:
|
||||
return funcName ? "SCardForgetReaderGroupW" : "SCARD_IOCTL_FORGETREADERGROUPW";
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERA:
|
||||
return funcName ? "SCardIntroduceReaderA" : "SCARD_IOCTL_INTRODUCEREADERA";
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERW:
|
||||
return funcName ? "SCardIntroduceReaderW" : "SCARD_IOCTL_INTRODUCEREADERW";
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERA:
|
||||
return funcName ? "SCardForgetReaderA" : "SCARD_IOCTL_FORGETREADERA";
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERW:
|
||||
return funcName ? "SCardForgetReaderW" : "SCARD_IOCTL_FORGETREADERW";
|
||||
|
||||
case SCARD_IOCTL_ADDREADERTOGROUPA:
|
||||
return funcName ? "SCardAddReaderToGroupA" : "SCARD_IOCTL_ADDREADERTOGROUPA";
|
||||
|
||||
case SCARD_IOCTL_ADDREADERTOGROUPW:
|
||||
return funcName ? "SCardAddReaderToGroupW" : "SCARD_IOCTL_ADDREADERTOGROUPW";
|
||||
|
||||
case SCARD_IOCTL_REMOVEREADERFROMGROUPA:
|
||||
return funcName ? "SCardRemoveReaderFromGroupA" : "SCARD_IOCTL_REMOVEREADERFROMGROUPA";
|
||||
|
||||
case SCARD_IOCTL_REMOVEREADERFROMGROUPW:
|
||||
return funcName ? "SCardRemoveReaderFromGroupW" : "SCARD_IOCTL_REMOVEREADERFROMGROUPW";
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSA:
|
||||
return funcName ? "SCardLocateCardsA" : "SCARD_IOCTL_LOCATECARDSA";
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSW:
|
||||
return funcName ? "SCardLocateCardsW" : "SCARD_IOCTL_LOCATECARDSW";
|
||||
|
||||
case SCARD_IOCTL_GETSTATUSCHANGEA:
|
||||
return funcName ? "SCardGetStatusChangeA" : "SCARD_IOCTL_GETSTATUSCHANGEA";
|
||||
|
||||
case SCARD_IOCTL_GETSTATUSCHANGEW:
|
||||
return funcName ? "SCardGetStatusChangeW" : "SCARD_IOCTL_GETSTATUSCHANGEW";
|
||||
|
||||
case SCARD_IOCTL_CANCEL:
|
||||
return funcName ? "SCardCancel" : "SCARD_IOCTL_CANCEL";
|
||||
|
||||
case SCARD_IOCTL_CONNECTA:
|
||||
return funcName ? "SCardConnectA" : "SCARD_IOCTL_CONNECTA";
|
||||
|
||||
case SCARD_IOCTL_CONNECTW:
|
||||
return funcName ? "SCardConnectW" : "SCARD_IOCTL_CONNECTW";
|
||||
|
||||
case SCARD_IOCTL_RECONNECT:
|
||||
return funcName ? "SCardReconnect" : "SCARD_IOCTL_RECONNECT";
|
||||
|
||||
case SCARD_IOCTL_DISCONNECT:
|
||||
return funcName ? "SCardDisconnect" : "SCARD_IOCTL_DISCONNECT";
|
||||
|
||||
case SCARD_IOCTL_BEGINTRANSACTION:
|
||||
return funcName ? "SCardBeginTransaction" : "SCARD_IOCTL_BEGINTRANSACTION";
|
||||
|
||||
case SCARD_IOCTL_ENDTRANSACTION:
|
||||
return funcName ? "SCardEndTransaction" : "SCARD_IOCTL_ENDTRANSACTION";
|
||||
|
||||
case SCARD_IOCTL_STATE:
|
||||
return funcName ? "SCardState" : "SCARD_IOCTL_STATE";
|
||||
|
||||
case SCARD_IOCTL_STATUSA:
|
||||
return funcName ? "SCardStatusA" : "SCARD_IOCTL_STATUSA";
|
||||
|
||||
case SCARD_IOCTL_STATUSW:
|
||||
return funcName ? "SCardStatusW" : "SCARD_IOCTL_STATUSW";
|
||||
|
||||
case SCARD_IOCTL_TRANSMIT:
|
||||
return funcName ? "SCardTransmit" : "SCARD_IOCTL_TRANSMIT";
|
||||
|
||||
case SCARD_IOCTL_CONTROL:
|
||||
return funcName ? "SCardControl" : "SCARD_IOCTL_CONTROL";
|
||||
|
||||
case SCARD_IOCTL_GETATTRIB:
|
||||
return funcName ? "SCardGetAttrib" : "SCARD_IOCTL_GETATTRIB";
|
||||
|
||||
case SCARD_IOCTL_SETATTRIB:
|
||||
return funcName ? "SCardSetAttrib" : "SCARD_IOCTL_SETATTRIB";
|
||||
|
||||
case SCARD_IOCTL_ACCESSSTARTEDEVENT:
|
||||
return funcName ? "SCardAccessStartedEvent" : "SCARD_IOCTL_ACCESSSTARTEDEVENT";
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSBYATRA:
|
||||
return funcName ? "SCardLocateCardsByATRA" : "SCARD_IOCTL_LOCATECARDSBYATRA";
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSBYATRW:
|
||||
return funcName ? "SCardLocateCardsByATRB" : "SCARD_IOCTL_LOCATECARDSBYATRW";
|
||||
|
||||
case SCARD_IOCTL_READCACHEA:
|
||||
return funcName ? "SCardReadCacheA" : "SCARD_IOCTL_READCACHEA";
|
||||
|
||||
case SCARD_IOCTL_READCACHEW:
|
||||
return funcName ? "SCardReadCacheW" : "SCARD_IOCTL_READCACHEW";
|
||||
|
||||
case SCARD_IOCTL_WRITECACHEA:
|
||||
return funcName ? "SCardWriteCacheA" : "SCARD_IOCTL_WRITECACHEA";
|
||||
|
||||
case SCARD_IOCTL_WRITECACHEW:
|
||||
return funcName ? "SCardWriteCacheW" : "SCARD_IOCTL_WRITECACHEW";
|
||||
|
||||
case SCARD_IOCTL_GETTRANSMITCOUNT:
|
||||
return funcName ? "SCardGetTransmitCount" : "SCARD_IOCTL_GETTRANSMITCOUNT";
|
||||
|
||||
case SCARD_IOCTL_RELEASESTARTEDEVENT:
|
||||
return funcName ? "SCardReleaseStartedEvent" : "SCARD_IOCTL_RELEASESTARTEDEVENT";
|
||||
|
||||
case SCARD_IOCTL_GETREADERICON:
|
||||
return funcName ? "SCardGetReaderIcon" : "SCARD_IOCTL_GETREADERICON";
|
||||
|
||||
case SCARD_IOCTL_GETDEVICETYPEID:
|
||||
return funcName ? "SCardGetDeviceTypeId" : "SCARD_IOCTL_GETDEVICETYPEID";
|
||||
|
||||
default:
|
||||
return funcName ? "SCardUnknown" : "SCARD_IOCTL_UNKNOWN";
|
||||
}
|
||||
@ -1048,167 +1096,215 @@ UINT32 smartcard_irp_device_control_decode(SMARTCARD_DEVICE *smartcard, SMARTCAR
|
||||
call = calloc(1, sizeof(EstablishContext_Call));
|
||||
status = smartcard_EstablishContext_Decode(smartcard, operation, (EstablishContext_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_RELEASECONTEXT:
|
||||
call = calloc(1, sizeof(Context_Call));
|
||||
status = smartcard_ReleaseContext_Decode(smartcard, operation, (Context_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_ISVALIDCONTEXT:
|
||||
call = calloc(1, sizeof(Context_Call));
|
||||
status = smartcard_IsValidContext_Decode(smartcard, operation, (Context_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LISTREADERGROUPSA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LISTREADERGROUPSW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LISTREADERSA:
|
||||
call = calloc(1, sizeof(ListReaders_Call));
|
||||
status = smartcard_ListReadersA_Decode(smartcard, operation, (ListReaders_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LISTREADERSW:
|
||||
call = calloc(1, sizeof(ListReaders_Call));
|
||||
status = smartcard_ListReadersW_Decode(smartcard, operation, (ListReaders_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERGROUPA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERGROUPW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERGROUPA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERGROUPW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_ADDREADERTOGROUPA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_ADDREADERTOGROUPW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_REMOVEREADERFROMGROUPA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_REMOVEREADERFROMGROUPW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETSTATUSCHANGEA:
|
||||
call = calloc(1, sizeof(GetStatusChangeA_Call));
|
||||
status = smartcard_GetStatusChangeA_Decode(smartcard, operation, (GetStatusChangeA_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETSTATUSCHANGEW:
|
||||
call = calloc(1, sizeof(GetStatusChangeW_Call));
|
||||
status = smartcard_GetStatusChangeW_Decode(smartcard, operation, (GetStatusChangeW_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_CANCEL:
|
||||
call = calloc(1, sizeof(Context_Call));
|
||||
status = smartcard_Cancel_Decode(smartcard, operation, (Context_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_CONNECTA:
|
||||
call = calloc(1, sizeof(ConnectA_Call));
|
||||
status = smartcard_ConnectA_Decode(smartcard, operation, (ConnectA_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_CONNECTW:
|
||||
call = calloc(1, sizeof(ConnectW_Call));
|
||||
status = smartcard_ConnectW_Decode(smartcard, operation, (ConnectW_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_RECONNECT:
|
||||
call = calloc(1, sizeof(Reconnect_Call));
|
||||
status = smartcard_Reconnect_Decode(smartcard, operation, (Reconnect_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_DISCONNECT:
|
||||
call = calloc(1, sizeof(HCardAndDisposition_Call));
|
||||
status = smartcard_Disconnect_Decode(smartcard, operation, (HCardAndDisposition_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_BEGINTRANSACTION:
|
||||
call = calloc(1, sizeof(HCardAndDisposition_Call));
|
||||
status = smartcard_BeginTransaction_Decode(smartcard, operation, (HCardAndDisposition_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_ENDTRANSACTION:
|
||||
call = calloc(1, sizeof(HCardAndDisposition_Call));
|
||||
status = smartcard_EndTransaction_Decode(smartcard, operation, (HCardAndDisposition_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_STATE:
|
||||
call = calloc(1, sizeof(State_Call));
|
||||
status = smartcard_State_Decode(smartcard, operation, (State_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_STATUSA:
|
||||
call = calloc(1, sizeof(Status_Call));
|
||||
status = smartcard_StatusA_Decode(smartcard, operation, (Status_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_STATUSW:
|
||||
call = calloc(1, sizeof(Status_Call));
|
||||
status = smartcard_StatusW_Decode(smartcard, operation, (Status_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_TRANSMIT:
|
||||
call = calloc(1, sizeof(Transmit_Call));
|
||||
status = smartcard_Transmit_Decode(smartcard, operation, (Transmit_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_CONTROL:
|
||||
call = calloc(1, sizeof(Control_Call));
|
||||
status = smartcard_Control_Decode(smartcard, operation, (Control_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETATTRIB:
|
||||
call = calloc(1, sizeof(GetAttrib_Call));
|
||||
status = smartcard_GetAttrib_Decode(smartcard, operation, (GetAttrib_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_SETATTRIB:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_ACCESSSTARTEDEVENT:
|
||||
call = calloc(1, sizeof(Long_Call));
|
||||
status = smartcard_AccessStartedEvent_Decode(smartcard, operation, (Long_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSBYATRA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSBYATRW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_READCACHEA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_READCACHEW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_WRITECACHEA:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_WRITECACHEW:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETTRANSMITCOUNT:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_RELEASESTARTEDEVENT:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETREADERICON:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETDEVICETYPEID:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
default:
|
||||
status = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
@ -1286,147 +1382,195 @@ UINT32 smartcard_irp_device_control_call(SMARTCARD_DEVICE *smartcard, SMARTCARD_
|
||||
case SCARD_IOCTL_ESTABLISHCONTEXT:
|
||||
result = smartcard_EstablishContext_Call(smartcard, operation, (EstablishContext_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_RELEASECONTEXT:
|
||||
result = smartcard_ReleaseContext_Call(smartcard, operation, (Context_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_ISVALIDCONTEXT:
|
||||
result = smartcard_IsValidContext_Call(smartcard, operation, (Context_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LISTREADERGROUPSA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LISTREADERGROUPSW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LISTREADERSA:
|
||||
result = smartcard_ListReadersA_Call(smartcard, operation, (ListReaders_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LISTREADERSW:
|
||||
result = smartcard_ListReadersW_Call(smartcard, operation, (ListReaders_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERGROUPA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERGROUPW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERGROUPA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERGROUPW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_INTRODUCEREADERW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_FORGETREADERW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_ADDREADERTOGROUPA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_ADDREADERTOGROUPW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_REMOVEREADERFROMGROUPA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_REMOVEREADERFROMGROUPW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETSTATUSCHANGEA:
|
||||
result = smartcard_GetStatusChangeA_Call(smartcard, operation, (GetStatusChangeA_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETSTATUSCHANGEW:
|
||||
result = smartcard_GetStatusChangeW_Call(smartcard, operation, (GetStatusChangeW_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_CANCEL:
|
||||
result = smartcard_Cancel_Call(smartcard, operation, (Context_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_CONNECTA:
|
||||
result = smartcard_ConnectA_Call(smartcard, operation, (ConnectA_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_CONNECTW:
|
||||
result = smartcard_ConnectW_Call(smartcard, operation, (ConnectW_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_RECONNECT:
|
||||
result = smartcard_Reconnect_Call(smartcard, operation, (Reconnect_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_DISCONNECT:
|
||||
result = smartcard_Disconnect_Call(smartcard, operation, (HCardAndDisposition_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_BEGINTRANSACTION:
|
||||
result = smartcard_BeginTransaction_Call(smartcard, operation, (HCardAndDisposition_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_ENDTRANSACTION:
|
||||
result = smartcard_EndTransaction_Call(smartcard, operation, (HCardAndDisposition_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_STATE:
|
||||
result = smartcard_State_Call(smartcard, operation, (State_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_STATUSA:
|
||||
result = smartcard_StatusA_Call(smartcard, operation, (Status_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_STATUSW:
|
||||
result = smartcard_StatusW_Call(smartcard, operation, (Status_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_TRANSMIT:
|
||||
result = smartcard_Transmit_Call(smartcard, operation, (Transmit_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_CONTROL:
|
||||
result = smartcard_Control_Call(smartcard, operation, (Control_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETATTRIB:
|
||||
result = smartcard_GetAttrib_Call(smartcard, operation, (GetAttrib_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_SETATTRIB:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_ACCESSSTARTEDEVENT:
|
||||
result = smartcard_AccessStartedEvent_Call(smartcard, operation, (Long_Call*) call);
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSBYATRA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_LOCATECARDSBYATRW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_READCACHEA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_READCACHEW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_WRITECACHEA:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_WRITECACHEW:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETTRANSMITCOUNT:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_RELEASESTARTEDEVENT:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETREADERICON:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
case SCARD_IOCTL_GETDEVICETYPEID:
|
||||
result = SCARD_F_INTERNAL_ERROR;
|
||||
break;
|
||||
|
||||
default:
|
||||
result = STATUS_UNSUCCESSFUL;
|
||||
break;
|
||||
|
@ -464,6 +464,7 @@ void xf_process_rail_server_sysparam_event(xfContext *xfc, rdpChannels *channels
|
||||
{
|
||||
case SPI_SET_SCREEN_SAVE_ACTIVE:
|
||||
break;
|
||||
|
||||
case SPI_SET_SCREEN_SAVE_SECURE:
|
||||
break;
|
||||
}
|
||||
@ -534,53 +535,63 @@ void xf_process_rail_server_localmovesize_event(xfContext *xfc, rdpChannels *cha
|
||||
x = movesize->posX;
|
||||
y = movesize->posY;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_RIGHT: //0x2
|
||||
direction = _NET_WM_MOVERESIZE_SIZE_RIGHT;
|
||||
x = movesize->posX;
|
||||
y = movesize->posY;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_TOP: //0x3
|
||||
direction = _NET_WM_MOVERESIZE_SIZE_TOP;
|
||||
x = movesize->posX;
|
||||
y = movesize->posY;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_TOPLEFT: //0x4
|
||||
direction = _NET_WM_MOVERESIZE_SIZE_TOPLEFT;
|
||||
x = movesize->posX;
|
||||
y = movesize->posY;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_TOPRIGHT: //0x5
|
||||
direction = _NET_WM_MOVERESIZE_SIZE_TOPRIGHT;
|
||||
x = movesize->posX;
|
||||
y = movesize->posY;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_BOTTOM: //0x6
|
||||
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOM;
|
||||
x = movesize->posX;
|
||||
y = movesize->posY;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_BOTTOMLEFT: //0x7
|
||||
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT;
|
||||
x = movesize->posX;
|
||||
y = movesize->posY;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_BOTTOMRIGHT: //0x8
|
||||
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT;
|
||||
x = movesize->posX;
|
||||
y = movesize->posY;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_MOVE: //0x9
|
||||
direction = _NET_WM_MOVERESIZE_MOVE;
|
||||
XTranslateCoordinates(xfc->display, xfw->handle,
|
||||
RootWindowOfScreen(xfc->screen),
|
||||
movesize->posX, movesize->posY, &x, &y, &child_window);
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_KEYMOVE: //0xA
|
||||
direction = _NET_WM_MOVERESIZE_MOVE_KEYBOARD;
|
||||
x = movesize->posX;
|
||||
y = movesize->posY;
|
||||
/* FIXME: local keyboard moves not working */
|
||||
return;
|
||||
|
||||
case RAIL_WMSZ_KEYSIZE: //0xB
|
||||
direction = _NET_WM_MOVERESIZE_SIZE_KEYBOARD;
|
||||
x = movesize->posX;
|
||||
@ -625,24 +636,31 @@ void xf_process_rail_event(xfContext *xfc, rdpChannels *channels, wMessage *even
|
||||
case RailChannel_GetSystemParam:
|
||||
xf_process_rail_get_sysparams_event(xfc, channels, event);
|
||||
break;
|
||||
|
||||
case RailChannel_ServerExecuteResult:
|
||||
xf_process_rail_exec_result_event(xfc, channels, event);
|
||||
break;
|
||||
|
||||
case RailChannel_ServerSystemParam:
|
||||
xf_process_rail_server_sysparam_event(xfc, channels, event);
|
||||
break;
|
||||
|
||||
case RailChannel_ServerMinMaxInfo:
|
||||
xf_process_rail_server_minmaxinfo_event(xfc, channels, event);
|
||||
break;
|
||||
|
||||
case RailChannel_ServerLocalMoveSize:
|
||||
xf_process_rail_server_localmovesize_event(xfc, channels, event);
|
||||
break;
|
||||
|
||||
case RailChannel_ServerGetAppIdResponse:
|
||||
xf_process_rail_appid_resp_event(xfc, channels, event);
|
||||
break;
|
||||
|
||||
case RailChannel_ServerLanguageBarInfo:
|
||||
xf_process_rail_langbarinfo_event(xfc, channels, event);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -126,16 +126,20 @@ int bulk_decompress(rdpBulk *bulk, BYTE *pSrcData, UINT32 SrcSize, BYTE **ppDstD
|
||||
mppc_set_compression_level(bulk->mppcRecv, 0);
|
||||
status = mppc_decompress(bulk->mppcRecv, pSrcData, SrcSize, ppDstData, pDstSize, flags);
|
||||
break;
|
||||
|
||||
case PACKET_COMPR_TYPE_64K:
|
||||
mppc_set_compression_level(bulk->mppcRecv, 1);
|
||||
status = mppc_decompress(bulk->mppcRecv, pSrcData, SrcSize, ppDstData, pDstSize, flags);
|
||||
break;
|
||||
|
||||
case PACKET_COMPR_TYPE_RDP6:
|
||||
status = ncrush_decompress(bulk->ncrushRecv, pSrcData, SrcSize, ppDstData, pDstSize, flags);
|
||||
break;
|
||||
|
||||
case PACKET_COMPR_TYPE_RDP61:
|
||||
status = xcrush_decompress(bulk->xcrushRecv, pSrcData, SrcSize, ppDstData, pDstSize, flags);
|
||||
break;
|
||||
|
||||
case PACKET_COMPR_TYPE_RDP8:
|
||||
status = -1;
|
||||
break;
|
||||
|
@ -632,9 +632,11 @@ BOOL certificate_read_server_certificate(rdpCertificate *certificate, BYTE *serv
|
||||
case CERT_CHAIN_VERSION_1:
|
||||
ret = certificate_read_server_proprietary_certificate(certificate, s);
|
||||
break;
|
||||
|
||||
case CERT_CHAIN_VERSION_2:
|
||||
ret = certificate_read_server_x509_certificate_chain(certificate, s);
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_WARN("invalid certificate chain version:%d\n", dwVersion & CERT_CHAIN_VERSION_MASK);
|
||||
ret = FALSE;
|
||||
@ -680,9 +682,11 @@ rdpRsaKey *key_new(const char *keyfile)
|
||||
case 0:
|
||||
DEBUG_WARN("%s: invalid RSA key in %s\n", __FUNCTION__, keyfile);
|
||||
goto out_free_rsa;
|
||||
|
||||
case 1:
|
||||
/* Valid key. */
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_WARN("%s: unexpected error when checking RSA key from %s: %s.", __FUNCTION__, keyfile, strerror(errno));
|
||||
ERR_print_errors_fp(stderr);
|
||||
|
@ -128,7 +128,6 @@ int rpc_client_on_fragment_received_event(rdpRpc *rpc)
|
||||
switch (header->common.ptype)
|
||||
{
|
||||
case PTYPE_RTS:
|
||||
|
||||
if (rpc->VirtualConnection->State < VIRTUAL_CONNECTION_STATE_OPENED)
|
||||
{
|
||||
DEBUG_WARN("%s: warning: unhandled RTS PDU\n", __FUNCTION__);
|
||||
@ -139,12 +138,15 @@ int rpc_client_on_fragment_received_event(rdpRpc *rpc)
|
||||
rts_recv_out_of_sequence_pdu(rpc, buffer, header->common.frag_length);
|
||||
rpc_client_fragment_pool_return(rpc, fragment);
|
||||
return 0;
|
||||
|
||||
case PTYPE_FAULT:
|
||||
rpc_recv_fault_pdu(header);
|
||||
Queue_Enqueue(rpc->client->ReceiveQueue, NULL);
|
||||
return -1;
|
||||
|
||||
case PTYPE_RESPONSE:
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG_WARN("%s: unexpected RPC PDU type %d\n", __FUNCTION__, header->common.ptype);
|
||||
Queue_Enqueue(rpc->client->ReceiveQueue, NULL);
|
||||
|
@ -360,12 +360,15 @@ ConversionResult ConvertUTF16toUTF8(
|
||||
case 4:
|
||||
*--target = (BYTE)((ch | byteMark) & byteMask);
|
||||
ch >>= 6;
|
||||
|
||||
case 3:
|
||||
*--target = (BYTE)((ch | byteMark) & byteMask);
|
||||
ch >>= 6;
|
||||
|
||||
case 2:
|
||||
*--target = (BYTE)((ch | byteMark) & byteMask);
|
||||
ch >>= 6;
|
||||
|
||||
case 1:
|
||||
*--target = (BYTE)(ch | firstByteMark[bytesToWrite]);
|
||||
}
|
||||
@ -378,12 +381,15 @@ ConversionResult ConvertUTF16toUTF8(
|
||||
case 4:
|
||||
--target;
|
||||
ch >>= 6;
|
||||
|
||||
case 3:
|
||||
--target;
|
||||
ch >>= 6;
|
||||
|
||||
case 2:
|
||||
--target;
|
||||
ch >>= 6;
|
||||
|
||||
case 1:
|
||||
--target;
|
||||
}
|
||||
@ -419,49 +425,45 @@ static BOOL isLegalUTF8(const BYTE *source, int length)
|
||||
{
|
||||
default:
|
||||
return FALSE;
|
||||
|
||||
/* Everything else falls through when "TRUE"... */
|
||||
case 4:
|
||||
|
||||
if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return FALSE;
|
||||
|
||||
case 3:
|
||||
|
||||
if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return FALSE;
|
||||
|
||||
case 2:
|
||||
|
||||
if ((a = (*--srcptr)) > 0xBF) return FALSE;
|
||||
|
||||
switch (*source)
|
||||
{
|
||||
/* no fall-through in this inner switch */
|
||||
case 0xE0:
|
||||
|
||||
if (a < 0xA0) return FALSE;
|
||||
|
||||
break;
|
||||
case 0xED:
|
||||
|
||||
case 0xED:
|
||||
if (a > 0x9F) return FALSE;
|
||||
|
||||
break;
|
||||
case 0xF0:
|
||||
|
||||
case 0xF0:
|
||||
if (a < 0x90) return FALSE;
|
||||
|
||||
break;
|
||||
case 0xF4:
|
||||
|
||||
case 0xF4:
|
||||
if (a > 0x8F) return FALSE;
|
||||
|
||||
break;
|
||||
default:
|
||||
|
||||
default:
|
||||
if (a < 0x80) return FALSE;
|
||||
}
|
||||
|
||||
case 1:
|
||||
|
||||
if (*source >= 0x80 && *source < 0xC2) return FALSE;
|
||||
}
|
||||
|
||||
@ -528,18 +530,23 @@ ConversionResult ConvertUTF8toUTF16(
|
||||
case 5:
|
||||
ch += *source++;
|
||||
ch <<= 6; /* remember, illegal UTF-8 */
|
||||
|
||||
case 4:
|
||||
ch += *source++;
|
||||
ch <<= 6; /* remember, illegal UTF-8 */
|
||||
|
||||
case 3:
|
||||
ch += *source++;
|
||||
ch <<= 6;
|
||||
|
||||
case 2:
|
||||
ch += *source++;
|
||||
ch <<= 6;
|
||||
|
||||
case 1:
|
||||
ch += *source++;
|
||||
ch <<= 6;
|
||||
|
||||
case 0:
|
||||
ch += *source++;
|
||||
}
|
||||
@ -698,12 +705,15 @@ ConversionResult ConvertUTF32toUTF8(
|
||||
case 4:
|
||||
*--target = (BYTE)((ch | byteMark) & byteMask);
|
||||
ch >>= 6;
|
||||
|
||||
case 3:
|
||||
*--target = (BYTE)((ch | byteMark) & byteMask);
|
||||
ch >>= 6;
|
||||
|
||||
case 2:
|
||||
*--target = (BYTE)((ch | byteMark) & byteMask);
|
||||
ch >>= 6;
|
||||
|
||||
case 1:
|
||||
*--target = (BYTE)(ch | firstByteMark[bytesToWrite]);
|
||||
}
|
||||
@ -752,18 +762,23 @@ ConversionResult ConvertUTF8toUTF32(
|
||||
case 5:
|
||||
ch += *source++;
|
||||
ch <<= 6;
|
||||
|
||||
case 4:
|
||||
ch += *source++;
|
||||
ch <<= 6;
|
||||
|
||||
case 3:
|
||||
ch += *source++;
|
||||
ch <<= 6;
|
||||
|
||||
case 2:
|
||||
ch += *source++;
|
||||
ch <<= 6;
|
||||
|
||||
case 1:
|
||||
ch += *source++;
|
||||
ch <<= 6;
|
||||
|
||||
case 0:
|
||||
ch += *source++;
|
||||
}
|
||||
|
@ -104,7 +104,6 @@ void Pcap_Add_Record(wPcap* pcap, void* data, UINT32 length)
|
||||
{
|
||||
pcap->tail = (wPcapRecord*) malloc(sizeof(wPcapRecord));
|
||||
ZeroMemory(pcap->tail, sizeof(wPcapRecord));
|
||||
|
||||
pcap->head = pcap->tail;
|
||||
pcap->record = pcap->head;
|
||||
record = pcap->tail;
|
||||
@ -113,7 +112,6 @@ void Pcap_Add_Record(wPcap* pcap, void* data, UINT32 length)
|
||||
{
|
||||
record = (wPcapRecord*) malloc(sizeof(wPcapRecord));
|
||||
ZeroMemory(record, sizeof(wPcapRecord));
|
||||
|
||||
pcap->tail->next = record;
|
||||
pcap->tail = record;
|
||||
}
|
||||
@ -125,7 +123,6 @@ void Pcap_Add_Record(wPcap* pcap, void* data, UINT32 length)
|
||||
record->length = length;
|
||||
record->header.incl_len = length;
|
||||
record->header.orig_len = length;
|
||||
|
||||
gettimeofday(&tp, 0);
|
||||
record->header.ts_sec = tp.tv_sec;
|
||||
record->header.ts_usec = tp.tv_usec;
|
||||
@ -146,7 +143,6 @@ BOOL Pcap_GetNext_RecordHeader(wPcap* pcap, wPcapRecord* record)
|
||||
|
||||
Pcap_Read_RecordHeader(pcap, &record->header);
|
||||
record->length = record->header.incl_len;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -157,6 +153,7 @@ BOOL Pcap_GetNext_RecordContent(wPcap* pcap, wPcapRecord* record)
|
||||
fread(record->data, record->length, 1, pcap->fp);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -166,14 +163,12 @@ BOOL Pcap_GetNext_Record(wPcap* pcap, wPcapRecord* record)
|
||||
return FALSE;
|
||||
|
||||
Pcap_Read_Record(pcap, record);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wPcap* Pcap_Open(char* name, BOOL write)
|
||||
{
|
||||
wPcap* pcap;
|
||||
|
||||
FILE* pcap_fp = fopen(name, write ? "w+b" : "rb");
|
||||
|
||||
if (!pcap_fp)
|
||||
@ -187,7 +182,6 @@ wPcap* Pcap_Open(char* name, BOOL write)
|
||||
if (pcap)
|
||||
{
|
||||
ZeroMemory(pcap, sizeof(wPcap));
|
||||
|
||||
pcap->name = name;
|
||||
pcap->write = write;
|
||||
pcap->record_count = 0;
|
||||
@ -236,9 +230,7 @@ void Pcap_Close(wPcap* pcap)
|
||||
return;
|
||||
|
||||
Pcap_Flush(pcap);
|
||||
|
||||
fclose(pcap->fp);
|
||||
|
||||
free(pcap);
|
||||
}
|
||||
|
||||
@ -251,15 +243,11 @@ int WLog_PacketMessage_Write_EthernetHeader(wPcap* pcap, wEthernetHeader* ethern
|
||||
return -1;
|
||||
|
||||
s = Stream_New(buffer, 14);
|
||||
|
||||
Stream_Write(s, ethernet->Destination, 6);
|
||||
Stream_Write(s, ethernet->Source, 6);
|
||||
Stream_Write_UINT16_BE(s, ethernet->Type);
|
||||
|
||||
fwrite(buffer, 14, 1, pcap->fp);
|
||||
|
||||
Stream_Free(s, FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -294,7 +282,6 @@ int WLog_PacketMessage_Write_IPv4Header(wPcap* pcap, wIPv4Header* ipv4)
|
||||
return -1;
|
||||
|
||||
s = Stream_New(buffer, 20);
|
||||
|
||||
Stream_Write_UINT8(s, (ipv4->Version << 4) | ipv4->InternetHeaderLength);
|
||||
Stream_Write_UINT8(s, ipv4->TypeOfService);
|
||||
Stream_Write_UINT16_BE(s, ipv4->TotalLength);
|
||||
@ -305,16 +292,12 @@ int WLog_PacketMessage_Write_IPv4Header(wPcap* pcap, wIPv4Header* ipv4)
|
||||
Stream_Write_UINT16(s, ipv4->HeaderChecksum);
|
||||
Stream_Write_UINT32_BE(s, ipv4->SourceAddress);
|
||||
Stream_Write_UINT32_BE(s, ipv4->DestinationAddress);
|
||||
|
||||
ipv4->HeaderChecksum = IPv4Checksum((BYTE*) buffer, 20);
|
||||
Stream_Rewind(s, 10);
|
||||
Stream_Write_UINT16(s, ipv4->HeaderChecksum);
|
||||
Stream_Seek(s, 8);
|
||||
|
||||
fwrite(buffer, 20, 1, pcap->fp);
|
||||
|
||||
Stream_Free(s, FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -327,7 +310,6 @@ int WLog_PacketMessage_Write_TcpHeader(wPcap* pcap, wTcpHeader* tcp)
|
||||
return -1;
|
||||
|
||||
s = Stream_New(buffer, 20);
|
||||
|
||||
Stream_Write_UINT16_BE(s, tcp->SourcePort);
|
||||
Stream_Write_UINT16_BE(s, tcp->DestinationPort);
|
||||
Stream_Write_UINT32_BE(s, tcp->SequenceNumber);
|
||||
@ -342,7 +324,6 @@ int WLog_PacketMessage_Write_TcpHeader(wPcap* pcap, wTcpHeader* tcp)
|
||||
fwrite(buffer, 20, 1, pcap->fp);
|
||||
|
||||
Stream_Free(s, FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -356,7 +337,6 @@ int WLog_PacketMessage_Write(wPcap* pcap, void* data, DWORD length, DWORD flags)
|
||||
struct timeval tp;
|
||||
wPcapRecord record;
|
||||
wEthernetHeader ethernet;
|
||||
|
||||
ethernet.Type = 0x0800;
|
||||
|
||||
if (!pcap || !pcap->fp)
|
||||
@ -371,7 +351,6 @@ int WLog_PacketMessage_Write(wPcap* pcap, void* data, DWORD length, DWORD flags)
|
||||
ethernet.Source[3] = 0x01;
|
||||
ethernet.Source[4] = 0x64;
|
||||
ethernet.Source[5] = 0x04;
|
||||
|
||||
/* 00:15:5D:01:64:01 */
|
||||
ethernet.Destination[0] = 0x00;
|
||||
ethernet.Destination[1] = 0x15;
|
||||
@ -389,7 +368,6 @@ int WLog_PacketMessage_Write(wPcap* pcap, void* data, DWORD length, DWORD flags)
|
||||
ethernet.Source[3] = 0x01;
|
||||
ethernet.Source[4] = 0x64;
|
||||
ethernet.Source[5] = 0x01;
|
||||
|
||||
/* 00:15:5D:01:64:04 */
|
||||
ethernet.Destination[0] = 0x00;
|
||||
ethernet.Destination[1] = 0x15;
|
||||
@ -443,23 +421,19 @@ int WLog_PacketMessage_Write(wPcap* pcap, void* data, DWORD length, DWORD flags)
|
||||
tcp.Window = 0x7FFF;
|
||||
tcp.Checksum = 0;
|
||||
tcp.UrgentPointer = 0;
|
||||
|
||||
record.data = data;
|
||||
record.length = length;
|
||||
record.header.incl_len = record.length + 14 + 20 + 20;
|
||||
record.header.orig_len = record.length + 14 + 20 + 20;
|
||||
record.next = NULL;
|
||||
|
||||
gettimeofday(&tp, 0);
|
||||
record.header.ts_sec = tp.tv_sec;
|
||||
record.header.ts_usec = tp.tv_usec;
|
||||
|
||||
Pcap_Write_RecordHeader(pcap, &record.header);
|
||||
WLog_PacketMessage_Write_EthernetHeader(pcap, ðernet);
|
||||
WLog_PacketMessage_Write_IPv4Header(pcap, &ipv4);
|
||||
WLog_PacketMessage_Write_TcpHeader(pcap, &tcp);
|
||||
Pcap_Write_RecordContent(pcap, &record);
|
||||
fflush(pcap->fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -68,22 +68,26 @@ static void log_recursion(const char *file, const char *fkt, int line)
|
||||
size_t used, i;
|
||||
void* bt = winpr_backtrace(20);
|
||||
char** msg = winpr_backtrace_symbols(bt, &used);
|
||||
|
||||
#if defined(ANDROID)
|
||||
const char* tag = WINPR_TAG("utils.wlog");
|
||||
__android_log_print(ANDROID_LOG_FATAL, tag, "Recursion detected!!!");
|
||||
__android_log_print(ANDROID_LOG_FATAL, tag, "Check %s [%s:%d]", fkt, file, line);
|
||||
|
||||
for (i=0; i<used; i++)
|
||||
__android_log_print(ANDROID_LOG_FATAL, tag, "%d: %s", msg[i]);
|
||||
|
||||
#else
|
||||
fprintf(stderr, "[%s]: Recursion detected!\n", fkt);
|
||||
fprintf(stderr, "[%s]: Check %s:%d\n", fkt, file, line);
|
||||
|
||||
for (i=0; i<used; i++)
|
||||
fprintf(stderr, "%s: %zd: %s\n", fkt, i, msg[i]);
|
||||
|
||||
#endif
|
||||
|
||||
if (msg)
|
||||
free(msg);
|
||||
|
||||
winpr_backtrace_free(bt);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user