- Make the package compile for i386
- Make the pAddr arg for DivertRecv() optional - Make the i386 user binaries compatible with an amd64 driver. (useful for projects not yet ported to amd64)
This commit is contained in:
+10
-4
@@ -1,4 +1,10 @@
|
||||
$(TARGETPATH)\$(_BUILDARCH)\divert.inf: divert.inf
|
||||
copy /y divert.inf $@
|
||||
$(TARGETPATH)\$(_BUILDARCH)\WdfCoInstaller01009.dll:
|
||||
copy /y $(BASEDIR)\redist\wdf\$(_BUILDARCH)\WdfCoInstaller01009.dll $@
|
||||
!IF "$(_BUILDARCH)" == "x86"
|
||||
CPU=i386
|
||||
!ELSE
|
||||
CPU=$(_BUILDARCH)
|
||||
!ENDIF
|
||||
|
||||
$(TARGETPATH)\$(CPU)\divert.inf: divert.inf
|
||||
copy /y divert.inf $@
|
||||
$(TARGETPATH)\$(CPU)\WdfCoInstaller01009.dll:
|
||||
copy /y $(BASEDIR)\redist\wdf\$(_BUILDARCH)\WdfCoInstaller01009.dll $@
|
||||
|
||||
+21
-11
@@ -964,9 +964,12 @@ static void divert_read_service(context_t context)
|
||||
// Write the address information.
|
||||
req_context = divert_req_context_get(request);
|
||||
addr = req_context->addr;
|
||||
addr->IfIdx = packet->if_idx;
|
||||
addr->SubIfIdx = packet->sub_if_idx;
|
||||
addr->Direction = packet->direction;
|
||||
if (addr != NULL)
|
||||
{
|
||||
addr->IfIdx = packet->if_idx;
|
||||
addr->SubIfIdx = packet->sub_if_idx;
|
||||
addr->Direction = packet->direction;
|
||||
}
|
||||
|
||||
// Compute the IP/TCP/UDP checksums here if required.
|
||||
divert_update_checksums(dst, dst_len, packet->ip_checksum,
|
||||
@@ -1208,14 +1211,21 @@ extern VOID divert_ioctl(IN WDFQUEUE queue, IN WDFREQUEST request,
|
||||
switch (code)
|
||||
{
|
||||
case IOCTL_DIVERT_RECV:
|
||||
status = WdfRequestProbeAndLockUserBufferForWrite(request,
|
||||
ioctl->arg, sizeof(struct divert_addr_s), &memobj);
|
||||
if (!NT_SUCCESS(status))
|
||||
if ((PVOID)ioctl->arg != NULL)
|
||||
{
|
||||
DEBUG_ERROR("invalid arg pointer for RECV ioctl", status);
|
||||
goto divert_ioctl_exit;
|
||||
status = WdfRequestProbeAndLockUserBufferForWrite(request,
|
||||
(PVOID)ioctl->arg, sizeof(struct divert_addr_s), &memobj);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
DEBUG_ERROR("invalid arg pointer for RECV ioctl", status);
|
||||
goto divert_ioctl_exit;
|
||||
}
|
||||
addr = (divert_addr_t)WdfMemoryGetBuffer(memobj, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
addr = NULL;
|
||||
}
|
||||
addr = (divert_addr_t)WdfMemoryGetBuffer(memobj, NULL);
|
||||
|
||||
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes,
|
||||
req_context_s);
|
||||
@@ -1238,7 +1248,7 @@ extern VOID divert_ioctl(IN WDFQUEUE queue, IN WDFREQUEST request,
|
||||
|
||||
case IOCTL_DIVERT_SEND:
|
||||
status = WdfRequestProbeAndLockUserBufferForRead(request,
|
||||
ioctl->arg, sizeof(struct divert_addr_s), &memobj);
|
||||
(PVOID)ioctl->arg, sizeof(struct divert_addr_s), &memobj);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
DEBUG_ERROR("invalid arg pointer for SEND ioctl", status);
|
||||
@@ -1253,7 +1263,7 @@ extern VOID divert_ioctl(IN WDFQUEUE queue, IN WDFREQUEST request,
|
||||
break;
|
||||
|
||||
case IOCTL_DIVERT_SET_FILTER:
|
||||
if (ioctl->arg != NULL)
|
||||
if ((PVOID)ioctl->arg != NULL)
|
||||
{
|
||||
status = STATUS_INVALID_DEVICE_REQUEST;
|
||||
DEBUG_ERROR("arg pointer is non-NULL for SET_FILTER ioctl",
|
||||
|
||||
+8
-2
@@ -14,6 +14,12 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
!IF "$(_BUILDARCH)" == "x86"
|
||||
CPU=i386
|
||||
!ELSE
|
||||
CPU=$(_BUILDARCH)
|
||||
!ENDIF
|
||||
|
||||
TARGETNAME=divert
|
||||
TARGETTYPE=DRIVER
|
||||
TARGETPATH=..\install
|
||||
@@ -23,8 +29,8 @@ TARGETLIBS=\
|
||||
$(DDK_LIB_PATH)\fwpkclnt.lib \
|
||||
$(SDK_LIB_PATH)\uuid.lib
|
||||
NTTARGETFILES=\
|
||||
$(TARGETPATH)\$(_BUILDARCH)\divert.inf \
|
||||
$(TARGETPATH)\$(_BUILDARCH)\WdfCoInstaller01009.dll
|
||||
$(TARGETPATH)\$(CPU)\divert.inf \
|
||||
$(TARGETPATH)\$(CPU)\WdfCoInstaller01009.dll
|
||||
KMDF_VERSION_MAJOR=1
|
||||
C_DEFINES=$(C_DEFINES) -DBINARY_COMPATIBLE=0 -DNT -DUNICODE -D_UNICODE \
|
||||
-DNDIS60 -DNDIS_SUPPORT_NDIS60
|
||||
|
||||
Reference in New Issue
Block a user