*/
UINT DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
{
- char* name;
- char* path;
size_t length;
- int ck;
RDPDR_SMARTCARD* device;
SMARTCARD_DEVICE* smartcard;
LONG status;
UINT error = CHANNEL_RC_NO_MEMORY;
device = (RDPDR_SMARTCARD*) pEntryPoints->device;
- name = device->Name;
- path = device->Path;
smartcard = (SMARTCARD_DEVICE*) calloc(1, sizeof(SMARTCARD_DEVICE));
if (!smartcard)
}
Stream_Write(smartcard->device.data, "SCARD", 6);
- smartcard->name = NULL;
- smartcard->path = NULL;
- if (path)
- {
- smartcard->path = path;
- smartcard->name = name;
- }
- else if (name)
- {
- if (1 == sscanf(name, "%d", &ck))
- smartcard->path = name;
- else
- smartcard->name = name;
- }
-
- status = SCardAddReaderName(&smartcard->thread, (LPSTR) name);
+ status = SCardAddReaderName(&smartcard->thread, (LPSTR) device->Name);
if (status != SCARD_S_SUCCESS)
{
{
DEVICE device;
- char* name;
- char* path;
-
HANDLE thread;
HANDLE StartedEvent;
wMessageQueue* IrpQueue;
CopyMemory(mszA, ret->msz, ret->cBytes);
}
- for (index = 0; index < length - 2; index++)
+ for (index = 0; index < length - 1; index++)
{
if (mszA[index] == '\0')
mszA[index] = ',';
settings->RedirectSmartCards = TRUE;
settings->DeviceRedirection = TRUE;
- if (count > 1)
- {
- smartcard = (RDPDR_SMARTCARD*) calloc(1, sizeof(RDPDR_SMARTCARD));
-
- if (!smartcard)
- return FALSE;
-
- smartcard->Type = RDPDR_DTYP_SMARTCARD;
+ smartcard = (RDPDR_SMARTCARD*) calloc(1, sizeof(RDPDR_SMARTCARD));
- if (count > 1)
- {
- if (!(smartcard->Name = _strdup(params[1])))
- {
- free(smartcard);
- return FALSE;
- }
- }
+ if (!smartcard)
+ return FALSE;
- if (count > 2)
- {
- if (!(smartcard->Path = _strdup(params[2])))
- {
- free(smartcard->Name);
- free(smartcard);
- return FALSE;
- }
- }
+ smartcard->Type = RDPDR_DTYP_SMARTCARD;
- if (!freerdp_device_collection_add(settings, (RDPDR_DEVICE*) smartcard))
+ if (count > 1 && strlen(params[1]))
+ {
+ if (!(smartcard->Name = _strdup(params[1])))
{
- free(smartcard->Path);
- free(smartcard->Name);
free(smartcard);
return FALSE;
}
}
+ if (!freerdp_device_collection_add(settings, (RDPDR_DEVICE*) smartcard))
+ {
+ free(smartcard->Name);
+ free(smartcard);
+ return FALSE;
+ }
+
return TRUE;
}
else if (strcmp(params[0], "serial") == 0)
UINT32 Id;
UINT32 Type;
char* Name;
- char* Path;
};
typedef struct _RDPDR_SMARTCARD RDPDR_SMARTCARD;
goto out_smartc_name_error;
}
- if (smartcard->Path)
- {
- _smartcard->Path = _strdup(smartcard->Path);
- if (!_smartcard->Path)
- goto out_smartc_path_error;
- }
-
return (RDPDR_DEVICE*) _smartcard;
out_smartc_path_error:
}
else if (settings->DeviceArray[index]->Type == RDPDR_DTYP_SMARTCARD)
{
- free(((RDPDR_SMARTCARD*) device)->Path);
+
}
else if (settings->DeviceArray[index]->Type == RDPDR_DTYP_SERIAL)
{