* PROGRAMMER: Johannes Anderwald
*/
+#include "precomp.h"
-#include "priv.h"
+#include <stdio.h>
+#include <swenum.h>
+
+#define NDEBUG
+#include <debug.h>
LONG KsDeviceCount = 0;
IN LPWSTR ReferenceString)
{
LPWSTR DeviceName;
- ULONG Length;
+ SIZE_T Length;
PLIST_ENTRY Entry;
PBUS_DEVICE_ENTRY DeviceEntry = NULL; /* GCC warning */
BOOLEAN ItemExists = FALSE;
IN OUT PWCHAR *String)
{
LPWSTR Name;
- ULONG Length;
+ SIZE_T Length;
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension = (PBUS_ENUM_DEVICE_EXTENSION)Context;
/* sanity checks */
PIRP Irp,
PBUS_DEVICE_ENTRY DeviceEntry)
{
- ULONG Length;
+ SIZE_T Length;
LPWSTR Buffer;
PIO_STACK_LOCATION IoStack;
Length += wcslen(DeviceEntry->Instance);
/* zero byte and '\\' */
- Length += 2;
+ Length += 2;
/* allocate buffer */
Buffer = AllocateItem(NonPagedPool, Length * sizeof(WCHAR));
NTSTATUS Status;
ULONG ResultLength;
LPWSTR Name;
+ ULONG NameLength;
PBUS_DEVICE_ENTRY DeviceEntry;
/* FIXME handle pending remove */
/* get full device name */
- Status = IoGetDeviceProperty(DeviceObject, DevicePropertyPhysicalDeviceObjectName, sizeof(PDOName), (PVOID)PDOName, &ResultLength);
+ Status = IoGetDeviceProperty(DeviceObject, DevicePropertyPhysicalDeviceObjectName, sizeof(PDOName), PDOName, &ResultLength);
if (!NT_SUCCESS(Status))
{
}
/* allocate device name buffer */
- Name = AllocateItem(NonPagedPool, (ResultLength + 1) * sizeof(WCHAR));
+ NameLength = ResultLength + sizeof(UNICODE_NULL);
+ Name = AllocateItem(NonPagedPool, NameLength);
if (!Name)
{
/* no memory */
}
/* copy name */
- wcscpy(Name, PDOName);
+ NT_VERIFY(NT_SUCCESS(RtlStringCbCopyW(Name, NameLength, PDOName)));
/* TODO: time stamp creation time */
PBUS_DEVICE_ENTRY DeviceEntry;
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
LPWSTR Name;
- ULONG Length;
+ SIZE_T Length;
/* get current irp stack location */
IoStack = IoGetCurrentIrpStackLocation(Irp);
IN PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension,
IN PSWENUM_INSTALL_INTERFACE InstallInterface)
{
- ULONG Length, Index;
+ SIZE_T Length, Index;
UNICODE_STRING DeviceString, InterfaceString, ReferenceString;
HANDLE hKey, hDeviceKey, hInterfaceKey, hReferenceKey;
NTSTATUS Status;
PDEV_EXTENSION DeviceExtension;
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
PIO_STACK_LOCATION IoStack;
- ULONG Length;
+ SIZE_T Length;
NTSTATUS Status;
LPWSTR Buffer;
IN REFGUID InterfaceGuid OPTIONAL,
IN PWCHAR ServiceRelativePath OPTIONAL)
{
- ULONG Length;
+ SIZE_T Length;
NTSTATUS Status = STATUS_SUCCESS;
UNICODE_STRING ServiceKeyPath = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Services\\");
PBUS_ENUM_DEVICE_EXTENSION BusDeviceExtension;
}
BusDeviceExtension->ServicePath.Length = 0;
- BusDeviceExtension->ServicePath.MaximumLength = Length;
+ BusDeviceExtension->ServicePath.MaximumLength = (USHORT)Length;
BusDeviceExtension->ServicePath.Buffer = AllocateItem(NonPagedPool, Length);
if (!BusDeviceExtension->ServicePath.Buffer)
/*
@implemented
*/
-KSDDKAPI
+KSDDKAPI
NTSTATUS
NTAPI
KsRemoveBusEnumInterface(