libfreerdp-utils: remove deprecated calls to xnew() macro
This commit is contained in:
parent
b2c3ca8cc4
commit
2a16183f5d
@ -380,7 +380,8 @@ static int audin_on_new_channel_connection(IWTSListenerCallback* pListenerCallba
|
|||||||
|
|
||||||
DEBUG_DVC("");
|
DEBUG_DVC("");
|
||||||
|
|
||||||
callback = xnew(AUDIN_CHANNEL_CALLBACK);
|
callback = (AUDIN_CHANNEL_CALLBACK*) malloc(sizeof(AUDIN_CHANNEL_CALLBACK));
|
||||||
|
ZeroMemory(callback, sizeof(AUDIN_CHANNEL_CALLBACK));
|
||||||
|
|
||||||
callback->iface.OnDataReceived = audin_on_data_received;
|
callback->iface.OnDataReceived = audin_on_data_received;
|
||||||
callback->iface.OnClose = audin_on_close;
|
callback->iface.OnClose = audin_on_close;
|
||||||
@ -399,7 +400,8 @@ static int audin_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManage
|
|||||||
|
|
||||||
DEBUG_DVC("");
|
DEBUG_DVC("");
|
||||||
|
|
||||||
audin->listener_callback = xnew(AUDIN_LISTENER_CALLBACK);
|
audin->listener_callback = (AUDIN_LISTENER_CALLBACK*) malloc(sizeof(AUDIN_LISTENER_CALLBACK));
|
||||||
|
ZeroMemory(audin->listener_callback, sizeof(AUDIN_LISTENER_CALLBACK));
|
||||||
|
|
||||||
audin->listener_callback->iface.OnNewChannelConnection = audin_on_new_channel_connection;
|
audin->listener_callback->iface.OnNewChannelConnection = audin_on_new_channel_connection;
|
||||||
audin->listener_callback->plugin = pPlugin;
|
audin->listener_callback->plugin = pPlugin;
|
||||||
|
@ -930,7 +930,8 @@ rdpChannels* freerdp_channels_new(void)
|
|||||||
rdpChannels* channels;
|
rdpChannels* channels;
|
||||||
rdpChannelsList* channels_list;
|
rdpChannelsList* channels_list;
|
||||||
|
|
||||||
channels = xnew(rdpChannels);
|
channels = (rdpChannels*) malloc(sizeof(rdpChannels));
|
||||||
|
ZeroMemory(channels, sizeof(rdpChannels));
|
||||||
|
|
||||||
channels->pSyncDataList = (PSLIST_HEADER) _aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT);
|
channels->pSyncDataList = (PSLIST_HEADER) _aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT);
|
||||||
InitializeSListHead(channels->pSyncDataList);
|
InitializeSListHead(channels->pSyncDataList);
|
||||||
@ -939,7 +940,8 @@ rdpChannels* freerdp_channels_new(void)
|
|||||||
channels->signal = wait_obj_new();
|
channels->signal = wait_obj_new();
|
||||||
|
|
||||||
/* Add it to the global list */
|
/* Add it to the global list */
|
||||||
channels_list = xnew(rdpChannelsList);
|
channels_list = (rdpChannelsList*) malloc(sizeof(rdpChannelsList));
|
||||||
|
ZeroMemory(channels_list, sizeof(rdpChannelsList));
|
||||||
channels_list->channels = channels;
|
channels_list->channels = channels;
|
||||||
|
|
||||||
WaitForSingleObject(g_mutex_list, INFINITE);
|
WaitForSingleObject(g_mutex_list, INFINITE);
|
||||||
|
@ -102,13 +102,16 @@ static int dvcman_create_listener(IWTSVirtualChannelManager* pChannelMgr,
|
|||||||
const char* pszChannelName, UINT32 ulFlags,
|
const char* pszChannelName, UINT32 ulFlags,
|
||||||
IWTSListenerCallback* pListenerCallback, IWTSListener** ppListener)
|
IWTSListenerCallback* pListenerCallback, IWTSListener** ppListener)
|
||||||
{
|
{
|
||||||
DVCMAN* dvcman = (DVCMAN*)pChannelMgr;
|
DVCMAN* dvcman = (DVCMAN*) pChannelMgr;
|
||||||
DVCMAN_LISTENER* listener;
|
DVCMAN_LISTENER* listener;
|
||||||
|
|
||||||
if (dvcman->num_listeners < MAX_PLUGINS)
|
if (dvcman->num_listeners < MAX_PLUGINS)
|
||||||
{
|
{
|
||||||
DEBUG_DVC("%d.%s.", dvcman->num_listeners, pszChannelName);
|
DEBUG_DVC("%d.%s.", dvcman->num_listeners, pszChannelName);
|
||||||
listener = xnew(DVCMAN_LISTENER);
|
|
||||||
|
listener = (DVCMAN_LISTENER*) malloc(sizeof(DVCMAN_LISTENER));
|
||||||
|
ZeroMemory(listener, sizeof(DVCMAN_LISTENER));
|
||||||
|
|
||||||
listener->iface.GetConfiguration = dvcman_get_configuration;
|
listener->iface.GetConfiguration = dvcman_get_configuration;
|
||||||
listener->dvcman = dvcman;
|
listener->dvcman = dvcman;
|
||||||
listener->channel_name = _strdup(pszChannelName);
|
listener->channel_name = _strdup(pszChannelName);
|
||||||
@ -213,7 +216,9 @@ IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
|
|||||||
{
|
{
|
||||||
DVCMAN* dvcman;
|
DVCMAN* dvcman;
|
||||||
|
|
||||||
dvcman = xnew(DVCMAN);
|
dvcman = (DVCMAN*) malloc(sizeof(DVCMAN));
|
||||||
|
ZeroMemory(dvcman, sizeof(DVCMAN));
|
||||||
|
|
||||||
dvcman->iface.CreateListener = dvcman_create_listener;
|
dvcman->iface.CreateListener = dvcman_create_listener;
|
||||||
dvcman->iface.PushEvent = dvcman_push_event;
|
dvcman->iface.PushEvent = dvcman_push_event;
|
||||||
dvcman->iface.FindChannelById = dvcman_find_channel_by_id;
|
dvcman->iface.FindChannelById = dvcman_find_channel_by_id;
|
||||||
@ -345,7 +350,9 @@ int dvcman_create_channel(IWTSVirtualChannelManager* pChannelMgr, UINT32 Channel
|
|||||||
|
|
||||||
if (strcmp(listener->channel_name, ChannelName) == 0)
|
if (strcmp(listener->channel_name, ChannelName) == 0)
|
||||||
{
|
{
|
||||||
channel = xnew(DVCMAN_CHANNEL);
|
channel = (DVCMAN_CHANNEL*) malloc(sizeof(DVCMAN_CHANNEL));
|
||||||
|
ZeroMemory(channel, sizeof(DVCMAN_CHANNEL));
|
||||||
|
|
||||||
channel->iface.Write = dvcman_write_channel;
|
channel->iface.Write = dvcman_write_channel;
|
||||||
channel->iface.Close = dvcman_close_channel_iface;
|
channel->iface.Close = dvcman_close_channel_iface;
|
||||||
channel->dvcman = dvcman;
|
channel->dvcman = dvcman;
|
||||||
|
@ -291,7 +291,9 @@ DRIVE_FILE* drive_file_new(const char* base_path, const char* path, UINT32 id,
|
|||||||
{
|
{
|
||||||
DRIVE_FILE* file;
|
DRIVE_FILE* file;
|
||||||
|
|
||||||
file = xnew(DRIVE_FILE);
|
file = (DRIVE_FILE*) malloc(sizeof(DRIVE_FILE));
|
||||||
|
ZeroMemory(file, sizeof(DRIVE_FILE));
|
||||||
|
|
||||||
file->id = id;
|
file->id = id;
|
||||||
file->basepath = (char*) base_path;
|
file->basepath = (char*) base_path;
|
||||||
drive_file_set_fullpath(file, drive_file_combine_fullpath(base_path, path));
|
drive_file_set_fullpath(file, drive_file_combine_fullpath(base_path, path));
|
||||||
|
@ -325,7 +325,8 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
|||||||
|
|
||||||
if (name[0] && path[0])
|
if (name[0] && path[0])
|
||||||
{
|
{
|
||||||
parallel = xnew(PARALLEL_DEVICE);
|
parallel = (PARALLEL_DEVICE*) malloc(sizeof(PARALLEL_DEVICE));
|
||||||
|
ZeroMemory(parallel, sizeof(PARALLEL_DEVICE));
|
||||||
|
|
||||||
parallel->device.type = RDPDR_DTYP_PARALLEL;
|
parallel->device.type = RDPDR_DTYP_PARALLEL;
|
||||||
parallel->device.name = name;
|
parallel->device.name = name;
|
||||||
|
@ -79,36 +79,39 @@ static void printer_cups_get_printjob_name(char* buf, int size)
|
|||||||
|
|
||||||
static void printer_cups_write_printjob(rdpPrintJob* printjob, BYTE* data, int size)
|
static void printer_cups_write_printjob(rdpPrintJob* printjob, BYTE* data, int size)
|
||||||
{
|
{
|
||||||
rdpCupsPrintJob* cups_printjob = (rdpCupsPrintJob*)printjob;
|
rdpCupsPrintJob* cups_printjob = (rdpCupsPrintJob*) printjob;
|
||||||
|
|
||||||
#ifndef _CUPS_API_1_4
|
#ifndef _CUPS_API_1_4
|
||||||
|
|
||||||
{
|
{
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
|
|
||||||
fp = fopen((const char*)cups_printjob->printjob_object, "a+b");
|
fp = fopen((const char*) cups_printjob->printjob_object, "a+b");
|
||||||
|
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
{
|
{
|
||||||
DEBUG_WARN("failed to open file %s", (char*)cups_printjob->printjob_object);
|
DEBUG_WARN("failed to open file %s", (char*) cups_printjob->printjob_object);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fwrite(data, 1, size, fp) < size)
|
if (fwrite(data, 1, size, fp) < size)
|
||||||
{
|
{
|
||||||
DEBUG_WARN("failed to write file %s", (char*)cups_printjob->printjob_object);
|
DEBUG_WARN("failed to write file %s", (char*) cups_printjob->printjob_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
cupsWriteRequestData((http_t*)cups_printjob->printjob_object, (const char*)data, size);
|
cupsWriteRequestData((http_t*) cups_printjob->printjob_object, (const char*) data, size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void printer_cups_close_printjob(rdpPrintJob* printjob)
|
static void printer_cups_close_printjob(rdpPrintJob* printjob)
|
||||||
{
|
{
|
||||||
rdpCupsPrintJob* cups_printjob = (rdpCupsPrintJob*)printjob;
|
rdpCupsPrintJob* cups_printjob = (rdpCupsPrintJob*) printjob;
|
||||||
|
|
||||||
#ifndef _CUPS_API_1_4
|
#ifndef _CUPS_API_1_4
|
||||||
|
|
||||||
@ -116,35 +119,38 @@ static void printer_cups_close_printjob(rdpPrintJob* printjob)
|
|||||||
char buf[100];
|
char buf[100];
|
||||||
|
|
||||||
printer_cups_get_printjob_name(buf, sizeof(buf));
|
printer_cups_get_printjob_name(buf, sizeof(buf));
|
||||||
if (cupsPrintFile(printjob->printer->name, (const char *)cups_printjob->printjob_object, buf, 0, NULL) == 0)
|
|
||||||
|
if (cupsPrintFile(printjob->printer->name, (const char*) cups_printjob->printjob_object, buf, 0, NULL) == 0)
|
||||||
{
|
{
|
||||||
DEBUG_WARN("cupsPrintFile: %s", cupsLastErrorString());
|
DEBUG_WARN("cupsPrintFile: %s", cupsLastErrorString());
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink(cups_printjob->printjob_object);
|
unlink(cups_printjob->printjob_object);
|
||||||
free(cups_printjob->printjob_object);
|
free(cups_printjob->printjob_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
cupsFinishDocument((http_t*)cups_printjob->printjob_object, printjob->printer->name);
|
cupsFinishDocument((http_t*) cups_printjob->printjob_object, printjob->printer->name);
|
||||||
cups_printjob->printjob_id = 0;
|
cups_printjob->printjob_id = 0;
|
||||||
httpClose((http_t*)cups_printjob->printjob_object);
|
httpClose((http_t*) cups_printjob->printjob_object);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
((rdpCupsPrinter*)printjob->printer)->printjob = NULL;
|
((rdpCupsPrinter*) printjob->printer)->printjob = NULL;
|
||||||
free(cups_printjob) ;
|
free(cups_printjob) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, UINT32 id)
|
static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, UINT32 id)
|
||||||
{
|
{
|
||||||
rdpCupsPrinter* cups_printer = (rdpCupsPrinter*)printer;
|
rdpCupsPrinter* cups_printer = (rdpCupsPrinter*) printer;
|
||||||
rdpCupsPrintJob* cups_printjob;
|
rdpCupsPrintJob* cups_printjob;
|
||||||
|
|
||||||
if (cups_printer->printjob != NULL)
|
if (cups_printer->printjob != NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
cups_printjob = xnew(rdpCupsPrintJob);
|
cups_printjob = (rdpCupsPrintJob*) malloc(sizeof(rdpCupsPrintJob));
|
||||||
|
ZeroMemory(cups_printjob, sizeof(rdpCupsPrintJob));
|
||||||
|
|
||||||
cups_printjob->printjob.id = id;
|
cups_printjob->printjob.id = id;
|
||||||
cups_printjob->printjob.printer = printer;
|
cups_printjob->printjob.printer = printer;
|
||||||
@ -161,6 +167,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, UINT32 id)
|
|||||||
char buf[100];
|
char buf[100];
|
||||||
|
|
||||||
cups_printjob->printjob_object = httpConnectEncrypt(cupsServer(), ippPort(), HTTP_ENCRYPT_IF_REQUESTED);
|
cups_printjob->printjob_object = httpConnectEncrypt(cupsServer(), ippPort(), HTTP_ENCRYPT_IF_REQUESTED);
|
||||||
|
|
||||||
if (cups_printjob->printjob_object == NULL)
|
if (cups_printjob->printjob_object == NULL)
|
||||||
{
|
{
|
||||||
DEBUG_WARN("httpConnectEncrypt: %s", cupsLastErrorString());
|
DEBUG_WARN("httpConnectEncrypt: %s", cupsLastErrorString());
|
||||||
@ -169,19 +176,19 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, UINT32 id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
printer_cups_get_printjob_name(buf, sizeof(buf));
|
printer_cups_get_printjob_name(buf, sizeof(buf));
|
||||||
cups_printjob->printjob_id = cupsCreateJob((http_t*)cups_printjob->printjob_object,
|
cups_printjob->printjob_id = cupsCreateJob((http_t*) cups_printjob->printjob_object,
|
||||||
printer->name, buf, 0, NULL);
|
printer->name, buf, 0, NULL);
|
||||||
|
|
||||||
if (cups_printjob->printjob_id == 0)
|
if (cups_printjob->printjob_id == 0)
|
||||||
{
|
{
|
||||||
DEBUG_WARN("cupsCreateJob: %s", cupsLastErrorString());
|
DEBUG_WARN("cupsCreateJob: %s", cupsLastErrorString());
|
||||||
httpClose((http_t*)cups_printjob->printjob_object);
|
httpClose((http_t*) cups_printjob->printjob_object);
|
||||||
free(cups_printjob);
|
free(cups_printjob);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
cupsStartDocument((http_t*)cups_printjob->printjob_object,
|
|
||||||
printer->name, cups_printjob->printjob_id, buf,
|
cupsStartDocument((http_t*) cups_printjob->printjob_object,
|
||||||
CUPS_FORMAT_AUTO, 1);
|
printer->name, cups_printjob->printjob_id, buf, CUPS_FORMAT_AUTO, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -205,10 +212,11 @@ static rdpPrintJob* printer_cups_find_printjob(rdpPrinter* printer, UINT32 id)
|
|||||||
|
|
||||||
static void printer_cups_free_printer(rdpPrinter* printer)
|
static void printer_cups_free_printer(rdpPrinter* printer)
|
||||||
{
|
{
|
||||||
rdpCupsPrinter* cups_printer = (rdpCupsPrinter*)printer;
|
rdpCupsPrinter* cups_printer = (rdpCupsPrinter*) printer;
|
||||||
|
|
||||||
if (cups_printer->printjob)
|
if (cups_printer->printjob)
|
||||||
cups_printer->printjob->printjob.Close((rdpPrintJob*)cups_printer->printjob);
|
cups_printer->printjob->printjob.Close((rdpPrintJob*) cups_printer->printjob);
|
||||||
|
|
||||||
free(printer->name);
|
free(printer->name);
|
||||||
free(printer);
|
free(printer);
|
||||||
}
|
}
|
||||||
@ -217,7 +225,8 @@ static rdpPrinter* printer_cups_new_printer(rdpCupsPrinterDriver* cups_driver, c
|
|||||||
{
|
{
|
||||||
rdpCupsPrinter* cups_printer;
|
rdpCupsPrinter* cups_printer;
|
||||||
|
|
||||||
cups_printer = xnew(rdpCupsPrinter);
|
cups_printer = (rdpCupsPrinter*) malloc(sizeof(rdpCupsPrinter));
|
||||||
|
ZeroMemory(cups_printer, sizeof(rdpCupsPrinter));
|
||||||
|
|
||||||
cups_printer->printer.id = cups_driver->id_sequence++;
|
cups_printer->printer.id = cups_driver->id_sequence++;
|
||||||
cups_printer->printer.name = _strdup(name);
|
cups_printer->printer.name = _strdup(name);
|
||||||
@ -229,7 +238,7 @@ static rdpPrinter* printer_cups_new_printer(rdpCupsPrinterDriver* cups_driver, c
|
|||||||
cups_printer->printer.FindPrintJob = printer_cups_find_printjob;
|
cups_printer->printer.FindPrintJob = printer_cups_find_printjob;
|
||||||
cups_printer->printer.Free = printer_cups_free_printer;
|
cups_printer->printer.Free = printer_cups_free_printer;
|
||||||
|
|
||||||
return (rdpPrinter*)cups_printer;
|
return (rdpPrinter*) cups_printer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static rdpPrinter** printer_cups_enum_printers(rdpPrinterDriver* driver)
|
static rdpPrinter** printer_cups_enum_printers(rdpPrinterDriver* driver)
|
||||||
@ -262,7 +271,7 @@ static rdpPrinter** printer_cups_enum_printers(rdpPrinterDriver* driver)
|
|||||||
|
|
||||||
static rdpPrinter* printer_cups_get_printer(rdpPrinterDriver* driver, const char* name)
|
static rdpPrinter* printer_cups_get_printer(rdpPrinterDriver* driver, const char* name)
|
||||||
{
|
{
|
||||||
rdpCupsPrinterDriver* cups_driver = (rdpCupsPrinterDriver*)driver;
|
rdpCupsPrinterDriver* cups_driver = (rdpCupsPrinterDriver*) driver;
|
||||||
|
|
||||||
return printer_cups_new_printer(cups_driver, name, cups_driver->id_sequence == 1 ? TRUE : FALSE);
|
return printer_cups_new_printer(cups_driver, name, cups_driver->id_sequence == 1 ? TRUE : FALSE);
|
||||||
}
|
}
|
||||||
@ -273,7 +282,8 @@ rdpPrinterDriver* printer_cups_get_driver(void)
|
|||||||
{
|
{
|
||||||
if (cups_driver == NULL)
|
if (cups_driver == NULL)
|
||||||
{
|
{
|
||||||
cups_driver = xnew(rdpCupsPrinterDriver);
|
cups_driver = (rdpCupsPrinterDriver*) malloc(sizeof(rdpCupsPrinterDriver));
|
||||||
|
ZeroMemory(cups_driver, sizeof(rdpCupsPrinterDriver));
|
||||||
|
|
||||||
cups_driver->driver.EnumPrinters = printer_cups_enum_printers;
|
cups_driver->driver.EnumPrinters = printer_cups_enum_printers;
|
||||||
cups_driver->driver.GetPrinter = printer_cups_get_printer;
|
cups_driver->driver.GetPrinter = printer_cups_get_printer;
|
||||||
@ -287,6 +297,6 @@ rdpPrinterDriver* printer_cups_get_driver(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return (rdpPrinterDriver*)cups_driver;
|
return (rdpPrinterDriver*) cups_driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,8 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri
|
|||||||
port = malloc(10);
|
port = malloc(10);
|
||||||
snprintf(port, 10, "PRN%d", printer->id);
|
snprintf(port, 10, "PRN%d", printer->id);
|
||||||
|
|
||||||
printer_dev = xnew(PRINTER_DEVICE);
|
printer_dev = (PRINTER_DEVICE*) malloc(sizeof(PRINTER_DEVICE));
|
||||||
|
ZeroMemory(printer_dev, sizeof(PRINTER_DEVICE));
|
||||||
|
|
||||||
printer_dev->device.type = RDPDR_DTYP_PRINT;
|
printer_dev->device.type = RDPDR_DTYP_PRINT;
|
||||||
printer_dev->device.name = port;
|
printer_dev->device.name = port;
|
||||||
|
@ -121,7 +121,8 @@ static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, UINT32 id)
|
|||||||
if (win_printer->printjob != NULL)
|
if (win_printer->printjob != NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
win_printjob = xnew(rdpWinPrintJob);
|
win_printjob = (rdpWinPrintJob*) malloc(sizeof(rdpWinPrintJob));
|
||||||
|
ZeroMemory(win_printjob, sizeof(rdpWinPrintJob));
|
||||||
|
|
||||||
win_printjob->printjob.id = id;
|
win_printjob->printjob.id = id;
|
||||||
win_printjob->printjob.printer = printer;
|
win_printjob->printjob.printer = printer;
|
||||||
@ -129,17 +130,17 @@ static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, UINT32 id)
|
|||||||
win_printjob->di.pDatatype= NULL;
|
win_printjob->di.pDatatype= NULL;
|
||||||
win_printjob->di.pOutputFile = NULL;
|
win_printjob->di.pOutputFile = NULL;
|
||||||
|
|
||||||
win_printjob->handle = StartDocPrinter(win_printer->hPrinter, 1, (LPBYTE)&(win_printjob->di) );
|
win_printjob->handle = StartDocPrinter(win_printer->hPrinter, 1, (LPBYTE) &(win_printjob->di));
|
||||||
if(! win_printjob->handle) DEBUG_WINPR("StartDocPrinter failed");
|
|
||||||
if ( ! StartPagePrinter(win_printer->hPrinter) )
|
|
||||||
DEBUG_WINPR("ClosePrinter failed");
|
|
||||||
|
|
||||||
|
if (!win_printjob->handle)
|
||||||
|
DEBUG_WINPR("StartDocPrinter failed");
|
||||||
|
|
||||||
|
if (!StartPagePrinter(win_printer->hPrinter))
|
||||||
|
DEBUG_WINPR("ClosePrinter failed");
|
||||||
|
|
||||||
win_printjob->printjob.Write = printer_win_write_printjob;
|
win_printjob->printjob.Write = printer_win_write_printjob;
|
||||||
win_printjob->printjob.Close = printer_win_close_printjob;
|
win_printjob->printjob.Close = printer_win_close_printjob;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
win_printer->printjob = win_printjob;
|
win_printer->printjob = win_printjob;
|
||||||
|
|
||||||
return (rdpPrintJob*) win_printjob;
|
return (rdpPrintJob*) win_printjob;
|
||||||
@ -147,7 +148,7 @@ static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, UINT32 id)
|
|||||||
|
|
||||||
static rdpPrintJob* printer_win_find_printjob(rdpPrinter* printer, UINT32 id)
|
static rdpPrintJob* printer_win_find_printjob(rdpPrinter* printer, UINT32 id)
|
||||||
{
|
{
|
||||||
rdpWinPrinter* win_printer = (rdpWinPrinter*)printer;
|
rdpWinPrinter* win_printer = (rdpWinPrinter*) printer;
|
||||||
|
|
||||||
DEBUG_WINPR("");
|
DEBUG_WINPR("");
|
||||||
|
|
||||||
@ -162,7 +163,7 @@ static rdpPrintJob* printer_win_find_printjob(rdpPrinter* printer, UINT32 id)
|
|||||||
|
|
||||||
static void printer_win_free_printer(rdpPrinter* printer)
|
static void printer_win_free_printer(rdpPrinter* printer)
|
||||||
{
|
{
|
||||||
rdpWinPrinter* win_printer = (rdpWinPrinter*)printer;
|
rdpWinPrinter* win_printer = (rdpWinPrinter*) printer;
|
||||||
|
|
||||||
DEBUG_WINPR("");
|
DEBUG_WINPR("");
|
||||||
|
|
||||||
@ -182,7 +183,8 @@ static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, cons
|
|||||||
size_t charsConverted;
|
size_t charsConverted;
|
||||||
DEBUG_WINPR("");
|
DEBUG_WINPR("");
|
||||||
|
|
||||||
win_printer = xnew(rdpWinPrinter);
|
win_printer = (rdpWinPrinter*) malloc(sizeof(rdpWinPrinter));
|
||||||
|
ZeroMemory(win_printer, sizeof(rdpWinPrinter));
|
||||||
|
|
||||||
win_printer->printer.id = win_driver->id_sequence++;
|
win_printer->printer.id = win_driver->id_sequence++;
|
||||||
win_printer->printer.name = _strdup(name);
|
win_printer->printer.name = _strdup(name);
|
||||||
@ -269,20 +271,15 @@ rdpPrinterDriver* printer_win_get_driver(void)
|
|||||||
|
|
||||||
if (win_driver == NULL)
|
if (win_driver == NULL)
|
||||||
{
|
{
|
||||||
win_driver = xnew(rdpWinPrinterDriver);
|
win_driver = (rdpWinPrinterDriver*) malloc(sizeof(rdpWinPrinterDriver));
|
||||||
|
ZeroMemory(win_driver, sizeof(rdpWinPrinterDriver));
|
||||||
|
|
||||||
win_driver->driver.EnumPrinters = printer_win_enum_printers;
|
win_driver->driver.EnumPrinters = printer_win_enum_printers;
|
||||||
win_driver->driver.GetPrinter = printer_win_get_printer;
|
win_driver->driver.GetPrinter = printer_win_get_printer;
|
||||||
|
|
||||||
win_driver->id_sequence = 1;
|
win_driver->id_sequence = 1;
|
||||||
|
|
||||||
//#ifdef _win_API_1_4
|
|
||||||
// DEBUG_SVC("using win API 1.4");
|
|
||||||
//#else
|
|
||||||
// DEBUG_SVC("using win API 1.2");
|
|
||||||
//#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (rdpPrinterDriver*)win_driver;
|
return (rdpPrinterDriver*) win_driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/types.h>
|
#include <freerdp/types.h>
|
||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
#include <freerdp/utils/dsp.h>
|
#include <freerdp/utils/dsp.h>
|
||||||
@ -206,7 +208,8 @@ int freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pE
|
|||||||
ADDIN_ARGV* args;
|
ADDIN_ARGV* args;
|
||||||
rdpsndAudioQPlugin* aqPlugin;
|
rdpsndAudioQPlugin* aqPlugin;
|
||||||
|
|
||||||
aqPlugin = xnew(rdpsndAudioQPlugin);
|
aqPlugin = (rdpsndAudioQPlugin*) malloc(sizeof(rdpsndAudioQPlugin));
|
||||||
|
ZeroMemory(aqPlugin, sizeof(rdpsndAudioQPlugin));
|
||||||
|
|
||||||
aqPlugin->device.Open = rdpsnd_audio_open;
|
aqPlugin->device.Open = rdpsnd_audio_open;
|
||||||
aqPlugin->device.FormatSupported = rdpsnd_audio_format_supported;
|
aqPlugin->device.FormatSupported = rdpsnd_audio_format_supported;
|
||||||
|
@ -570,7 +570,8 @@ int freerdp_rdpsnd_client_subsystem_entry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pE
|
|||||||
ADDIN_ARGV* args;
|
ADDIN_ARGV* args;
|
||||||
rdpsndPulsePlugin* pulse;
|
rdpsndPulsePlugin* pulse;
|
||||||
|
|
||||||
pulse = xnew(rdpsndPulsePlugin);
|
pulse = (rdpsndPulsePlugin*) malloc(sizeof(rdpsndPulsePlugin));
|
||||||
|
ZeroMemory(pulse, sizeof(rdpsndPulsePlugin));
|
||||||
|
|
||||||
pulse->device.Open = rdpsnd_pulse_open;
|
pulse->device.Open = rdpsnd_pulse_open;
|
||||||
pulse->device.FormatSupported = rdpsnd_pulse_format_supported;
|
pulse->device.FormatSupported = rdpsnd_pulse_format_supported;
|
||||||
|
@ -363,7 +363,9 @@ static void rdpsnd_process_message_wave(rdpsndPlugin* rdpsnd, STREAM* data_in)
|
|||||||
DEBUG_SVC("data_size %d delay_ms %u process_ms %u",
|
DEBUG_SVC("data_size %d delay_ms %u process_ms %u",
|
||||||
stream_get_size(data_in), delay_ms, process_ms);
|
stream_get_size(data_in), delay_ms, process_ms);
|
||||||
|
|
||||||
item = xnew(struct data_out_item);
|
item = (struct data_out_item*) malloc(sizeof(struct data_out_item));
|
||||||
|
ZeroMemory(item, sizeof(struct data_out_item));
|
||||||
|
|
||||||
item->data_out = stream_new(8);
|
item->data_out = stream_new(8);
|
||||||
stream_write_BYTE(item->data_out, SNDC_WAVECONFIRM);
|
stream_write_BYTE(item->data_out, SNDC_WAVECONFIRM);
|
||||||
stream_write_BYTE(item->data_out, 0);
|
stream_write_BYTE(item->data_out, 0);
|
||||||
|
@ -109,6 +109,8 @@ static BOOL rdpsnd_server_send_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RDPSND_PDU_FINISH(s);
|
RDPSND_PDU_FINISH(s);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
static BOOL rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
|
||||||
@ -451,7 +453,9 @@ rdpsnd_server_context* rdpsnd_server_context_new(WTSVirtualChannelManager* vcm)
|
|||||||
{
|
{
|
||||||
rdpsnd_server* rdpsnd;
|
rdpsnd_server* rdpsnd;
|
||||||
|
|
||||||
rdpsnd = xnew(rdpsnd_server);
|
rdpsnd = (rdpsnd_server*) malloc(sizeof(rdpsnd_server));
|
||||||
|
ZeroMemory(rdpsnd, sizeof(rdpsnd_server));
|
||||||
|
|
||||||
rdpsnd->context.vcm = vcm;
|
rdpsnd->context.vcm = vcm;
|
||||||
rdpsnd->context.selected_client_format = -1;
|
rdpsnd->context.selected_client_format = -1;
|
||||||
rdpsnd->context.Initialize = rdpsnd_server_initialize;
|
rdpsnd->context.Initialize = rdpsnd_server_initialize;
|
||||||
|
@ -708,7 +708,8 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
|
|||||||
|
|
||||||
if (name[0] && path[0])
|
if (name[0] && path[0])
|
||||||
{
|
{
|
||||||
serial = xnew(SERIAL_DEVICE);
|
serial = (SERIAL_DEVICE*) malloc(sizeof(SERIAL_DEVICE));
|
||||||
|
ZeroMemory(serial, sizeof(SERIAL_DEVICE));
|
||||||
|
|
||||||
serial->device.type = RDPDR_DTYP_SERIAL;
|
serial->device.type = RDPDR_DTYP_SERIAL;
|
||||||
serial->device.name = name;
|
serial->device.name = name;
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
#include <freerdp/server/channels.h>
|
#include <freerdp/server/channels.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
#include <winpr/synch.h>
|
#include <winpr/synch.h>
|
||||||
|
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
@ -99,7 +100,9 @@ static void wts_queue_receive_data(rdpPeerChannel* channel, const BYTE* buffer,
|
|||||||
{
|
{
|
||||||
wts_data_item* item;
|
wts_data_item* item;
|
||||||
|
|
||||||
item = xnew(wts_data_item);
|
item = (wts_data_item*) malloc(sizeof(wts_data_item));
|
||||||
|
ZeroMemory(item, sizeof(wts_data_item));
|
||||||
|
|
||||||
item->length = length;
|
item->length = length;
|
||||||
item->buffer = malloc(length);
|
item->buffer = malloc(length);
|
||||||
memcpy(item->buffer, buffer, length);
|
memcpy(item->buffer, buffer, length);
|
||||||
@ -411,10 +414,12 @@ WTSVirtualChannelManager* WTSCreateVirtualChannelManager(freerdp_peer* client)
|
|||||||
{
|
{
|
||||||
WTSVirtualChannelManager* vcm;
|
WTSVirtualChannelManager* vcm;
|
||||||
|
|
||||||
vcm = xnew(WTSVirtualChannelManager);
|
vcm = (WTSVirtualChannelManager*) malloc(sizeof(WTSVirtualChannelManager));
|
||||||
|
|
||||||
if (vcm != NULL)
|
if (vcm != NULL)
|
||||||
{
|
{
|
||||||
|
ZeroMemory(vcm, sizeof(WTSVirtualChannelManager));
|
||||||
|
|
||||||
vcm->client = client;
|
vcm->client = client;
|
||||||
vcm->send_event = wait_obj_new();
|
vcm->send_event = wait_obj_new();
|
||||||
vcm->send_queue = list_new();
|
vcm->send_queue = list_new();
|
||||||
@ -535,7 +540,9 @@ void* WTSVirtualChannelOpenEx(
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
channel = xnew(rdpPeerChannel);
|
channel = (rdpPeerChannel*) malloc(sizeof(rdpPeerChannel));
|
||||||
|
ZeroMemory(channel, sizeof(rdpPeerChannel));
|
||||||
|
|
||||||
channel->vcm = vcm;
|
channel->vcm = vcm;
|
||||||
channel->client = client;
|
channel->client = client;
|
||||||
channel->channel_type = RDP_PEER_CHANNEL_TYPE_DVC;
|
channel->channel_type = RDP_PEER_CHANNEL_TYPE_DVC;
|
||||||
@ -579,7 +586,9 @@ void* WTSVirtualChannelOpenEx(
|
|||||||
|
|
||||||
if (channel == NULL)
|
if (channel == NULL)
|
||||||
{
|
{
|
||||||
channel = xnew(rdpPeerChannel);
|
channel = (rdpPeerChannel*) malloc(sizeof(rdpPeerChannel));
|
||||||
|
ZeroMemory(channel, sizeof(rdpPeerChannel));
|
||||||
|
|
||||||
channel->vcm = vcm;
|
channel->vcm = vcm;
|
||||||
channel->client = client;
|
channel->client = client;
|
||||||
channel->channel_id = client->settings->ChannelDefArray[i].ChannelId;
|
channel->channel_id = client->settings->ChannelDefArray[i].ChannelId;
|
||||||
@ -718,7 +727,9 @@ BOOL WTSVirtualChannelWrite(
|
|||||||
|
|
||||||
if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC)
|
if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC)
|
||||||
{
|
{
|
||||||
item = xnew(wts_data_item);
|
item = (wts_data_item*) malloc(sizeof(wts_data_item));
|
||||||
|
ZeroMemory(item, sizeof(wts_data_item));
|
||||||
|
|
||||||
item->buffer = malloc(Length);
|
item->buffer = malloc(Length);
|
||||||
item->length = Length;
|
item->length = Length;
|
||||||
memcpy(item->buffer, Buffer, Length);
|
memcpy(item->buffer, Buffer, Length);
|
||||||
@ -737,7 +748,9 @@ BOOL WTSVirtualChannelWrite(
|
|||||||
|
|
||||||
while (Length > 0)
|
while (Length > 0)
|
||||||
{
|
{
|
||||||
item = xnew(wts_data_item);
|
item = (wts_data_item*) malloc(sizeof(wts_data_item));
|
||||||
|
ZeroMemory(item, sizeof(wts_data_item));
|
||||||
|
|
||||||
item->buffer = malloc(channel->client->settings->VirtualChannelChunkSize);
|
item->buffer = malloc(channel->client->settings->VirtualChannelChunkSize);
|
||||||
stream_attach(s, item->buffer, channel->client->settings->VirtualChannelChunkSize);
|
stream_attach(s, item->buffer, channel->client->settings->VirtualChannelChunkSize);
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
|
|
||||||
#include "df_graphics.h"
|
#include "df_graphics.h"
|
||||||
@ -123,7 +125,8 @@ void df_register_graphics(rdpGraphics* graphics)
|
|||||||
{
|
{
|
||||||
rdpPointer* pointer;
|
rdpPointer* pointer;
|
||||||
|
|
||||||
pointer = xnew(rdpPointer);
|
pointer = (rdpPointer*) malloc(sizeof(rdpPointer));
|
||||||
|
ZeroMemory(pointer, sizeof(rdpPointer));
|
||||||
pointer->size = sizeof(dfPointer);
|
pointer->size = sizeof(dfPointer);
|
||||||
|
|
||||||
pointer->New = df_Pointer_New;
|
pointer->New = df_Pointer_New;
|
||||||
|
@ -155,11 +155,15 @@ BOOL df_pre_connect(freerdp* instance)
|
|||||||
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
|
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
|
||||||
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
|
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
|
||||||
|
|
||||||
dfi->clrconv = xnew(CLRCONV);
|
dfi->clrconv = (CLRCONV*) malloc(sizeof(CLRCONV));
|
||||||
|
ZeroMemory(dfi->clrconv, sizeof(CLRCONV));
|
||||||
|
|
||||||
dfi->clrconv->alpha = 1;
|
dfi->clrconv->alpha = 1;
|
||||||
dfi->clrconv->invert = 0;
|
dfi->clrconv->invert = 0;
|
||||||
dfi->clrconv->rgb555 = 0;
|
dfi->clrconv->rgb555 = 0;
|
||||||
dfi->clrconv->palette = xnew(rdpPalette);
|
|
||||||
|
dfi->clrconv->palette = (rdpPalette*) malloc(sizeof(rdpPalette));
|
||||||
|
ZeroMemory(dfi->clrconv->palette, sizeof(rdpPalette));
|
||||||
|
|
||||||
freerdp_channels_pre_connect(instance->context->channels, instance);
|
freerdp_channels_pre_connect(instance->context->channels, instance);
|
||||||
|
|
||||||
|
@ -25,11 +25,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/types.h>
|
#include <freerdp/types.h>
|
||||||
#include <freerdp/utils/print.h>
|
#include <freerdp/utils/print.h>
|
||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
#include <freerdp/utils/hexdump.h>
|
#include <freerdp/utils/hexdump.h>
|
||||||
#include <freerdp/codec/rfx.h>
|
#include <freerdp/codec/rfx.h>
|
||||||
|
|
||||||
#include "rfx_types.h"
|
#include "rfx_types.h"
|
||||||
#include "rfx_bitstream.h"
|
#include "rfx_bitstream.h"
|
||||||
#include "rfx_rlgr.h"
|
#include "rfx_rlgr.h"
|
||||||
@ -191,8 +195,11 @@ void test_bitstream(void)
|
|||||||
UINT16 b;
|
UINT16 b;
|
||||||
RFX_BITSTREAM* bs;
|
RFX_BITSTREAM* bs;
|
||||||
|
|
||||||
bs = xnew(RFX_BITSTREAM);
|
bs = (RFX_BITSTREAM*) malloc(sizeof(RFX_BITSTREAM));
|
||||||
|
ZeroMemory(bs, sizeof(RFX_BITSTREAM));
|
||||||
|
|
||||||
rfx_bitstream_attach(bs, (BYTE*) y_data, sizeof(y_data));
|
rfx_bitstream_attach(bs, (BYTE*) y_data, sizeof(y_data));
|
||||||
|
|
||||||
while (!rfx_bitstream_eos(bs))
|
while (!rfx_bitstream_eos(bs))
|
||||||
{
|
{
|
||||||
rfx_bitstream_get_bits(bs, 3, b);
|
rfx_bitstream_get_bits(bs, 3, b);
|
||||||
@ -210,7 +217,9 @@ void test_bitstream_enc(void)
|
|||||||
RFX_BITSTREAM* bs;
|
RFX_BITSTREAM* bs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
bs = xnew(RFX_BITSTREAM);
|
bs = (RFX_BITSTREAM*) malloc(sizeof(RFX_BITSTREAM));
|
||||||
|
ZeroMemory(bs, sizeof(RFX_BITSTREAM));
|
||||||
|
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
rfx_bitstream_attach(bs, buffer, sizeof(buffer));
|
rfx_bitstream_attach(bs, buffer, sizeof(buffer));
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
|
@ -26,10 +26,6 @@
|
|||||||
|
|
||||||
#include <freerdp/api.h>
|
#include <freerdp/api.h>
|
||||||
|
|
||||||
FREERDP_API void* xzalloc(size_t size);
|
|
||||||
|
|
||||||
#define xnew(_type) (_type*)xzalloc(sizeof(_type))
|
|
||||||
|
|
||||||
#define ARRAY_SIZE(_x) (sizeof(_x)/sizeof(*(_x)))
|
#define ARRAY_SIZE(_x) (sizeof(_x)/sizeof(*(_x)))
|
||||||
|
|
||||||
#endif /* __MEMORY_UTILS_H */
|
#endif /* __MEMORY_UTILS_H */
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <freerdp/api.h>
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/svc.h>
|
#include <freerdp/svc.h>
|
||||||
#include <freerdp/addin.h>
|
#include <freerdp/addin.h>
|
||||||
|
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/event.h>
|
#include <freerdp/utils/event.h>
|
||||||
#include <freerdp/utils/debug.h>
|
#include <freerdp/utils/debug.h>
|
||||||
@ -59,37 +60,4 @@ FREERDP_API int svc_plugin_send_event(rdpSvcPlugin* plugin, RDP_EVENT* event);
|
|||||||
#define DEBUG_SVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
|
#define DEBUG_SVC(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STATIC_CHANNELS
|
|
||||||
#define DEFINE_SVC_PLUGIN_ENTRY(_prefix) int _prefix##_entry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
|
||||||
#define DEFINE_DEV_PLUGIN_ENTRY(_prefix) int _prefix##_entry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
|
||||||
#define REGISTER_SVC_PLUGIN_ENTRY(_prefix) freerdp_register_static_plugin(#_prefix, "VirtualChannelEntry", _prefix##_entry)
|
|
||||||
#define REGISTER_DEV_PLUGIN_ENTRY(_prefix) freerdp_register_static_plugin(#_prefix, "DeviceServiceEntry", _prefix##_entry)
|
|
||||||
#else
|
|
||||||
#define REGISTER_DEV_PLUGIN_ENTRY(_prefix)
|
|
||||||
#define REGISTER_SVC_PLUGIN_ENTRY(_prefix)
|
|
||||||
#define DEFINE_DEV_PLUGIN_ENTRY(_prefix)
|
|
||||||
#define DEFINE_SVC_PLUGIN_ENTRY(_prefix) int VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEFINE_SVC_PLUGIN(_prefix, _name, _options) \
|
|
||||||
\
|
|
||||||
DEFINE_SVC_PLUGIN_ENTRY(_prefix) \
|
|
||||||
{ \
|
|
||||||
_prefix##Plugin* _p; \
|
|
||||||
\
|
|
||||||
_p = xnew(_prefix##Plugin); \
|
|
||||||
\
|
|
||||||
_p->plugin.channel_def.options = _options; \
|
|
||||||
strcpy(_p->plugin.channel_def.name, _name); \
|
|
||||||
\
|
|
||||||
_p->plugin.connect_callback = _prefix##_process_connect; \
|
|
||||||
_p->plugin.receive_callback = _prefix##_process_receive; \
|
|
||||||
_p->plugin.event_callback = _prefix##_process_event; \
|
|
||||||
_p->plugin.terminate_callback = _prefix##_process_terminate; \
|
|
||||||
\
|
|
||||||
svc_plugin_init((rdpSvcPlugin*)_p, pEntryPoints); \
|
|
||||||
\
|
|
||||||
return 1; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* __SVC_PLUGIN_UTILS_H */
|
#endif /* __SVC_PLUGIN_UTILS_H */
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/api.h>
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/codec/color.h>
|
#include <freerdp/codec/color.h>
|
||||||
@ -1076,12 +1078,17 @@ void freerdp_image_swap_color_order(BYTE* data, int width, int height)
|
|||||||
|
|
||||||
HCLRCONV freerdp_clrconv_new(UINT32 flags)
|
HCLRCONV freerdp_clrconv_new(UINT32 flags)
|
||||||
{
|
{
|
||||||
HCLRCONV clrconv = xnew(CLRCONV);
|
HCLRCONV clrconv;
|
||||||
|
|
||||||
|
clrconv = (CLRCONV*) malloc(sizeof(CLRCONV));
|
||||||
|
ZeroMemory(clrconv, sizeof(CLRCONV));
|
||||||
|
|
||||||
clrconv->alpha = (flags & CLRCONV_ALPHA) ? TRUE : FALSE;
|
clrconv->alpha = (flags & CLRCONV_ALPHA) ? TRUE : FALSE;
|
||||||
clrconv->invert = (flags & CLRCONV_INVERT) ? TRUE : FALSE;
|
clrconv->invert = (flags & CLRCONV_INVERT) ? TRUE : FALSE;
|
||||||
clrconv->rgb555 = (flags & CLRCONV_RGB555) ? TRUE : FALSE;
|
clrconv->rgb555 = (flags & CLRCONV_RGB555) ? TRUE : FALSE;
|
||||||
clrconv->palette = xnew(rdpPalette);
|
|
||||||
|
clrconv->palette = (rdpPalette*) malloc(sizeof(rdpPalette));
|
||||||
|
ZeroMemory(clrconv->palette, sizeof(rdpPalette));
|
||||||
|
|
||||||
return clrconv;
|
return clrconv;
|
||||||
}
|
}
|
||||||
|
@ -432,19 +432,24 @@ struct rdp_mppc_enc* mppc_enc_new(int protocol_type)
|
|||||||
{
|
{
|
||||||
struct rdp_mppc_enc* enc;
|
struct rdp_mppc_enc* enc;
|
||||||
|
|
||||||
enc = xnew(struct rdp_mppc_enc);
|
enc = (struct rdp_mppc_enc*) malloc(sizeof(struct rdp_mppc_enc));
|
||||||
|
ZeroMemory(enc, sizeof(struct rdp_mppc_enc));
|
||||||
|
|
||||||
if (enc == NULL)
|
if (enc == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
switch (protocol_type)
|
switch (protocol_type)
|
||||||
{
|
{
|
||||||
case PROTO_RDP_40:
|
case PROTO_RDP_40:
|
||||||
enc->protocol_type = PROTO_RDP_40;
|
enc->protocol_type = PROTO_RDP_40;
|
||||||
enc->buf_len = RDP_40_HIST_BUF_LEN;
|
enc->buf_len = RDP_40_HIST_BUF_LEN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROTO_RDP_50:
|
case PROTO_RDP_50:
|
||||||
enc->protocol_type = PROTO_RDP_50;
|
enc->protocol_type = PROTO_RDP_50;
|
||||||
enc->buf_len = RDP_50_HIST_BUF_LEN;
|
enc->buf_len = RDP_50_HIST_BUF_LEN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
free(enc);
|
free(enc);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -515,15 +520,18 @@ BOOL compress_rdp(struct rdp_mppc_enc* enc, BYTE* srcData, int len)
|
|||||||
{
|
{
|
||||||
if ((enc == NULL) || (srcData == NULL) || (len <= 0) || (len > enc->buf_len))
|
if ((enc == NULL) || (srcData == NULL) || (len <= 0) || (len > enc->buf_len))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
switch (enc->protocol_type)
|
switch (enc->protocol_type)
|
||||||
{
|
{
|
||||||
case PROTO_RDP_40:
|
case PROTO_RDP_40:
|
||||||
return compress_rdp_4(enc, srcData, len);
|
return compress_rdp_4(enc, srcData, len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROTO_RDP_50:
|
case PROTO_RDP_50:
|
||||||
return compress_rdp_5(enc, srcData, len);
|
return compress_rdp_5(enc, srcData, len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,8 +267,8 @@ NSC_CONTEXT* nsc_context_new(void)
|
|||||||
{
|
{
|
||||||
NSC_CONTEXT* nsc_context;
|
NSC_CONTEXT* nsc_context;
|
||||||
|
|
||||||
nsc_context = xnew(NSC_CONTEXT);
|
nsc_context = (NSC_CONTEXT*) malloc(sizeof(NSC_CONTEXT));
|
||||||
nsc_context->priv = xnew(NSC_CONTEXT_PRIV);
|
nsc_context->priv = (NSC_CONTEXT_PRIV*) malloc(sizeof(NSC_CONTEXT_PRIV));
|
||||||
|
|
||||||
nsc_context->decode = nsc_decode;
|
nsc_context->decode = nsc_decode;
|
||||||
nsc_context->encode = nsc_encode;
|
nsc_context->encode = nsc_encode;
|
||||||
|
@ -24,10 +24,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef HAVE_STDINT_H
|
#ifdef HAVE_STDINT_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/codec/rfx.h>
|
#include <freerdp/codec/rfx.h>
|
||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
#include <freerdp/constants.h>
|
#include <freerdp/constants.h>
|
||||||
@ -140,8 +143,12 @@ RFX_CONTEXT* rfx_context_new(void)
|
|||||||
{
|
{
|
||||||
RFX_CONTEXT* context;
|
RFX_CONTEXT* context;
|
||||||
|
|
||||||
context = xnew(RFX_CONTEXT);
|
context = (RFX_CONTEXT*) malloc(sizeof(RFX_CONTEXT));
|
||||||
context->priv = xnew(RFX_CONTEXT_PRIV);
|
ZeroMemory(context, sizeof(RFX_CONTEXT));
|
||||||
|
|
||||||
|
context->priv = (RFX_CONTEXT_PRIV*) malloc(sizeof(RFX_CONTEXT_PRIV));
|
||||||
|
ZeroMemory(context->priv, sizeof(RFX_CONTEXT_PRIV));
|
||||||
|
|
||||||
context->priv->pool = rfx_pool_new();
|
context->priv->pool = rfx_pool_new();
|
||||||
|
|
||||||
/* initialize the default pixel format */
|
/* initialize the default pixel format */
|
||||||
@ -517,8 +524,10 @@ RFX_MESSAGE* rfx_process_message(RFX_CONTEXT* context, BYTE* data, UINT32 length
|
|||||||
UINT32 blockType;
|
UINT32 blockType;
|
||||||
RFX_MESSAGE* message;
|
RFX_MESSAGE* message;
|
||||||
|
|
||||||
|
message = (RFX_MESSAGE*) malloc(sizeof(RFX_MESSAGE));
|
||||||
|
ZeroMemory(message, sizeof(RFX_MESSAGE));
|
||||||
|
|
||||||
s = stream_new(0);
|
s = stream_new(0);
|
||||||
message = xnew(RFX_MESSAGE);
|
|
||||||
stream_attach(s, data, length);
|
stream_attach(s, data, length);
|
||||||
|
|
||||||
while (stream_get_left(s) > 6)
|
while (stream_get_left(s) > 6)
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
|
|
||||||
#include "rfx_bitstream.h"
|
#include "rfx_bitstream.h"
|
||||||
@ -134,7 +136,9 @@ int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* data, int data_size, INT16* buff
|
|||||||
int vk;
|
int vk;
|
||||||
UINT16 mag16;
|
UINT16 mag16;
|
||||||
|
|
||||||
bs = xnew(RFX_BITSTREAM);
|
bs = (RFX_BITSTREAM*) malloc(sizeof(RFX_BITSTREAM));
|
||||||
|
ZeroMemory(bs, sizeof(RFX_BITSTREAM));
|
||||||
|
|
||||||
rfx_bitstream_attach(bs, data, data_size);
|
rfx_bitstream_attach(bs, data, data_size);
|
||||||
dst = buffer;
|
dst = buffer;
|
||||||
|
|
||||||
@ -306,7 +310,9 @@ int rfx_rlgr_encode(RLGR_MODE mode, const INT16* data, int data_size, BYTE* buff
|
|||||||
RFX_BITSTREAM* bs;
|
RFX_BITSTREAM* bs;
|
||||||
int processed_size;
|
int processed_size;
|
||||||
|
|
||||||
bs = xnew(RFX_BITSTREAM);
|
bs = (RFX_BITSTREAM*) malloc(sizeof(RFX_BITSTREAM));
|
||||||
|
ZeroMemory(bs, sizeof(RFX_BITSTREAM));
|
||||||
|
|
||||||
rfx_bitstream_attach(bs, buffer, buffer_size);
|
rfx_bitstream_attach(bs, buffer, buffer_size);
|
||||||
|
|
||||||
/* initialize the parameters */
|
/* initialize the parameters */
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/utils/print.h>
|
#include <freerdp/utils/print.h>
|
||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
@ -211,7 +213,8 @@ rdpExtension* extension_new(freerdp* instance)
|
|||||||
|
|
||||||
if (instance != NULL)
|
if (instance != NULL)
|
||||||
{
|
{
|
||||||
extension = xnew(rdpExtension);
|
extension = (rdpExtension*) malloc(sizeof(rdpExtension));
|
||||||
|
ZeroMemory(extension, sizeof(rdpExtension));
|
||||||
|
|
||||||
extension->instance = instance;
|
extension->instance = instance;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/api.h>
|
#include <freerdp/api.h>
|
||||||
#include <freerdp/crypto/per.h>
|
#include <freerdp/crypto/per.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
@ -764,7 +766,9 @@ rdpFastPath* fastpath_new(rdpRdp* rdp)
|
|||||||
{
|
{
|
||||||
rdpFastPath* fastpath;
|
rdpFastPath* fastpath;
|
||||||
|
|
||||||
fastpath = xnew(rdpFastPath);
|
fastpath = (rdpFastPath*) malloc(sizeof(rdpFastPath));
|
||||||
|
ZeroMemory(fastpath, sizeof(rdpFastPath));
|
||||||
|
|
||||||
fastpath->rdp = rdp;
|
fastpath->rdp = rdp;
|
||||||
fastpath->updateData = stream_new(4096);
|
fastpath->updateData = stream_new(4096);
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@
|
|||||||
|
|
||||||
HttpContext* http_context_new()
|
HttpContext* http_context_new()
|
||||||
{
|
{
|
||||||
HttpContext* http_context = xnew(HttpContext);
|
HttpContext* http_context = (HttpContext*) malloc(sizeof(HttpContext));
|
||||||
|
|
||||||
if (http_context != NULL)
|
if (http_context != NULL)
|
||||||
{
|
{
|
||||||
|
ZeroMemory(http_context, sizeof(HttpContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
return http_context;
|
return http_context;
|
||||||
@ -255,11 +255,11 @@ STREAM* http_request_write(HttpContext* http_context, HttpRequest* http_request)
|
|||||||
|
|
||||||
HttpRequest* http_request_new()
|
HttpRequest* http_request_new()
|
||||||
{
|
{
|
||||||
HttpRequest* http_request = xnew(HttpRequest);
|
HttpRequest* http_request = (HttpRequest*) malloc(sizeof(HttpRequest));
|
||||||
|
|
||||||
if (http_request != NULL)
|
if (http_request != NULL)
|
||||||
{
|
{
|
||||||
|
ZeroMemory(http_request, sizeof(HttpRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
return http_request;
|
return http_request;
|
||||||
@ -496,11 +496,13 @@ HttpResponse* http_response_recv(rdpTls* tls)
|
|||||||
|
|
||||||
HttpResponse* http_response_new()
|
HttpResponse* http_response_new()
|
||||||
{
|
{
|
||||||
HttpResponse* http_response = xnew(HttpResponse);
|
HttpResponse* http_response;
|
||||||
|
|
||||||
|
http_response = (HttpResponse*) malloc(sizeof(HttpResponse));
|
||||||
|
|
||||||
if (http_response != NULL)
|
if (http_response != NULL)
|
||||||
{
|
{
|
||||||
|
ZeroMemory(http_response, sizeof(HttpResponse));
|
||||||
}
|
}
|
||||||
|
|
||||||
return http_response;
|
return http_response;
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/utils/print.h>
|
#include <freerdp/utils/print.h>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -312,14 +314,18 @@ freerdp_listener* freerdp_listener_new(void)
|
|||||||
freerdp_listener* instance;
|
freerdp_listener* instance;
|
||||||
rdpListener* listener;
|
rdpListener* listener;
|
||||||
|
|
||||||
instance = xnew(freerdp_listener);
|
instance = (freerdp_listener*) malloc(sizeof(freerdp_listener));
|
||||||
|
ZeroMemory(instance, sizeof(freerdp_listener));
|
||||||
|
|
||||||
instance->Open = freerdp_listener_open;
|
instance->Open = freerdp_listener_open;
|
||||||
instance->OpenLocal = freerdp_listener_open_local;
|
instance->OpenLocal = freerdp_listener_open_local;
|
||||||
instance->GetFileDescriptor = freerdp_listener_get_fds;
|
instance->GetFileDescriptor = freerdp_listener_get_fds;
|
||||||
instance->CheckFileDescriptor = freerdp_listener_check_fds;
|
instance->CheckFileDescriptor = freerdp_listener_check_fds;
|
||||||
instance->Close = freerdp_listener_close;
|
instance->Close = freerdp_listener_close;
|
||||||
|
|
||||||
listener = xnew(rdpListener);
|
listener = (rdpListener*) malloc(sizeof(rdpListener));
|
||||||
|
ZeroMemory(listener, sizeof(rdpListener));
|
||||||
|
|
||||||
listener->instance = instance;
|
listener->instance = instance;
|
||||||
|
|
||||||
instance->listener = (void*) listener;
|
instance->listener = (void*) listener;
|
||||||
|
@ -396,7 +396,8 @@ freerdp_peer* freerdp_peer_new(int sockfd)
|
|||||||
{
|
{
|
||||||
freerdp_peer* client;
|
freerdp_peer* client;
|
||||||
|
|
||||||
client = xnew(freerdp_peer);
|
client = (freerdp_peer*) malloc(sizeof(freerdp_peer));
|
||||||
|
ZeroMemory(client, sizeof(freerdp_peer));
|
||||||
|
|
||||||
freerdp_tcp_set_no_delay(sockfd, TRUE);
|
freerdp_tcp_set_no_delay(sockfd, TRUE);
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/gdi/dc.h>
|
#include <freerdp/gdi/dc.h>
|
||||||
#include <freerdp/gdi/brush.h>
|
#include <freerdp/gdi/brush.h>
|
||||||
#include <freerdp/gdi/shape.h>
|
#include <freerdp/gdi/shape.h>
|
||||||
@ -264,7 +266,8 @@ void gdi_register_graphics(rdpGraphics* graphics)
|
|||||||
rdpBitmap* bitmap;
|
rdpBitmap* bitmap;
|
||||||
rdpGlyph* glyph;
|
rdpGlyph* glyph;
|
||||||
|
|
||||||
bitmap = xnew(rdpBitmap);
|
bitmap = (rdpBitmap*) malloc(sizeof(rdpBitmap));
|
||||||
|
ZeroMemory(bitmap, sizeof(rdpBitmap));
|
||||||
bitmap->size = sizeof(gdiBitmap);
|
bitmap->size = sizeof(gdiBitmap);
|
||||||
|
|
||||||
bitmap->New = gdi_Bitmap_New;
|
bitmap->New = gdi_Bitmap_New;
|
||||||
@ -276,7 +279,8 @@ void gdi_register_graphics(rdpGraphics* graphics)
|
|||||||
graphics_register_bitmap(graphics, bitmap);
|
graphics_register_bitmap(graphics, bitmap);
|
||||||
free(bitmap);
|
free(bitmap);
|
||||||
|
|
||||||
glyph = xnew(rdpGlyph);
|
glyph = (rdpGlyph*) malloc(sizeof(rdpGlyph));
|
||||||
|
ZeroMemory(glyph, sizeof(rdpGlyph));
|
||||||
glyph->size = sizeof(gdiGlyph);
|
glyph->size = sizeof(gdiGlyph);
|
||||||
|
|
||||||
glyph->New = gdi_Glyph_New;
|
glyph->New = gdi_Glyph_New;
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/types.h>
|
#include <freerdp/types.h>
|
||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
#include <freerdp/utils/dsp.h>
|
#include <freerdp/utils/dsp.h>
|
||||||
@ -595,7 +597,8 @@ FREERDP_DSP_CONTEXT* freerdp_dsp_context_new(void)
|
|||||||
{
|
{
|
||||||
FREERDP_DSP_CONTEXT* context;
|
FREERDP_DSP_CONTEXT* context;
|
||||||
|
|
||||||
context = xnew(FREERDP_DSP_CONTEXT);
|
context = (FREERDP_DSP_CONTEXT*) malloc(sizeof(FREERDP_DSP_CONTEXT));
|
||||||
|
ZeroMemory(context, sizeof(FREERDP_DSP_CONTEXT));
|
||||||
|
|
||||||
context->resample = freerdp_dsp_resample;
|
context->resample = freerdp_dsp_resample;
|
||||||
context->decode_ima_adpcm = freerdp_dsp_decode_ima_adpcm;
|
context->decode_ima_adpcm = freerdp_dsp_decode_ima_adpcm;
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
#include <freerdp/utils/event.h>
|
#include <freerdp/utils/event.h>
|
||||||
#include <freerdp/client/cliprdr.h>
|
#include <freerdp/client/cliprdr.h>
|
||||||
@ -38,16 +40,23 @@ static RDP_EVENT* freerdp_cliprdr_event_new(UINT16 event_type)
|
|||||||
switch (event_type)
|
switch (event_type)
|
||||||
{
|
{
|
||||||
case RDP_EVENT_TYPE_CB_MONITOR_READY:
|
case RDP_EVENT_TYPE_CB_MONITOR_READY:
|
||||||
event = (RDP_EVENT*) xnew(RDP_CB_MONITOR_READY_EVENT);
|
event = (RDP_EVENT*) malloc(sizeof(RDP_CB_MONITOR_READY_EVENT));
|
||||||
|
ZeroMemory(event, sizeof(RDP_CB_MONITOR_READY_EVENT));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RDP_EVENT_TYPE_CB_FORMAT_LIST:
|
case RDP_EVENT_TYPE_CB_FORMAT_LIST:
|
||||||
event = (RDP_EVENT*) xnew(RDP_CB_FORMAT_LIST_EVENT);
|
event = (RDP_EVENT*) malloc(sizeof(RDP_CB_FORMAT_LIST_EVENT));
|
||||||
|
ZeroMemory(event, sizeof(RDP_CB_FORMAT_LIST_EVENT));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RDP_EVENT_TYPE_CB_DATA_REQUEST:
|
case RDP_EVENT_TYPE_CB_DATA_REQUEST:
|
||||||
event = (RDP_EVENT*) xnew(RDP_CB_DATA_REQUEST_EVENT);
|
event = (RDP_EVENT*) malloc(sizeof(RDP_CB_DATA_REQUEST_EVENT));
|
||||||
|
ZeroMemory(event, sizeof(RDP_CB_DATA_REQUEST_EVENT));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RDP_EVENT_TYPE_CB_DATA_RESPONSE:
|
case RDP_EVENT_TYPE_CB_DATA_RESPONSE:
|
||||||
event = (RDP_EVENT*) xnew(RDP_CB_DATA_RESPONSE_EVENT);
|
event = (RDP_EVENT*) malloc(sizeof(RDP_CB_DATA_RESPONSE_EVENT));
|
||||||
|
ZeroMemory(event, sizeof(RDP_CB_DATA_RESPONSE_EVENT));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,10 +70,13 @@ static RDP_EVENT* freerdp_tsmf_event_new(UINT16 event_type)
|
|||||||
switch (event_type)
|
switch (event_type)
|
||||||
{
|
{
|
||||||
case RDP_EVENT_TYPE_TSMF_VIDEO_FRAME:
|
case RDP_EVENT_TYPE_TSMF_VIDEO_FRAME:
|
||||||
event = (RDP_EVENT*) xnew(RDP_VIDEO_FRAME_EVENT);
|
event = (RDP_EVENT*) malloc(sizeof(RDP_VIDEO_FRAME_EVENT));
|
||||||
|
ZeroMemory(event, sizeof(RDP_VIDEO_FRAME_EVENT));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RDP_EVENT_TYPE_TSMF_REDRAW:
|
case RDP_EVENT_TYPE_TSMF_REDRAW:
|
||||||
event = (RDP_EVENT*) xnew(RDP_REDRAW_EVENT);
|
event = (RDP_EVENT*) malloc(sizeof(RDP_REDRAW_EVENT));
|
||||||
|
ZeroMemory(event, sizeof(RDP_REDRAW_EVENT));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +86,10 @@ static RDP_EVENT* freerdp_tsmf_event_new(UINT16 event_type)
|
|||||||
static RDP_EVENT* freerdp_rail_event_new(UINT16 event_type)
|
static RDP_EVENT* freerdp_rail_event_new(UINT16 event_type)
|
||||||
{
|
{
|
||||||
RDP_EVENT* event = NULL;
|
RDP_EVENT* event = NULL;
|
||||||
event = xnew(RDP_EVENT);
|
|
||||||
|
event = (RDP_EVENT*) malloc(sizeof(RDP_EVENT));
|
||||||
|
ZeroMemory(event, sizeof(RDP_EVENT));
|
||||||
|
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,14 +101,18 @@ RDP_EVENT* freerdp_event_new(UINT16 event_class, UINT16 event_type,
|
|||||||
switch (event_class)
|
switch (event_class)
|
||||||
{
|
{
|
||||||
case RDP_EVENT_CLASS_DEBUG:
|
case RDP_EVENT_CLASS_DEBUG:
|
||||||
event = xnew(RDP_EVENT);
|
event = (RDP_EVENT*) malloc(sizeof(RDP_EVENT));
|
||||||
|
ZeroMemory(event, sizeof(RDP_EVENT));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RDP_EVENT_CLASS_CLIPRDR:
|
case RDP_EVENT_CLASS_CLIPRDR:
|
||||||
event = freerdp_cliprdr_event_new(event_type);
|
event = freerdp_cliprdr_event_new(event_type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RDP_EVENT_CLASS_TSMF:
|
case RDP_EVENT_CLASS_TSMF:
|
||||||
event = freerdp_tsmf_event_new(event_type);
|
event = freerdp_tsmf_event_new(event_type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RDP_EVENT_CLASS_RAIL:
|
case RDP_EVENT_CLASS_RAIL:
|
||||||
event = freerdp_rail_event_new(event_type);
|
event = freerdp_rail_event_new(event_type);
|
||||||
break;
|
break;
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
#include <freerdp/utils/list.h>
|
#include <freerdp/utils/list.h>
|
||||||
|
|
||||||
@ -40,9 +42,12 @@ static LIST_ITEM* list_item_new(void* data)
|
|||||||
{
|
{
|
||||||
LIST_ITEM* item;
|
LIST_ITEM* item;
|
||||||
|
|
||||||
item = xnew(LIST_ITEM);
|
item = (LIST_ITEM*) malloc(sizeof(LIST_ITEM));
|
||||||
|
ZeroMemory(item, sizeof(LIST_ITEM));
|
||||||
|
|
||||||
if (item)
|
if (item)
|
||||||
item->data = data;
|
item->data = data;
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +88,11 @@ LIST* list_new(void)
|
|||||||
{
|
{
|
||||||
LIST* list;
|
LIST* list;
|
||||||
|
|
||||||
list = xnew(LIST);
|
list = (LIST*) malloc(sizeof(LIST));
|
||||||
|
ZeroMemory(list, sizeof(LIST));
|
||||||
|
|
||||||
list->count = 0;
|
list->count = 0;
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,6 +106,7 @@ void list_free(LIST* list)
|
|||||||
{
|
{
|
||||||
while (list->head)
|
while (list->head)
|
||||||
list_dequeue(list);
|
list_dequeue(list);
|
||||||
|
|
||||||
free(list);
|
free(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +121,7 @@ void list_enqueue(LIST* list, void* data)
|
|||||||
LIST_ITEM* item;
|
LIST_ITEM* item;
|
||||||
|
|
||||||
item = list_item_new(data);
|
item = list_item_new(data);
|
||||||
|
|
||||||
if (list->tail == NULL)
|
if (list->tail == NULL)
|
||||||
{
|
{
|
||||||
list->head = item;
|
list->head = item;
|
||||||
@ -123,6 +133,7 @@ void list_enqueue(LIST* list, void* data)
|
|||||||
list->tail->next = item;
|
list->tail->next = item;
|
||||||
list->tail = item;
|
list->tail = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
list->count++;
|
list->count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,9 +151,11 @@ void* list_dequeue(LIST* list)
|
|||||||
void* data = NULL;
|
void* data = NULL;
|
||||||
|
|
||||||
item = list->head;
|
item = list->head;
|
||||||
|
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
{
|
{
|
||||||
list->head = item->next;
|
list->head = item->next;
|
||||||
|
|
||||||
if (list->head == NULL)
|
if (list->head == NULL)
|
||||||
list->tail = NULL;
|
list->tail = NULL;
|
||||||
else
|
else
|
||||||
@ -152,6 +165,7 @@ void* list_dequeue(LIST* list)
|
|||||||
free(item);
|
free(item);
|
||||||
list->count--;
|
list->count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,11 +203,13 @@ void* list_next(LIST* list, void* data)
|
|||||||
|
|
||||||
item = list_item_find(list, data);
|
item = list_item_find(list, data);
|
||||||
data = NULL;
|
data = NULL;
|
||||||
|
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
{
|
{
|
||||||
if (item->next != NULL)
|
if (item->next != NULL)
|
||||||
data = item->next->data;
|
data = item->next->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,6 +227,7 @@ void* list_remove(LIST* list, void* data)
|
|||||||
LIST_ITEM* item;
|
LIST_ITEM* item;
|
||||||
|
|
||||||
item = list_item_find(list, data);
|
item = list_item_find(list, data);
|
||||||
|
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
{
|
{
|
||||||
if (item->prev != NULL)
|
if (item->prev != NULL)
|
||||||
@ -225,7 +242,10 @@ void* list_remove(LIST* list, void* data)
|
|||||||
list->count--;
|
list->count--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
data = NULL;
|
data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,32 +27,3 @@
|
|||||||
|
|
||||||
#include <winpr/crt.h>
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/utils/memory.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate memory initialized to zero.
|
|
||||||
* This function is used to secure a calloc call.
|
|
||||||
* It verifies its return value, and logs an error if the allocation failed.
|
|
||||||
*
|
|
||||||
* @param size - number of bytes to allocate. If the size is < 1, it will default to 1.
|
|
||||||
*
|
|
||||||
* @return a pointer to the allocated and zeroed buffer. NULL if the allocation failed.
|
|
||||||
*/
|
|
||||||
void* xzalloc(size_t size)
|
|
||||||
{
|
|
||||||
void* mem;
|
|
||||||
|
|
||||||
if (size < 1)
|
|
||||||
size = 1;
|
|
||||||
|
|
||||||
mem = calloc(1, size);
|
|
||||||
|
|
||||||
if (mem == NULL)
|
|
||||||
{
|
|
||||||
perror("xzalloc");
|
|
||||||
printf("xzalloc: failed to allocate memory of size: %d\n", (int) size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return mem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -51,7 +51,8 @@ STREAM* stream_new(int size)
|
|||||||
{
|
{
|
||||||
STREAM* stream;
|
STREAM* stream;
|
||||||
|
|
||||||
stream = xnew(STREAM);
|
stream = malloc(sizeof(STREAM));
|
||||||
|
ZeroMemory(stream, sizeof(STREAM));
|
||||||
|
|
||||||
if (stream != NULL)
|
if (stream != NULL)
|
||||||
{
|
{
|
||||||
|
@ -196,7 +196,9 @@ static void svc_plugin_process_received(rdpSvcPlugin* plugin, void* pData, UINT3
|
|||||||
plugin->priv->data_in = NULL;
|
plugin->priv->data_in = NULL;
|
||||||
stream_set_pos(data_in, 0);
|
stream_set_pos(data_in, 0);
|
||||||
|
|
||||||
item = xnew(svc_data_in_item);
|
item = (svc_data_in_item*) malloc(sizeof(svc_data_in_item));
|
||||||
|
ZeroMemory(item, sizeof(svc_data_in_item));
|
||||||
|
|
||||||
item->data_in = data_in;
|
item->data_in = data_in;
|
||||||
|
|
||||||
freerdp_thread_lock(plugin->priv->thread);
|
freerdp_thread_lock(plugin->priv->thread);
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
#include <winpr/windows.h>
|
#include <winpr/windows.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -42,7 +43,9 @@ freerdp_thread* freerdp_thread_new(void)
|
|||||||
{
|
{
|
||||||
freerdp_thread* thread;
|
freerdp_thread* thread;
|
||||||
|
|
||||||
thread = xnew(freerdp_thread);
|
thread = (freerdp_thread*) malloc(sizeof(freerdp_thread));
|
||||||
|
ZeroMemory(thread, sizeof(freerdp_thread));
|
||||||
|
|
||||||
thread->mutex = CreateMutex(NULL, FALSE, NULL);
|
thread->mutex = CreateMutex(NULL, FALSE, NULL);
|
||||||
thread->signals[0] = wait_obj_new();
|
thread->signals[0] = wait_obj_new();
|
||||||
thread->signals[1] = wait_obj_new();
|
thread->signals[1] = wait_obj_new();
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
#include <winpr/windows.h>
|
#include <winpr/windows.h>
|
||||||
|
|
||||||
#include <freerdp/utils/memory.h>
|
#include <freerdp/utils/memory.h>
|
||||||
@ -52,7 +53,8 @@ struct wait_obj* wait_obj_new(void)
|
|||||||
{
|
{
|
||||||
struct wait_obj* obj;
|
struct wait_obj* obj;
|
||||||
|
|
||||||
obj = xnew(struct wait_obj);
|
obj = (struct wait_obj*) malloc(sizeof(struct wait_obj));
|
||||||
|
ZeroMemory(obj, sizeof(struct wait_obj));
|
||||||
|
|
||||||
obj->attached = 0;
|
obj->attached = 0;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -76,7 +78,8 @@ struct wait_obj* wait_obj_new_with_fd(void* fd)
|
|||||||
{
|
{
|
||||||
struct wait_obj* obj;
|
struct wait_obj* obj;
|
||||||
|
|
||||||
obj = xnew(struct wait_obj);
|
obj = (struct wait_obj*) malloc(sizeof(struct wait_obj));
|
||||||
|
ZeroMemory(obj, sizeof(struct wait_obj));
|
||||||
|
|
||||||
obj->attached = 1;
|
obj->attached = 1;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -93,7 +96,6 @@ void wait_obj_free(struct wait_obj* obj)
|
|||||||
{
|
{
|
||||||
if (obj)
|
if (obj)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (obj->attached == 0)
|
if (obj->attached == 0)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -146,7 +148,9 @@ void wait_obj_set(struct wait_obj* obj)
|
|||||||
|
|
||||||
if (wait_obj_is_set(obj))
|
if (wait_obj_is_set(obj))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
len = write(obj->pipe_fd[1], "sig", 4);
|
len = write(obj->pipe_fd[1], "sig", 4);
|
||||||
|
|
||||||
if (len != 4)
|
if (len != 4)
|
||||||
printf("wait_obj_set: error\n");
|
printf("wait_obj_set: error\n");
|
||||||
#endif
|
#endif
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/locale/keyboard.h>
|
#include <freerdp/locale/keyboard.h>
|
||||||
#include <freerdp/codec/color.h>
|
#include <freerdp/codec/color.h>
|
||||||
@ -177,7 +179,8 @@ xfInfo* xf_info_init()
|
|||||||
XPixmapFormatValues* pf;
|
XPixmapFormatValues* pf;
|
||||||
XPixmapFormatValues* pfs;
|
XPixmapFormatValues* pfs;
|
||||||
|
|
||||||
xfi = xnew(xfInfo);
|
xfi = (xfInfo*) malloc(sizeof(xfInfo));
|
||||||
|
ZeroMemory(xfi, sizeof(xfInfo));
|
||||||
|
|
||||||
//xfi->use_xshm = TRUE;
|
//xfi->use_xshm = TRUE;
|
||||||
xfi->display = XOpenDisplay(NULL);
|
xfi->display = XOpenDisplay(NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user