Reformatted changed files.
This commit is contained in:
parent
a5ca75c3ab
commit
b22b897389
@ -32,9 +32,9 @@
|
||||
|
||||
static UINT32 g_ClientId = 0;
|
||||
|
||||
static int rdpdr_server_send_announce_request(RdpdrServerContext *context)
|
||||
static int rdpdr_server_send_announce_request(RdpdrServerContext* context)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
BOOL status;
|
||||
RDPDR_HEADER header;
|
||||
ULONG written;
|
||||
@ -53,7 +53,7 @@ static int rdpdr_server_send_announce_request(RdpdrServerContext *context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_receive_announce_response(RdpdrServerContext *context, wStream *s, RDPDR_HEADER *header)
|
||||
static int rdpdr_server_receive_announce_response(RdpdrServerContext* context, wStream* s, RDPDR_HEADER* header)
|
||||
{
|
||||
UINT32 ClientId;
|
||||
UINT16 VersionMajor;
|
||||
@ -67,7 +67,7 @@ static int rdpdr_server_receive_announce_response(RdpdrServerContext *context, w
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_receive_client_name_request(RdpdrServerContext *context, wStream *s, RDPDR_HEADER *header)
|
||||
static int rdpdr_server_receive_client_name_request(RdpdrServerContext* context, wStream* s, RDPDR_HEADER* header)
|
||||
{
|
||||
UINT32 UnicodeFlag;
|
||||
UINT32 ComputerNameLen;
|
||||
@ -88,12 +88,12 @@ static int rdpdr_server_receive_client_name_request(RdpdrServerContext *context,
|
||||
|
||||
if (UnicodeFlag)
|
||||
{
|
||||
ConvertFromUnicode(CP_UTF8, 0, (WCHAR *) Stream_Pointer(s),
|
||||
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s),
|
||||
-1, &(context->priv->ClientComputerName), 0, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
context->priv->ClientComputerName = _strdup((char *) Stream_Pointer(s));
|
||||
context->priv->ClientComputerName = _strdup((char*) Stream_Pointer(s));
|
||||
}
|
||||
|
||||
Stream_Seek(s, ComputerNameLen);
|
||||
@ -101,7 +101,7 @@ static int rdpdr_server_receive_client_name_request(RdpdrServerContext *context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_read_capability_set_header(wStream *s, RDPDR_CAPABILITY_HEADER *header)
|
||||
static int rdpdr_server_read_capability_set_header(wStream* s, RDPDR_CAPABILITY_HEADER* header)
|
||||
{
|
||||
Stream_Read_UINT16(s, header->CapabilityType); /* CapabilityType (2 bytes) */
|
||||
Stream_Read_UINT16(s, header->CapabilityLength); /* CapabilityLength (2 bytes) */
|
||||
@ -109,7 +109,7 @@ static int rdpdr_server_read_capability_set_header(wStream *s, RDPDR_CAPABILITY_
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_write_capability_set_header(wStream *s, RDPDR_CAPABILITY_HEADER *header)
|
||||
static int rdpdr_server_write_capability_set_header(wStream* s, RDPDR_CAPABILITY_HEADER* header)
|
||||
{
|
||||
Stream_Write_UINT16(s, header->CapabilityType); /* CapabilityType (2 bytes) */
|
||||
Stream_Write_UINT16(s, header->CapabilityLength); /* CapabilityLength (2 bytes) */
|
||||
@ -117,7 +117,7 @@ static int rdpdr_server_write_capability_set_header(wStream *s, RDPDR_CAPABILITY
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_read_general_capability_set(RdpdrServerContext *context, wStream *s, RDPDR_CAPABILITY_HEADER *header)
|
||||
static int rdpdr_server_read_general_capability_set(RdpdrServerContext* context, wStream* s, RDPDR_CAPABILITY_HEADER* header)
|
||||
{
|
||||
UINT32 ioCode1;
|
||||
UINT32 extraFlags1;
|
||||
@ -139,7 +139,7 @@ static int rdpdr_server_read_general_capability_set(RdpdrServerContext *context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_write_general_capability_set(RdpdrServerContext *context, wStream *s)
|
||||
static int rdpdr_server_write_general_capability_set(RdpdrServerContext* context, wStream* s)
|
||||
{
|
||||
UINT32 ioCode1;
|
||||
UINT32 extendedPdu;
|
||||
@ -191,12 +191,12 @@ static int rdpdr_server_write_general_capability_set(RdpdrServerContext *context
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_read_printer_capability_set(RdpdrServerContext *context, wStream *s, RDPDR_CAPABILITY_HEADER *header)
|
||||
static int rdpdr_server_read_printer_capability_set(RdpdrServerContext* context, wStream* s, RDPDR_CAPABILITY_HEADER* header)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_write_printer_capability_set(RdpdrServerContext *context, wStream *s)
|
||||
static int rdpdr_server_write_printer_capability_set(RdpdrServerContext* context, wStream* s)
|
||||
{
|
||||
RDPDR_CAPABILITY_HEADER header;
|
||||
header.CapabilityType = CAP_PRINTER_TYPE;
|
||||
@ -207,12 +207,12 @@ static int rdpdr_server_write_printer_capability_set(RdpdrServerContext *context
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_read_port_capability_set(RdpdrServerContext *context, wStream *s, RDPDR_CAPABILITY_HEADER *header)
|
||||
static int rdpdr_server_read_port_capability_set(RdpdrServerContext* context, wStream* s, RDPDR_CAPABILITY_HEADER* header)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_write_port_capability_set(RdpdrServerContext *context, wStream *s)
|
||||
static int rdpdr_server_write_port_capability_set(RdpdrServerContext* context, wStream* s)
|
||||
{
|
||||
RDPDR_CAPABILITY_HEADER header;
|
||||
header.CapabilityType = CAP_PORT_TYPE;
|
||||
@ -223,12 +223,12 @@ static int rdpdr_server_write_port_capability_set(RdpdrServerContext *context, w
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_read_drive_capability_set(RdpdrServerContext *context, wStream *s, RDPDR_CAPABILITY_HEADER *header)
|
||||
static int rdpdr_server_read_drive_capability_set(RdpdrServerContext* context, wStream* s, RDPDR_CAPABILITY_HEADER* header)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_write_drive_capability_set(RdpdrServerContext *context, wStream *s)
|
||||
static int rdpdr_server_write_drive_capability_set(RdpdrServerContext* context, wStream* s)
|
||||
{
|
||||
RDPDR_CAPABILITY_HEADER header;
|
||||
header.CapabilityType = CAP_DRIVE_TYPE;
|
||||
@ -239,12 +239,12 @@ static int rdpdr_server_write_drive_capability_set(RdpdrServerContext *context,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_read_smartcard_capability_set(RdpdrServerContext *context, wStream *s, RDPDR_CAPABILITY_HEADER *header)
|
||||
static int rdpdr_server_read_smartcard_capability_set(RdpdrServerContext* context, wStream* s, RDPDR_CAPABILITY_HEADER* header)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_write_smartcard_capability_set(RdpdrServerContext *context, wStream *s)
|
||||
static int rdpdr_server_write_smartcard_capability_set(RdpdrServerContext* context, wStream* s)
|
||||
{
|
||||
RDPDR_CAPABILITY_HEADER header;
|
||||
header.CapabilityType = CAP_SMARTCARD_TYPE;
|
||||
@ -255,9 +255,9 @@ static int rdpdr_server_write_smartcard_capability_set(RdpdrServerContext *conte
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_send_core_capability_request(RdpdrServerContext *context)
|
||||
static int rdpdr_server_send_core_capability_request(RdpdrServerContext* context)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
BOOL status;
|
||||
RDPDR_HEADER header;
|
||||
UINT16 numCapabilities;
|
||||
@ -282,7 +282,7 @@ static int rdpdr_server_send_core_capability_request(RdpdrServerContext *context
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_receive_core_capability_response(RdpdrServerContext *context, wStream *s, RDPDR_HEADER *header)
|
||||
static int rdpdr_server_receive_core_capability_response(RdpdrServerContext* context, wStream* s, RDPDR_HEADER* header)
|
||||
{
|
||||
int i;
|
||||
UINT16 numCapabilities;
|
||||
@ -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);
|
||||
@ -321,9 +326,9 @@ static int rdpdr_server_receive_core_capability_response(RdpdrServerContext *con
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_send_client_id_confirm(RdpdrServerContext *context)
|
||||
static int rdpdr_server_send_client_id_confirm(RdpdrServerContext* context)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
BOOL status;
|
||||
RDPDR_HEADER header;
|
||||
ULONG written;
|
||||
@ -342,7 +347,7 @@ static int rdpdr_server_send_client_id_confirm(RdpdrServerContext *context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_receive_device_list_announce_request(RdpdrServerContext *context, wStream *s, RDPDR_HEADER *header)
|
||||
static int rdpdr_server_receive_device_list_announce_request(RdpdrServerContext* context, wStream* s, RDPDR_HEADER* header)
|
||||
{
|
||||
int i;
|
||||
UINT32 DeviceCount;
|
||||
@ -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;
|
||||
}
|
||||
@ -385,9 +395,9 @@ static int rdpdr_server_receive_device_list_announce_request(RdpdrServerContext
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_send_user_logged_on(RdpdrServerContext *context)
|
||||
static int rdpdr_server_send_user_logged_on(RdpdrServerContext* context)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
BOOL status;
|
||||
RDPDR_HEADER header;
|
||||
ULONG written;
|
||||
@ -403,7 +413,7 @@ static int rdpdr_server_send_user_logged_on(RdpdrServerContext *context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_receive_pdu(RdpdrServerContext *context, wStream *s, RDPDR_HEADER *header)
|
||||
static int rdpdr_server_receive_pdu(RdpdrServerContext* context, wStream* s, RDPDR_HEADER* header)
|
||||
{
|
||||
CLOG_DBG("RdpdrServerReceivePdu: Component: 0x%04X PacketId: 0x%04X\n",
|
||||
header->Component, header->PacketId);
|
||||
@ -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;
|
||||
}
|
||||
@ -464,19 +484,19 @@ static int rdpdr_server_receive_pdu(RdpdrServerContext *context, wStream *s, RDP
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *rdpdr_server_thread(void *arg)
|
||||
static void* rdpdr_server_thread(void* arg)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
DWORD status;
|
||||
DWORD nCount;
|
||||
void *buffer;
|
||||
void* buffer;
|
||||
int position;
|
||||
HANDLE events[8];
|
||||
RDPDR_HEADER header;
|
||||
HANDLE ChannelEvent;
|
||||
DWORD BytesReturned;
|
||||
RdpdrServerContext *context;
|
||||
context = (RdpdrServerContext *) arg;
|
||||
RdpdrServerContext* context;
|
||||
context = (RdpdrServerContext*) arg;
|
||||
buffer = NULL;
|
||||
BytesReturned = 0;
|
||||
ChannelEvent = NULL;
|
||||
@ -536,7 +556,7 @@ static void *rdpdr_server_thread(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int rdpdr_server_start(RdpdrServerContext *context)
|
||||
static int rdpdr_server_start(RdpdrServerContext* context)
|
||||
{
|
||||
context->priv->ChannelHandle = WTSVirtualChannelOpen(context->vcm, WTS_CURRENT_SESSION, "rdpdr");
|
||||
|
||||
@ -545,11 +565,11 @@ static int rdpdr_server_start(RdpdrServerContext *context)
|
||||
|
||||
context->priv->StopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
context->priv->Thread = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE) rdpdr_server_thread, (void *) context, 0, NULL);
|
||||
(LPTHREAD_START_ROUTINE) rdpdr_server_thread, (void*) context, 0, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rdpdr_server_stop(RdpdrServerContext *context)
|
||||
static int rdpdr_server_stop(RdpdrServerContext* context)
|
||||
{
|
||||
SetEvent(context->priv->StopEvent);
|
||||
WaitForSingleObject(context->priv->Thread, INFINITE);
|
||||
@ -557,10 +577,10 @@ static int rdpdr_server_stop(RdpdrServerContext *context)
|
||||
return 0;
|
||||
}
|
||||
|
||||
RdpdrServerContext *rdpdr_server_context_new(HANDLE vcm)
|
||||
RdpdrServerContext* rdpdr_server_context_new(HANDLE vcm)
|
||||
{
|
||||
RdpdrServerContext *context;
|
||||
context = (RdpdrServerContext *) malloc(sizeof(RdpdrServerContext));
|
||||
RdpdrServerContext* context;
|
||||
context = (RdpdrServerContext*) malloc(sizeof(RdpdrServerContext));
|
||||
|
||||
if (context)
|
||||
{
|
||||
@ -568,7 +588,7 @@ RdpdrServerContext *rdpdr_server_context_new(HANDLE vcm)
|
||||
context->vcm = vcm;
|
||||
context->Start = rdpdr_server_start;
|
||||
context->Stop = rdpdr_server_stop;
|
||||
context->priv = (RdpdrServerPrivate *) malloc(sizeof(RdpdrServerPrivate));
|
||||
context->priv = (RdpdrServerPrivate*) malloc(sizeof(RdpdrServerPrivate));
|
||||
|
||||
if (context->priv)
|
||||
{
|
||||
@ -583,7 +603,7 @@ RdpdrServerContext *rdpdr_server_context_new(HANDLE vcm)
|
||||
return context;
|
||||
}
|
||||
|
||||
void rdpdr_server_context_free(RdpdrServerContext *context)
|
||||
void rdpdr_server_context_free(RdpdrServerContext* context)
|
||||
{
|
||||
if (context)
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,7 +41,7 @@
|
||||
#define DEBUG_X11_LMS(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
void xf_rail_enable_remoteapp_mode(xfContext *xfc)
|
||||
void xf_rail_enable_remoteapp_mode(xfContext* xfc)
|
||||
{
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
@ -52,7 +52,7 @@ void xf_rail_enable_remoteapp_mode(xfContext *xfc)
|
||||
}
|
||||
}
|
||||
|
||||
void xf_rail_disable_remoteapp_mode(xfContext *xfc)
|
||||
void xf_rail_disable_remoteapp_mode(xfContext* xfc)
|
||||
{
|
||||
if (xfc->remote_app)
|
||||
{
|
||||
@ -61,10 +61,10 @@ void xf_rail_disable_remoteapp_mode(xfContext *xfc)
|
||||
}
|
||||
}
|
||||
|
||||
void xf_rail_paint(xfContext *xfc, rdpRail *rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom)
|
||||
void xf_rail_paint(xfContext* xfc, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom)
|
||||
{
|
||||
xfWindow *xfw;
|
||||
rdpWindow *window;
|
||||
xfWindow* xfw;
|
||||
rdpWindow* window;
|
||||
BOOL intersect;
|
||||
UINT32 iwidth, iheight;
|
||||
INT32 ileft, itop;
|
||||
@ -76,7 +76,7 @@ void xf_rail_paint(xfContext *xfc, rdpRail *rail, INT32 uleft, INT32 utop, UINT3
|
||||
while (window_list_has_next(rail->list))
|
||||
{
|
||||
window = window_list_get_next(rail->list);
|
||||
xfw = (xfWindow *) window->extra;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
|
||||
/* RDP can have zero width or height windows. X cannot, so we ignore these. */
|
||||
|
||||
@ -104,34 +104,34 @@ void xf_rail_paint(xfContext *xfc, rdpRail *rail, INT32 uleft, INT32 utop, UINT3
|
||||
}
|
||||
}
|
||||
|
||||
void xf_rail_DesktopNonMonitored(rdpRail *rail, rdpWindow *window)
|
||||
void xf_rail_DesktopNonMonitored(rdpRail* rail, rdpWindow* window)
|
||||
{
|
||||
xfContext *xfc;
|
||||
xfc = (xfContext *) rail->extra;
|
||||
xfContext* xfc;
|
||||
xfc = (xfContext*) rail->extra;
|
||||
xf_rail_disable_remoteapp_mode(xfc);
|
||||
}
|
||||
|
||||
static void xf_rail_CreateWindow(rdpRail *rail, rdpWindow *window)
|
||||
static void xf_rail_CreateWindow(rdpRail* rail, rdpWindow* window)
|
||||
{
|
||||
xfContext *xfc;
|
||||
xfWindow *xfw;
|
||||
xfc = (xfContext *) rail->extra;
|
||||
xfContext* xfc;
|
||||
xfWindow* xfw;
|
||||
xfc = (xfContext*) rail->extra;
|
||||
xf_rail_enable_remoteapp_mode(xfc);
|
||||
xfw = xf_CreateWindow(xfc, window,
|
||||
window->windowOffsetX, window->windowOffsetY,
|
||||
window->windowWidth, window->windowHeight, window->windowId);
|
||||
xf_SetWindowStyle(xfc, xfw, window->style, window->extendedStyle);
|
||||
xf_SetWindowText(xfc, xfw, window->title);
|
||||
window->extra = (void *) xfw;
|
||||
window->extraId = (void *) xfw->handle;
|
||||
window->extra = (void*) xfw;
|
||||
window->extraId = (void*) xfw->handle;
|
||||
}
|
||||
|
||||
static void xf_rail_MoveWindow(rdpRail *rail, rdpWindow *window)
|
||||
static void xf_rail_MoveWindow(rdpRail* rail, rdpWindow* window)
|
||||
{
|
||||
xfContext *xfc;
|
||||
xfWindow *xfw;
|
||||
xfc = (xfContext *) rail->extra;
|
||||
xfw = (xfWindow *) window->extra;
|
||||
xfContext* xfc;
|
||||
xfWindow* xfw;
|
||||
xfc = (xfContext*) rail->extra;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
|
||||
/*
|
||||
* The rail server like to set the window to a small size when it is minimized even though it is hidden
|
||||
@ -160,65 +160,65 @@ static void xf_rail_MoveWindow(rdpRail *rail, rdpWindow *window)
|
||||
window->windowWidth, window->windowHeight);
|
||||
}
|
||||
|
||||
static void xf_rail_ShowWindow(rdpRail *rail, rdpWindow *window, BYTE state)
|
||||
static void xf_rail_ShowWindow(rdpRail* rail, rdpWindow* window, BYTE state)
|
||||
{
|
||||
xfContext *xfc;
|
||||
xfWindow *xfw;
|
||||
xfc = (xfContext *) rail->extra;
|
||||
xfw = (xfWindow *) window->extra;
|
||||
xfContext* xfc;
|
||||
xfWindow* xfw;
|
||||
xfc = (xfContext*) rail->extra;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
xf_ShowWindow(xfc, xfw, state);
|
||||
}
|
||||
|
||||
static void xf_rail_SetWindowText(rdpRail *rail, rdpWindow *window)
|
||||
static void xf_rail_SetWindowText(rdpRail* rail, rdpWindow* window)
|
||||
{
|
||||
xfContext *xfc;
|
||||
xfWindow *xfw;
|
||||
xfc = (xfContext *) rail->extra;
|
||||
xfw = (xfWindow *) window->extra;
|
||||
xfContext* xfc;
|
||||
xfWindow* xfw;
|
||||
xfc = (xfContext*) rail->extra;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
xf_SetWindowText(xfc, xfw, window->title);
|
||||
}
|
||||
|
||||
static void xf_rail_SetWindowIcon(rdpRail *rail, rdpWindow *window, rdpIcon *icon)
|
||||
static void xf_rail_SetWindowIcon(rdpRail* rail, rdpWindow* window, rdpIcon* icon)
|
||||
{
|
||||
xfContext *xfc;
|
||||
xfWindow *xfw;
|
||||
xfc = (xfContext *) rail->extra;
|
||||
xfw = (xfWindow *) window->extra;
|
||||
xfContext* xfc;
|
||||
xfWindow* xfw;
|
||||
xfc = (xfContext*) rail->extra;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
icon->extra = freerdp_icon_convert(icon->entry->bitsColor, NULL, icon->entry->bitsMask,
|
||||
icon->entry->width, icon->entry->height, icon->entry->bpp, rail->clrconv);
|
||||
xf_SetWindowIcon(xfc, xfw, icon);
|
||||
}
|
||||
|
||||
static void xf_rail_SetWindowRects(rdpRail *rail, rdpWindow *window)
|
||||
static void xf_rail_SetWindowRects(rdpRail* rail, rdpWindow* window)
|
||||
{
|
||||
xfContext *xfc;
|
||||
xfWindow *xfw;
|
||||
xfc = (xfContext *) rail->extra;
|
||||
xfw = (xfWindow *) window->extra;
|
||||
xfContext* xfc;
|
||||
xfWindow* xfw;
|
||||
xfc = (xfContext*) rail->extra;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
xf_SetWindowRects(xfc, xfw, window->windowRects, window->numWindowRects);
|
||||
}
|
||||
|
||||
static void xf_rail_SetWindowVisibilityRects(rdpRail *rail, rdpWindow *window)
|
||||
static void xf_rail_SetWindowVisibilityRects(rdpRail* rail, rdpWindow* window)
|
||||
{
|
||||
xfWindow *xfw;
|
||||
xfContext *xfc;
|
||||
xfc = (xfContext *) rail->extra;
|
||||
xfw = (xfWindow *) window->extra;
|
||||
xfWindow* xfw;
|
||||
xfContext* xfc;
|
||||
xfc = (xfContext*) rail->extra;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
xf_SetWindowVisibilityRects(xfc, xfw, window->windowRects, window->numWindowRects);
|
||||
}
|
||||
|
||||
static void xf_rail_DestroyWindow(rdpRail *rail, rdpWindow *window)
|
||||
static void xf_rail_DestroyWindow(rdpRail* rail, rdpWindow* window)
|
||||
{
|
||||
xfWindow *xfw;
|
||||
xfContext *xfc;
|
||||
xfc = (xfContext *) rail->extra;
|
||||
xfw = (xfWindow *) window->extra;
|
||||
xfWindow* xfw;
|
||||
xfContext* xfc;
|
||||
xfc = (xfContext*) rail->extra;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
xf_DestroyWindow(xfc, xfw);
|
||||
}
|
||||
|
||||
void xf_rail_register_callbacks(xfContext *xfc, rdpRail *rail)
|
||||
void xf_rail_register_callbacks(xfContext* xfc, rdpRail* rail)
|
||||
{
|
||||
rail->extra = (void *) xfc;
|
||||
rail->extra = (void*) xfc;
|
||||
rail->rail_CreateWindow = xf_rail_CreateWindow;
|
||||
rail->rail_MoveWindow = xf_rail_MoveWindow;
|
||||
rail->rail_ShowWindow = xf_rail_ShowWindow;
|
||||
@ -230,15 +230,15 @@ void xf_rail_register_callbacks(xfContext *xfc, rdpRail *rail)
|
||||
rail->rail_DesktopNonMonitored = xf_rail_DesktopNonMonitored;
|
||||
}
|
||||
|
||||
static void xf_on_free_rail_client_event(wMessage *event)
|
||||
static void xf_on_free_rail_client_event(wMessage* event)
|
||||
{
|
||||
rail_free_cloned_order(GetMessageType(event->id), event->wParam);
|
||||
}
|
||||
|
||||
static void xf_send_rail_client_event(rdpChannels *channels, UINT16 event_type, void *param)
|
||||
static void xf_send_rail_client_event(rdpChannels* channels, UINT16 event_type, void* param)
|
||||
{
|
||||
wMessage *out_event = NULL;
|
||||
void *payload = NULL;
|
||||
wMessage* out_event = NULL;
|
||||
void* payload = NULL;
|
||||
payload = rail_clone_order(event_type, param);
|
||||
|
||||
if (payload != NULL)
|
||||
@ -249,15 +249,15 @@ static void xf_send_rail_client_event(rdpChannels *channels, UINT16 event_type,
|
||||
}
|
||||
}
|
||||
|
||||
void xf_rail_send_activate(xfContext *xfc, Window xwindow, BOOL enabled)
|
||||
void xf_rail_send_activate(xfContext* xfc, Window xwindow, BOOL enabled)
|
||||
{
|
||||
rdpRail *rail;
|
||||
rdpChannels *channels;
|
||||
rdpWindow *rail_window;
|
||||
rdpRail* rail;
|
||||
rdpChannels* channels;
|
||||
rdpWindow* rail_window;
|
||||
RAIL_ACTIVATE_ORDER activate;
|
||||
rail = ((rdpContext *) xfc)->rail;
|
||||
channels = ((rdpContext *) xfc)->channels;
|
||||
rail_window = window_list_get_by_extra_id(rail->list, (void *) xwindow);
|
||||
rail = ((rdpContext*) xfc)->rail;
|
||||
channels = ((rdpContext*) xfc)->channels;
|
||||
rail_window = window_list_get_by_extra_id(rail->list, (void*) xwindow);
|
||||
|
||||
if (rail_window == NULL)
|
||||
return;
|
||||
@ -267,11 +267,11 @@ void xf_rail_send_activate(xfContext *xfc, Window xwindow, BOOL enabled)
|
||||
xf_send_rail_client_event(channels, RailChannel_ClientActivate, &activate);
|
||||
}
|
||||
|
||||
void xf_rail_send_client_system_command(xfContext *xfc, UINT32 windowId, UINT16 command)
|
||||
void xf_rail_send_client_system_command(xfContext* xfc, UINT32 windowId, UINT16 command)
|
||||
{
|
||||
rdpChannels *channels;
|
||||
rdpChannels* channels;
|
||||
RAIL_SYSCOMMAND_ORDER syscommand;
|
||||
channels = ((rdpContext *) xfc)->channels;
|
||||
channels = ((rdpContext*) xfc)->channels;
|
||||
syscommand.windowId = windowId;
|
||||
syscommand.command = command;
|
||||
xf_send_rail_client_event(channels, RailChannel_ClientSystemCommand, &syscommand);
|
||||
@ -283,13 +283,13 @@ void xf_rail_send_client_system_command(xfContext *xfc, UINT32 windowId, UINT16
|
||||
* send an update to the RDP server informing it of the new window position
|
||||
* and size.
|
||||
*/
|
||||
void xf_rail_adjust_position(xfContext *xfc, rdpWindow *window)
|
||||
void xf_rail_adjust_position(xfContext* xfc, rdpWindow* window)
|
||||
{
|
||||
xfWindow *xfw;
|
||||
rdpChannels *channels;
|
||||
xfWindow* xfw;
|
||||
rdpChannels* channels;
|
||||
RAIL_WINDOW_MOVE_ORDER window_move;
|
||||
xfw = (xfWindow *) window->extra;
|
||||
channels = ((rdpContext *) xfc)->channels;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
channels = ((rdpContext*) xfc)->channels;
|
||||
|
||||
if (! xfw->is_mapped || xfw->local_move.state != LMS_NOT_ACTIVE)
|
||||
return;
|
||||
@ -339,20 +339,20 @@ void xf_rail_adjust_position(xfContext *xfc, rdpWindow *window)
|
||||
}
|
||||
}
|
||||
|
||||
void xf_rail_end_local_move(xfContext *xfc, rdpWindow *window)
|
||||
void xf_rail_end_local_move(xfContext* xfc, rdpWindow* window)
|
||||
{
|
||||
xfWindow *xfw;
|
||||
rdpChannels *channels;
|
||||
xfWindow* xfw;
|
||||
rdpChannels* channels;
|
||||
RAIL_WINDOW_MOVE_ORDER window_move;
|
||||
rdpInput *input = xfc->instance->input;
|
||||
rdpInput* input = xfc->instance->input;
|
||||
int x,y;
|
||||
Window root_window;
|
||||
Window child_window;
|
||||
unsigned int mask;
|
||||
int child_x;
|
||||
int child_y;
|
||||
xfw = (xfWindow *) window->extra;
|
||||
channels = ((rdpContext *) xfc)->channels;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
channels = ((rdpContext*) xfc)->channels;
|
||||
DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d",
|
||||
(UINT32) xfw->handle,
|
||||
xfw->left, xfw->top, xfw->right, xfw->bottom,
|
||||
@ -412,10 +412,10 @@ void xf_rail_end_local_move(xfContext *xfc, rdpWindow *window)
|
||||
xfw->local_move.state = LMS_TERMINATING;
|
||||
}
|
||||
|
||||
void xf_process_rail_get_sysparams_event(xfContext *xfc, rdpChannels *channels, wMessage *event)
|
||||
void xf_process_rail_get_sysparams_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
|
||||
{
|
||||
RAIL_SYSPARAM_ORDER *sysparam;
|
||||
sysparam = (RAIL_SYSPARAM_ORDER *) event->wParam;
|
||||
RAIL_SYSPARAM_ORDER* sysparam;
|
||||
sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam;
|
||||
sysparam->workArea.left = xfc->workArea.x;
|
||||
sysparam->workArea.top = xfc->workArea.y;
|
||||
sysparam->workArea.right = xfc->workArea.x + xfc->workArea.width;
|
||||
@ -428,7 +428,7 @@ void xf_process_rail_get_sysparams_event(xfContext *xfc, rdpChannels *channels,
|
||||
xf_send_rail_client_event(channels, RailChannel_ClientSystemParam, sysparam);
|
||||
}
|
||||
|
||||
const char *error_code_names[] =
|
||||
const char* error_code_names[] =
|
||||
{
|
||||
"RAIL_EXEC_S_OK",
|
||||
"RAIL_EXEC_E_HOOK_NOT_LOADED",
|
||||
@ -439,10 +439,10 @@ const char *error_code_names[] =
|
||||
"RAIL_EXEC_E_SESSION_LOCKED"
|
||||
};
|
||||
|
||||
void xf_process_rail_exec_result_event(xfContext *xfc, rdpChannels *channels, wMessage *event)
|
||||
void xf_process_rail_exec_result_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
|
||||
{
|
||||
RAIL_EXEC_RESULT_ORDER *exec_result;
|
||||
exec_result = (RAIL_EXEC_RESULT_ORDER *) event->wParam;
|
||||
RAIL_EXEC_RESULT_ORDER* exec_result;
|
||||
exec_result = (RAIL_EXEC_RESULT_ORDER*) event->wParam;
|
||||
|
||||
if (exec_result->execResult != RAIL_EXEC_S_OK)
|
||||
{
|
||||
@ -456,31 +456,32 @@ void xf_process_rail_exec_result_event(xfContext *xfc, rdpChannels *channels, wM
|
||||
}
|
||||
}
|
||||
|
||||
void xf_process_rail_server_sysparam_event(xfContext *xfc, rdpChannels *channels, wMessage *event)
|
||||
void xf_process_rail_server_sysparam_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
|
||||
{
|
||||
RAIL_SYSPARAM_ORDER *sysparam = (RAIL_SYSPARAM_ORDER *) event->wParam;
|
||||
RAIL_SYSPARAM_ORDER* sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam;
|
||||
|
||||
switch (sysparam->param)
|
||||
{
|
||||
case SPI_SET_SCREEN_SAVE_ACTIVE:
|
||||
break;
|
||||
|
||||
case SPI_SET_SCREEN_SAVE_SECURE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void xf_process_rail_server_minmaxinfo_event(xfContext *xfc, rdpChannels *channels, wMessage *event)
|
||||
void xf_process_rail_server_minmaxinfo_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
|
||||
{
|
||||
rdpRail *rail;
|
||||
rdpWindow *rail_window = NULL;
|
||||
RAIL_MINMAXINFO_ORDER *minmax = (RAIL_MINMAXINFO_ORDER *) event->wParam;
|
||||
rail = ((rdpContext *) xfc)->rail;
|
||||
rdpRail* rail;
|
||||
rdpWindow* rail_window = NULL;
|
||||
RAIL_MINMAXINFO_ORDER* minmax = (RAIL_MINMAXINFO_ORDER*) event->wParam;
|
||||
rail = ((rdpContext*) xfc)->rail;
|
||||
rail_window = window_list_get_by_id(rail->list, minmax->windowId);
|
||||
|
||||
if (rail_window != NULL)
|
||||
{
|
||||
xfWindow *window = NULL;
|
||||
window = (xfWindow *) rail_window->extra;
|
||||
xfWindow* window = NULL;
|
||||
window = (xfWindow*) rail_window->extra;
|
||||
DEBUG_X11_LMS("windowId=0x%X maxWidth=%d maxHeight=%d maxPosX=%d maxPosY=%d "
|
||||
"minTrackWidth=%d minTrackHeight=%d maxTrackWidth=%d maxTrackHeight=%d",
|
||||
minmax->windowId, minmax->maxWidth, minmax->maxHeight,
|
||||
@ -492,7 +493,7 @@ void xf_process_rail_server_minmaxinfo_event(xfContext *xfc, rdpChannels *channe
|
||||
}
|
||||
}
|
||||
|
||||
const char *movetype_names[] =
|
||||
const char* movetype_names[] =
|
||||
{
|
||||
"(invalid)",
|
||||
"RAIL_WMSZ_LEFT",
|
||||
@ -508,21 +509,21 @@ const char *movetype_names[] =
|
||||
"RAIL_WMSZ_KEYSIZE"
|
||||
};
|
||||
|
||||
void xf_process_rail_server_localmovesize_event(xfContext *xfc, rdpChannels *channels, wMessage *event)
|
||||
void xf_process_rail_server_localmovesize_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
|
||||
{
|
||||
int x = 0, y = 0;
|
||||
rdpRail *rail;
|
||||
rdpRail* rail;
|
||||
int direction = 0;
|
||||
Window child_window;
|
||||
rdpWindow *rail_window = NULL;
|
||||
RAIL_LOCALMOVESIZE_ORDER *movesize = (RAIL_LOCALMOVESIZE_ORDER *) event->wParam;
|
||||
rail = ((rdpContext *) xfc)->rail;
|
||||
rdpWindow* rail_window = NULL;
|
||||
RAIL_LOCALMOVESIZE_ORDER* movesize = (RAIL_LOCALMOVESIZE_ORDER*) event->wParam;
|
||||
rail = ((rdpContext*) xfc)->rail;
|
||||
rail_window = window_list_get_by_id(rail->list, movesize->windowId);
|
||||
|
||||
if (rail_window != NULL)
|
||||
{
|
||||
xfWindow *xfw = NULL;
|
||||
xfw = (xfWindow *) rail_window->extra;
|
||||
xfWindow* xfw = NULL;
|
||||
xfw = (xfWindow*) rail_window->extra;
|
||||
DEBUG_X11_LMS("windowId=0x%X isMoveSizeStart=%d moveSizeType=%s PosX=%d PosY=%d",
|
||||
movesize->windowId, movesize->isMoveSizeStart,
|
||||
movetype_names[movesize->moveSizeType], (INT16) movesize->posX, (INT16) movesize->posY);
|
||||
@ -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;
|
||||
@ -600,49 +611,56 @@ void xf_process_rail_server_localmovesize_event(xfContext *xfc, rdpChannels *cha
|
||||
}
|
||||
}
|
||||
|
||||
void xf_process_rail_appid_resp_event(xfContext *xfc, rdpChannels *channels, wMessage *event)
|
||||
void xf_process_rail_appid_resp_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
|
||||
{
|
||||
RAIL_GET_APPID_RESP_ORDER *appid_resp =
|
||||
(RAIL_GET_APPID_RESP_ORDER *) event->wParam;
|
||||
RAIL_GET_APPID_RESP_ORDER* appid_resp =
|
||||
(RAIL_GET_APPID_RESP_ORDER*) event->wParam;
|
||||
DEBUG_WARN("Server Application ID Response PDU: windowId=0x%X "
|
||||
"applicationId=(length=%d dump)\n",
|
||||
appid_resp->windowId, 512);
|
||||
winpr_HexDump(TAG, WLOG_ERROR, (BYTE *) &appid_resp->applicationId, 512);
|
||||
winpr_HexDump(TAG, WLOG_ERROR, (BYTE*) &appid_resp->applicationId, 512);
|
||||
}
|
||||
|
||||
void xf_process_rail_langbarinfo_event(xfContext *xfc, rdpChannels *channels, wMessage *event)
|
||||
void xf_process_rail_langbarinfo_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
|
||||
{
|
||||
RAIL_LANGBAR_INFO_ORDER *langbar =
|
||||
(RAIL_LANGBAR_INFO_ORDER *) event->wParam;
|
||||
RAIL_LANGBAR_INFO_ORDER* langbar =
|
||||
(RAIL_LANGBAR_INFO_ORDER*) event->wParam;
|
||||
DEBUG_WARN("Language Bar Information PDU: languageBarStatus=0x%X\n",
|
||||
langbar->languageBarStatus);
|
||||
}
|
||||
|
||||
void xf_process_rail_event(xfContext *xfc, rdpChannels *channels, wMessage *event)
|
||||
void xf_process_rail_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
|
||||
{
|
||||
switch (GetMessageType(event->id))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -2874,67 +2874,67 @@ static int simple_rand(void)
|
||||
return ((unsigned int)(next / 65536) % 32768);
|
||||
}
|
||||
|
||||
static void fill_bitmap_alpha_channel(BYTE *data, int width, int height, BYTE value)
|
||||
static void fill_bitmap_alpha_channel(BYTE* data, int width, int height, BYTE value)
|
||||
{
|
||||
int i, j;
|
||||
UINT32 *pixel;
|
||||
UINT32* pixel;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
pixel = (UINT32 *) &data[((i * width) + j) * 4];
|
||||
pixel = (UINT32*) &data[((i * width) + j) * 4];
|
||||
*pixel = ((*pixel & 0x00FFFFFF) | (value << 24));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fill_bitmap_red_channel(BYTE *data, int width, int height, BYTE value)
|
||||
void fill_bitmap_red_channel(BYTE* data, int width, int height, BYTE value)
|
||||
{
|
||||
int i, j;
|
||||
UINT32 *pixel;
|
||||
UINT32* pixel;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
pixel = (UINT32 *) &data[((i * width) + j) * 4];
|
||||
pixel = (UINT32*) &data[((i * width) + j) * 4];
|
||||
*pixel = ((*pixel & 0xFF00FFFF) | (value << 16));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fill_bitmap_green_channel(BYTE *data, int width, int height, BYTE value)
|
||||
void fill_bitmap_green_channel(BYTE* data, int width, int height, BYTE value)
|
||||
{
|
||||
int i, j;
|
||||
UINT32 *pixel;
|
||||
UINT32* pixel;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
pixel = (UINT32 *) &data[((i * width) + j) * 4];
|
||||
pixel = (UINT32*) &data[((i * width) + j) * 4];
|
||||
*pixel = ((*pixel & 0xFFFF00FF) | (value << 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fill_bitmap_blue_channel(BYTE *data, int width, int height, BYTE value)
|
||||
void fill_bitmap_blue_channel(BYTE* data, int width, int height, BYTE value)
|
||||
{
|
||||
int i, j;
|
||||
UINT32 *pixel;
|
||||
UINT32* pixel;
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
for (j = 0; j < width; j++)
|
||||
{
|
||||
pixel = (UINT32 *) &data[((i * width) + j) * 4];
|
||||
pixel = (UINT32*) &data[((i * width) + j) * 4];
|
||||
*pixel = ((*pixel & 0xFFFFFF00) | (value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dump_color_channel(BYTE *data, int width, int height)
|
||||
void dump_color_channel(BYTE* data, int width, int height)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
@ -2953,22 +2953,22 @@ int test_individual_planes_encoding_rle()
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
BYTE *pOutput;
|
||||
BYTE* pOutput;
|
||||
int planeSize;
|
||||
int compareSize;
|
||||
int dstSizes[4];
|
||||
int availableSize;
|
||||
DWORD planarFlags;
|
||||
BITMAP_PLANAR_CONTEXT *planar;
|
||||
BITMAP_PLANAR_CONTEXT* planar;
|
||||
planarFlags = PLANAR_FORMAT_HEADER_NA;
|
||||
planarFlags |= PLANAR_FORMAT_HEADER_RLE;
|
||||
width = 64;
|
||||
height = 64;
|
||||
planeSize = width * height;
|
||||
planar = freerdp_bitmap_planar_context_new(planarFlags, width, height);
|
||||
CopyMemory(planar->planes[1], (BYTE *) TEST_64X64_RED_PLANE, planeSize); /* Red */
|
||||
CopyMemory(planar->planes[2], (BYTE *) TEST_64X64_GREEN_PLANE, planeSize); /* Green */
|
||||
CopyMemory(planar->planes[3], (BYTE *) TEST_64X64_BLUE_PLANE, planeSize); /* Blue */
|
||||
CopyMemory(planar->planes[1], (BYTE*) TEST_64X64_RED_PLANE, planeSize); /* Red */
|
||||
CopyMemory(planar->planes[2], (BYTE*) TEST_64X64_GREEN_PLANE, planeSize); /* Green */
|
||||
CopyMemory(planar->planes[3], (BYTE*) TEST_64X64_BLUE_PLANE, planeSize); /* Blue */
|
||||
freerdp_bitmap_planar_delta_encode_plane(planar->planes[1], width, height, planar->deltaPlanes[1]); /* Red */
|
||||
freerdp_bitmap_planar_delta_encode_plane(planar->planes[2], width, height, planar->deltaPlanes[2]); /* Green */
|
||||
freerdp_bitmap_planar_delta_encode_plane(planar->planes[3], width, height, planar->deltaPlanes[3]); /* Blue */
|
||||
@ -2996,7 +2996,7 @@ int test_individual_planes_encoding_rle()
|
||||
|
||||
compareSize = (dstSizes[1] > sizeof(TEST_64X64_RED_PLANE_RLE)) ? sizeof(TEST_64X64_RED_PLANE_RLE) : dstSizes[1];
|
||||
|
||||
if (memcmp(planar->rlePlanes[1], (BYTE *) TEST_64X64_RED_PLANE_RLE, compareSize) != 0)
|
||||
if (memcmp(planar->rlePlanes[1], (BYTE*) TEST_64X64_RED_PLANE_RLE, compareSize) != 0)
|
||||
{
|
||||
printf("RedPlaneRle doesn't match expected output\n");
|
||||
printf("RedPlaneRle Expected (%d):\n", (int) sizeof(TEST_64X64_RED_PLANE_RLE));
|
||||
@ -3028,11 +3028,11 @@ int test_individual_planes_encoding_rle()
|
||||
|
||||
compareSize = (dstSizes[2] > sizeof(TEST_64X64_GREEN_PLANE_RLE)) ? sizeof(TEST_64X64_GREEN_PLANE_RLE) : dstSizes[2];
|
||||
|
||||
if (memcmp(planar->rlePlanes[2], (BYTE *) TEST_64X64_GREEN_PLANE_RLE, compareSize) != 0)
|
||||
if (memcmp(planar->rlePlanes[2], (BYTE*) TEST_64X64_GREEN_PLANE_RLE, compareSize) != 0)
|
||||
{
|
||||
printf("GreenPlaneRle doesn't match expected output\n");
|
||||
printf("GreenPlaneRle Expected (%d):\n", (int) sizeof(TEST_64X64_GREEN_PLANE_RLE));
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, (BYTE *) TEST_64X64_GREEN_PLANE_RLE, (int) sizeof(TEST_64X64_GREEN_PLANE_RLE));
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, (BYTE*) TEST_64X64_GREEN_PLANE_RLE, (int) sizeof(TEST_64X64_GREEN_PLANE_RLE));
|
||||
printf("GreenPlaneRle Actual (%d):\n", dstSizes[2]);
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, planar->rlePlanes[2], dstSizes[2]);
|
||||
return -1;
|
||||
@ -3060,11 +3060,11 @@ int test_individual_planes_encoding_rle()
|
||||
|
||||
compareSize = (dstSizes[3] > sizeof(TEST_64X64_BLUE_PLANE_RLE)) ? sizeof(TEST_64X64_BLUE_PLANE_RLE) : dstSizes[3];
|
||||
|
||||
if (memcmp(planar->rlePlanes[3], (BYTE *) TEST_64X64_BLUE_PLANE_RLE, compareSize) != 0)
|
||||
if (memcmp(planar->rlePlanes[3], (BYTE*) TEST_64X64_BLUE_PLANE_RLE, compareSize) != 0)
|
||||
{
|
||||
printf("BluePlaneRle doesn't match expected output\n");
|
||||
printf("BluePlaneRle Expected (%d):\n", (int) sizeof(TEST_64X64_BLUE_PLANE_RLE));
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, (BYTE *) TEST_64X64_BLUE_PLANE_RLE, (int) sizeof(TEST_64X64_BLUE_PLANE_RLE));
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, (BYTE*) TEST_64X64_BLUE_PLANE_RLE, (int) sizeof(TEST_64X64_BLUE_PLANE_RLE));
|
||||
printf("BluePlaneRle Actual (%d):\n", dstSizes[3]);
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, planar->rlePlanes[3], dstSizes[3]);
|
||||
return -1;
|
||||
@ -3074,34 +3074,34 @@ int test_individual_planes_encoding_rle()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
||||
{
|
||||
int i, j;
|
||||
int dstSize;
|
||||
UINT32 format;
|
||||
HCLRCONV clrconv;
|
||||
DWORD planarFlags;
|
||||
BYTE *srcBitmap32;
|
||||
BYTE *srcBitmap16;
|
||||
BYTE* srcBitmap32;
|
||||
BYTE* srcBitmap16;
|
||||
int width, height;
|
||||
BYTE *blackBitmap;
|
||||
BYTE *whiteBitmap;
|
||||
BYTE *randomBitmap;
|
||||
BYTE *compressedBitmap;
|
||||
BYTE *decompressedBitmap;
|
||||
BITMAP_PLANAR_CONTEXT *planar;
|
||||
BYTE* blackBitmap;
|
||||
BYTE* whiteBitmap;
|
||||
BYTE* randomBitmap;
|
||||
BYTE* compressedBitmap;
|
||||
BYTE* decompressedBitmap;
|
||||
BITMAP_PLANAR_CONTEXT* planar;
|
||||
planarFlags = PLANAR_FORMAT_HEADER_NA;
|
||||
planarFlags |= PLANAR_FORMAT_HEADER_RLE;
|
||||
planar = freerdp_bitmap_planar_context_new(planarFlags, 64, 64);
|
||||
clrconv = freerdp_clrconv_new(0);
|
||||
srcBitmap16 = (BYTE *) TEST_RLE_UNCOMPRESSED_BITMAP_16BPP;
|
||||
srcBitmap16 = (BYTE*) TEST_RLE_UNCOMPRESSED_BITMAP_16BPP;
|
||||
srcBitmap32 = freerdp_image_convert(srcBitmap16, NULL, 32, 32, 16, 32, clrconv);
|
||||
format = PIXEL_FORMAT_ARGB32;
|
||||
#if 0
|
||||
freerdp_bitmap_compress_planar(planar, srcBitmap32, format, 32, 32, 32 * 4, NULL, &dstSize);
|
||||
freerdp_bitmap_planar_compress_plane_rle((BYTE *) TEST_RLE_SCANLINE_UNCOMPRESSED, 12, 1, NULL, &dstSize);
|
||||
freerdp_bitmap_planar_delta_encode_plane((BYTE *) TEST_RDP6_SCANLINES_ABSOLUTE, 6, 3, NULL);
|
||||
freerdp_bitmap_planar_compress_plane_rle((BYTE *) TEST_RDP6_SCANLINES_DELTA_2C_ENCODED_UNSIGNED, 6, 3, NULL, &dstSize);
|
||||
freerdp_bitmap_planar_compress_plane_rle((BYTE*) TEST_RLE_SCANLINE_UNCOMPRESSED, 12, 1, NULL, &dstSize);
|
||||
freerdp_bitmap_planar_delta_encode_plane((BYTE*) TEST_RDP6_SCANLINES_ABSOLUTE, 6, 3, NULL);
|
||||
freerdp_bitmap_planar_compress_plane_rle((BYTE*) TEST_RDP6_SCANLINES_DELTA_2C_ENCODED_UNSIGNED, 6, 3, NULL, &dstSize);
|
||||
#endif
|
||||
#if 1
|
||||
|
||||
@ -3109,11 +3109,11 @@ int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
{
|
||||
width = i;
|
||||
height = i;
|
||||
whiteBitmap = (BYTE *) malloc(width * height * 4);
|
||||
whiteBitmap = (BYTE*) malloc(width * height * 4);
|
||||
FillMemory(whiteBitmap, width * height * 4, 0xFF);
|
||||
fill_bitmap_alpha_channel(whiteBitmap, width, height, 0x00);
|
||||
compressedBitmap = freerdp_bitmap_compress_planar(planar, whiteBitmap, format, width, height, width * 4, NULL, &dstSize);
|
||||
decompressedBitmap = (BYTE *) malloc(width * height * 4);
|
||||
decompressedBitmap = (BYTE*) malloc(width * height * 4);
|
||||
ZeroMemory(decompressedBitmap, width * height * 4);
|
||||
|
||||
if (!bitmap_decompress(compressedBitmap, decompressedBitmap, width, height, dstSize, 32, 32))
|
||||
@ -3144,11 +3144,11 @@ int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
{
|
||||
width = i;
|
||||
height = i;
|
||||
blackBitmap = (BYTE *) malloc(width * height * 4);
|
||||
blackBitmap = (BYTE*) malloc(width * height * 4);
|
||||
ZeroMemory(blackBitmap, width * height * 4);
|
||||
fill_bitmap_alpha_channel(blackBitmap, width, height, 0x00);
|
||||
compressedBitmap = freerdp_bitmap_compress_planar(planar, blackBitmap, format, width, height, width * 4, NULL, &dstSize);
|
||||
decompressedBitmap = (BYTE *) malloc(width * height * 4);
|
||||
decompressedBitmap = (BYTE*) malloc(width * height * 4);
|
||||
ZeroMemory(decompressedBitmap, width * height * 4);
|
||||
|
||||
if (!bitmap_decompress(compressedBitmap, decompressedBitmap, width, height, dstSize, 32, 32))
|
||||
@ -3179,7 +3179,7 @@ int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
{
|
||||
width = i;
|
||||
height = i;
|
||||
randomBitmap = (BYTE *) malloc(width * height * 4);
|
||||
randomBitmap = (BYTE*) malloc(width * height * 4);
|
||||
|
||||
for (j = 0; j < width * height * 4; j++)
|
||||
{
|
||||
@ -3188,7 +3188,7 @@ int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
|
||||
fill_bitmap_alpha_channel(randomBitmap, width, height, 0x00);
|
||||
compressedBitmap = freerdp_bitmap_compress_planar(planar, randomBitmap, format, width, height, width * 4, NULL, &dstSize);
|
||||
decompressedBitmap = (BYTE *) malloc(width * height * 4);
|
||||
decompressedBitmap = (BYTE*) malloc(width * height * 4);
|
||||
ZeroMemory(decompressedBitmap, width * height * 4);
|
||||
|
||||
if (!bitmap_decompress(compressedBitmap, decompressedBitmap, width, height, dstSize, 32, 32))
|
||||
@ -3218,9 +3218,9 @@ int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
/* Experimental Case 01 */
|
||||
width = 64;
|
||||
height = 64;
|
||||
compressedBitmap = freerdp_bitmap_compress_planar(planar, (BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_01,
|
||||
compressedBitmap = freerdp_bitmap_compress_planar(planar, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_01,
|
||||
format, width, height, width * 4, NULL, &dstSize);
|
||||
decompressedBitmap = (BYTE *) malloc(width * height * 4);
|
||||
decompressedBitmap = (BYTE*) malloc(width * height * 4);
|
||||
ZeroMemory(decompressedBitmap, width * height * 4);
|
||||
|
||||
if (!bitmap_decompress(compressedBitmap, decompressedBitmap, width, height, dstSize, 32, 32))
|
||||
@ -3234,13 +3234,13 @@ int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
}
|
||||
|
||||
fill_bitmap_alpha_channel(decompressedBitmap, width, height, 0xFF);
|
||||
fill_bitmap_alpha_channel((BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_01, width, height, 0xFF);
|
||||
fill_bitmap_alpha_channel((BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_01, width, height, 0xFF);
|
||||
|
||||
if (memcmp(decompressedBitmap, (BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_01, width * height * 4) != 0)
|
||||
if (memcmp(decompressedBitmap, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_01, width * height * 4) != 0)
|
||||
{
|
||||
#if 0
|
||||
printf("experimental bitmap 01\n");
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, (BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_01, width * height * 4);
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_01, width * height * 4);
|
||||
printf("decompressed bitmap\n");
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, decompressedBitmap, width * height * 4);
|
||||
#endif
|
||||
@ -3253,9 +3253,9 @@ int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
/* Experimental Case 02 */
|
||||
width = 64;
|
||||
height = 64;
|
||||
compressedBitmap = freerdp_bitmap_compress_planar(planar, (BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_02,
|
||||
compressedBitmap = freerdp_bitmap_compress_planar(planar, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_02,
|
||||
format, width, height, width * 4, NULL, &dstSize);
|
||||
decompressedBitmap = (BYTE *) malloc(width * height * 4);
|
||||
decompressedBitmap = (BYTE*) malloc(width * height * 4);
|
||||
ZeroMemory(decompressedBitmap, width * height * 4);
|
||||
|
||||
if (!bitmap_decompress(compressedBitmap, decompressedBitmap, width, height, dstSize, 32, 32))
|
||||
@ -3269,13 +3269,13 @@ int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
}
|
||||
|
||||
fill_bitmap_alpha_channel(decompressedBitmap, width, height, 0xFF);
|
||||
fill_bitmap_alpha_channel((BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_02, width, height, 0xFF);
|
||||
fill_bitmap_alpha_channel((BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_02, width, height, 0xFF);
|
||||
|
||||
if (memcmp(decompressedBitmap, (BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_02, width * height * 4) != 0)
|
||||
if (memcmp(decompressedBitmap, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_02, width * height * 4) != 0)
|
||||
{
|
||||
#if 0
|
||||
printf("experimental bitmap 02\n");
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, (BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_02, width * height * 4);
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_02, width * height * 4);
|
||||
printf("decompressed bitmap\n");
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, decompressedBitmap, width * height * 4);
|
||||
#endif
|
||||
@ -3295,9 +3295,9 @@ int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
/* Experimental Case 03 */
|
||||
width = 64;
|
||||
height = 64;
|
||||
compressedBitmap = freerdp_bitmap_compress_planar(planar, (BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_03,
|
||||
compressedBitmap = freerdp_bitmap_compress_planar(planar, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_03,
|
||||
format, width, height, width * 4, NULL, &dstSize);
|
||||
decompressedBitmap = (BYTE *) malloc(width * height * 4);
|
||||
decompressedBitmap = (BYTE*) malloc(width * height * 4);
|
||||
ZeroMemory(decompressedBitmap, width * height * 4);
|
||||
|
||||
if (!bitmap_decompress(compressedBitmap, decompressedBitmap, width, height, dstSize, 32, 32))
|
||||
@ -3311,13 +3311,13 @@ int TestFreeRDPCodecPlanar(int argc, char *argv[])
|
||||
}
|
||||
|
||||
fill_bitmap_alpha_channel(decompressedBitmap, width, height, 0xFF);
|
||||
fill_bitmap_alpha_channel((BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_03, width, height, 0xFF);
|
||||
fill_bitmap_alpha_channel((BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_03, width, height, 0xFF);
|
||||
|
||||
if (memcmp(decompressedBitmap, (BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_03, width * height * 4) != 0)
|
||||
if (memcmp(decompressedBitmap, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_03, width * height * 4) != 0)
|
||||
{
|
||||
#if 0
|
||||
printf("experimental bitmap 03\n");
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, (BYTE *) TEST_RLE_BITMAP_EXPERIMENTAL_03, width * height * 4);
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, (BYTE*) TEST_RLE_BITMAP_EXPERIMENTAL_03, width * height * 4);
|
||||
printf("decompressed bitmap\n");
|
||||
winpr_HexDump("codec.test", WLOG_DEBUG, decompressedBitmap, width * height * 4);
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
//#define WITH_BULK_DEBUG 1
|
||||
|
||||
const char *bulk_get_compression_flags_string(UINT32 flags)
|
||||
const char* bulk_get_compression_flags_string(UINT32 flags)
|
||||
{
|
||||
flags &= BULK_COMPRESSION_FLAGS_MASK;
|
||||
|
||||
@ -51,26 +51,26 @@ const char *bulk_get_compression_flags_string(UINT32 flags)
|
||||
return "PACKET_UNKNOWN";
|
||||
}
|
||||
|
||||
UINT32 bulk_compression_level(rdpBulk *bulk)
|
||||
UINT32 bulk_compression_level(rdpBulk* bulk)
|
||||
{
|
||||
rdpSettings *settings = bulk->context->settings;
|
||||
rdpSettings* settings = bulk->context->settings;
|
||||
bulk->CompressionLevel = (settings->CompressionLevel >= PACKET_COMPR_TYPE_RDP61) ?
|
||||
PACKET_COMPR_TYPE_RDP61 : settings->CompressionLevel;
|
||||
return bulk->CompressionLevel;
|
||||
}
|
||||
|
||||
UINT32 bulk_compression_max_size(rdpBulk *bulk)
|
||||
UINT32 bulk_compression_max_size(rdpBulk* bulk)
|
||||
{
|
||||
bulk_compression_level(bulk);
|
||||
bulk->CompressionMaxSize = (bulk->CompressionLevel < PACKET_COMPR_TYPE_64K) ? 8192 : 65536;
|
||||
return bulk->CompressionMaxSize;
|
||||
}
|
||||
|
||||
int bulk_compress_validate(rdpBulk *bulk, BYTE *pSrcData, UINT32 SrcSize, BYTE **ppDstData, UINT32 *pDstSize, UINT32 *pFlags)
|
||||
int bulk_compress_validate(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32* pFlags)
|
||||
{
|
||||
int status;
|
||||
BYTE *_pSrcData = NULL;
|
||||
BYTE *_pDstData = NULL;
|
||||
BYTE* _pSrcData = NULL;
|
||||
BYTE* _pDstData = NULL;
|
||||
UINT32 _SrcSize = 0;
|
||||
UINT32 _DstSize = 0;
|
||||
UINT32 _Flags = 0;
|
||||
@ -106,11 +106,11 @@ int bulk_compress_validate(rdpBulk *bulk, BYTE *pSrcData, UINT32 SrcSize, BYTE *
|
||||
return status;
|
||||
}
|
||||
|
||||
int bulk_decompress(rdpBulk *bulk, BYTE *pSrcData, UINT32 SrcSize, BYTE **ppDstData, UINT32 *pDstSize, UINT32 flags)
|
||||
int bulk_decompress(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32 flags)
|
||||
{
|
||||
UINT32 type;
|
||||
int status = -1;
|
||||
rdpMetrics *metrics;
|
||||
rdpMetrics* metrics;
|
||||
UINT32 CompressedBytes;
|
||||
UINT32 UncompressedBytes;
|
||||
double CompressionRatio;
|
||||
@ -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;
|
||||
@ -171,10 +175,10 @@ int bulk_decompress(rdpBulk *bulk, BYTE *pSrcData, UINT32 SrcSize, BYTE **ppDstD
|
||||
return status;
|
||||
}
|
||||
|
||||
int bulk_compress(rdpBulk *bulk, BYTE *pSrcData, UINT32 SrcSize, BYTE **ppDstData, UINT32 *pDstSize, UINT32 *pFlags)
|
||||
int bulk_compress(rdpBulk* bulk, BYTE* pSrcData, UINT32 SrcSize, BYTE** ppDstData, UINT32* pDstSize, UINT32* pFlags)
|
||||
{
|
||||
int status = -1;
|
||||
rdpMetrics *metrics;
|
||||
rdpMetrics* metrics;
|
||||
UINT32 CompressedBytes;
|
||||
UINT32 UncompressedBytes;
|
||||
double CompressionRatio;
|
||||
@ -236,7 +240,7 @@ int bulk_compress(rdpBulk *bulk, BYTE *pSrcData, UINT32 SrcSize, BYTE **ppDstDat
|
||||
return status;
|
||||
}
|
||||
|
||||
void bulk_reset(rdpBulk *bulk)
|
||||
void bulk_reset(rdpBulk* bulk)
|
||||
{
|
||||
mppc_context_reset(bulk->mppcSend, FALSE);
|
||||
mppc_context_reset(bulk->mppcRecv, FALSE);
|
||||
@ -246,10 +250,10 @@ void bulk_reset(rdpBulk *bulk)
|
||||
xcrush_context_reset(bulk->xcrushSend, FALSE);
|
||||
}
|
||||
|
||||
rdpBulk *bulk_new(rdpContext *context)
|
||||
rdpBulk* bulk_new(rdpContext* context)
|
||||
{
|
||||
rdpBulk *bulk;
|
||||
bulk = (rdpBulk *) calloc(1, sizeof(rdpBulk));
|
||||
rdpBulk* bulk;
|
||||
bulk = (rdpBulk*) calloc(1, sizeof(rdpBulk));
|
||||
|
||||
if (bulk)
|
||||
{
|
||||
@ -266,7 +270,7 @@ rdpBulk *bulk_new(rdpContext *context)
|
||||
return bulk;
|
||||
}
|
||||
|
||||
void bulk_free(rdpBulk *bulk)
|
||||
void bulk_free(rdpBulk* bulk)
|
||||
{
|
||||
if (!bulk)
|
||||
return;
|
||||
|
@ -123,7 +123,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
static const char *certificate_read_errors[] =
|
||||
static const char* certificate_read_errors[] =
|
||||
{
|
||||
"Certificate tag",
|
||||
"TBSCertificate",
|
||||
@ -153,9 +153,9 @@ static const char *certificate_read_errors[] =
|
||||
* @param cert X.509 certificate
|
||||
*/
|
||||
|
||||
BOOL certificate_read_x509_certificate(rdpCertBlob *cert, rdpCertInfo *info)
|
||||
BOOL certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
BYTE padding;
|
||||
UINT32 version;
|
||||
@ -273,7 +273,7 @@ BOOL certificate_read_x509_certificate(rdpCertBlob *cert, rdpCertInfo *info)
|
||||
goto error1;
|
||||
|
||||
info->ModulusLength = modulus_length;
|
||||
info->Modulus = (BYTE *) malloc(info->ModulusLength);
|
||||
info->Modulus = (BYTE*) malloc(info->ModulusLength);
|
||||
|
||||
if (!info->Modulus)
|
||||
goto error1;
|
||||
@ -309,16 +309,16 @@ error1:
|
||||
* @return new X.509 certificate chain
|
||||
*/
|
||||
|
||||
rdpX509CertChain *certificate_new_x509_certificate_chain(UINT32 count)
|
||||
rdpX509CertChain* certificate_new_x509_certificate_chain(UINT32 count)
|
||||
{
|
||||
rdpX509CertChain *x509_cert_chain;
|
||||
x509_cert_chain = (rdpX509CertChain *)malloc(sizeof(rdpX509CertChain));
|
||||
rdpX509CertChain* x509_cert_chain;
|
||||
x509_cert_chain = (rdpX509CertChain*)malloc(sizeof(rdpX509CertChain));
|
||||
|
||||
if (!x509_cert_chain)
|
||||
return NULL;
|
||||
|
||||
x509_cert_chain->count = count;
|
||||
x509_cert_chain->array = (rdpCertBlob *)calloc(count, sizeof(rdpCertBlob));
|
||||
x509_cert_chain->array = (rdpCertBlob*)calloc(count, sizeof(rdpCertBlob));
|
||||
|
||||
if (!x509_cert_chain->array)
|
||||
{
|
||||
@ -334,7 +334,7 @@ rdpX509CertChain *certificate_new_x509_certificate_chain(UINT32 count)
|
||||
* @param x509_cert_chain X.509 certificate chain to be freed
|
||||
*/
|
||||
|
||||
void certificate_free_x509_certificate_chain(rdpX509CertChain *x509_cert_chain)
|
||||
void certificate_free_x509_certificate_chain(rdpX509CertChain* x509_cert_chain)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -351,7 +351,7 @@ void certificate_free_x509_certificate_chain(rdpX509CertChain *x509_cert_chain)
|
||||
free(x509_cert_chain);
|
||||
}
|
||||
|
||||
static BOOL certificate_process_server_public_key(rdpCertificate *certificate, wStream *s, UINT32 length)
|
||||
static BOOL certificate_process_server_public_key(rdpCertificate* certificate, wStream* s, UINT32 length)
|
||||
{
|
||||
BYTE magic[4];
|
||||
UINT32 keylen;
|
||||
@ -391,8 +391,8 @@ static BOOL certificate_process_server_public_key(rdpCertificate *certificate, w
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL certificate_process_server_public_signature(rdpCertificate *certificate,
|
||||
const BYTE *sigdata, int sigdatalen, wStream *s, UINT32 siglen)
|
||||
static BOOL certificate_process_server_public_signature(rdpCertificate* certificate,
|
||||
const BYTE* sigdata, int sigdatalen, wStream* s, UINT32 siglen)
|
||||
{
|
||||
int i, sum;
|
||||
CryptoMd5 md5ctx;
|
||||
@ -455,7 +455,7 @@ static BOOL certificate_process_server_public_signature(rdpCertificate *certific
|
||||
* @param s stream
|
||||
*/
|
||||
|
||||
BOOL certificate_read_server_proprietary_certificate(rdpCertificate *certificate, wStream *s)
|
||||
BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate, wStream* s)
|
||||
{
|
||||
UINT32 dwSigAlgId;
|
||||
UINT32 dwKeyAlgId;
|
||||
@ -463,7 +463,7 @@ BOOL certificate_read_server_proprietary_certificate(rdpCertificate *certificate
|
||||
UINT32 wPublicKeyBlobLen;
|
||||
UINT32 wSignatureBlobType;
|
||||
UINT32 wSignatureBlobLen;
|
||||
BYTE *sigdata;
|
||||
BYTE* sigdata;
|
||||
int sigdatalen;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 12)
|
||||
@ -541,7 +541,7 @@ BOOL certificate_read_server_proprietary_certificate(rdpCertificate *certificate
|
||||
* @param s stream
|
||||
*/
|
||||
|
||||
BOOL certificate_read_server_x509_certificate_chain(rdpCertificate *certificate, wStream *s)
|
||||
BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate, wStream* s)
|
||||
{
|
||||
int i;
|
||||
UINT32 certLength;
|
||||
@ -569,7 +569,7 @@ BOOL certificate_read_server_x509_certificate_chain(rdpCertificate *certificate,
|
||||
return FALSE;
|
||||
|
||||
DEBUG_CERTIFICATE("\nX.509 Certificate #%d, length:%d", i + 1, certLength);
|
||||
certificate->x509_cert_chain->array[i].data = (BYTE *) malloc(certLength);
|
||||
certificate->x509_cert_chain->array[i].data = (BYTE*) malloc(certLength);
|
||||
|
||||
if (!certificate->x509_cert_chain->array[i].data)
|
||||
return FALSE;
|
||||
@ -615,9 +615,9 @@ BOOL certificate_read_server_x509_certificate_chain(rdpCertificate *certificate,
|
||||
* @param length certificate length
|
||||
*/
|
||||
|
||||
BOOL certificate_read_server_certificate(rdpCertificate *certificate, BYTE *server_cert, int length)
|
||||
BOOL certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, int length)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
UINT32 dwVersion;
|
||||
BOOL ret;
|
||||
|
||||
@ -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;
|
||||
@ -645,12 +647,12 @@ BOOL certificate_read_server_certificate(rdpCertificate *certificate, BYTE *serv
|
||||
return ret;
|
||||
}
|
||||
|
||||
rdpRsaKey *key_new(const char *keyfile)
|
||||
rdpRsaKey* key_new(const char* keyfile)
|
||||
{
|
||||
FILE *fp;
|
||||
RSA *rsa;
|
||||
rdpRsaKey *key;
|
||||
key = (rdpRsaKey *)calloc(1, sizeof(rdpRsaKey));
|
||||
FILE* fp;
|
||||
RSA* rsa;
|
||||
rdpRsaKey* key;
|
||||
key = (rdpRsaKey*)calloc(1, sizeof(rdpRsaKey));
|
||||
|
||||
if (!key)
|
||||
return NULL;
|
||||
@ -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);
|
||||
@ -696,7 +700,7 @@ rdpRsaKey *key_new(const char *keyfile)
|
||||
}
|
||||
|
||||
key->ModulusLength = BN_num_bytes(rsa->n);
|
||||
key->Modulus = (BYTE *)malloc(key->ModulusLength);
|
||||
key->Modulus = (BYTE*)malloc(key->ModulusLength);
|
||||
|
||||
if (!key->Modulus)
|
||||
goto out_free_rsa;
|
||||
@ -704,7 +708,7 @@ rdpRsaKey *key_new(const char *keyfile)
|
||||
BN_bn2bin(rsa->n, key->Modulus);
|
||||
crypto_reverse(key->Modulus, key->ModulusLength);
|
||||
key->PrivateExponentLength = BN_num_bytes(rsa->d);
|
||||
key->PrivateExponent = (BYTE *)malloc(key->PrivateExponentLength);
|
||||
key->PrivateExponent = (BYTE*)malloc(key->PrivateExponentLength);
|
||||
|
||||
if (!key->PrivateExponent)
|
||||
goto out_free_modulus;
|
||||
@ -725,7 +729,7 @@ out_free:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void key_free(rdpRsaKey *key)
|
||||
void key_free(rdpRsaKey* key)
|
||||
{
|
||||
if (!key)
|
||||
return;
|
||||
@ -743,9 +747,9 @@ void key_free(rdpRsaKey *key)
|
||||
* @return new certificate module
|
||||
*/
|
||||
|
||||
rdpCertificate *certificate_new()
|
||||
rdpCertificate* certificate_new()
|
||||
{
|
||||
return (rdpCertificate *) calloc(1, sizeof(rdpCertificate));
|
||||
return (rdpCertificate*) calloc(1, sizeof(rdpCertificate));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -753,7 +757,7 @@ rdpCertificate *certificate_new()
|
||||
* @param certificate certificate module to be freed
|
||||
*/
|
||||
|
||||
void certificate_free(rdpCertificate *certificate)
|
||||
void certificate_free(rdpCertificate* certificate)
|
||||
{
|
||||
if (!certificate)
|
||||
return;
|
||||
|
@ -36,12 +36,12 @@
|
||||
|
||||
#define TAG "gateway"
|
||||
|
||||
HttpContext *http_context_new()
|
||||
HttpContext* http_context_new()
|
||||
{
|
||||
return (HttpContext *)calloc(1, sizeof(HttpContext));
|
||||
return (HttpContext*)calloc(1, sizeof(HttpContext));
|
||||
}
|
||||
|
||||
void http_context_set_method(HttpContext *http_context, char *method)
|
||||
void http_context_set_method(HttpContext* http_context, char* method)
|
||||
{
|
||||
if (http_context->Method)
|
||||
free(http_context->Method);
|
||||
@ -50,7 +50,7 @@ void http_context_set_method(HttpContext *http_context, char *method)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_context_set_uri(HttpContext *http_context, char *uri)
|
||||
void http_context_set_uri(HttpContext* http_context, char* uri)
|
||||
{
|
||||
if (http_context->URI)
|
||||
free(http_context->URI);
|
||||
@ -59,7 +59,7 @@ void http_context_set_uri(HttpContext *http_context, char *uri)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_context_set_user_agent(HttpContext *http_context, char *user_agent)
|
||||
void http_context_set_user_agent(HttpContext* http_context, char* user_agent)
|
||||
{
|
||||
if (http_context->UserAgent)
|
||||
free(http_context->UserAgent);
|
||||
@ -68,7 +68,7 @@ void http_context_set_user_agent(HttpContext *http_context, char *user_agent)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_context_set_host(HttpContext *http_context, char *host)
|
||||
void http_context_set_host(HttpContext* http_context, char* host)
|
||||
{
|
||||
if (http_context->Host)
|
||||
free(http_context->Host);
|
||||
@ -77,7 +77,7 @@ void http_context_set_host(HttpContext *http_context, char *host)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_context_set_accept(HttpContext *http_context, char *accept)
|
||||
void http_context_set_accept(HttpContext* http_context, char* accept)
|
||||
{
|
||||
if (http_context->Accept)
|
||||
free(http_context->Accept);
|
||||
@ -86,7 +86,7 @@ void http_context_set_accept(HttpContext *http_context, char *accept)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_context_set_cache_control(HttpContext *http_context, char *cache_control)
|
||||
void http_context_set_cache_control(HttpContext* http_context, char* cache_control)
|
||||
{
|
||||
if (http_context->CacheControl)
|
||||
free(http_context->CacheControl);
|
||||
@ -95,7 +95,7 @@ void http_context_set_cache_control(HttpContext *http_context, char *cache_contr
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_context_set_connection(HttpContext *http_context, char *connection)
|
||||
void http_context_set_connection(HttpContext* http_context, char* connection)
|
||||
{
|
||||
if (http_context->Connection)
|
||||
free(http_context->Connection);
|
||||
@ -104,7 +104,7 @@ void http_context_set_connection(HttpContext *http_context, char *connection)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_context_set_pragma(HttpContext *http_context, char *pragma)
|
||||
void http_context_set_pragma(HttpContext* http_context, char* pragma)
|
||||
{
|
||||
if (http_context->Pragma)
|
||||
free(http_context->Pragma);
|
||||
@ -113,7 +113,7 @@ void http_context_set_pragma(HttpContext *http_context, char *pragma)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_context_free(HttpContext *http_context)
|
||||
void http_context_free(HttpContext* http_context)
|
||||
{
|
||||
if (http_context != NULL)
|
||||
{
|
||||
@ -129,7 +129,7 @@ void http_context_free(HttpContext *http_context)
|
||||
}
|
||||
}
|
||||
|
||||
void http_request_set_method(HttpRequest *http_request, char *method)
|
||||
void http_request_set_method(HttpRequest* http_request, char* method)
|
||||
{
|
||||
if (http_request->Method)
|
||||
free(http_request->Method);
|
||||
@ -138,7 +138,7 @@ void http_request_set_method(HttpRequest *http_request, char *method)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_request_set_uri(HttpRequest *http_request, char *uri)
|
||||
void http_request_set_uri(HttpRequest* http_request, char* uri)
|
||||
{
|
||||
if (http_request->URI)
|
||||
free(http_request->URI);
|
||||
@ -147,7 +147,7 @@ void http_request_set_uri(HttpRequest *http_request, char *uri)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_request_set_auth_scheme(HttpRequest *http_request, char *auth_scheme)
|
||||
void http_request_set_auth_scheme(HttpRequest* http_request, char* auth_scheme)
|
||||
{
|
||||
if (http_request->AuthScheme)
|
||||
free(http_request->AuthScheme);
|
||||
@ -156,7 +156,7 @@ void http_request_set_auth_scheme(HttpRequest *http_request, char *auth_scheme)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
void http_request_set_auth_param(HttpRequest *http_request, char *auth_param)
|
||||
void http_request_set_auth_param(HttpRequest* http_request, char* auth_param)
|
||||
{
|
||||
if (http_request->AuthParam)
|
||||
free(http_request->AuthParam);
|
||||
@ -165,12 +165,12 @@ void http_request_set_auth_param(HttpRequest *http_request, char *auth_param)
|
||||
// TODO: check result
|
||||
}
|
||||
|
||||
char *http_encode_body_line(char *param, char *value)
|
||||
char* http_encode_body_line(char* param, char* value)
|
||||
{
|
||||
char *line;
|
||||
char* line;
|
||||
int length;
|
||||
length = strlen(param) + strlen(value) + 2;
|
||||
line = (char *) malloc(length + 1);
|
||||
line = (char*) malloc(length + 1);
|
||||
|
||||
if (!line)
|
||||
return NULL;
|
||||
@ -179,14 +179,14 @@ char *http_encode_body_line(char *param, char *value)
|
||||
return line;
|
||||
}
|
||||
|
||||
char *http_encode_content_length_line(int ContentLength)
|
||||
char* http_encode_content_length_line(int ContentLength)
|
||||
{
|
||||
char *line;
|
||||
char* line;
|
||||
int length;
|
||||
char str[32];
|
||||
_itoa_s(ContentLength, str, sizeof(str), 10);
|
||||
length = strlen("Content-Length") + strlen(str) + 2;
|
||||
line = (char *)malloc(length + 1);
|
||||
line = (char*)malloc(length + 1);
|
||||
|
||||
if (!line)
|
||||
return NULL;
|
||||
@ -195,12 +195,12 @@ char *http_encode_content_length_line(int ContentLength)
|
||||
return line;
|
||||
}
|
||||
|
||||
char *http_encode_header_line(char *Method, char *URI)
|
||||
char* http_encode_header_line(char* Method, char* URI)
|
||||
{
|
||||
char *line;
|
||||
char* line;
|
||||
int length;
|
||||
length = strlen("HTTP/1.1") + strlen(Method) + strlen(URI) + 2;
|
||||
line = (char *)malloc(length + 1);
|
||||
line = (char*)malloc(length + 1);
|
||||
|
||||
if (!line)
|
||||
return NULL;
|
||||
@ -209,12 +209,12 @@ char *http_encode_header_line(char *Method, char *URI)
|
||||
return line;
|
||||
}
|
||||
|
||||
char *http_encode_authorization_line(char *AuthScheme, char *AuthParam)
|
||||
char* http_encode_authorization_line(char* AuthScheme, char* AuthParam)
|
||||
{
|
||||
char *line;
|
||||
char* line;
|
||||
int length;
|
||||
length = strlen("Authorization") + strlen(AuthScheme) + strlen(AuthParam) + 3;
|
||||
line = (char *) malloc(length + 1);
|
||||
line = (char*) malloc(length + 1);
|
||||
|
||||
if (!line)
|
||||
return NULL;
|
||||
@ -223,14 +223,14 @@ char *http_encode_authorization_line(char *AuthScheme, char *AuthParam)
|
||||
return line;
|
||||
}
|
||||
|
||||
wStream *http_request_write(HttpContext *http_context, HttpRequest *http_request)
|
||||
wStream* http_request_write(HttpContext* http_context, HttpRequest* http_request)
|
||||
{
|
||||
int i, count;
|
||||
char **lines;
|
||||
wStream *s;
|
||||
char** lines;
|
||||
wStream* s;
|
||||
int length = 0;
|
||||
count = 9;
|
||||
lines = (char **)calloc(count, sizeof(char *));
|
||||
lines = (char**)calloc(count, sizeof(char*));
|
||||
|
||||
if (!lines)
|
||||
return NULL;
|
||||
@ -303,12 +303,12 @@ out_free:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HttpRequest *http_request_new()
|
||||
HttpRequest* http_request_new()
|
||||
{
|
||||
return (HttpRequest *) calloc(1, sizeof(HttpRequest));
|
||||
return (HttpRequest*) calloc(1, sizeof(HttpRequest));
|
||||
}
|
||||
|
||||
void http_request_free(HttpRequest *http_request)
|
||||
void http_request_free(HttpRequest* http_request)
|
||||
{
|
||||
if (!http_request)
|
||||
return;
|
||||
@ -328,11 +328,11 @@ void http_request_free(HttpRequest *http_request)
|
||||
free(http_request);
|
||||
}
|
||||
|
||||
BOOL http_response_parse_header_status_line(HttpResponse *http_response, char *status_line)
|
||||
BOOL http_response_parse_header_status_line(HttpResponse* http_response, char* status_line)
|
||||
{
|
||||
char *separator;
|
||||
char *status_code;
|
||||
char *reason_phrase;
|
||||
char* separator;
|
||||
char* status_code;
|
||||
char* reason_phrase;
|
||||
separator = strchr(status_line, ' ');
|
||||
|
||||
if (!separator)
|
||||
@ -356,7 +356,7 @@ BOOL http_response_parse_header_status_line(HttpResponse *http_response, char *s
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL http_response_parse_header_field(HttpResponse *http_response, char *name, char *value)
|
||||
BOOL http_response_parse_header_field(HttpResponse* http_response, char* name, char* value)
|
||||
{
|
||||
if (_stricmp(name, "Content-Length") == 0)
|
||||
{
|
||||
@ -364,8 +364,8 @@ BOOL http_response_parse_header_field(HttpResponse *http_response, char *name, c
|
||||
}
|
||||
else if (_stricmp(name, "WWW-Authenticate") == 0)
|
||||
{
|
||||
char *separator;
|
||||
char *authScheme, *authValue;
|
||||
char* separator;
|
||||
char* authScheme, *authValue;
|
||||
separator = strchr(value, ' ');
|
||||
|
||||
if (separator != NULL)
|
||||
@ -401,14 +401,14 @@ BOOL http_response_parse_header_field(HttpResponse *http_response, char *name, c
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL http_response_parse_header(HttpResponse *http_response)
|
||||
BOOL http_response_parse_header(HttpResponse* http_response)
|
||||
{
|
||||
int count;
|
||||
char *line;
|
||||
char *name;
|
||||
char *value;
|
||||
char *colon_pos;
|
||||
char *end_of_header;
|
||||
char* line;
|
||||
char* name;
|
||||
char* value;
|
||||
char* colon_pos;
|
||||
char* end_of_header;
|
||||
char end_of_header_char;
|
||||
char c;
|
||||
|
||||
@ -470,7 +470,7 @@ BOOL http_response_parse_header(HttpResponse *http_response)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void http_response_print(HttpResponse *http_response)
|
||||
void http_response_print(HttpResponse* http_response)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -482,16 +482,16 @@ void http_response_print(HttpResponse *http_response)
|
||||
DEBUG_WARN("\n");
|
||||
}
|
||||
|
||||
HttpResponse *http_response_recv(rdpTls *tls)
|
||||
HttpResponse* http_response_recv(rdpTls* tls)
|
||||
{
|
||||
BYTE *p;
|
||||
BYTE* p;
|
||||
int nbytes;
|
||||
int length;
|
||||
int status;
|
||||
BYTE *buffer;
|
||||
char *content;
|
||||
char *header_end;
|
||||
HttpResponse *http_response;
|
||||
BYTE* buffer;
|
||||
char* content;
|
||||
char* header_end;
|
||||
HttpResponse* http_response;
|
||||
nbytes = 0;
|
||||
length = 10000;
|
||||
content = NULL;
|
||||
@ -527,10 +527,10 @@ HttpResponse *http_response_recv(rdpTls *tls)
|
||||
VALGRIND_MAKE_MEM_DEFINED(p, status);
|
||||
#endif
|
||||
nbytes += status;
|
||||
p = (BYTE *) &buffer[nbytes];
|
||||
p = (BYTE*) &buffer[nbytes];
|
||||
}
|
||||
|
||||
header_end = strstr((char *) buffer, "\r\n\r\n");
|
||||
header_end = strstr((char*) buffer, "\r\n\r\n");
|
||||
|
||||
if (!header_end)
|
||||
{
|
||||
@ -544,12 +544,12 @@ HttpResponse *http_response_recv(rdpTls *tls)
|
||||
if (header_end != NULL)
|
||||
{
|
||||
int count;
|
||||
char *line;
|
||||
char* line;
|
||||
header_end[0] = '\0';
|
||||
header_end[1] = '\0';
|
||||
content = header_end + 2;
|
||||
count = 0;
|
||||
line = (char *) buffer;
|
||||
line = (char*) buffer;
|
||||
|
||||
while ((line = strstr(line, "\r\n")) != NULL)
|
||||
{
|
||||
@ -561,14 +561,14 @@ HttpResponse *http_response_recv(rdpTls *tls)
|
||||
|
||||
if (count)
|
||||
{
|
||||
http_response->lines = (char **)calloc(http_response->count, sizeof(char *));
|
||||
http_response->lines = (char**)calloc(http_response->count, sizeof(char*));
|
||||
|
||||
if (!http_response->lines)
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
line = strtok((char *) buffer, "\r\n");
|
||||
line = strtok((char*) buffer, "\r\n");
|
||||
|
||||
while (line != NULL)
|
||||
{
|
||||
@ -584,11 +584,11 @@ HttpResponse *http_response_recv(rdpTls *tls)
|
||||
if (!http_response_parse_header(http_response))
|
||||
goto out_error;
|
||||
|
||||
http_response->bodyLen = nbytes - (content - (char *)buffer);
|
||||
http_response->bodyLen = nbytes - (content - (char*)buffer);
|
||||
|
||||
if (http_response->bodyLen > 0)
|
||||
{
|
||||
http_response->BodyContent = (BYTE *)malloc(http_response->bodyLen);
|
||||
http_response->BodyContent = (BYTE*)malloc(http_response->bodyLen);
|
||||
|
||||
if (!http_response->BodyContent)
|
||||
goto out_error;
|
||||
@ -603,7 +603,7 @@ HttpResponse *http_response_recv(rdpTls *tls)
|
||||
{
|
||||
length *= 2;
|
||||
buffer = realloc(buffer, length);
|
||||
p = (BYTE *) &buffer[nbytes];
|
||||
p = (BYTE*) &buffer[nbytes];
|
||||
}
|
||||
}
|
||||
|
||||
@ -616,7 +616,7 @@ out_free:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static BOOL strings_equals_nocase(void *obj1, void *obj2)
|
||||
static BOOL strings_equals_nocase(void* obj1, void* obj2)
|
||||
{
|
||||
if (!obj1 || !obj2)
|
||||
return FALSE;
|
||||
@ -624,7 +624,7 @@ static BOOL strings_equals_nocase(void *obj1, void *obj2)
|
||||
return _stricmp(obj1, obj2) == 0;
|
||||
}
|
||||
|
||||
static void string_free(void *obj1)
|
||||
static void string_free(void* obj1)
|
||||
{
|
||||
if (!obj1)
|
||||
return;
|
||||
@ -632,9 +632,9 @@ static void string_free(void *obj1)
|
||||
free(obj1);
|
||||
}
|
||||
|
||||
HttpResponse *http_response_new()
|
||||
HttpResponse* http_response_new()
|
||||
{
|
||||
HttpResponse *ret = (HttpResponse *)calloc(1, sizeof(HttpResponse));
|
||||
HttpResponse* ret = (HttpResponse*)calloc(1, sizeof(HttpResponse));
|
||||
|
||||
if (!ret)
|
||||
return NULL;
|
||||
@ -647,7 +647,7 @@ HttpResponse *http_response_new()
|
||||
return ret;
|
||||
}
|
||||
|
||||
void http_response_free(HttpResponse *http_response)
|
||||
void http_response_free(HttpResponse* http_response)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -40,9 +40,9 @@
|
||||
#define TAG "gateway"
|
||||
#define SYNCHRONOUS_TIMEOUT 5000
|
||||
|
||||
wStream *rpc_client_fragment_pool_take(rdpRpc *rpc)
|
||||
wStream* rpc_client_fragment_pool_take(rdpRpc* rpc)
|
||||
{
|
||||
wStream *fragment = NULL;
|
||||
wStream* fragment = NULL;
|
||||
|
||||
if (WaitForSingleObject(Queue_Event(rpc->client->FragmentPool), 0) == WAIT_OBJECT_0)
|
||||
fragment = Queue_Dequeue(rpc->client->FragmentPool);
|
||||
@ -53,22 +53,22 @@ wStream *rpc_client_fragment_pool_take(rdpRpc *rpc)
|
||||
return fragment;
|
||||
}
|
||||
|
||||
int rpc_client_fragment_pool_return(rdpRpc *rpc, wStream *fragment)
|
||||
int rpc_client_fragment_pool_return(rdpRpc* rpc, wStream* fragment)
|
||||
{
|
||||
Queue_Enqueue(rpc->client->FragmentPool, fragment);
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_PDU *rpc_client_receive_pool_take(rdpRpc *rpc)
|
||||
RPC_PDU* rpc_client_receive_pool_take(rdpRpc* rpc)
|
||||
{
|
||||
RPC_PDU *pdu = NULL;
|
||||
RPC_PDU* pdu = NULL;
|
||||
|
||||
if (WaitForSingleObject(Queue_Event(rpc->client->ReceivePool), 0) == WAIT_OBJECT_0)
|
||||
pdu = Queue_Dequeue(rpc->client->ReceivePool);
|
||||
|
||||
if (!pdu)
|
||||
{
|
||||
pdu = (RPC_PDU *)malloc(sizeof(RPC_PDU));
|
||||
pdu = (RPC_PDU*)malloc(sizeof(RPC_PDU));
|
||||
|
||||
if (!pdu)
|
||||
return NULL;
|
||||
@ -89,27 +89,27 @@ RPC_PDU *rpc_client_receive_pool_take(rdpRpc *rpc)
|
||||
return pdu;
|
||||
}
|
||||
|
||||
int rpc_client_receive_pool_return(rdpRpc *rpc, RPC_PDU *pdu)
|
||||
int rpc_client_receive_pool_return(rdpRpc* rpc, RPC_PDU* pdu)
|
||||
{
|
||||
return Queue_Enqueue(rpc->client->ReceivePool, pdu) == TRUE ? 0 : -1;
|
||||
}
|
||||
|
||||
int rpc_client_on_fragment_received_event(rdpRpc *rpc)
|
||||
int rpc_client_on_fragment_received_event(rdpRpc* rpc)
|
||||
{
|
||||
BYTE *buffer;
|
||||
BYTE* buffer;
|
||||
UINT32 StubOffset;
|
||||
UINT32 StubLength;
|
||||
wStream *fragment;
|
||||
rpcconn_hdr_t *header;
|
||||
freerdp *instance;
|
||||
instance = (freerdp *)rpc->transport->settings->instance;
|
||||
wStream* fragment;
|
||||
rpcconn_hdr_t* header;
|
||||
freerdp* instance;
|
||||
instance = (freerdp*)rpc->transport->settings->instance;
|
||||
|
||||
if (!rpc->client->pdu)
|
||||
rpc->client->pdu = rpc_client_receive_pool_take(rpc);
|
||||
|
||||
fragment = Queue_Dequeue(rpc->client->FragmentQueue);
|
||||
buffer = (BYTE *) Stream_Buffer(fragment);
|
||||
header = (rpcconn_hdr_t *) Stream_Buffer(fragment);
|
||||
buffer = (BYTE*) Stream_Buffer(fragment);
|
||||
header = (rpcconn_hdr_t*) Stream_Buffer(fragment);
|
||||
|
||||
if (rpc->State < RPC_CLIENT_STATE_CONTEXT_NEGOTIATED)
|
||||
{
|
||||
@ -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);
|
||||
@ -182,8 +184,8 @@ int rpc_client_on_fragment_received_event(rdpRpc *rpc)
|
||||
}
|
||||
|
||||
Stream_EnsureCapacity(rpc->client->pdu->s, header->response.alloc_hint);
|
||||
buffer = (BYTE *) Stream_Buffer(fragment);
|
||||
header = (rpcconn_hdr_t *) Stream_Buffer(fragment);
|
||||
buffer = (BYTE*) Stream_Buffer(fragment);
|
||||
header = (rpcconn_hdr_t*) Stream_Buffer(fragment);
|
||||
|
||||
if (rpc->StubFragCount == 0)
|
||||
rpc->StubCallId = header->common.call_id;
|
||||
@ -225,11 +227,11 @@ int rpc_client_on_fragment_received_event(rdpRpc *rpc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rpc_client_on_read_event(rdpRpc *rpc)
|
||||
int rpc_client_on_read_event(rdpRpc* rpc)
|
||||
{
|
||||
int position;
|
||||
int status = -1;
|
||||
rpcconn_common_hdr_t *header;
|
||||
rpcconn_common_hdr_t* header;
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -258,7 +260,7 @@ int rpc_client_on_read_event(rdpRpc *rpc)
|
||||
if (Stream_GetPosition(rpc->client->RecvFrag) < RPC_COMMON_FIELDS_LENGTH)
|
||||
return status;
|
||||
|
||||
header = (rpcconn_common_hdr_t *) Stream_Buffer(rpc->client->RecvFrag);
|
||||
header = (rpcconn_common_hdr_t*) Stream_Buffer(rpc->client->RecvFrag);
|
||||
|
||||
if (header->frag_length > rpc->max_recv_frag)
|
||||
{
|
||||
@ -311,18 +313,18 @@ int rpc_client_on_read_event(rdpRpc *rpc)
|
||||
* http://msdn.microsoft.com/en-us/library/gg593159/
|
||||
*/
|
||||
|
||||
RpcClientCall *rpc_client_call_find_by_id(rdpRpc *rpc, UINT32 CallId)
|
||||
RpcClientCall* rpc_client_call_find_by_id(rdpRpc* rpc, UINT32 CallId)
|
||||
{
|
||||
int index;
|
||||
int count;
|
||||
RpcClientCall *clientCall;
|
||||
RpcClientCall* clientCall;
|
||||
ArrayList_Lock(rpc->client->ClientCallList);
|
||||
clientCall = NULL;
|
||||
count = ArrayList_Count(rpc->client->ClientCallList);
|
||||
|
||||
for (index = 0; index < count; index++)
|
||||
{
|
||||
clientCall = (RpcClientCall *) ArrayList_GetItem(rpc->client->ClientCallList, index);
|
||||
clientCall = (RpcClientCall*) ArrayList_GetItem(rpc->client->ClientCallList, index);
|
||||
|
||||
if (clientCall->CallId == CallId)
|
||||
break;
|
||||
@ -332,10 +334,10 @@ RpcClientCall *rpc_client_call_find_by_id(rdpRpc *rpc, UINT32 CallId)
|
||||
return clientCall;
|
||||
}
|
||||
|
||||
RpcClientCall *rpc_client_call_new(UINT32 CallId, UINT32 OpNum)
|
||||
RpcClientCall* rpc_client_call_new(UINT32 CallId, UINT32 OpNum)
|
||||
{
|
||||
RpcClientCall *clientCall;
|
||||
clientCall = (RpcClientCall *) malloc(sizeof(RpcClientCall));
|
||||
RpcClientCall* clientCall;
|
||||
clientCall = (RpcClientCall*) malloc(sizeof(RpcClientCall));
|
||||
|
||||
if (!clientCall)
|
||||
return NULL;
|
||||
@ -346,16 +348,16 @@ RpcClientCall *rpc_client_call_new(UINT32 CallId, UINT32 OpNum)
|
||||
return clientCall;
|
||||
}
|
||||
|
||||
void rpc_client_call_free(RpcClientCall *clientCall)
|
||||
void rpc_client_call_free(RpcClientCall* clientCall)
|
||||
{
|
||||
free(clientCall);
|
||||
}
|
||||
|
||||
int rpc_send_enqueue_pdu(rdpRpc *rpc, BYTE *buffer, UINT32 length)
|
||||
int rpc_send_enqueue_pdu(rdpRpc* rpc, BYTE* buffer, UINT32 length)
|
||||
{
|
||||
RPC_PDU *pdu;
|
||||
RPC_PDU* pdu;
|
||||
int status;
|
||||
pdu = (RPC_PDU *) malloc(sizeof(RPC_PDU));
|
||||
pdu = (RPC_PDU*) malloc(sizeof(RPC_PDU));
|
||||
|
||||
if (!pdu)
|
||||
return -1;
|
||||
@ -389,14 +391,14 @@ out_free:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rpc_send_dequeue_pdu(rdpRpc *rpc)
|
||||
int rpc_send_dequeue_pdu(rdpRpc* rpc)
|
||||
{
|
||||
int status;
|
||||
RPC_PDU *pdu;
|
||||
RpcClientCall *clientCall;
|
||||
rpcconn_common_hdr_t *header;
|
||||
RpcInChannel *inChannel;
|
||||
pdu = (RPC_PDU *) Queue_Dequeue(rpc->client->SendQueue);
|
||||
RPC_PDU* pdu;
|
||||
RpcClientCall* clientCall;
|
||||
rpcconn_common_hdr_t* header;
|
||||
RpcInChannel* inChannel;
|
||||
pdu = (RPC_PDU*) Queue_Dequeue(rpc->client->SendQueue);
|
||||
|
||||
if (!pdu)
|
||||
return 0;
|
||||
@ -404,7 +406,7 @@ int rpc_send_dequeue_pdu(rdpRpc *rpc)
|
||||
inChannel = rpc->VirtualConnection->DefaultInChannel;
|
||||
WaitForSingleObject(inChannel->Mutex, INFINITE);
|
||||
status = rpc_in_write(rpc, Stream_Buffer(pdu->s), Stream_Length(pdu->s));
|
||||
header = (rpcconn_common_hdr_t *) Stream_Buffer(pdu->s);
|
||||
header = (rpcconn_common_hdr_t*) Stream_Buffer(pdu->s);
|
||||
clientCall = rpc_client_call_find_by_id(rpc, header->call_id);
|
||||
clientCall->State = RPC_CLIENT_CALL_STATE_DISPATCHED;
|
||||
ReleaseMutex(inChannel->Mutex);
|
||||
@ -431,9 +433,9 @@ int rpc_send_dequeue_pdu(rdpRpc *rpc)
|
||||
return status;
|
||||
}
|
||||
|
||||
RPC_PDU *rpc_recv_dequeue_pdu(rdpRpc *rpc)
|
||||
RPC_PDU* rpc_recv_dequeue_pdu(rdpRpc* rpc)
|
||||
{
|
||||
RPC_PDU *pdu;
|
||||
RPC_PDU* pdu;
|
||||
DWORD dwMilliseconds;
|
||||
DWORD result;
|
||||
dwMilliseconds = rpc->client->SynchronousReceive ? SYNCHRONOUS_TIMEOUT * 4 : 0;
|
||||
@ -448,7 +450,7 @@ RPC_PDU *rpc_recv_dequeue_pdu(rdpRpc *rpc)
|
||||
if (result != WAIT_OBJECT_0)
|
||||
return NULL;
|
||||
|
||||
pdu = (RPC_PDU *)Queue_Dequeue(rpc->client->ReceiveQueue);
|
||||
pdu = (RPC_PDU*)Queue_Dequeue(rpc->client->ReceiveQueue);
|
||||
#ifdef WITH_DEBUG_TSG
|
||||
|
||||
if (pdu)
|
||||
@ -466,7 +468,7 @@ RPC_PDU *rpc_recv_dequeue_pdu(rdpRpc *rpc)
|
||||
return pdu;
|
||||
}
|
||||
|
||||
RPC_PDU *rpc_recv_peek_pdu(rdpRpc *rpc)
|
||||
RPC_PDU* rpc_recv_peek_pdu(rdpRpc* rpc)
|
||||
{
|
||||
DWORD dwMilliseconds;
|
||||
DWORD result;
|
||||
@ -476,18 +478,18 @@ RPC_PDU *rpc_recv_peek_pdu(rdpRpc *rpc)
|
||||
if (result != WAIT_OBJECT_0)
|
||||
return NULL;
|
||||
|
||||
return (RPC_PDU *)Queue_Peek(rpc->client->ReceiveQueue);
|
||||
return (RPC_PDU*)Queue_Peek(rpc->client->ReceiveQueue);
|
||||
}
|
||||
|
||||
static void *rpc_client_thread(void *arg)
|
||||
static void* rpc_client_thread(void* arg)
|
||||
{
|
||||
rdpRpc *rpc;
|
||||
rdpRpc* rpc;
|
||||
DWORD status;
|
||||
DWORD nCount;
|
||||
HANDLE events[3];
|
||||
HANDLE ReadEvent;
|
||||
int fd;
|
||||
rpc = (rdpRpc *) arg;
|
||||
rpc = (rdpRpc*) arg;
|
||||
fd = BIO_get_fd(rpc->TlsOut->bio, NULL);
|
||||
ReadEvent = CreateFileDescriptorEvent(NULL, TRUE, FALSE, fd);
|
||||
nCount = 0;
|
||||
@ -533,7 +535,7 @@ out:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void rpc_pdu_free(RPC_PDU *pdu)
|
||||
static void rpc_pdu_free(RPC_PDU* pdu)
|
||||
{
|
||||
if (!pdu)
|
||||
return;
|
||||
@ -542,15 +544,15 @@ static void rpc_pdu_free(RPC_PDU *pdu)
|
||||
free(pdu);
|
||||
}
|
||||
|
||||
static void rpc_fragment_free(wStream *fragment)
|
||||
static void rpc_fragment_free(wStream* fragment)
|
||||
{
|
||||
Stream_Free(fragment, TRUE);
|
||||
}
|
||||
|
||||
int rpc_client_new(rdpRpc *rpc)
|
||||
int rpc_client_new(rdpRpc* rpc)
|
||||
{
|
||||
RpcClient *client = NULL;
|
||||
client = (RpcClient *)calloc(1, sizeof(RpcClient));
|
||||
RpcClient* client = NULL;
|
||||
client = (RpcClient*)calloc(1, sizeof(RpcClient));
|
||||
rpc->client = client;
|
||||
|
||||
if (!client)
|
||||
@ -614,7 +616,7 @@ int rpc_client_new(rdpRpc *rpc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rpc_client_start(rdpRpc *rpc)
|
||||
int rpc_client_start(rdpRpc* rpc)
|
||||
{
|
||||
rpc->client->Thread = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE) rpc_client_thread,
|
||||
@ -622,7 +624,7 @@ int rpc_client_start(rdpRpc *rpc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rpc_client_stop(rdpRpc *rpc)
|
||||
int rpc_client_stop(rdpRpc* rpc)
|
||||
{
|
||||
if (rpc->client->Thread)
|
||||
{
|
||||
@ -634,9 +636,9 @@ int rpc_client_stop(rdpRpc *rpc)
|
||||
return rpc_client_free(rpc);
|
||||
}
|
||||
|
||||
int rpc_client_free(rdpRpc *rpc)
|
||||
int rpc_client_free(rdpRpc* rpc)
|
||||
{
|
||||
RpcClient *client;
|
||||
RpcClient* client;
|
||||
client = rpc->client;
|
||||
|
||||
if (!client)
|
||||
|
@ -90,14 +90,14 @@
|
||||
|
||||
#define TERMSRV_SPN_PREFIX "TERMSRV/"
|
||||
|
||||
void credssp_send(rdpCredssp *credssp);
|
||||
int credssp_recv(rdpCredssp *credssp);
|
||||
void credssp_buffer_print(rdpCredssp *credssp);
|
||||
void credssp_buffer_free(rdpCredssp *credssp);
|
||||
SECURITY_STATUS credssp_encrypt_public_key_echo(rdpCredssp *credssp);
|
||||
SECURITY_STATUS credssp_decrypt_public_key_echo(rdpCredssp *credssp);
|
||||
SECURITY_STATUS credssp_encrypt_ts_credentials(rdpCredssp *credssp);
|
||||
SECURITY_STATUS credssp_decrypt_ts_credentials(rdpCredssp *credssp);
|
||||
void credssp_send(rdpCredssp* credssp);
|
||||
int credssp_recv(rdpCredssp* credssp);
|
||||
void credssp_buffer_print(rdpCredssp* credssp);
|
||||
void credssp_buffer_free(rdpCredssp* credssp);
|
||||
SECURITY_STATUS credssp_encrypt_public_key_echo(rdpCredssp* credssp);
|
||||
SECURITY_STATUS credssp_decrypt_public_key_echo(rdpCredssp* credssp);
|
||||
SECURITY_STATUS credssp_encrypt_ts_credentials(rdpCredssp* credssp);
|
||||
SECURITY_STATUS credssp_decrypt_ts_credentials(rdpCredssp* credssp);
|
||||
|
||||
#define ber_sizeof_sequence_octet_string(length) ber_sizeof_contextual_tag(ber_sizeof_octet_string(length)) + ber_sizeof_octet_string(length)
|
||||
#define ber_write_sequence_octet_string(stream, context, value, length) ber_write_contextual_tag(stream, context, ber_sizeof_octet_string(length), TRUE) + ber_write_octet_string(stream, value, length)
|
||||
@ -107,17 +107,17 @@ SECURITY_STATUS credssp_decrypt_ts_credentials(rdpCredssp *credssp);
|
||||
* @param credssp
|
||||
*/
|
||||
|
||||
int credssp_ntlm_client_init(rdpCredssp *credssp)
|
||||
int credssp_ntlm_client_init(rdpCredssp* credssp)
|
||||
{
|
||||
char *spn;
|
||||
char* spn;
|
||||
int length;
|
||||
BOOL PromptPassword;
|
||||
rdpTls *tls = NULL;
|
||||
freerdp *instance;
|
||||
rdpSettings *settings;
|
||||
rdpTls* tls = NULL;
|
||||
freerdp* instance;
|
||||
rdpSettings* settings;
|
||||
PromptPassword = FALSE;
|
||||
settings = credssp->settings;
|
||||
instance = (freerdp *) settings->instance;
|
||||
instance = (freerdp*) settings->instance;
|
||||
|
||||
if (settings->RestrictedAdminModeRequired)
|
||||
settings->DisableCredentialsDelegation = TRUE;
|
||||
@ -160,7 +160,7 @@ int credssp_ntlm_client_init(rdpCredssp *credssp)
|
||||
sspi_SetAuthIdentity(&(credssp->identity), settings->Username, settings->Domain, settings->Password);
|
||||
#ifndef _WIN32
|
||||
{
|
||||
SEC_WINNT_AUTH_IDENTITY *identity = &(credssp->identity);
|
||||
SEC_WINNT_AUTH_IDENTITY* identity = &(credssp->identity);
|
||||
|
||||
if (settings->RestrictedAdminModeRequired)
|
||||
{
|
||||
@ -185,7 +185,7 @@ int credssp_ntlm_client_init(rdpCredssp *credssp)
|
||||
#endif
|
||||
#ifdef WITH_DEBUG_NLA
|
||||
DEBUG_MSG("User: %s Domain: %s Password: %s\n",
|
||||
(char *) credssp->identity.User, (char *) credssp->identity.Domain, (char *) credssp->identity.Password);
|
||||
(char*) credssp->identity.User, (char*) credssp->identity.Domain, (char*) credssp->identity.Password);
|
||||
#endif
|
||||
|
||||
if (credssp->transport->layer == TRANSPORT_LAYER_TLS)
|
||||
@ -205,7 +205,7 @@ int credssp_ntlm_client_init(rdpCredssp *credssp)
|
||||
sspi_SecBufferAlloc(&credssp->PublicKey, tls->PublicKeyLength);
|
||||
CopyMemory(credssp->PublicKey.pvBuffer, tls->PublicKey, tls->PublicKeyLength);
|
||||
length = sizeof(TERMSRV_SPN_PREFIX) + strlen(settings->ServerHostname);
|
||||
spn = (SEC_CHAR *) malloc(length + 1);
|
||||
spn = (SEC_CHAR*) malloc(length + 1);
|
||||
sprintf(spn, "%s%s", TERMSRV_SPN_PREFIX, settings->ServerHostname);
|
||||
#ifdef UNICODE
|
||||
credssp->ServicePrincipalName = (LPTSTR) malloc(length * 2 + 2);
|
||||
@ -223,17 +223,17 @@ int credssp_ntlm_client_init(rdpCredssp *credssp)
|
||||
* @param credssp
|
||||
*/
|
||||
|
||||
int credssp_ntlm_server_init(rdpCredssp *credssp)
|
||||
int credssp_ntlm_server_init(rdpCredssp* credssp)
|
||||
{
|
||||
freerdp *instance;
|
||||
rdpSettings *settings = credssp->settings;
|
||||
instance = (freerdp *) settings->instance;
|
||||
freerdp* instance;
|
||||
rdpSettings* settings = credssp->settings;
|
||||
instance = (freerdp*) settings->instance;
|
||||
sspi_SecBufferAlloc(&credssp->PublicKey, credssp->transport->TlsIn->PublicKeyLength);
|
||||
CopyMemory(credssp->PublicKey.pvBuffer, credssp->transport->TlsIn->PublicKey, credssp->transport->TlsIn->PublicKeyLength);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int credssp_client_authenticate(rdpCredssp *credssp)
|
||||
int credssp_client_authenticate(rdpCredssp* credssp)
|
||||
{
|
||||
ULONG cbMaxToken;
|
||||
ULONG fContextReq;
|
||||
@ -405,7 +405,7 @@ int credssp_client_authenticate(rdpCredssp *credssp)
|
||||
* @return 1 if authentication is successful
|
||||
*/
|
||||
|
||||
int credssp_server_authenticate(rdpCredssp *credssp)
|
||||
int credssp_server_authenticate(rdpCredssp* credssp)
|
||||
{
|
||||
UINT32 cbMaxToken;
|
||||
ULONG fContextReq;
|
||||
@ -630,7 +630,7 @@ int credssp_server_authenticate(rdpCredssp *credssp)
|
||||
* @return 1 if authentication is successful
|
||||
*/
|
||||
|
||||
int credssp_authenticate(rdpCredssp *credssp)
|
||||
int credssp_authenticate(rdpCredssp* credssp)
|
||||
{
|
||||
if (credssp->server)
|
||||
return credssp_server_authenticate(credssp);
|
||||
@ -638,7 +638,7 @@ int credssp_authenticate(rdpCredssp *credssp)
|
||||
return credssp_client_authenticate(credssp);
|
||||
}
|
||||
|
||||
void ap_integer_increment_le(BYTE *number, int size)
|
||||
void ap_integer_increment_le(BYTE* number, int size)
|
||||
{
|
||||
int index;
|
||||
|
||||
@ -657,7 +657,7 @@ void ap_integer_increment_le(BYTE *number, int size)
|
||||
}
|
||||
}
|
||||
|
||||
void ap_integer_decrement_le(BYTE *number, int size)
|
||||
void ap_integer_decrement_le(BYTE* number, int size)
|
||||
{
|
||||
int index;
|
||||
|
||||
@ -676,7 +676,7 @@ void ap_integer_decrement_le(BYTE *number, int size)
|
||||
}
|
||||
}
|
||||
|
||||
SECURITY_STATUS credssp_encrypt_public_key_echo(rdpCredssp *credssp)
|
||||
SECURITY_STATUS credssp_encrypt_public_key_echo(rdpCredssp* credssp)
|
||||
{
|
||||
SecBuffer Buffers[2];
|
||||
SecBufferDesc Message;
|
||||
@ -689,13 +689,13 @@ SECURITY_STATUS credssp_encrypt_public_key_echo(rdpCredssp *credssp)
|
||||
Buffers[0].cbBuffer = credssp->ContextSizes.cbMaxSignature;
|
||||
Buffers[0].pvBuffer = credssp->pubKeyAuth.pvBuffer;
|
||||
Buffers[1].cbBuffer = public_key_length;
|
||||
Buffers[1].pvBuffer = ((BYTE *) credssp->pubKeyAuth.pvBuffer) + credssp->ContextSizes.cbMaxSignature;
|
||||
Buffers[1].pvBuffer = ((BYTE*) credssp->pubKeyAuth.pvBuffer) + credssp->ContextSizes.cbMaxSignature;
|
||||
CopyMemory(Buffers[1].pvBuffer, credssp->PublicKey.pvBuffer, Buffers[1].cbBuffer);
|
||||
|
||||
if (credssp->server)
|
||||
{
|
||||
/* server echos the public key +1 */
|
||||
ap_integer_increment_le((BYTE *) Buffers[1].pvBuffer, Buffers[1].cbBuffer);
|
||||
ap_integer_increment_le((BYTE*) Buffers[1].pvBuffer, Buffers[1].cbBuffer);
|
||||
}
|
||||
|
||||
Message.cBuffers = 2;
|
||||
@ -712,13 +712,13 @@ SECURITY_STATUS credssp_encrypt_public_key_echo(rdpCredssp *credssp)
|
||||
return status;
|
||||
}
|
||||
|
||||
SECURITY_STATUS credssp_decrypt_public_key_echo(rdpCredssp *credssp)
|
||||
SECURITY_STATUS credssp_decrypt_public_key_echo(rdpCredssp* credssp)
|
||||
{
|
||||
int length;
|
||||
BYTE *buffer;
|
||||
BYTE* buffer;
|
||||
ULONG pfQOP = 0;
|
||||
BYTE *public_key1;
|
||||
BYTE *public_key2;
|
||||
BYTE* public_key1;
|
||||
BYTE* public_key2;
|
||||
int public_key_length;
|
||||
SecBuffer Buffers[2];
|
||||
SecBufferDesc Message;
|
||||
@ -731,7 +731,7 @@ SECURITY_STATUS credssp_decrypt_public_key_echo(rdpCredssp *credssp)
|
||||
}
|
||||
|
||||
length = credssp->pubKeyAuth.cbBuffer;
|
||||
buffer = (BYTE *) malloc(length);
|
||||
buffer = (BYTE*) malloc(length);
|
||||
CopyMemory(buffer, credssp->pubKeyAuth.pvBuffer, length);
|
||||
public_key_length = credssp->PublicKey.cbBuffer;
|
||||
Buffers[0].BufferType = SECBUFFER_TOKEN; /* Signature */
|
||||
@ -751,8 +751,8 @@ SECURITY_STATUS credssp_decrypt_public_key_echo(rdpCredssp *credssp)
|
||||
return status;
|
||||
}
|
||||
|
||||
public_key1 = (BYTE *) credssp->PublicKey.pvBuffer;
|
||||
public_key2 = (BYTE *) Buffers[1].pvBuffer;
|
||||
public_key1 = (BYTE*) credssp->PublicKey.pvBuffer;
|
||||
public_key2 = (BYTE*) Buffers[1].pvBuffer;
|
||||
|
||||
if (!credssp->server)
|
||||
{
|
||||
@ -774,7 +774,7 @@ SECURITY_STATUS credssp_decrypt_public_key_echo(rdpCredssp *credssp)
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
int credssp_sizeof_ts_password_creds(rdpCredssp *credssp)
|
||||
int credssp_sizeof_ts_password_creds(rdpCredssp* credssp)
|
||||
{
|
||||
int length = 0;
|
||||
length += ber_sizeof_sequence_octet_string(credssp->identity.DomainLength * 2);
|
||||
@ -783,7 +783,7 @@ int credssp_sizeof_ts_password_creds(rdpCredssp *credssp)
|
||||
return length;
|
||||
}
|
||||
|
||||
void credssp_read_ts_password_creds(rdpCredssp *credssp, wStream *s)
|
||||
void credssp_read_ts_password_creds(rdpCredssp* credssp, wStream* s)
|
||||
{
|
||||
int length;
|
||||
/* TSPasswordCreds (SEQUENCE) */
|
||||
@ -792,7 +792,7 @@ void credssp_read_ts_password_creds(rdpCredssp *credssp, wStream *s)
|
||||
ber_read_contextual_tag(s, 0, &length, TRUE);
|
||||
ber_read_octet_string_tag(s, &length);
|
||||
credssp->identity.DomainLength = (UINT32) length;
|
||||
credssp->identity.Domain = (UINT16 *) malloc(length);
|
||||
credssp->identity.Domain = (UINT16*) malloc(length);
|
||||
CopyMemory(credssp->identity.Domain, Stream_Pointer(s), credssp->identity.DomainLength);
|
||||
Stream_Seek(s, credssp->identity.DomainLength);
|
||||
credssp->identity.DomainLength /= 2;
|
||||
@ -800,7 +800,7 @@ void credssp_read_ts_password_creds(rdpCredssp *credssp, wStream *s)
|
||||
ber_read_contextual_tag(s, 1, &length, TRUE);
|
||||
ber_read_octet_string_tag(s, &length);
|
||||
credssp->identity.UserLength = (UINT32) length;
|
||||
credssp->identity.User = (UINT16 *) malloc(length);
|
||||
credssp->identity.User = (UINT16*) malloc(length);
|
||||
CopyMemory(credssp->identity.User, Stream_Pointer(s), credssp->identity.UserLength);
|
||||
Stream_Seek(s, credssp->identity.UserLength);
|
||||
credssp->identity.UserLength /= 2;
|
||||
@ -808,29 +808,29 @@ void credssp_read_ts_password_creds(rdpCredssp *credssp, wStream *s)
|
||||
ber_read_contextual_tag(s, 2, &length, TRUE);
|
||||
ber_read_octet_string_tag(s, &length);
|
||||
credssp->identity.PasswordLength = (UINT32) length;
|
||||
credssp->identity.Password = (UINT16 *) malloc(length);
|
||||
credssp->identity.Password = (UINT16*) malloc(length);
|
||||
CopyMemory(credssp->identity.Password, Stream_Pointer(s), credssp->identity.PasswordLength);
|
||||
Stream_Seek(s, credssp->identity.PasswordLength);
|
||||
credssp->identity.PasswordLength /= 2;
|
||||
credssp->identity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
||||
}
|
||||
|
||||
int credssp_write_ts_password_creds(rdpCredssp *credssp, wStream *s)
|
||||
int credssp_write_ts_password_creds(rdpCredssp* credssp, wStream* s)
|
||||
{
|
||||
int size = 0;
|
||||
int innerSize = credssp_sizeof_ts_password_creds(credssp);
|
||||
/* TSPasswordCreds (SEQUENCE) */
|
||||
size += ber_write_sequence_tag(s, innerSize);
|
||||
/* [0] domainName (OCTET STRING) */
|
||||
size += ber_write_sequence_octet_string(s, 0, (BYTE *) credssp->identity.Domain, credssp->identity.DomainLength * 2);
|
||||
size += ber_write_sequence_octet_string(s, 0, (BYTE*) credssp->identity.Domain, credssp->identity.DomainLength * 2);
|
||||
/* [1] userName (OCTET STRING) */
|
||||
size += ber_write_sequence_octet_string(s, 1, (BYTE *) credssp->identity.User, credssp->identity.UserLength * 2);
|
||||
size += ber_write_sequence_octet_string(s, 1, (BYTE*) credssp->identity.User, credssp->identity.UserLength * 2);
|
||||
/* [2] password (OCTET STRING) */
|
||||
size += ber_write_sequence_octet_string(s, 2, (BYTE *) credssp->identity.Password, credssp->identity.PasswordLength * 2);
|
||||
size += ber_write_sequence_octet_string(s, 2, (BYTE*) credssp->identity.Password, credssp->identity.PasswordLength * 2);
|
||||
return size;
|
||||
}
|
||||
|
||||
int credssp_sizeof_ts_credentials(rdpCredssp *credssp)
|
||||
int credssp_sizeof_ts_credentials(rdpCredssp* credssp)
|
||||
{
|
||||
int size = 0;
|
||||
size += ber_sizeof_integer(1);
|
||||
@ -839,9 +839,9 @@ int credssp_sizeof_ts_credentials(rdpCredssp *credssp)
|
||||
return size;
|
||||
}
|
||||
|
||||
void credssp_read_ts_credentials(rdpCredssp *credssp, PSecBuffer ts_credentials)
|
||||
void credssp_read_ts_credentials(rdpCredssp* credssp, PSecBuffer ts_credentials)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
int ts_password_creds_length;
|
||||
s = Stream_New(ts_credentials->pvBuffer, ts_credentials->cbBuffer);
|
||||
@ -857,7 +857,7 @@ void credssp_read_ts_credentials(rdpCredssp *credssp, PSecBuffer ts_credentials)
|
||||
Stream_Free(s, FALSE);
|
||||
}
|
||||
|
||||
int credssp_write_ts_credentials(rdpCredssp *credssp, wStream *s)
|
||||
int credssp_write_ts_credentials(rdpCredssp* credssp, wStream* s)
|
||||
{
|
||||
int size = 0;
|
||||
int innerSize = credssp_sizeof_ts_credentials(credssp);
|
||||
@ -880,9 +880,9 @@ int credssp_write_ts_credentials(rdpCredssp *credssp, wStream *s)
|
||||
* @param credssp
|
||||
*/
|
||||
|
||||
void credssp_encode_ts_credentials(rdpCredssp *credssp)
|
||||
void credssp_encode_ts_credentials(rdpCredssp* credssp)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
int DomainLength;
|
||||
int UserLength;
|
||||
@ -900,7 +900,7 @@ void credssp_encode_ts_credentials(rdpCredssp *credssp)
|
||||
|
||||
length = ber_sizeof_sequence(credssp_sizeof_ts_credentials(credssp));
|
||||
sspi_SecBufferAlloc(&credssp->ts_credentials, length);
|
||||
s = Stream_New((BYTE *) credssp->ts_credentials.pvBuffer, length);
|
||||
s = Stream_New((BYTE*) credssp->ts_credentials.pvBuffer, length);
|
||||
credssp_write_ts_credentials(credssp, s);
|
||||
|
||||
if (credssp->settings->DisableCredentialsDelegation)
|
||||
@ -913,7 +913,7 @@ void credssp_encode_ts_credentials(rdpCredssp *credssp)
|
||||
Stream_Free(s, FALSE);
|
||||
}
|
||||
|
||||
SECURITY_STATUS credssp_encrypt_ts_credentials(rdpCredssp *credssp)
|
||||
SECURITY_STATUS credssp_encrypt_ts_credentials(rdpCredssp* credssp)
|
||||
{
|
||||
SecBuffer Buffers[2];
|
||||
SecBufferDesc Message;
|
||||
@ -926,7 +926,7 @@ SECURITY_STATUS credssp_encrypt_ts_credentials(rdpCredssp *credssp)
|
||||
Buffers[0].pvBuffer = credssp->authInfo.pvBuffer;
|
||||
ZeroMemory(Buffers[0].pvBuffer, Buffers[0].cbBuffer);
|
||||
Buffers[1].cbBuffer = credssp->ts_credentials.cbBuffer;
|
||||
Buffers[1].pvBuffer = &((BYTE *) credssp->authInfo.pvBuffer)[Buffers[0].cbBuffer];
|
||||
Buffers[1].pvBuffer = &((BYTE*) credssp->authInfo.pvBuffer)[Buffers[0].cbBuffer];
|
||||
CopyMemory(Buffers[1].pvBuffer, credssp->ts_credentials.pvBuffer, Buffers[1].cbBuffer);
|
||||
Message.cBuffers = 2;
|
||||
Message.ulVersion = SECBUFFER_VERSION;
|
||||
@ -939,10 +939,10 @@ SECURITY_STATUS credssp_encrypt_ts_credentials(rdpCredssp *credssp)
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
SECURITY_STATUS credssp_decrypt_ts_credentials(rdpCredssp *credssp)
|
||||
SECURITY_STATUS credssp_decrypt_ts_credentials(rdpCredssp* credssp)
|
||||
{
|
||||
int length;
|
||||
BYTE *buffer;
|
||||
BYTE* buffer;
|
||||
ULONG pfQOP;
|
||||
SecBuffer Buffers[2];
|
||||
SecBufferDesc Message;
|
||||
@ -957,7 +957,7 @@ SECURITY_STATUS credssp_decrypt_ts_credentials(rdpCredssp *credssp)
|
||||
}
|
||||
|
||||
length = credssp->authInfo.cbBuffer;
|
||||
buffer = (BYTE *) malloc(length);
|
||||
buffer = (BYTE*) malloc(length);
|
||||
CopyMemory(buffer, credssp->authInfo.pvBuffer, length);
|
||||
Buffers[0].cbBuffer = credssp->ContextSizes.cbMaxSignature;
|
||||
Buffers[0].pvBuffer = buffer;
|
||||
@ -1018,9 +1018,9 @@ int credssp_sizeof_ts_request(int length)
|
||||
* @param credssp
|
||||
*/
|
||||
|
||||
void credssp_send(rdpCredssp *credssp)
|
||||
void credssp_send(rdpCredssp* credssp)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
int ts_request_length;
|
||||
int nego_tokens_length;
|
||||
@ -1045,7 +1045,7 @@ void credssp_send(rdpCredssp *credssp)
|
||||
length -= ber_write_contextual_tag(s, 1, ber_sizeof_sequence(ber_sizeof_sequence(ber_sizeof_sequence_octet_string(credssp->negoToken.cbBuffer))), TRUE); /* NegoData */
|
||||
length -= ber_write_sequence_tag(s, ber_sizeof_sequence(ber_sizeof_sequence_octet_string(credssp->negoToken.cbBuffer))); /* SEQUENCE OF NegoDataItem */
|
||||
length -= ber_write_sequence_tag(s, ber_sizeof_sequence_octet_string(credssp->negoToken.cbBuffer)); /* NegoDataItem */
|
||||
length -= ber_write_sequence_octet_string(s, 0, (BYTE *) credssp->negoToken.pvBuffer, credssp->negoToken.cbBuffer); /* OCTET STRING */
|
||||
length -= ber_write_sequence_octet_string(s, 0, (BYTE*) credssp->negoToken.pvBuffer, credssp->negoToken.cbBuffer); /* OCTET STRING */
|
||||
// assert length == 0
|
||||
}
|
||||
|
||||
@ -1076,9 +1076,9 @@ void credssp_send(rdpCredssp *credssp)
|
||||
* @return
|
||||
*/
|
||||
|
||||
int credssp_recv(rdpCredssp *credssp)
|
||||
int credssp_recv(rdpCredssp* credssp)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
int status;
|
||||
UINT32 version;
|
||||
@ -1153,7 +1153,7 @@ int credssp_recv(rdpCredssp *credssp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void credssp_buffer_print(rdpCredssp *credssp)
|
||||
void credssp_buffer_print(rdpCredssp* credssp)
|
||||
{
|
||||
if (credssp->negoToken.cbBuffer > 0)
|
||||
{
|
||||
@ -1177,14 +1177,14 @@ void credssp_buffer_print(rdpCredssp *credssp)
|
||||
}
|
||||
}
|
||||
|
||||
void credssp_buffer_free(rdpCredssp *credssp)
|
||||
void credssp_buffer_free(rdpCredssp* credssp)
|
||||
{
|
||||
sspi_SecBufferFree(&credssp->negoToken);
|
||||
sspi_SecBufferFree(&credssp->pubKeyAuth);
|
||||
sspi_SecBufferFree(&credssp->authInfo);
|
||||
}
|
||||
|
||||
LPTSTR credssp_make_spn(const char *ServiceClass, const char *hostname)
|
||||
LPTSTR credssp_make_spn(const char* ServiceClass, const char* hostname)
|
||||
{
|
||||
DWORD status;
|
||||
DWORD SpnLength;
|
||||
@ -1243,10 +1243,10 @@ LPTSTR credssp_make_spn(const char *ServiceClass, const char *hostname)
|
||||
* @return new CredSSP state machine.
|
||||
*/
|
||||
|
||||
rdpCredssp *credssp_new(freerdp *instance, rdpTransport *transport, rdpSettings *settings)
|
||||
rdpCredssp* credssp_new(freerdp* instance, rdpTransport* transport, rdpSettings* settings)
|
||||
{
|
||||
rdpCredssp *credssp;
|
||||
credssp = (rdpCredssp *) calloc(1, sizeof(rdpCredssp));
|
||||
rdpCredssp* credssp;
|
||||
credssp = (rdpCredssp*) calloc(1, sizeof(rdpCredssp));
|
||||
|
||||
if (credssp)
|
||||
{
|
||||
@ -1278,7 +1278,7 @@ rdpCredssp *credssp_new(freerdp *instance, rdpTransport *transport, rdpSettings
|
||||
{
|
||||
credssp->SspiModule = (LPTSTR) malloc(dwSize + sizeof(TCHAR));
|
||||
status = RegQueryValueEx(hKey, _T("SspiModule"), NULL, &dwType,
|
||||
(BYTE *) credssp->SspiModule, &dwSize);
|
||||
(BYTE*) credssp->SspiModule, &dwSize);
|
||||
|
||||
if (status == ERROR_SUCCESS)
|
||||
{
|
||||
@ -1298,7 +1298,7 @@ rdpCredssp *credssp_new(freerdp *instance, rdpTransport *transport, rdpSettings
|
||||
* @param credssp
|
||||
*/
|
||||
|
||||
void credssp_free(rdpCredssp *credssp)
|
||||
void credssp_free(rdpCredssp* credssp)
|
||||
{
|
||||
if (credssp)
|
||||
{
|
||||
|
@ -33,14 +33,14 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WINPR_API void winpr_HexDump(const char *tag, int lvl, const BYTE *data, int length);
|
||||
WINPR_API void winpr_CArrayDump(const char *tag, int lvl, const BYTE *data, int length, int width);
|
||||
WINPR_API void winpr_HexDump(const char* tag, int lvl, const BYTE* data, int length);
|
||||
WINPR_API void winpr_CArrayDump(const char* tag, int lvl, const BYTE* data, int length, int width);
|
||||
|
||||
WINPR_API char *winpr_BinToHexString(const BYTE *data, int length, BOOL space);
|
||||
WINPR_API char* winpr_BinToHexString(const BYTE* data, int length, BOOL space);
|
||||
|
||||
WINPR_API int wprintfx(const char *fmt, ...);
|
||||
WINPR_API int wvprintfx(const char *fmt, va_list args);
|
||||
WINPR_API int wvsnprintfx(char *buffer, size_t bufferSize, const char *fmt, va_list args);
|
||||
WINPR_API int wprintfx(const char* fmt, ...);
|
||||
WINPR_API int wvprintfx(const char* fmt, va_list args);
|
||||
WINPR_API int wvsnprintfx(char* buffer, size_t bufferSize, const char* fmt, va_list args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -33,14 +33,14 @@ extern "C" {
|
||||
#include <winpr/synch.h>
|
||||
#include <winpr/thread.h>
|
||||
|
||||
typedef struct _wLog wLog;
|
||||
typedef struct _wLogMessage wLogMessage;
|
||||
typedef struct _wLogLayout wLogLayout;
|
||||
typedef struct _wLogAppender wLogAppender;
|
||||
typedef struct _wLog wLog;
|
||||
typedef struct _wLogMessage wLogMessage;
|
||||
typedef struct _wLogLayout wLogLayout;
|
||||
typedef struct _wLogAppender wLogAppender;
|
||||
|
||||
/**
|
||||
* Log Levels
|
||||
*/
|
||||
/**
|
||||
* Log Levels
|
||||
*/
|
||||
|
||||
#define WLOG_TRACE 0
|
||||
#define WLOG_DEBUG 1
|
||||
@ -51,63 +51,63 @@ extern "C" {
|
||||
#define WLOG_OFF 6
|
||||
#define WLOG_LEVEL_INHERIT 0xFFFF
|
||||
|
||||
/**
|
||||
* Log Message
|
||||
*/
|
||||
/**
|
||||
* Log Message
|
||||
*/
|
||||
|
||||
#define WLOG_MESSAGE_TEXT 0
|
||||
#define WLOG_MESSAGE_DATA 1
|
||||
#define WLOG_MESSAGE_IMAGE 2
|
||||
#define WLOG_MESSAGE_PACKET 3
|
||||
|
||||
struct _wLogMessage
|
||||
{
|
||||
DWORD Type;
|
||||
struct _wLogMessage
|
||||
{
|
||||
DWORD Type;
|
||||
|
||||
DWORD Level;
|
||||
DWORD Level;
|
||||
|
||||
LPSTR PrefixString;
|
||||
LPSTR PrefixString;
|
||||
|
||||
LPCSTR FormatString;
|
||||
LPSTR TextString;
|
||||
LPCSTR FormatString;
|
||||
LPSTR TextString;
|
||||
|
||||
DWORD LineNumber; /* __LINE__ */
|
||||
LPCSTR FileName; /* __FILE__ */
|
||||
LPCSTR FunctionName; /* __FUNCTION__ */
|
||||
DWORD LineNumber; /* __LINE__ */
|
||||
LPCSTR FileName; /* __FILE__ */
|
||||
LPCSTR FunctionName; /* __FUNCTION__ */
|
||||
|
||||
/* Data Message */
|
||||
/* Data Message */
|
||||
|
||||
void *Data;
|
||||
int Length;
|
||||
void* Data;
|
||||
int Length;
|
||||
|
||||
/* Image Message */
|
||||
/* Image Message */
|
||||
|
||||
void *ImageData;
|
||||
int ImageWidth;
|
||||
int ImageHeight;
|
||||
int ImageBpp;
|
||||
void* ImageData;
|
||||
int ImageWidth;
|
||||
int ImageHeight;
|
||||
int ImageBpp;
|
||||
|
||||
/* Packet Message */
|
||||
/* Packet Message */
|
||||
|
||||
void *PacketData;
|
||||
int PacketLength;
|
||||
DWORD PacketFlags;
|
||||
};
|
||||
void* PacketData;
|
||||
int PacketLength;
|
||||
DWORD PacketFlags;
|
||||
};
|
||||
|
||||
/**
|
||||
* Log Layout
|
||||
*/
|
||||
/**
|
||||
* Log Layout
|
||||
*/
|
||||
|
||||
struct _wLogLayout
|
||||
{
|
||||
DWORD Type;
|
||||
struct _wLogLayout
|
||||
{
|
||||
DWORD Type;
|
||||
|
||||
LPSTR FormatString;
|
||||
};
|
||||
LPSTR FormatString;
|
||||
};
|
||||
|
||||
/**
|
||||
* Log Appenders
|
||||
*/
|
||||
/**
|
||||
* Log Appenders
|
||||
*/
|
||||
|
||||
#define WLOG_APPENDER_CONSOLE 0
|
||||
#define WLOG_APPENDER_FILE 1
|
||||
@ -116,12 +116,12 @@ extern "C" {
|
||||
#define WLOG_PACKET_INBOUND 1
|
||||
#define WLOG_PACKET_OUTBOUND 2
|
||||
|
||||
typedef int (*WLOG_APPENDER_OPEN_FN)(wLog *log, wLogAppender *appender);
|
||||
typedef int (*WLOG_APPENDER_CLOSE_FN)(wLog *log, wLogAppender *appender);
|
||||
typedef int (*WLOG_APPENDER_WRITE_MESSAGE_FN)(wLog *log, wLogAppender *appender, wLogMessage *message);
|
||||
typedef int (*WLOG_APPENDER_WRITE_DATA_MESSAGE_FN)(wLog *log, wLogAppender *appender, wLogMessage *message);
|
||||
typedef int (*WLOG_APPENDER_WRITE_IMAGE_MESSAGE_FN)(wLog *log, wLogAppender *appender, wLogMessage *message);
|
||||
typedef int (*WLOG_APPENDER_WRITE_PACKET_MESSAGE_FN)(wLog *log, wLogAppender *appender, wLogMessage *message);
|
||||
typedef int (*WLOG_APPENDER_OPEN_FN)(wLog* log, wLogAppender* appender);
|
||||
typedef int (*WLOG_APPENDER_CLOSE_FN)(wLog* log, wLogAppender* appender);
|
||||
typedef int (*WLOG_APPENDER_WRITE_MESSAGE_FN)(wLog* log, wLogAppender* appender, wLogMessage* message);
|
||||
typedef int (*WLOG_APPENDER_WRITE_DATA_MESSAGE_FN)(wLog* log, wLogAppender* appender, wLogMessage* message);
|
||||
typedef int (*WLOG_APPENDER_WRITE_IMAGE_MESSAGE_FN)(wLog* log, wLogAppender* appender, wLogMessage* message);
|
||||
typedef int (*WLOG_APPENDER_WRITE_PACKET_MESSAGE_FN)(wLog* log, wLogAppender* appender, wLogMessage* message);
|
||||
|
||||
#define WLOG_APPENDER_COMMON() \
|
||||
DWORD Type; \
|
||||
@ -140,79 +140,79 @@ extern "C" {
|
||||
WLOG_APPENDER_WRITE_IMAGE_MESSAGE_FN WriteImageMessage; \
|
||||
WLOG_APPENDER_WRITE_PACKET_MESSAGE_FN WritePacketMessage
|
||||
|
||||
struct _wLogAppender
|
||||
{
|
||||
WLOG_APPENDER_COMMON();
|
||||
};
|
||||
struct _wLogAppender
|
||||
{
|
||||
WLOG_APPENDER_COMMON();
|
||||
};
|
||||
|
||||
#define WLOG_CONSOLE_STDOUT 1
|
||||
#define WLOG_CONSOLE_STDERR 2
|
||||
#define WLOG_CONSOLE_DEBUG 3
|
||||
|
||||
struct _wLogConsoleAppender
|
||||
{
|
||||
WLOG_APPENDER_COMMON();
|
||||
struct _wLogConsoleAppender
|
||||
{
|
||||
WLOG_APPENDER_COMMON();
|
||||
|
||||
int outputStream;
|
||||
};
|
||||
typedef struct _wLogConsoleAppender wLogConsoleAppender;
|
||||
int outputStream;
|
||||
};
|
||||
typedef struct _wLogConsoleAppender wLogConsoleAppender;
|
||||
|
||||
struct _wLogFileAppender
|
||||
{
|
||||
WLOG_APPENDER_COMMON();
|
||||
struct _wLogFileAppender
|
||||
{
|
||||
WLOG_APPENDER_COMMON();
|
||||
|
||||
char *FileName;
|
||||
char *FilePath;
|
||||
char *FullFileName;
|
||||
FILE *FileDescriptor;
|
||||
};
|
||||
typedef struct _wLogFileAppender wLogFileAppender;
|
||||
char* FileName;
|
||||
char* FilePath;
|
||||
char* FullFileName;
|
||||
FILE* FileDescriptor;
|
||||
};
|
||||
typedef struct _wLogFileAppender wLogFileAppender;
|
||||
|
||||
struct _wLogBinaryAppender
|
||||
{
|
||||
WLOG_APPENDER_COMMON();
|
||||
struct _wLogBinaryAppender
|
||||
{
|
||||
WLOG_APPENDER_COMMON();
|
||||
|
||||
char *FileName;
|
||||
char *FilePath;
|
||||
char *FullFileName;
|
||||
FILE *FileDescriptor;
|
||||
};
|
||||
typedef struct _wLogBinaryAppender wLogBinaryAppender;
|
||||
char* FileName;
|
||||
char* FilePath;
|
||||
char* FullFileName;
|
||||
FILE* FileDescriptor;
|
||||
};
|
||||
typedef struct _wLogBinaryAppender wLogBinaryAppender;
|
||||
|
||||
/**
|
||||
* Filter
|
||||
*/
|
||||
/**
|
||||
* Filter
|
||||
*/
|
||||
|
||||
struct _wLogFilter
|
||||
{
|
||||
DWORD Level;
|
||||
LPSTR *Names;
|
||||
DWORD NameCount;
|
||||
};
|
||||
typedef struct _wLogFilter wLogFilter;
|
||||
struct _wLogFilter
|
||||
{
|
||||
DWORD Level;
|
||||
LPSTR* Names;
|
||||
DWORD NameCount;
|
||||
};
|
||||
typedef struct _wLogFilter wLogFilter;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
*/
|
||||
/**
|
||||
* Logger
|
||||
*/
|
||||
|
||||
struct _wLog
|
||||
{
|
||||
LPSTR Name;
|
||||
DWORD Level;
|
||||
struct _wLog
|
||||
{
|
||||
LPSTR Name;
|
||||
DWORD Level;
|
||||
|
||||
BOOL IsRoot;
|
||||
LPSTR *Names;
|
||||
DWORD NameCount;
|
||||
wLogAppender *Appender;
|
||||
BOOL IsRoot;
|
||||
LPSTR* Names;
|
||||
DWORD NameCount;
|
||||
wLogAppender* Appender;
|
||||
|
||||
wLog *Parent;
|
||||
wLog **Children;
|
||||
DWORD ChildrenCount;
|
||||
DWORD ChildrenSize;
|
||||
};
|
||||
wLog* Parent;
|
||||
wLog** Children;
|
||||
DWORD ChildrenCount;
|
||||
DWORD ChildrenSize;
|
||||
};
|
||||
|
||||
WINPR_API void WLog_PrintMessage(wLog *log, wLogMessage *message, ...);
|
||||
WINPR_API int WLog_PrintMessageVA(wLog *log, wLogMessage *message, va_list args);
|
||||
WINPR_API void WLog_PrintMessage(wLog* log, wLogMessage* message, ...);
|
||||
WINPR_API int WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args);
|
||||
|
||||
#define WLog_Print(_log, _log_level, _fmt, ...) \
|
||||
if (_log_level >= WLog_GetLogLevel(_log)) { \
|
||||
@ -292,28 +292,28 @@ extern "C" {
|
||||
#define WLog_FATAL(tag, fmt, ...) WLog_Print(WLog_Get(tag), WLOG_FATAL, __FILE__, __FUNCTION__, \
|
||||
__LINE__, tag, fmt, ## __VA_ARGS__)
|
||||
|
||||
WINPR_API DWORD WLog_GetLogLevel(wLog *log);
|
||||
WINPR_API void WLog_SetLogLevel(wLog *log, DWORD logLevel);
|
||||
WINPR_API DWORD WLog_GetLogLevel(wLog* log);
|
||||
WINPR_API void WLog_SetLogLevel(wLog* log, DWORD logLevel);
|
||||
|
||||
WINPR_API wLogAppender *WLog_GetLogAppender(wLog *log);
|
||||
WINPR_API void WLog_SetLogAppenderType(wLog *log, DWORD logAppenderType);
|
||||
WINPR_API wLogAppender* WLog_GetLogAppender(wLog* log);
|
||||
WINPR_API void WLog_SetLogAppenderType(wLog* log, DWORD logAppenderType);
|
||||
|
||||
WINPR_API int WLog_OpenAppender(wLog *log);
|
||||
WINPR_API int WLog_CloseAppender(wLog *log);
|
||||
WINPR_API int WLog_OpenAppender(wLog* log);
|
||||
WINPR_API int WLog_CloseAppender(wLog* log);
|
||||
|
||||
WINPR_API void WLog_ConsoleAppender_SetOutputStream(wLog *log, wLogConsoleAppender *appender, int outputStream);
|
||||
WINPR_API void WLog_ConsoleAppender_SetOutputStream(wLog* log, wLogConsoleAppender* appender, int outputStream);
|
||||
|
||||
WINPR_API void WLog_FileAppender_SetOutputFileName(wLog *log, wLogFileAppender *appender, const char *filename);
|
||||
WINPR_API void WLog_FileAppender_SetOutputFilePath(wLog *log, wLogFileAppender *appender, const char *filepath);
|
||||
WINPR_API void WLog_FileAppender_SetOutputFileName(wLog* log, wLogFileAppender* appender, const char* filename);
|
||||
WINPR_API void WLog_FileAppender_SetOutputFilePath(wLog* log, wLogFileAppender* appender, const char* filepath);
|
||||
|
||||
WINPR_API wLogLayout *WLog_GetLogLayout(wLog *log);
|
||||
WINPR_API void WLog_Layout_SetPrefixFormat(wLog *log, wLogLayout *layout, const char *format);
|
||||
WINPR_API wLogLayout* WLog_GetLogLayout(wLog* log);
|
||||
WINPR_API void WLog_Layout_SetPrefixFormat(wLog* log, wLogLayout* layout, const char* format);
|
||||
|
||||
WINPR_API wLog *WLog_GetRoot(void);
|
||||
WINPR_API wLog *WLog_Get(LPCSTR name);
|
||||
WINPR_API wLog* WLog_GetRoot(void);
|
||||
WINPR_API wLog* WLog_Get(LPCSTR name);
|
||||
|
||||
WINPR_API void WLog_Init(void);
|
||||
WINPR_API void WLog_Uninit(void);
|
||||
WINPR_API void WLog_Init(void);
|
||||
WINPR_API void WLog_Uninit(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -49,30 +49,30 @@ struct winpr_aligned_mem
|
||||
{
|
||||
UINT32 sig;
|
||||
size_t size;
|
||||
void *base_addr;
|
||||
void* base_addr;
|
||||
};
|
||||
typedef struct winpr_aligned_mem WINPR_ALIGNED_MEM;
|
||||
|
||||
void *_aligned_malloc(size_t size, size_t alignment)
|
||||
void* _aligned_malloc(size_t size, size_t alignment)
|
||||
{
|
||||
return _aligned_offset_malloc(size, alignment, 0);
|
||||
}
|
||||
|
||||
void *_aligned_realloc(void *memblock, size_t size, size_t alignment)
|
||||
void* _aligned_realloc(void* memblock, size_t size, size_t alignment)
|
||||
{
|
||||
return _aligned_offset_realloc(memblock, size, alignment, 0);
|
||||
}
|
||||
|
||||
void *_aligned_recalloc(void *memblock, size_t num, size_t size, size_t alignment)
|
||||
void* _aligned_recalloc(void* memblock, size_t num, size_t size, size_t alignment)
|
||||
{
|
||||
return _aligned_offset_recalloc(memblock, num, size, alignment, 0);
|
||||
}
|
||||
|
||||
void *_aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
|
||||
void* _aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
|
||||
{
|
||||
void *base;
|
||||
void *memblock;
|
||||
WINPR_ALIGNED_MEM *pMem;
|
||||
void* base;
|
||||
void* memblock;
|
||||
WINPR_ALIGNED_MEM* pMem;
|
||||
|
||||
/* alignment must be a power of 2 */
|
||||
if (alignment % 2 == 1)
|
||||
@ -83,8 +83,8 @@ void *_aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
|
||||
return NULL;
|
||||
|
||||
/* minimum alignment is pointer size */
|
||||
if (alignment < sizeof(void *))
|
||||
alignment = sizeof(void *);
|
||||
if (alignment < sizeof(void*))
|
||||
alignment = sizeof(void*);
|
||||
|
||||
/* malloc size + alignment to make sure we can align afterwards */
|
||||
base = malloc(size + alignment + sizeof(WINPR_ALIGNED_MEM));
|
||||
@ -92,7 +92,7 @@ void *_aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
|
||||
if (!base)
|
||||
return NULL;
|
||||
|
||||
memblock = (void *)((((size_t)(((BYTE *) base) + alignment + offset + sizeof(WINPR_ALIGNED_MEM)) & ~(alignment - 1)) - offset));
|
||||
memblock = (void*)((((size_t)(((BYTE*) base) + alignment + offset + sizeof(WINPR_ALIGNED_MEM)) & ~(alignment - 1)) - offset));
|
||||
pMem = WINPR_ALIGNED_MEM_STRUCT_FROM_PTR(memblock);
|
||||
pMem->sig = WINPR_ALIGNED_MEM_SIGNATURE;
|
||||
pMem->base_addr = base;
|
||||
@ -100,12 +100,12 @@ void *_aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
|
||||
return memblock;
|
||||
}
|
||||
|
||||
void *_aligned_offset_realloc(void *memblock, size_t size, size_t alignment, size_t offset)
|
||||
void* _aligned_offset_realloc(void* memblock, size_t size, size_t alignment, size_t offset)
|
||||
{
|
||||
size_t copySize;
|
||||
void *newMemblock;
|
||||
WINPR_ALIGNED_MEM *pMem;
|
||||
WINPR_ALIGNED_MEM *pNewMem;
|
||||
void* newMemblock;
|
||||
WINPR_ALIGNED_MEM* pMem;
|
||||
WINPR_ALIGNED_MEM* pNewMem;
|
||||
|
||||
if (!memblock)
|
||||
return _aligned_offset_malloc(size, alignment, offset);
|
||||
@ -136,11 +136,11 @@ void *_aligned_offset_realloc(void *memblock, size_t size, size_t alignment, siz
|
||||
return newMemblock;
|
||||
}
|
||||
|
||||
void *_aligned_offset_recalloc(void *memblock, size_t num, size_t size, size_t alignment, size_t offset)
|
||||
void* _aligned_offset_recalloc(void* memblock, size_t num, size_t size, size_t alignment, size_t offset)
|
||||
{
|
||||
void *newMemblock;
|
||||
WINPR_ALIGNED_MEM *pMem;
|
||||
WINPR_ALIGNED_MEM *pNewMem;
|
||||
void* newMemblock;
|
||||
WINPR_ALIGNED_MEM* pMem;
|
||||
WINPR_ALIGNED_MEM* pNewMem;
|
||||
|
||||
if (!memblock)
|
||||
return _aligned_offset_malloc(size, alignment, offset);
|
||||
@ -170,9 +170,9 @@ void *_aligned_offset_recalloc(void *memblock, size_t num, size_t size, size_t a
|
||||
return newMemblock;
|
||||
}
|
||||
|
||||
size_t _aligned_msize(void *memblock, size_t alignment, size_t offset)
|
||||
size_t _aligned_msize(void* memblock, size_t alignment, size_t offset)
|
||||
{
|
||||
WINPR_ALIGNED_MEM *pMem;
|
||||
WINPR_ALIGNED_MEM* pMem;
|
||||
|
||||
if (!memblock)
|
||||
return 0;
|
||||
@ -188,9 +188,9 @@ size_t _aligned_msize(void *memblock, size_t alignment, size_t offset)
|
||||
return pMem->size;
|
||||
}
|
||||
|
||||
void _aligned_free(void *memblock)
|
||||
void _aligned_free(void* memblock)
|
||||
{
|
||||
WINPR_ALIGNED_MEM *pMem;
|
||||
WINPR_ALIGNED_MEM* pMem;
|
||||
|
||||
if (!memblock)
|
||||
return;
|
||||
|
@ -35,9 +35,9 @@
|
||||
#include "../log.h"
|
||||
#define TAG WINPR_TAG("crt")
|
||||
|
||||
char *_strdup(const char *strSource)
|
||||
char* _strdup(const char* strSource)
|
||||
{
|
||||
char *strDestination;
|
||||
char* strDestination;
|
||||
|
||||
if (strSource == NULL)
|
||||
return NULL;
|
||||
@ -50,9 +50,9 @@ char *_strdup(const char *strSource)
|
||||
return strDestination;
|
||||
}
|
||||
|
||||
WCHAR *_wcsdup(const WCHAR *strSource)
|
||||
WCHAR* _wcsdup(const WCHAR* strSource)
|
||||
{
|
||||
WCHAR *strDestination;
|
||||
WCHAR* strDestination;
|
||||
|
||||
if (strSource == NULL)
|
||||
return NULL;
|
||||
@ -60,13 +60,13 @@ WCHAR *_wcsdup(const WCHAR *strSource)
|
||||
#if defined(sun) && sun
|
||||
strDestination = wsdup(strSource);
|
||||
#elif defined(__APPLE__) && defined(__MACH__) || defined(ANDROID)
|
||||
strDestination = malloc(wcslen((wchar_t *)strSource));
|
||||
strDestination = malloc(wcslen((wchar_t*)strSource));
|
||||
|
||||
if (strDestination != NULL)
|
||||
wcscpy((wchar_t *)strDestination, (const wchar_t *)strSource);
|
||||
wcscpy((wchar_t*)strDestination, (const wchar_t*)strSource);
|
||||
|
||||
#else
|
||||
strDestination = (WCHAR *) wcsdup((wchar_t *) strSource);
|
||||
strDestination = (WCHAR*) wcsdup((wchar_t*) strSource);
|
||||
#endif
|
||||
|
||||
if (strDestination == NULL)
|
||||
@ -75,19 +75,19 @@ WCHAR *_wcsdup(const WCHAR *strSource)
|
||||
return strDestination;
|
||||
}
|
||||
|
||||
int _stricmp(const char *string1, const char *string2)
|
||||
int _stricmp(const char* string1, const char* string2)
|
||||
{
|
||||
return strcasecmp(string1, string2);
|
||||
}
|
||||
|
||||
int _strnicmp(const char *string1, const char *string2, size_t count)
|
||||
int _strnicmp(const char* string1, const char* string2, size_t count)
|
||||
{
|
||||
return strncasecmp(string1, string2, count);
|
||||
}
|
||||
|
||||
/* _wcscmp -> wcscmp */
|
||||
|
||||
int _wcscmp(const WCHAR *string1, const WCHAR *string2)
|
||||
int _wcscmp(const WCHAR* string1, const WCHAR* string2)
|
||||
{
|
||||
while (*string1 && (*string1 == *string2))
|
||||
{
|
||||
@ -100,9 +100,9 @@ int _wcscmp(const WCHAR *string1, const WCHAR *string2)
|
||||
|
||||
/* _wcslen -> wcslen */
|
||||
|
||||
size_t _wcslen(const WCHAR *str)
|
||||
size_t _wcslen(const WCHAR* str)
|
||||
{
|
||||
WCHAR *p = (WCHAR *) str;
|
||||
WCHAR* p = (WCHAR*) str;
|
||||
|
||||
if (!p)
|
||||
return 0;
|
||||
@ -115,9 +115,9 @@ size_t _wcslen(const WCHAR *str)
|
||||
|
||||
/* _wcschr -> wcschr */
|
||||
|
||||
WCHAR *_wcschr(const WCHAR *str, WCHAR c)
|
||||
WCHAR* _wcschr(const WCHAR* str, WCHAR c)
|
||||
{
|
||||
WCHAR *p = (WCHAR *) str;
|
||||
WCHAR* p = (WCHAR*) str;
|
||||
|
||||
while (*p && (*p != c))
|
||||
p++;
|
||||
@ -125,14 +125,14 @@ WCHAR *_wcschr(const WCHAR *str, WCHAR c)
|
||||
return ((*p == c) ? p : NULL);
|
||||
}
|
||||
|
||||
char *strtok_s(char *strToken, const char *strDelimit, char **context)
|
||||
char* strtok_s(char* strToken, const char* strDelimit, char** context)
|
||||
{
|
||||
return strtok_r(strToken, strDelimit, context);
|
||||
}
|
||||
|
||||
WCHAR *wcstok_s(WCHAR *strToken, const WCHAR *strDelimit, WCHAR **context)
|
||||
WCHAR* wcstok_s(WCHAR* strToken, const WCHAR* strDelimit, WCHAR** context)
|
||||
{
|
||||
WCHAR *nextToken;
|
||||
WCHAR* nextToken;
|
||||
|
||||
if (!strToken)
|
||||
strToken = *context;
|
||||
|
@ -53,12 +53,12 @@ static const DWORD halfMask = 0x3FFUL;
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF32toUTF16(
|
||||
const DWORD **sourceStart, const DWORD *sourceEnd,
|
||||
WCHAR **targetStart, WCHAR *targetEnd, ConversionFlags flags)
|
||||
const DWORD** sourceStart, const DWORD* sourceEnd,
|
||||
WCHAR** targetStart, WCHAR* targetEnd, ConversionFlags flags)
|
||||
{
|
||||
ConversionResult result = conversionOK;
|
||||
const DWORD *source = *sourceStart;
|
||||
WCHAR *target = *targetStart;
|
||||
const DWORD* source = *sourceStart;
|
||||
WCHAR* target = *targetStart;
|
||||
|
||||
while (source < sourceEnd)
|
||||
{
|
||||
@ -128,17 +128,17 @@ ConversionResult ConvertUTF32toUTF16(
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF16toUTF32(
|
||||
const WCHAR **sourceStart, const WCHAR *sourceEnd,
|
||||
DWORD **targetStart, DWORD *targetEnd, ConversionFlags flags)
|
||||
const WCHAR** sourceStart, const WCHAR* sourceEnd,
|
||||
DWORD** targetStart, DWORD* targetEnd, ConversionFlags flags)
|
||||
{
|
||||
ConversionResult result = conversionOK;
|
||||
const WCHAR *source = *sourceStart;
|
||||
DWORD *target = *targetStart;
|
||||
const WCHAR* source = *sourceStart;
|
||||
DWORD* target = *targetStart;
|
||||
DWORD ch, ch2;
|
||||
|
||||
while (source < sourceEnd)
|
||||
{
|
||||
const WCHAR *oldSource = source; /* In case we have to back up because of target overflow. */
|
||||
const WCHAR* oldSource = source; /* In case we have to back up because of target overflow. */
|
||||
ch = *source++;
|
||||
|
||||
/* If we have a surrogate pair, convert to UTF32 first. */
|
||||
@ -231,7 +231,7 @@ static const char trailingBytesForUTF8[256] =
|
||||
* in a UTF-8 sequence.
|
||||
*/
|
||||
static const DWORD offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
|
||||
0x03C82080UL, 0xFA082080UL, 0x82082080UL
|
||||
0x03C82080UL, 0xFA082080UL, 0x82082080UL
|
||||
};
|
||||
|
||||
/*
|
||||
@ -256,11 +256,11 @@ static const BYTE firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF16toUTF8(
|
||||
const WCHAR **sourceStart, const WCHAR *sourceEnd,
|
||||
BYTE **targetStart, BYTE *targetEnd, ConversionFlags flags)
|
||||
const WCHAR** sourceStart, const WCHAR* sourceEnd,
|
||||
BYTE** targetStart, BYTE* targetEnd, ConversionFlags flags)
|
||||
{
|
||||
BYTE *target;
|
||||
const WCHAR *source;
|
||||
BYTE* target;
|
||||
const WCHAR* source;
|
||||
BOOL computeLength;
|
||||
ConversionResult result;
|
||||
computeLength = (!targetEnd) ? TRUE : FALSE;
|
||||
@ -274,7 +274,7 @@ ConversionResult ConvertUTF16toUTF8(
|
||||
unsigned short bytesToWrite = 0;
|
||||
const DWORD byteMask = 0xBF;
|
||||
const DWORD byteMark = 0x80;
|
||||
const WCHAR *oldSource = source; /* In case we have to back up because of target overflow. */
|
||||
const WCHAR* oldSource = source; /* In case we have to back up because of target overflow. */
|
||||
ch = *source++;
|
||||
|
||||
/* If we have a surrogate pair, convert to UTF32 first. */
|
||||
@ -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;
|
||||
}
|
||||
@ -410,58 +416,54 @@ ConversionResult ConvertUTF16toUTF8(
|
||||
* definition of UTF-8 goes up to 4-byte sequences.
|
||||
*/
|
||||
|
||||
static BOOL isLegalUTF8(const BYTE *source, int length)
|
||||
static BOOL isLegalUTF8(const BYTE* source, int length)
|
||||
{
|
||||
BYTE a;
|
||||
const BYTE *srcptr = source + length;
|
||||
const BYTE* srcptr = source + length;
|
||||
|
||||
switch (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;
|
||||
}
|
||||
|
||||
@ -477,7 +479,7 @@ static BOOL isLegalUTF8(const BYTE *source, int length)
|
||||
* Exported function to return whether a UTF-8 sequence is legal or not.
|
||||
* This is not used here; it's just exported.
|
||||
*/
|
||||
BOOL isLegalUTF8Sequence(const BYTE *source, const BYTE *sourceEnd)
|
||||
BOOL isLegalUTF8Sequence(const BYTE* source, const BYTE* sourceEnd)
|
||||
{
|
||||
int length = trailingBytesForUTF8[*source] + 1;
|
||||
|
||||
@ -490,11 +492,11 @@ BOOL isLegalUTF8Sequence(const BYTE *source, const BYTE *sourceEnd)
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF8toUTF16(
|
||||
const BYTE **sourceStart, const BYTE *sourceEnd,
|
||||
WCHAR **targetStart, WCHAR *targetEnd, ConversionFlags flags)
|
||||
const BYTE** sourceStart, const BYTE* sourceEnd,
|
||||
WCHAR** targetStart, WCHAR* targetEnd, ConversionFlags flags)
|
||||
{
|
||||
WCHAR *target;
|
||||
const BYTE *source;
|
||||
WCHAR* target;
|
||||
const BYTE* source;
|
||||
BOOL computeLength;
|
||||
ConversionResult result;
|
||||
computeLength = (!targetEnd) ? TRUE : 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++;
|
||||
}
|
||||
@ -630,12 +637,12 @@ ConversionResult ConvertUTF8toUTF16(
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF32toUTF8(
|
||||
const DWORD **sourceStart, const DWORD *sourceEnd,
|
||||
BYTE **targetStart, BYTE *targetEnd, ConversionFlags flags)
|
||||
const DWORD** sourceStart, const DWORD* sourceEnd,
|
||||
BYTE** targetStart, BYTE* targetEnd, ConversionFlags flags)
|
||||
{
|
||||
ConversionResult result = conversionOK;
|
||||
const DWORD *source = *sourceStart;
|
||||
BYTE *target = *targetStart;
|
||||
const DWORD* source = *sourceStart;
|
||||
BYTE* target = *targetStart;
|
||||
|
||||
while (source < sourceEnd)
|
||||
{
|
||||
@ -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]);
|
||||
}
|
||||
@ -719,12 +729,12 @@ ConversionResult ConvertUTF32toUTF8(
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
ConversionResult ConvertUTF8toUTF32(
|
||||
const BYTE **sourceStart, const BYTE *sourceEnd,
|
||||
DWORD **targetStart, DWORD *targetEnd, ConversionFlags flags)
|
||||
const BYTE** sourceStart, const BYTE* sourceEnd,
|
||||
DWORD** targetStart, DWORD* targetEnd, ConversionFlags flags)
|
||||
{
|
||||
ConversionResult result = conversionOK;
|
||||
const BYTE *source = *sourceStart;
|
||||
DWORD *target = *targetStart;
|
||||
const BYTE* source = *sourceStart;
|
||||
DWORD* target = *targetStart;
|
||||
|
||||
while (source < sourceEnd)
|
||||
{
|
||||
@ -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++;
|
||||
}
|
||||
|
@ -4,19 +4,19 @@
|
||||
#include <winpr/crypto.h>
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
static const char *SECRET_PASSWORD_TEST = "MySecretPassword123!";
|
||||
static const char* SECRET_PASSWORD_TEST = "MySecretPassword123!";
|
||||
|
||||
int TestCryptoProtectMemory(int argc, char *argv[])
|
||||
int TestCryptoProtectMemory(int argc, char* argv[])
|
||||
{
|
||||
int cbPlainText;
|
||||
int cbCipherText;
|
||||
char *pPlainText;
|
||||
BYTE *pCipherText;
|
||||
pPlainText = (char *) SECRET_PASSWORD_TEST;
|
||||
char* pPlainText;
|
||||
BYTE* pCipherText;
|
||||
pPlainText = (char*) SECRET_PASSWORD_TEST;
|
||||
cbPlainText = strlen(pPlainText) + 1;
|
||||
cbCipherText = cbPlainText + (CRYPTPROTECTMEMORY_BLOCK_SIZE - (cbPlainText % CRYPTPROTECTMEMORY_BLOCK_SIZE));
|
||||
printf("cbPlainText: %d cbCipherText: %d\n", cbPlainText, cbCipherText);
|
||||
pCipherText = (BYTE *) malloc(cbCipherText);
|
||||
pCipherText = (BYTE*) malloc(cbCipherText);
|
||||
CopyMemory(pCipherText, pPlainText, cbPlainText);
|
||||
ZeroMemory(&pCipherText[cbPlainText], (cbCipherText - cbPlainText));
|
||||
|
||||
|
@ -197,7 +197,7 @@
|
||||
*/
|
||||
/* _HandleCreators is a NULL-terminated array with a maximun of HANDLE_CREATOR_MAX HANDLE_CREATOR */
|
||||
#define HANDLE_CREATOR_MAX 128
|
||||
static HANDLE_CREATOR **_HandleCreators = NULL;
|
||||
static HANDLE_CREATOR** _HandleCreators = NULL;
|
||||
static CRITICAL_SECTION _HandleCreatorsLock;
|
||||
|
||||
static pthread_once_t _HandleCreatorsInitialized = PTHREAD_ONCE_INIT;
|
||||
@ -205,7 +205,7 @@ static void _HandleCreatorsInit()
|
||||
{
|
||||
/* NB: error management to be done outside of this function */
|
||||
assert(_HandleCreators == NULL);
|
||||
_HandleCreators = (HANDLE_CREATOR **)calloc(HANDLE_CREATOR_MAX+1, sizeof(HANDLE_CREATOR *));
|
||||
_HandleCreators = (HANDLE_CREATOR**)calloc(HANDLE_CREATOR_MAX+1, sizeof(HANDLE_CREATOR*));
|
||||
InitializeCriticalSection(&_HandleCreatorsLock);
|
||||
assert(_HandleCreators != NULL);
|
||||
}
|
||||
@ -255,7 +255,7 @@ BOOL RegisterHandleCreator(PHANDLE_CREATOR pHandleCreator)
|
||||
|
||||
static BOOL g_AioSignalHandlerInstalled = FALSE;
|
||||
|
||||
void AioSignalHandler(int signum, siginfo_t *siginfo, void *arg)
|
||||
void AioSignalHandler(int signum, siginfo_t* siginfo, void* arg)
|
||||
{
|
||||
WLog_INFO("%d", signum);
|
||||
}
|
||||
@ -268,7 +268,7 @@ int InstallAioSignalHandler()
|
||||
sigemptyset(&action.sa_mask);
|
||||
sigaddset(&action.sa_mask, SIGIO);
|
||||
action.sa_flags = SA_SIGINFO;
|
||||
action.sa_sigaction = (void *) &AioSignalHandler;
|
||||
action.sa_sigaction = (void*) &AioSignalHandler;
|
||||
sigaction(SIGIO, &action, NULL);
|
||||
g_AioSignalHandlerInstalled = TRUE;
|
||||
}
|
||||
@ -282,11 +282,11 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
|
||||
{
|
||||
int i;
|
||||
char *name;
|
||||
char* name;
|
||||
int status;
|
||||
HANDLE hNamedPipe;
|
||||
struct sockaddr_un s;
|
||||
WINPR_NAMED_PIPE *pNamedPipe;
|
||||
WINPR_NAMED_PIPE* pNamedPipe;
|
||||
|
||||
if (!lpFileName)
|
||||
return INVALID_HANDLE_VALUE;
|
||||
@ -307,7 +307,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||
|
||||
for (i=0; _HandleCreators[i] != NULL; i++)
|
||||
{
|
||||
HANDLE_CREATOR *creator = (HANDLE_CREATOR *)_HandleCreators[i];
|
||||
HANDLE_CREATOR* creator = (HANDLE_CREATOR*)_HandleCreators[i];
|
||||
|
||||
if (creator && creator->IsHandled(lpFileName))
|
||||
{
|
||||
@ -331,7 +331,7 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||
return INVALID_HANDLE_VALUE;
|
||||
|
||||
free(name);
|
||||
pNamedPipe = (WINPR_NAMED_PIPE *) calloc(1, sizeof(WINPR_NAMED_PIPE));
|
||||
pNamedPipe = (WINPR_NAMED_PIPE*) calloc(1, sizeof(WINPR_NAMED_PIPE));
|
||||
hNamedPipe = (HANDLE) pNamedPipe;
|
||||
WINPR_HANDLE_SET_TYPE(pNamedPipe, HANDLE_TYPE_NAMED_PIPE);
|
||||
pNamedPipe->name = _strdup(lpFileName);
|
||||
@ -350,14 +350,14 @@ HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||
ZeroMemory(&s, sizeof(struct sockaddr_un));
|
||||
s.sun_family = AF_UNIX;
|
||||
strcpy(s.sun_path, pNamedPipe->lpFilePath);
|
||||
status = connect(pNamedPipe->clientfd, (struct sockaddr *) &s, sizeof(struct sockaddr_un));
|
||||
status = connect(pNamedPipe->clientfd, (struct sockaddr*) &s, sizeof(struct sockaddr_un));
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
close(pNamedPipe->clientfd);
|
||||
free((char *) pNamedPipe->name);
|
||||
free((char *) pNamedPipe->lpFileName);
|
||||
free((char *) pNamedPipe->lpFilePath);
|
||||
free((char*) pNamedPipe->name);
|
||||
free((char*) pNamedPipe->lpFileName);
|
||||
free((char*) pNamedPipe->lpFilePath);
|
||||
free(pNamedPipe);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
@ -420,8 +420,8 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
|
||||
if (Type == HANDLE_TYPE_ANONYMOUS_PIPE)
|
||||
{
|
||||
int io_status;
|
||||
WINPR_PIPE *pipe;
|
||||
pipe = (WINPR_PIPE *) Object;
|
||||
WINPR_PIPE* pipe;
|
||||
pipe = (WINPR_PIPE*) Object;
|
||||
|
||||
do
|
||||
{
|
||||
@ -449,8 +449,8 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
|
||||
else if (Type == HANDLE_TYPE_NAMED_PIPE)
|
||||
{
|
||||
int io_status;
|
||||
WINPR_NAMED_PIPE *pipe;
|
||||
pipe = (WINPR_NAMED_PIPE *) Object;
|
||||
WINPR_NAMED_PIPE* pipe;
|
||||
pipe = (WINPR_NAMED_PIPE*) Object;
|
||||
|
||||
if (!(pipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
|
||||
{
|
||||
@ -507,7 +507,7 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
|
||||
cb.aio_offset = lpOverlapped->Offset;
|
||||
cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
|
||||
cb.aio_sigevent.sigev_signo = SIGIO;
|
||||
cb.aio_sigevent.sigev_value.sival_ptr = (void *) lpOverlapped;
|
||||
cb.aio_sigevent.sigev_value.sival_ptr = (void*) lpOverlapped;
|
||||
InstallAioSignalHandler();
|
||||
aio_status = aio_read(&cb);
|
||||
WLog_DBG(TAG, "aio_read status: %d", aio_status);
|
||||
@ -562,8 +562,8 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
|
||||
if (Type == HANDLE_TYPE_ANONYMOUS_PIPE)
|
||||
{
|
||||
int io_status;
|
||||
WINPR_PIPE *pipe;
|
||||
pipe = (WINPR_PIPE *) Object;
|
||||
WINPR_PIPE* pipe;
|
||||
pipe = (WINPR_PIPE*) Object;
|
||||
|
||||
do
|
||||
{
|
||||
@ -580,8 +580,8 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
|
||||
else if (Type == HANDLE_TYPE_NAMED_PIPE)
|
||||
{
|
||||
int io_status;
|
||||
WINPR_NAMED_PIPE *pipe;
|
||||
pipe = (WINPR_NAMED_PIPE *) Object;
|
||||
WINPR_NAMED_PIPE* pipe;
|
||||
pipe = (WINPR_NAMED_PIPE*) Object;
|
||||
|
||||
if (!(pipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
|
||||
{
|
||||
@ -630,12 +630,12 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
|
||||
struct aiocb cb;
|
||||
ZeroMemory(&cb, sizeof(struct aiocb));
|
||||
cb.aio_fildes = pipe->clientfd;
|
||||
cb.aio_buf = (void *) lpBuffer;
|
||||
cb.aio_buf = (void*) lpBuffer;
|
||||
cb.aio_nbytes = nNumberOfBytesToWrite;
|
||||
cb.aio_offset = lpOverlapped->Offset;
|
||||
cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL;
|
||||
cb.aio_sigevent.sigev_signo = SIGIO;
|
||||
cb.aio_sigevent.sigev_value.sival_ptr = (void *) lpOverlapped;
|
||||
cb.aio_sigevent.sigev_value.sival_ptr = (void*) lpOverlapped;
|
||||
InstallAioSignalHandler();
|
||||
io_status = aio_write(&cb);
|
||||
WLog_DBG("aio_write status: %d", io_status);
|
||||
@ -720,22 +720,22 @@ BOOL UnlockFileEx(HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLo
|
||||
|
||||
struct _WIN32_FILE_SEARCH
|
||||
{
|
||||
DIR *pDir;
|
||||
DIR* pDir;
|
||||
LPSTR lpPath;
|
||||
LPSTR lpPattern;
|
||||
struct dirent *pDirent;
|
||||
struct dirent* pDirent;
|
||||
};
|
||||
typedef struct _WIN32_FILE_SEARCH WIN32_FILE_SEARCH;
|
||||
|
||||
HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData)
|
||||
{
|
||||
char *p;
|
||||
char* p;
|
||||
int index;
|
||||
int length;
|
||||
struct stat fileStat;
|
||||
WIN32_FILE_SEARCH *pFileSearch;
|
||||
WIN32_FILE_SEARCH* pFileSearch;
|
||||
ZeroMemory(lpFindFileData, sizeof(WIN32_FIND_DATAA));
|
||||
pFileSearch = (WIN32_FILE_SEARCH *) malloc(sizeof(WIN32_FILE_SEARCH));
|
||||
pFileSearch = (WIN32_FILE_SEARCH*) malloc(sizeof(WIN32_FILE_SEARCH));
|
||||
ZeroMemory(pFileSearch, sizeof(WIN32_FILE_SEARCH));
|
||||
/* Separate lpFileName into path and pattern components */
|
||||
p = strrchr(lpFileName, '/');
|
||||
@ -814,7 +814,7 @@ HANDLE FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPV
|
||||
|
||||
BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData)
|
||||
{
|
||||
WIN32_FILE_SEARCH *pFileSearch;
|
||||
WIN32_FILE_SEARCH* pFileSearch;
|
||||
|
||||
if (!hFindFile)
|
||||
return FALSE;
|
||||
@ -822,7 +822,7 @@ BOOL FindNextFileA(HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData)
|
||||
if (hFindFile == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
pFileSearch = (WIN32_FILE_SEARCH *) hFindFile;
|
||||
pFileSearch = (WIN32_FILE_SEARCH*) hFindFile;
|
||||
|
||||
while ((pFileSearch->pDirent = readdir(pFileSearch->pDir)) != NULL)
|
||||
{
|
||||
@ -843,8 +843,8 @@ BOOL FindNextFileW(HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData)
|
||||
|
||||
BOOL FindClose(HANDLE hFindFile)
|
||||
{
|
||||
WIN32_FILE_SEARCH *pFileSearch;
|
||||
pFileSearch = (WIN32_FILE_SEARCH *) hFindFile;
|
||||
WIN32_FILE_SEARCH* pFileSearch;
|
||||
pFileSearch = (WIN32_FILE_SEARCH*) hFindFile;
|
||||
|
||||
if (pFileSearch)
|
||||
{
|
||||
@ -891,9 +891,9 @@ BOOL IsNamedPipeFileNameA(LPCSTR lpName)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *GetNamedPipeNameWithoutPrefixA(LPCSTR lpName)
|
||||
char* GetNamedPipeNameWithoutPrefixA(LPCSTR lpName)
|
||||
{
|
||||
char *lpFileName;
|
||||
char* lpFileName;
|
||||
|
||||
if (!lpName)
|
||||
return NULL;
|
||||
@ -905,24 +905,24 @@ char *GetNamedPipeNameWithoutPrefixA(LPCSTR lpName)
|
||||
return lpFileName;
|
||||
}
|
||||
|
||||
char *GetNamedPipeUnixDomainSocketBaseFilePathA()
|
||||
char* GetNamedPipeUnixDomainSocketBaseFilePathA()
|
||||
{
|
||||
char *lpTempPath;
|
||||
char *lpPipePath;
|
||||
char* lpTempPath;
|
||||
char* lpPipePath;
|
||||
lpTempPath = GetKnownPath(KNOWN_PATH_TEMP);
|
||||
lpPipePath = GetCombinedPath(lpTempPath, ".pipe");
|
||||
free(lpTempPath);
|
||||
return lpPipePath;
|
||||
}
|
||||
|
||||
char *GetNamedPipeUnixDomainSocketFilePathA(LPCSTR lpName)
|
||||
char* GetNamedPipeUnixDomainSocketFilePathA(LPCSTR lpName)
|
||||
{
|
||||
char *lpPipePath;
|
||||
char *lpFileName;
|
||||
char *lpFilePath;
|
||||
char* lpPipePath;
|
||||
char* lpFileName;
|
||||
char* lpFilePath;
|
||||
lpPipePath = GetNamedPipeUnixDomainSocketBaseFilePathA();
|
||||
lpFileName = GetNamedPipeNameWithoutPrefixA(lpName);
|
||||
lpFilePath = GetCombinedPath(lpPipePath, (char *) lpFileName);
|
||||
lpFilePath = GetCombinedPath(lpPipePath, (char*) lpFileName);
|
||||
free(lpPipePath);
|
||||
free(lpFileName);
|
||||
return lpFilePath;
|
||||
@ -932,8 +932,8 @@ int GetNamePipeFileDescriptor(HANDLE hNamedPipe)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
int fd;
|
||||
WINPR_NAMED_PIPE *pNamedPipe;
|
||||
pNamedPipe = (WINPR_NAMED_PIPE *) hNamedPipe;
|
||||
WINPR_NAMED_PIPE* pNamedPipe;
|
||||
pNamedPipe = (WINPR_NAMED_PIPE*) hNamedPipe;
|
||||
|
||||
if (!pNamedPipe || pNamedPipe->Type != HANDLE_TYPE_NAMED_PIPE)
|
||||
return -1;
|
||||
@ -945,7 +945,7 @@ int GetNamePipeFileDescriptor(HANDLE hNamedPipe)
|
||||
#endif
|
||||
}
|
||||
|
||||
int UnixChangeFileMode(const char *filename, int flags)
|
||||
int UnixChangeFileMode(const char* filename, int flags)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
mode_t fl = 0;
|
||||
|
@ -42,7 +42,7 @@
|
||||
* http://download.microsoft.com/download/4/3/8/43889780-8d45-4b2e-9d3a-c696a890309f/File%20System%20Behavior%20Overview.pdf
|
||||
*/
|
||||
|
||||
LPSTR FilePatternFindNextWildcardA(LPCSTR lpPattern, DWORD *pFlags)
|
||||
LPSTR FilePatternFindNextWildcardA(LPCSTR lpPattern, DWORD* pFlags)
|
||||
{
|
||||
LPSTR lpWildcard;
|
||||
*pFlags = 0;
|
||||
@ -84,7 +84,7 @@ LPSTR FilePatternFindNextWildcardA(LPCSTR lpPattern, DWORD *pFlags)
|
||||
}
|
||||
|
||||
BOOL FilePatternMatchSubExpressionA(LPCSTR lpFileName, size_t cchFileName,
|
||||
LPCSTR lpX, size_t cchX, LPCSTR lpY, size_t cchY, LPCSTR lpWildcard, LPSTR *ppMatchEnd)
|
||||
LPCSTR lpX, size_t cchX, LPCSTR lpY, size_t cchY, LPCSTR lpWildcard, LPSTR* ppMatchEnd)
|
||||
{
|
||||
LPSTR lpMatch;
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
/* _HandleCreators is a NULL-terminated array with a maximun of HANDLE_CREATOR_MAX HANDLE_CREATOR */
|
||||
#define HANDLE_CLOSE_CB_MAX 128
|
||||
static HANDLE_CLOSE_CB **_HandleCloseCbs = NULL;
|
||||
static HANDLE_CLOSE_CB** _HandleCloseCbs = NULL;
|
||||
static CRITICAL_SECTION _HandleCloseCbsLock;
|
||||
|
||||
static pthread_once_t _HandleCloseCbsInitialized = PTHREAD_ONCE_INIT;
|
||||
@ -52,7 +52,7 @@ static void _HandleCloseCbsInit()
|
||||
{
|
||||
/* NB: error management to be done outside of this function */
|
||||
assert(_HandleCloseCbs == NULL);
|
||||
_HandleCloseCbs = (HANDLE_CLOSE_CB **)calloc(HANDLE_CLOSE_CB_MAX+1, sizeof(HANDLE_CLOSE_CB *));
|
||||
_HandleCloseCbs = (HANDLE_CLOSE_CB**)calloc(HANDLE_CLOSE_CB_MAX+1, sizeof(HANDLE_CLOSE_CB*));
|
||||
InitializeCriticalSection(&_HandleCloseCbsLock);
|
||||
assert(_HandleCloseCbs != NULL);
|
||||
}
|
||||
@ -60,7 +60,7 @@ static void _HandleCloseCbsInit()
|
||||
/**
|
||||
* Returns TRUE on success, FALSE otherwise.
|
||||
*/
|
||||
BOOL RegisterHandleCloseCb(HANDLE_CLOSE_CB *pHandleCloseCb)
|
||||
BOOL RegisterHandleCloseCb(HANDLE_CLOSE_CB* pHandleCloseCb)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -115,7 +115,7 @@ BOOL CloseHandle(HANDLE hObject)
|
||||
|
||||
for (i=0; _HandleCloseCbs[i] != NULL; i++)
|
||||
{
|
||||
HANDLE_CLOSE_CB *close_cb = (HANDLE_CLOSE_CB *)_HandleCloseCbs[i];
|
||||
HANDLE_CLOSE_CB* close_cb = (HANDLE_CLOSE_CB*)_HandleCloseCbs[i];
|
||||
|
||||
if (close_cb && close_cb->IsHandled(hObject))
|
||||
{
|
||||
@ -129,8 +129,8 @@ BOOL CloseHandle(HANDLE hObject)
|
||||
|
||||
if (Type == HANDLE_TYPE_THREAD)
|
||||
{
|
||||
WINPR_THREAD *thread;
|
||||
thread = (WINPR_THREAD *) Object;
|
||||
WINPR_THREAD* thread;
|
||||
thread = (WINPR_THREAD*) Object;
|
||||
|
||||
if (thread->started)
|
||||
{
|
||||
@ -142,23 +142,23 @@ BOOL CloseHandle(HANDLE hObject)
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_PROCESS)
|
||||
{
|
||||
WINPR_PROCESS *process;
|
||||
process = (WINPR_PROCESS *) Object;
|
||||
WINPR_PROCESS* process;
|
||||
process = (WINPR_PROCESS*) Object;
|
||||
free(process);
|
||||
return TRUE;
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_MUTEX)
|
||||
{
|
||||
WINPR_MUTEX *mutex;
|
||||
mutex = (WINPR_MUTEX *) Object;
|
||||
WINPR_MUTEX* mutex;
|
||||
mutex = (WINPR_MUTEX*) Object;
|
||||
pthread_mutex_destroy(&mutex->mutex);
|
||||
free(Object);
|
||||
return TRUE;
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_EVENT)
|
||||
{
|
||||
WINPR_EVENT *event;
|
||||
event = (WINPR_EVENT *) Object;
|
||||
WINPR_EVENT* event;
|
||||
event = (WINPR_EVENT*) Object;
|
||||
|
||||
if (!event->bAttached)
|
||||
{
|
||||
@ -180,8 +180,8 @@ BOOL CloseHandle(HANDLE hObject)
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_SEMAPHORE)
|
||||
{
|
||||
WINPR_SEMAPHORE *semaphore;
|
||||
semaphore = (WINPR_SEMAPHORE *) Object;
|
||||
WINPR_SEMAPHORE* semaphore;
|
||||
semaphore = (WINPR_SEMAPHORE*) Object;
|
||||
#ifdef WINPR_PIPE_SEMAPHORE
|
||||
|
||||
if (semaphore->pipe_fd[0] != -1)
|
||||
@ -198,9 +198,9 @@ BOOL CloseHandle(HANDLE hObject)
|
||||
|
||||
#else
|
||||
#if defined __APPLE__
|
||||
semaphore_destroy(mach_task_self(), *((winpr_sem_t *) semaphore->sem));
|
||||
semaphore_destroy(mach_task_self(), *((winpr_sem_t*) semaphore->sem));
|
||||
#else
|
||||
sem_destroy((winpr_sem_t *) semaphore->sem);
|
||||
sem_destroy((winpr_sem_t*) semaphore->sem);
|
||||
#endif
|
||||
#endif
|
||||
free(Object);
|
||||
@ -208,8 +208,8 @@ BOOL CloseHandle(HANDLE hObject)
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_TIMER)
|
||||
{
|
||||
WINPR_TIMER *timer;
|
||||
timer = (WINPR_TIMER *) Object;
|
||||
WINPR_TIMER* timer;
|
||||
timer = (WINPR_TIMER*) Object;
|
||||
#ifdef __linux__
|
||||
|
||||
if (timer->fd != -1)
|
||||
@ -221,8 +221,8 @@ BOOL CloseHandle(HANDLE hObject)
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_ANONYMOUS_PIPE)
|
||||
{
|
||||
WINPR_PIPE *pipe;
|
||||
pipe = (WINPR_PIPE *) Object;
|
||||
WINPR_PIPE* pipe;
|
||||
pipe = (WINPR_PIPE*) Object;
|
||||
|
||||
if (pipe->fd != -1)
|
||||
{
|
||||
@ -234,7 +234,7 @@ BOOL CloseHandle(HANDLE hObject)
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_NAMED_PIPE)
|
||||
{
|
||||
WINPR_NAMED_PIPE *pNamedPipe = (WINPR_NAMED_PIPE *) Object;
|
||||
WINPR_NAMED_PIPE* pNamedPipe = (WINPR_NAMED_PIPE*) Object;
|
||||
|
||||
if (pNamedPipe->clientfd != -1)
|
||||
{
|
||||
@ -251,16 +251,16 @@ BOOL CloseHandle(HANDLE hObject)
|
||||
if (pNamedPipe->pfnUnrefNamedPipe)
|
||||
pNamedPipe->pfnUnrefNamedPipe(pNamedPipe);
|
||||
|
||||
free((void *)pNamedPipe->lpFileName);
|
||||
free((void *)pNamedPipe->lpFilePath);
|
||||
free((void *)pNamedPipe->name);
|
||||
free((void*)pNamedPipe->lpFileName);
|
||||
free((void*)pNamedPipe->lpFilePath);
|
||||
free((void*)pNamedPipe->name);
|
||||
free(pNamedPipe);
|
||||
return TRUE;
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_ACCESS_TOKEN)
|
||||
{
|
||||
WINPR_ACCESS_TOKEN *token;
|
||||
token = (WINPR_ACCESS_TOKEN *) Object;
|
||||
WINPR_ACCESS_TOKEN* token;
|
||||
token = (WINPR_ACCESS_TOKEN*) Object;
|
||||
|
||||
if (token->Username)
|
||||
free(token->Username);
|
||||
|
@ -61,11 +61,11 @@
|
||||
* descriptor gets closed and the entry is removed from the list.
|
||||
*/
|
||||
|
||||
static wArrayList *g_NamedPipeServerSockets = NULL;
|
||||
static wArrayList* g_NamedPipeServerSockets = NULL;
|
||||
|
||||
typedef struct _NamedPipeServerSocketEntry
|
||||
{
|
||||
char *name;
|
||||
char* name;
|
||||
int serverfd;
|
||||
int references;
|
||||
} NamedPipeServerSocketEntry;
|
||||
@ -86,8 +86,8 @@ static void InitWinPRPipeModule()
|
||||
BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
|
||||
{
|
||||
int pipe_fd[2];
|
||||
WINPR_PIPE *pReadPipe;
|
||||
WINPR_PIPE *pWritePipe;
|
||||
WINPR_PIPE* pReadPipe;
|
||||
WINPR_PIPE* pWritePipe;
|
||||
pipe_fd[0] = -1;
|
||||
pipe_fd[1] = -1;
|
||||
|
||||
@ -97,8 +97,8 @@ BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpP
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pReadPipe = (WINPR_PIPE *) malloc(sizeof(WINPR_PIPE));
|
||||
pWritePipe = (WINPR_PIPE *) malloc(sizeof(WINPR_PIPE));
|
||||
pReadPipe = (WINPR_PIPE*) malloc(sizeof(WINPR_PIPE));
|
||||
pWritePipe = (WINPR_PIPE*) malloc(sizeof(WINPR_PIPE));
|
||||
|
||||
if (!pReadPipe || !pWritePipe)
|
||||
{
|
||||
@ -114,9 +114,9 @@ BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpP
|
||||
pReadPipe->fd = pipe_fd[0];
|
||||
pWritePipe->fd = pipe_fd[1];
|
||||
WINPR_HANDLE_SET_TYPE(pReadPipe, HANDLE_TYPE_ANONYMOUS_PIPE);
|
||||
*((ULONG_PTR *) hReadPipe) = (ULONG_PTR) pReadPipe;
|
||||
*((ULONG_PTR*) hReadPipe) = (ULONG_PTR) pReadPipe;
|
||||
WINPR_HANDLE_SET_TYPE(pWritePipe, HANDLE_TYPE_ANONYMOUS_PIPE);
|
||||
*((ULONG_PTR *) hWritePipe) = (ULONG_PTR) pWritePipe;
|
||||
*((ULONG_PTR*) hWritePipe) = (ULONG_PTR) pWritePipe;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -124,10 +124,10 @@ BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpP
|
||||
* Named pipe
|
||||
*/
|
||||
|
||||
static void winpr_unref_named_pipe(WINPR_NAMED_PIPE *pNamedPipe)
|
||||
static void winpr_unref_named_pipe(WINPR_NAMED_PIPE* pNamedPipe)
|
||||
{
|
||||
int index;
|
||||
NamedPipeServerSocketEntry *baseSocket;
|
||||
NamedPipeServerSocketEntry* baseSocket;
|
||||
|
||||
if (!pNamedPipe)
|
||||
return;
|
||||
@ -139,7 +139,7 @@ static void winpr_unref_named_pipe(WINPR_NAMED_PIPE *pNamedPipe)
|
||||
|
||||
for (index = 0; index < ArrayList_Count(g_NamedPipeServerSockets); index++)
|
||||
{
|
||||
baseSocket = (NamedPipeServerSocketEntry *) ArrayList_GetItem(
|
||||
baseSocket = (NamedPipeServerSocketEntry*) ArrayList_GetItem(
|
||||
g_NamedPipeServerSockets, index);
|
||||
assert(baseSocket->name);
|
||||
|
||||
@ -170,17 +170,17 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
|
||||
{
|
||||
int index;
|
||||
HANDLE hNamedPipe = INVALID_HANDLE_VALUE;
|
||||
char *lpPipePath;
|
||||
char* lpPipePath;
|
||||
struct sockaddr_un s;
|
||||
WINPR_NAMED_PIPE *pNamedPipe = NULL;
|
||||
WINPR_NAMED_PIPE* pNamedPipe = NULL;
|
||||
int serverfd = -1;
|
||||
NamedPipeServerSocketEntry *baseSocket = NULL;
|
||||
NamedPipeServerSocketEntry* baseSocket = NULL;
|
||||
|
||||
if (!lpName)
|
||||
return INVALID_HANDLE_VALUE;
|
||||
|
||||
InitWinPRPipeModule();
|
||||
pNamedPipe = (WINPR_NAMED_PIPE *) calloc(1, sizeof(WINPR_NAMED_PIPE));
|
||||
pNamedPipe = (WINPR_NAMED_PIPE*) calloc(1, sizeof(WINPR_NAMED_PIPE));
|
||||
WINPR_HANDLE_SET_TYPE(pNamedPipe, HANDLE_TYPE_NAMED_PIPE);
|
||||
|
||||
if (!(pNamedPipe->name = _strdup(lpName)))
|
||||
@ -205,7 +205,7 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
|
||||
|
||||
for (index = 0; index < ArrayList_Count(g_NamedPipeServerSockets); index++)
|
||||
{
|
||||
baseSocket = (NamedPipeServerSocketEntry *) ArrayList_GetItem(
|
||||
baseSocket = (NamedPipeServerSocketEntry*) ArrayList_GetItem(
|
||||
g_NamedPipeServerSockets, index);
|
||||
|
||||
if (!strcmp(baseSocket->name, lpName))
|
||||
@ -246,7 +246,7 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
|
||||
s.sun_family = AF_UNIX;
|
||||
strcpy(s.sun_path, pNamedPipe->lpFilePath);
|
||||
|
||||
if (bind(serverfd, (struct sockaddr *) &s, sizeof(struct sockaddr_un)) == -1)
|
||||
if (bind(serverfd, (struct sockaddr*) &s, sizeof(struct sockaddr_un)) == -1)
|
||||
{
|
||||
WLog_ERR(TAG, "CreateNamedPipeA: bind error, %s", strerror(errno));
|
||||
goto out;
|
||||
@ -260,7 +260,7 @@ HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD
|
||||
|
||||
UnixChangeFileMode(pNamedPipe->lpFilePath, 0xFFFF);
|
||||
|
||||
if (!(baseSocket = (NamedPipeServerSocketEntry *) malloc(sizeof(NamedPipeServerSocketEntry))))
|
||||
if (!(baseSocket = (NamedPipeServerSocketEntry*) malloc(sizeof(NamedPipeServerSocketEntry))))
|
||||
goto out;
|
||||
|
||||
if (!(baseSocket->name = _strdup(lpName)))
|
||||
@ -298,9 +298,9 @@ out:
|
||||
{
|
||||
if (pNamedPipe)
|
||||
{
|
||||
free((void *)pNamedPipe->name);
|
||||
free((void *)pNamedPipe->lpFileName);
|
||||
free((void *)pNamedPipe->lpFilePath);
|
||||
free((void*)pNamedPipe->name);
|
||||
free((void*)pNamedPipe->lpFileName);
|
||||
free((void*)pNamedPipe->lpFilePath);
|
||||
free(pNamedPipe);
|
||||
}
|
||||
|
||||
@ -323,18 +323,18 @@ BOOL ConnectNamedPipe(HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped)
|
||||
int status;
|
||||
socklen_t length;
|
||||
struct sockaddr_un s;
|
||||
WINPR_NAMED_PIPE *pNamedPipe;
|
||||
WINPR_NAMED_PIPE* pNamedPipe;
|
||||
|
||||
if (!hNamedPipe)
|
||||
return FALSE;
|
||||
|
||||
pNamedPipe = (WINPR_NAMED_PIPE *) hNamedPipe;
|
||||
pNamedPipe = (WINPR_NAMED_PIPE*) hNamedPipe;
|
||||
|
||||
if (!(pNamedPipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED))
|
||||
{
|
||||
length = sizeof(struct sockaddr_un);
|
||||
ZeroMemory(&s, sizeof(struct sockaddr_un));
|
||||
status = accept(pNamedPipe->serverfd, (struct sockaddr *) &s, &length);
|
||||
status = accept(pNamedPipe->serverfd, (struct sockaddr*) &s, &length);
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
@ -366,8 +366,8 @@ BOOL ConnectNamedPipe(HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped)
|
||||
|
||||
BOOL DisconnectNamedPipe(HANDLE hNamedPipe)
|
||||
{
|
||||
WINPR_NAMED_PIPE *pNamedPipe;
|
||||
pNamedPipe = (WINPR_NAMED_PIPE *) hNamedPipe;
|
||||
WINPR_NAMED_PIPE* pNamedPipe;
|
||||
pNamedPipe = (WINPR_NAMED_PIPE*) hNamedPipe;
|
||||
|
||||
if (pNamedPipe->clientfd != -1)
|
||||
{
|
||||
@ -396,7 +396,7 @@ BOOL WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut)
|
||||
{
|
||||
BOOL status;
|
||||
DWORD nWaitTime;
|
||||
char *lpFilePath;
|
||||
char* lpFilePath;
|
||||
DWORD dwSleepInterval;
|
||||
|
||||
if (!lpNamedPipeName)
|
||||
@ -437,8 +437,8 @@ BOOL SetNamedPipeHandleState(HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCol
|
||||
{
|
||||
int fd;
|
||||
int flags;
|
||||
WINPR_NAMED_PIPE *pNamedPipe;
|
||||
pNamedPipe = (WINPR_NAMED_PIPE *) hNamedPipe;
|
||||
WINPR_NAMED_PIPE* pNamedPipe;
|
||||
pNamedPipe = (WINPR_NAMED_PIPE*) hNamedPipe;
|
||||
|
||||
if (lpMode)
|
||||
{
|
||||
|
@ -23,11 +23,11 @@ static LPTSTR lpszPipeNameSt = _T("\\\\.\\pipe\\winpr_test_pipe_st");
|
||||
|
||||
BOOL testFailed = FALSE;
|
||||
|
||||
static void *named_pipe_client_thread(void *arg)
|
||||
static void* named_pipe_client_thread(void* arg)
|
||||
{
|
||||
HANDLE hNamedPipe = NULL;
|
||||
BYTE *lpReadBuffer = NULL;
|
||||
BYTE *lpWriteBuffer = NULL;
|
||||
BYTE* lpReadBuffer = NULL;
|
||||
BYTE* lpWriteBuffer = NULL;
|
||||
BOOL fSuccess = FALSE;
|
||||
DWORD nNumberOfBytesToRead;
|
||||
DWORD nNumberOfBytesToWrite;
|
||||
@ -48,13 +48,13 @@ static void *named_pipe_client_thread(void *arg)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!(lpReadBuffer = (BYTE *) malloc(PIPE_BUFFER_SIZE)))
|
||||
if (!(lpReadBuffer = (BYTE*) malloc(PIPE_BUFFER_SIZE)))
|
||||
{
|
||||
printf("%s: Error allocating read buffer\n", __FUNCTION__);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!(lpWriteBuffer = (BYTE *) malloc(PIPE_BUFFER_SIZE)))
|
||||
if (!(lpWriteBuffer = (BYTE*) malloc(PIPE_BUFFER_SIZE)))
|
||||
{
|
||||
printf("%s: Error allocating write buffer\n", __FUNCTION__);
|
||||
goto out;
|
||||
@ -96,11 +96,11 @@ out:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *named_pipe_server_thread(void *arg)
|
||||
static void* named_pipe_server_thread(void* arg)
|
||||
{
|
||||
HANDLE hNamedPipe = NULL;
|
||||
BYTE *lpReadBuffer = NULL;
|
||||
BYTE *lpWriteBuffer = NULL;
|
||||
BYTE* lpReadBuffer = NULL;
|
||||
BYTE* lpWriteBuffer = NULL;
|
||||
BOOL fSuccess = FALSE;
|
||||
BOOL fConnected = FALSE;
|
||||
DWORD nNumberOfBytesToRead;
|
||||
@ -135,13 +135,13 @@ static void *named_pipe_server_thread(void *arg)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!(lpReadBuffer = (BYTE *) malloc(PIPE_BUFFER_SIZE)))
|
||||
if (!(lpReadBuffer = (BYTE*) malloc(PIPE_BUFFER_SIZE)))
|
||||
{
|
||||
printf("%s: Error allocating read buffer\n", __FUNCTION__);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!(lpWriteBuffer = (BYTE *) malloc(PIPE_BUFFER_SIZE)))
|
||||
if (!(lpWriteBuffer = (BYTE*) malloc(PIPE_BUFFER_SIZE)))
|
||||
{
|
||||
printf("%s: Error allocating write buffer\n", __FUNCTION__);
|
||||
goto out;
|
||||
@ -184,7 +184,7 @@ out:
|
||||
}
|
||||
|
||||
#define TESTNUMPIPESST 16
|
||||
static void *named_pipe_single_thread(void *arg)
|
||||
static void* named_pipe_single_thread(void* arg)
|
||||
{
|
||||
HANDLE servers[TESTNUMPIPESST];
|
||||
HANDLE clients[TESTNUMPIPESST];
|
||||
@ -196,7 +196,7 @@ static void *named_pipe_single_thread(void *arg)
|
||||
int numPipes;
|
||||
BOOL bSuccess = FALSE;
|
||||
#ifndef _WIN32
|
||||
WINPR_NAMED_PIPE *p;
|
||||
WINPR_NAMED_PIPE* p;
|
||||
#endif
|
||||
numPipes = TESTNUMPIPESST;
|
||||
memset(servers, 0, sizeof(servers));
|
||||
@ -218,7 +218,7 @@ static void *named_pipe_single_thread(void *arg)
|
||||
|
||||
for (i = 0; i < numPipes; i++)
|
||||
{
|
||||
p = (WINPR_NAMED_PIPE *)servers[i];
|
||||
p = (WINPR_NAMED_PIPE*)servers[i];
|
||||
|
||||
if (strcmp(lpszPipeNameSt, p->name))
|
||||
{
|
||||
@ -431,7 +431,7 @@ out:
|
||||
}
|
||||
|
||||
|
||||
int TestPipeCreateNamedPipe(int argc, char *argv[])
|
||||
int TestPipeCreateNamedPipe(int argc, char* argv[])
|
||||
{
|
||||
HANDLE SingleThread;
|
||||
HANDLE ClientThread;
|
||||
|
@ -16,13 +16,13 @@ static HANDLE ReadyEvent;
|
||||
|
||||
static LPTSTR lpszPipeName = _T("\\\\.\\pipe\\winpr_test_pipe_overlapped");
|
||||
|
||||
static void *named_pipe_client_thread(void *arg)
|
||||
static void* named_pipe_client_thread(void* arg)
|
||||
{
|
||||
DWORD status;
|
||||
HANDLE hEvent;
|
||||
HANDLE hNamedPipe;
|
||||
BYTE *lpReadBuffer;
|
||||
BYTE *lpWriteBuffer;
|
||||
BYTE* lpReadBuffer;
|
||||
BYTE* lpWriteBuffer;
|
||||
BOOL fSuccess = FALSE;
|
||||
OVERLAPPED overlapped;
|
||||
DWORD nNumberOfBytesToRead;
|
||||
@ -43,8 +43,8 @@ static void *named_pipe_client_thread(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lpReadBuffer = (BYTE *) malloc(PIPE_BUFFER_SIZE);
|
||||
lpWriteBuffer = (BYTE *) malloc(PIPE_BUFFER_SIZE);
|
||||
lpReadBuffer = (BYTE*) malloc(PIPE_BUFFER_SIZE);
|
||||
lpWriteBuffer = (BYTE*) malloc(PIPE_BUFFER_SIZE);
|
||||
ZeroMemory(&overlapped, sizeof(OVERLAPPED));
|
||||
hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
overlapped.hEvent = hEvent;
|
||||
@ -99,13 +99,13 @@ static void *named_pipe_client_thread(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *named_pipe_server_thread(void *arg)
|
||||
static void* named_pipe_server_thread(void* arg)
|
||||
{
|
||||
DWORD status;
|
||||
HANDLE hEvent;
|
||||
HANDLE hNamedPipe;
|
||||
BYTE *lpReadBuffer;
|
||||
BYTE *lpWriteBuffer;
|
||||
BYTE* lpReadBuffer;
|
||||
BYTE* lpWriteBuffer;
|
||||
OVERLAPPED overlapped;
|
||||
BOOL fSuccess = FALSE;
|
||||
BOOL fConnected = FALSE;
|
||||
@ -151,8 +151,8 @@ static void *named_pipe_server_thread(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lpReadBuffer = (BYTE *) malloc(PIPE_BUFFER_SIZE);
|
||||
lpWriteBuffer = (BYTE *) malloc(PIPE_BUFFER_SIZE);
|
||||
lpReadBuffer = (BYTE*) malloc(PIPE_BUFFER_SIZE);
|
||||
lpWriteBuffer = (BYTE*) malloc(PIPE_BUFFER_SIZE);
|
||||
nNumberOfBytesToRead = PIPE_BUFFER_SIZE;
|
||||
ZeroMemory(lpReadBuffer, PIPE_BUFFER_SIZE);
|
||||
fSuccess = ReadFile(hNamedPipe, lpReadBuffer, nNumberOfBytesToRead, NULL, &overlapped);
|
||||
@ -204,7 +204,7 @@ static void *named_pipe_server_thread(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int TestPipeCreateNamedPipeOverlapped(int argc, char *argv[])
|
||||
int TestPipeCreateNamedPipeOverlapped(int argc, char* argv[])
|
||||
{
|
||||
HANDLE ClientThread;
|
||||
HANDLE ServerThread;
|
||||
|
@ -34,11 +34,11 @@ static BOOL module_initialized = FALSE;
|
||||
static BOOL module_available = FALSE;
|
||||
static HMODULE kernel32_module = NULL;
|
||||
|
||||
static PTP_WORK(WINAPI *pCreateThreadpoolWork)(PTP_WORK_CALLBACK pfnwk, PVOID pv, PTP_CALLBACK_ENVIRON pcbe);
|
||||
static VOID (WINAPI *pCloseThreadpoolWork)(PTP_WORK pwk);
|
||||
static VOID (WINAPI *pSubmitThreadpoolWork)(PTP_WORK pwk);
|
||||
static BOOL (WINAPI *pTrySubmitThreadpoolCallback)(PTP_SIMPLE_CALLBACK pfns, PVOID pv, PTP_CALLBACK_ENVIRON pcbe);
|
||||
static VOID (WINAPI *pWaitForThreadpoolWorkCallbacks)(PTP_WORK pwk, BOOL fCancelPendingCallbacks);
|
||||
static PTP_WORK(WINAPI* pCreateThreadpoolWork)(PTP_WORK_CALLBACK pfnwk, PVOID pv, PTP_CALLBACK_ENVIRON pcbe);
|
||||
static VOID (WINAPI* pCloseThreadpoolWork)(PTP_WORK pwk);
|
||||
static VOID (WINAPI* pSubmitThreadpoolWork)(PTP_WORK pwk);
|
||||
static BOOL (WINAPI* pTrySubmitThreadpoolCallback)(PTP_SIMPLE_CALLBACK pfns, PVOID pv, PTP_CALLBACK_ENVIRON pcbe);
|
||||
static VOID (WINAPI* pWaitForThreadpoolWorkCallbacks)(PTP_WORK pwk, BOOL fCancelPendingCallbacks);
|
||||
|
||||
static void module_init()
|
||||
{
|
||||
@ -52,11 +52,11 @@ static void module_init()
|
||||
return;
|
||||
|
||||
module_available = TRUE;
|
||||
pCreateThreadpoolWork = (void *) GetProcAddress(kernel32_module, "CreateThreadpoolWork");
|
||||
pCloseThreadpoolWork = (void *) GetProcAddress(kernel32_module, "CloseThreadpoolWork");
|
||||
pSubmitThreadpoolWork = (void *) GetProcAddress(kernel32_module, "SubmitThreadpoolWork");
|
||||
pTrySubmitThreadpoolCallback = (void *) GetProcAddress(kernel32_module, "TrySubmitThreadpoolCallback");
|
||||
pWaitForThreadpoolWorkCallbacks = (void *) GetProcAddress(kernel32_module, "WaitForThreadpoolWorkCallbacks");
|
||||
pCreateThreadpoolWork = (void*) GetProcAddress(kernel32_module, "CreateThreadpoolWork");
|
||||
pCloseThreadpoolWork = (void*) GetProcAddress(kernel32_module, "CloseThreadpoolWork");
|
||||
pSubmitThreadpoolWork = (void*) GetProcAddress(kernel32_module, "SubmitThreadpoolWork");
|
||||
pTrySubmitThreadpoolCallback = (void*) GetProcAddress(kernel32_module, "TrySubmitThreadpoolCallback");
|
||||
pWaitForThreadpoolWorkCallbacks = (void*) GetProcAddress(kernel32_module, "WaitForThreadpoolWorkCallbacks");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -34,12 +34,12 @@
|
||||
|
||||
#define WINPR_HKLM_HIVE "/etc/winpr/HKLM.reg"
|
||||
|
||||
static void reg_print_key(Reg *reg, RegKey *key);
|
||||
static void reg_print_value(Reg *reg, RegVal *value);
|
||||
static void reg_print_key(Reg* reg, RegKey* key);
|
||||
static void reg_print_value(Reg* reg, RegVal* value);
|
||||
|
||||
struct reg_data_type
|
||||
{
|
||||
char *tag;
|
||||
char* tag;
|
||||
int length;
|
||||
DWORD type;
|
||||
};
|
||||
@ -58,7 +58,7 @@ static struct reg_data_type REG_DATA_TYPE_TABLE[] =
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
|
||||
static char *REG_DATA_TYPE_STRINGS[] =
|
||||
static char* REG_DATA_TYPE_STRINGS[] =
|
||||
{
|
||||
"REG_NONE",
|
||||
"REG_SZ",
|
||||
@ -74,7 +74,7 @@ static char *REG_DATA_TYPE_STRINGS[] =
|
||||
"REG_QWORD"
|
||||
};
|
||||
|
||||
static void reg_load_start(Reg *reg)
|
||||
static void reg_load_start(Reg* reg)
|
||||
{
|
||||
long int file_size;
|
||||
fseek(reg->fp, 0, SEEK_END);
|
||||
@ -87,7 +87,7 @@ static void reg_load_start(Reg *reg)
|
||||
if (file_size < 1)
|
||||
return;
|
||||
|
||||
reg->buffer = (char *) malloc(file_size + 2);
|
||||
reg->buffer = (char*) malloc(file_size + 2);
|
||||
|
||||
if (fread(reg->buffer, file_size, 1, reg->fp) != 1)
|
||||
{
|
||||
@ -101,7 +101,7 @@ static void reg_load_start(Reg *reg)
|
||||
reg->next_line = strtok(reg->buffer, "\n");
|
||||
}
|
||||
|
||||
static void reg_load_finish(Reg *reg)
|
||||
static void reg_load_finish(Reg* reg)
|
||||
{
|
||||
if (!reg)
|
||||
return;
|
||||
@ -113,15 +113,15 @@ static void reg_load_finish(Reg *reg)
|
||||
}
|
||||
}
|
||||
|
||||
static RegVal *reg_load_value(Reg *reg, RegKey *key)
|
||||
static RegVal* reg_load_value(Reg* reg, RegKey* key)
|
||||
{
|
||||
int index;
|
||||
char *p[5];
|
||||
char* p[5];
|
||||
int length;
|
||||
char *name;
|
||||
char *type;
|
||||
char *data;
|
||||
RegVal *value;
|
||||
char* name;
|
||||
char* type;
|
||||
char* data;
|
||||
RegVal* value;
|
||||
p[0] = reg->line + 1;
|
||||
p[1] = strstr(p[0], "\"=");
|
||||
p[2] = p[1] + 2;
|
||||
@ -134,10 +134,10 @@ static RegVal *reg_load_value(Reg *reg, RegKey *key)
|
||||
|
||||
data = p[3] + 1;
|
||||
length = p[1] - p[0];
|
||||
name = (char *) malloc(length + 1);
|
||||
name = (char*) malloc(length + 1);
|
||||
memcpy(name, p[0], length);
|
||||
name[length] = '\0';
|
||||
value = (RegVal *) malloc(sizeof(RegVal));
|
||||
value = (RegVal*) malloc(sizeof(RegVal));
|
||||
value->name = name;
|
||||
value->type = REG_NONE;
|
||||
value->next = value->prev = NULL;
|
||||
@ -172,7 +172,7 @@ static RegVal *reg_load_value(Reg *reg, RegKey *key)
|
||||
}
|
||||
else
|
||||
{
|
||||
RegVal *pValue = key->values;
|
||||
RegVal* pValue = key->values;
|
||||
|
||||
while (pValue->next != NULL)
|
||||
{
|
||||
@ -186,7 +186,7 @@ static RegVal *reg_load_value(Reg *reg, RegKey *key)
|
||||
return value;
|
||||
}
|
||||
|
||||
static BOOL reg_load_has_next_line(Reg *reg)
|
||||
static BOOL reg_load_has_next_line(Reg* reg)
|
||||
{
|
||||
if (!reg)
|
||||
return 0;
|
||||
@ -194,7 +194,7 @@ static BOOL reg_load_has_next_line(Reg *reg)
|
||||
return (reg->next_line != NULL) ? 1 : 0;
|
||||
}
|
||||
|
||||
static char *reg_load_get_next_line(Reg *reg)
|
||||
static char* reg_load_get_next_line(Reg* reg)
|
||||
{
|
||||
if (!reg)
|
||||
return NULL;
|
||||
@ -205,16 +205,16 @@ static char *reg_load_get_next_line(Reg *reg)
|
||||
return reg->line;
|
||||
}
|
||||
|
||||
static char *reg_load_peek_next_line(Reg *reg)
|
||||
static char* reg_load_peek_next_line(Reg* reg)
|
||||
{
|
||||
return reg->next_line;
|
||||
}
|
||||
|
||||
static void reg_insert_key(Reg *reg, RegKey *key, RegKey *subkey)
|
||||
static void reg_insert_key(Reg* reg, RegKey* key, RegKey* subkey)
|
||||
{
|
||||
char *name;
|
||||
char *path;
|
||||
char *save;
|
||||
char* name;
|
||||
char* path;
|
||||
char* save;
|
||||
int length;
|
||||
path = _strdup(subkey->name);
|
||||
name = strtok_s(path, "\\", &save);
|
||||
@ -234,19 +234,19 @@ static void reg_insert_key(Reg *reg, RegKey *key, RegKey *subkey)
|
||||
free(path);
|
||||
}
|
||||
|
||||
static RegKey *reg_load_key(Reg *reg, RegKey *key)
|
||||
static RegKey* reg_load_key(Reg* reg, RegKey* key)
|
||||
{
|
||||
char *p[2];
|
||||
char* p[2];
|
||||
int length;
|
||||
char *line;
|
||||
RegKey *subkey;
|
||||
char* line;
|
||||
RegKey* subkey;
|
||||
p[0] = reg->line + 1;
|
||||
p[1] = strrchr(p[0], ']');
|
||||
subkey = (RegKey *) malloc(sizeof(RegKey));
|
||||
subkey = (RegKey*) malloc(sizeof(RegKey));
|
||||
subkey->values = NULL;
|
||||
subkey->prev = subkey->next = NULL;
|
||||
length = p[1] - p[0];
|
||||
subkey->name = (char *) malloc(length + 1);
|
||||
subkey->name = (char*) malloc(length + 1);
|
||||
memcpy(subkey->name, p[0], length);
|
||||
subkey->name[length] = '\0';
|
||||
|
||||
@ -273,7 +273,7 @@ static RegKey *reg_load_key(Reg *reg, RegKey *key)
|
||||
}
|
||||
else
|
||||
{
|
||||
RegKey *pKey = key->subkeys;
|
||||
RegKey* pKey = key->subkeys;
|
||||
|
||||
while (pKey->next != NULL)
|
||||
{
|
||||
@ -287,7 +287,7 @@ static RegKey *reg_load_key(Reg *reg, RegKey *key)
|
||||
return subkey;
|
||||
}
|
||||
|
||||
void reg_load(Reg *reg)
|
||||
void reg_load(Reg* reg)
|
||||
{
|
||||
reg_load_start(reg);
|
||||
|
||||
@ -304,7 +304,7 @@ void reg_load(Reg *reg)
|
||||
reg_load_finish(reg);
|
||||
}
|
||||
|
||||
static void reg_unload_value(Reg *reg, RegVal *value)
|
||||
static void reg_unload_value(Reg* reg, RegVal* value)
|
||||
{
|
||||
if (value->type == REG_DWORD)
|
||||
{
|
||||
@ -321,10 +321,10 @@ static void reg_unload_value(Reg *reg, RegVal *value)
|
||||
free(value);
|
||||
}
|
||||
|
||||
static void reg_unload_key(Reg *reg, RegKey *key)
|
||||
static void reg_unload_key(Reg* reg, RegKey* key)
|
||||
{
|
||||
RegVal *pValue;
|
||||
RegVal *pValueNext;
|
||||
RegVal* pValue;
|
||||
RegVal* pValueNext;
|
||||
pValue = key->values;
|
||||
|
||||
while (pValue != NULL)
|
||||
@ -338,10 +338,10 @@ static void reg_unload_key(Reg *reg, RegKey *key)
|
||||
free(key);
|
||||
}
|
||||
|
||||
void reg_unload(Reg *reg)
|
||||
void reg_unload(Reg* reg)
|
||||
{
|
||||
RegKey *pKey;
|
||||
RegKey *pKeyNext;
|
||||
RegKey* pKey;
|
||||
RegKey* pKeyNext;
|
||||
pKey = reg->root_key->subkeys;
|
||||
|
||||
while (pKey != NULL)
|
||||
@ -354,10 +354,10 @@ void reg_unload(Reg *reg)
|
||||
free(reg->root_key);
|
||||
}
|
||||
|
||||
Reg *reg_open(BOOL read_only)
|
||||
Reg* reg_open(BOOL read_only)
|
||||
{
|
||||
Reg *reg;
|
||||
reg = (Reg *) malloc(sizeof(Reg));
|
||||
Reg* reg;
|
||||
reg = (Reg*) malloc(sizeof(Reg));
|
||||
|
||||
if (reg)
|
||||
{
|
||||
@ -382,7 +382,7 @@ Reg *reg_open(BOOL read_only)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
reg->root_key = (RegKey *) malloc(sizeof(RegKey));
|
||||
reg->root_key = (RegKey*) malloc(sizeof(RegKey));
|
||||
reg->root_key->values = NULL;
|
||||
reg->root_key->subkeys = NULL;
|
||||
reg->root_key->name = "HKEY_LOCAL_MACHINE";
|
||||
@ -392,7 +392,7 @@ Reg *reg_open(BOOL read_only)
|
||||
return reg;
|
||||
}
|
||||
|
||||
void reg_close(Reg *reg)
|
||||
void reg_close(Reg* reg)
|
||||
{
|
||||
if (reg)
|
||||
{
|
||||
@ -402,7 +402,7 @@ void reg_close(Reg *reg)
|
||||
}
|
||||
}
|
||||
|
||||
void reg_print_value(Reg *reg, RegVal *value)
|
||||
void reg_print_value(Reg* reg, RegVal* value)
|
||||
{
|
||||
WLog_INFO(TAG, "\"%s\"=", value->name);
|
||||
|
||||
@ -420,9 +420,9 @@ void reg_print_value(Reg *reg, RegVal *value)
|
||||
}
|
||||
}
|
||||
|
||||
void reg_print_key(Reg *reg, RegKey *key)
|
||||
void reg_print_key(Reg* reg, RegKey* key)
|
||||
{
|
||||
RegVal *pValue;
|
||||
RegVal* pValue;
|
||||
pValue = key->values;
|
||||
WLog_INFO(TAG, "[%s]", key->name);
|
||||
|
||||
@ -433,9 +433,9 @@ void reg_print_key(Reg *reg, RegKey *key)
|
||||
}
|
||||
}
|
||||
|
||||
void reg_print(Reg *reg)
|
||||
void reg_print(Reg* reg)
|
||||
{
|
||||
RegKey *pKey;
|
||||
RegKey* pKey;
|
||||
pKey = reg->root_key->subkeys;
|
||||
|
||||
while (pKey != NULL)
|
||||
|
@ -86,7 +86,7 @@ void NdrPrintParamAttributes(PARAM_ATTRIBUTES attributes)
|
||||
WLog_INFO(TAG, "MustSize, ");
|
||||
}
|
||||
|
||||
void NdrProcessParam(PMIDL_STUB_MESSAGE pStubMsg, NDR_PHASE phase, unsigned char *pMemory, NDR_PARAM *param)
|
||||
void NdrProcessParam(PMIDL_STUB_MESSAGE pStubMsg, NDR_PHASE phase, unsigned char* pMemory, NDR_PARAM* param)
|
||||
{
|
||||
unsigned char type;
|
||||
PFORMAT_STRING pFormat;
|
||||
@ -98,14 +98,14 @@ void NdrProcessParam(PMIDL_STUB_MESSAGE pStubMsg, NDR_PHASE phase, unsigned char
|
||||
pFormat = ¶m->Type.FormatChar;
|
||||
|
||||
if (param->Attributes.IsSimpleRef)
|
||||
pMemory = *(unsigned char **) pMemory;
|
||||
pMemory = *(unsigned char**) pMemory;
|
||||
}
|
||||
else
|
||||
{
|
||||
pFormat = &pStubMsg->StubDesc->pFormatTypes[param->Type.Offset];
|
||||
|
||||
if (!(param->Attributes.IsByValue))
|
||||
pMemory = *(unsigned char **) pMemory;
|
||||
pMemory = *(unsigned char**) pMemory;
|
||||
}
|
||||
|
||||
type = (pFormat[0] & 0x7F);
|
||||
@ -143,14 +143,14 @@ void NdrProcessParam(PMIDL_STUB_MESSAGE pStubMsg, NDR_PHASE phase, unsigned char
|
||||
}
|
||||
}
|
||||
|
||||
void NdrProcessParams(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, NDR_PHASE phase, void **fpuArgs, unsigned short numberParams)
|
||||
void NdrProcessParams(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, NDR_PHASE phase, void** fpuArgs, unsigned short numberParams)
|
||||
{
|
||||
unsigned int i;
|
||||
NDR_PARAM *params;
|
||||
NDR_PARAM* params;
|
||||
PFORMAT_STRING fmt;
|
||||
unsigned char *arg;
|
||||
unsigned char* arg;
|
||||
unsigned char type;
|
||||
params = (NDR_PARAM *) pFormat;
|
||||
params = (NDR_PARAM*) pFormat;
|
||||
WLog_INFO(TAG, "Params = ");
|
||||
|
||||
for (i = 0; i < numberParams; i++)
|
||||
@ -166,8 +166,8 @@ void NdrProcessParams(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, NDR_P
|
||||
!(params[i].Attributes.IsSimpleRef) &&
|
||||
((params[i].Type.FormatChar) == FC_FLOAT) && !fpuArgs)
|
||||
{
|
||||
tmp = *(double *) arg;
|
||||
arg = (unsigned char *) &tmp;
|
||||
tmp = *(double*) arg;
|
||||
arg = (unsigned char*) &tmp;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -243,7 +243,7 @@ void NdrPrintExtFlags(INTERPRETER_OPT_FLAGS2 extFlags)
|
||||
WLog_INFO(TAG, "HasNotify2, ");
|
||||
}
|
||||
|
||||
CLIENT_CALL_RETURN NdrClientCall(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, void **stackTop, void **fpuStack)
|
||||
CLIENT_CALL_RETURN NdrClientCall(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, void** stackTop, void** fpuStack)
|
||||
{
|
||||
RPC_MESSAGE rpcMsg;
|
||||
unsigned short procNum;
|
||||
@ -253,11 +253,11 @@ CLIENT_CALL_RETURN NdrClientCall(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING
|
||||
MIDL_STUB_MESSAGE stubMsg;
|
||||
INTERPRETER_FLAGS flags;
|
||||
INTERPRETER_OPT_FLAGS optFlags;
|
||||
NDR_PROC_HEADER *procHeader;
|
||||
NDR_OI2_PROC_HEADER *oi2ProcHeader;
|
||||
NDR_PROC_HEADER* procHeader;
|
||||
NDR_OI2_PROC_HEADER* oi2ProcHeader;
|
||||
CLIENT_CALL_RETURN client_call_return;
|
||||
procNum = stackSize = numberParams = 0;
|
||||
procHeader = (NDR_PROC_HEADER *) &pFormat[0];
|
||||
procHeader = (NDR_PROC_HEADER*) &pFormat[0];
|
||||
client_call_return.Pointer = NULL;
|
||||
handleType = procHeader->HandleType;
|
||||
flags = procHeader->OldOiFlags;
|
||||
@ -268,28 +268,28 @@ CLIENT_CALL_RETURN NdrClientCall(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING
|
||||
/* Procedure Header Descriptor: http://msdn.microsoft.com/en-us/library/windows/desktop/aa374387/ */
|
||||
/* Handles: http://msdn.microsoft.com/en-us/library/windows/desktop/aa373932/ */
|
||||
WLog_DBG(TAG, "Oi Header: HandleType: 0x%02X OiFlags: 0x%02X ProcNum: %d StackSize: 0x%04X",
|
||||
handleType, *((unsigned char *) &flags),
|
||||
handleType, *((unsigned char*) &flags),
|
||||
(unsigned short) procNum, (unsigned short) stackSize);
|
||||
|
||||
if (handleType > 0)
|
||||
{
|
||||
/* implicit handle */
|
||||
WLog_INFO(TAG, "Implicit Handle");
|
||||
oi2ProcHeader = (NDR_OI2_PROC_HEADER *) &pFormat[0];
|
||||
oi2ProcHeader = (NDR_OI2_PROC_HEADER*) &pFormat[0];
|
||||
pFormat += sizeof(NDR_OI2_PROC_HEADER);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* explicit handle */
|
||||
WLog_INFO(TAG, "Explicit Handle");
|
||||
oi2ProcHeader = (NDR_OI2_PROC_HEADER *) &pFormat[6];
|
||||
oi2ProcHeader = (NDR_OI2_PROC_HEADER*) &pFormat[6];
|
||||
pFormat += sizeof(NDR_OI2_PROC_HEADER) + 6;
|
||||
}
|
||||
|
||||
optFlags = oi2ProcHeader->Oi2Flags;
|
||||
numberParams = oi2ProcHeader->NumberParams;
|
||||
WLog_DBG(TAG, "Oi2 Header: Oi2Flags: 0x%02X, NumberParams: %d ClientBufferSize: %d ServerBufferSize: %d",
|
||||
*((unsigned char *) &optFlags),
|
||||
*((unsigned char*) &optFlags),
|
||||
(unsigned char) numberParams,
|
||||
oi2ProcHeader->ClientBufferSize,
|
||||
oi2ProcHeader->ServerBufferSize);
|
||||
@ -300,28 +300,28 @@ CLIENT_CALL_RETURN NdrClientCall(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING
|
||||
if (optFlags.HasExtensions)
|
||||
{
|
||||
INTERPRETER_OPT_FLAGS2 extFlags;
|
||||
NDR_PROC_HEADER_EXTS *extensions = (NDR_PROC_HEADER_EXTS *) pFormat;
|
||||
NDR_PROC_HEADER_EXTS* extensions = (NDR_PROC_HEADER_EXTS*) pFormat;
|
||||
pFormat += extensions->Size;
|
||||
extFlags = extensions->Flags2;
|
||||
WLog_DBG(TAG, "Extensions: Size: %d, flags2: 0x%02X",
|
||||
extensions->Size, *((unsigned char *) &extensions->Flags2));
|
||||
extensions->Size, *((unsigned char*) &extensions->Flags2));
|
||||
#ifdef __x86_64__
|
||||
|
||||
if (extensions->Size > sizeof(*extensions) && fpuStack)
|
||||
{
|
||||
int i;
|
||||
unsigned short fpuMask = *(unsigned short *)(extensions + 1);
|
||||
unsigned short fpuMask = *(unsigned short*)(extensions + 1);
|
||||
|
||||
for (i = 0; i < 4; i++, fpuMask >>= 2)
|
||||
{
|
||||
switch (fpuMask & 3)
|
||||
{
|
||||
case 1:
|
||||
*(float *) &stackTop[i] = *(float *) &fpuStack[i];
|
||||
*(float*) &stackTop[i] = *(float*) &fpuStack[i];
|
||||
break;
|
||||
|
||||
case 2:
|
||||
*(double *) &stackTop[i] = *(double *) &fpuStack[i];
|
||||
*(double*) &stackTop[i] = *(double*) &fpuStack[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -332,7 +332,7 @@ CLIENT_CALL_RETURN NdrClientCall(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING
|
||||
NdrPrintExtFlags(extFlags);
|
||||
}
|
||||
|
||||
stubMsg.StackTop = (unsigned char *) stackTop;
|
||||
stubMsg.StackTop = (unsigned char*) stackTop;
|
||||
NdrProcessParams(&stubMsg, pFormat, NDR_PHASE_SIZE, fpuStack, numberParams);
|
||||
WLog_DBG(TAG, "stubMsg BufferLength: %d", (int) stubMsg.BufferLength);
|
||||
return client_call_return;
|
||||
@ -343,7 +343,7 @@ CLIENT_CALL_RETURN NdrClientCall2(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRIN
|
||||
va_list args;
|
||||
CLIENT_CALL_RETURN client_call_return;
|
||||
va_start(args, pFormat);
|
||||
client_call_return = NdrClientCall(pStubDescriptor, pFormat, va_arg(args, void **), NULL);
|
||||
client_call_return = NdrClientCall(pStubDescriptor, pFormat, va_arg(args, void**), NULL);
|
||||
va_end(args);
|
||||
return client_call_return;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
void NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
/**
|
||||
* FC_CARRAY
|
||||
@ -47,7 +47,7 @@ void NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pM
|
||||
unsigned short element_size;
|
||||
type = pFormat[0];
|
||||
alignment = pFormat[1] + 1;
|
||||
element_size = *(unsigned short *) &pFormat[2];
|
||||
element_size = *(unsigned short*) &pFormat[2];
|
||||
|
||||
if (type != FC_CARRAY)
|
||||
{
|
||||
@ -58,7 +58,7 @@ void NdrConformantArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pM
|
||||
WLog_ERR(TAG, "warning: NdrConformantArrayBufferSize unimplemented");
|
||||
}
|
||||
|
||||
void NdrConformantVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrConformantVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
/**
|
||||
* FC_CVARRAY
|
||||
@ -73,7 +73,7 @@ void NdrConformantVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned c
|
||||
WLog_ERR(TAG, "warning: NdrConformantVaryingArrayBufferSize unimplemented");
|
||||
}
|
||||
|
||||
void NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
/**
|
||||
* FC_SMFARRAY
|
||||
@ -94,7 +94,7 @@ void NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory
|
||||
WLog_ERR(TAG, "warning: NdrFixedArrayBufferSize unimplemented");
|
||||
}
|
||||
|
||||
void NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
/**
|
||||
* FC_SMVARRAY
|
||||
@ -121,7 +121,7 @@ void NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemo
|
||||
WLog_ERR(TAG, "warning: NdrVaryingArrayBufferSize unimplemented");
|
||||
}
|
||||
|
||||
void NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
/**
|
||||
* FC_BOGUS_ARRAY
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "../log.h"
|
||||
#define TAG WINPR_TAG("rpc")
|
||||
|
||||
void NdrContextHandleBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrContextHandleBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
unsigned char type = *pFormat;
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
PFORMAT_STRING NdrpComputeCount(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG_PTR *pCount)
|
||||
PFORMAT_STRING NdrpComputeCount(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat, ULONG_PTR* pCount)
|
||||
{
|
||||
LPVOID ptr = NULL;
|
||||
ULONG_PTR data = 0;
|
||||
@ -54,7 +54,7 @@ PFORMAT_STRING NdrpComputeCount(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMem
|
||||
type = correlation_type & 0x0F;
|
||||
conformance = correlation_type & 0xF0;
|
||||
correlation_operator = pFormat[1];
|
||||
offset = *(unsigned short *) & pFormat[2];
|
||||
offset = *(unsigned short*) & pFormat[2];
|
||||
|
||||
if (conformance == FC_NORMAL_CONFORMANCE)
|
||||
{
|
||||
@ -84,23 +84,23 @@ PFORMAT_STRING NdrpComputeCount(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMem
|
||||
switch (correlation_operator)
|
||||
{
|
||||
case FC_DEREFERENCE:
|
||||
ptr = *(LPVOID *)((char *) ptr + offset);
|
||||
ptr = *(LPVOID*)((char*) ptr + offset);
|
||||
break;
|
||||
|
||||
case FC_DIV_2:
|
||||
ptr = (char *) ptr + offset;
|
||||
ptr = (char*) ptr + offset;
|
||||
break;
|
||||
|
||||
case FC_MULT_2:
|
||||
ptr = (char *) ptr + offset;
|
||||
ptr = (char*) ptr + offset;
|
||||
break;
|
||||
|
||||
case FC_SUB_1:
|
||||
ptr = (char *) ptr + offset;
|
||||
ptr = (char*) ptr + offset;
|
||||
break;
|
||||
|
||||
case FC_ADD_1:
|
||||
ptr = (char *) ptr + offset;
|
||||
ptr = (char*) ptr + offset;
|
||||
break;
|
||||
|
||||
case FC_CALLBACK:
|
||||
@ -116,33 +116,33 @@ PFORMAT_STRING NdrpComputeCount(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMem
|
||||
switch (type)
|
||||
{
|
||||
case FC_LONG:
|
||||
data = *(LONG *) ptr;
|
||||
data = *(LONG*) ptr;
|
||||
break;
|
||||
|
||||
case FC_ULONG:
|
||||
data = *(ULONG *) ptr;
|
||||
data = *(ULONG*) ptr;
|
||||
break;
|
||||
|
||||
case FC_SHORT:
|
||||
data = *(SHORT *) ptr;
|
||||
data = *(SHORT*) ptr;
|
||||
break;
|
||||
|
||||
case FC_USHORT:
|
||||
data = *(USHORT *) ptr;
|
||||
data = *(USHORT*) ptr;
|
||||
break;
|
||||
|
||||
case FC_CHAR:
|
||||
case FC_SMALL:
|
||||
data = *(CHAR *) ptr;
|
||||
data = *(CHAR*) ptr;
|
||||
break;
|
||||
|
||||
case FC_BYTE:
|
||||
case FC_USMALL:
|
||||
data = *(BYTE *) ptr;
|
||||
data = *(BYTE*) ptr;
|
||||
break;
|
||||
|
||||
case FC_HYPER:
|
||||
data = (ULONG_PTR) *(ULONGLONG *) ptr;
|
||||
data = (ULONG_PTR) *(ULONGLONG*) ptr;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -181,12 +181,12 @@ PFORMAT_STRING NdrpComputeCount(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMem
|
||||
return pFormat;
|
||||
}
|
||||
|
||||
PFORMAT_STRING NdrpComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
PFORMAT_STRING NdrpComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
return NdrpComputeCount(pStubMsg, pMemory, pFormat, &pStubMsg->MaxCount);
|
||||
}
|
||||
|
||||
PFORMAT_STRING NdrpComputeVariance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
PFORMAT_STRING NdrpComputeVariance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
ULONG_PTR ActualCount = pStubMsg->ActualCount;
|
||||
pFormat = NdrpComputeCount(pStubMsg, pMemory, pFormat, &ActualCount);
|
||||
|
@ -77,7 +77,7 @@ PFORMAT_STRING NdrpSkipPointerLayout(PFORMAT_STRING pFormat)
|
||||
* { pointer_instance<8> }*
|
||||
*/
|
||||
pFormat += 8;
|
||||
number_of_pointers = *(unsigned short *) pFormat;
|
||||
number_of_pointers = *(unsigned short*) pFormat;
|
||||
pFormat += 2 + (number_of_pointers * 8);
|
||||
}
|
||||
else if (*pFormat == FC_VARIABLE_REPEAT)
|
||||
@ -92,7 +92,7 @@ PFORMAT_STRING NdrpSkipPointerLayout(PFORMAT_STRING pFormat)
|
||||
* { pointer_instance<8> }*
|
||||
*/
|
||||
pFormat += 6;
|
||||
number_of_pointers = *(unsigned short *) pFormat;
|
||||
number_of_pointers = *(unsigned short*) pFormat;
|
||||
pFormat += 2 + (number_of_pointers * 8);
|
||||
}
|
||||
else
|
||||
@ -120,7 +120,7 @@ PFORMAT_STRING NdrpSkipPointerLayout(PFORMAT_STRING pFormat)
|
||||
* offset_to_complex_description<2>
|
||||
*/
|
||||
|
||||
void NdrpPointerBufferSize(unsigned char *pMemory, PFORMAT_STRING pFormat, PMIDL_STUB_MESSAGE pStubMsg)
|
||||
void NdrpPointerBufferSize(unsigned char* pMemory, PFORMAT_STRING pFormat, PMIDL_STUB_MESSAGE pStubMsg)
|
||||
{
|
||||
unsigned char type;
|
||||
unsigned char attributes;
|
||||
@ -133,7 +133,7 @@ void NdrpPointerBufferSize(unsigned char *pMemory, PFORMAT_STRING pFormat, PMIDL
|
||||
if (attributes & FC_SIMPLE_POINTER)
|
||||
pNextFormat = pFormat;
|
||||
else
|
||||
pNextFormat = pFormat + *(SHORT *) pFormat;
|
||||
pNextFormat = pFormat + *(SHORT*) pFormat;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@ -153,7 +153,7 @@ void NdrpPointerBufferSize(unsigned char *pMemory, PFORMAT_STRING pFormat, PMIDL
|
||||
}
|
||||
|
||||
if (attributes & FC_POINTER_DEREF)
|
||||
pMemory = *(unsigned char **) pMemory;
|
||||
pMemory = *(unsigned char**) pMemory;
|
||||
|
||||
pfnSizeRoutine = pfnSizeRoutines[*pNextFormat];
|
||||
|
||||
@ -161,12 +161,12 @@ void NdrpPointerBufferSize(unsigned char *pMemory, PFORMAT_STRING pFormat, PMIDL
|
||||
pfnSizeRoutine(pStubMsg, pMemory, pNextFormat);
|
||||
}
|
||||
|
||||
PFORMAT_STRING NdrpEmbeddedRepeatPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, unsigned char **ppMemory)
|
||||
PFORMAT_STRING NdrpEmbeddedRepeatPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat, unsigned char** ppMemory)
|
||||
{
|
||||
ULONG_PTR MaxCount;
|
||||
unsigned char *Memory;
|
||||
unsigned char *MemoryCopy;
|
||||
unsigned char *MemoryPointer;
|
||||
unsigned char* Memory;
|
||||
unsigned char* MemoryCopy;
|
||||
unsigned char* MemoryPointer;
|
||||
PFORMAT_STRING pFormatNext;
|
||||
PFORMAT_STRING pFormatPointers;
|
||||
unsigned short increment;
|
||||
@ -179,7 +179,7 @@ PFORMAT_STRING NdrpEmbeddedRepeatPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
if (*pFormat == FC_FIXED_REPEAT)
|
||||
{
|
||||
pFormat += 2;
|
||||
MaxCount = *(unsigned short *) pFormat;
|
||||
MaxCount = *(unsigned short*) pFormat;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -193,17 +193,17 @@ PFORMAT_STRING NdrpEmbeddedRepeatPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
|
||||
if (pFormat[1] == FC_VARIABLE_OFFSET)
|
||||
{
|
||||
pMemory += pStubMsg->Offset **((unsigned short *) &pFormat[1]);
|
||||
pMemory += pStubMsg->Offset** ((unsigned short*) &pFormat[1]);
|
||||
}
|
||||
}
|
||||
|
||||
pFormat += 2;
|
||||
increment = *(unsigned short *) pFormat;
|
||||
increment = *(unsigned short*) pFormat;
|
||||
pFormat += 2;
|
||||
offset_to_array = *(unsigned short *) pFormat;
|
||||
offset_to_array = *(unsigned short*) pFormat;
|
||||
pStubMsg->Memory = Memory + offset_to_array;
|
||||
pFormat += 2;
|
||||
number_of_pointers = *(unsigned short *) pFormat;
|
||||
number_of_pointers = *(unsigned short*) pFormat;
|
||||
pFormat += 2;
|
||||
pFormatPointers = pFormat;
|
||||
|
||||
@ -220,7 +220,7 @@ PFORMAT_STRING NdrpEmbeddedRepeatPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
do
|
||||
{
|
||||
pointer_count--;
|
||||
MemoryPointer = &pMemory[*(unsigned short *) pFormatNext];
|
||||
MemoryPointer = &pMemory[*(unsigned short*) pFormatNext];
|
||||
NdrpPointerBufferSize(MemoryPointer, pFormatNext + 4, pStubMsg);
|
||||
pFormatNext += 8;
|
||||
}
|
||||
@ -240,17 +240,17 @@ PFORMAT_STRING NdrpEmbeddedRepeatPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg,
|
||||
return pFormat;
|
||||
}
|
||||
|
||||
PFORMAT_STRING NdrpEmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
PFORMAT_STRING NdrpEmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
ULONG_PTR MaxCount;
|
||||
unsigned long Offset;
|
||||
unsigned char *Memory;
|
||||
unsigned char* Memory;
|
||||
char PointerLengthSet;
|
||||
PFORMAT_STRING pFormatCopy;
|
||||
unsigned long BufferLength;
|
||||
unsigned long BufferLengthCopy = 0;
|
||||
unsigned long PointerLength;
|
||||
unsigned char *pMemoryPtr = NULL;
|
||||
unsigned char* pMemoryPtr = NULL;
|
||||
pFormatCopy = pFormat;
|
||||
|
||||
if (!pStubMsg->IgnoreEmbeddedPointers)
|
||||
@ -297,7 +297,7 @@ PFORMAT_STRING NdrpEmbeddedPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsign
|
||||
return pFormat;
|
||||
}
|
||||
|
||||
void NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
if (*pFormat != FC_RP)
|
||||
{
|
||||
@ -308,7 +308,7 @@ void NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, P
|
||||
NdrpPointerBufferSize(pMemory, pFormat, pStubMsg);
|
||||
}
|
||||
|
||||
void NdrByteCountPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrByteCountPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
WLog_ERR(TAG, "warning: NdrByteCountPointerBufferSize unimplemented");
|
||||
}
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
void NdrpAlignLength(ULONG *length, unsigned int alignment);
|
||||
void NdrpIncrementLength(ULONG *length, unsigned int size);
|
||||
void NdrpAlignLength(ULONG* length, unsigned int alignment);
|
||||
void NdrpIncrementLength(ULONG* length, unsigned int size);
|
||||
|
||||
extern const NDR_TYPE_SIZE_ROUTINE pfnSizeRoutines[];
|
||||
extern const NDR_TYPE_MARSHALL_ROUTINE pfnMarshallRoutines[];
|
||||
@ -40,7 +40,7 @@ extern const char SimpleTypeBufferSize[];
|
||||
extern const char SimpleTypeMemorySize[];
|
||||
|
||||
extern const char NdrTypeFlags[];
|
||||
extern const char *FC_TYPE_STRINGS[];
|
||||
extern const char* FC_TYPE_STRINGS[];
|
||||
|
||||
#include "ndr_correlation.h"
|
||||
|
||||
|
@ -31,12 +31,12 @@
|
||||
#include "ndr_string.h"
|
||||
#include "ndr_private.h"
|
||||
|
||||
void NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
WLog_ERR(TAG, "warning: NdrConformantStringBufferSize unimplemented");
|
||||
}
|
||||
|
||||
void NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
WLog_ERR(TAG, "warning: NdrNonConformantStringBufferSize unimplemented");
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
/* Structures: http://msdn.microsoft.com/en-us/library/windows/desktop/aa378695/ */
|
||||
|
||||
void NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
/**
|
||||
* FC_STRUCT
|
||||
@ -56,7 +56,7 @@ void NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemo
|
||||
unsigned short memory_size;
|
||||
type = pFormat[0];
|
||||
alignment = pFormat[1] + 1;
|
||||
memory_size = *(unsigned short *) &pFormat[2];
|
||||
memory_size = *(unsigned short*) &pFormat[2];
|
||||
NdrpAlignLength(&(pStubMsg->BufferLength), alignment);
|
||||
NdrpIncrementLength(&(pStubMsg->BufferLength), memory_size);
|
||||
pFormat += 4;
|
||||
@ -67,7 +67,7 @@ void NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemo
|
||||
WLog_ERR(TAG, "warning: NdrSimpleStructBufferSize unimplemented");
|
||||
}
|
||||
|
||||
void NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
/**
|
||||
* FC_CSTRUCT alignment<1>
|
||||
@ -86,7 +86,7 @@ void NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *p
|
||||
WLog_ERR(TAG, "warning: NdrConformantStructBufferSize unimplemented");
|
||||
}
|
||||
|
||||
void NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
/**
|
||||
* FC_CVSTRUCT alignment<1>
|
||||
@ -156,7 +156,7 @@ ULONG NdrComplexStructMemberSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFo
|
||||
case FC_OP:
|
||||
case FC_FP:
|
||||
case FC_POINTER:
|
||||
size += sizeof(void *);
|
||||
size += sizeof(void*);
|
||||
|
||||
if (*pFormat != FC_POINTER)
|
||||
pFormat += 4;
|
||||
@ -203,7 +203,7 @@ ULONG NdrComplexStructMemberSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFo
|
||||
return size;
|
||||
}
|
||||
|
||||
void NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
/**
|
||||
* FC_BOGUS_STRUCT
|
||||
@ -218,12 +218,12 @@ void NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMem
|
||||
ULONG_PTR MaxCount;
|
||||
unsigned long Offset;
|
||||
unsigned long ActualCount;
|
||||
unsigned char *pMemoryCopy;
|
||||
unsigned char* pMemoryCopy;
|
||||
unsigned char type;
|
||||
unsigned char alignment;
|
||||
unsigned short memory_size;
|
||||
unsigned char *pointer_layout;
|
||||
unsigned char *conformant_array_description;
|
||||
unsigned char* pointer_layout;
|
||||
unsigned char* conformant_array_description;
|
||||
unsigned short offset_to_pointer_layout;
|
||||
unsigned short offset_to_conformant_array_description;
|
||||
type = pFormat[0];
|
||||
@ -237,7 +237,7 @@ void NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMem
|
||||
}
|
||||
|
||||
alignment = pFormat[1] + 1;
|
||||
memory_size = *(unsigned short *) &pFormat[2];
|
||||
memory_size = *(unsigned short*) &pFormat[2];
|
||||
NdrpAlignLength(&(pStubMsg->BufferLength), alignment);
|
||||
|
||||
if (!pStubMsg->IgnoreEmbeddedPointers && !pStubMsg->PointerLength)
|
||||
@ -252,16 +252,16 @@ void NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMem
|
||||
}
|
||||
|
||||
pFormat += 4;
|
||||
offset_to_conformant_array_description = *(unsigned short *) &pFormat[0];
|
||||
offset_to_conformant_array_description = *(unsigned short*) &pFormat[0];
|
||||
|
||||
if (offset_to_conformant_array_description)
|
||||
conformant_array_description = (unsigned char *) pFormat + offset_to_conformant_array_description;
|
||||
conformant_array_description = (unsigned char*) pFormat + offset_to_conformant_array_description;
|
||||
|
||||
pFormat += 2;
|
||||
offset_to_pointer_layout = *(unsigned short *) &pFormat[0];
|
||||
offset_to_pointer_layout = *(unsigned short*) &pFormat[0];
|
||||
|
||||
if (offset_to_pointer_layout)
|
||||
pointer_layout = (unsigned char *) pFormat + offset_to_pointer_layout;
|
||||
pointer_layout = (unsigned char*) pFormat + offset_to_pointer_layout;
|
||||
|
||||
pFormat += 2;
|
||||
pStubMsg->Memory = pMemory;
|
||||
|
@ -31,12 +31,12 @@
|
||||
#include "ndr_union.h"
|
||||
#include "ndr_private.h"
|
||||
|
||||
void NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
WLog_ERR(TAG, "warning: NdrEncapsulatedUnionBufferSize unimplemented");
|
||||
}
|
||||
|
||||
void NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat)
|
||||
void NdrNonEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
|
||||
{
|
||||
WLog_ERR(TAG, "warning: NdrNonEncapsulatedUnionBufferSize unimplemented");
|
||||
}
|
||||
|
@ -33,13 +33,13 @@
|
||||
#include "../log.h"
|
||||
#define TAG WINPR_TAG("rpc")
|
||||
|
||||
RPC_STATUS RpcBindingCopy(RPC_BINDING_HANDLE SourceBinding, RPC_BINDING_HANDLE *DestinationBinding)
|
||||
RPC_STATUS RpcBindingCopy(RPC_BINDING_HANDLE SourceBinding, RPC_BINDING_HANDLE* DestinationBinding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingFree(RPC_BINDING_HANDLE *Binding)
|
||||
RPC_STATUS RpcBindingFree(RPC_BINDING_HANDLE* Binding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -51,31 +51,31 @@ RPC_STATUS RpcBindingSetOption(RPC_BINDING_HANDLE hBinding, unsigned long option
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingInqOption(RPC_BINDING_HANDLE hBinding, unsigned long option, ULONG_PTR *pOptionValue)
|
||||
RPC_STATUS RpcBindingInqOption(RPC_BINDING_HANDLE hBinding, unsigned long option, ULONG_PTR* pOptionValue)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingFromStringBindingA(RPC_CSTR StringBinding, RPC_BINDING_HANDLE *Binding)
|
||||
RPC_STATUS RpcBindingFromStringBindingA(RPC_CSTR StringBinding, RPC_BINDING_HANDLE* Binding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
|
||||
RPC_STATUS RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE* Binding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcSsGetContextBinding(void *ContextHandle, RPC_BINDING_HANDLE *Binding)
|
||||
RPC_STATUS RpcSsGetContextBinding(void* ContextHandle, RPC_BINDING_HANDLE* Binding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingInqObject(RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
|
||||
RPC_STATUS RpcBindingInqObject(RPC_BINDING_HANDLE Binding, UUID* ObjectUuid)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -87,79 +87,79 @@ RPC_STATUS RpcBindingReset(RPC_BINDING_HANDLE Binding)
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingSetObject(RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
|
||||
RPC_STATUS RpcBindingSetObject(RPC_BINDING_HANDLE Binding, UUID* ObjectUuid)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtInqDefaultProtectLevel(unsigned long AuthnSvc, unsigned long *AuthnLevel)
|
||||
RPC_STATUS RpcMgmtInqDefaultProtectLevel(unsigned long AuthnSvc, unsigned long* AuthnLevel)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding, RPC_CSTR *StringBinding)
|
||||
RPC_STATUS RpcBindingToStringBindingA(RPC_BINDING_HANDLE Binding, RPC_CSTR* StringBinding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingToStringBindingW(RPC_BINDING_HANDLE Binding, RPC_WSTR *StringBinding)
|
||||
RPC_STATUS RpcBindingToStringBindingW(RPC_BINDING_HANDLE Binding, RPC_WSTR* StringBinding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingVectorFree(RPC_BINDING_VECTOR **BindingVector)
|
||||
RPC_STATUS RpcBindingVectorFree(RPC_BINDING_VECTOR** BindingVector)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcStringBindingComposeA(RPC_CSTR ObjUuid, RPC_CSTR Protseq, RPC_CSTR NetworkAddr,
|
||||
RPC_CSTR Endpoint, RPC_CSTR Options, RPC_CSTR *StringBinding)
|
||||
RPC_CSTR Endpoint, RPC_CSTR Options, RPC_CSTR* StringBinding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr,
|
||||
RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
|
||||
RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR* StringBinding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcStringBindingParseA(RPC_CSTR StringBinding, RPC_CSTR *ObjUuid, RPC_CSTR *Protseq,
|
||||
RPC_CSTR *NetworkAddr, RPC_CSTR *Endpoint, RPC_CSTR *NetworkOptions)
|
||||
RPC_STATUS RpcStringBindingParseA(RPC_CSTR StringBinding, RPC_CSTR* ObjUuid, RPC_CSTR* Protseq,
|
||||
RPC_CSTR* NetworkAddr, RPC_CSTR* Endpoint, RPC_CSTR* NetworkOptions)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcStringBindingParseW(RPC_WSTR StringBinding, RPC_WSTR *ObjUuid, RPC_WSTR *Protseq,
|
||||
RPC_WSTR *NetworkAddr, RPC_WSTR *Endpoint, RPC_WSTR *NetworkOptions)
|
||||
RPC_STATUS RpcStringBindingParseW(RPC_WSTR StringBinding, RPC_WSTR* ObjUuid, RPC_WSTR* Protseq,
|
||||
RPC_WSTR* NetworkAddr, RPC_WSTR* Endpoint, RPC_WSTR* NetworkOptions)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcStringFreeA(RPC_CSTR *String)
|
||||
RPC_STATUS RpcStringFreeA(RPC_CSTR* String)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
free(String);
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcStringFreeW(RPC_WSTR *String)
|
||||
RPC_STATUS RpcStringFreeW(RPC_WSTR* String)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
free(String);
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcIfInqId(RPC_IF_HANDLE RpcIfHandle, RPC_IF_ID *RpcIfId)
|
||||
RPC_STATUS RpcIfInqId(RPC_IF_HANDLE RpcIfHandle, RPC_IF_ID* RpcIfId)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -177,7 +177,7 @@ RPC_STATUS RpcNetworkIsProtseqValidW(RPC_WSTR Protseq)
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtInqComTimeout(RPC_BINDING_HANDLE Binding, unsigned int *Timeout)
|
||||
RPC_STATUS RpcMgmtInqComTimeout(RPC_BINDING_HANDLE Binding, unsigned int* Timeout)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -195,55 +195,55 @@ RPC_STATUS RpcMgmtSetCancelTimeout(long Timeout)
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcNetworkInqProtseqsA(RPC_PROTSEQ_VECTORA **ProtseqVector)
|
||||
RPC_STATUS RpcNetworkInqProtseqsA(RPC_PROTSEQ_VECTORA** ProtseqVector)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcNetworkInqProtseqsW(RPC_PROTSEQ_VECTORW **ProtseqVector)
|
||||
RPC_STATUS RpcNetworkInqProtseqsW(RPC_PROTSEQ_VECTORW** ProtseqVector)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcObjectInqType(UUID *ObjUuid, UUID *TypeUuid)
|
||||
RPC_STATUS RpcObjectInqType(UUID* ObjUuid, UUID* TypeUuid)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcObjectSetInqFn(RPC_OBJECT_INQ_FN *InquiryFn)
|
||||
RPC_STATUS RpcObjectSetInqFn(RPC_OBJECT_INQ_FN* InquiryFn)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcObjectSetType(UUID *ObjUuid, UUID *TypeUuid)
|
||||
RPC_STATUS RpcObjectSetType(UUID* ObjUuid, UUID* TypeUuid)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcProtseqVectorFreeA(RPC_PROTSEQ_VECTORA **ProtseqVector)
|
||||
RPC_STATUS RpcProtseqVectorFreeA(RPC_PROTSEQ_VECTORA** ProtseqVector)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcProtseqVectorFreeW(RPC_PROTSEQ_VECTORW **ProtseqVector)
|
||||
RPC_STATUS RpcProtseqVectorFreeW(RPC_PROTSEQ_VECTORW** ProtseqVector)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerInqBindings(RPC_BINDING_VECTOR **BindingVector)
|
||||
RPC_STATUS RpcServerInqBindings(RPC_BINDING_VECTOR** BindingVector)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerInqIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV **MgrEpv)
|
||||
RPC_STATUS RpcServerInqIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV** MgrEpv)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -255,129 +255,129 @@ RPC_STATUS RpcServerListen(unsigned int MinimumCallThreads, unsigned int MaxCall
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
|
||||
RPC_STATUS RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv,
|
||||
unsigned int Flags, unsigned int MaxCalls, RPC_IF_CALLBACK_FN *IfCallback)
|
||||
RPC_STATUS RpcServerRegisterIfEx(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv,
|
||||
unsigned int Flags, unsigned int MaxCalls, RPC_IF_CALLBACK_FN* IfCallback)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerRegisterIf2(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv,
|
||||
unsigned int Flags, unsigned int MaxCalls, unsigned int MaxRpcSize, RPC_IF_CALLBACK_FN *IfCallbackFn)
|
||||
RPC_STATUS RpcServerRegisterIf2(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv,
|
||||
unsigned int Flags, unsigned int MaxCalls, unsigned int MaxRpcSize, RPC_IF_CALLBACK_FN* IfCallbackFn)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, unsigned int WaitForCallsToComplete)
|
||||
RPC_STATUS RpcServerUnregisterIf(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, unsigned int WaitForCallsToComplete)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUnregisterIfEx(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, int RundownContextHandles)
|
||||
RPC_STATUS RpcServerUnregisterIfEx(RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, int RundownContextHandles)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseAllProtseqs(unsigned int MaxCalls, void *SecurityDescriptor)
|
||||
RPC_STATUS RpcServerUseAllProtseqs(unsigned int MaxCalls, void* SecurityDescriptor)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseAllProtseqsEx(unsigned int MaxCalls, void *SecurityDescriptor, PRPC_POLICY Policy)
|
||||
RPC_STATUS RpcServerUseAllProtseqsEx(unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseAllProtseqsIf(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor)
|
||||
RPC_STATUS RpcServerUseAllProtseqsIf(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseAllProtseqsIfEx(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor, PRPC_POLICY Policy)
|
||||
RPC_STATUS RpcServerUseAllProtseqsIfEx(unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
|
||||
RPC_STATUS RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqExA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor, PRPC_POLICY Policy)
|
||||
RPC_STATUS RpcServerUseProtseqExA(RPC_CSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor)
|
||||
RPC_STATUS RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqExW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor, PRPC_POLICY Policy)
|
||||
RPC_STATUS RpcServerUseProtseqExW(RPC_WSTR Protseq, unsigned int MaxCalls, void* SecurityDescriptor, PRPC_POLICY Policy)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqEpA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_CSTR Endpoint, void *SecurityDescriptor)
|
||||
RPC_STATUS RpcServerUseProtseqEpA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_CSTR Endpoint, void* SecurityDescriptor)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqEpExA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_CSTR Endpoint, void *SecurityDescriptor, PRPC_POLICY Policy)
|
||||
RPC_STATUS RpcServerUseProtseqEpExA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_CSTR Endpoint, void* SecurityDescriptor, PRPC_POLICY Policy)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqEpW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_WSTR Endpoint, void *SecurityDescriptor)
|
||||
RPC_STATUS RpcServerUseProtseqEpW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_WSTR Endpoint, void* SecurityDescriptor)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqEpExW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_WSTR Endpoint, void *SecurityDescriptor, PRPC_POLICY Policy)
|
||||
RPC_STATUS RpcServerUseProtseqEpExW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_WSTR Endpoint, void* SecurityDescriptor, PRPC_POLICY Policy)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqIfA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor)
|
||||
RPC_STATUS RpcServerUseProtseqIfA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqIfExA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor, PRPC_POLICY Policy)
|
||||
RPC_STATUS RpcServerUseProtseqIfExA(RPC_CSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqIfW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor)
|
||||
RPC_STATUS RpcServerUseProtseqIfW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerUseProtseqIfExW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void *SecurityDescriptor, PRPC_POLICY Policy)
|
||||
RPC_STATUS RpcServerUseProtseqIfExW(RPC_WSTR Protseq, unsigned int MaxCalls, RPC_IF_HANDLE IfSpec, void* SecurityDescriptor, PRPC_POLICY Policy)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -388,13 +388,13 @@ void RpcServerYield()
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtStatsVectorFree(RPC_STATS_VECTOR **StatsVector)
|
||||
RPC_STATUS RpcMgmtStatsVectorFree(RPC_STATS_VECTOR** StatsVector)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR **Statistics)
|
||||
RPC_STATUS RpcMgmtInqStats(RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR** Statistics)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -435,37 +435,37 @@ RPC_STATUS RpcMgmtEnableIdleCleanup(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtInqIfIds(RPC_BINDING_HANDLE Binding, RPC_IF_ID_VECTOR **IfIdVector)
|
||||
RPC_STATUS RpcMgmtInqIfIds(RPC_BINDING_HANDLE Binding, RPC_IF_ID_VECTOR** IfIdVector)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcIfIdVectorFree(RPC_IF_ID_VECTOR **IfIdVector)
|
||||
RPC_STATUS RpcIfIdVectorFree(RPC_IF_ID_VECTOR** IfIdVector)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtInqServerPrincNameA(RPC_BINDING_HANDLE Binding, unsigned long AuthnSvc, RPC_CSTR *ServerPrincName)
|
||||
RPC_STATUS RpcMgmtInqServerPrincNameA(RPC_BINDING_HANDLE Binding, unsigned long AuthnSvc, RPC_CSTR* ServerPrincName)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtInqServerPrincNameW(RPC_BINDING_HANDLE Binding, unsigned long AuthnSvc, RPC_WSTR *ServerPrincName)
|
||||
RPC_STATUS RpcMgmtInqServerPrincNameW(RPC_BINDING_HANDLE Binding, unsigned long AuthnSvc, RPC_WSTR* ServerPrincName)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerInqDefaultPrincNameA(unsigned long AuthnSvc, RPC_CSTR *PrincName)
|
||||
RPC_STATUS RpcServerInqDefaultPrincNameA(unsigned long AuthnSvc, RPC_CSTR* PrincName)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerInqDefaultPrincNameW(unsigned long AuthnSvc, RPC_WSTR *PrincName)
|
||||
RPC_STATUS RpcServerInqDefaultPrincNameW(unsigned long AuthnSvc, RPC_WSTR* PrincName)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -477,13 +477,13 @@ RPC_STATUS RpcEpResolveBinding(RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE IfSpec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcNsBindingInqEntryNameA(RPC_BINDING_HANDLE Binding, unsigned long EntryNameSyntax, RPC_CSTR *EntryName)
|
||||
RPC_STATUS RpcNsBindingInqEntryNameA(RPC_BINDING_HANDLE Binding, unsigned long EntryNameSyntax, RPC_CSTR* EntryName)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcNsBindingInqEntryNameW(RPC_BINDING_HANDLE Binding, unsigned long EntryNameSyntax, RPC_WSTR *EntryName)
|
||||
RPC_STATUS RpcNsBindingInqEntryNameW(RPC_BINDING_HANDLE Binding, unsigned long EntryNameSyntax, RPC_WSTR* EntryName)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -508,43 +508,43 @@ RPC_STATUS RpcRevertToSelf()
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingInqAuthClientA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs,
|
||||
RPC_CSTR *ServerPrincName, unsigned long *AuthnLevel, unsigned long *AuthnSvc, unsigned long *AuthzSvc)
|
||||
RPC_STATUS RpcBindingInqAuthClientA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
|
||||
RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingInqAuthClientW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs,
|
||||
RPC_WSTR *ServerPrincName, unsigned long *AuthnLevel, unsigned long *AuthnSvc, unsigned long *AuthzSvc)
|
||||
RPC_STATUS RpcBindingInqAuthClientW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
|
||||
RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingInqAuthClientExA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs,
|
||||
RPC_CSTR *ServerPrincName, unsigned long *AuthnLevel, unsigned long *AuthnSvc, unsigned long *AuthzSvc, unsigned long Flags)
|
||||
RPC_STATUS RpcBindingInqAuthClientExA(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
|
||||
RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc, unsigned long Flags)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingInqAuthClientExW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs,
|
||||
RPC_WSTR *ServerPrincName, unsigned long *AuthnLevel, unsigned long *AuthnSvc, unsigned long *AuthzSvc, unsigned long Flags)
|
||||
RPC_STATUS RpcBindingInqAuthClientExW(RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE* Privs,
|
||||
RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel, unsigned long* AuthnSvc, unsigned long* AuthzSvc, unsigned long Flags)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingInqAuthInfoA(RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName, unsigned long *AuthnLevel,
|
||||
unsigned long *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, unsigned long *AuthzSvc)
|
||||
RPC_STATUS RpcBindingInqAuthInfoA(RPC_BINDING_HANDLE Binding, RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
|
||||
unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingInqAuthInfoW(RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName, unsigned long *AuthnLevel,
|
||||
unsigned long *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, unsigned long *AuthzSvc)
|
||||
RPC_STATUS RpcBindingInqAuthInfoW(RPC_BINDING_HANDLE Binding, RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
|
||||
unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -558,7 +558,7 @@ RPC_STATUS RpcBindingSetAuthInfoA(RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPri
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingSetAuthInfoExA(RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, unsigned long AuthnLevel,
|
||||
unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc, RPC_SECURITY_QOS *SecurityQos)
|
||||
unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc, RPC_SECURITY_QOS* SecurityQos)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -572,43 +572,43 @@ RPC_STATUS RpcBindingSetAuthInfoW(RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPri
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingSetAuthInfoExW(RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, unsigned long AuthnLevel,
|
||||
unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc, RPC_SECURITY_QOS *SecurityQOS)
|
||||
unsigned long AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, unsigned long AuthzSvc, RPC_SECURITY_QOS* SecurityQOS)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingInqAuthInfoExA(RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName, unsigned long *AuthnLevel,
|
||||
unsigned long *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, unsigned long *AuthzSvc,
|
||||
unsigned long RpcQosVersion, RPC_SECURITY_QOS *SecurityQOS)
|
||||
RPC_STATUS RpcBindingInqAuthInfoExA(RPC_BINDING_HANDLE Binding, RPC_CSTR* ServerPrincName, unsigned long* AuthnLevel,
|
||||
unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc,
|
||||
unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcBindingInqAuthInfoExW(RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName, unsigned long *AuthnLevel,
|
||||
unsigned long *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, unsigned long *AuthzSvc,
|
||||
unsigned long RpcQosVersion, RPC_SECURITY_QOS *SecurityQOS)
|
||||
RPC_STATUS RpcBindingInqAuthInfoExW(RPC_BINDING_HANDLE Binding, RPC_WSTR* ServerPrincName, unsigned long* AuthnLevel,
|
||||
unsigned long* AuthnSvc, RPC_AUTH_IDENTITY_HANDLE* AuthIdentity, unsigned long* AuthzSvc,
|
||||
unsigned long RpcQosVersion, RPC_SECURITY_QOS* SecurityQOS)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
RPC_STATUS RpcServerRegisterAuthInfoA(RPC_CSTR ServerPrincName, unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void *Arg)
|
||||
RPC_STATUS RpcServerRegisterAuthInfoA(RPC_CSTR ServerPrincName, unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcServerRegisterAuthInfoW(RPC_WSTR ServerPrincName, unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void *Arg)
|
||||
RPC_STATUS RpcServerRegisterAuthInfoW(RPC_WSTR ServerPrincName, unsigned long AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, void* Arg)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
RPC_STATUS RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE *ServerBinding)
|
||||
RPC_STATUS RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE* ServerBinding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -632,13 +632,13 @@ RPC_STATUS RpcServerTestCancel(RPC_BINDING_HANDLE BindingHandle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcCancelThread(void *Thread)
|
||||
RPC_STATUS RpcCancelThread(void* Thread)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcCancelThreadEx(void *Thread, long Timeout)
|
||||
RPC_STATUS RpcCancelThreadEx(void* Thread, long Timeout)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -654,19 +654,19 @@ static UUID UUID_NIL =
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
};
|
||||
|
||||
RPC_STATUS UuidCreate(UUID *Uuid)
|
||||
RPC_STATUS UuidCreate(UUID* Uuid)
|
||||
{
|
||||
RAND_pseudo_bytes((void *) Uuid, 16);
|
||||
RAND_pseudo_bytes((void*) Uuid, 16);
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
RPC_STATUS UuidCreateSequential(UUID *Uuid)
|
||||
RPC_STATUS UuidCreateSequential(UUID* Uuid)
|
||||
{
|
||||
RAND_pseudo_bytes((void *) Uuid, 16);
|
||||
RAND_pseudo_bytes((void*) Uuid, 16);
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
RPC_STATUS UuidToStringA(UUID *Uuid, RPC_CSTR *StringUuid)
|
||||
RPC_STATUS UuidToStringA(UUID* Uuid, RPC_CSTR* StringUuid)
|
||||
{
|
||||
*StringUuid = (RPC_CSTR) malloc(36 + 1);
|
||||
|
||||
@ -680,7 +680,7 @@ RPC_STATUS UuidToStringA(UUID *Uuid, RPC_CSTR *StringUuid)
|
||||
* Format is 32 hex digits partitioned in 5 groups:
|
||||
* xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
*/
|
||||
sprintf_s((char *) *StringUuid, 36 + 1, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
sprintf_s((char*) *StringUuid, 36 + 1, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
Uuid->Data1, Uuid->Data2, Uuid->Data3,
|
||||
Uuid->Data4[0], Uuid->Data4[1],
|
||||
Uuid->Data4[2], Uuid->Data4[3], Uuid->Data4[4],
|
||||
@ -688,13 +688,13 @@ RPC_STATUS UuidToStringA(UUID *Uuid, RPC_CSTR *StringUuid)
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
RPC_STATUS UuidToStringW(UUID *Uuid, RPC_WSTR *StringUuid)
|
||||
RPC_STATUS UuidToStringW(UUID* Uuid, RPC_WSTR* StringUuid)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS UuidFromStringA(RPC_CSTR StringUuid, UUID *Uuid)
|
||||
RPC_STATUS UuidFromStringA(RPC_CSTR StringUuid, UUID* Uuid)
|
||||
{
|
||||
int index;
|
||||
BYTE bin[36];
|
||||
@ -702,7 +702,7 @@ RPC_STATUS UuidFromStringA(RPC_CSTR StringUuid, UUID *Uuid)
|
||||
if (!StringUuid)
|
||||
return UuidCreateNil(Uuid);
|
||||
|
||||
if (strlen((char *) StringUuid) != 36)
|
||||
if (strlen((char*) StringUuid) != 36)
|
||||
return RPC_S_INVALID_STRING_UUID;
|
||||
|
||||
if ((StringUuid[8] != '-') || (StringUuid[13] != '-') ||
|
||||
@ -741,13 +741,13 @@ RPC_STATUS UuidFromStringA(RPC_CSTR StringUuid, UUID *Uuid)
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
RPC_STATUS UuidFromStringW(RPC_WSTR StringUuid, UUID *Uuid)
|
||||
RPC_STATUS UuidFromStringW(RPC_WSTR StringUuid, UUID* Uuid)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
signed int UuidCompare(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
|
||||
signed int UuidCompare(UUID* Uuid1, UUID* Uuid2, RPC_STATUS* Status)
|
||||
{
|
||||
int index;
|
||||
*Status = RPC_S_OK;
|
||||
@ -776,53 +776,53 @@ signed int UuidCompare(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS UuidCreateNil(UUID *NilUuid)
|
||||
RPC_STATUS UuidCreateNil(UUID* NilUuid)
|
||||
{
|
||||
CopyMemory((void *) NilUuid, (void *) &UUID_NIL, 16);
|
||||
CopyMemory((void*) NilUuid, (void*) &UUID_NIL, 16);
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
int UuidEqual(UUID *Uuid1, UUID *Uuid2, RPC_STATUS *Status)
|
||||
int UuidEqual(UUID* Uuid1, UUID* Uuid2, RPC_STATUS* Status)
|
||||
{
|
||||
return ((UuidCompare(Uuid1, Uuid2, Status) == 0) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
unsigned short UuidHash(UUID *Uuid, RPC_STATUS *Status)
|
||||
unsigned short UuidHash(UUID* Uuid, RPC_STATUS* Status)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
|
||||
int UuidIsNil(UUID* Uuid, RPC_STATUS* Status)
|
||||
{
|
||||
return UuidEqual(Uuid, &UUID_NIL, Status);
|
||||
}
|
||||
|
||||
RPC_STATUS RpcEpRegisterNoReplaceA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector, RPC_CSTR Annotation)
|
||||
RPC_STATUS RpcEpRegisterNoReplaceA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_CSTR Annotation)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcEpRegisterNoReplaceW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector, RPC_WSTR Annotation)
|
||||
RPC_STATUS RpcEpRegisterNoReplaceW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_WSTR Annotation)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcEpRegisterA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector, RPC_CSTR Annotation)
|
||||
RPC_STATUS RpcEpRegisterA(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_CSTR Annotation)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcEpRegisterW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector, RPC_WSTR Annotation)
|
||||
RPC_STATUS RpcEpRegisterW(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector, RPC_WSTR Annotation)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcEpUnregister(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector)
|
||||
RPC_STATUS RpcEpUnregister(RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR* BindingVector, UUID_VECTOR* UuidVector)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -842,35 +842,35 @@ RPC_STATUS DceErrorInqTextW(RPC_STATUS RpcStatus, RPC_WSTR ErrorText)
|
||||
}
|
||||
|
||||
|
||||
RPC_STATUS RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE EpBinding, unsigned long InquiryType, RPC_IF_ID *IfId,
|
||||
unsigned long VersOption, UUID *ObjectUuid, RPC_EP_INQ_HANDLE *InquiryContext)
|
||||
RPC_STATUS RpcMgmtEpEltInqBegin(RPC_BINDING_HANDLE EpBinding, unsigned long InquiryType, RPC_IF_ID* IfId,
|
||||
unsigned long VersOption, UUID* ObjectUuid, RPC_EP_INQ_HANDLE* InquiryContext)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtEpEltInqDone(RPC_EP_INQ_HANDLE *InquiryContext)
|
||||
RPC_STATUS RpcMgmtEpEltInqDone(RPC_EP_INQ_HANDLE* InquiryContext)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtEpEltInqNextA(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID *IfId,
|
||||
RPC_BINDING_HANDLE *Binding, UUID *ObjectUuid, RPC_CSTR *Annotation)
|
||||
RPC_STATUS RpcMgmtEpEltInqNextA(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID* IfId,
|
||||
RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid, RPC_CSTR* Annotation)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtEpEltInqNextW(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID *IfId,
|
||||
RPC_BINDING_HANDLE *Binding, UUID *ObjectUuid, RPC_WSTR *Annotation)
|
||||
RPC_STATUS RpcMgmtEpEltInqNextW(RPC_EP_INQ_HANDLE InquiryContext, RPC_IF_ID* IfId,
|
||||
RPC_BINDING_HANDLE* Binding, UUID* ObjectUuid, RPC_WSTR* Annotation)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
||||
RPC_STATUS RpcMgmtEpUnregister(RPC_BINDING_HANDLE EpBinding, RPC_IF_ID *IfId,
|
||||
RPC_BINDING_HANDLE Binding, UUID *ObjectUuid)
|
||||
RPC_STATUS RpcMgmtEpUnregister(RPC_BINDING_HANDLE EpBinding, RPC_IF_ID* IfId,
|
||||
RPC_BINDING_HANDLE Binding, UUID* ObjectUuid)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
@ -883,7 +883,7 @@ RPC_STATUS RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN AuthorizationFn)
|
||||
}
|
||||
|
||||
|
||||
RPC_STATUS RpcServerInqBindingHandle(RPC_BINDING_HANDLE *Binding)
|
||||
RPC_STATUS RpcServerInqBindingHandle(RPC_BINDING_HANDLE* Binding)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented");
|
||||
return 0;
|
||||
|
@ -123,8 +123,8 @@ typedef struct _PCSC_SCARDHANDLE PCSC_SCARDHANDLE;
|
||||
|
||||
struct _PCSC_READER
|
||||
{
|
||||
char *namePCSC;
|
||||
char *nameWinSCard;
|
||||
char* namePCSC;
|
||||
char* nameWinSCard;
|
||||
};
|
||||
typedef struct _PCSC_READER PCSC_READER;
|
||||
|
||||
@ -163,10 +163,10 @@ static BOOL g_PnP_Notification = TRUE;
|
||||
|
||||
static BOOL g_LockTransactions = FALSE;
|
||||
|
||||
static wArrayList *g_Readers = NULL;
|
||||
static wListDictionary *g_CardHandles = NULL;
|
||||
static wListDictionary *g_CardContexts = NULL;
|
||||
static wListDictionary *g_MemoryBlocks = NULL;
|
||||
static wArrayList* g_Readers = NULL;
|
||||
static wListDictionary* g_CardHandles = NULL;
|
||||
static wListDictionary* g_CardContexts = NULL;
|
||||
static wListDictionary* g_MemoryBlocks = NULL;
|
||||
|
||||
char SMARTCARD_PNP_NOTIFICATION_A[] = "\\\\?PnP?\\Notification";
|
||||
|
||||
@ -292,7 +292,7 @@ DWORD PCSC_ConvertProtocolsFromWinSCard(DWORD dwProtocols)
|
||||
return dwProtocols;
|
||||
}
|
||||
|
||||
void PCSC_ReaderAliasFree(PCSC_READER *reader)
|
||||
void PCSC_ReaderAliasFree(PCSC_READER* reader)
|
||||
{
|
||||
if (!reader)
|
||||
return;
|
||||
@ -301,14 +301,14 @@ void PCSC_ReaderAliasFree(PCSC_READER *reader)
|
||||
free(reader->nameWinSCard);
|
||||
}
|
||||
|
||||
PCSC_SCARDCONTEXT *PCSC_GetCardContextData(SCARDCONTEXT hContext)
|
||||
PCSC_SCARDCONTEXT* PCSC_GetCardContextData(SCARDCONTEXT hContext)
|
||||
{
|
||||
PCSC_SCARDCONTEXT *pContext;
|
||||
PCSC_SCARDCONTEXT* pContext;
|
||||
|
||||
if (!g_CardContexts)
|
||||
return NULL;
|
||||
|
||||
pContext = (PCSC_SCARDCONTEXT *) ListDictionary_GetItemValue(g_CardContexts, (void *) hContext);
|
||||
pContext = (PCSC_SCARDCONTEXT*) ListDictionary_GetItemValue(g_CardContexts, (void*) hContext);
|
||||
|
||||
if (!pContext)
|
||||
return NULL;
|
||||
@ -316,10 +316,10 @@ PCSC_SCARDCONTEXT *PCSC_GetCardContextData(SCARDCONTEXT hContext)
|
||||
return pContext;
|
||||
}
|
||||
|
||||
PCSC_SCARDCONTEXT *PCSC_EstablishCardContext(SCARDCONTEXT hContext)
|
||||
PCSC_SCARDCONTEXT* PCSC_EstablishCardContext(SCARDCONTEXT hContext)
|
||||
{
|
||||
PCSC_SCARDCONTEXT *pContext;
|
||||
pContext = (PCSC_SCARDCONTEXT *) calloc(1, sizeof(PCSC_SCARDCONTEXT));
|
||||
PCSC_SCARDCONTEXT* pContext;
|
||||
pContext = (PCSC_SCARDCONTEXT*) calloc(1, sizeof(PCSC_SCARDCONTEXT));
|
||||
|
||||
if (!pContext)
|
||||
return NULL;
|
||||
@ -336,13 +336,13 @@ PCSC_SCARDCONTEXT *PCSC_EstablishCardContext(SCARDCONTEXT hContext)
|
||||
ArrayList_Object(g_Readers)->fnObjectFree = (OBJECT_FREE_FN) PCSC_ReaderAliasFree;
|
||||
}
|
||||
|
||||
ListDictionary_Add(g_CardContexts, (void *) hContext, (void *) pContext);
|
||||
ListDictionary_Add(g_CardContexts, (void*) hContext, (void*) pContext);
|
||||
return pContext;
|
||||
}
|
||||
|
||||
void PCSC_ReleaseCardContext(SCARDCONTEXT hContext)
|
||||
{
|
||||
PCSC_SCARDCONTEXT *pContext;
|
||||
PCSC_SCARDCONTEXT* pContext;
|
||||
pContext = PCSC_GetCardContextData(hContext);
|
||||
|
||||
if (!pContext)
|
||||
@ -357,17 +357,17 @@ void PCSC_ReleaseCardContext(SCARDCONTEXT hContext)
|
||||
if (!g_CardContexts)
|
||||
return;
|
||||
|
||||
ListDictionary_Remove(g_CardContexts, (void *) hContext);
|
||||
ListDictionary_Remove(g_CardContexts, (void*) hContext);
|
||||
}
|
||||
|
||||
BOOL PCSC_LockCardContext(SCARDCONTEXT hContext)
|
||||
{
|
||||
PCSC_SCARDCONTEXT *pContext;
|
||||
PCSC_SCARDCONTEXT* pContext;
|
||||
pContext = PCSC_GetCardContextData(hContext);
|
||||
|
||||
if (!pContext)
|
||||
{
|
||||
WLog_ERR(TAG, "PCSC_LockCardContext: invalid context (%p)", (void *) hContext);
|
||||
WLog_ERR(TAG, "PCSC_LockCardContext: invalid context (%p)", (void*) hContext);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -377,12 +377,12 @@ BOOL PCSC_LockCardContext(SCARDCONTEXT hContext)
|
||||
|
||||
BOOL PCSC_UnlockCardContext(SCARDCONTEXT hContext)
|
||||
{
|
||||
PCSC_SCARDCONTEXT *pContext;
|
||||
PCSC_SCARDCONTEXT* pContext;
|
||||
pContext = PCSC_GetCardContextData(hContext);
|
||||
|
||||
if (!pContext)
|
||||
{
|
||||
WLog_ERR(TAG, "PCSC_UnlockCardContext: invalid context (%p)", (void *) hContext);
|
||||
WLog_ERR(TAG, "PCSC_UnlockCardContext: invalid context (%p)", (void*) hContext);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -390,14 +390,14 @@ BOOL PCSC_UnlockCardContext(SCARDCONTEXT hContext)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PCSC_SCARDHANDLE *PCSC_GetCardHandleData(SCARDHANDLE hCard)
|
||||
PCSC_SCARDHANDLE* PCSC_GetCardHandleData(SCARDHANDLE hCard)
|
||||
{
|
||||
PCSC_SCARDHANDLE *pCard;
|
||||
PCSC_SCARDHANDLE* pCard;
|
||||
|
||||
if (!g_CardHandles)
|
||||
return NULL;
|
||||
|
||||
pCard = (PCSC_SCARDHANDLE *) ListDictionary_GetItemValue(g_CardHandles, (void *) hCard);
|
||||
pCard = (PCSC_SCARDHANDLE*) ListDictionary_GetItemValue(g_CardHandles, (void*) hCard);
|
||||
|
||||
if (!pCard)
|
||||
return NULL;
|
||||
@ -407,7 +407,7 @@ PCSC_SCARDHANDLE *PCSC_GetCardHandleData(SCARDHANDLE hCard)
|
||||
|
||||
SCARDCONTEXT PCSC_GetCardContextFromHandle(SCARDHANDLE hCard)
|
||||
{
|
||||
PCSC_SCARDHANDLE *pCard;
|
||||
PCSC_SCARDHANDLE* pCard;
|
||||
pCard = PCSC_GetCardHandleData(hCard);
|
||||
|
||||
if (!pCard)
|
||||
@ -416,10 +416,10 @@ SCARDCONTEXT PCSC_GetCardContextFromHandle(SCARDHANDLE hCard)
|
||||
return pCard->hPrivateContext;
|
||||
}
|
||||
|
||||
PCSC_SCARDHANDLE *PCSC_ConnectCardHandle(SCARDCONTEXT hSharedContext, SCARDCONTEXT hPrivateContext, SCARDHANDLE hCard)
|
||||
PCSC_SCARDHANDLE* PCSC_ConnectCardHandle(SCARDCONTEXT hSharedContext, SCARDCONTEXT hPrivateContext, SCARDHANDLE hCard)
|
||||
{
|
||||
PCSC_SCARDHANDLE *pCard;
|
||||
PCSC_SCARDCONTEXT *pContext;
|
||||
PCSC_SCARDHANDLE* pCard;
|
||||
PCSC_SCARDCONTEXT* pContext;
|
||||
pContext = PCSC_GetCardContextData(hSharedContext);
|
||||
|
||||
if (!pContext)
|
||||
@ -428,7 +428,7 @@ PCSC_SCARDHANDLE *PCSC_ConnectCardHandle(SCARDCONTEXT hSharedContext, SCARDCONTE
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pCard = (PCSC_SCARDHANDLE *) calloc(1, sizeof(PCSC_SCARDHANDLE));
|
||||
pCard = (PCSC_SCARDHANDLE*) calloc(1, sizeof(PCSC_SCARDHANDLE));
|
||||
|
||||
if (!pCard)
|
||||
return NULL;
|
||||
@ -441,14 +441,14 @@ PCSC_SCARDHANDLE *PCSC_ConnectCardHandle(SCARDCONTEXT hSharedContext, SCARDCONTE
|
||||
if (!g_CardHandles)
|
||||
g_CardHandles = ListDictionary_New(TRUE);
|
||||
|
||||
ListDictionary_Add(g_CardHandles, (void *) hCard, (void *) pCard);
|
||||
ListDictionary_Add(g_CardHandles, (void*) hCard, (void*) pCard);
|
||||
return pCard;
|
||||
}
|
||||
|
||||
void PCSC_DisconnectCardHandle(SCARDHANDLE hCard)
|
||||
{
|
||||
PCSC_SCARDHANDLE *pCard;
|
||||
PCSC_SCARDCONTEXT *pContext;
|
||||
PCSC_SCARDHANDLE* pCard;
|
||||
PCSC_SCARDCONTEXT* pContext;
|
||||
pCard = PCSC_GetCardHandleData(hCard);
|
||||
|
||||
if (!pCard)
|
||||
@ -462,7 +462,7 @@ void PCSC_DisconnectCardHandle(SCARDHANDLE hCard)
|
||||
if (!g_CardHandles)
|
||||
return;
|
||||
|
||||
ListDictionary_Remove(g_CardHandles, (void *) hCard);
|
||||
ListDictionary_Remove(g_CardHandles, (void*) hCard);
|
||||
|
||||
if (!pContext)
|
||||
{
|
||||
@ -475,12 +475,12 @@ void PCSC_DisconnectCardHandle(SCARDHANDLE hCard)
|
||||
|
||||
BOOL PCSC_LockCardHandle(SCARDHANDLE hCard)
|
||||
{
|
||||
PCSC_SCARDHANDLE *pCard;
|
||||
PCSC_SCARDHANDLE* pCard;
|
||||
pCard = PCSC_GetCardHandleData(hCard);
|
||||
|
||||
if (!pCard)
|
||||
{
|
||||
WLog_ERR(TAG, "PCSC_LockCardHandle: invalid handle (%p)", (void *) hCard);
|
||||
WLog_ERR(TAG, "PCSC_LockCardHandle: invalid handle (%p)", (void*) hCard);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -490,12 +490,12 @@ BOOL PCSC_LockCardHandle(SCARDHANDLE hCard)
|
||||
|
||||
BOOL PCSC_UnlockCardHandle(SCARDHANDLE hCard)
|
||||
{
|
||||
PCSC_SCARDHANDLE *pCard;
|
||||
PCSC_SCARDHANDLE* pCard;
|
||||
pCard = PCSC_GetCardHandleData(hCard);
|
||||
|
||||
if (!pCard)
|
||||
{
|
||||
WLog_ERR(TAG, "PCSC_UnlockCardHandle: invalid handle (%p)", (void *) hCard);
|
||||
WLog_ERR(TAG, "PCSC_UnlockCardHandle: invalid handle (%p)", (void*) hCard);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -505,13 +505,13 @@ BOOL PCSC_UnlockCardHandle(SCARDHANDLE hCard)
|
||||
|
||||
BOOL PCSC_LockCardTransaction(SCARDHANDLE hCard)
|
||||
{
|
||||
PCSC_SCARDHANDLE *pCard;
|
||||
PCSC_SCARDHANDLE* pCard;
|
||||
return TRUE; /* disable for now because it deadlocks */
|
||||
pCard = PCSC_GetCardHandleData(hCard);
|
||||
|
||||
if (!pCard)
|
||||
{
|
||||
WLog_ERR(TAG, "PCSC_LockCardTransaction: invalid handle (%p)", (void *) hCard);
|
||||
WLog_ERR(TAG, "PCSC_LockCardTransaction: invalid handle (%p)", (void*) hCard);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -521,13 +521,13 @@ BOOL PCSC_LockCardTransaction(SCARDHANDLE hCard)
|
||||
|
||||
BOOL PCSC_UnlockCardTransaction(SCARDHANDLE hCard)
|
||||
{
|
||||
PCSC_SCARDHANDLE *pCard;
|
||||
PCSC_SCARDHANDLE* pCard;
|
||||
return TRUE; /* disable for now because it deadlocks */
|
||||
pCard = PCSC_GetCardHandleData(hCard);
|
||||
|
||||
if (!pCard)
|
||||
{
|
||||
WLog_ERR(TAG, "PCSC_UnlockCardTransaction: invalid handle (%p)", (void *) hCard);
|
||||
WLog_ERR(TAG, "PCSC_UnlockCardTransaction: invalid handle (%p)", (void*) hCard);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -535,12 +535,12 @@ BOOL PCSC_UnlockCardTransaction(SCARDHANDLE hCard)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char *PCSC_GetReaderNameFromAlias(char *nameWinSCard)
|
||||
char* PCSC_GetReaderNameFromAlias(char* nameWinSCard)
|
||||
{
|
||||
int index;
|
||||
int count;
|
||||
PCSC_READER *reader;
|
||||
char *namePCSC = NULL;
|
||||
PCSC_READER* reader;
|
||||
char* namePCSC = NULL;
|
||||
ArrayList_Lock(g_Readers);
|
||||
count = ArrayList_Count(g_Readers);
|
||||
|
||||
@ -559,14 +559,14 @@ char *PCSC_GetReaderNameFromAlias(char *nameWinSCard)
|
||||
return namePCSC;
|
||||
}
|
||||
|
||||
BOOL PCSC_AddReaderNameAlias(char *namePCSC, char *nameWinSCard)
|
||||
BOOL PCSC_AddReaderNameAlias(char* namePCSC, char* nameWinSCard)
|
||||
{
|
||||
PCSC_READER *reader;
|
||||
PCSC_READER* reader;
|
||||
|
||||
if (PCSC_GetReaderNameFromAlias(nameWinSCard))
|
||||
return TRUE;
|
||||
|
||||
reader = (PCSC_READER *) calloc(1, sizeof(PCSC_READER));
|
||||
reader = (PCSC_READER*) calloc(1, sizeof(PCSC_READER));
|
||||
|
||||
if (!reader)
|
||||
return FALSE;
|
||||
@ -577,7 +577,7 @@ BOOL PCSC_AddReaderNameAlias(char *namePCSC, char *nameWinSCard)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int PCSC_AtoiWithLength(const char *str, int length)
|
||||
static int PCSC_AtoiWithLength(const char* str, int length)
|
||||
{
|
||||
int index;
|
||||
int value = 0;
|
||||
@ -593,7 +593,7 @@ static int PCSC_AtoiWithLength(const char *str, int length)
|
||||
return value;
|
||||
}
|
||||
|
||||
char *PCSC_ConvertReaderNameToWinSCard(const char *name)
|
||||
char* PCSC_ConvertReaderNameToWinSCard(const char* name)
|
||||
{
|
||||
int slot;
|
||||
int index;
|
||||
@ -601,9 +601,9 @@ char *PCSC_ConvertReaderNameToWinSCard(const char *name)
|
||||
int length;
|
||||
int ctoken;
|
||||
int ntokens;
|
||||
char *p, *q;
|
||||
char *tokens[64][2];
|
||||
char *nameWinSCard;
|
||||
char* p, *q;
|
||||
char* tokens[64][2];
|
||||
char* nameWinSCard;
|
||||
/**
|
||||
* pcsc-lite reader name format:
|
||||
* name [interface] (serial) index slot
|
||||
@ -650,7 +650,7 @@ char *PCSC_ConvertReaderNameToWinSCard(const char *name)
|
||||
return NULL;
|
||||
|
||||
ntokens = 0;
|
||||
p = q = (char *) name;
|
||||
p = q = (char*) name;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
@ -715,7 +715,7 @@ char *PCSC_ConvertReaderNameToWinSCard(const char *name)
|
||||
q = tokens[ctoken][1];
|
||||
length = (q - p);
|
||||
size = length + 16;
|
||||
nameWinSCard = (char *) malloc(size);
|
||||
nameWinSCard = (char*) malloc(size);
|
||||
|
||||
if (!nameWinSCard)
|
||||
return NULL;
|
||||
@ -731,9 +731,9 @@ char *PCSC_ConvertReaderNameToWinSCard(const char *name)
|
||||
return nameWinSCard;
|
||||
}
|
||||
|
||||
char *PCSC_GetReaderAliasFromName(char *namePCSC)
|
||||
char* PCSC_GetReaderAliasFromName(char* namePCSC)
|
||||
{
|
||||
char *nameWinSCard;
|
||||
char* nameWinSCard;
|
||||
nameWinSCard = PCSC_ConvertReaderNameToWinSCard(namePCSC);
|
||||
|
||||
if (nameWinSCard)
|
||||
@ -742,22 +742,22 @@ char *PCSC_GetReaderAliasFromName(char *namePCSC)
|
||||
return nameWinSCard;
|
||||
}
|
||||
|
||||
char *PCSC_ConvertReaderNamesToWinSCard(const char *names, LPDWORD pcchReaders)
|
||||
char* PCSC_ConvertReaderNamesToWinSCard(const char* names, LPDWORD pcchReaders)
|
||||
{
|
||||
int length;
|
||||
char *p, *q;
|
||||
char* p, *q;
|
||||
DWORD cchReaders;
|
||||
char *nameWinSCard;
|
||||
char *namesWinSCard;
|
||||
p = (char *) names;
|
||||
char* nameWinSCard;
|
||||
char* namesWinSCard;
|
||||
p = (char*) names;
|
||||
cchReaders = *pcchReaders;
|
||||
namesWinSCard = (char *) malloc(cchReaders * 2);
|
||||
namesWinSCard = (char*) malloc(cchReaders * 2);
|
||||
|
||||
if (!namesWinSCard)
|
||||
return NULL;
|
||||
|
||||
q = namesWinSCard;
|
||||
p = (char *) names;
|
||||
p = (char*) names;
|
||||
|
||||
while ((p - names) < cchReaders)
|
||||
{
|
||||
@ -787,22 +787,22 @@ char *PCSC_ConvertReaderNamesToWinSCard(const char *names, LPDWORD pcchReaders)
|
||||
return namesWinSCard;
|
||||
}
|
||||
|
||||
char *PCSC_ConvertReaderNamesToPCSC(const char *names, LPDWORD pcchReaders)
|
||||
char* PCSC_ConvertReaderNamesToPCSC(const char* names, LPDWORD pcchReaders)
|
||||
{
|
||||
int length;
|
||||
char *p, *q;
|
||||
char *namePCSC;
|
||||
char *namesPCSC;
|
||||
char* p, *q;
|
||||
char* namePCSC;
|
||||
char* namesPCSC;
|
||||
DWORD cchReaders;
|
||||
p = (char *) names;
|
||||
p = (char*) names;
|
||||
cchReaders = *pcchReaders;
|
||||
namesPCSC = (char *) malloc(cchReaders * 2);
|
||||
namesPCSC = (char*) malloc(cchReaders * 2);
|
||||
|
||||
if (!namesPCSC)
|
||||
return NULL;
|
||||
|
||||
q = namesPCSC;
|
||||
p = (char *) names;
|
||||
p = (char*) names;
|
||||
|
||||
while ((p - names) < cchReaders)
|
||||
{
|
||||
@ -825,15 +825,15 @@ char *PCSC_ConvertReaderNamesToPCSC(const char *names, LPDWORD pcchReaders)
|
||||
return namesPCSC;
|
||||
}
|
||||
|
||||
void PCSC_AddMemoryBlock(SCARDCONTEXT hContext, void *pvMem)
|
||||
void PCSC_AddMemoryBlock(SCARDCONTEXT hContext, void* pvMem)
|
||||
{
|
||||
if (!g_MemoryBlocks)
|
||||
g_MemoryBlocks = ListDictionary_New(TRUE);
|
||||
|
||||
ListDictionary_Add(g_MemoryBlocks, pvMem, (void *) hContext);
|
||||
ListDictionary_Add(g_MemoryBlocks, pvMem, (void*) hContext);
|
||||
}
|
||||
|
||||
void *PCSC_RemoveMemoryBlock(SCARDCONTEXT hContext, void *pvMem)
|
||||
void* PCSC_RemoveMemoryBlock(SCARDCONTEXT hContext, void* pvMem)
|
||||
{
|
||||
if (!g_MemoryBlocks)
|
||||
return NULL;
|
||||
@ -841,9 +841,9 @@ void *PCSC_RemoveMemoryBlock(SCARDCONTEXT hContext, void *pvMem)
|
||||
return ListDictionary_Remove(g_MemoryBlocks, pvMem);
|
||||
}
|
||||
|
||||
void *PCSC_SCardAllocMemory(SCARDCONTEXT hContext, size_t size)
|
||||
void* PCSC_SCardAllocMemory(SCARDCONTEXT hContext, size_t size)
|
||||
{
|
||||
void *pvMem;
|
||||
void* pvMem;
|
||||
pvMem = malloc(size);
|
||||
|
||||
if (!pvMem)
|
||||
@ -976,9 +976,9 @@ WINSCARDAPI LONG WINAPI PCSC_SCardListReaders_Internal(SCARDCONTEXT hContext,
|
||||
LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)
|
||||
{
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
char *mszReadersWinSCard = NULL;
|
||||
char* mszReadersWinSCard = NULL;
|
||||
BOOL pcchReadersAlloc = FALSE;
|
||||
LPSTR *pMszReaders = (LPSTR *) mszReaders;
|
||||
LPSTR* pMszReaders = (LPSTR*) mszReaders;
|
||||
PCSC_DWORD pcsc_cchReaders = 0;
|
||||
|
||||
if (!pcchReaders)
|
||||
@ -1077,7 +1077,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardListReadersW(SCARDCONTEXT hContext,
|
||||
{
|
||||
LPSTR mszGroupsA = NULL;
|
||||
LPSTR mszReadersA = NULL;
|
||||
LPSTR *pMszReadersA = &mszReadersA;
|
||||
LPSTR* pMszReadersA = &mszReadersA;
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
BOOL nullCardContext = FALSE;
|
||||
|
||||
@ -1100,13 +1100,13 @@ WINSCARDAPI LONG WINAPI PCSC_SCardListReadersW(SCARDCONTEXT hContext,
|
||||
mszGroups = NULL; /* mszGroups is not supported by pcsc-lite */
|
||||
|
||||
if (mszGroups)
|
||||
ConvertFromUnicode(CP_UTF8, 0, mszGroups, -1, (char **) &mszGroupsA, 0, NULL, NULL);
|
||||
ConvertFromUnicode(CP_UTF8, 0, mszGroups, -1, (char**) &mszGroupsA, 0, NULL, NULL);
|
||||
|
||||
status = PCSC_SCardListReaders_Internal(hContext, mszGroupsA, (LPSTR) &mszReadersA, pcchReaders);
|
||||
|
||||
if (status == SCARD_S_SUCCESS)
|
||||
{
|
||||
*pcchReaders = ConvertToUnicode(CP_UTF8, 0, *pMszReadersA, *pcchReaders, (WCHAR **) mszReaders, 0);
|
||||
*pcchReaders = ConvertToUnicode(CP_UTF8, 0, *pMszReadersA, *pcchReaders, (WCHAR**) mszReaders, 0);
|
||||
PCSC_AddMemoryBlock(hContext, mszReaders);
|
||||
PCSC_SCardFreeMemory_Internal(hContext, *pMszReadersA);
|
||||
}
|
||||
@ -1125,13 +1125,13 @@ WINSCARDAPI LONG WINAPI PCSC_SCardListReadersW(SCARDCONTEXT hContext,
|
||||
}
|
||||
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardListCardsA(SCARDCONTEXT hContext,
|
||||
LPCBYTE pbAtr, LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount, CHAR *mszCards, LPDWORD pcchCards)
|
||||
LPCBYTE pbAtr, LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount, CHAR* mszCards, LPDWORD pcchCards)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardListCardsW(SCARDCONTEXT hContext,
|
||||
LPCBYTE pbAtr, LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount, WCHAR *mszCards, LPDWORD pcchCards)
|
||||
LPCBYTE pbAtr, LPCGUID rgquidInterfaces, DWORD cguidInterfaceCount, WCHAR* mszCards, LPDWORD pcchCards)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -1161,13 +1161,13 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetProviderIdW(SCARDCONTEXT hContext,
|
||||
}
|
||||
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardGetCardTypeProviderNameA(SCARDCONTEXT hContext,
|
||||
LPCSTR szCardName, DWORD dwProviderId, CHAR *szProvider, LPDWORD pcchProvider)
|
||||
LPCSTR szCardName, DWORD dwProviderId, CHAR* szProvider, LPDWORD pcchProvider)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardGetCardTypeProviderNameW(SCARDCONTEXT hContext,
|
||||
LPCWSTR szCardName, DWORD dwProviderId, WCHAR *szProvider, LPDWORD pcchProvider)
|
||||
LPCWSTR szCardName, DWORD dwProviderId, WCHAR* szProvider, LPDWORD pcchProvider)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -1278,9 +1278,9 @@ WINSCARDAPI LONG WINAPI PCSC_SCardFreeMemory_Internal(SCARDCONTEXT hContext, LPC
|
||||
{
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
|
||||
if (PCSC_RemoveMemoryBlock(hContext, (void *) pvMem))
|
||||
if (PCSC_RemoveMemoryBlock(hContext, (void*) pvMem))
|
||||
{
|
||||
free((void *) pvMem);
|
||||
free((void*) pvMem);
|
||||
status = SCARD_S_SUCCESS;
|
||||
}
|
||||
else
|
||||
@ -1382,11 +1382,11 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChange_Internal(SCARDCONTEXT hContext
|
||||
DWORD dwTimeout, LPSCARD_READERSTATEA rgReaderStates, DWORD cReaders)
|
||||
{
|
||||
int i, j;
|
||||
int *map;
|
||||
int* map;
|
||||
DWORD dwEventState;
|
||||
PCSC_DWORD cMappedReaders;
|
||||
BOOL stateChanged = FALSE;
|
||||
PCSC_SCARD_READERSTATE *states;
|
||||
PCSC_SCARD_READERSTATE* states;
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
PCSC_DWORD pcsc_dwTimeout = (PCSC_DWORD) dwTimeout;
|
||||
PCSC_DWORD pcsc_cReaders = (PCSC_DWORD) cReaders;
|
||||
@ -1410,12 +1410,12 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChange_Internal(SCARDCONTEXT hContext
|
||||
* To work around this apparent lack of "\\\\?PnP?\\Notification" support,
|
||||
* we have to filter rgReaderStates to exclude the special PnP reader name.
|
||||
*/
|
||||
map = (int *) calloc(pcsc_cReaders, sizeof(int));
|
||||
map = (int*) calloc(pcsc_cReaders, sizeof(int));
|
||||
|
||||
if (!map)
|
||||
return SCARD_E_NO_MEMORY;
|
||||
|
||||
states = (PCSC_SCARD_READERSTATE *) calloc(pcsc_cReaders, sizeof(PCSC_SCARD_READERSTATE));
|
||||
states = (PCSC_SCARD_READERSTATE*) calloc(pcsc_cReaders, sizeof(PCSC_SCARD_READERSTATE));
|
||||
|
||||
if (!states)
|
||||
return SCARD_E_NO_MEMORY;
|
||||
@ -1432,7 +1432,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChange_Internal(SCARDCONTEXT hContext
|
||||
}
|
||||
|
||||
map[i] = j;
|
||||
states[j].szReader = PCSC_GetReaderNameFromAlias((char *) rgReaderStates[i].szReader);
|
||||
states[j].szReader = PCSC_GetReaderNameFromAlias((char*) rgReaderStates[i].szReader);
|
||||
|
||||
if (!states[j].szReader)
|
||||
states[j].szReader = rgReaderStates[i].szReader;
|
||||
@ -1547,7 +1547,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChangeW(SCARDCONTEXT hContext,
|
||||
{
|
||||
states[index].szReader = NULL;
|
||||
ConvertFromUnicode(CP_UTF8, 0, rgReaderStates[index].szReader, -1,
|
||||
(char **) &(states[index].szReader), 0, NULL, NULL);
|
||||
(char**) &(states[index].szReader), 0, NULL, NULL);
|
||||
states[index].pvUserData = rgReaderStates[index].pvUserData;
|
||||
states[index].dwCurrentState = rgReaderStates[index].dwCurrentState;
|
||||
states[index].dwEventState = rgReaderStates[index].dwEventState;
|
||||
@ -1559,7 +1559,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetStatusChangeW(SCARDCONTEXT hContext,
|
||||
|
||||
for (index = 0; index < cReaders; index++)
|
||||
{
|
||||
free((void *) states[index].szReader);
|
||||
free((void*) states[index].szReader);
|
||||
rgReaderStates[index].pvUserData = states[index].pvUserData;
|
||||
rgReaderStates[index].dwCurrentState = states[index].dwCurrentState;
|
||||
rgReaderStates[index].dwEventState = states[index].dwEventState;
|
||||
@ -1591,7 +1591,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardConnect_Internal(SCARDCONTEXT hContext,
|
||||
LPCSTR szReader, DWORD dwShareMode, DWORD dwPreferredProtocols,
|
||||
LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocol)
|
||||
{
|
||||
char *szReaderPCSC;
|
||||
char* szReaderPCSC;
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
SCARDCONTEXT hPrivateContext = 0;
|
||||
PCSC_DWORD pcsc_dwShareMode = (PCSC_DWORD) dwShareMode;
|
||||
@ -1606,10 +1606,10 @@ WINSCARDAPI LONG WINAPI PCSC_SCardConnect_Internal(SCARDCONTEXT hContext,
|
||||
if (status != SCARD_S_SUCCESS)
|
||||
return status;
|
||||
|
||||
szReaderPCSC = PCSC_GetReaderNameFromAlias((char *) szReader);
|
||||
szReaderPCSC = PCSC_GetReaderNameFromAlias((char*) szReader);
|
||||
|
||||
if (!szReaderPCSC)
|
||||
szReaderPCSC = (char *) szReader;
|
||||
szReaderPCSC = (char*) szReader;
|
||||
|
||||
pcsc_dwPreferredProtocols = (PCSC_DWORD) PCSC_ConvertProtocolsFromWinSCard(dwPreferredProtocols);
|
||||
status = (LONG) g_PCSC.pfnSCardConnect(hPrivateContext, szReaderPCSC,
|
||||
@ -1712,8 +1712,8 @@ WINSCARDAPI LONG WINAPI PCSC_SCardDisconnect(SCARDHANDLE hCard, DWORD dwDisposit
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardBeginTransaction(SCARDHANDLE hCard)
|
||||
{
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
PCSC_SCARDHANDLE *pCard = NULL;
|
||||
PCSC_SCARDCONTEXT *pContext = NULL;
|
||||
PCSC_SCARDHANDLE* pCard = NULL;
|
||||
PCSC_SCARDCONTEXT* pContext = NULL;
|
||||
|
||||
if (!g_PCSC.pfnSCardBeginTransaction)
|
||||
return SCARD_E_NO_SERVICE;
|
||||
@ -1744,8 +1744,8 @@ WINSCARDAPI LONG WINAPI PCSC_SCardBeginTransaction(SCARDHANDLE hCard)
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardEndTransaction(SCARDHANDLE hCard, DWORD dwDisposition)
|
||||
{
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
PCSC_SCARDHANDLE *pCard = NULL;
|
||||
PCSC_SCARDCONTEXT *pContext = NULL;
|
||||
PCSC_SCARDHANDLE* pCard = NULL;
|
||||
PCSC_SCARDCONTEXT* pContext = NULL;
|
||||
PCSC_DWORD pcsc_dwDisposition = (PCSC_DWORD) dwDisposition;
|
||||
|
||||
if (!g_PCSC.pfnSCardEndTransaction)
|
||||
@ -1817,11 +1817,11 @@ WINSCARDAPI LONG WINAPI PCSC_SCardStatus_Internal(SCARDHANDLE hCard,
|
||||
LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
|
||||
{
|
||||
SCARDCONTEXT hContext;
|
||||
char *mszReaderNamesWinSCard = NULL;
|
||||
char* mszReaderNamesWinSCard = NULL;
|
||||
BOOL pcbAtrLenAlloc = FALSE;
|
||||
BOOL pcchReaderLenAlloc = FALSE;
|
||||
LPBYTE *pPbAtr = (LPBYTE *) pbAtr;
|
||||
LPSTR *pMszReaderNames = (LPSTR *) mszReaderNames;
|
||||
LPBYTE* pPbAtr = (LPBYTE*) pbAtr;
|
||||
LPSTR* pMszReaderNames = (LPSTR*) mszReaderNames;
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
PCSC_DWORD pcsc_cchReaderLen = 0;
|
||||
PCSC_DWORD pcsc_dwState = 0;
|
||||
@ -1871,7 +1871,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardStatus_Internal(SCARDHANDLE hCard,
|
||||
|
||||
if (pcbAtrLenAlloc)
|
||||
{
|
||||
*pPbAtr = (BYTE *) calloc(1, pcsc_cbAtrLen);
|
||||
*pPbAtr = (BYTE*) calloc(1, pcsc_cbAtrLen);
|
||||
|
||||
if (!*pPbAtr)
|
||||
return SCARD_E_NO_MEMORY;
|
||||
@ -1959,7 +1959,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardStatusW(SCARDHANDLE hCard,
|
||||
|
||||
if (mszReaderNamesA)
|
||||
{
|
||||
*pcchReaderLen = ConvertToUnicode(CP_UTF8, 0, mszReaderNamesA, *pcchReaderLen, (WCHAR **) mszReaderNames, 0);
|
||||
*pcchReaderLen = ConvertToUnicode(CP_UTF8, 0, mszReaderNamesA, *pcchReaderLen, (WCHAR**) mszReaderNames, 0);
|
||||
PCSC_AddMemoryBlock(hContext, mszReaderNames);
|
||||
PCSC_SCardFreeMemory_Internal(hContext, mszReaderNamesA);
|
||||
}
|
||||
@ -1973,10 +1973,10 @@ WINSCARDAPI LONG WINAPI PCSC_SCardTransmit(SCARDHANDLE hCard,
|
||||
{
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
PCSC_DWORD cbExtraBytes = 0;
|
||||
BYTE *pbExtraBytes = NULL;
|
||||
BYTE *pcsc_pbExtraBytes = NULL;
|
||||
PCSC_SCARD_IO_REQUEST *pcsc_pioSendPci = NULL;
|
||||
PCSC_SCARD_IO_REQUEST *pcsc_pioRecvPci = NULL;
|
||||
BYTE* pbExtraBytes = NULL;
|
||||
BYTE* pcsc_pbExtraBytes = NULL;
|
||||
PCSC_SCARD_IO_REQUEST* pcsc_pioSendPci = NULL;
|
||||
PCSC_SCARD_IO_REQUEST* pcsc_pioRecvPci = NULL;
|
||||
PCSC_DWORD pcsc_cbSendLength = (PCSC_DWORD) cbSendLength;
|
||||
PCSC_DWORD pcsc_cbRecvLength = 0;
|
||||
|
||||
@ -2006,40 +2006,40 @@ WINSCARDAPI LONG WINAPI PCSC_SCardTransmit(SCARDHANDLE hCard,
|
||||
if (status == SCARD_S_SUCCESS)
|
||||
{
|
||||
if (dwProtocol == SCARD_PROTOCOL_T0)
|
||||
pcsc_pioSendPci = (PCSC_SCARD_IO_REQUEST *) PCSC_SCARD_PCI_T0;
|
||||
pcsc_pioSendPci = (PCSC_SCARD_IO_REQUEST*) PCSC_SCARD_PCI_T0;
|
||||
else if (dwProtocol == SCARD_PROTOCOL_T1)
|
||||
pcsc_pioSendPci = (PCSC_SCARD_IO_REQUEST *) PCSC_SCARD_PCI_T1;
|
||||
pcsc_pioSendPci = (PCSC_SCARD_IO_REQUEST*) PCSC_SCARD_PCI_T1;
|
||||
else if (dwProtocol == PCSC_SCARD_PROTOCOL_RAW)
|
||||
pcsc_pioSendPci = (PCSC_SCARD_IO_REQUEST *) PCSC_SCARD_PCI_RAW;
|
||||
pcsc_pioSendPci = (PCSC_SCARD_IO_REQUEST*) PCSC_SCARD_PCI_RAW;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cbExtraBytes = pioSendPci->cbPciLength - sizeof(SCARD_IO_REQUEST);
|
||||
pcsc_pioSendPci = (PCSC_SCARD_IO_REQUEST *) malloc(sizeof(PCSC_SCARD_IO_REQUEST) + cbExtraBytes);
|
||||
pcsc_pioSendPci = (PCSC_SCARD_IO_REQUEST*) malloc(sizeof(PCSC_SCARD_IO_REQUEST) + cbExtraBytes);
|
||||
|
||||
if (!pcsc_pioSendPci)
|
||||
return SCARD_E_NO_MEMORY;
|
||||
|
||||
pcsc_pioSendPci->dwProtocol = (PCSC_DWORD) pioSendPci->dwProtocol;
|
||||
pcsc_pioSendPci->cbPciLength = sizeof(PCSC_SCARD_IO_REQUEST) + cbExtraBytes;
|
||||
pbExtraBytes = &((BYTE *) pioSendPci)[sizeof(SCARD_IO_REQUEST)];
|
||||
pcsc_pbExtraBytes = &((BYTE *) pcsc_pioSendPci)[sizeof(PCSC_SCARD_IO_REQUEST)];
|
||||
pbExtraBytes = &((BYTE*) pioSendPci)[sizeof(SCARD_IO_REQUEST)];
|
||||
pcsc_pbExtraBytes = &((BYTE*) pcsc_pioSendPci)[sizeof(PCSC_SCARD_IO_REQUEST)];
|
||||
CopyMemory(pcsc_pbExtraBytes, pbExtraBytes, cbExtraBytes);
|
||||
}
|
||||
|
||||
if (pioRecvPci)
|
||||
{
|
||||
cbExtraBytes = pioRecvPci->cbPciLength - sizeof(SCARD_IO_REQUEST);
|
||||
pcsc_pioRecvPci = (PCSC_SCARD_IO_REQUEST *) malloc(sizeof(PCSC_SCARD_IO_REQUEST) + cbExtraBytes);
|
||||
pcsc_pioRecvPci = (PCSC_SCARD_IO_REQUEST*) malloc(sizeof(PCSC_SCARD_IO_REQUEST) + cbExtraBytes);
|
||||
|
||||
if (!pcsc_pioRecvPci)
|
||||
return SCARD_E_NO_MEMORY;
|
||||
|
||||
pcsc_pioRecvPci->dwProtocol = (PCSC_DWORD) pioRecvPci->dwProtocol;
|
||||
pcsc_pioRecvPci->cbPciLength = sizeof(PCSC_SCARD_IO_REQUEST) + cbExtraBytes;
|
||||
pbExtraBytes = &((BYTE *) pioRecvPci)[sizeof(SCARD_IO_REQUEST)];
|
||||
pcsc_pbExtraBytes = &((BYTE *) pcsc_pioRecvPci)[sizeof(PCSC_SCARD_IO_REQUEST)];
|
||||
pbExtraBytes = &((BYTE*) pioRecvPci)[sizeof(SCARD_IO_REQUEST)];
|
||||
pcsc_pbExtraBytes = &((BYTE*) pcsc_pioRecvPci)[sizeof(PCSC_SCARD_IO_REQUEST)];
|
||||
CopyMemory(pcsc_pbExtraBytes, pbExtraBytes, cbExtraBytes);
|
||||
}
|
||||
|
||||
@ -2101,10 +2101,10 @@ WINSCARDAPI LONG WINAPI PCSC_SCardControl(SCARDHANDLE hCard,
|
||||
if (getFeatureRequest)
|
||||
{
|
||||
UINT32 ioCtlValue;
|
||||
PCSC_TLV_STRUCTURE *tlv = (PCSC_TLV_STRUCTURE *) lpOutBuffer;
|
||||
void *lpOutBufferEnd = (void *) &((BYTE *) lpOutBuffer)[*lpBytesReturned];
|
||||
PCSC_TLV_STRUCTURE* tlv = (PCSC_TLV_STRUCTURE*) lpOutBuffer;
|
||||
void* lpOutBufferEnd = (void*) &((BYTE*) lpOutBuffer)[*lpBytesReturned];
|
||||
|
||||
for (; ((void *) tlv) < lpOutBufferEnd; tlv++)
|
||||
for (; ((void*) tlv) < lpOutBufferEnd; tlv++)
|
||||
{
|
||||
ioCtlValue = _byteswap_ulong(tlv->value);
|
||||
ioCtlValue -= 0x42000000; /* inverse of PCSC_SCARD_CTL_CODE() */
|
||||
@ -2124,7 +2124,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib_Internal(SCARDHANDLE hCard, DWORD dw
|
||||
{
|
||||
SCARDCONTEXT hContext = 0;
|
||||
BOOL pcbAttrLenAlloc = FALSE;
|
||||
LPBYTE *pPbAttr = (LPBYTE *) pbAttr;
|
||||
LPBYTE* pPbAttr = (LPBYTE*) pbAttr;
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
PCSC_DWORD pcsc_dwAttrId = (PCSC_DWORD) dwAttrId;
|
||||
PCSC_DWORD pcsc_cbAttrLen = 0;
|
||||
@ -2152,7 +2152,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib_Internal(SCARDHANDLE hCard, DWORD dw
|
||||
|
||||
if (status == SCARD_S_SUCCESS)
|
||||
{
|
||||
*pPbAttr = (BYTE *) calloc(1, pcsc_cbAttrLen);
|
||||
*pPbAttr = (BYTE*) calloc(1, pcsc_cbAttrLen);
|
||||
|
||||
if (!*pPbAttr)
|
||||
return SCARD_E_NO_MEMORY;
|
||||
@ -2178,16 +2178,16 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib_Internal(SCARDHANDLE hCard, DWORD dw
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib_FriendlyName(SCARDHANDLE hCard, DWORD dwAttrId, LPBYTE pbAttr, LPDWORD pcbAttrLen)
|
||||
{
|
||||
int length = 0;
|
||||
char *namePCSC;
|
||||
char *nameWinSCard;
|
||||
char* namePCSC;
|
||||
char* nameWinSCard;
|
||||
DWORD cbAttrLen = 0;
|
||||
char *pbAttrA = NULL;
|
||||
WCHAR *pbAttrW = NULL;
|
||||
char* pbAttrA = NULL;
|
||||
WCHAR* pbAttrW = NULL;
|
||||
SCARDCONTEXT hContext;
|
||||
char *friendlyNameA = NULL;
|
||||
WCHAR *friendlyNameW = NULL;
|
||||
char* friendlyNameA = NULL;
|
||||
WCHAR* friendlyNameW = NULL;
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
LPBYTE *pPbAttr = (LPBYTE *) pbAttr;
|
||||
LPBYTE* pPbAttr = (LPBYTE*) pbAttr;
|
||||
hContext = PCSC_GetCardContextFromHandle(hCard);
|
||||
|
||||
if (!hContext)
|
||||
@ -2208,8 +2208,8 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib_FriendlyName(SCARDHANDLE hCard, DWOR
|
||||
if (status != SCARD_S_SUCCESS)
|
||||
return status;
|
||||
|
||||
length = ConvertFromUnicode(CP_UTF8, 0, (WCHAR *) pbAttrW,
|
||||
*pcbAttrLen, (char **) &pbAttrA, 0, NULL, NULL);
|
||||
length = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) pbAttrW,
|
||||
*pcbAttrLen, (char**) &pbAttrA, 0, NULL, NULL);
|
||||
namePCSC = pbAttrA;
|
||||
PCSC_SCardFreeMemory_Internal(hContext, pbAttrW);
|
||||
}
|
||||
@ -2241,7 +2241,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib_FriendlyName(SCARDHANDLE hCard, DWOR
|
||||
|
||||
if (dwAttrId == SCARD_ATTR_DEVICE_FRIENDLY_NAME_W)
|
||||
{
|
||||
length = ConvertToUnicode(CP_UTF8, 0, (char *) friendlyNameA, -1, &friendlyNameW, 0);
|
||||
length = ConvertToUnicode(CP_UTF8, 0, (char*) friendlyNameA, -1, &friendlyNameW, 0);
|
||||
free(friendlyNameA);
|
||||
|
||||
if (!friendlyNameW)
|
||||
@ -2249,7 +2249,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib_FriendlyName(SCARDHANDLE hCard, DWOR
|
||||
|
||||
if (cbAttrLen == SCARD_AUTOALLOCATE)
|
||||
{
|
||||
*pPbAttr = (BYTE *) friendlyNameW;
|
||||
*pPbAttr = (BYTE*) friendlyNameW;
|
||||
*pcbAttrLen = length * 2;
|
||||
PCSC_AddMemoryBlock(hContext, *pPbAttr);
|
||||
}
|
||||
@ -2262,7 +2262,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib_FriendlyName(SCARDHANDLE hCard, DWOR
|
||||
}
|
||||
else
|
||||
{
|
||||
CopyMemory(pbAttr, (BYTE *) friendlyNameW, ((length + 1) * 2));
|
||||
CopyMemory(pbAttr, (BYTE*) friendlyNameW, ((length + 1) * 2));
|
||||
*pcbAttrLen = length * 2;
|
||||
free(friendlyNameW);
|
||||
}
|
||||
@ -2272,7 +2272,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib_FriendlyName(SCARDHANDLE hCard, DWOR
|
||||
{
|
||||
if (cbAttrLen == SCARD_AUTOALLOCATE)
|
||||
{
|
||||
*pPbAttr = (BYTE *) friendlyNameA;
|
||||
*pPbAttr = (BYTE*) friendlyNameA;
|
||||
*pcbAttrLen = length;
|
||||
PCSC_AddMemoryBlock(hContext, *pPbAttr);
|
||||
}
|
||||
@ -2285,7 +2285,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib_FriendlyName(SCARDHANDLE hCard, DWOR
|
||||
}
|
||||
else
|
||||
{
|
||||
CopyMemory(pbAttr, (BYTE *) friendlyNameA, length + 1);
|
||||
CopyMemory(pbAttr, (BYTE*) friendlyNameA, length + 1);
|
||||
*pcbAttrLen = length;
|
||||
free(friendlyNameA);
|
||||
}
|
||||
@ -2301,7 +2301,7 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, L
|
||||
SCARDCONTEXT hContext;
|
||||
BOOL pcbAttrLenAlloc = FALSE;
|
||||
LONG status = SCARD_S_SUCCESS;
|
||||
LPBYTE *pPbAttr = (LPBYTE *) pbAttr;
|
||||
LPBYTE* pPbAttr = (LPBYTE*) pbAttr;
|
||||
cbAttrLen = *pcbAttrLen;
|
||||
|
||||
if (*pcbAttrLen == SCARD_AUTOALLOCATE)
|
||||
@ -2337,9 +2337,9 @@ WINSCARDAPI LONG WINAPI PCSC_SCardGetAttrib(SCARDHANDLE hCard, DWORD dwAttrId, L
|
||||
* while WinSCard doesn't. Strip the null terminator.
|
||||
*/
|
||||
if (pcbAttrLenAlloc)
|
||||
*pcbAttrLen = strlen((char *) *pPbAttr);
|
||||
*pcbAttrLen = strlen((char*) *pPbAttr);
|
||||
else
|
||||
*pcbAttrLen = strlen((char *) pbAttr);
|
||||
*pcbAttrLen = strlen((char*) pbAttr);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2471,25 +2471,25 @@ WINSCARDAPI LONG WINAPI PCSC_SCardDlgExtendedError(void)
|
||||
}
|
||||
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardReadCacheA(SCARDCONTEXT hContext,
|
||||
UUID *CardIdentifier, DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data, DWORD *DataLen)
|
||||
UUID* CardIdentifier, DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data, DWORD* DataLen)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardReadCacheW(SCARDCONTEXT hContext,
|
||||
UUID *CardIdentifier, DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data, DWORD *DataLen)
|
||||
UUID* CardIdentifier, DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data, DWORD* DataLen)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardWriteCacheA(SCARDCONTEXT hContext,
|
||||
UUID *CardIdentifier, DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data, DWORD DataLen)
|
||||
UUID* CardIdentifier, DWORD FreshnessCounter, LPSTR LookupName, PBYTE Data, DWORD DataLen)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
WINSCARDAPI LONG WINAPI PCSC_SCardWriteCacheW(SCARDCONTEXT hContext,
|
||||
UUID *CardIdentifier, DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data, DWORD DataLen)
|
||||
UUID* CardIdentifier, DWORD FreshnessCounter, LPWSTR LookupName, PBYTE Data, DWORD DataLen)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -2679,26 +2679,26 @@ int PCSC_InitializeSCardApi(void)
|
||||
if (!g_PCSCModule)
|
||||
return -1;
|
||||
|
||||
g_PCSC.pfnSCardEstablishContext = (void *) GetProcAddress(g_PCSCModule, "SCardEstablishContext");
|
||||
g_PCSC.pfnSCardReleaseContext = (void *) GetProcAddress(g_PCSCModule, "SCardReleaseContext");
|
||||
g_PCSC.pfnSCardIsValidContext = (void *) GetProcAddress(g_PCSCModule, "SCardIsValidContext");
|
||||
g_PCSC.pfnSCardConnect = (void *) GetProcAddress(g_PCSCModule, "SCardConnect");
|
||||
g_PCSC.pfnSCardReconnect = (void *) GetProcAddress(g_PCSCModule, "SCardReconnect");
|
||||
g_PCSC.pfnSCardDisconnect = (void *) GetProcAddress(g_PCSCModule, "SCardDisconnect");
|
||||
g_PCSC.pfnSCardBeginTransaction = (void *) GetProcAddress(g_PCSCModule, "SCardBeginTransaction");
|
||||
g_PCSC.pfnSCardEndTransaction = (void *) GetProcAddress(g_PCSCModule, "SCardEndTransaction");
|
||||
g_PCSC.pfnSCardStatus = (void *) GetProcAddress(g_PCSCModule, "SCardStatus");
|
||||
g_PCSC.pfnSCardGetStatusChange = (void *) GetProcAddress(g_PCSCModule, "SCardGetStatusChange");
|
||||
g_PCSC.pfnSCardControl = (void *) GetProcAddress(g_PCSCModule, "SCardControl");
|
||||
g_PCSC.pfnSCardTransmit = (void *) GetProcAddress(g_PCSCModule, "SCardTransmit");
|
||||
g_PCSC.pfnSCardListReaderGroups = (void *) GetProcAddress(g_PCSCModule, "SCardListReaderGroups");
|
||||
g_PCSC.pfnSCardListReaders = (void *) GetProcAddress(g_PCSCModule, "SCardListReaders");
|
||||
g_PCSC.pfnSCardCancel = (void *) GetProcAddress(g_PCSCModule, "SCardCancel");
|
||||
g_PCSC.pfnSCardGetAttrib = (void *) GetProcAddress(g_PCSCModule, "SCardGetAttrib");
|
||||
g_PCSC.pfnSCardSetAttrib = (void *) GetProcAddress(g_PCSCModule, "SCardSetAttrib");
|
||||
g_PCSC.pfnSCardEstablishContext = (void*) GetProcAddress(g_PCSCModule, "SCardEstablishContext");
|
||||
g_PCSC.pfnSCardReleaseContext = (void*) GetProcAddress(g_PCSCModule, "SCardReleaseContext");
|
||||
g_PCSC.pfnSCardIsValidContext = (void*) GetProcAddress(g_PCSCModule, "SCardIsValidContext");
|
||||
g_PCSC.pfnSCardConnect = (void*) GetProcAddress(g_PCSCModule, "SCardConnect");
|
||||
g_PCSC.pfnSCardReconnect = (void*) GetProcAddress(g_PCSCModule, "SCardReconnect");
|
||||
g_PCSC.pfnSCardDisconnect = (void*) GetProcAddress(g_PCSCModule, "SCardDisconnect");
|
||||
g_PCSC.pfnSCardBeginTransaction = (void*) GetProcAddress(g_PCSCModule, "SCardBeginTransaction");
|
||||
g_PCSC.pfnSCardEndTransaction = (void*) GetProcAddress(g_PCSCModule, "SCardEndTransaction");
|
||||
g_PCSC.pfnSCardStatus = (void*) GetProcAddress(g_PCSCModule, "SCardStatus");
|
||||
g_PCSC.pfnSCardGetStatusChange = (void*) GetProcAddress(g_PCSCModule, "SCardGetStatusChange");
|
||||
g_PCSC.pfnSCardControl = (void*) GetProcAddress(g_PCSCModule, "SCardControl");
|
||||
g_PCSC.pfnSCardTransmit = (void*) GetProcAddress(g_PCSCModule, "SCardTransmit");
|
||||
g_PCSC.pfnSCardListReaderGroups = (void*) GetProcAddress(g_PCSCModule, "SCardListReaderGroups");
|
||||
g_PCSC.pfnSCardListReaders = (void*) GetProcAddress(g_PCSCModule, "SCardListReaders");
|
||||
g_PCSC.pfnSCardCancel = (void*) GetProcAddress(g_PCSCModule, "SCardCancel");
|
||||
g_PCSC.pfnSCardGetAttrib = (void*) GetProcAddress(g_PCSCModule, "SCardGetAttrib");
|
||||
g_PCSC.pfnSCardSetAttrib = (void*) GetProcAddress(g_PCSCModule, "SCardSetAttrib");
|
||||
g_PCSC.pfnSCardFreeMemory = NULL;
|
||||
#ifndef __APPLE__
|
||||
g_PCSC.pfnSCardFreeMemory = (void *) GetProcAddress(g_PCSCModule, "SCardFreeMemory");
|
||||
g_PCSC.pfnSCardFreeMemory = (void*) GetProcAddress(g_PCSCModule, "SCardFreeMemory");
|
||||
#endif
|
||||
|
||||
if (g_PCSC.pfnSCardFreeMemory)
|
||||
|
@ -42,18 +42,18 @@
|
||||
#include "../../log.h"
|
||||
#define TAG WINPR_TAG("sspi.NTLM")
|
||||
|
||||
char *NTLM_PACKAGE_NAME = "NTLM";
|
||||
char* NTLM_PACKAGE_NAME = "NTLM";
|
||||
|
||||
int ntlm_SetContextWorkstation(NTLM_CONTEXT *context, char *Workstation)
|
||||
int ntlm_SetContextWorkstation(NTLM_CONTEXT* context, char* Workstation)
|
||||
{
|
||||
int status;
|
||||
DWORD nSize = 0;
|
||||
char *ws = Workstation;
|
||||
char* ws = Workstation;
|
||||
|
||||
if (!Workstation)
|
||||
{
|
||||
GetComputerNameExA(ComputerNameNetBIOS, NULL, &nSize);
|
||||
ws = (char *) malloc(nSize);
|
||||
ws = (char*) malloc(nSize);
|
||||
|
||||
if (!ws)
|
||||
return -1;
|
||||
@ -78,7 +78,7 @@ int ntlm_SetContextWorkstation(NTLM_CONTEXT *context, char *Workstation)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ntlm_SetContextServicePrincipalNameW(NTLM_CONTEXT *context, LPWSTR ServicePrincipalName)
|
||||
int ntlm_SetContextServicePrincipalNameW(NTLM_CONTEXT* context, LPWSTR ServicePrincipalName)
|
||||
{
|
||||
if (!ServicePrincipalName)
|
||||
{
|
||||
@ -97,7 +97,7 @@ int ntlm_SetContextServicePrincipalNameW(NTLM_CONTEXT *context, LPWSTR ServicePr
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ntlm_SetContextServicePrincipalNameA(NTLM_CONTEXT *context, char *ServicePrincipalName)
|
||||
int ntlm_SetContextServicePrincipalNameA(NTLM_CONTEXT* context, char* ServicePrincipalName)
|
||||
{
|
||||
int status;
|
||||
context->ServicePrincipalName.Buffer = NULL;
|
||||
@ -110,18 +110,18 @@ int ntlm_SetContextServicePrincipalNameA(NTLM_CONTEXT *context, char *ServicePri
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ntlm_SetContextTargetName(NTLM_CONTEXT *context, char *TargetName)
|
||||
int ntlm_SetContextTargetName(NTLM_CONTEXT* context, char* TargetName)
|
||||
{
|
||||
int status;
|
||||
DWORD nSize = 0;
|
||||
char *name = TargetName;
|
||||
char* name = TargetName;
|
||||
|
||||
if (!TargetName)
|
||||
{
|
||||
if (!GetComputerNameExA(ComputerNameDnsHostname, NULL, &nSize))
|
||||
return -1;
|
||||
|
||||
name = (char *) malloc(nSize);
|
||||
name = (char*) malloc(nSize);
|
||||
|
||||
if (!name)
|
||||
return -1;
|
||||
@ -133,7 +133,7 @@ int ntlm_SetContextTargetName(NTLM_CONTEXT *context, char *TargetName)
|
||||
}
|
||||
|
||||
context->TargetName.pvBuffer = NULL;
|
||||
status = ConvertToUnicode(CP_UTF8, 0, name, -1, (LPWSTR *) &context->TargetName.pvBuffer, 0);
|
||||
status = ConvertToUnicode(CP_UTF8, 0, name, -1, (LPWSTR*) &context->TargetName.pvBuffer, 0);
|
||||
|
||||
if (status <= 0)
|
||||
return -1;
|
||||
@ -146,15 +146,15 @@ int ntlm_SetContextTargetName(NTLM_CONTEXT *context, char *TargetName)
|
||||
return 1;
|
||||
}
|
||||
|
||||
NTLM_CONTEXT *ntlm_ContextNew()
|
||||
NTLM_CONTEXT* ntlm_ContextNew()
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG status;
|
||||
DWORD dwType;
|
||||
DWORD dwSize;
|
||||
DWORD dwValue;
|
||||
NTLM_CONTEXT *context;
|
||||
context = (NTLM_CONTEXT *) calloc(1, sizeof(NTLM_CONTEXT));
|
||||
NTLM_CONTEXT* context;
|
||||
context = (NTLM_CONTEXT*) calloc(1, sizeof(NTLM_CONTEXT));
|
||||
|
||||
if (!context)
|
||||
return NULL;
|
||||
@ -170,29 +170,29 @@ NTLM_CONTEXT *ntlm_ContextNew()
|
||||
|
||||
if (status == ERROR_SUCCESS)
|
||||
{
|
||||
if (RegQueryValueEx(hKey, _T("NTLMv2"), NULL, &dwType, (BYTE *) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
if (RegQueryValueEx(hKey, _T("NTLMv2"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
context->NTLMv2 = dwValue ? 1 : 0;
|
||||
|
||||
if (RegQueryValueEx(hKey, _T("UseMIC"), NULL, &dwType, (BYTE *) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
if (RegQueryValueEx(hKey, _T("UseMIC"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
context->UseMIC = dwValue ? 1 : 0;
|
||||
|
||||
if (RegQueryValueEx(hKey, _T("SendVersionInfo"), NULL, &dwType, (BYTE *) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
if (RegQueryValueEx(hKey, _T("SendVersionInfo"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
context->SendVersionInfo = dwValue ? 1 : 0;
|
||||
|
||||
if (RegQueryValueEx(hKey, _T("SendSingleHostData"), NULL, &dwType, (BYTE *) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
if (RegQueryValueEx(hKey, _T("SendSingleHostData"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
context->SendSingleHostData = dwValue ? 1 : 0;
|
||||
|
||||
if (RegQueryValueEx(hKey, _T("SendWorkstationName"), NULL, &dwType, (BYTE *) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
if (RegQueryValueEx(hKey, _T("SendWorkstationName"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
context->SendWorkstationName = dwValue ? 1 : 0;
|
||||
|
||||
if (RegQueryValueEx(hKey, _T("WorkstationName"), NULL, &dwType, NULL, &dwSize) == ERROR_SUCCESS)
|
||||
{
|
||||
char *workstation = (char *) malloc(dwSize + 1);
|
||||
char* workstation = (char*) malloc(dwSize + 1);
|
||||
|
||||
if (!workstation)
|
||||
return NULL;
|
||||
|
||||
status = RegQueryValueExA(hKey, "WorkstationName", NULL, &dwType, (BYTE *) workstation, &dwSize);
|
||||
status = RegQueryValueExA(hKey, "WorkstationName", NULL, &dwType, (BYTE*) workstation, &dwSize);
|
||||
workstation[dwSize] = '\0';
|
||||
|
||||
if (ntlm_SetContextWorkstation(context, workstation) < 0)
|
||||
@ -213,7 +213,7 @@ NTLM_CONTEXT *ntlm_ContextNew()
|
||||
|
||||
if (status == ERROR_SUCCESS)
|
||||
{
|
||||
if (RegQueryValueEx(hKey, _T("SuppressExtendedProtection"), NULL, &dwType, (BYTE *) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
if (RegQueryValueEx(hKey, _T("SuppressExtendedProtection"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
context->SuppressExtendedProtection = dwValue ? 1 : 0;
|
||||
|
||||
RegCloseKey(hKey);
|
||||
@ -230,7 +230,7 @@ NTLM_CONTEXT *ntlm_ContextNew()
|
||||
return context;
|
||||
}
|
||||
|
||||
void ntlm_ContextFree(NTLM_CONTEXT *context)
|
||||
void ntlm_ContextFree(NTLM_CONTEXT* context)
|
||||
{
|
||||
if (!context)
|
||||
return;
|
||||
@ -247,12 +247,12 @@ void ntlm_ContextFree(NTLM_CONTEXT *context)
|
||||
free(context);
|
||||
}
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleW(SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage,
|
||||
ULONG fCredentialUse, void *pvLogonID, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn,
|
||||
void *pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleW(SEC_WCHAR* pszPrincipal, SEC_WCHAR* pszPackage,
|
||||
ULONG fCredentialUse, void* pvLogonID, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
|
||||
void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
|
||||
{
|
||||
SSPI_CREDENTIALS *credentials;
|
||||
SEC_WINNT_AUTH_IDENTITY *identity;
|
||||
SSPI_CREDENTIALS* credentials;
|
||||
SEC_WINNT_AUTH_IDENTITY* identity;
|
||||
|
||||
if ((fCredentialUse != SECPKG_CRED_OUTBOUND) &&
|
||||
(fCredentialUse != SECPKG_CRED_INBOUND) &&
|
||||
@ -269,22 +269,22 @@ SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleW(SEC_WCHAR *pszPrincipal
|
||||
credentials->fCredentialUse = fCredentialUse;
|
||||
credentials->pGetKeyFn = pGetKeyFn;
|
||||
credentials->pvGetKeyArgument = pvGetKeyArgument;
|
||||
identity = (SEC_WINNT_AUTH_IDENTITY *) pAuthData;
|
||||
identity = (SEC_WINNT_AUTH_IDENTITY*) pAuthData;
|
||||
|
||||
if (identity)
|
||||
sspi_CopyAuthIdentity(&(credentials->identity), identity);
|
||||
|
||||
sspi_SecureHandleSetLowerPointer(phCredential, (void *) credentials);
|
||||
sspi_SecureHandleSetUpperPointer(phCredential, (void *) NTLM_PACKAGE_NAME);
|
||||
sspi_SecureHandleSetLowerPointer(phCredential, (void*) credentials);
|
||||
sspi_SecureHandleSetUpperPointer(phCredential, (void*) NTLM_PACKAGE_NAME);
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleA(SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage,
|
||||
ULONG fCredentialUse, void *pvLogonID, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn,
|
||||
void *pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleA(SEC_CHAR* pszPrincipal, SEC_CHAR* pszPackage,
|
||||
ULONG fCredentialUse, void* pvLogonID, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
|
||||
void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
|
||||
{
|
||||
SSPI_CREDENTIALS *credentials;
|
||||
SEC_WINNT_AUTH_IDENTITY *identity;
|
||||
SSPI_CREDENTIALS* credentials;
|
||||
SEC_WINNT_AUTH_IDENTITY* identity;
|
||||
|
||||
if ((fCredentialUse != SECPKG_CRED_OUTBOUND) &&
|
||||
(fCredentialUse != SECPKG_CRED_INBOUND) &&
|
||||
@ -301,24 +301,24 @@ SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleA(SEC_CHAR *pszPrincipal,
|
||||
credentials->fCredentialUse = fCredentialUse;
|
||||
credentials->pGetKeyFn = pGetKeyFn;
|
||||
credentials->pvGetKeyArgument = pvGetKeyArgument;
|
||||
identity = (SEC_WINNT_AUTH_IDENTITY *) pAuthData;
|
||||
identity = (SEC_WINNT_AUTH_IDENTITY*) pAuthData;
|
||||
|
||||
if (identity)
|
||||
sspi_CopyAuthIdentity(&(credentials->identity), identity);
|
||||
|
||||
sspi_SecureHandleSetLowerPointer(phCredential, (void *) credentials);
|
||||
sspi_SecureHandleSetUpperPointer(phCredential, (void *) NTLM_PACKAGE_NAME);
|
||||
sspi_SecureHandleSetLowerPointer(phCredential, (void*) credentials);
|
||||
sspi_SecureHandleSetUpperPointer(phCredential, (void*) NTLM_PACKAGE_NAME);
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_FreeCredentialsHandle(PCredHandle phCredential)
|
||||
{
|
||||
SSPI_CREDENTIALS *credentials;
|
||||
SSPI_CREDENTIALS* credentials;
|
||||
|
||||
if (!phCredential)
|
||||
return SEC_E_INVALID_HANDLE;
|
||||
|
||||
credentials = (SSPI_CREDENTIALS *) sspi_SecureHandleGetLowerPointer(phCredential);
|
||||
credentials = (SSPI_CREDENTIALS*) sspi_SecureHandleGetLowerPointer(phCredential);
|
||||
|
||||
if (!credentials)
|
||||
return SEC_E_INVALID_HANDLE;
|
||||
@ -327,7 +327,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_FreeCredentialsHandle(PCredHandle phCredential)
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_QueryCredentialsAttributesW(PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_QueryCredentialsAttributesW(PCredHandle phCredential, ULONG ulAttribute, void* pBuffer)
|
||||
{
|
||||
if (ulAttribute == SECPKG_CRED_ATTR_NAMES)
|
||||
{
|
||||
@ -337,7 +337,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_QueryCredentialsAttributesW(PCredHandle phCredent
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_QueryCredentialsAttributesA(PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_QueryCredentialsAttributesA(PCredHandle phCredential, ULONG ulAttribute, void* pBuffer)
|
||||
{
|
||||
return ntlm_QueryCredentialsAttributesW(phCredential, ulAttribute, pBuffer);
|
||||
}
|
||||
@ -349,12 +349,12 @@ SECURITY_STATUS SEC_ENTRY ntlm_AcceptSecurityContext(PCredHandle phCredential, P
|
||||
PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext,
|
||||
PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsTimeStamp)
|
||||
{
|
||||
NTLM_CONTEXT *context;
|
||||
NTLM_CONTEXT* context;
|
||||
SECURITY_STATUS status;
|
||||
SSPI_CREDENTIALS *credentials;
|
||||
SSPI_CREDENTIALS* credentials;
|
||||
PSecBuffer input_buffer;
|
||||
PSecBuffer output_buffer;
|
||||
context = (NTLM_CONTEXT *) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
context = (NTLM_CONTEXT*) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
|
||||
if (!context)
|
||||
{
|
||||
@ -368,11 +368,11 @@ SECURITY_STATUS SEC_ENTRY ntlm_AcceptSecurityContext(PCredHandle phCredential, P
|
||||
if (fContextReq & ASC_REQ_CONFIDENTIALITY)
|
||||
context->confidentiality = TRUE;
|
||||
|
||||
credentials = (SSPI_CREDENTIALS *) sspi_SecureHandleGetLowerPointer(phCredential);
|
||||
credentials = (SSPI_CREDENTIALS*) sspi_SecureHandleGetLowerPointer(phCredential);
|
||||
context->credentials = credentials;
|
||||
ntlm_SetContextTargetName(context, NULL);
|
||||
sspi_SecureHandleSetLowerPointer(phNewContext, context);
|
||||
sspi_SecureHandleSetUpperPointer(phNewContext, (void *) NTLM_PACKAGE_NAME);
|
||||
sspi_SecureHandleSetUpperPointer(phNewContext, (void*) NTLM_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
if (context->state == NTLM_STATE_INITIAL)
|
||||
@ -457,17 +457,17 @@ SECURITY_STATUS SEC_ENTRY ntlm_ImpersonateSecurityContext(PCtxtHandle phContext)
|
||||
}
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(PCredHandle phCredential, PCtxtHandle phContext,
|
||||
SEC_WCHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
|
||||
SEC_WCHAR* pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
|
||||
PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
|
||||
PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
|
||||
{
|
||||
NTLM_CONTEXT *context;
|
||||
NTLM_CONTEXT* context;
|
||||
SECURITY_STATUS status;
|
||||
SSPI_CREDENTIALS *credentials;
|
||||
SSPI_CREDENTIALS* credentials;
|
||||
PSecBuffer input_buffer = NULL;
|
||||
PSecBuffer output_buffer = NULL;
|
||||
PSecBuffer channel_bindings = NULL;
|
||||
context = (NTLM_CONTEXT *) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
context = (NTLM_CONTEXT*) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
|
||||
if (!context)
|
||||
{
|
||||
@ -479,7 +479,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(PCredHandle phCredenti
|
||||
if (fContextReq & ISC_REQ_CONFIDENTIALITY)
|
||||
context->confidentiality = TRUE;
|
||||
|
||||
credentials = (SSPI_CREDENTIALS *) sspi_SecureHandleGetLowerPointer(phCredential);
|
||||
credentials = (SSPI_CREDENTIALS*) sspi_SecureHandleGetLowerPointer(phCredential);
|
||||
context->credentials = credentials;
|
||||
|
||||
if (context->Workstation.Length < 1)
|
||||
@ -492,7 +492,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(PCredHandle phCredenti
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
|
||||
sspi_SecureHandleSetLowerPointer(phNewContext, context);
|
||||
sspi_SecureHandleSetUpperPointer(phNewContext, (void *) NTLM_PACKAGE_NAME);
|
||||
sspi_SecureHandleSetUpperPointer(phNewContext, (void*) NTLM_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
if ((!pInput) || (context->state == NTLM_STATE_AUTHENTICATE))
|
||||
@ -537,7 +537,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(PCredHandle phCredenti
|
||||
if (channel_bindings)
|
||||
{
|
||||
context->Bindings.BindingsLength = channel_bindings->cbBuffer;
|
||||
context->Bindings.Bindings = (SEC_CHANNEL_BINDINGS *) channel_bindings->pvBuffer;
|
||||
context->Bindings.Bindings = (SEC_CHANNEL_BINDINGS*) channel_bindings->pvBuffer;
|
||||
}
|
||||
|
||||
if (context->state == NTLM_STATE_CHALLENGE)
|
||||
@ -572,12 +572,12 @@ SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW(PCredHandle phCredenti
|
||||
* @see http://msdn.microsoft.com/en-us/library/windows/desktop/aa375512%28v=vs.85%29.aspx
|
||||
*/
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextA(PCredHandle phCredential, PCtxtHandle phContext,
|
||||
SEC_CHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
|
||||
SEC_CHAR* pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
|
||||
PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
|
||||
PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
|
||||
{
|
||||
SECURITY_STATUS status;
|
||||
SEC_WCHAR *pszTargetNameW = NULL;
|
||||
SEC_WCHAR* pszTargetNameW = NULL;
|
||||
|
||||
if (pszTargetName)
|
||||
{
|
||||
@ -596,9 +596,9 @@ SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextA(PCredHandle phCredenti
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_CompleteAuthToken(PCtxtHandle phContext, PSecBufferDesc pToken)
|
||||
{
|
||||
NTLM_CONTEXT *context;
|
||||
NTLM_CONTEXT* context;
|
||||
SECURITY_STATUS status = SEC_E_OK;
|
||||
context = (NTLM_CONTEXT *) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
context = (NTLM_CONTEXT*) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
|
||||
if (!context)
|
||||
return SEC_E_INVALID_HANDLE;
|
||||
@ -615,8 +615,8 @@ SECURITY_STATUS SEC_ENTRY ntlm_CompleteAuthToken(PCtxtHandle phContext, PSecBuff
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_DeleteSecurityContext(PCtxtHandle phContext)
|
||||
{
|
||||
NTLM_CONTEXT *context;
|
||||
context = (NTLM_CONTEXT *) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
NTLM_CONTEXT* context;
|
||||
context = (NTLM_CONTEXT*) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
|
||||
if (!context)
|
||||
return SEC_E_INVALID_HANDLE;
|
||||
@ -627,9 +627,9 @@ SECURITY_STATUS SEC_ENTRY ntlm_DeleteSecurityContext(PCtxtHandle phContext)
|
||||
|
||||
/* http://msdn.microsoft.com/en-us/library/windows/desktop/aa379337/ */
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer)
|
||||
{
|
||||
NTLM_CONTEXT *context;
|
||||
NTLM_CONTEXT* context;
|
||||
|
||||
if (!phContext)
|
||||
return SEC_E_INVALID_HANDLE;
|
||||
@ -637,11 +637,11 @@ SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesW(PCtxtHandle phContext, UL
|
||||
if (!pBuffer)
|
||||
return SEC_E_INSUFFICIENT_MEMORY;
|
||||
|
||||
context = (NTLM_CONTEXT *) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
context = (NTLM_CONTEXT*) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
|
||||
if (ulAttribute == SECPKG_ATTR_SIZES)
|
||||
{
|
||||
SecPkgContext_Sizes *ContextSizes = (SecPkgContext_Sizes *) pBuffer;
|
||||
SecPkgContext_Sizes* ContextSizes = (SecPkgContext_Sizes*) pBuffer;
|
||||
ContextSizes->cbMaxToken = 2010;
|
||||
ContextSizes->cbMaxSignature = 16;
|
||||
ContextSizes->cbBlockSize = 0;
|
||||
@ -651,15 +651,15 @@ SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesW(PCtxtHandle phContext, UL
|
||||
else if (ulAttribute == SECPKG_ATTR_AUTH_IDENTITY)
|
||||
{
|
||||
int status;
|
||||
char *UserA = NULL;
|
||||
char *DomainA = NULL;
|
||||
SSPI_CREDENTIALS *credentials;
|
||||
SecPkgContext_AuthIdentity *AuthIdentity = (SecPkgContext_AuthIdentity *) pBuffer;
|
||||
char* UserA = NULL;
|
||||
char* DomainA = NULL;
|
||||
SSPI_CREDENTIALS* credentials;
|
||||
SecPkgContext_AuthIdentity* AuthIdentity = (SecPkgContext_AuthIdentity*) pBuffer;
|
||||
context->UseSamFileDatabase = FALSE;
|
||||
credentials = context->credentials;
|
||||
ZeroMemory(AuthIdentity, sizeof(SecPkgContext_AuthIdentity));
|
||||
UserA = AuthIdentity->User;
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR *) credentials->identity.User,
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) credentials->identity.User,
|
||||
credentials->identity.UserLength,
|
||||
&UserA, 256, NULL, NULL);
|
||||
|
||||
@ -667,7 +667,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesW(PCtxtHandle phContext, UL
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
|
||||
DomainA = AuthIdentity->Domain;
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR *) credentials->identity.Domain,
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) credentials->identity.Domain,
|
||||
credentials->identity.DomainLength,
|
||||
&DomainA, 256, NULL, NULL);
|
||||
|
||||
@ -680,14 +680,14 @@ SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesW(PCtxtHandle phContext, UL
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_QueryContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer)
|
||||
{
|
||||
return ntlm_QueryContextAttributesW(phContext, ulAttribute, pBuffer);
|
||||
}
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer, ULONG cbBuffer)
|
||||
{
|
||||
NTLM_CONTEXT *context;
|
||||
NTLM_CONTEXT* context;
|
||||
|
||||
if (!phContext)
|
||||
return SEC_E_INVALID_HANDLE;
|
||||
@ -695,11 +695,11 @@ SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesW(PCtxtHandle phContext, ULON
|
||||
if (!pBuffer)
|
||||
return SEC_E_INVALID_PARAMETER;
|
||||
|
||||
context = (NTLM_CONTEXT *) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
context = (NTLM_CONTEXT*) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
|
||||
if (ulAttribute == SECPKG_ATTR_AUTH_NTLM_HASH)
|
||||
{
|
||||
SecPkgContext_AuthNtlmHash *AuthNtlmHash = (SecPkgContext_AuthNtlmHash *) pBuffer;
|
||||
SecPkgContext_AuthNtlmHash* AuthNtlmHash = (SecPkgContext_AuthNtlmHash*) pBuffer;
|
||||
|
||||
if (cbBuffer < sizeof(SecPkgContext_AuthNtlmHash))
|
||||
return SEC_E_INVALID_PARAMETER;
|
||||
@ -713,7 +713,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesW(PCtxtHandle phContext, ULON
|
||||
}
|
||||
else if (ulAttribute == SECPKG_ATTR_AUTH_NTLM_MESSAGE)
|
||||
{
|
||||
SecPkgContext_AuthNtlmMessage *AuthNtlmMessage = (SecPkgContext_AuthNtlmMessage *) pBuffer;
|
||||
SecPkgContext_AuthNtlmMessage* AuthNtlmMessage = (SecPkgContext_AuthNtlmMessage*) pBuffer;
|
||||
|
||||
if (cbBuffer < sizeof(SecPkgContext_AuthNtlmMessage))
|
||||
return SEC_E_INVALID_PARAMETER;
|
||||
@ -741,7 +741,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesW(PCtxtHandle phContext, ULON
|
||||
}
|
||||
else if (ulAttribute == SECPKG_ATTR_AUTH_NTLM_TIMESTAMP)
|
||||
{
|
||||
SecPkgContext_AuthNtlmTimestamp *AuthNtlmTimestamp = (SecPkgContext_AuthNtlmTimestamp *) pBuffer;
|
||||
SecPkgContext_AuthNtlmTimestamp* AuthNtlmTimestamp = (SecPkgContext_AuthNtlmTimestamp*) pBuffer;
|
||||
|
||||
if (cbBuffer < sizeof(SecPkgContext_AuthNtlmTimestamp))
|
||||
return SEC_E_INVALID_PARAMETER;
|
||||
@ -755,7 +755,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesW(PCtxtHandle phContext, ULON
|
||||
}
|
||||
else if (ulAttribute == SECPKG_ATTR_AUTH_NTLM_CLIENT_CHALLENGE)
|
||||
{
|
||||
SecPkgContext_AuthNtlmClientChallenge *AuthNtlmClientChallenge = (SecPkgContext_AuthNtlmClientChallenge *) pBuffer;
|
||||
SecPkgContext_AuthNtlmClientChallenge* AuthNtlmClientChallenge = (SecPkgContext_AuthNtlmClientChallenge*) pBuffer;
|
||||
|
||||
if (cbBuffer < sizeof(SecPkgContext_AuthNtlmClientChallenge))
|
||||
return SEC_E_INVALID_PARAMETER;
|
||||
@ -765,7 +765,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesW(PCtxtHandle phContext, ULON
|
||||
}
|
||||
else if (ulAttribute == SECPKG_ATTR_AUTH_NTLM_SERVER_CHALLENGE)
|
||||
{
|
||||
SecPkgContext_AuthNtlmServerChallenge *AuthNtlmServerChallenge = (SecPkgContext_AuthNtlmServerChallenge *) pBuffer;
|
||||
SecPkgContext_AuthNtlmServerChallenge* AuthNtlmServerChallenge = (SecPkgContext_AuthNtlmServerChallenge*) pBuffer;
|
||||
|
||||
if (cbBuffer < sizeof(SecPkgContext_AuthNtlmServerChallenge))
|
||||
return SEC_E_INVALID_PARAMETER;
|
||||
@ -777,7 +777,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesW(PCtxtHandle phContext, ULON
|
||||
return SEC_E_UNSUPPORTED_FUNCTION;
|
||||
}
|
||||
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
|
||||
SECURITY_STATUS SEC_ENTRY ntlm_SetContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void* pBuffer, ULONG cbBuffer)
|
||||
{
|
||||
return ntlm_SetContextAttributesW(phContext, ulAttribute, pBuffer, cbBuffer);
|
||||
}
|
||||
@ -791,18 +791,18 @@ SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
|
||||
{
|
||||
int index;
|
||||
int length;
|
||||
void *data;
|
||||
void* data;
|
||||
UINT32 SeqNo;
|
||||
HMAC_CTX hmac;
|
||||
BYTE digest[16];
|
||||
BYTE checksum[8];
|
||||
BYTE *signature;
|
||||
BYTE* signature;
|
||||
ULONG version = 1;
|
||||
NTLM_CONTEXT *context;
|
||||
NTLM_CONTEXT* context;
|
||||
PSecBuffer data_buffer = NULL;
|
||||
PSecBuffer signature_buffer = NULL;
|
||||
SeqNo = MessageSeqNo;
|
||||
context = (NTLM_CONTEXT *) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
context = (NTLM_CONTEXT*) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
|
||||
for (index = 0; index < (int) pMessage->cBuffers; index++)
|
||||
{
|
||||
@ -829,15 +829,15 @@ SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
|
||||
/* Compute the HMAC-MD5 hash of ConcatenationOf(seq_num,data) using the client signing key */
|
||||
HMAC_CTX_init(&hmac);
|
||||
HMAC_Init_ex(&hmac, context->SendSigningKey, 16, EVP_md5(), NULL);
|
||||
HMAC_Update(&hmac, (void *) &(SeqNo), 4);
|
||||
HMAC_Update(&hmac, (void *) data, length);
|
||||
HMAC_Update(&hmac, (void*) &(SeqNo), 4);
|
||||
HMAC_Update(&hmac, (void*) data, length);
|
||||
HMAC_Final(&hmac, digest, NULL);
|
||||
HMAC_CTX_cleanup(&hmac);
|
||||
|
||||
/* Encrypt message using with RC4, result overwrites original buffer */
|
||||
|
||||
if (context->confidentiality)
|
||||
RC4(&context->SendRc4Seal, length, (BYTE *) data, (BYTE *) data_buffer->pvBuffer);
|
||||
RC4(&context->SendRc4Seal, length, (BYTE*) data, (BYTE*) data_buffer->pvBuffer);
|
||||
else
|
||||
CopyMemory(data_buffer->pvBuffer, data, length);
|
||||
|
||||
@ -850,11 +850,11 @@ SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
|
||||
free(data);
|
||||
/* RC4-encrypt first 8 bytes of digest */
|
||||
RC4(&context->SendRc4Seal, 8, digest, checksum);
|
||||
signature = (BYTE *) signature_buffer->pvBuffer;
|
||||
signature = (BYTE*) signature_buffer->pvBuffer;
|
||||
/* Concatenate version, ciphertext and sequence number to build signature */
|
||||
CopyMemory(signature, (void *) &version, 4);
|
||||
CopyMemory(&signature[4], (void *) checksum, 8);
|
||||
CopyMemory(&signature[12], (void *) &(SeqNo), 4);
|
||||
CopyMemory(signature, (void*) &version, 4);
|
||||
CopyMemory(&signature[4], (void*) checksum, 8);
|
||||
CopyMemory(&signature[12], (void*) &(SeqNo), 4);
|
||||
context->SendSeqNum++;
|
||||
#ifdef WITH_DEBUG_NTLM
|
||||
WLog_DBG(TAG, "Signature (length = %d)", (int) signature_buffer->cbBuffer);
|
||||
@ -867,18 +867,18 @@ SECURITY_STATUS SEC_ENTRY ntlm_DecryptMessage(PCtxtHandle phContext, PSecBufferD
|
||||
{
|
||||
int index;
|
||||
int length;
|
||||
void *data;
|
||||
void* data;
|
||||
UINT32 SeqNo;
|
||||
HMAC_CTX hmac;
|
||||
BYTE digest[16];
|
||||
BYTE checksum[8];
|
||||
UINT32 version = 1;
|
||||
NTLM_CONTEXT *context;
|
||||
NTLM_CONTEXT* context;
|
||||
BYTE expected_signature[16];
|
||||
PSecBuffer data_buffer = NULL;
|
||||
PSecBuffer signature_buffer = NULL;
|
||||
SeqNo = (UINT32) MessageSeqNo;
|
||||
context = (NTLM_CONTEXT *) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
context = (NTLM_CONTEXT*) sspi_SecureHandleGetLowerPointer(phContext);
|
||||
|
||||
for (index = 0; index < (int) pMessage->cBuffers; index++)
|
||||
{
|
||||
@ -906,15 +906,15 @@ SECURITY_STATUS SEC_ENTRY ntlm_DecryptMessage(PCtxtHandle phContext, PSecBufferD
|
||||
/* Decrypt message using with RC4, result overwrites original buffer */
|
||||
|
||||
if (context->confidentiality)
|
||||
RC4(&context->RecvRc4Seal, length, (BYTE *) data, (BYTE *) data_buffer->pvBuffer);
|
||||
RC4(&context->RecvRc4Seal, length, (BYTE*) data, (BYTE*) data_buffer->pvBuffer);
|
||||
else
|
||||
CopyMemory(data_buffer->pvBuffer, data, length);
|
||||
|
||||
/* Compute the HMAC-MD5 hash of ConcatenationOf(seq_num,data) using the client signing key */
|
||||
HMAC_CTX_init(&hmac);
|
||||
HMAC_Init_ex(&hmac, context->RecvSigningKey, 16, EVP_md5(), NULL);
|
||||
HMAC_Update(&hmac, (void *) &(SeqNo), 4);
|
||||
HMAC_Update(&hmac, (void *) data_buffer->pvBuffer, data_buffer->cbBuffer);
|
||||
HMAC_Update(&hmac, (void*) &(SeqNo), 4);
|
||||
HMAC_Update(&hmac, (void*) data_buffer->pvBuffer, data_buffer->cbBuffer);
|
||||
HMAC_Final(&hmac, digest, NULL);
|
||||
HMAC_CTX_cleanup(&hmac);
|
||||
#ifdef WITH_DEBUG_NTLM
|
||||
@ -927,9 +927,9 @@ SECURITY_STATUS SEC_ENTRY ntlm_DecryptMessage(PCtxtHandle phContext, PSecBufferD
|
||||
/* RC4-encrypt first 8 bytes of digest */
|
||||
RC4(&context->RecvRc4Seal, 8, digest, checksum);
|
||||
/* Concatenate version, ciphertext and sequence number to build signature */
|
||||
CopyMemory(expected_signature, (void *) &version, 4);
|
||||
CopyMemory(&expected_signature[4], (void *) checksum, 8);
|
||||
CopyMemory(&expected_signature[12], (void *) &(SeqNo), 4);
|
||||
CopyMemory(expected_signature, (void*) &version, 4);
|
||||
CopyMemory(&expected_signature[4], (void*) checksum, 8);
|
||||
CopyMemory(&expected_signature[12], (void*) &(SeqNo), 4);
|
||||
context->RecvSeqNum++;
|
||||
|
||||
if (memcmp(signature_buffer->pvBuffer, expected_signature, 16) != 0)
|
||||
@ -939,7 +939,7 @@ SECURITY_STATUS SEC_ENTRY ntlm_DecryptMessage(PCtxtHandle phContext, PSecBufferD
|
||||
WLog_ERR(TAG, "Expected Signature:");
|
||||
winpr_HexDump(TAG, WLOG_ERROR, expected_signature, 16);
|
||||
WLog_ERR(TAG, "Actual Signature:");
|
||||
winpr_HexDump(TAG, WLOG_ERROR, (BYTE *) signature_buffer->pvBuffer, 16);
|
||||
winpr_HexDump(TAG, WLOG_ERROR, (BYTE*) signature_buffer->pvBuffer, 16);
|
||||
return SEC_E_MESSAGE_ALTERED;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "../../log.h"
|
||||
#define TAG WINPR_TAG("sspi.NTLM")
|
||||
|
||||
const char *const AV_PAIR_STRINGS[] =
|
||||
const char* const AV_PAIR_STRINGS[] =
|
||||
{
|
||||
"MsvAvEOL",
|
||||
"MsvAvNbComputerName",
|
||||
@ -50,17 +50,17 @@ const char *const AV_PAIR_STRINGS[] =
|
||||
"MsvChannelBindings"
|
||||
};
|
||||
|
||||
void ntlm_av_pair_list_init(NTLM_AV_PAIR *pAvPairList)
|
||||
void ntlm_av_pair_list_init(NTLM_AV_PAIR* pAvPairList)
|
||||
{
|
||||
NTLM_AV_PAIR *pAvPair = pAvPairList;
|
||||
NTLM_AV_PAIR* pAvPair = pAvPairList;
|
||||
pAvPair->AvId = MsvAvEOL;
|
||||
pAvPair->AvLen = 0;
|
||||
}
|
||||
|
||||
ULONG ntlm_av_pair_list_length(NTLM_AV_PAIR *pAvPairList)
|
||||
ULONG ntlm_av_pair_list_length(NTLM_AV_PAIR* pAvPairList)
|
||||
{
|
||||
ULONG length;
|
||||
NTLM_AV_PAIR *pAvPair = pAvPairList;
|
||||
NTLM_AV_PAIR* pAvPair = pAvPairList;
|
||||
|
||||
if (!pAvPair)
|
||||
return 0;
|
||||
@ -74,9 +74,9 @@ ULONG ntlm_av_pair_list_length(NTLM_AV_PAIR *pAvPairList)
|
||||
return length;
|
||||
}
|
||||
|
||||
void ntlm_print_av_pair_list(NTLM_AV_PAIR *pAvPairList)
|
||||
void ntlm_print_av_pair_list(NTLM_AV_PAIR* pAvPairList)
|
||||
{
|
||||
NTLM_AV_PAIR *pAvPair = pAvPairList;
|
||||
NTLM_AV_PAIR* pAvPair = pAvPairList;
|
||||
|
||||
if (!pAvPair)
|
||||
return;
|
||||
@ -99,24 +99,24 @@ ULONG ntlm_av_pair_list_size(ULONG AvPairsCount, ULONG AvPairsValueLength)
|
||||
return ((AvPairsCount + 1) * 4) + AvPairsValueLength;
|
||||
}
|
||||
|
||||
PBYTE ntlm_av_pair_get_value_pointer(NTLM_AV_PAIR *pAvPair)
|
||||
PBYTE ntlm_av_pair_get_value_pointer(NTLM_AV_PAIR* pAvPair)
|
||||
{
|
||||
return &((PBYTE) pAvPair)[sizeof(NTLM_AV_PAIR)];
|
||||
}
|
||||
|
||||
int ntlm_av_pair_get_next_offset(NTLM_AV_PAIR *pAvPair)
|
||||
int ntlm_av_pair_get_next_offset(NTLM_AV_PAIR* pAvPair)
|
||||
{
|
||||
return pAvPair->AvLen + sizeof(NTLM_AV_PAIR);
|
||||
}
|
||||
|
||||
NTLM_AV_PAIR *ntlm_av_pair_get_next_pointer(NTLM_AV_PAIR *pAvPair)
|
||||
NTLM_AV_PAIR* ntlm_av_pair_get_next_pointer(NTLM_AV_PAIR* pAvPair)
|
||||
{
|
||||
return (NTLM_AV_PAIR *)((PBYTE) pAvPair + ntlm_av_pair_get_next_offset(pAvPair));
|
||||
return (NTLM_AV_PAIR*)((PBYTE) pAvPair + ntlm_av_pair_get_next_offset(pAvPair));
|
||||
}
|
||||
|
||||
NTLM_AV_PAIR *ntlm_av_pair_get(NTLM_AV_PAIR *pAvPairList, NTLM_AV_ID AvId)
|
||||
NTLM_AV_PAIR* ntlm_av_pair_get(NTLM_AV_PAIR* pAvPairList, NTLM_AV_ID AvId)
|
||||
{
|
||||
NTLM_AV_PAIR *pAvPair = pAvPairList;
|
||||
NTLM_AV_PAIR* pAvPair = pAvPairList;
|
||||
|
||||
if (!pAvPair)
|
||||
return NULL;
|
||||
@ -135,9 +135,9 @@ NTLM_AV_PAIR *ntlm_av_pair_get(NTLM_AV_PAIR *pAvPairList, NTLM_AV_ID AvId)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NTLM_AV_PAIR *ntlm_av_pair_add(NTLM_AV_PAIR *pAvPairList, NTLM_AV_ID AvId, PBYTE Value, UINT16 AvLen)
|
||||
NTLM_AV_PAIR* ntlm_av_pair_add(NTLM_AV_PAIR* pAvPairList, NTLM_AV_ID AvId, PBYTE Value, UINT16 AvLen)
|
||||
{
|
||||
NTLM_AV_PAIR *pAvPair;
|
||||
NTLM_AV_PAIR* pAvPair;
|
||||
pAvPair = ntlm_av_pair_get(pAvPairList, MsvAvEOL);
|
||||
|
||||
if (!pAvPair)
|
||||
@ -149,9 +149,9 @@ NTLM_AV_PAIR *ntlm_av_pair_add(NTLM_AV_PAIR *pAvPairList, NTLM_AV_ID AvId, PBYTE
|
||||
return pAvPair;
|
||||
}
|
||||
|
||||
NTLM_AV_PAIR *ntlm_av_pair_add_copy(NTLM_AV_PAIR *pAvPairList, NTLM_AV_PAIR *pAvPair)
|
||||
NTLM_AV_PAIR* ntlm_av_pair_add_copy(NTLM_AV_PAIR* pAvPairList, NTLM_AV_PAIR* pAvPair)
|
||||
{
|
||||
NTLM_AV_PAIR *pAvPairCopy;
|
||||
NTLM_AV_PAIR* pAvPairCopy;
|
||||
pAvPairCopy = ntlm_av_pair_get(pAvPairList, MsvAvEOL);
|
||||
|
||||
if (!pAvPairCopy)
|
||||
@ -166,11 +166,11 @@ NTLM_AV_PAIR *ntlm_av_pair_add_copy(NTLM_AV_PAIR *pAvPairList, NTLM_AV_PAIR *pAv
|
||||
|
||||
int ntlm_get_target_computer_name(PUNICODE_STRING pName, COMPUTER_NAME_FORMAT type)
|
||||
{
|
||||
char *name;
|
||||
char* name;
|
||||
int status;
|
||||
DWORD nSize = 0;
|
||||
GetComputerNameExA(type, NULL, &nSize);
|
||||
name = (char *) malloc(nSize);
|
||||
name = (char*) malloc(nSize);
|
||||
|
||||
if (!name)
|
||||
return -1;
|
||||
@ -236,7 +236,7 @@ typedef struct gss_channel_bindings_struct {
|
||||
} *gss_channel_bindings_t;
|
||||
*/
|
||||
|
||||
static void ntlm_md5_update_uint32_be(MD5_CTX *md5, UINT32 num)
|
||||
static void ntlm_md5_update_uint32_be(MD5_CTX* md5, UINT32 num)
|
||||
{
|
||||
BYTE be32[4];
|
||||
be32[0] = (num >> 0) & 0xFF;
|
||||
@ -246,12 +246,12 @@ static void ntlm_md5_update_uint32_be(MD5_CTX *md5, UINT32 num)
|
||||
MD5_Update(md5, be32, 4);
|
||||
}
|
||||
|
||||
void ntlm_compute_channel_bindings(NTLM_CONTEXT *context)
|
||||
void ntlm_compute_channel_bindings(NTLM_CONTEXT* context)
|
||||
{
|
||||
MD5_CTX md5;
|
||||
BYTE *ChannelBindingToken;
|
||||
BYTE* ChannelBindingToken;
|
||||
UINT32 ChannelBindingTokenLength;
|
||||
SEC_CHANNEL_BINDINGS *ChannelBindings;
|
||||
SEC_CHANNEL_BINDINGS* ChannelBindings;
|
||||
ZeroMemory(context->ChannelBindingsHash, 16);
|
||||
ChannelBindings = context->Bindings.Bindings;
|
||||
|
||||
@ -259,18 +259,18 @@ void ntlm_compute_channel_bindings(NTLM_CONTEXT *context)
|
||||
return;
|
||||
|
||||
ChannelBindingTokenLength = context->Bindings.BindingsLength - sizeof(SEC_CHANNEL_BINDINGS);
|
||||
ChannelBindingToken = &((BYTE *) ChannelBindings)[ChannelBindings->dwApplicationDataOffset];
|
||||
ChannelBindingToken = &((BYTE*) ChannelBindings)[ChannelBindings->dwApplicationDataOffset];
|
||||
MD5_Init(&md5);
|
||||
ntlm_md5_update_uint32_be(&md5, ChannelBindings->dwInitiatorAddrType);
|
||||
ntlm_md5_update_uint32_be(&md5, ChannelBindings->cbInitiatorLength);
|
||||
ntlm_md5_update_uint32_be(&md5, ChannelBindings->dwAcceptorAddrType);
|
||||
ntlm_md5_update_uint32_be(&md5, ChannelBindings->cbAcceptorLength);
|
||||
ntlm_md5_update_uint32_be(&md5, ChannelBindings->cbApplicationDataLength);
|
||||
MD5_Update(&md5, (void *) ChannelBindingToken, ChannelBindingTokenLength);
|
||||
MD5_Update(&md5, (void*) ChannelBindingToken, ChannelBindingTokenLength);
|
||||
MD5_Final(context->ChannelBindingsHash, &md5);
|
||||
}
|
||||
|
||||
void ntlm_compute_single_host_data(NTLM_CONTEXT *context)
|
||||
void ntlm_compute_single_host_data(NTLM_CONTEXT* context)
|
||||
{
|
||||
/**
|
||||
* The Single_Host_Data structure allows a client to send machine-specific information
|
||||
@ -287,13 +287,13 @@ void ntlm_compute_single_host_data(NTLM_CONTEXT *context)
|
||||
FillMemory(context->SingleHostData.MachineID, 32, 0xAA);
|
||||
}
|
||||
|
||||
int ntlm_construct_challenge_target_info(NTLM_CONTEXT *context)
|
||||
int ntlm_construct_challenge_target_info(NTLM_CONTEXT* context)
|
||||
{
|
||||
int length;
|
||||
ULONG AvPairsCount;
|
||||
ULONG AvPairsLength;
|
||||
LONG AvPairListSize;
|
||||
NTLM_AV_PAIR *pAvPairList;
|
||||
NTLM_AV_PAIR* pAvPairList;
|
||||
UNICODE_STRING NbDomainName;
|
||||
UNICODE_STRING NbComputerName;
|
||||
UNICODE_STRING DnsDomainName;
|
||||
@ -326,7 +326,7 @@ int ntlm_construct_challenge_target_info(NTLM_CONTEXT *context)
|
||||
if (!sspi_SecBufferAlloc(&context->ChallengeTargetInfo, length))
|
||||
return -1;
|
||||
|
||||
pAvPairList = (NTLM_AV_PAIR *) context->ChallengeTargetInfo.pvBuffer;
|
||||
pAvPairList = (NTLM_AV_PAIR*) context->ChallengeTargetInfo.pvBuffer;
|
||||
AvPairListSize = (ULONG) context->ChallengeTargetInfo.cbBuffer;
|
||||
ntlm_av_pair_list_init(pAvPairList);
|
||||
ntlm_av_pair_add(pAvPairList, MsvAvNbDomainName, (PBYTE) NbDomainName.Buffer, NbDomainName.Length);
|
||||
@ -341,22 +341,22 @@ int ntlm_construct_challenge_target_info(NTLM_CONTEXT *context)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ntlm_construct_authenticate_target_info(NTLM_CONTEXT *context)
|
||||
int ntlm_construct_authenticate_target_info(NTLM_CONTEXT* context)
|
||||
{
|
||||
ULONG size;
|
||||
ULONG AvPairsCount;
|
||||
ULONG AvPairsValueLength;
|
||||
NTLM_AV_PAIR *AvTimestamp;
|
||||
NTLM_AV_PAIR *AvNbDomainName;
|
||||
NTLM_AV_PAIR *AvNbComputerName;
|
||||
NTLM_AV_PAIR *AvDnsDomainName;
|
||||
NTLM_AV_PAIR *AvDnsComputerName;
|
||||
NTLM_AV_PAIR *AvDnsTreeName;
|
||||
NTLM_AV_PAIR *ChallengeTargetInfo;
|
||||
NTLM_AV_PAIR *AuthenticateTargetInfo;
|
||||
NTLM_AV_PAIR* AvTimestamp;
|
||||
NTLM_AV_PAIR* AvNbDomainName;
|
||||
NTLM_AV_PAIR* AvNbComputerName;
|
||||
NTLM_AV_PAIR* AvDnsDomainName;
|
||||
NTLM_AV_PAIR* AvDnsComputerName;
|
||||
NTLM_AV_PAIR* AvDnsTreeName;
|
||||
NTLM_AV_PAIR* ChallengeTargetInfo;
|
||||
NTLM_AV_PAIR* AuthenticateTargetInfo;
|
||||
AvPairsCount = 1;
|
||||
AvPairsValueLength = 0;
|
||||
ChallengeTargetInfo = (NTLM_AV_PAIR *) context->ChallengeTargetInfo.pvBuffer;
|
||||
ChallengeTargetInfo = (NTLM_AV_PAIR*) context->ChallengeTargetInfo.pvBuffer;
|
||||
AvNbDomainName = ntlm_av_pair_get(ChallengeTargetInfo, MsvAvNbDomainName);
|
||||
AvNbComputerName = ntlm_av_pair_get(ChallengeTargetInfo, MsvAvNbComputerName);
|
||||
AvDnsDomainName = ntlm_av_pair_get(ChallengeTargetInfo, MsvAvDnsDomainName);
|
||||
@ -438,7 +438,7 @@ int ntlm_construct_authenticate_target_info(NTLM_CONTEXT *context)
|
||||
size += 8; /* unknown 8-byte padding */
|
||||
|
||||
sspi_SecBufferAlloc(&context->AuthenticateTargetInfo, size);
|
||||
AuthenticateTargetInfo = (NTLM_AV_PAIR *) context->AuthenticateTargetInfo.pvBuffer;
|
||||
AuthenticateTargetInfo = (NTLM_AV_PAIR*) context->AuthenticateTargetInfo.pvBuffer;
|
||||
ntlm_av_pair_list_init(AuthenticateTargetInfo);
|
||||
|
||||
if (AvNbDomainName)
|
||||
@ -485,9 +485,9 @@ int ntlm_construct_authenticate_target_info(NTLM_CONTEXT *context)
|
||||
|
||||
if (context->NTLMv2)
|
||||
{
|
||||
NTLM_AV_PAIR *AvEOL;
|
||||
NTLM_AV_PAIR* AvEOL;
|
||||
AvEOL = ntlm_av_pair_get(ChallengeTargetInfo, MsvAvEOL);
|
||||
ZeroMemory((void *) AvEOL, 4);
|
||||
ZeroMemory((void*) AvEOL, 4);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -51,7 +51,7 @@ static const BYTE NTLM_NULL_BUFFER[16] =
|
||||
* @param s
|
||||
*/
|
||||
|
||||
void ntlm_get_version_info(NTLM_VERSION_INFO *versionInfo)
|
||||
void ntlm_get_version_info(NTLM_VERSION_INFO* versionInfo)
|
||||
{
|
||||
OSVERSIONINFOA osVersionInfo;
|
||||
osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
|
||||
@ -69,7 +69,7 @@ void ntlm_get_version_info(NTLM_VERSION_INFO *versionInfo)
|
||||
* @param s
|
||||
*/
|
||||
|
||||
int ntlm_read_version_info(wStream *s, NTLM_VERSION_INFO *versionInfo)
|
||||
int ntlm_read_version_info(wStream* s, NTLM_VERSION_INFO* versionInfo)
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return -1;
|
||||
@ -88,7 +88,7 @@ int ntlm_read_version_info(wStream *s, NTLM_VERSION_INFO *versionInfo)
|
||||
* @param s
|
||||
*/
|
||||
|
||||
void ntlm_write_version_info(wStream *s, NTLM_VERSION_INFO *versionInfo)
|
||||
void ntlm_write_version_info(wStream* s, NTLM_VERSION_INFO* versionInfo)
|
||||
{
|
||||
Stream_Write_UINT8(s, versionInfo->ProductMajorVersion); /* ProductMajorVersion (1 byte) */
|
||||
Stream_Write_UINT8(s, versionInfo->ProductMinorVersion); /* ProductMinorVersion (1 byte) */
|
||||
@ -103,7 +103,7 @@ void ntlm_write_version_info(wStream *s, NTLM_VERSION_INFO *versionInfo)
|
||||
* @param s
|
||||
*/
|
||||
|
||||
void ntlm_print_version_info(NTLM_VERSION_INFO *versionInfo)
|
||||
void ntlm_print_version_info(NTLM_VERSION_INFO* versionInfo)
|
||||
{
|
||||
WLog_INFO(TAG, "VERSION ={");
|
||||
WLog_INFO(TAG, "\tProductMajorVersion: %d", versionInfo->ProductMajorVersion);
|
||||
@ -114,7 +114,7 @@ void ntlm_print_version_info(NTLM_VERSION_INFO *versionInfo)
|
||||
WLog_INFO(TAG, "\tNTLMRevisionCurrent: 0x%02X", versionInfo->NTLMRevisionCurrent);
|
||||
}
|
||||
|
||||
int ntlm_read_ntlm_v2_client_challenge(wStream *s, NTLMv2_CLIENT_CHALLENGE *challenge)
|
||||
int ntlm_read_ntlm_v2_client_challenge(wStream* s, NTLMv2_CLIENT_CHALLENGE* challenge)
|
||||
{
|
||||
size_t size;
|
||||
Stream_Read_UINT8(s, challenge->RespType);
|
||||
@ -125,7 +125,7 @@ int ntlm_read_ntlm_v2_client_challenge(wStream *s, NTLMv2_CLIENT_CHALLENGE *chal
|
||||
Stream_Read(s, challenge->ClientChallenge, 8);
|
||||
Stream_Read_UINT32(s, challenge->Reserved3);
|
||||
size = Stream_Length(s) - Stream_GetPosition(s);
|
||||
challenge->AvPairs = (NTLM_AV_PAIR *) malloc(size);
|
||||
challenge->AvPairs = (NTLM_AV_PAIR*) malloc(size);
|
||||
|
||||
if (!challenge->AvPairs)
|
||||
return -1;
|
||||
@ -134,7 +134,7 @@ int ntlm_read_ntlm_v2_client_challenge(wStream *s, NTLMv2_CLIENT_CHALLENGE *chal
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ntlm_write_ntlm_v2_client_challenge(wStream *s, NTLMv2_CLIENT_CHALLENGE *challenge)
|
||||
int ntlm_write_ntlm_v2_client_challenge(wStream* s, NTLMv2_CLIENT_CHALLENGE* challenge)
|
||||
{
|
||||
ULONG length;
|
||||
Stream_Write_UINT8(s, challenge->RespType);
|
||||
@ -149,13 +149,13 @@ int ntlm_write_ntlm_v2_client_challenge(wStream *s, NTLMv2_CLIENT_CHALLENGE *cha
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ntlm_read_ntlm_v2_response(wStream *s, NTLMv2_RESPONSE *response)
|
||||
int ntlm_read_ntlm_v2_response(wStream* s, NTLMv2_RESPONSE* response)
|
||||
{
|
||||
Stream_Read(s, response->Response, 16);
|
||||
return ntlm_read_ntlm_v2_client_challenge(s, &(response->Challenge));
|
||||
}
|
||||
|
||||
int ntlm_write_ntlm_v2_response(wStream *s, NTLMv2_RESPONSE *response)
|
||||
int ntlm_write_ntlm_v2_response(wStream* s, NTLMv2_RESPONSE* response)
|
||||
{
|
||||
Stream_Write(s, response->Response, 16);
|
||||
return ntlm_write_ntlm_v2_client_challenge(s, &(response->Challenge));
|
||||
@ -166,7 +166,7 @@ int ntlm_write_ntlm_v2_response(wStream *s, NTLMv2_RESPONSE *response)
|
||||
* @param[out] timestamp 64-bit little-endian timestamp
|
||||
*/
|
||||
|
||||
void ntlm_current_time(BYTE *timestamp)
|
||||
void ntlm_current_time(BYTE* timestamp)
|
||||
{
|
||||
FILETIME filetime;
|
||||
ULARGE_INTEGER time64;
|
||||
@ -181,7 +181,7 @@ void ntlm_current_time(BYTE *timestamp)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_generate_timestamp(NTLM_CONTEXT *context)
|
||||
void ntlm_generate_timestamp(NTLM_CONTEXT* context)
|
||||
{
|
||||
if (memcmp(context->ChallengeTimestamp, NTLM_NULL_BUFFER, 8) != 0)
|
||||
CopyMemory(context->Timestamp, context->ChallengeTimestamp, 8);
|
||||
@ -189,11 +189,11 @@ void ntlm_generate_timestamp(NTLM_CONTEXT *context)
|
||||
ntlm_current_time(context->Timestamp);
|
||||
}
|
||||
|
||||
int ntlm_fetch_ntlm_v2_hash(NTLM_CONTEXT *context, BYTE *hash)
|
||||
int ntlm_fetch_ntlm_v2_hash(NTLM_CONTEXT* context, BYTE* hash)
|
||||
{
|
||||
WINPR_SAM *sam;
|
||||
WINPR_SAM_ENTRY *entry;
|
||||
SSPI_CREDENTIALS *credentials = context->credentials;
|
||||
WINPR_SAM* sam;
|
||||
WINPR_SAM_ENTRY* entry;
|
||||
SSPI_CREDENTIALS* credentials = context->credentials;
|
||||
sam = SamOpen(TRUE);
|
||||
|
||||
if (!sam)
|
||||
@ -212,7 +212,7 @@ int ntlm_fetch_ntlm_v2_hash(NTLM_CONTEXT *context, BYTE *hash)
|
||||
NTOWFv2FromHashW(entry->NtHash,
|
||||
(LPWSTR) credentials->identity.User, credentials->identity.UserLength * 2,
|
||||
(LPWSTR) credentials->identity.Domain, credentials->identity.DomainLength * 2,
|
||||
(BYTE *) hash);
|
||||
(BYTE*) hash);
|
||||
SamFreeEntry(sam, entry);
|
||||
SamClose(sam);
|
||||
return 1;
|
||||
@ -230,7 +230,7 @@ int ntlm_fetch_ntlm_v2_hash(NTLM_CONTEXT *context, BYTE *hash)
|
||||
NTOWFv2FromHashW(entry->NtHash,
|
||||
(LPWSTR) credentials->identity.User, credentials->identity.UserLength * 2,
|
||||
(LPWSTR) credentials->identity.Domain, credentials->identity.DomainLength * 2,
|
||||
(BYTE *) hash);
|
||||
(BYTE*) hash);
|
||||
SamFreeEntry(sam, entry);
|
||||
SamClose(sam);
|
||||
return 1;
|
||||
@ -245,13 +245,13 @@ int ntlm_fetch_ntlm_v2_hash(NTLM_CONTEXT *context, BYTE *hash)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ntlm_convert_password_hash(NTLM_CONTEXT *context, BYTE *hash)
|
||||
int ntlm_convert_password_hash(NTLM_CONTEXT* context, BYTE* hash)
|
||||
{
|
||||
int status;
|
||||
int i, hn, ln;
|
||||
char *PasswordHash = NULL;
|
||||
char* PasswordHash = NULL;
|
||||
UINT32 PasswordHashLength = 0;
|
||||
SSPI_CREDENTIALS *credentials = context->credentials;
|
||||
SSPI_CREDENTIALS* credentials = context->credentials;
|
||||
/* Password contains a password hash of length (PasswordLength / SSPI_CREDENTIALS_HASH_LENGTH_FACTOR) */
|
||||
PasswordHashLength = credentials->identity.PasswordLength / SSPI_CREDENTIALS_HASH_LENGTH_FACTOR;
|
||||
status = ConvertFromUnicode(CP_UTF8, 0, (LPCWSTR) credentials->identity.Password,
|
||||
@ -273,9 +273,9 @@ int ntlm_convert_password_hash(NTLM_CONTEXT *context, BYTE *hash)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ntlm_compute_ntlm_v2_hash(NTLM_CONTEXT *context, BYTE *hash)
|
||||
int ntlm_compute_ntlm_v2_hash(NTLM_CONTEXT* context, BYTE* hash)
|
||||
{
|
||||
SSPI_CREDENTIALS *credentials = context->credentials;
|
||||
SSPI_CREDENTIALS* credentials = context->credentials;
|
||||
|
||||
if (memcmp(context->NtlmV2Hash, NTLM_NULL_BUFFER, 16) != 0)
|
||||
return 1;
|
||||
@ -285,7 +285,7 @@ int ntlm_compute_ntlm_v2_hash(NTLM_CONTEXT *context, BYTE *hash)
|
||||
NTOWFv2FromHashW(context->NtlmHash,
|
||||
(LPWSTR) credentials->identity.User, credentials->identity.UserLength * 2,
|
||||
(LPWSTR) credentials->identity.Domain, credentials->identity.DomainLength * 2,
|
||||
(BYTE *) hash);
|
||||
(BYTE*) hash);
|
||||
}
|
||||
else if (credentials->identity.PasswordLength > 256)
|
||||
{
|
||||
@ -296,13 +296,13 @@ int ntlm_compute_ntlm_v2_hash(NTLM_CONTEXT *context, BYTE *hash)
|
||||
NTOWFv2FromHashW(context->NtlmHash,
|
||||
(LPWSTR) credentials->identity.User, credentials->identity.UserLength * 2,
|
||||
(LPWSTR) credentials->identity.Domain, credentials->identity.DomainLength * 2,
|
||||
(BYTE *) hash);
|
||||
(BYTE*) hash);
|
||||
}
|
||||
else if (credentials->identity.PasswordLength > 0)
|
||||
{
|
||||
NTOWFv2W((LPWSTR) credentials->identity.Password, credentials->identity.PasswordLength * 2,
|
||||
(LPWSTR) credentials->identity.User, credentials->identity.UserLength * 2,
|
||||
(LPWSTR) credentials->identity.Domain, credentials->identity.DomainLength * 2, (BYTE *) hash);
|
||||
(LPWSTR) credentials->identity.Domain, credentials->identity.DomainLength * 2, (BYTE*) hash);
|
||||
}
|
||||
else if (context->UseSamFileDatabase)
|
||||
{
|
||||
@ -312,9 +312,9 @@ int ntlm_compute_ntlm_v2_hash(NTLM_CONTEXT *context, BYTE *hash)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int ntlm_compute_lm_v2_response(NTLM_CONTEXT *context)
|
||||
int ntlm_compute_lm_v2_response(NTLM_CONTEXT* context)
|
||||
{
|
||||
BYTE *response;
|
||||
BYTE* response;
|
||||
BYTE value[16];
|
||||
|
||||
if (context->LmCompatibilityLevel < 2)
|
||||
@ -338,9 +338,9 @@ int ntlm_compute_lm_v2_response(NTLM_CONTEXT *context)
|
||||
if (!sspi_SecBufferAlloc(&context->LmChallengeResponse, 24))
|
||||
return -1;
|
||||
|
||||
response = (BYTE *) context->LmChallengeResponse.pvBuffer;
|
||||
response = (BYTE*) context->LmChallengeResponse.pvBuffer;
|
||||
/* Compute the HMAC-MD5 hash of the resulting value using the NTLMv2 hash as the key */
|
||||
HMAC(EVP_md5(), (void *) context->NtlmV2Hash, 16, (BYTE *) value, 16, (BYTE *) response, NULL);
|
||||
HMAC(EVP_md5(), (void*) context->NtlmV2Hash, 16, (BYTE*) value, 16, (BYTE*) response, NULL);
|
||||
/* Concatenate the resulting HMAC-MD5 hash and the client challenge, giving us the LMv2 response (24 bytes) */
|
||||
CopyMemory(&response[16], context->ClientChallenge, 8);
|
||||
return 1;
|
||||
@ -353,14 +353,14 @@ int ntlm_compute_lm_v2_response(NTLM_CONTEXT *context)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
int ntlm_compute_ntlm_v2_response(NTLM_CONTEXT *context)
|
||||
int ntlm_compute_ntlm_v2_response(NTLM_CONTEXT* context)
|
||||
{
|
||||
BYTE *blob;
|
||||
BYTE* blob;
|
||||
BYTE nt_proof_str[16];
|
||||
SecBuffer ntlm_v2_temp;
|
||||
SecBuffer ntlm_v2_temp_chal;
|
||||
PSecBuffer TargetInfo;
|
||||
SSPI_CREDENTIALS *credentials;
|
||||
SSPI_CREDENTIALS* credentials;
|
||||
credentials = context->credentials;
|
||||
TargetInfo = &context->ChallengeTargetInfo;
|
||||
|
||||
@ -368,22 +368,22 @@ int ntlm_compute_ntlm_v2_response(NTLM_CONTEXT *context)
|
||||
return -1;
|
||||
|
||||
ZeroMemory(ntlm_v2_temp.pvBuffer, ntlm_v2_temp.cbBuffer);
|
||||
blob = (BYTE *) ntlm_v2_temp.pvBuffer;
|
||||
blob = (BYTE*) ntlm_v2_temp.pvBuffer;
|
||||
|
||||
/* Compute the NTLMv2 hash */
|
||||
|
||||
if (ntlm_compute_ntlm_v2_hash(context, (BYTE *) context->NtlmV2Hash) < 0)
|
||||
if (ntlm_compute_ntlm_v2_hash(context, (BYTE*) context->NtlmV2Hash) < 0)
|
||||
return -1;
|
||||
|
||||
#ifdef WITH_DEBUG_NTLM
|
||||
WLog_DBG(TAG, "Password (length = %d)", credentials->identity.PasswordLength * 2);
|
||||
winpr_HexDump((BYTE *) credentials->identity.Password, credentials->identity.PasswordLength * 2);
|
||||
winpr_HexDump((BYTE*) credentials->identity.Password, credentials->identity.PasswordLength * 2);
|
||||
WLog_DBG(TAG, "Username (length = %d)", credentials->identity.UserLength * 2);
|
||||
winpr_HexDump((BYTE *) credentials->identity.User, credentials->identity.UserLength * 2);
|
||||
winpr_HexDump((BYTE*) credentials->identity.User, credentials->identity.UserLength * 2);
|
||||
WLog_DBG(TAG, "Domain (length = %d)", credentials->identity.DomainLength * 2);
|
||||
winpr_HexDump((BYTE *) credentials->identity.Domain, credentials->identity.DomainLength * 2);
|
||||
winpr_HexDump((BYTE*) credentials->identity.Domain, credentials->identity.DomainLength * 2);
|
||||
WLog_DBG(TAG, "Workstation (length = %d)", context->Workstation.Length);
|
||||
winpr_HexDump((BYTE *) context->Workstation.Buffer, context->Workstation.Length);
|
||||
winpr_HexDump((BYTE*) context->Workstation.Buffer, context->Workstation.Length);
|
||||
WLog_DBG(TAG, "NTOWFv2, NTLMv2 Hash");
|
||||
winpr_HexDump(context->NtlmV2Hash, 16);
|
||||
#endif
|
||||
@ -406,22 +406,22 @@ int ntlm_compute_ntlm_v2_response(NTLM_CONTEXT *context)
|
||||
if (!sspi_SecBufferAlloc(&ntlm_v2_temp_chal, ntlm_v2_temp.cbBuffer + 8))
|
||||
return -1;
|
||||
|
||||
blob = (BYTE *) ntlm_v2_temp_chal.pvBuffer;
|
||||
blob = (BYTE*) ntlm_v2_temp_chal.pvBuffer;
|
||||
CopyMemory(blob, context->ServerChallenge, 8);
|
||||
CopyMemory(&blob[8], ntlm_v2_temp.pvBuffer, ntlm_v2_temp.cbBuffer);
|
||||
HMAC(EVP_md5(), (BYTE *) context->NtlmV2Hash, 16, (BYTE *) ntlm_v2_temp_chal.pvBuffer,
|
||||
ntlm_v2_temp_chal.cbBuffer, (BYTE *) nt_proof_str, NULL);
|
||||
HMAC(EVP_md5(), (BYTE*) context->NtlmV2Hash, 16, (BYTE*) ntlm_v2_temp_chal.pvBuffer,
|
||||
ntlm_v2_temp_chal.cbBuffer, (BYTE*) nt_proof_str, NULL);
|
||||
|
||||
/* NtChallengeResponse, Concatenate NTProofStr with temp */
|
||||
|
||||
if (!sspi_SecBufferAlloc(&context->NtChallengeResponse, ntlm_v2_temp.cbBuffer + 16))
|
||||
return -1;
|
||||
|
||||
blob = (BYTE *) context->NtChallengeResponse.pvBuffer;
|
||||
blob = (BYTE*) context->NtChallengeResponse.pvBuffer;
|
||||
CopyMemory(blob, nt_proof_str, 16);
|
||||
CopyMemory(&blob[16], ntlm_v2_temp.pvBuffer, ntlm_v2_temp.cbBuffer);
|
||||
/* Compute SessionBaseKey, the HMAC-MD5 hash of NTProofStr using the NTLMv2 hash as the key */
|
||||
HMAC(EVP_md5(), (BYTE *) context->NtlmV2Hash, 16, (BYTE *) nt_proof_str, 16, (BYTE *) context->SessionBaseKey, NULL);
|
||||
HMAC(EVP_md5(), (BYTE*) context->NtlmV2Hash, 16, (BYTE*) nt_proof_str, 16, (BYTE*) context->SessionBaseKey, NULL);
|
||||
sspi_SecBufferFree(&ntlm_v2_temp);
|
||||
sspi_SecBufferFree(&ntlm_v2_temp_chal);
|
||||
return 1;
|
||||
@ -435,13 +435,13 @@ int ntlm_compute_ntlm_v2_response(NTLM_CONTEXT *context)
|
||||
* @param ciphertext cipher text
|
||||
*/
|
||||
|
||||
void ntlm_rc4k(BYTE *key, int length, BYTE *plaintext, BYTE *ciphertext)
|
||||
void ntlm_rc4k(BYTE* key, int length, BYTE* plaintext, BYTE* ciphertext)
|
||||
{
|
||||
RC4_KEY rc4;
|
||||
/* Initialize RC4 cipher with key */
|
||||
RC4_set_key(&rc4, 16, (void *) key);
|
||||
RC4_set_key(&rc4, 16, (void*) key);
|
||||
/* Encrypt plaintext with key */
|
||||
RC4(&rc4, length, (void *) plaintext, (void *) ciphertext);
|
||||
RC4(&rc4, length, (void*) plaintext, (void*) ciphertext);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -449,7 +449,7 @@ void ntlm_rc4k(BYTE *key, int length, BYTE *plaintext, BYTE *ciphertext)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_generate_client_challenge(NTLM_CONTEXT *context)
|
||||
void ntlm_generate_client_challenge(NTLM_CONTEXT* context)
|
||||
{
|
||||
/* ClientChallenge is used in computation of LMv2 and NTLMv2 responses */
|
||||
if (memcmp(context->ClientChallenge, NTLM_NULL_BUFFER, 8) == 0)
|
||||
@ -461,7 +461,7 @@ void ntlm_generate_client_challenge(NTLM_CONTEXT *context)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_generate_server_challenge(NTLM_CONTEXT *context)
|
||||
void ntlm_generate_server_challenge(NTLM_CONTEXT* context)
|
||||
{
|
||||
if (memcmp(context->ServerChallenge, NTLM_NULL_BUFFER, 8) == 0)
|
||||
RAND_bytes(context->ServerChallenge, 8);
|
||||
@ -473,7 +473,7 @@ void ntlm_generate_server_challenge(NTLM_CONTEXT *context)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_generate_key_exchange_key(NTLM_CONTEXT *context)
|
||||
void ntlm_generate_key_exchange_key(NTLM_CONTEXT* context)
|
||||
{
|
||||
/* In NTLMv2, KeyExchangeKey is the 128-bit SessionBaseKey */
|
||||
CopyMemory(context->KeyExchangeKey, context->SessionBaseKey, 16);
|
||||
@ -484,7 +484,7 @@ void ntlm_generate_key_exchange_key(NTLM_CONTEXT *context)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_generate_random_session_key(NTLM_CONTEXT *context)
|
||||
void ntlm_generate_random_session_key(NTLM_CONTEXT* context)
|
||||
{
|
||||
RAND_bytes(context->RandomSessionKey, 16);
|
||||
}
|
||||
@ -494,7 +494,7 @@ void ntlm_generate_random_session_key(NTLM_CONTEXT *context)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_generate_exported_session_key(NTLM_CONTEXT *context)
|
||||
void ntlm_generate_exported_session_key(NTLM_CONTEXT* context)
|
||||
{
|
||||
CopyMemory(context->ExportedSessionKey, context->RandomSessionKey, 16);
|
||||
}
|
||||
@ -504,7 +504,7 @@ void ntlm_generate_exported_session_key(NTLM_CONTEXT *context)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_encrypt_random_session_key(NTLM_CONTEXT *context)
|
||||
void ntlm_encrypt_random_session_key(NTLM_CONTEXT* context)
|
||||
{
|
||||
/* In NTLMv2, EncryptedRandomSessionKey is the ExportedSessionKey RC4-encrypted with the KeyExchangeKey */
|
||||
ntlm_rc4k(context->KeyExchangeKey, 16, context->RandomSessionKey, context->EncryptedRandomSessionKey);
|
||||
@ -515,7 +515,7 @@ void ntlm_encrypt_random_session_key(NTLM_CONTEXT *context)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_decrypt_random_session_key(NTLM_CONTEXT *context)
|
||||
void ntlm_decrypt_random_session_key(NTLM_CONTEXT* context)
|
||||
{
|
||||
/* In NTLMv2, EncryptedRandomSessionKey is the ExportedSessionKey RC4-encrypted with the KeyExchangeKey */
|
||||
|
||||
@ -539,13 +539,13 @@ void ntlm_decrypt_random_session_key(NTLM_CONTEXT *context)
|
||||
* @param signing_key Destination signing key
|
||||
*/
|
||||
|
||||
int ntlm_generate_signing_key(BYTE *exported_session_key, PSecBuffer sign_magic, BYTE *signing_key)
|
||||
int ntlm_generate_signing_key(BYTE* exported_session_key, PSecBuffer sign_magic, BYTE* signing_key)
|
||||
{
|
||||
int length;
|
||||
BYTE *value;
|
||||
BYTE* value;
|
||||
MD5_CTX md5;
|
||||
length = 16 + sign_magic->cbBuffer;
|
||||
value = (BYTE *) malloc(length);
|
||||
value = (BYTE*) malloc(length);
|
||||
|
||||
if (!value)
|
||||
return -1;
|
||||
@ -566,10 +566,10 @@ int ntlm_generate_signing_key(BYTE *exported_session_key, PSecBuffer sign_magic,
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_generate_client_signing_key(NTLM_CONTEXT *context)
|
||||
void ntlm_generate_client_signing_key(NTLM_CONTEXT* context)
|
||||
{
|
||||
SecBuffer signMagic;
|
||||
signMagic.pvBuffer = (void *) NTLM_CLIENT_SIGN_MAGIC;
|
||||
signMagic.pvBuffer = (void*) NTLM_CLIENT_SIGN_MAGIC;
|
||||
signMagic.cbBuffer = sizeof(NTLM_CLIENT_SIGN_MAGIC);
|
||||
ntlm_generate_signing_key(context->ExportedSessionKey, &signMagic, context->ClientSigningKey);
|
||||
}
|
||||
@ -580,10 +580,10 @@ void ntlm_generate_client_signing_key(NTLM_CONTEXT *context)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_generate_server_signing_key(NTLM_CONTEXT *context)
|
||||
void ntlm_generate_server_signing_key(NTLM_CONTEXT* context)
|
||||
{
|
||||
SecBuffer signMagic;
|
||||
signMagic.pvBuffer = (void *) NTLM_SERVER_SIGN_MAGIC;
|
||||
signMagic.pvBuffer = (void*) NTLM_SERVER_SIGN_MAGIC;
|
||||
signMagic.cbBuffer = sizeof(NTLM_SERVER_SIGN_MAGIC);
|
||||
ntlm_generate_signing_key(context->ExportedSessionKey, &signMagic, context->ServerSigningKey);
|
||||
}
|
||||
@ -596,16 +596,16 @@ void ntlm_generate_server_signing_key(NTLM_CONTEXT *context)
|
||||
* @param sealing_key Destination sealing key
|
||||
*/
|
||||
|
||||
int ntlm_generate_sealing_key(BYTE *exported_session_key, PSecBuffer seal_magic, BYTE *sealing_key)
|
||||
int ntlm_generate_sealing_key(BYTE* exported_session_key, PSecBuffer seal_magic, BYTE* sealing_key)
|
||||
{
|
||||
BYTE *p;
|
||||
BYTE* p;
|
||||
MD5_CTX md5;
|
||||
SecBuffer buffer;
|
||||
|
||||
if (!sspi_SecBufferAlloc(&buffer, 16 + seal_magic->cbBuffer))
|
||||
return -1;
|
||||
|
||||
p = (BYTE *) buffer.pvBuffer;
|
||||
p = (BYTE*) buffer.pvBuffer;
|
||||
/* Concatenate ExportedSessionKey with seal magic */
|
||||
CopyMemory(p, exported_session_key, 16);
|
||||
CopyMemory(&p[16], seal_magic->pvBuffer, seal_magic->cbBuffer);
|
||||
@ -622,10 +622,10 @@ int ntlm_generate_sealing_key(BYTE *exported_session_key, PSecBuffer seal_magic,
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_generate_client_sealing_key(NTLM_CONTEXT *context)
|
||||
void ntlm_generate_client_sealing_key(NTLM_CONTEXT* context)
|
||||
{
|
||||
SecBuffer sealMagic;
|
||||
sealMagic.pvBuffer = (void *) NTLM_CLIENT_SEAL_MAGIC;
|
||||
sealMagic.pvBuffer = (void*) NTLM_CLIENT_SEAL_MAGIC;
|
||||
sealMagic.cbBuffer = sizeof(NTLM_CLIENT_SEAL_MAGIC);
|
||||
ntlm_generate_signing_key(context->ExportedSessionKey, &sealMagic, context->ClientSealingKey);
|
||||
}
|
||||
@ -636,10 +636,10 @@ void ntlm_generate_client_sealing_key(NTLM_CONTEXT *context)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_generate_server_sealing_key(NTLM_CONTEXT *context)
|
||||
void ntlm_generate_server_sealing_key(NTLM_CONTEXT* context)
|
||||
{
|
||||
SecBuffer sealMagic;
|
||||
sealMagic.pvBuffer = (void *) NTLM_SERVER_SEAL_MAGIC;
|
||||
sealMagic.pvBuffer = (void*) NTLM_SERVER_SEAL_MAGIC;
|
||||
sealMagic.cbBuffer = sizeof(NTLM_SERVER_SEAL_MAGIC);
|
||||
ntlm_generate_signing_key(context->ExportedSessionKey, &sealMagic, context->ServerSealingKey);
|
||||
}
|
||||
@ -649,7 +649,7 @@ void ntlm_generate_server_sealing_key(NTLM_CONTEXT *context)
|
||||
* @param NTLM context
|
||||
*/
|
||||
|
||||
void ntlm_init_rc4_seal_states(NTLM_CONTEXT *context)
|
||||
void ntlm_init_rc4_seal_states(NTLM_CONTEXT* context)
|
||||
{
|
||||
if (context->server)
|
||||
{
|
||||
@ -671,7 +671,7 @@ void ntlm_init_rc4_seal_states(NTLM_CONTEXT *context)
|
||||
}
|
||||
}
|
||||
|
||||
void ntlm_compute_message_integrity_check(NTLM_CONTEXT *context)
|
||||
void ntlm_compute_message_integrity_check(NTLM_CONTEXT* context)
|
||||
{
|
||||
HMAC_CTX hmac_ctx;
|
||||
/*
|
||||
@ -680,9 +680,9 @@ void ntlm_compute_message_integrity_check(NTLM_CONTEXT *context)
|
||||
*/
|
||||
HMAC_CTX_init(&hmac_ctx);
|
||||
HMAC_Init_ex(&hmac_ctx, context->ExportedSessionKey, 16, EVP_md5(), NULL);
|
||||
HMAC_Update(&hmac_ctx, (BYTE *) context->NegotiateMessage.pvBuffer, context->NegotiateMessage.cbBuffer);
|
||||
HMAC_Update(&hmac_ctx, (BYTE *) context->ChallengeMessage.pvBuffer, context->ChallengeMessage.cbBuffer);
|
||||
HMAC_Update(&hmac_ctx, (BYTE *) context->AuthenticateMessage.pvBuffer, context->AuthenticateMessage.cbBuffer);
|
||||
HMAC_Update(&hmac_ctx, (BYTE*) context->NegotiateMessage.pvBuffer, context->NegotiateMessage.cbBuffer);
|
||||
HMAC_Update(&hmac_ctx, (BYTE*) context->ChallengeMessage.pvBuffer, context->ChallengeMessage.cbBuffer);
|
||||
HMAC_Update(&hmac_ctx, (BYTE*) context->AuthenticateMessage.pvBuffer, context->AuthenticateMessage.cbBuffer);
|
||||
HMAC_Final(&hmac_ctx, context->MessageIntegrityCheck, NULL);
|
||||
HMAC_CTX_cleanup(&hmac_ctx);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
static const char NTLM_SIGNATURE[8] = { 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0' };
|
||||
|
||||
static const char *const NTLM_NEGOTIATE_STRINGS[] =
|
||||
static const char* const NTLM_NEGOTIATE_STRINGS[] =
|
||||
{
|
||||
"NTLMSSP_NEGOTIATE_56",
|
||||
"NTLMSSP_NEGOTIATE_KEY_EXCH",
|
||||
@ -77,7 +77,7 @@ static const char *const NTLM_NEGOTIATE_STRINGS[] =
|
||||
void ntlm_print_negotiate_flags(UINT32 flags)
|
||||
{
|
||||
int i;
|
||||
const char *str;
|
||||
const char* str;
|
||||
WLog_INFO(TAG, "negotiateFlags \"0x%08X\"", flags);
|
||||
|
||||
for (i = 31; i >= 0; i--)
|
||||
@ -90,7 +90,7 @@ void ntlm_print_negotiate_flags(UINT32 flags)
|
||||
}
|
||||
}
|
||||
|
||||
int ntlm_read_message_header(wStream *s, NTLM_MESSAGE_HEADER *header)
|
||||
int ntlm_read_message_header(wStream* s, NTLM_MESSAGE_HEADER* header)
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 12)
|
||||
return -1;
|
||||
@ -98,25 +98,25 @@ int ntlm_read_message_header(wStream *s, NTLM_MESSAGE_HEADER *header)
|
||||
Stream_Read(s, header->Signature, 8);
|
||||
Stream_Read_UINT32(s, header->MessageType);
|
||||
|
||||
if (strncmp((char *) header->Signature, NTLM_SIGNATURE, 8) != 0)
|
||||
if (strncmp((char*) header->Signature, NTLM_SIGNATURE, 8) != 0)
|
||||
return -1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ntlm_write_message_header(wStream *s, NTLM_MESSAGE_HEADER *header)
|
||||
void ntlm_write_message_header(wStream* s, NTLM_MESSAGE_HEADER* header)
|
||||
{
|
||||
Stream_Write(s, header->Signature, sizeof(NTLM_SIGNATURE));
|
||||
Stream_Write_UINT32(s, header->MessageType);
|
||||
}
|
||||
|
||||
void ntlm_populate_message_header(NTLM_MESSAGE_HEADER *header, UINT32 MessageType)
|
||||
void ntlm_populate_message_header(NTLM_MESSAGE_HEADER* header, UINT32 MessageType)
|
||||
{
|
||||
CopyMemory(header->Signature, NTLM_SIGNATURE, sizeof(NTLM_SIGNATURE));
|
||||
header->MessageType = MessageType;
|
||||
}
|
||||
|
||||
int ntlm_read_message_fields(wStream *s, NTLM_MESSAGE_FIELDS *fields)
|
||||
int ntlm_read_message_fields(wStream* s, NTLM_MESSAGE_FIELDS* fields)
|
||||
{
|
||||
if (Stream_GetRemainingLength(s) < 8)
|
||||
return -1;
|
||||
@ -127,7 +127,7 @@ int ntlm_read_message_fields(wStream *s, NTLM_MESSAGE_FIELDS *fields)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ntlm_write_message_fields(wStream *s, NTLM_MESSAGE_FIELDS *fields)
|
||||
void ntlm_write_message_fields(wStream* s, NTLM_MESSAGE_FIELDS* fields)
|
||||
{
|
||||
if (fields->MaxLen < 1)
|
||||
fields->MaxLen = fields->Len;
|
||||
@ -137,7 +137,7 @@ void ntlm_write_message_fields(wStream *s, NTLM_MESSAGE_FIELDS *fields)
|
||||
Stream_Write_UINT32(s, fields->BufferOffset); /* BufferOffset (4 bytes) */
|
||||
}
|
||||
|
||||
int ntlm_read_message_fields_buffer(wStream *s, NTLM_MESSAGE_FIELDS *fields)
|
||||
int ntlm_read_message_fields_buffer(wStream* s, NTLM_MESSAGE_FIELDS* fields)
|
||||
{
|
||||
if (fields->Len > 0)
|
||||
{
|
||||
@ -156,7 +156,7 @@ int ntlm_read_message_fields_buffer(wStream *s, NTLM_MESSAGE_FIELDS *fields)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void ntlm_write_message_fields_buffer(wStream *s, NTLM_MESSAGE_FIELDS *fields)
|
||||
void ntlm_write_message_fields_buffer(wStream* s, NTLM_MESSAGE_FIELDS* fields)
|
||||
{
|
||||
if (fields->Len > 0)
|
||||
{
|
||||
@ -165,7 +165,7 @@ void ntlm_write_message_fields_buffer(wStream *s, NTLM_MESSAGE_FIELDS *fields)
|
||||
}
|
||||
}
|
||||
|
||||
void ntlm_free_message_fields_buffer(NTLM_MESSAGE_FIELDS *fields)
|
||||
void ntlm_free_message_fields_buffer(NTLM_MESSAGE_FIELDS* fields)
|
||||
{
|
||||
if (fields)
|
||||
{
|
||||
@ -180,7 +180,7 @@ void ntlm_free_message_fields_buffer(NTLM_MESSAGE_FIELDS *fields)
|
||||
}
|
||||
}
|
||||
|
||||
void ntlm_print_message_fields(NTLM_MESSAGE_FIELDS *fields, const char *name)
|
||||
void ntlm_print_message_fields(NTLM_MESSAGE_FIELDS* fields, const char* name)
|
||||
{
|
||||
WLog_DBG(TAG, "%s (Len: %d MaxLen: %d BufferOffset: %d)",
|
||||
name, fields->Len, fields->MaxLen, fields->BufferOffset);
|
||||
@ -189,19 +189,19 @@ void ntlm_print_message_fields(NTLM_MESSAGE_FIELDS *fields, const char *name)
|
||||
winpr_HexDump(TAG, WLOG_DEBUG, fields->Buffer, fields->Len);
|
||||
}
|
||||
|
||||
SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT *context, PSecBuffer buffer)
|
||||
SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
NTLM_NEGOTIATE_MESSAGE *message;
|
||||
NTLM_NEGOTIATE_MESSAGE* message;
|
||||
message = &context->NEGOTIATE_MESSAGE;
|
||||
ZeroMemory(message, sizeof(NTLM_NEGOTIATE_MESSAGE));
|
||||
s = Stream_New((BYTE *) buffer->pvBuffer, buffer->cbBuffer);
|
||||
s = Stream_New((BYTE*) buffer->pvBuffer, buffer->cbBuffer);
|
||||
|
||||
if (!s)
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
|
||||
if (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER *) message) < 0)
|
||||
if (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER*) message) < 0)
|
||||
return SEC_E_INVALID_TOKEN;
|
||||
|
||||
if (message->MessageType != MESSAGE_TYPE_NEGOTIATE)
|
||||
@ -258,19 +258,19 @@ SECURITY_STATUS ntlm_read_NegotiateMessage(NTLM_CONTEXT *context, PSecBuffer buf
|
||||
return SEC_I_CONTINUE_NEEDED;
|
||||
}
|
||||
|
||||
SECURITY_STATUS ntlm_write_NegotiateMessage(NTLM_CONTEXT *context, PSecBuffer buffer)
|
||||
SECURITY_STATUS ntlm_write_NegotiateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
NTLM_NEGOTIATE_MESSAGE *message;
|
||||
NTLM_NEGOTIATE_MESSAGE* message;
|
||||
message = &context->NEGOTIATE_MESSAGE;
|
||||
ZeroMemory(message, sizeof(NTLM_NEGOTIATE_MESSAGE));
|
||||
s = Stream_New((BYTE *) buffer->pvBuffer, buffer->cbBuffer);
|
||||
s = Stream_New((BYTE*) buffer->pvBuffer, buffer->cbBuffer);
|
||||
|
||||
if (!s)
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
|
||||
ntlm_populate_message_header((NTLM_MESSAGE_HEADER *) message, MESSAGE_TYPE_NEGOTIATE);
|
||||
ntlm_populate_message_header((NTLM_MESSAGE_HEADER*) message, MESSAGE_TYPE_NEGOTIATE);
|
||||
|
||||
if (context->NTLMv2)
|
||||
{
|
||||
@ -300,7 +300,7 @@ SECURITY_STATUS ntlm_write_NegotiateMessage(NTLM_CONTEXT *context, PSecBuffer bu
|
||||
|
||||
context->NegotiateFlags = message->NegotiateFlags;
|
||||
/* Message Header (12 bytes) */
|
||||
ntlm_write_message_header(s, (NTLM_MESSAGE_HEADER *) message);
|
||||
ntlm_write_message_header(s, (NTLM_MESSAGE_HEADER*) message);
|
||||
Stream_Write_UINT32(s, message->NegotiateFlags); /* NegotiateFlags (4 bytes) */
|
||||
/* only set if NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED is set */
|
||||
/* DomainNameFields (8 bytes) */
|
||||
@ -333,25 +333,25 @@ SECURITY_STATUS ntlm_write_NegotiateMessage(NTLM_CONTEXT *context, PSecBuffer bu
|
||||
return SEC_I_CONTINUE_NEEDED;
|
||||
}
|
||||
|
||||
SECURITY_STATUS ntlm_read_ChallengeMessage(NTLM_CONTEXT *context, PSecBuffer buffer)
|
||||
SECURITY_STATUS ntlm_read_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
PBYTE StartOffset;
|
||||
PBYTE PayloadOffset;
|
||||
NTLM_AV_PAIR *AvTimestamp;
|
||||
NTLM_CHALLENGE_MESSAGE *message;
|
||||
NTLM_AV_PAIR* AvTimestamp;
|
||||
NTLM_CHALLENGE_MESSAGE* message;
|
||||
ntlm_generate_client_challenge(context);
|
||||
message = &context->CHALLENGE_MESSAGE;
|
||||
ZeroMemory(message, sizeof(NTLM_CHALLENGE_MESSAGE));
|
||||
s = Stream_New((BYTE *) buffer->pvBuffer, buffer->cbBuffer);
|
||||
s = Stream_New((BYTE*) buffer->pvBuffer, buffer->cbBuffer);
|
||||
|
||||
if (!s)
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
|
||||
StartOffset = Stream_Pointer(s);
|
||||
|
||||
if (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER *) message) < 0)
|
||||
if (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER*) message) < 0)
|
||||
return SEC_E_INVALID_TOKEN;
|
||||
|
||||
if (message->MessageType != MESSAGE_TYPE_CHALLENGE)
|
||||
@ -402,7 +402,7 @@ SECURITY_STATUS ntlm_read_ChallengeMessage(NTLM_CONTEXT *context, PSecBuffer buf
|
||||
|
||||
context->ChallengeTargetInfo.pvBuffer = message->TargetInfo.Buffer;
|
||||
context->ChallengeTargetInfo.cbBuffer = message->TargetInfo.Len;
|
||||
AvTimestamp = ntlm_av_pair_get((NTLM_AV_PAIR *) message->TargetInfo.Buffer, MsvAvTimestamp);
|
||||
AvTimestamp = ntlm_av_pair_get((NTLM_AV_PAIR*) message->TargetInfo.Buffer, MsvAvTimestamp);
|
||||
|
||||
if (AvTimestamp)
|
||||
{
|
||||
@ -499,15 +499,15 @@ SECURITY_STATUS ntlm_read_ChallengeMessage(NTLM_CONTEXT *context, PSecBuffer buf
|
||||
return SEC_I_CONTINUE_NEEDED;
|
||||
}
|
||||
|
||||
SECURITY_STATUS ntlm_write_ChallengeMessage(NTLM_CONTEXT *context, PSecBuffer buffer)
|
||||
SECURITY_STATUS ntlm_write_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
UINT32 PayloadOffset;
|
||||
NTLM_CHALLENGE_MESSAGE *message;
|
||||
NTLM_CHALLENGE_MESSAGE* message;
|
||||
message = &context->CHALLENGE_MESSAGE;
|
||||
ZeroMemory(message, sizeof(NTLM_CHALLENGE_MESSAGE));
|
||||
s = Stream_New((BYTE *) buffer->pvBuffer, buffer->cbBuffer);
|
||||
s = Stream_New((BYTE*) buffer->pvBuffer, buffer->cbBuffer);
|
||||
|
||||
if (!s)
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
@ -521,9 +521,9 @@ SECURITY_STATUS ntlm_write_ChallengeMessage(NTLM_CONTEXT *context, PSecBuffer bu
|
||||
|
||||
CopyMemory(message->ServerChallenge, context->ServerChallenge, 8); /* ServerChallenge */
|
||||
message->NegotiateFlags = context->NegotiateFlags;
|
||||
ntlm_populate_message_header((NTLM_MESSAGE_HEADER *) message, MESSAGE_TYPE_CHALLENGE);
|
||||
ntlm_populate_message_header((NTLM_MESSAGE_HEADER*) message, MESSAGE_TYPE_CHALLENGE);
|
||||
/* Message Header (12 bytes) */
|
||||
ntlm_write_message_header(s, (NTLM_MESSAGE_HEADER *) message);
|
||||
ntlm_write_message_header(s, (NTLM_MESSAGE_HEADER*) message);
|
||||
|
||||
if (message->NegotiateFlags & NTLMSSP_REQUEST_TARGET)
|
||||
{
|
||||
@ -588,25 +588,25 @@ SECURITY_STATUS ntlm_write_ChallengeMessage(NTLM_CONTEXT *context, PSecBuffer bu
|
||||
return SEC_I_CONTINUE_NEEDED;
|
||||
}
|
||||
|
||||
SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT *context, PSecBuffer buffer)
|
||||
SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
UINT32 flags;
|
||||
NTLM_AV_PAIR *AvFlags;
|
||||
NTLM_AV_PAIR* AvFlags;
|
||||
UINT32 PayloadBufferOffset;
|
||||
NTLM_AUTHENTICATE_MESSAGE *message;
|
||||
SSPI_CREDENTIALS *credentials = context->credentials;
|
||||
NTLM_AUTHENTICATE_MESSAGE* message;
|
||||
SSPI_CREDENTIALS* credentials = context->credentials;
|
||||
flags = 0;
|
||||
AvFlags = NULL;
|
||||
message = &context->AUTHENTICATE_MESSAGE;
|
||||
ZeroMemory(message, sizeof(NTLM_AUTHENTICATE_MESSAGE));
|
||||
s = Stream_New((BYTE *) buffer->pvBuffer, buffer->cbBuffer);
|
||||
s = Stream_New((BYTE*) buffer->pvBuffer, buffer->cbBuffer);
|
||||
|
||||
if (!s)
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
|
||||
if (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER *) message) < 0)
|
||||
if (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER*) message) < 0)
|
||||
return SEC_E_INVALID_TOKEN;
|
||||
|
||||
if (message->MessageType != MESSAGE_TYPE_AUTHENTICATE)
|
||||
@ -662,7 +662,7 @@ SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT *context, PSecBuffer
|
||||
|
||||
if (message->NtChallengeResponse.Len > 0)
|
||||
{
|
||||
wStream *snt = Stream_New(message->NtChallengeResponse.Buffer, message->NtChallengeResponse.Len);
|
||||
wStream* snt = Stream_New(message->NtChallengeResponse.Buffer, message->NtChallengeResponse.Len);
|
||||
|
||||
if (!snt)
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
@ -674,13 +674,13 @@ SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT *context, PSecBuffer
|
||||
context->NtChallengeResponse.pvBuffer = message->NtChallengeResponse.Buffer;
|
||||
context->NtChallengeResponse.cbBuffer = message->NtChallengeResponse.Len;
|
||||
sspi_SecBufferFree(&(context->ChallengeTargetInfo));
|
||||
context->ChallengeTargetInfo.pvBuffer = (void *) context->NTLMv2Response.Challenge.AvPairs;
|
||||
context->ChallengeTargetInfo.pvBuffer = (void*) context->NTLMv2Response.Challenge.AvPairs;
|
||||
context->ChallengeTargetInfo.cbBuffer = message->NtChallengeResponse.Len - (28 + 16);
|
||||
CopyMemory(context->ClientChallenge, context->NTLMv2Response.Challenge.ClientChallenge, 8);
|
||||
AvFlags = ntlm_av_pair_get(context->NTLMv2Response.Challenge.AvPairs, MsvAvFlags);
|
||||
|
||||
if (AvFlags)
|
||||
flags = *((UINT32 *) ntlm_av_pair_get_value_pointer(AvFlags));
|
||||
flags = *((UINT32*) ntlm_av_pair_get_value_pointer(AvFlags));
|
||||
}
|
||||
|
||||
if (ntlm_read_message_fields_buffer(s, &(message->EncryptedRandomSessionKey)) < 0) /* EncryptedRandomSessionKey */
|
||||
@ -739,7 +739,7 @@ SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT *context, PSecBuffer
|
||||
|
||||
if (message->UserName.Len > 0)
|
||||
{
|
||||
credentials->identity.User = (UINT16 *) malloc(message->UserName.Len);
|
||||
credentials->identity.User = (UINT16*) malloc(message->UserName.Len);
|
||||
|
||||
if (!credentials->identity.User)
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
@ -750,7 +750,7 @@ SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT *context, PSecBuffer
|
||||
|
||||
if (message->DomainName.Len > 0)
|
||||
{
|
||||
credentials->identity.Domain = (UINT16 *) malloc(message->DomainName.Len);
|
||||
credentials->identity.Domain = (UINT16*) malloc(message->DomainName.Len);
|
||||
|
||||
if (!credentials->identity.Domain)
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
@ -772,16 +772,16 @@ SECURITY_STATUS ntlm_read_AuthenticateMessage(NTLM_CONTEXT *context, PSecBuffer
|
||||
* @param buffer
|
||||
*/
|
||||
|
||||
SECURITY_STATUS ntlm_write_AuthenticateMessage(NTLM_CONTEXT *context, PSecBuffer buffer)
|
||||
SECURITY_STATUS ntlm_write_AuthenticateMessage(NTLM_CONTEXT* context, PSecBuffer buffer)
|
||||
{
|
||||
wStream *s;
|
||||
wStream* s;
|
||||
int length;
|
||||
UINT32 PayloadBufferOffset;
|
||||
NTLM_AUTHENTICATE_MESSAGE *message;
|
||||
SSPI_CREDENTIALS *credentials = context->credentials;
|
||||
NTLM_AUTHENTICATE_MESSAGE* message;
|
||||
SSPI_CREDENTIALS* credentials = context->credentials;
|
||||
message = &context->AUTHENTICATE_MESSAGE;
|
||||
ZeroMemory(message, sizeof(NTLM_AUTHENTICATE_MESSAGE));
|
||||
s = Stream_New((BYTE *) buffer->pvBuffer, buffer->cbBuffer);
|
||||
s = Stream_New((BYTE*) buffer->pvBuffer, buffer->cbBuffer);
|
||||
|
||||
if (!s)
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
@ -820,22 +820,22 @@ SECURITY_STATUS ntlm_write_AuthenticateMessage(NTLM_CONTEXT *context, PSecBuffer
|
||||
if (message->NegotiateFlags & NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED)
|
||||
{
|
||||
message->Workstation.Len = context->Workstation.Length;
|
||||
message->Workstation.Buffer = (BYTE *) context->Workstation.Buffer;
|
||||
message->Workstation.Buffer = (BYTE*) context->Workstation.Buffer;
|
||||
}
|
||||
|
||||
if (credentials->identity.DomainLength > 0)
|
||||
{
|
||||
message->NegotiateFlags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED;
|
||||
message->DomainName.Len = (UINT16) credentials->identity.DomainLength * 2;
|
||||
message->DomainName.Buffer = (BYTE *) credentials->identity.Domain;
|
||||
message->DomainName.Buffer = (BYTE*) credentials->identity.Domain;
|
||||
}
|
||||
|
||||
message->UserName.Len = (UINT16) credentials->identity.UserLength * 2;
|
||||
message->UserName.Buffer = (BYTE *) credentials->identity.User;
|
||||
message->UserName.Buffer = (BYTE*) credentials->identity.User;
|
||||
message->LmChallengeResponse.Len = (UINT16) context->LmChallengeResponse.cbBuffer;
|
||||
message->LmChallengeResponse.Buffer = (BYTE *) context->LmChallengeResponse.pvBuffer;
|
||||
message->LmChallengeResponse.Buffer = (BYTE*) context->LmChallengeResponse.pvBuffer;
|
||||
message->NtChallengeResponse.Len = (UINT16) context->NtChallengeResponse.cbBuffer;
|
||||
message->NtChallengeResponse.Buffer = (BYTE *) context->NtChallengeResponse.pvBuffer;
|
||||
message->NtChallengeResponse.Buffer = (BYTE*) context->NtChallengeResponse.pvBuffer;
|
||||
|
||||
if (message->NegotiateFlags & NTLMSSP_NEGOTIATE_KEY_EXCH)
|
||||
{
|
||||
@ -857,8 +857,8 @@ SECURITY_STATUS ntlm_write_AuthenticateMessage(NTLM_CONTEXT *context, PSecBuffer
|
||||
message->LmChallengeResponse.BufferOffset = message->Workstation.BufferOffset + message->Workstation.Len;
|
||||
message->NtChallengeResponse.BufferOffset = message->LmChallengeResponse.BufferOffset + message->LmChallengeResponse.Len;
|
||||
message->EncryptedRandomSessionKey.BufferOffset = message->NtChallengeResponse.BufferOffset + message->NtChallengeResponse.Len;
|
||||
ntlm_populate_message_header((NTLM_MESSAGE_HEADER *) message, MESSAGE_TYPE_AUTHENTICATE);
|
||||
ntlm_write_message_header(s, (NTLM_MESSAGE_HEADER *) message); /* Message Header (12 bytes) */
|
||||
ntlm_populate_message_header((NTLM_MESSAGE_HEADER*) message, MESSAGE_TYPE_AUTHENTICATE);
|
||||
ntlm_write_message_header(s, (NTLM_MESSAGE_HEADER*) message); /* Message Header (12 bytes) */
|
||||
ntlm_write_message_fields(s, &(message->LmChallengeResponse)); /* LmChallengeResponseFields (8 bytes) */
|
||||
ntlm_write_message_fields(s, &(message->NtChallengeResponse)); /* NtChallengeResponseFields (8 bytes) */
|
||||
ntlm_write_message_fields(s, &(message->DomainName)); /* DomainNameFields (8 bytes) */
|
||||
@ -940,11 +940,11 @@ SECURITY_STATUS ntlm_write_AuthenticateMessage(NTLM_CONTEXT *context, PSecBuffer
|
||||
return SEC_I_COMPLETE_NEEDED;
|
||||
}
|
||||
|
||||
SECURITY_STATUS ntlm_server_AuthenticateComplete(NTLM_CONTEXT *context)
|
||||
SECURITY_STATUS ntlm_server_AuthenticateComplete(NTLM_CONTEXT* context)
|
||||
{
|
||||
UINT32 flags = 0;
|
||||
NTLM_AV_PAIR *AvFlags = NULL;
|
||||
NTLM_AUTHENTICATE_MESSAGE *message;
|
||||
NTLM_AV_PAIR* AvFlags = NULL;
|
||||
NTLM_AUTHENTICATE_MESSAGE* message;
|
||||
|
||||
if (context->state != NTLM_STATE_COMPLETION)
|
||||
return SEC_E_OUT_OF_SEQUENCE;
|
||||
@ -953,7 +953,7 @@ SECURITY_STATUS ntlm_server_AuthenticateComplete(NTLM_CONTEXT *context)
|
||||
AvFlags = ntlm_av_pair_get(context->NTLMv2Response.Challenge.AvPairs, MsvAvFlags);
|
||||
|
||||
if (AvFlags)
|
||||
flags = *((UINT32 *) ntlm_av_pair_get_value_pointer(AvFlags));
|
||||
flags = *((UINT32*) ntlm_av_pair_get_value_pointer(AvFlags));
|
||||
|
||||
if (ntlm_compute_lm_v2_response(context) < 0) /* LmChallengeResponse */
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "../../log.h"
|
||||
#define TAG WINPR_TAG("sspi.schannel")
|
||||
|
||||
char *openssl_get_ssl_error_string(int ssl_error)
|
||||
char* openssl_get_ssl_error_string(int ssl_error)
|
||||
{
|
||||
switch (ssl_error)
|
||||
{
|
||||
@ -55,7 +55,7 @@ char *openssl_get_ssl_error_string(int ssl_error)
|
||||
return "SSL_ERROR_UNKNOWN";
|
||||
}
|
||||
|
||||
int schannel_openssl_client_init(SCHANNEL_OPENSSL *context)
|
||||
int schannel_openssl_client_init(SCHANNEL_OPENSSL* context)
|
||||
{
|
||||
int status;
|
||||
long options = 0;
|
||||
@ -122,12 +122,12 @@ int schannel_openssl_client_init(SCHANNEL_OPENSSL *context)
|
||||
status = BIO_set_write_buf_size(context->bioWrite, SCHANNEL_CB_MAX_TOKEN);
|
||||
status = BIO_make_bio_pair(context->bioRead, context->bioWrite);
|
||||
SSL_set_bio(context->ssl, context->bioRead, context->bioWrite);
|
||||
context->ReadBuffer = (BYTE *) malloc(SCHANNEL_CB_MAX_TOKEN);
|
||||
context->WriteBuffer = (BYTE *) malloc(SCHANNEL_CB_MAX_TOKEN);
|
||||
context->ReadBuffer = (BYTE*) malloc(SCHANNEL_CB_MAX_TOKEN);
|
||||
context->WriteBuffer = (BYTE*) malloc(SCHANNEL_CB_MAX_TOKEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int schannel_openssl_server_init(SCHANNEL_OPENSSL *context)
|
||||
int schannel_openssl_server_init(SCHANNEL_OPENSSL* context)
|
||||
{
|
||||
int status;
|
||||
long options = 0;
|
||||
@ -215,12 +215,12 @@ int schannel_openssl_server_init(SCHANNEL_OPENSSL *context)
|
||||
status = BIO_set_write_buf_size(context->bioWrite, SCHANNEL_CB_MAX_TOKEN);
|
||||
status = BIO_make_bio_pair(context->bioRead, context->bioWrite);
|
||||
SSL_set_bio(context->ssl, context->bioRead, context->bioWrite);
|
||||
context->ReadBuffer = (BYTE *) malloc(SCHANNEL_CB_MAX_TOKEN);
|
||||
context->WriteBuffer = (BYTE *) malloc(SCHANNEL_CB_MAX_TOKEN);
|
||||
context->ReadBuffer = (BYTE*) malloc(SCHANNEL_CB_MAX_TOKEN);
|
||||
context->WriteBuffer = (BYTE*) malloc(SCHANNEL_CB_MAX_TOKEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SECURITY_STATUS schannel_openssl_client_process_tokens(SCHANNEL_OPENSSL *context, PSecBufferDesc pInput, PSecBufferDesc pOutput)
|
||||
SECURITY_STATUS schannel_openssl_client_process_tokens(SCHANNEL_OPENSSL* context, PSecBufferDesc pInput, PSecBufferDesc pOutput)
|
||||
{
|
||||
int status;
|
||||
int ssl_error;
|
||||
@ -281,7 +281,7 @@ SECURITY_STATUS schannel_openssl_client_process_tokens(SCHANNEL_OPENSSL *context
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
SECURITY_STATUS schannel_openssl_server_process_tokens(SCHANNEL_OPENSSL *context, PSecBufferDesc pInput, PSecBufferDesc pOutput)
|
||||
SECURITY_STATUS schannel_openssl_server_process_tokens(SCHANNEL_OPENSSL* context, PSecBufferDesc pInput, PSecBufferDesc pOutput)
|
||||
{
|
||||
int status;
|
||||
int ssl_error;
|
||||
@ -338,7 +338,7 @@ SECURITY_STATUS schannel_openssl_server_process_tokens(SCHANNEL_OPENSSL *context
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
SECURITY_STATUS schannel_openssl_encrypt_message(SCHANNEL_OPENSSL *context, PSecBufferDesc pMessage)
|
||||
SECURITY_STATUS schannel_openssl_encrypt_message(SCHANNEL_OPENSSL* context, PSecBufferDesc pMessage)
|
||||
{
|
||||
int status;
|
||||
int length;
|
||||
@ -383,11 +383,11 @@ SECURITY_STATUS schannel_openssl_encrypt_message(SCHANNEL_OPENSSL *context, PSec
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
SECURITY_STATUS schannel_openssl_decrypt_message(SCHANNEL_OPENSSL *context, PSecBufferDesc pMessage)
|
||||
SECURITY_STATUS schannel_openssl_decrypt_message(SCHANNEL_OPENSSL* context, PSecBufferDesc pMessage)
|
||||
{
|
||||
int status;
|
||||
int length;
|
||||
BYTE *buffer;
|
||||
BYTE* buffer;
|
||||
int ssl_error;
|
||||
PSecBuffer pBuffer;
|
||||
pBuffer = sspi_FindSecBuffer(pMessage, SECBUFFER_DATA);
|
||||
@ -418,10 +418,10 @@ SECURITY_STATUS schannel_openssl_decrypt_message(SCHANNEL_OPENSSL *context, PSec
|
||||
return SEC_E_OK;
|
||||
}
|
||||
|
||||
SCHANNEL_OPENSSL *schannel_openssl_new()
|
||||
SCHANNEL_OPENSSL* schannel_openssl_new()
|
||||
{
|
||||
SCHANNEL_OPENSSL *context;
|
||||
context = (SCHANNEL_OPENSSL *) malloc(sizeof(SCHANNEL_OPENSSL));
|
||||
SCHANNEL_OPENSSL* context;
|
||||
context = (SCHANNEL_OPENSSL*) malloc(sizeof(SCHANNEL_OPENSSL));
|
||||
|
||||
if (context != NULL)
|
||||
{
|
||||
@ -433,7 +433,7 @@ SCHANNEL_OPENSSL *schannel_openssl_new()
|
||||
return context;
|
||||
}
|
||||
|
||||
void schannel_openssl_free(SCHANNEL_OPENSSL *context)
|
||||
void schannel_openssl_free(SCHANNEL_OPENSSL* context)
|
||||
{
|
||||
if (context)
|
||||
{
|
||||
|
@ -58,9 +58,9 @@ static BYTE TEST_NTLM_AUTHENTICATE[] =
|
||||
|
||||
#define TEST_SSPI_INTERFACE SSPI_INTERFACE_WINPR
|
||||
|
||||
static const char *TEST_NTLM_USER = "Username";
|
||||
static const char *TEST_NTLM_DOMAIN = "Domain";
|
||||
static const char *TEST_NTLM_PASSWORD = "P4ss123!";
|
||||
static const char* TEST_NTLM_USER = "Username";
|
||||
static const char* TEST_NTLM_DOMAIN = "Domain";
|
||||
static const char* TEST_NTLM_PASSWORD = "P4ss123!";
|
||||
|
||||
//static const char* TEST_NTLM_HASH_STRING = "d5922a65c4d5c082ca444af1be0001db";
|
||||
|
||||
@ -92,13 +92,13 @@ struct _TEST_NTLM_CLIENT
|
||||
SecBufferDesc outputBufferDesc;
|
||||
CredHandle credentials;
|
||||
BOOL confidentiality;
|
||||
SecPkgInfo *pPackageInfo;
|
||||
SecurityFunctionTable *table;
|
||||
SecPkgInfo* pPackageInfo;
|
||||
SecurityFunctionTable* table;
|
||||
SEC_WINNT_AUTH_IDENTITY identity;
|
||||
};
|
||||
typedef struct _TEST_NTLM_CLIENT TEST_NTLM_CLIENT;
|
||||
|
||||
int test_ntlm_client_init(TEST_NTLM_CLIENT *ntlm, const char *user, const char *domain, const char *password)
|
||||
int test_ntlm_client_init(TEST_NTLM_CLIENT* ntlm, const char* user, const char* domain, const char* password)
|
||||
{
|
||||
SECURITY_STATUS status;
|
||||
SecInvalidateHandle(&(ntlm->context));
|
||||
@ -140,7 +140,7 @@ int test_ntlm_client_init(TEST_NTLM_CLIENT *ntlm, const char *user, const char *
|
||||
return 1;
|
||||
}
|
||||
|
||||
void test_ntlm_client_uninit(TEST_NTLM_CLIENT *ntlm)
|
||||
void test_ntlm_client_uninit(TEST_NTLM_CLIENT* ntlm)
|
||||
{
|
||||
if (!ntlm)
|
||||
return;
|
||||
@ -202,7 +202,7 @@ void test_ntlm_client_uninit(TEST_NTLM_CLIENT *ntlm)
|
||||
* --------------
|
||||
*/
|
||||
|
||||
int test_ntlm_client_authenticate(TEST_NTLM_CLIENT *ntlm)
|
||||
int test_ntlm_client_authenticate(TEST_NTLM_CLIENT* ntlm)
|
||||
{
|
||||
SECURITY_STATUS status;
|
||||
|
||||
@ -265,10 +265,10 @@ int test_ntlm_client_authenticate(TEST_NTLM_CLIENT *ntlm)
|
||||
return (status == SEC_I_CONTINUE_NEEDED) ? 1 : 0;
|
||||
}
|
||||
|
||||
TEST_NTLM_CLIENT *test_ntlm_client_new()
|
||||
TEST_NTLM_CLIENT* test_ntlm_client_new()
|
||||
{
|
||||
TEST_NTLM_CLIENT *ntlm;
|
||||
ntlm = (TEST_NTLM_CLIENT *) calloc(1, sizeof(TEST_NTLM_CLIENT));
|
||||
TEST_NTLM_CLIENT* ntlm;
|
||||
ntlm = (TEST_NTLM_CLIENT*) calloc(1, sizeof(TEST_NTLM_CLIENT));
|
||||
|
||||
if (!ntlm)
|
||||
return NULL;
|
||||
@ -276,7 +276,7 @@ TEST_NTLM_CLIENT *test_ntlm_client_new()
|
||||
return ntlm;
|
||||
}
|
||||
|
||||
void test_ntlm_client_free(TEST_NTLM_CLIENT *ntlm)
|
||||
void test_ntlm_client_free(TEST_NTLM_CLIENT* ntlm)
|
||||
{
|
||||
if (!ntlm)
|
||||
return;
|
||||
@ -303,13 +303,13 @@ struct _TEST_NTLM_SERVER
|
||||
SecBufferDesc outputBufferDesc;
|
||||
CredHandle credentials;
|
||||
BOOL confidentiality;
|
||||
SecPkgInfo *pPackageInfo;
|
||||
SecurityFunctionTable *table;
|
||||
SecPkgInfo* pPackageInfo;
|
||||
SecurityFunctionTable* table;
|
||||
SEC_WINNT_AUTH_IDENTITY identity;
|
||||
};
|
||||
typedef struct _TEST_NTLM_SERVER TEST_NTLM_SERVER;
|
||||
|
||||
int test_ntlm_server_init(TEST_NTLM_SERVER *ntlm)
|
||||
int test_ntlm_server_init(TEST_NTLM_SERVER* ntlm)
|
||||
{
|
||||
SECURITY_STATUS status;
|
||||
ntlm->UseNtlmV2Hash = TRUE;
|
||||
@ -352,7 +352,7 @@ int test_ntlm_server_init(TEST_NTLM_SERVER *ntlm)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void test_ntlm_server_uninit(TEST_NTLM_SERVER *ntlm)
|
||||
void test_ntlm_server_uninit(TEST_NTLM_SERVER* ntlm)
|
||||
{
|
||||
if (!ntlm)
|
||||
return;
|
||||
@ -376,7 +376,7 @@ void test_ntlm_server_uninit(TEST_NTLM_SERVER *ntlm)
|
||||
}
|
||||
}
|
||||
|
||||
int test_ntlm_server_authenticate(TEST_NTLM_SERVER *ntlm)
|
||||
int test_ntlm_server_authenticate(TEST_NTLM_SERVER* ntlm)
|
||||
{
|
||||
SECURITY_STATUS status;
|
||||
ntlm->inputBufferDesc.ulVersion = SECBUFFER_VERSION;
|
||||
@ -442,10 +442,10 @@ int test_ntlm_server_authenticate(TEST_NTLM_SERVER *ntlm)
|
||||
return (status == SEC_I_CONTINUE_NEEDED) ? 1 : 0;
|
||||
}
|
||||
|
||||
TEST_NTLM_SERVER *test_ntlm_server_new()
|
||||
TEST_NTLM_SERVER* test_ntlm_server_new()
|
||||
{
|
||||
TEST_NTLM_SERVER *ntlm;
|
||||
ntlm = (TEST_NTLM_SERVER *) calloc(1, sizeof(TEST_NTLM_SERVER));
|
||||
TEST_NTLM_SERVER* ntlm;
|
||||
ntlm = (TEST_NTLM_SERVER*) calloc(1, sizeof(TEST_NTLM_SERVER));
|
||||
|
||||
if (!ntlm)
|
||||
return NULL;
|
||||
@ -453,7 +453,7 @@ TEST_NTLM_SERVER *test_ntlm_server_new()
|
||||
return ntlm;
|
||||
}
|
||||
|
||||
void test_ntlm_server_free(TEST_NTLM_SERVER *ntlm)
|
||||
void test_ntlm_server_free(TEST_NTLM_SERVER* ntlm)
|
||||
{
|
||||
if (!ntlm)
|
||||
return;
|
||||
@ -462,12 +462,12 @@ void test_ntlm_server_free(TEST_NTLM_SERVER *ntlm)
|
||||
free(ntlm);
|
||||
}
|
||||
|
||||
int TestNTLM(int argc, char *argv[])
|
||||
int TestNTLM(int argc, char* argv[])
|
||||
{
|
||||
int status;
|
||||
PSecBuffer pSecBuffer;
|
||||
TEST_NTLM_CLIENT *client;
|
||||
TEST_NTLM_SERVER *server;
|
||||
TEST_NTLM_CLIENT* client;
|
||||
TEST_NTLM_SERVER* server;
|
||||
BOOL DynamicTest = TRUE;
|
||||
/**
|
||||
* Client Initialization
|
||||
@ -529,12 +529,12 @@ int TestNTLM(int argc, char *argv[])
|
||||
if (!DynamicTest)
|
||||
{
|
||||
pSecBuffer->cbBuffer = sizeof(TEST_NTLM_NEGOTIATE) -1;
|
||||
pSecBuffer->pvBuffer = (void *) malloc(pSecBuffer->cbBuffer);
|
||||
pSecBuffer->pvBuffer = (void*) malloc(pSecBuffer->cbBuffer);
|
||||
CopyMemory(pSecBuffer->pvBuffer, TEST_NTLM_NEGOTIATE, pSecBuffer->cbBuffer);
|
||||
}
|
||||
|
||||
fprintf(stderr, "NTLM_NEGOTIATE (length = %d):\n", pSecBuffer->cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE *) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE*) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
|
||||
/**
|
||||
* Server <- Negotiate Message
|
||||
* Server -> Challenge Message
|
||||
@ -577,17 +577,17 @@ int TestNTLM(int argc, char *argv[])
|
||||
{
|
||||
SecPkgContext_AuthNtlmMessage AuthNtlmMessage;
|
||||
pSecBuffer->cbBuffer = sizeof(TEST_NTLM_CHALLENGE) -1;
|
||||
pSecBuffer->pvBuffer = (void *) malloc(pSecBuffer->cbBuffer);
|
||||
pSecBuffer->pvBuffer = (void*) malloc(pSecBuffer->cbBuffer);
|
||||
CopyMemory(pSecBuffer->pvBuffer, TEST_NTLM_CHALLENGE, pSecBuffer->cbBuffer);
|
||||
AuthNtlmMessage.type = 2;
|
||||
AuthNtlmMessage.length = pSecBuffer->cbBuffer;
|
||||
AuthNtlmMessage.buffer = (BYTE *) pSecBuffer->pvBuffer;
|
||||
AuthNtlmMessage.buffer = (BYTE*) pSecBuffer->pvBuffer;
|
||||
server->table->SetContextAttributes(&server->context, SECPKG_ATTR_AUTH_NTLM_MESSAGE,
|
||||
&AuthNtlmMessage, sizeof(SecPkgContext_AuthNtlmMessage));
|
||||
}
|
||||
|
||||
fprintf(stderr, "NTLM_CHALLENGE (length = %d):\n", pSecBuffer->cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE *) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE*) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
|
||||
/**
|
||||
* Client <- Challenge Message
|
||||
* Client -> Authenticate Message
|
||||
@ -609,12 +609,12 @@ int TestNTLM(int argc, char *argv[])
|
||||
if (!DynamicTest)
|
||||
{
|
||||
pSecBuffer->cbBuffer = sizeof(TEST_NTLM_AUTHENTICATE) -1;
|
||||
pSecBuffer->pvBuffer = (void *) malloc(pSecBuffer->cbBuffer);
|
||||
pSecBuffer->pvBuffer = (void*) malloc(pSecBuffer->cbBuffer);
|
||||
CopyMemory(pSecBuffer->pvBuffer, TEST_NTLM_AUTHENTICATE, pSecBuffer->cbBuffer);
|
||||
}
|
||||
|
||||
fprintf(stderr, "NTLM_AUTHENTICATE (length = %d):\n", pSecBuffer->cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE *) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE*) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
|
||||
/**
|
||||
* Server <- Authenticate Message
|
||||
*/
|
||||
|
@ -227,11 +227,11 @@ BYTE test_LastDummyMessage[64] =
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
int schannel_send(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phContext, BYTE *buffer, UINT32 length)
|
||||
int schannel_send(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phContext, BYTE* buffer, UINT32 length)
|
||||
{
|
||||
BYTE *ioBuffer;
|
||||
BYTE* ioBuffer;
|
||||
UINT32 ioBufferLength;
|
||||
BYTE *pMessageBuffer;
|
||||
BYTE* pMessageBuffer;
|
||||
SecBuffer Buffers[4];
|
||||
SecBufferDesc Message;
|
||||
SECURITY_STATUS status;
|
||||
@ -240,7 +240,7 @@ int schannel_send(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phCont
|
||||
ZeroMemory(&StreamSizes, sizeof(SecPkgContext_StreamSizes));
|
||||
status = table->QueryContextAttributes(phContext, SECPKG_ATTR_STREAM_SIZES, &StreamSizes);
|
||||
ioBufferLength = StreamSizes.cbHeader + StreamSizes.cbMaximumMessage + StreamSizes.cbTrailer;
|
||||
ioBuffer = (BYTE *) malloc(ioBufferLength);
|
||||
ioBuffer = (BYTE*) malloc(ioBufferLength);
|
||||
ZeroMemory(ioBuffer, ioBufferLength);
|
||||
pMessageBuffer = ioBuffer + StreamSizes.cbHeader;
|
||||
CopyMemory(pMessageBuffer, buffer, length);
|
||||
@ -285,7 +285,7 @@ int schannel_send(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phCont
|
||||
|
||||
int schannel_recv(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phContext)
|
||||
{
|
||||
BYTE *ioBuffer;
|
||||
BYTE* ioBuffer;
|
||||
UINT32 ioBufferLength;
|
||||
//BYTE* pMessageBuffer;
|
||||
SecBuffer Buffers[4];
|
||||
@ -296,7 +296,7 @@ int schannel_recv(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phCont
|
||||
ZeroMemory(&StreamSizes, sizeof(SecPkgContext_StreamSizes));
|
||||
status = table->QueryContextAttributes(phContext, SECPKG_ATTR_STREAM_SIZES, &StreamSizes);
|
||||
ioBufferLength = StreamSizes.cbHeader + StreamSizes.cbMaximumMessage + StreamSizes.cbTrailer;
|
||||
ioBuffer = (BYTE *) malloc(ioBufferLength);
|
||||
ioBuffer = (BYTE*) malloc(ioBufferLength);
|
||||
ZeroMemory(ioBuffer, ioBufferLength);
|
||||
|
||||
if (!ReadFile(hPipe, ioBuffer, ioBufferLength, &NumberOfBytesRead, NULL))
|
||||
@ -332,7 +332,7 @@ int schannel_recv(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phCont
|
||||
return -1;
|
||||
|
||||
printf("Decrypted Message (%d)\n", Message.pBuffers[1].cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE *) Message.pBuffers[1].pvBuffer, Message.pBuffers[1].cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE*) Message.pBuffers[1].pvBuffer, Message.pBuffers[1].cbBuffer);
|
||||
|
||||
if (memcmp(Message.pBuffers[1].pvBuffer, test_LastDummyMessage, sizeof(test_LastDummyMessage)) == 0)
|
||||
return -1;
|
||||
@ -340,11 +340,11 @@ int schannel_recv(PSecurityFunctionTable table, HANDLE hPipe, PCtxtHandle phCont
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *schannel_test_server_thread(void *arg)
|
||||
static void* schannel_test_server_thread(void* arg)
|
||||
{
|
||||
BOOL extraData;
|
||||
BYTE *lpTokenIn;
|
||||
BYTE *lpTokenOut;
|
||||
BYTE* lpTokenIn;
|
||||
BYTE* lpTokenOut;
|
||||
TimeStamp expiry;
|
||||
UINT32 cbMaxToken;
|
||||
UINT32 fContextReq;
|
||||
@ -422,8 +422,8 @@ static void *schannel_test_server_thread(void *arg)
|
||||
|
||||
extraData = FALSE;
|
||||
g_ServerWait = TRUE;
|
||||
lpTokenIn = (BYTE *) malloc(cbMaxToken);
|
||||
lpTokenOut = (BYTE *) malloc(cbMaxToken);
|
||||
lpTokenIn = (BYTE*) malloc(cbMaxToken);
|
||||
lpTokenOut = (BYTE*) malloc(cbMaxToken);
|
||||
fContextReq = ASC_REQ_STREAM |
|
||||
ASC_REQ_SEQUENCE_DETECT | ASC_REQ_REPLAY_DETECT |
|
||||
ASC_REQ_CONFIDENTIALITY | ASC_REQ_EXTENDED_ERROR;
|
||||
@ -503,7 +503,7 @@ static void *schannel_test_server_thread(void *arg)
|
||||
if (pSecBuffer->cbBuffer > 0)
|
||||
{
|
||||
printf("Server > Client (%d)\n", pSecBuffer->cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE *) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE*) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
|
||||
|
||||
if (!WriteFile(g_ClientWritePipe, pSecBuffer->pvBuffer, pSecBuffer->cbBuffer, &NumberOfBytesWritten, NULL))
|
||||
{
|
||||
@ -533,8 +533,8 @@ static void *schannel_test_server_thread(void *arg)
|
||||
|
||||
int dump_test_certificate_files()
|
||||
{
|
||||
FILE *fp;
|
||||
char *fullpath;
|
||||
FILE* fp;
|
||||
char* fullpath;
|
||||
/*
|
||||
* Output Certificate File
|
||||
*/
|
||||
@ -543,7 +543,7 @@ int dump_test_certificate_files()
|
||||
|
||||
if (fp)
|
||||
{
|
||||
fwrite((void *) test_localhost_crt, sizeof(test_localhost_crt), 1, fp);
|
||||
fwrite((void*) test_localhost_crt, sizeof(test_localhost_crt), 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
@ -556,7 +556,7 @@ int dump_test_certificate_files()
|
||||
|
||||
if (fp)
|
||||
{
|
||||
fwrite((void *) test_localhost_key, sizeof(test_localhost_key), 1, fp);
|
||||
fwrite((void*) test_localhost_key, sizeof(test_localhost_key), 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
@ -564,14 +564,14 @@ int dump_test_certificate_files()
|
||||
return 1;
|
||||
}
|
||||
|
||||
int TestSchannel(int argc, char *argv[])
|
||||
int TestSchannel(int argc, char* argv[])
|
||||
{
|
||||
int count;
|
||||
DWORD index;
|
||||
ALG_ID algId;
|
||||
HANDLE thread;
|
||||
BYTE *lpTokenIn;
|
||||
BYTE *lpTokenOut;
|
||||
BYTE* lpTokenIn;
|
||||
BYTE* lpTokenOut;
|
||||
TimeStamp expiry;
|
||||
UINT32 cbMaxToken;
|
||||
SCHANNEL_CRED cred;
|
||||
@ -691,8 +691,8 @@ int TestSchannel(int argc, char *argv[])
|
||||
ISC_REQ_SEQUENCE_DETECT | ISC_REQ_REPLAY_DETECT |
|
||||
ISC_REQ_CONFIDENTIALITY | ISC_RET_EXTENDED_ERROR |
|
||||
ISC_REQ_MANUAL_CRED_VALIDATION | ISC_REQ_INTEGRITY;
|
||||
lpTokenIn = (BYTE *) malloc(cbMaxToken);
|
||||
lpTokenOut = (BYTE *) malloc(cbMaxToken);
|
||||
lpTokenIn = (BYTE*) malloc(cbMaxToken);
|
||||
lpTokenOut = (BYTE*) malloc(cbMaxToken);
|
||||
ZeroMemory(&SecBuffer_in, sizeof(SecBuffer_in));
|
||||
ZeroMemory(&SecBuffer_out, sizeof(SecBuffer_out));
|
||||
ZeroMemory(&SecBufferDesc_in, sizeof(SecBufferDesc));
|
||||
@ -762,7 +762,7 @@ int TestSchannel(int argc, char *argv[])
|
||||
if (pSecBuffer->cbBuffer > 0)
|
||||
{
|
||||
printf("Client > Server (%d)\n", pSecBuffer->cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE *) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
|
||||
winpr_HexDump("sspi.test", WLOG_DEBUG, (BYTE*) pSecBuffer->pvBuffer, pSecBuffer->cbBuffer);
|
||||
|
||||
if (!WriteFile(g_ServerWritePipe, pSecBuffer->pvBuffer, pSecBuffer->cbBuffer, &NumberOfBytesWritten, NULL))
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ BOOL InitializeCriticalSectionEx(LPCRITICAL_SECTION lpCriticalSection, DWORD dwS
|
||||
lpCriticalSection->SpinCount = 0;
|
||||
lpCriticalSection->RecursionCount = 0;
|
||||
lpCriticalSection->OwningThread = NULL;
|
||||
lpCriticalSection->LockSemaphore = (winpr_sem_t *) malloc(sizeof(winpr_sem_t));
|
||||
lpCriticalSection->LockSemaphore = (winpr_sem_t*) malloc(sizeof(winpr_sem_t));
|
||||
#if defined(__APPLE__)
|
||||
semaphore_create(mach_task_self(), lpCriticalSection->LockSemaphore, SYNC_POLICY_FIFO, 0);
|
||||
#else
|
||||
@ -106,18 +106,18 @@ DWORD SetCriticalSectionSpinCount(LPCRITICAL_SECTION lpCriticalSection, DWORD dw
|
||||
static VOID _WaitForCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
semaphore_wait(*((winpr_sem_t *) lpCriticalSection->LockSemaphore));
|
||||
semaphore_wait(*((winpr_sem_t*) lpCriticalSection->LockSemaphore));
|
||||
#else
|
||||
sem_wait((winpr_sem_t *) lpCriticalSection->LockSemaphore);
|
||||
sem_wait((winpr_sem_t*) lpCriticalSection->LockSemaphore);
|
||||
#endif
|
||||
}
|
||||
|
||||
static VOID _UnWaitCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
{
|
||||
#if defined __APPLE__
|
||||
semaphore_signal(*((winpr_sem_t *) lpCriticalSection->LockSemaphore));
|
||||
semaphore_signal(*((winpr_sem_t*) lpCriticalSection->LockSemaphore));
|
||||
#else
|
||||
sem_post((winpr_sem_t *) lpCriticalSection->LockSemaphore);
|
||||
sem_post((winpr_sem_t*) lpCriticalSection->LockSemaphore);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -229,9 +229,9 @@ VOID DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
if (lpCriticalSection->LockSemaphore != NULL)
|
||||
{
|
||||
#if defined __APPLE__
|
||||
semaphore_destroy(mach_task_self(), *((winpr_sem_t *) lpCriticalSection->LockSemaphore));
|
||||
semaphore_destroy(mach_task_self(), *((winpr_sem_t*) lpCriticalSection->LockSemaphore));
|
||||
#else
|
||||
sem_destroy((winpr_sem_t *) lpCriticalSection->LockSemaphore);
|
||||
sem_destroy((winpr_sem_t*) lpCriticalSection->LockSemaphore);
|
||||
#endif
|
||||
free(lpCriticalSection->LockSemaphore);
|
||||
lpCriticalSection->LockSemaphore = NULL;
|
||||
@ -242,7 +242,7 @@ VOID DeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
|
||||
|
||||
#if (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
|
||||
|
||||
typedef BOOL (WINAPI *PINITIALIZE_CRITICAL_SECTION_EX_FN)(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags);
|
||||
typedef BOOL (WINAPI* PINITIALIZE_CRITICAL_SECTION_EX_FN)(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount, DWORD Flags);
|
||||
|
||||
static HMODULE g_KERNEL32_Library = NULL;
|
||||
static BOOL g_InitializeCriticalSectionEx_Detected = FALSE;
|
||||
|
@ -50,9 +50,9 @@ CRITICAL_SECTION cs = { NULL, 0, 0, NULL, NULL, 0 };
|
||||
|
||||
HANDLE CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName)
|
||||
{
|
||||
WINPR_EVENT *event;
|
||||
WINPR_EVENT* event;
|
||||
HANDLE handle = NULL;
|
||||
event = (WINPR_EVENT *) malloc(sizeof(WINPR_EVENT));
|
||||
event = (WINPR_EVENT*) malloc(sizeof(WINPR_EVENT));
|
||||
|
||||
if (event)
|
||||
{
|
||||
@ -144,12 +144,12 @@ BOOL SetEvent(HANDLE hEvent)
|
||||
PVOID Object;
|
||||
int length;
|
||||
BOOL status;
|
||||
WINPR_EVENT *event;
|
||||
WINPR_EVENT* event;
|
||||
status = FALSE;
|
||||
|
||||
if (winpr_Handle_GetInfo(hEvent, &Type, &Object))
|
||||
{
|
||||
event = (WINPR_EVENT *) Object;
|
||||
event = (WINPR_EVENT*) Object;
|
||||
#ifdef HAVE_EVENTFD_H
|
||||
eventfd_t val = 1;
|
||||
|
||||
@ -186,12 +186,12 @@ BOOL ResetEvent(HANDLE hEvent)
|
||||
PVOID Object;
|
||||
int length;
|
||||
BOOL status;
|
||||
WINPR_EVENT *event;
|
||||
WINPR_EVENT* event;
|
||||
status = FALSE;
|
||||
|
||||
if (winpr_Handle_GetInfo(hEvent, &Type, &Object))
|
||||
{
|
||||
event = (WINPR_EVENT *) Object;
|
||||
event = (WINPR_EVENT*) Object;
|
||||
|
||||
while (WaitForSingleObject(hEvent, 0) == WAIT_OBJECT_0)
|
||||
{
|
||||
@ -225,9 +225,9 @@ BOOL ResetEvent(HANDLE hEvent)
|
||||
HANDLE CreateFileDescriptorEventW(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, int FileDescriptor)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
WINPR_EVENT *event;
|
||||
WINPR_EVENT* event;
|
||||
HANDLE handle = NULL;
|
||||
event = (WINPR_EVENT *) malloc(sizeof(WINPR_EVENT));
|
||||
event = (WINPR_EVENT*) malloc(sizeof(WINPR_EVENT));
|
||||
|
||||
if (event)
|
||||
{
|
||||
@ -254,7 +254,7 @@ HANDLE CreateFileDescriptorEventA(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL
|
||||
* Returns an event based on the handle returned by GetEventWaitObject()
|
||||
*/
|
||||
HANDLE CreateWaitObjectEvent(LPSECURITY_ATTRIBUTES lpEventAttributes,
|
||||
BOOL bManualReset, BOOL bInitialState, void *pObject)
|
||||
BOOL bManualReset, BOOL bInitialState, void* pObject)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
return CreateFileDescriptorEventW(lpEventAttributes, bManualReset, bInitialState, (int)(ULONG_PTR) pObject);
|
||||
@ -275,16 +275,16 @@ int GetEventFileDescriptor(HANDLE hEvent)
|
||||
#ifndef _WIN32
|
||||
ULONG Type;
|
||||
PVOID Object;
|
||||
WINPR_EVENT *event;
|
||||
WINPR_EVENT* event;
|
||||
|
||||
if (!winpr_Handle_GetInfo(hEvent, &Type, &Object))
|
||||
return -1;
|
||||
|
||||
event = (WINPR_EVENT *) Object;
|
||||
event = (WINPR_EVENT*) Object;
|
||||
|
||||
if (Type == HANDLE_TYPE_NAMED_PIPE)
|
||||
{
|
||||
WINPR_NAMED_PIPE *named = (WINPR_NAMED_PIPE *)hEvent;
|
||||
WINPR_NAMED_PIPE* named = (WINPR_NAMED_PIPE*)hEvent;
|
||||
|
||||
if (named->ServerMode)
|
||||
{
|
||||
@ -312,12 +312,12 @@ int SetEventFileDescriptor(HANDLE hEvent, int FileDescriptor)
|
||||
#ifndef _WIN32
|
||||
ULONG Type;
|
||||
PVOID Object;
|
||||
WINPR_EVENT *event;
|
||||
WINPR_EVENT* event;
|
||||
|
||||
if (!winpr_Handle_GetInfo(hEvent, &Type, &Object))
|
||||
return -1;
|
||||
|
||||
event = (WINPR_EVENT *) Object;
|
||||
event = (WINPR_EVENT*) Object;
|
||||
event->pipe_fd[0] = FileDescriptor;
|
||||
return 0;
|
||||
#else
|
||||
@ -335,13 +335,13 @@ int SetEventFileDescriptor(HANDLE hEvent, int FileDescriptor)
|
||||
* to obtain a file descriptor usable in select()
|
||||
*/
|
||||
|
||||
void *GetEventWaitObject(HANDLE hEvent)
|
||||
void* GetEventWaitObject(HANDLE hEvent)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
int fd;
|
||||
void *obj;
|
||||
void* obj;
|
||||
fd = GetEventFileDescriptor(hEvent);
|
||||
obj = ((void *)(long) fd);
|
||||
obj = ((void*)(long) fd);
|
||||
return obj;
|
||||
#else
|
||||
return hEvent;
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#if (!defined(_WIN32)) || (defined(_WIN32) && (_WIN32_WINNT < 0x0600))
|
||||
|
||||
BOOL InitOnceBeginInitialize(LPINIT_ONCE lpInitOnce, DWORD dwFlags, PBOOL fPending, LPVOID *lpContext)
|
||||
BOOL InitOnceBeginInitialize(LPINIT_ONCE lpInitOnce, DWORD dwFlags, PBOOL fPending, LPVOID* lpContext)
|
||||
{
|
||||
WLog_ERR(TAG, "not implemented");
|
||||
return FALSE;
|
||||
@ -48,7 +48,7 @@ VOID InitOnceInitialize(PINIT_ONCE InitOnce)
|
||||
WLog_ERR(TAG, "not implemented");
|
||||
}
|
||||
|
||||
BOOL InitOnceExecuteOnce(PINIT_ONCE InitOnce, PINIT_ONCE_FN InitFn, PVOID Parameter, LPVOID *Context)
|
||||
BOOL InitOnceExecuteOnce(PINIT_ONCE InitOnce, PINIT_ONCE_FN InitFn, PVOID Parameter, LPVOID* Context)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
|
@ -38,15 +38,15 @@
|
||||
HANDLE CreateSemaphoreW(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName)
|
||||
{
|
||||
HANDLE handle;
|
||||
WINPR_SEMAPHORE *semaphore;
|
||||
semaphore = (WINPR_SEMAPHORE *) malloc(sizeof(WINPR_SEMAPHORE));
|
||||
WINPR_SEMAPHORE* semaphore;
|
||||
semaphore = (WINPR_SEMAPHORE*) malloc(sizeof(WINPR_SEMAPHORE));
|
||||
|
||||
if (!semaphore)
|
||||
return NULL;
|
||||
|
||||
semaphore->pipe_fd[0] = -1;
|
||||
semaphore->pipe_fd[0] = -1;
|
||||
semaphore->sem = (winpr_sem_t *) NULL;
|
||||
semaphore->sem = (winpr_sem_t*) NULL;
|
||||
|
||||
if (semaphore)
|
||||
{
|
||||
@ -73,7 +73,7 @@ HANDLE CreateSemaphoreW(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lIniti
|
||||
}
|
||||
|
||||
#else
|
||||
semaphore->sem = (winpr_sem_t *) malloc(sizeof(winpr_sem_t));
|
||||
semaphore->sem = (winpr_sem_t*) malloc(sizeof(winpr_sem_t));
|
||||
#if defined __APPLE__
|
||||
semaphore_create(mach_task_self(), semaphore->sem, SYNC_POLICY_FIFO, lMaximumCount);
|
||||
#else
|
||||
@ -108,14 +108,14 @@ BOOL ReleaseSemaphore(HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCo
|
||||
{
|
||||
ULONG Type;
|
||||
PVOID Object;
|
||||
WINPR_SEMAPHORE *semaphore;
|
||||
WINPR_SEMAPHORE* semaphore;
|
||||
|
||||
if (!winpr_Handle_GetInfo(hSemaphore, &Type, &Object))
|
||||
return FALSE;
|
||||
|
||||
if (Type == HANDLE_TYPE_SEMAPHORE)
|
||||
{
|
||||
semaphore = (WINPR_SEMAPHORE *) Object;
|
||||
semaphore = (WINPR_SEMAPHORE*) Object;
|
||||
#ifdef WINPR_PIPE_SEMAPHORE
|
||||
|
||||
if (semaphore->pipe_fd[0] != -1)
|
||||
@ -131,9 +131,9 @@ BOOL ReleaseSemaphore(HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCo
|
||||
|
||||
#else
|
||||
#if defined __APPLE__
|
||||
semaphore_signal(*((winpr_sem_t *) semaphore->sem));
|
||||
semaphore_signal(*((winpr_sem_t*) semaphore->sem));
|
||||
#else
|
||||
sem_post((winpr_sem_t *) semaphore->sem);
|
||||
sem_post((winpr_sem_t*) semaphore->sem);
|
||||
#endif
|
||||
#endif
|
||||
return TRUE;
|
||||
|
@ -46,9 +46,9 @@
|
||||
|
||||
static BOOL g_WaitableTimerSignalHandlerInstalled = FALSE;
|
||||
|
||||
void WaitableTimerSignalHandler(int signum, siginfo_t *siginfo, void *arg)
|
||||
void WaitableTimerSignalHandler(int signum, siginfo_t* siginfo, void* arg)
|
||||
{
|
||||
WINPR_TIMER *timer = siginfo->si_value.sival_ptr;
|
||||
WINPR_TIMER* timer = siginfo->si_value.sival_ptr;
|
||||
|
||||
if (!timer || (signum != SIGALRM))
|
||||
return;
|
||||
@ -78,7 +78,7 @@ int InstallWaitableTimerSignalHandler()
|
||||
sigemptyset(&action.sa_mask);
|
||||
sigaddset(&action.sa_mask, SIGALRM);
|
||||
action.sa_flags = SA_RESTART | SA_SIGINFO;
|
||||
action.sa_sigaction = (void *) &WaitableTimerSignalHandler;
|
||||
action.sa_sigaction = (void*) &WaitableTimerSignalHandler;
|
||||
sigaction(SIGALRM, &action, NULL);
|
||||
g_WaitableTimerSignalHandlerInstalled = TRUE;
|
||||
}
|
||||
@ -88,7 +88,7 @@ int InstallWaitableTimerSignalHandler()
|
||||
|
||||
#endif
|
||||
|
||||
int InitializeWaitableTimer(WINPR_TIMER *timer)
|
||||
int InitializeWaitableTimer(WINPR_TIMER* timer)
|
||||
{
|
||||
if (!timer->lpArgToCompletionRoutine)
|
||||
{
|
||||
@ -120,7 +120,7 @@ int InitializeWaitableTimer(WINPR_TIMER *timer)
|
||||
ZeroMemory(&sigev, sizeof(struct sigevent));
|
||||
sigev.sigev_notify = SIGEV_SIGNAL;
|
||||
sigev.sigev_signo = SIGALRM;
|
||||
sigev.sigev_value.sival_ptr = (void *) timer;
|
||||
sigev.sigev_value.sival_ptr = (void*) timer;
|
||||
|
||||
if ((timer_create(CLOCK_MONOTONIC, &sigev, &(timer->tid))) != 0)
|
||||
{
|
||||
@ -142,8 +142,8 @@ int InitializeWaitableTimer(WINPR_TIMER *timer)
|
||||
HANDLE CreateWaitableTimerA(LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCSTR lpTimerName)
|
||||
{
|
||||
HANDLE handle = NULL;
|
||||
WINPR_TIMER *timer;
|
||||
timer = (WINPR_TIMER *) malloc(sizeof(WINPR_TIMER));
|
||||
WINPR_TIMER* timer;
|
||||
timer = (WINPR_TIMER*) malloc(sizeof(WINPR_TIMER));
|
||||
|
||||
if (timer)
|
||||
{
|
||||
@ -177,12 +177,12 @@ HANDLE CreateWaitableTimerExW(LPSECURITY_ATTRIBUTES lpTimerAttributes, LPCWSTR l
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL SetWaitableTimer(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod,
|
||||
BOOL SetWaitableTimer(HANDLE hTimer, const LARGE_INTEGER* lpDueTime, LONG lPeriod,
|
||||
PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, BOOL fResume)
|
||||
{
|
||||
ULONG Type;
|
||||
PVOID Object;
|
||||
WINPR_TIMER *timer;
|
||||
WINPR_TIMER* timer;
|
||||
#ifdef WITH_POSIX_TIMER
|
||||
LONGLONG seconds = 0;
|
||||
LONGLONG nanoseconds = 0;
|
||||
@ -203,7 +203,7 @@ BOOL SetWaitableTimer(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPerio
|
||||
if (lPeriod < 0)
|
||||
return FALSE;
|
||||
|
||||
timer = (WINPR_TIMER *) Object;
|
||||
timer = (WINPR_TIMER*) Object;
|
||||
timer->lPeriod = lPeriod; /* milliseconds */
|
||||
timer->pfnCompletionRoutine = pfnCompletionRoutine;
|
||||
timer->lpArgToCompletionRoutine = lpArgToCompletionRoutine;
|
||||
@ -277,19 +277,19 @@ BOOL SetWaitableTimer(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPerio
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL SetWaitableTimerEx(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod,
|
||||
BOOL SetWaitableTimerEx(HANDLE hTimer, const LARGE_INTEGER* lpDueTime, LONG lPeriod,
|
||||
PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, PREASON_CONTEXT WakeContext, ULONG TolerableDelay)
|
||||
{
|
||||
ULONG Type;
|
||||
PVOID Object;
|
||||
WINPR_TIMER *timer;
|
||||
WINPR_TIMER* timer;
|
||||
|
||||
if (!winpr_Handle_GetInfo(hTimer, &Type, &Object))
|
||||
return FALSE;
|
||||
|
||||
if (Type == HANDLE_TYPE_TIMER)
|
||||
{
|
||||
timer = (WINPR_TIMER *) Object;
|
||||
timer = (WINPR_TIMER*) Object;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -320,14 +320,14 @@ BOOL CancelWaitableTimer(HANDLE hTimer)
|
||||
* http://www.cs.wustl.edu/~schmidt/Timer_Queue.html
|
||||
*/
|
||||
|
||||
void timespec_add_ms(struct timespec *tspec, UINT32 ms)
|
||||
void timespec_add_ms(struct timespec* tspec, UINT32 ms)
|
||||
{
|
||||
UINT64 ns = tspec->tv_nsec + (ms * 1000000);
|
||||
tspec->tv_sec += (ns / 1000000000);
|
||||
tspec->tv_nsec = (ns % 1000000000);
|
||||
}
|
||||
|
||||
UINT64 timespec_to_ms(struct timespec *tspec)
|
||||
UINT64 timespec_to_ms(struct timespec* tspec)
|
||||
{
|
||||
UINT64 ms;
|
||||
ms = tspec->tv_sec * 1000;
|
||||
@ -335,7 +335,7 @@ UINT64 timespec_to_ms(struct timespec *tspec)
|
||||
return ms;
|
||||
}
|
||||
|
||||
static void timespec_gettimeofday(struct timespec *tspec)
|
||||
static void timespec_gettimeofday(struct timespec* tspec)
|
||||
{
|
||||
struct timeval tval;
|
||||
gettimeofday(&tval, NULL);
|
||||
@ -343,7 +343,7 @@ static void timespec_gettimeofday(struct timespec *tspec)
|
||||
tspec->tv_nsec = tval.tv_usec * 1000;
|
||||
}
|
||||
|
||||
static int timespec_compare(const struct timespec *tspec1, const struct timespec *tspec2)
|
||||
static int timespec_compare(const struct timespec* tspec1, const struct timespec* tspec2)
|
||||
{
|
||||
if (tspec1->tv_sec == tspec2->tv_sec)
|
||||
return (tspec1->tv_nsec - tspec2->tv_nsec);
|
||||
@ -351,15 +351,15 @@ static int timespec_compare(const struct timespec *tspec1, const struct timespec
|
||||
return (tspec1->tv_sec - tspec2->tv_sec);
|
||||
}
|
||||
|
||||
static void timespec_copy(struct timespec *dst, struct timespec *src)
|
||||
static void timespec_copy(struct timespec* dst, struct timespec* src)
|
||||
{
|
||||
dst->tv_sec = src->tv_sec;
|
||||
dst->tv_nsec = src->tv_nsec;
|
||||
}
|
||||
|
||||
void InsertTimerQueueTimer(WINPR_TIMER_QUEUE_TIMER **pHead, WINPR_TIMER_QUEUE_TIMER *timer)
|
||||
void InsertTimerQueueTimer(WINPR_TIMER_QUEUE_TIMER** pHead, WINPR_TIMER_QUEUE_TIMER* timer)
|
||||
{
|
||||
WINPR_TIMER_QUEUE_TIMER *node;
|
||||
WINPR_TIMER_QUEUE_TIMER* node;
|
||||
|
||||
if (!(*pHead))
|
||||
{
|
||||
@ -393,11 +393,11 @@ void InsertTimerQueueTimer(WINPR_TIMER_QUEUE_TIMER **pHead, WINPR_TIMER_QUEUE_TI
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveTimerQueueTimer(WINPR_TIMER_QUEUE_TIMER **pHead, WINPR_TIMER_QUEUE_TIMER *timer)
|
||||
void RemoveTimerQueueTimer(WINPR_TIMER_QUEUE_TIMER** pHead, WINPR_TIMER_QUEUE_TIMER* timer)
|
||||
{
|
||||
BOOL found = FALSE;
|
||||
WINPR_TIMER_QUEUE_TIMER *node;
|
||||
WINPR_TIMER_QUEUE_TIMER *prevNode;
|
||||
WINPR_TIMER_QUEUE_TIMER* node;
|
||||
WINPR_TIMER_QUEUE_TIMER* prevNode;
|
||||
|
||||
if (timer == *pHead)
|
||||
{
|
||||
@ -432,10 +432,10 @@ void RemoveTimerQueueTimer(WINPR_TIMER_QUEUE_TIMER **pHead, WINPR_TIMER_QUEUE_TI
|
||||
}
|
||||
}
|
||||
|
||||
int FireExpiredTimerQueueTimers(WINPR_TIMER_QUEUE *timerQueue)
|
||||
int FireExpiredTimerQueueTimers(WINPR_TIMER_QUEUE* timerQueue)
|
||||
{
|
||||
struct timespec CurrentTime;
|
||||
WINPR_TIMER_QUEUE_TIMER *node;
|
||||
WINPR_TIMER_QUEUE_TIMER* node;
|
||||
|
||||
if (!timerQueue->activeHead)
|
||||
return 0;
|
||||
@ -473,11 +473,11 @@ int FireExpiredTimerQueueTimers(WINPR_TIMER_QUEUE *timerQueue)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *TimerQueueThread(void *arg)
|
||||
static void* TimerQueueThread(void* arg)
|
||||
{
|
||||
int status;
|
||||
struct timespec timeout;
|
||||
WINPR_TIMER_QUEUE *timerQueue = (WINPR_TIMER_QUEUE *) arg;
|
||||
WINPR_TIMER_QUEUE* timerQueue = (WINPR_TIMER_QUEUE*) arg;
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -507,7 +507,7 @@ static void *TimerQueueThread(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int StartTimerQueueThread(WINPR_TIMER_QUEUE *timerQueue)
|
||||
int StartTimerQueueThread(WINPR_TIMER_QUEUE* timerQueue)
|
||||
{
|
||||
pthread_cond_init(&(timerQueue->cond), NULL);
|
||||
pthread_mutex_init(&(timerQueue->cond_mutex), NULL);
|
||||
@ -523,8 +523,8 @@ int StartTimerQueueThread(WINPR_TIMER_QUEUE *timerQueue)
|
||||
HANDLE CreateTimerQueue(void)
|
||||
{
|
||||
HANDLE handle = NULL;
|
||||
WINPR_TIMER_QUEUE *timerQueue;
|
||||
timerQueue = (WINPR_TIMER_QUEUE *) malloc(sizeof(WINPR_TIMER_QUEUE));
|
||||
WINPR_TIMER_QUEUE* timerQueue;
|
||||
timerQueue = (WINPR_TIMER_QUEUE*) malloc(sizeof(WINPR_TIMER_QUEUE));
|
||||
|
||||
if (timerQueue)
|
||||
{
|
||||
@ -542,15 +542,15 @@ HANDLE CreateTimerQueue(void)
|
||||
|
||||
BOOL DeleteTimerQueueEx(HANDLE TimerQueue, HANDLE CompletionEvent)
|
||||
{
|
||||
void *rvalue;
|
||||
WINPR_TIMER_QUEUE *timerQueue;
|
||||
WINPR_TIMER_QUEUE_TIMER *node;
|
||||
WINPR_TIMER_QUEUE_TIMER *nextNode;
|
||||
void* rvalue;
|
||||
WINPR_TIMER_QUEUE* timerQueue;
|
||||
WINPR_TIMER_QUEUE_TIMER* node;
|
||||
WINPR_TIMER_QUEUE_TIMER* nextNode;
|
||||
|
||||
if (!TimerQueue)
|
||||
return FALSE;
|
||||
|
||||
timerQueue = (WINPR_TIMER_QUEUE *) TimerQueue;
|
||||
timerQueue = (WINPR_TIMER_QUEUE*) TimerQueue;
|
||||
/* Cancel and delete timer queue timers */
|
||||
pthread_mutex_lock(&(timerQueue->cond_mutex));
|
||||
timerQueue->bCancelled = TRUE;
|
||||
@ -610,21 +610,21 @@ BOOL CreateTimerQueueTimer(PHANDLE phNewTimer, HANDLE TimerQueue,
|
||||
WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, ULONG Flags)
|
||||
{
|
||||
struct timespec CurrentTime;
|
||||
WINPR_TIMER_QUEUE *timerQueue;
|
||||
WINPR_TIMER_QUEUE_TIMER *timer;
|
||||
WINPR_TIMER_QUEUE* timerQueue;
|
||||
WINPR_TIMER_QUEUE_TIMER* timer;
|
||||
|
||||
if (!TimerQueue)
|
||||
return FALSE;
|
||||
|
||||
timespec_gettimeofday(&CurrentTime);
|
||||
timerQueue = (WINPR_TIMER_QUEUE *) TimerQueue;
|
||||
timer = (WINPR_TIMER_QUEUE_TIMER *) malloc(sizeof(WINPR_TIMER_QUEUE_TIMER));
|
||||
timerQueue = (WINPR_TIMER_QUEUE*) TimerQueue;
|
||||
timer = (WINPR_TIMER_QUEUE_TIMER*) malloc(sizeof(WINPR_TIMER_QUEUE_TIMER));
|
||||
|
||||
if (!timer)
|
||||
return FALSE;
|
||||
|
||||
WINPR_HANDLE_SET_TYPE(timer, HANDLE_TYPE_TIMER_QUEUE_TIMER);
|
||||
*((UINT_PTR *) phNewTimer) = (UINT_PTR)(HANDLE) timer;
|
||||
*((UINT_PTR*) phNewTimer) = (UINT_PTR)(HANDLE) timer;
|
||||
timespec_copy(&(timer->StartTime), &CurrentTime);
|
||||
timespec_add_ms(&(timer->StartTime), DueTime);
|
||||
timespec_copy(&(timer->ExpirationTime), &(timer->StartTime));
|
||||
@ -633,7 +633,7 @@ BOOL CreateTimerQueueTimer(PHANDLE phNewTimer, HANDLE TimerQueue,
|
||||
timer->Period = Period;
|
||||
timer->Callback = Callback;
|
||||
timer->Parameter = Parameter;
|
||||
timer->timerQueue = (WINPR_TIMER_QUEUE *) TimerQueue;
|
||||
timer->timerQueue = (WINPR_TIMER_QUEUE*) TimerQueue;
|
||||
timer->FireCount = 0;
|
||||
timer->next = NULL;
|
||||
pthread_mutex_lock(&(timerQueue->cond_mutex));
|
||||
@ -646,15 +646,15 @@ BOOL CreateTimerQueueTimer(PHANDLE phNewTimer, HANDLE TimerQueue,
|
||||
BOOL ChangeTimerQueueTimer(HANDLE TimerQueue, HANDLE Timer, ULONG DueTime, ULONG Period)
|
||||
{
|
||||
struct timespec CurrentTime;
|
||||
WINPR_TIMER_QUEUE *timerQueue;
|
||||
WINPR_TIMER_QUEUE_TIMER *timer;
|
||||
WINPR_TIMER_QUEUE* timerQueue;
|
||||
WINPR_TIMER_QUEUE_TIMER* timer;
|
||||
|
||||
if (!TimerQueue || !Timer)
|
||||
return FALSE;
|
||||
|
||||
timespec_gettimeofday(&CurrentTime);
|
||||
timerQueue = (WINPR_TIMER_QUEUE *) TimerQueue;
|
||||
timer = (WINPR_TIMER_QUEUE_TIMER *) Timer;
|
||||
timerQueue = (WINPR_TIMER_QUEUE*) TimerQueue;
|
||||
timer = (WINPR_TIMER_QUEUE_TIMER*) Timer;
|
||||
pthread_mutex_lock(&(timerQueue->cond_mutex));
|
||||
RemoveTimerQueueTimer(&(timerQueue->activeHead), timer);
|
||||
RemoveTimerQueueTimer(&(timerQueue->inactiveHead), timer);
|
||||
@ -672,14 +672,14 @@ BOOL ChangeTimerQueueTimer(HANDLE TimerQueue, HANDLE Timer, ULONG DueTime, ULONG
|
||||
|
||||
BOOL DeleteTimerQueueTimer(HANDLE TimerQueue, HANDLE Timer, HANDLE CompletionEvent)
|
||||
{
|
||||
WINPR_TIMER_QUEUE *timerQueue;
|
||||
WINPR_TIMER_QUEUE_TIMER *timer;
|
||||
WINPR_TIMER_QUEUE* timerQueue;
|
||||
WINPR_TIMER_QUEUE_TIMER* timer;
|
||||
|
||||
if (!TimerQueue || !Timer)
|
||||
return FALSE;
|
||||
|
||||
timerQueue = (WINPR_TIMER_QUEUE *) TimerQueue;
|
||||
timer = (WINPR_TIMER_QUEUE_TIMER *) Timer;
|
||||
timerQueue = (WINPR_TIMER_QUEUE*) TimerQueue;
|
||||
timer = (WINPR_TIMER_QUEUE_TIMER*) Timer;
|
||||
pthread_mutex_lock(&(timerQueue->cond_mutex));
|
||||
|
||||
if (CompletionEvent == INVALID_HANDLE_VALUE)
|
||||
|
@ -76,7 +76,7 @@
|
||||
#define CLOCK_REALTIME 0
|
||||
#define CLOCK_MONOTONIC 0
|
||||
|
||||
int clock_gettime(int clk_id, struct timespec *t)
|
||||
int clock_gettime(int clk_id, struct timespec* t)
|
||||
{
|
||||
UINT64 time;
|
||||
double seconds;
|
||||
@ -99,16 +99,16 @@ int clock_gettime(int clk_id, struct timespec *t)
|
||||
#if !defined(HAVE_PTHREAD_GNU_EXT)
|
||||
#include <pthread.h>
|
||||
|
||||
static long long ts_difftime(const struct timespec *o,
|
||||
const struct timespec *n)
|
||||
static long long ts_difftime(const struct timespec* o,
|
||||
const struct timespec* n)
|
||||
{
|
||||
long long oldValue = o->tv_sec * 1000000000LL + o->tv_nsec;
|
||||
long long newValue = n->tv_sec * 1000000000LL + n->tv_nsec;
|
||||
return newValue - oldValue;
|
||||
}
|
||||
|
||||
static int pthread_timedjoin_np(pthread_t td, void **res,
|
||||
struct timespec *timeout)
|
||||
static int pthread_timedjoin_np(pthread_t td, void** res,
|
||||
struct timespec* timeout)
|
||||
{
|
||||
struct timespec timenow;
|
||||
struct timespec sleepytime;
|
||||
@ -136,9 +136,9 @@ static int pthread_timedjoin_np(pthread_t td, void **res,
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
/*the only way to get it work is to remove the static*/
|
||||
int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *timeout)
|
||||
int pthread_mutex_timedlock(pthread_mutex_t* mutex, const struct timespec* timeout)
|
||||
#else
|
||||
static int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *timeout)
|
||||
static int pthread_mutex_timedlock(pthread_mutex_t* mutex, const struct timespec* timeout)
|
||||
#endif
|
||||
{
|
||||
struct timespec timenow;
|
||||
@ -164,7 +164,7 @@ static int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec
|
||||
}
|
||||
#endif
|
||||
|
||||
static void ts_add_ms(struct timespec *ts, DWORD dwMilliseconds)
|
||||
static void ts_add_ms(struct timespec* ts, DWORD dwMilliseconds)
|
||||
{
|
||||
ts->tv_sec += dwMilliseconds / 1000L;
|
||||
ts->tv_nsec += (dwMilliseconds % 1000L) * 1000000L;
|
||||
@ -224,9 +224,9 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
|
||||
if (Type == HANDLE_TYPE_THREAD)
|
||||
{
|
||||
int status = 0;
|
||||
WINPR_THREAD *thread;
|
||||
void *thread_status = NULL;
|
||||
thread = (WINPR_THREAD *) Object;
|
||||
WINPR_THREAD* thread;
|
||||
void* thread_status = NULL;
|
||||
thread = (WINPR_THREAD*) Object;
|
||||
|
||||
if (thread->started)
|
||||
{
|
||||
@ -263,8 +263,8 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_PROCESS)
|
||||
{
|
||||
WINPR_PROCESS *process;
|
||||
process = (WINPR_PROCESS *) Object;
|
||||
WINPR_PROCESS* process;
|
||||
process = (WINPR_PROCESS*) Object;
|
||||
|
||||
if (waitpid(process->pid, &(process->status), 0) != -1)
|
||||
{
|
||||
@ -276,8 +276,8 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_MUTEX)
|
||||
{
|
||||
WINPR_MUTEX *mutex;
|
||||
mutex = (WINPR_MUTEX *) Object;
|
||||
WINPR_MUTEX* mutex;
|
||||
mutex = (WINPR_MUTEX*) Object;
|
||||
|
||||
if (dwMilliseconds != INFINITE)
|
||||
{
|
||||
@ -298,8 +298,8 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
|
||||
else if (Type == HANDLE_TYPE_EVENT)
|
||||
{
|
||||
int status;
|
||||
WINPR_EVENT *event;
|
||||
event = (WINPR_EVENT *) Object;
|
||||
WINPR_EVENT* event;
|
||||
event = (WINPR_EVENT*) Object;
|
||||
status = waitOnFd(event->pipe_fd[0], dwMilliseconds);
|
||||
|
||||
if (status < 0)
|
||||
@ -313,8 +313,8 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_SEMAPHORE)
|
||||
{
|
||||
WINPR_SEMAPHORE *semaphore;
|
||||
semaphore = (WINPR_SEMAPHORE *) Object;
|
||||
WINPR_SEMAPHORE* semaphore;
|
||||
semaphore = (WINPR_SEMAPHORE*) Object;
|
||||
#ifdef WINPR_PIPE_SEMAPHORE
|
||||
|
||||
if (semaphore->pipe_fd[0] != -1)
|
||||
@ -343,16 +343,16 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
|
||||
|
||||
#else
|
||||
#if defined __APPLE__
|
||||
semaphore_wait(*((winpr_sem_t *) semaphore->sem));
|
||||
semaphore_wait(*((winpr_sem_t*) semaphore->sem));
|
||||
#else
|
||||
sem_wait((winpr_sem_t *) semaphore->sem);
|
||||
sem_wait((winpr_sem_t*) semaphore->sem);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_TIMER)
|
||||
{
|
||||
WINPR_TIMER *timer;
|
||||
timer = (WINPR_TIMER *) Object;
|
||||
WINPR_TIMER* timer;
|
||||
timer = (WINPR_TIMER*) Object;
|
||||
#ifdef HAVE_EVENTFD_H
|
||||
|
||||
if (timer->fd != -1)
|
||||
@ -370,7 +370,7 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
|
||||
if (status != 1)
|
||||
return WAIT_TIMEOUT;
|
||||
|
||||
status = read(timer->fd, (void *) &expirations, sizeof(UINT64));
|
||||
status = read(timer->fd, (void*) &expirations, sizeof(UINT64));
|
||||
|
||||
if (status != 8)
|
||||
{
|
||||
@ -404,7 +404,7 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
|
||||
{
|
||||
int fd;
|
||||
int status;
|
||||
WINPR_NAMED_PIPE *pipe = (WINPR_NAMED_PIPE *) Object;
|
||||
WINPR_NAMED_PIPE* pipe = (WINPR_NAMED_PIPE*) Object;
|
||||
fd = (pipe->ServerMode) ? pipe->serverfd : pipe->clientfd;
|
||||
|
||||
if (fd == -1)
|
||||
@ -443,7 +443,7 @@ DWORD WaitForSingleObjectEx(HANDLE hHandle, DWORD dwMilliseconds, BOOL bAlertabl
|
||||
|
||||
#define MAXIMUM_WAIT_OBJECTS 64
|
||||
|
||||
DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAll, DWORD dwMilliseconds)
|
||||
DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE* lpHandles, BOOL bWaitAll, DWORD dwMilliseconds)
|
||||
{
|
||||
int fd = -1;
|
||||
int index;
|
||||
@ -451,7 +451,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
|
||||
ULONG Type;
|
||||
PVOID Object;
|
||||
#ifdef HAVE_POLL_H
|
||||
struct pollfd *pollfds;
|
||||
struct pollfd* pollfds;
|
||||
#else
|
||||
int maxfd;
|
||||
fd_set fds;
|
||||
@ -488,7 +488,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
|
||||
|
||||
if (Type == HANDLE_TYPE_EVENT)
|
||||
{
|
||||
fd = ((WINPR_EVENT *) Object)->pipe_fd[0];
|
||||
fd = ((WINPR_EVENT*) Object)->pipe_fd[0];
|
||||
|
||||
if (fd == -1)
|
||||
{
|
||||
@ -499,7 +499,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
|
||||
else if (Type == HANDLE_TYPE_SEMAPHORE)
|
||||
{
|
||||
#ifdef WINPR_PIPE_SEMAPHORE
|
||||
fd = ((WINPR_SEMAPHORE *) Object)->pipe_fd[0];
|
||||
fd = ((WINPR_SEMAPHORE*) Object)->pipe_fd[0];
|
||||
#else
|
||||
WLog_ERR(TAG, "semaphore not supported");
|
||||
return WAIT_FAILED;
|
||||
@ -507,7 +507,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_TIMER)
|
||||
{
|
||||
WINPR_TIMER *timer = (WINPR_TIMER *) Object;
|
||||
WINPR_TIMER* timer = (WINPR_TIMER*) Object;
|
||||
fd = timer->fd;
|
||||
|
||||
if (fd == -1)
|
||||
@ -518,7 +518,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_NAMED_PIPE)
|
||||
{
|
||||
WINPR_NAMED_PIPE *pipe = (WINPR_NAMED_PIPE *) Object;
|
||||
WINPR_NAMED_PIPE* pipe = (WINPR_NAMED_PIPE*) Object;
|
||||
fd = (pipe->ServerMode) ? pipe->serverfd : pipe->clientfd;
|
||||
|
||||
if (fd == -1)
|
||||
@ -592,20 +592,20 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
|
||||
|
||||
if (Type == HANDLE_TYPE_EVENT)
|
||||
{
|
||||
fd = ((WINPR_EVENT *) Object)->pipe_fd[0];
|
||||
fd = ((WINPR_EVENT*) Object)->pipe_fd[0];
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_SEMAPHORE)
|
||||
{
|
||||
fd = ((WINPR_SEMAPHORE *) Object)->pipe_fd[0];
|
||||
fd = ((WINPR_SEMAPHORE*) Object)->pipe_fd[0];
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_TIMER)
|
||||
{
|
||||
WINPR_TIMER *timer = (WINPR_TIMER *) Object;
|
||||
WINPR_TIMER* timer = (WINPR_TIMER*) Object;
|
||||
fd = timer->fd;
|
||||
}
|
||||
else if (Type == HANDLE_TYPE_NAMED_PIPE)
|
||||
{
|
||||
WINPR_NAMED_PIPE *pipe = (WINPR_NAMED_PIPE *) Object;
|
||||
WINPR_NAMED_PIPE* pipe = (WINPR_NAMED_PIPE*) Object;
|
||||
fd = (pipe->ServerMode) ? pipe->serverfd : pipe->clientfd;
|
||||
}
|
||||
|
||||
@ -631,7 +631,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
|
||||
{
|
||||
int length;
|
||||
UINT64 expirations;
|
||||
length = read(fd, (void *) &expirations, sizeof(UINT64));
|
||||
length = read(fd, (void*) &expirations, sizeof(UINT64));
|
||||
|
||||
if (length != 8)
|
||||
{
|
||||
@ -659,7 +659,7 @@ DWORD WaitForMultipleObjects(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAl
|
||||
return WAIT_FAILED;
|
||||
}
|
||||
|
||||
DWORD WaitForMultipleObjectsEx(DWORD nCount, const HANDLE *lpHandles, BOOL bWaitAll, DWORD dwMilliseconds, BOOL bAlertable)
|
||||
DWORD WaitForMultipleObjectsEx(DWORD nCount, const HANDLE* lpHandles, BOOL bWaitAll, DWORD dwMilliseconds, BOOL bAlertable)
|
||||
{
|
||||
WLog_ERR(TAG, "[ERROR] %s: Function not implemented.");
|
||||
assert(0);
|
||||
|
@ -151,7 +151,7 @@ void GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo)
|
||||
|
||||
BOOL GetComputerNameA(LPSTR lpBuffer, LPDWORD lpnSize)
|
||||
{
|
||||
char *dot;
|
||||
char* dot;
|
||||
int length;
|
||||
char hostname[256];
|
||||
gethostname(hostname, sizeof(hostname));
|
||||
@ -261,7 +261,7 @@ BOOL GetVersionExW(LPOSVERSIONINFOW lpVersionInformation)
|
||||
void GetSystemTime(LPSYSTEMTIME lpSystemTime)
|
||||
{
|
||||
time_t ct = 0;
|
||||
struct tm *stm = NULL;
|
||||
struct tm* stm = NULL;
|
||||
WORD wMilliseconds = 0;
|
||||
ct = time(NULL);
|
||||
wMilliseconds = (WORD)(GetTickCount() % 1000);
|
||||
@ -281,7 +281,7 @@ void GetSystemTime(LPSYSTEMTIME lpSystemTime)
|
||||
}
|
||||
}
|
||||
|
||||
BOOL SetSystemTime(CONST SYSTEMTIME *lpSystemTime)
|
||||
BOOL SetSystemTime(CONST SYSTEMTIME* lpSystemTime)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -289,7 +289,7 @@ BOOL SetSystemTime(CONST SYSTEMTIME *lpSystemTime)
|
||||
VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
|
||||
{
|
||||
time_t ct = 0;
|
||||
struct tm *ltm = NULL;
|
||||
struct tm* ltm = NULL;
|
||||
WORD wMilliseconds = 0;
|
||||
ct = time(NULL);
|
||||
wMilliseconds = (WORD)(GetTickCount() % 1000);
|
||||
@ -309,7 +309,7 @@ VOID GetLocalTime(LPSYSTEMTIME lpSystemTime)
|
||||
}
|
||||
}
|
||||
|
||||
BOOL SetLocalTime(CONST SYSTEMTIME *lpSystemTime)
|
||||
BOOL SetLocalTime(CONST SYSTEMTIME* lpSystemTime)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -418,10 +418,10 @@ ULONGLONG GetTickCount64(void)
|
||||
|
||||
static void cpuid(
|
||||
unsigned info,
|
||||
unsigned *eax,
|
||||
unsigned *ebx,
|
||||
unsigned *ecx,
|
||||
unsigned *edx)
|
||||
unsigned* eax,
|
||||
unsigned* ebx,
|
||||
unsigned* ecx,
|
||||
unsigned* edx)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
*eax = *ebx = *ecx = *edx = 0;
|
||||
@ -496,7 +496,7 @@ static unsigned GetARMCPUCaps(void)
|
||||
while (1)
|
||||
{
|
||||
int num;
|
||||
num = read(fd, (char *)&auxvec, sizeof(auxvec));
|
||||
num = read(fd, (char*)&auxvec, sizeof(auxvec));
|
||||
|
||||
if (num < 1 || (auxvec.a_type == 0 && auxvec.a_val == 0))
|
||||
break;
|
||||
|
@ -88,22 +88,22 @@
|
||||
*
|
||||
*/
|
||||
|
||||
LPSTR *CommandLineToArgvA(LPCSTR lpCmdLine, int *pNumArgs)
|
||||
LPSTR* CommandLineToArgvA(LPCSTR lpCmdLine, int* pNumArgs)
|
||||
{
|
||||
char *p;
|
||||
char* p;
|
||||
int index;
|
||||
int length;
|
||||
char *pBeg;
|
||||
char *pEnd;
|
||||
char *buffer;
|
||||
char *pOutput;
|
||||
char* pBeg;
|
||||
char* pEnd;
|
||||
char* buffer;
|
||||
char* pOutput;
|
||||
int numArgs;
|
||||
LPSTR *pArgs;
|
||||
LPSTR* pArgs;
|
||||
int maxNumArgs;
|
||||
int maxBufferSize;
|
||||
int currentIndex;
|
||||
int cmdLineLength;
|
||||
BOOL *lpEscapedChars;
|
||||
BOOL* lpEscapedChars;
|
||||
LPSTR lpEscapedCmdLine;
|
||||
|
||||
if (!lpCmdLine)
|
||||
@ -116,17 +116,17 @@ LPSTR *CommandLineToArgvA(LPCSTR lpCmdLine, int *pNumArgs)
|
||||
numArgs = 0;
|
||||
lpEscapedCmdLine = NULL;
|
||||
cmdLineLength = strlen(lpCmdLine);
|
||||
lpEscapedChars = (BOOL *) malloc((cmdLineLength + 1) * sizeof(BOOL));
|
||||
lpEscapedChars = (BOOL*) malloc((cmdLineLength + 1) * sizeof(BOOL));
|
||||
ZeroMemory(lpEscapedChars, (cmdLineLength + 1) * sizeof(BOOL));
|
||||
|
||||
if (strstr(lpCmdLine, "\\\""))
|
||||
{
|
||||
int i, n;
|
||||
char *pLastEnd = NULL;
|
||||
lpEscapedCmdLine = (char *) malloc((cmdLineLength + 1) * sizeof(char));
|
||||
p = (char *) lpCmdLine;
|
||||
pLastEnd = (char *) lpCmdLine;
|
||||
pOutput = (char *) lpEscapedCmdLine;
|
||||
char* pLastEnd = NULL;
|
||||
lpEscapedCmdLine = (char*) malloc((cmdLineLength + 1) * sizeof(char));
|
||||
p = (char*) lpCmdLine;
|
||||
pLastEnd = (char*) lpCmdLine;
|
||||
pOutput = (char*) lpEscapedCmdLine;
|
||||
|
||||
while (p < &lpCmdLine[cmdLineLength])
|
||||
{
|
||||
@ -184,27 +184,27 @@ LPSTR *CommandLineToArgvA(LPCSTR lpCmdLine, int *pNumArgs)
|
||||
|
||||
maxNumArgs = 2;
|
||||
currentIndex = 0;
|
||||
p = (char *) lpCmdLine;
|
||||
p = (char*) lpCmdLine;
|
||||
|
||||
while (currentIndex < cmdLineLength - 1)
|
||||
{
|
||||
index = strcspn(p, " \t");
|
||||
currentIndex += (index + 1);
|
||||
p = (char *) &lpCmdLine[currentIndex];
|
||||
p = (char*) &lpCmdLine[currentIndex];
|
||||
maxNumArgs++;
|
||||
}
|
||||
|
||||
maxBufferSize = (maxNumArgs * (sizeof(char *))) + (cmdLineLength + 1);
|
||||
buffer = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, maxBufferSize);
|
||||
maxBufferSize = (maxNumArgs * (sizeof(char*))) + (cmdLineLength + 1);
|
||||
buffer = (char*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, maxBufferSize);
|
||||
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
|
||||
pArgs = (LPSTR *) buffer;
|
||||
pOutput = (char *) &buffer[maxNumArgs * (sizeof(char *))];
|
||||
pArgs = (LPSTR*) buffer;
|
||||
pOutput = (char*) &buffer[maxNumArgs * (sizeof(char*))];
|
||||
numArgs = 0;
|
||||
currentIndex = 0;
|
||||
p = (char *) lpCmdLine;
|
||||
p = (char*) lpCmdLine;
|
||||
|
||||
while (currentIndex < cmdLineLength)
|
||||
{
|
||||
@ -306,7 +306,7 @@ LPSTR *CommandLineToArgvA(LPCSTR lpCmdLine, int *pNumArgs)
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
LPWSTR *CommandLineToArgvW(LPCWSTR lpCmdLine, int *pNumArgs)
|
||||
LPWSTR* CommandLineToArgvW(LPCWSTR lpCmdLine, int* pNumArgs)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -33,14 +33,14 @@
|
||||
|
||||
#include "../log.h"
|
||||
|
||||
void winpr_HexDump(const char *tag, int level, const BYTE *data, int length)
|
||||
void winpr_HexDump(const char* tag, int level, const BYTE* data, int length)
|
||||
{
|
||||
const BYTE *p = data;
|
||||
const BYTE* p = data;
|
||||
int i, line, offset = 0;
|
||||
const size_t llen = (length > WINPR_HEXDUMP_LINE_LENGTH) ? WINPR_HEXDUMP_LINE_LENGTH : length;
|
||||
size_t blen = 5 + llen * 5;
|
||||
size_t pos = 0;
|
||||
char *buffer = malloc(blen);
|
||||
char* buffer = malloc(blen);
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
@ -76,13 +76,13 @@ void winpr_HexDump(const char *tag, int level, const BYTE *data, int length)
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
void winpr_CArrayDump(const char *tag, int level, const BYTE *data, int length, int width)
|
||||
void winpr_CArrayDump(const char* tag, int level, const BYTE* data, int length, int width)
|
||||
{
|
||||
const BYTE *p = data;
|
||||
const BYTE* p = data;
|
||||
int i, line, offset = 0;
|
||||
const size_t llen = ((length > width) ? width : length) * 4 + 1;
|
||||
size_t pos;
|
||||
char *buffer = malloc(llen);
|
||||
char* buffer = malloc(llen);
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
@ -110,15 +110,15 @@ void winpr_CArrayDump(const char *tag, int level, const BYTE *data, int length,
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
char *winpr_BinToHexString(const BYTE *data, int length, BOOL space)
|
||||
char* winpr_BinToHexString(const BYTE* data, int length, BOOL space)
|
||||
{
|
||||
int i;
|
||||
int n;
|
||||
char *p;
|
||||
char* p;
|
||||
int ln, hn;
|
||||
char bin2hex[] = "0123456789ABCDEF";
|
||||
n = space ? 3 : 2;
|
||||
p = (char *) malloc((length + 1) * n);
|
||||
p = (char*) malloc((length + 1) * n);
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
@ -135,12 +135,12 @@ char *winpr_BinToHexString(const BYTE *data, int length, BOOL space)
|
||||
return p;
|
||||
}
|
||||
|
||||
int wvprintfx(const char *fmt, va_list args)
|
||||
int wvprintfx(const char* fmt, va_list args)
|
||||
{
|
||||
return trio_vprintf(fmt, args);
|
||||
}
|
||||
|
||||
int wprintfx(const char *fmt, ...)
|
||||
int wprintfx(const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
int status;
|
||||
@ -150,7 +150,7 @@ int wprintfx(const char *fmt, ...)
|
||||
return status;
|
||||
}
|
||||
|
||||
int wvsnprintfx(char *buffer, size_t bufferSize, const char *fmt, va_list args)
|
||||
int wvsnprintfx(char* buffer, size_t bufferSize, const char* fmt, va_list args)
|
||||
{
|
||||
return trio_vsnprintf(buffer, bufferSize, fmt, args);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define TAG WINPR_TAG("utils.ssl")
|
||||
|
||||
static int g_winpr_openssl_num_locks = 0;
|
||||
static HANDLE *g_winpr_openssl_locks = NULL;
|
||||
static HANDLE* g_winpr_openssl_locks = NULL;
|
||||
static BOOL g_winpr_openssl_initialized_by_winpr = FALSE;
|
||||
|
||||
struct CRYPTO_dynlock_value
|
||||
@ -46,7 +46,7 @@ static unsigned long _winpr_openssl_id(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void _winpr_openssl_locking(int mode, int type, const char *file, int line)
|
||||
static void _winpr_openssl_locking(int mode, int type, const char* file, int line)
|
||||
{
|
||||
if (mode & CRYPTO_LOCK)
|
||||
{
|
||||
@ -58,9 +58,9 @@ static void _winpr_openssl_locking(int mode, int type, const char *file, int lin
|
||||
}
|
||||
}
|
||||
|
||||
static struct CRYPTO_dynlock_value *_winpr_openssl_dynlock_create(const char *file, int line)
|
||||
static struct CRYPTO_dynlock_value* _winpr_openssl_dynlock_create(const char* file, int line)
|
||||
{
|
||||
struct CRYPTO_dynlock_value *dynlock = (struct CRYPTO_dynlock_value *)
|
||||
struct CRYPTO_dynlock_value* dynlock = (struct CRYPTO_dynlock_value*)
|
||||
malloc(sizeof(struct CRYPTO_dynlock_value));
|
||||
|
||||
if (dynlock)
|
||||
@ -71,7 +71,7 @@ static struct CRYPTO_dynlock_value *_winpr_openssl_dynlock_create(const char *fi
|
||||
return dynlock;
|
||||
}
|
||||
|
||||
static void _winpr_openssl_dynlock_lock(int mode, struct CRYPTO_dynlock_value *dynlock, const char *file, int line)
|
||||
static void _winpr_openssl_dynlock_lock(int mode, struct CRYPTO_dynlock_value* dynlock, const char* file, int line)
|
||||
{
|
||||
if (mode & CRYPTO_LOCK)
|
||||
{
|
||||
@ -83,7 +83,7 @@ static void _winpr_openssl_dynlock_lock(int mode, struct CRYPTO_dynlock_value *d
|
||||
}
|
||||
}
|
||||
|
||||
static void _winpr_openssl_dynlock_destroy(struct CRYPTO_dynlock_value *dynlock, const char *file, int line)
|
||||
static void _winpr_openssl_dynlock_destroy(struct CRYPTO_dynlock_value* dynlock, const char* file, int line)
|
||||
{
|
||||
CloseHandle(dynlock->mutex);
|
||||
free(dynlock);
|
||||
@ -103,7 +103,7 @@ static BOOL _winpr_openssl_initialize_locking(void)
|
||||
{
|
||||
if ((count = CRYPTO_num_locks()) > 0)
|
||||
{
|
||||
HANDLE *locks;
|
||||
HANDLE* locks;
|
||||
|
||||
if (!(locks = calloc(count, sizeof(HANDLE))))
|
||||
{
|
||||
@ -210,7 +210,7 @@ static BOOL _winpr_openssl_cleanup_locking(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK _winpr_openssl_initialize(PINIT_ONCE once, PVOID param, PVOID *context)
|
||||
static BOOL CALLBACK _winpr_openssl_initialize(PINIT_ONCE once, PVOID param, PVOID* context)
|
||||
{
|
||||
DWORD flags = param ? *(PDWORD)param : WINPR_SSL_INIT_DEFAULT;
|
||||
|
||||
|
@ -28,9 +28,9 @@
|
||||
#include "../../log.h"
|
||||
#define TAG WINPR_TAG("utils.wlog")
|
||||
|
||||
int WLog_DataMessage_Write(char *filename, void *data, int length)
|
||||
int WLog_DataMessage_Write(char* filename, void* data, int length)
|
||||
{
|
||||
FILE *fp;
|
||||
FILE* fp;
|
||||
fp = fopen(filename, "w+b");
|
||||
|
||||
if (!fp)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
@ -282,7 +270,7 @@ UINT16 IPv4Checksum(BYTE* ipv4, int length)
|
||||
while (checksum >> 16)
|
||||
checksum = (checksum & 0xFFFF) + (checksum >> 16);
|
||||
|
||||
return (UINT16) (~checksum);
|
||||
return (UINT16)(~checksum);
|
||||
}
|
||||
|
||||
int WLog_PacketMessage_Write_IPv4Header(wPcap* pcap, wIPv4Header* ipv4)
|
||||
@ -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;
|
||||
@ -402,7 +380,7 @@ int WLog_PacketMessage_Write(wPcap* pcap, void* data, DWORD length, DWORD flags)
|
||||
ipv4.Version = 4;
|
||||
ipv4.InternetHeaderLength = 5;
|
||||
ipv4.TypeOfService = 0;
|
||||
ipv4.TotalLength = (UINT16) (length + 20 + 20);
|
||||
ipv4.TotalLength = (UINT16)(length + 20 + 20);
|
||||
ipv4.Identification = 0;
|
||||
ipv4.InternetProtocolFlags = 0x02;
|
||||
ipv4.FragmentOffset = 0;
|
||||
@ -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;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@
|
||||
* http://docs.python.org/2/library/logging.html
|
||||
*/
|
||||
|
||||
const char *WLOG_LEVELS[7] =
|
||||
const char* WLOG_LEVELS[7] =
|
||||
{
|
||||
"TRACE",
|
||||
"DEBUG",
|
||||
@ -61,36 +61,40 @@ const char *WLOG_LEVELS[7] =
|
||||
};
|
||||
|
||||
static DWORD g_FilterCount = 0;
|
||||
static wLogFilter *g_Filters = NULL;
|
||||
static wLogFilter* g_Filters = NULL;
|
||||
|
||||
static void log_recursion(const char *file, const char *fkt, int line)
|
||||
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);
|
||||
|
||||
void* bt = winpr_backtrace(20);
|
||||
char** msg = winpr_backtrace_symbols(bt, &used);
|
||||
#if defined(ANDROID)
|
||||
const char *tag = WINPR_TAG("utils.wlog");
|
||||
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);
|
||||
}
|
||||
|
||||
int WLog_Write(wLog *log, wLogMessage *message)
|
||||
int WLog_Write(wLog* log, wLogMessage* message)
|
||||
{
|
||||
int status = -1;
|
||||
wLogAppender *appender;
|
||||
wLogAppender* appender;
|
||||
appender = WLog_GetLogAppender(log);
|
||||
|
||||
if (!appender)
|
||||
@ -117,10 +121,10 @@ int WLog_Write(wLog *log, wLogMessage *message)
|
||||
return status;
|
||||
}
|
||||
|
||||
int WLog_WriteData(wLog *log, wLogMessage *message)
|
||||
int WLog_WriteData(wLog* log, wLogMessage* message)
|
||||
{
|
||||
int status = -1;
|
||||
wLogAppender *appender;
|
||||
wLogAppender* appender;
|
||||
appender = WLog_GetLogAppender(log);
|
||||
|
||||
if (!appender)
|
||||
@ -147,10 +151,10 @@ int WLog_WriteData(wLog *log, wLogMessage *message)
|
||||
return status;
|
||||
}
|
||||
|
||||
int WLog_WriteImage(wLog *log, wLogMessage *message)
|
||||
int WLog_WriteImage(wLog* log, wLogMessage* message)
|
||||
{
|
||||
int status = -1;
|
||||
wLogAppender *appender;
|
||||
wLogAppender* appender;
|
||||
appender = WLog_GetLogAppender(log);
|
||||
|
||||
if (!appender)
|
||||
@ -177,10 +181,10 @@ int WLog_WriteImage(wLog *log, wLogMessage *message)
|
||||
return status;
|
||||
}
|
||||
|
||||
int WLog_WritePacket(wLog *log, wLogMessage *message)
|
||||
int WLog_WritePacket(wLog* log, wLogMessage* message)
|
||||
{
|
||||
int status = -1;
|
||||
wLogAppender *appender;
|
||||
wLogAppender* appender;
|
||||
appender = WLog_GetLogAppender(log);
|
||||
|
||||
if (!appender)
|
||||
@ -207,7 +211,7 @@ int WLog_WritePacket(wLog *log, wLogMessage *message)
|
||||
return status;
|
||||
}
|
||||
|
||||
int WLog_PrintMessageVA(wLog *log, wLogMessage *message, va_list args)
|
||||
int WLog_PrintMessageVA(wLog* log, wLogMessage* message, va_list args)
|
||||
{
|
||||
int status = -1;
|
||||
|
||||
@ -228,13 +232,13 @@ int WLog_PrintMessageVA(wLog *log, wLogMessage *message, va_list args)
|
||||
}
|
||||
else if (message->Type == WLOG_MESSAGE_DATA)
|
||||
{
|
||||
message->Data = va_arg(args, void *);
|
||||
message->Data = va_arg(args, void*);
|
||||
message->Length = va_arg(args, int);
|
||||
status = WLog_WriteData(log, message);
|
||||
}
|
||||
else if (message->Type == WLOG_MESSAGE_IMAGE)
|
||||
{
|
||||
message->ImageData = va_arg(args, void *);
|
||||
message->ImageData = va_arg(args, void*);
|
||||
message->ImageWidth = va_arg(args, int);
|
||||
message->ImageHeight = va_arg(args, int);
|
||||
message->ImageBpp = va_arg(args, int);
|
||||
@ -242,7 +246,7 @@ int WLog_PrintMessageVA(wLog *log, wLogMessage *message, va_list args)
|
||||
}
|
||||
else if (message->Type == WLOG_MESSAGE_PACKET)
|
||||
{
|
||||
message->PacketData = va_arg(args, void *);
|
||||
message->PacketData = va_arg(args, void*);
|
||||
message->PacketLength = va_arg(args, int);
|
||||
message->PacketFlags = va_arg(args, int);
|
||||
status = WLog_WritePacket(log, message);
|
||||
@ -251,7 +255,7 @@ int WLog_PrintMessageVA(wLog *log, wLogMessage *message, va_list args)
|
||||
return status;
|
||||
}
|
||||
|
||||
void WLog_PrintMessage(wLog *log, wLogMessage *message, ...)
|
||||
void WLog_PrintMessage(wLog* log, wLogMessage* message, ...)
|
||||
{
|
||||
int status;
|
||||
va_list args;
|
||||
@ -260,7 +264,7 @@ void WLog_PrintMessage(wLog *log, wLogMessage *message, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
DWORD WLog_GetLogLevel(wLog *log)
|
||||
DWORD WLog_GetLogLevel(wLog* log)
|
||||
{
|
||||
if (log->Level == WLOG_LEVEL_INHERIT)
|
||||
{
|
||||
@ -272,7 +276,7 @@ DWORD WLog_GetLogLevel(wLog *log)
|
||||
}
|
||||
}
|
||||
|
||||
void WLog_SetLogLevel(wLog *log, DWORD logLevel)
|
||||
void WLog_SetLogLevel(wLog* log, DWORD logLevel)
|
||||
{
|
||||
if ((logLevel > WLOG_OFF) && (logLevel != WLOG_LEVEL_INHERIT))
|
||||
{
|
||||
@ -282,7 +286,7 @@ void WLog_SetLogLevel(wLog *log, DWORD logLevel)
|
||||
log->Level = logLevel;
|
||||
}
|
||||
|
||||
int WLog_ParseLogLevel(const char *level)
|
||||
int WLog_ParseLogLevel(const char* level)
|
||||
{
|
||||
int iLevel = -1;
|
||||
|
||||
@ -307,15 +311,15 @@ int WLog_ParseLogLevel(const char *level)
|
||||
return iLevel;
|
||||
}
|
||||
|
||||
int WLog_ParseFilter(wLogFilter *filter, LPCSTR name)
|
||||
int WLog_ParseFilter(wLogFilter* filter, LPCSTR name)
|
||||
{
|
||||
char *p;
|
||||
char *q;
|
||||
char* p;
|
||||
char* q;
|
||||
int count;
|
||||
LPSTR names;
|
||||
int iLevel;
|
||||
count = 1;
|
||||
p = (char *) name;
|
||||
p = (char*) name;
|
||||
|
||||
while ((p = strchr(p, '.')) != NULL)
|
||||
{
|
||||
@ -325,10 +329,10 @@ int WLog_ParseFilter(wLogFilter *filter, LPCSTR name)
|
||||
|
||||
names = _strdup(name);
|
||||
filter->NameCount = count;
|
||||
filter->Names = (LPSTR *) malloc(sizeof(LPSTR) * (count + 1));
|
||||
filter->Names = (LPSTR*) malloc(sizeof(LPSTR) * (count + 1));
|
||||
filter->Names[count] = NULL;
|
||||
count = 0;
|
||||
p = (char *) names;
|
||||
p = (char*) names;
|
||||
filter->Names[count++] = p;
|
||||
q = strrchr(p, ':');
|
||||
|
||||
@ -356,12 +360,12 @@ int WLog_ParseFilter(wLogFilter *filter, LPCSTR name)
|
||||
|
||||
int WLog_ParseFilters()
|
||||
{
|
||||
char *p;
|
||||
char *env;
|
||||
char* p;
|
||||
char* env;
|
||||
DWORD count;
|
||||
DWORD nSize;
|
||||
int status;
|
||||
char **strs;
|
||||
char** strs;
|
||||
nSize = GetEnvironmentVariableA("WLOG_FILTER", NULL, 0);
|
||||
|
||||
if (nSize < 1)
|
||||
@ -385,7 +389,7 @@ int WLog_ParseFilters()
|
||||
g_FilterCount = count;
|
||||
p = env;
|
||||
count = 0;
|
||||
strs = (char **) calloc(g_FilterCount, sizeof(char *));
|
||||
strs = (char**) calloc(g_FilterCount, sizeof(char*));
|
||||
strs[count++] = p;
|
||||
|
||||
while ((p = strchr(p, ',')) != NULL)
|
||||
@ -412,7 +416,7 @@ int WLog_ParseFilters()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WLog_GetFilterLogLevel(wLog *log)
|
||||
int WLog_GetFilterLogLevel(wLog* log)
|
||||
{
|
||||
DWORD i, j;
|
||||
int iLevel = -1;
|
||||
@ -453,13 +457,13 @@ int WLog_GetFilterLogLevel(wLog *log)
|
||||
return iLevel;
|
||||
}
|
||||
|
||||
int WLog_ParseName(wLog *log, LPCSTR name)
|
||||
int WLog_ParseName(wLog* log, LPCSTR name)
|
||||
{
|
||||
char *p;
|
||||
char* p;
|
||||
int count;
|
||||
LPSTR names;
|
||||
count = 1;
|
||||
p = (char *) name;
|
||||
p = (char*) name;
|
||||
|
||||
while ((p = strchr(p, '.')) != NULL)
|
||||
{
|
||||
@ -469,10 +473,10 @@ int WLog_ParseName(wLog *log, LPCSTR name)
|
||||
|
||||
names = _strdup(name);
|
||||
log->NameCount = count;
|
||||
log->Names = (LPSTR *) malloc(sizeof(LPSTR) * (count + 1));
|
||||
log->Names = (LPSTR*) malloc(sizeof(LPSTR) * (count + 1));
|
||||
log->Names[count] = NULL;
|
||||
count = 0;
|
||||
p = (char *) names;
|
||||
p = (char*) names;
|
||||
log->Names[count++] = p;
|
||||
|
||||
while ((p = strchr(p, '.')) != NULL)
|
||||
@ -485,13 +489,13 @@ int WLog_ParseName(wLog *log, LPCSTR name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
wLog *WLog_New(LPCSTR name, wLog *rootLogger)
|
||||
wLog* WLog_New(LPCSTR name, wLog* rootLogger)
|
||||
{
|
||||
wLog *log;
|
||||
char *env;
|
||||
wLog* log;
|
||||
char* env;
|
||||
DWORD nSize;
|
||||
int iLevel;
|
||||
log = (wLog *) calloc(1, sizeof(wLog));
|
||||
log = (wLog*) calloc(1, sizeof(wLog));
|
||||
|
||||
if (log)
|
||||
{
|
||||
@ -504,7 +508,7 @@ wLog *WLog_New(LPCSTR name, wLog *rootLogger)
|
||||
log->Parent = rootLogger;
|
||||
log->ChildrenCount = 0;
|
||||
log->ChildrenSize = 16;
|
||||
log->Children = (wLog **) calloc(log->ChildrenSize, sizeof(wLog *));
|
||||
log->Children = (wLog**) calloc(log->ChildrenSize, sizeof(wLog*));
|
||||
|
||||
if (!log->Children)
|
||||
return NULL;
|
||||
@ -542,7 +546,7 @@ wLog *WLog_New(LPCSTR name, wLog *rootLogger)
|
||||
return log;
|
||||
}
|
||||
|
||||
void WLog_Free(wLog *log)
|
||||
void WLog_Free(wLog* log)
|
||||
{
|
||||
if (log)
|
||||
{
|
||||
@ -560,11 +564,11 @@ void WLog_Free(wLog *log)
|
||||
}
|
||||
}
|
||||
|
||||
static wLog *g_RootLog = NULL;
|
||||
static wLog* g_RootLog = NULL;
|
||||
|
||||
wLog *WLog_GetRoot()
|
||||
wLog* WLog_GetRoot()
|
||||
{
|
||||
char *env;
|
||||
char* env;
|
||||
DWORD nSize;
|
||||
DWORD logAppenderType;
|
||||
|
||||
@ -600,12 +604,12 @@ wLog *WLog_GetRoot()
|
||||
return g_RootLog;
|
||||
}
|
||||
|
||||
int WLog_AddChild(wLog *parent, wLog *child)
|
||||
int WLog_AddChild(wLog* parent, wLog* child)
|
||||
{
|
||||
if (parent->ChildrenCount >= parent->ChildrenSize)
|
||||
{
|
||||
parent->ChildrenSize *= 2;
|
||||
parent->Children = (wLog **) realloc(parent->Children, sizeof(wLog *) * parent->ChildrenSize);
|
||||
parent->Children = (wLog**) realloc(parent->Children, sizeof(wLog*) * parent->ChildrenSize);
|
||||
}
|
||||
|
||||
parent->Children[parent->ChildrenCount++] = child;
|
||||
@ -613,11 +617,11 @@ int WLog_AddChild(wLog *parent, wLog *child)
|
||||
return 0;
|
||||
}
|
||||
|
||||
wLog *WLog_FindChild(LPCSTR name)
|
||||
wLog* WLog_FindChild(LPCSTR name)
|
||||
{
|
||||
DWORD index;
|
||||
wLog *root;
|
||||
wLog *child = NULL;
|
||||
wLog* root;
|
||||
wLog* child = NULL;
|
||||
BOOL found = FALSE;
|
||||
root = WLog_GetRoot();
|
||||
|
||||
@ -635,10 +639,10 @@ wLog *WLog_FindChild(LPCSTR name)
|
||||
return (found) ? child : NULL;
|
||||
}
|
||||
|
||||
wLog *WLog_Get(LPCSTR name)
|
||||
wLog* WLog_Get(LPCSTR name)
|
||||
{
|
||||
wLog *log;
|
||||
wLog *root;
|
||||
wLog* log;
|
||||
wLog* root;
|
||||
root = WLog_GetRoot();
|
||||
log = WLog_FindChild(name);
|
||||
|
||||
@ -658,9 +662,9 @@ void WLog_Init()
|
||||
|
||||
void WLog_Uninit()
|
||||
{
|
||||
wLog *root = WLog_GetRoot();
|
||||
wLog* root = WLog_GetRoot();
|
||||
DWORD index;
|
||||
wLog *child = NULL;
|
||||
wLog* child = NULL;
|
||||
|
||||
for (index = 0; index < root->ChildrenCount; index++)
|
||||
{
|
||||
|
@ -225,12 +225,12 @@ BOOL WINAPI WTSConnectSessionA(ULONG LogonId, ULONG TargetLogonId, PSTR pPasswor
|
||||
WTSAPI_STUB_CALL_BOOL(ConnectSessionA, LogonId, TargetLogonId, pPassword, bWait);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOW *ppServerInfo, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateServersW(LPWSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOW* ppServerInfo, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateServersW, pDomainName, Reserved, Version, ppServerInfo, pCount);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOA *ppServerInfo, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateServersA(LPSTR pDomainName, DWORD Reserved, DWORD Version, PWTS_SERVER_INFOA* ppServerInfo, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateServersA, pDomainName, Reserved, Version, ppServerInfo, pCount);
|
||||
}
|
||||
@ -260,32 +260,32 @@ VOID WINAPI WTSCloseServer(HANDLE hServer)
|
||||
WTSAPI_STUB_CALL_VOID(CloseServer, hServer);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_SESSION_INFOW *ppSessionInfo, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateSessionsW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_SESSION_INFOW* ppSessionInfo, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateSessionsW, hServer, Reserved, Version, ppSessionInfo, pCount);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_SESSION_INFOA *ppSessionInfo, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateSessionsA(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_SESSION_INFOA* ppSessionInfo, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateSessionsA, hServer, Reserved, Version, ppSessionInfo, pCount);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateSessionsExW(HANDLE hServer, DWORD *pLevel, DWORD Filter, PWTS_SESSION_INFO_1W *ppSessionInfo, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateSessionsExW(HANDLE hServer, DWORD* pLevel, DWORD Filter, PWTS_SESSION_INFO_1W* ppSessionInfo, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateSessionsExW, hServer, pLevel, Filter, ppSessionInfo, pCount);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateSessionsExA(HANDLE hServer, DWORD *pLevel, DWORD Filter, PWTS_SESSION_INFO_1A *ppSessionInfo, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateSessionsExA(HANDLE hServer, DWORD* pLevel, DWORD Filter, PWTS_SESSION_INFO_1A* ppSessionInfo, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateSessionsExA, hServer, pLevel, Filter, ppSessionInfo, pCount);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOW *ppProcessInfo, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateProcessesW(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOW* ppProcessInfo, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateProcessesW, hServer, Reserved, Version, ppProcessInfo, pCount);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOA *ppProcessInfo, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateProcessesA(HANDLE hServer, DWORD Reserved, DWORD Version, PWTS_PROCESS_INFOA* ppProcessInfo, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateProcessesA, hServer, Reserved, Version, ppProcessInfo, pCount);
|
||||
}
|
||||
@ -295,22 +295,22 @@ BOOL WINAPI WTSTerminateProcess(HANDLE hServer, DWORD ProcessId, DWORD ExitCode)
|
||||
WTSAPI_STUB_CALL_BOOL(TerminateProcess, hServer, ProcessId, ExitCode);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSQuerySessionInformationW(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPWSTR *ppBuffer, DWORD *pBytesReturned)
|
||||
BOOL WINAPI WTSQuerySessionInformationW(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPWSTR* ppBuffer, DWORD* pBytesReturned)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(QuerySessionInformationW, hServer, SessionId, WTSInfoClass, ppBuffer, pBytesReturned);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSQuerySessionInformationA(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPSTR *ppBuffer, DWORD *pBytesReturned)
|
||||
BOOL WINAPI WTSQuerySessionInformationA(HANDLE hServer, DWORD SessionId, WTS_INFO_CLASS WTSInfoClass, LPSTR* ppBuffer, DWORD* pBytesReturned)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(QuerySessionInformationA, hServer, SessionId, WTSInfoClass, ppBuffer, pBytesReturned);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR *ppBuffer, DWORD *pBytesReturned)
|
||||
BOOL WINAPI WTSQueryUserConfigW(LPWSTR pServerName, LPWSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPWSTR* ppBuffer, DWORD* pBytesReturned)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(QueryUserConfigW, pServerName, pUserName, WTSConfigClass, ppBuffer, pBytesReturned);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR *ppBuffer, DWORD *pBytesReturned)
|
||||
BOOL WINAPI WTSQueryUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLASS WTSConfigClass, LPSTR* ppBuffer, DWORD* pBytesReturned)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(QueryUserConfigA, pServerName, pUserName, WTSConfigClass, ppBuffer, pBytesReturned);
|
||||
}
|
||||
@ -326,14 +326,14 @@ BOOL WINAPI WTSSetUserConfigA(LPSTR pServerName, LPSTR pUserName, WTS_CONFIG_CLA
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSSendMessageW(HANDLE hServer, DWORD SessionId, LPWSTR pTitle, DWORD TitleLength,
|
||||
LPWSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD *pResponse, BOOL bWait)
|
||||
LPWSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(SendMessageW, hServer, SessionId, pTitle, TitleLength,
|
||||
pMessage, MessageLength, Style, Timeout, pResponse, bWait);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSSendMessageA(HANDLE hServer, DWORD SessionId, LPSTR pTitle, DWORD TitleLength,
|
||||
LPSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD *pResponse, BOOL bWait)
|
||||
LPSTR pMessage, DWORD MessageLength, DWORD Style, DWORD Timeout, DWORD* pResponse, BOOL bWait)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(SendMessageA, hServer, SessionId, pTitle, TitleLength,
|
||||
pMessage, MessageLength, Style, Timeout, pResponse, bWait);
|
||||
@ -354,7 +354,7 @@ BOOL WINAPI WTSShutdownSystem(HANDLE hServer, DWORD ShutdownFlag)
|
||||
WTSAPI_STUB_CALL_BOOL(ShutdownSystem, hServer, ShutdownFlag);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD EventMask, DWORD *pEventFlags)
|
||||
BOOL WINAPI WTSWaitSystemEvent(HANDLE hServer, DWORD EventMask, DWORD* pEventFlags)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(WaitSystemEvent, hServer, EventMask, pEventFlags);
|
||||
}
|
||||
@ -394,7 +394,7 @@ BOOL WINAPI WTSVirtualChannelPurgeOutput(HANDLE hChannelHandle)
|
||||
WTSAPI_STUB_CALL_BOOL(VirtualChannelPurgeOutput, hChannelHandle);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID *ppBuffer, DWORD *pBytesReturned)
|
||||
BOOL WINAPI WTSVirtualChannelQuery(HANDLE hChannelHandle, WTS_VIRTUAL_CLASS WtsVirtualClass, PVOID* ppBuffer, DWORD* pBytesReturned)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(VirtualChannelQuery, hChannelHandle, WtsVirtualClass, ppBuffer, pBytesReturned);
|
||||
}
|
||||
@ -439,22 +439,22 @@ BOOL WINAPI WTSQueryUserToken(ULONG SessionId, PHANDLE phToken)
|
||||
WTSAPI_STUB_CALL_BOOL(QueryUserToken, SessionId, phToken);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateProcessesExW(HANDLE hServer, DWORD *pLevel, DWORD SessionId, LPWSTR *ppProcessInfo, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateProcessesExW(HANDLE hServer, DWORD* pLevel, DWORD SessionId, LPWSTR* ppProcessInfo, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateProcessesExW, hServer, pLevel, SessionId, ppProcessInfo, pCount);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateProcessesExA(HANDLE hServer, DWORD *pLevel, DWORD SessionId, LPSTR *ppProcessInfo, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateProcessesExA(HANDLE hServer, DWORD* pLevel, DWORD SessionId, LPSTR* ppProcessInfo, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateProcessesExA, hServer, pLevel, SessionId, ppProcessInfo, pCount);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateListenersW(HANDLE hServer, PVOID pReserved, DWORD Reserved, PWTSLISTENERNAMEW pListeners, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateListenersW(HANDLE hServer, PVOID pReserved, DWORD Reserved, PWTSLISTENERNAMEW pListeners, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateListenersW, hServer, pReserved, Reserved, pListeners, pCount);
|
||||
}
|
||||
|
||||
BOOL WINAPI WTSEnumerateListenersA(HANDLE hServer, PVOID pReserved, DWORD Reserved, PWTSLISTENERNAMEA pListeners, DWORD *pCount)
|
||||
BOOL WINAPI WTSEnumerateListenersA(HANDLE hServer, PVOID pReserved, DWORD Reserved, PWTSLISTENERNAMEA pListeners, DWORD* pCount)
|
||||
{
|
||||
WTSAPI_STUB_CALL_BOOL(EnumerateListenersA, hServer, pReserved, Reserved, pListeners, pCount);
|
||||
}
|
||||
@ -554,7 +554,7 @@ BOOL WTSRegisterWtsApiFunctionTable(PWtsApiFunctionTable table)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL LoadAndInitialize(char *library)
|
||||
static BOOL LoadAndInitialize(char* library)
|
||||
{
|
||||
INIT_WTSAPI_FN pInitWtsApi;
|
||||
g_WtsApiModule = LoadLibraryA(library);
|
||||
@ -576,7 +576,7 @@ static BOOL LoadAndInitialize(char *library)
|
||||
void InitializeWtsApiStubs_Env()
|
||||
{
|
||||
DWORD nSize;
|
||||
char *env = NULL;
|
||||
char* env = NULL;
|
||||
|
||||
if (g_WtsApi)
|
||||
return;
|
||||
@ -599,9 +599,9 @@ void InitializeWtsApiStubs_Env()
|
||||
|
||||
void InitializeWtsApiStubs_FreeRDS()
|
||||
{
|
||||
char *prefix;
|
||||
char *libdir;
|
||||
wIniFile *ini;
|
||||
char* prefix;
|
||||
char* libdir;
|
||||
wIniFile* ini;
|
||||
|
||||
if (g_WtsApi)
|
||||
return;
|
||||
@ -622,8 +622,8 @@ void InitializeWtsApiStubs_FreeRDS()
|
||||
|
||||
if (prefix && libdir)
|
||||
{
|
||||
char *prefix_libdir;
|
||||
char *wtsapi_library;
|
||||
char* prefix_libdir;
|
||||
char* wtsapi_library;
|
||||
prefix_libdir = GetCombinedPath(prefix, libdir);
|
||||
wtsapi_library = GetCombinedPath(prefix_libdir, FREERDS_LIBRARY_NAME);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user