http.sys: Fill out the local and remote addresses.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-08-26 23:31:19 -05:00 committed by Alexandre Julliard
parent d39dc9803b
commit 0d5643592f
1 changed files with 29 additions and 0 deletions

View File

@ -274,6 +274,8 @@ static NTSTATUS complete_irp(struct connection *conn, IRP *irp)
const DWORD output_len = stack->Parameters.DeviceIoControl.OutputBufferLength;
ULONG cooked_len, host_len, abs_path_len, query_len, offset;
const char *p, *host, *abs_path, *query;
struct sockaddr_in addr;
int len;
TRACE("Completing IRP %p.\n", irp);
@ -309,6 +311,9 @@ static NTSTATUS complete_irp(struct connection *conn, IRP *irp)
cooked_len = (7 /* scheme */ + host_len + abs_path_len + query_len) * sizeof(WCHAR);
irp_size += cooked_len + sizeof(WCHAR);
/* addresses */
irp_size += 2 * sizeof(addr);
TRACE("Need %u bytes, have %u.\n", irp_size, output_len);
irp->IoStatus.Information = irp_size;
@ -376,6 +381,18 @@ static NTSTATUS complete_irp(struct connection *conn, IRP *irp)
buffer[offset++] = 0;
buffer[offset++] = 0;
req->Address.pRemoteAddress = params.addr + offset;
len = sizeof(addr);
getpeername(conn->socket, (struct sockaddr *)&addr, &len);
memcpy(buffer + offset, &addr, sizeof(addr));
offset += sizeof(addr);
req->Address.pLocalAddress = params.addr + offset;
len = sizeof(addr);
getsockname(conn->socket, (struct sockaddr *)&addr, &len);
memcpy(buffer + offset, &addr, sizeof(addr));
offset += sizeof(addr);
req->BytesReceived = conn->req_len;
}
else
@ -425,6 +442,18 @@ static NTSTATUS complete_irp(struct connection *conn, IRP *irp)
buffer[offset++] = 0;
buffer[offset++] = 0;
req->Address.pRemoteAddress = params.addr + offset;
len = sizeof(addr);
getpeername(conn->socket, (struct sockaddr *)&addr, &len);
memcpy(buffer + offset, &addr, sizeof(addr));
offset += sizeof(addr);
req->Address.pLocalAddress = params.addr + offset;
len = sizeof(addr);
getsockname(conn->socket, (struct sockaddr *)&addr, &len);
memcpy(buffer + offset, &addr, sizeof(addr));
offset += sizeof(addr);
req->BytesReceived = conn->req_len;
}