#include "precomp.h"
-#ifndef NDEBUG
+#include <ntddk.h>
+#include <stdio.h>
+#include <scsi.h>
+#include <ntddscsi.h>
+#include <ntdddisk.h>
+
#define NDEBUG
-#endif
#include <debug.h>
+#include "scsiport_int.h"
+
ULONG InternalDebugLevel = 0x00;
#undef ScsiPortMoveMemory
-/* TYPES *********************************************************************/
-
/* GLOBALS *******************************************************************/
static BOOLEAN
{
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
SCSI_PHYSICAL_ADDRESS PhysicalAddress;
- ULONG BufferLength = 0;
- ULONG Offset;
+ SIZE_T BufferLength = 0;
+ ULONG_PTR Offset;
PSCSI_SG_ADDRESS SGList;
PSCSI_REQUEST_BLOCK_INFO SrbInfo;
PhysicalAddress.QuadPart = (LONGLONG)(SP_UNINITIALIZED_VALUE);
}
- *Length = BufferLength;
+ *Length = (ULONG)BufferLength;
return PhysicalAddress;
}
KIRQL OldIrql;
PCM_RESOURCE_LIST ResourceList;
BOOLEAN Conflict;
+ SIZE_T BusConfigSize;
DPRINT ("ScsiPortInitialize() called!\n");
IoStartTimer(PortDeviceObject);
/* Initialize bus scanning information */
+ BusConfigSize = FIELD_OFFSET(BUSES_CONFIGURATION_INFORMATION,
+ BusScanInfo[DeviceExtension->PortConfig->NumberOfBuses]);
DeviceExtension->BusesConfig = ExAllocatePoolWithTag(PagedPool,
- sizeof(PVOID) * DeviceExtension->PortConfig->NumberOfBuses
- + sizeof(ULONG), TAG_SCSIPORT);
-
+ BusConfigSize,
+ TAG_SCSIPORT);
if (!DeviceExtension->BusesConfig)
{
DPRINT1("Out of resources!\n");
}
/* Zero it */
- RtlZeroMemory(DeviceExtension->BusesConfig,
- sizeof(PVOID) * DeviceExtension->PortConfig->NumberOfBuses
- + sizeof(ULONG));
+ RtlZeroMemory(DeviceExtension->BusesConfig, BusConfigSize);
/* Store number of buses there */
DeviceExtension->BusesConfig->NumberOfBuses = (UCHAR)DeviceExtension->BusNum;
//PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
DPRINT1("ScsiPortLogError() called\n");
+ DPRINT1("PathId: 0x%02x TargetId: 0x%02x Lun: 0x%02x ErrorCode: 0x%08lx UniqueId: 0x%08lx\n",
+ PathId, TargetId, Lun, ErrorCode, UniqueId);
//DeviceExtension = CONTAINING_RECORD(HwDeviceExtension, SCSI_PORT_DEVICE_EXTENSION, MiniPortDeviceExtension);
case SRB_FUNCTION_EXECUTE_SCSI:
case SRB_FUNCTION_IO_CONTROL:
+ DPRINT(" SRB_FUNCTION_EXECUTE_SCSI or SRB_FUNCTION_IO_CONTROL\n");
/* Mark IRP as pending in all cases */
IoMarkIrpPending(Irp);
break;
ScatterGatherList->Length = Srb->DataTransferLength - TotalLength;
- ScatterGatherList->PhysicalAddress = IoMapTransfer(NULL,
+ ScatterGatherList->PhysicalAddress = IoMapTransfer(DeviceExtension->AdapterObject,
Irp->MdlAddress,
MapRegisterBase,
DataVA + TotalLength,
BusData = &AdapterBusInfo->BusData[Bus];
/* Calculate and save an offset of the inquiry data */
- BusData->InquiryDataOffset = (PUCHAR)InquiryData - Buffer;
+ BusData->InquiryDataOffset = (ULONG)((PUCHAR)InquiryData - Buffer);
/* Get a pointer to the LUN information structure */
LunInfo = DeviceExtension->BusesConfig->BusScanInfo[Bus]->LunInfo;
InquiryData->InquiryDataLength = INQUIRYDATABUFFERSIZE;
InquiryData->DeviceClaimed = LunInfo->DeviceClaimed;
InquiryData->NextInquiryDataOffset =
- (PUCHAR)InquiryData + InquiryDataSize - Buffer;
+ (ULONG)((PUCHAR)InquiryData + InquiryDataSize - Buffer);
/* Copy data in it */
RtlCopyMemory(InquiryData->InquiryData,
L"\\Registry\\Machine\\Hardware\\DeviceMap\\Scsi");
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
- OBJ_CASE_INSENSITIVE | OBJ_OPENIF,
+ OBJ_CASE_INSENSITIVE | OBJ_OPENIF | OBJ_KERNEL_HANDLE,
0,
NULL);
Status = ZwCreateKey(&ScsiKey,
NameBuffer);
InitializeObjectAttributes(&ObjectAttributes,
&KeyName,
- 0,
+ OBJ_KERNEL_HANDLE,
ScsiKey,
NULL);
Status = ZwCreateKey(&ScsiPortKey,
0,
REG_SZ,
DriverName,
- (wcslen(DriverName) + 1) * sizeof(WCHAR));
+ (ULONG)((wcslen(DriverName) + 1) * sizeof(WCHAR)));
if (!NT_SUCCESS(Status))
{
DPRINT("ZwSetValueKey('Driver') failed (Status %lx)\n", Status);
0,
REG_SZ,
NameBuffer,
- (wcslen(NameBuffer) + 1) * sizeof(WCHAR));
+ (ULONG)((wcslen(NameBuffer) + 1) * sizeof(WCHAR)));
if (!NT_SUCCESS(Status))
{
DPRINT("ZwSetValueKey('Identifier') failed (Status %lx)\n", Status);
0,
REG_SZ,
TypeName,
- (wcslen(TypeName) + 1) * sizeof(WCHAR));
+ (ULONG)((wcslen(TypeName) + 1) * sizeof(WCHAR)));
if (!NT_SUCCESS(Status))
{
DPRINT("ZwSetValueKey('Type') failed (Status %lx)\n", Status);
return(Address.u.LowPart);
}
-
/* EOF */