&ByteOffset,
NULL);
/* If it fails or returns inconsistent data, drop it (= truncate) */
- if (!NT_SUCCESS(Status) || IoStatusBlock.Information != EntrySize || EntrySize < sizeof(DATABASE_ENTRY))
+ if (!NT_SUCCESS(Status) ||
+ (IoStatusBlock.Information != EntrySize) ||
+ (EntrySize < sizeof(DATABASE_ENTRY)) )
{
TruncateRemoteDatabase(Database, StartingOffset);
FreePool(Entry);
/* Validate entry */
if (MAX(Entry->SymbolicNameOffset + Entry->SymbolicNameLength,
- Entry->UniqueIdOffset + Entry->UniqueIdLength) > EntrySize)
+ Entry->UniqueIdOffset + Entry->UniqueIdLength) > (LONG)EntrySize)
{
TruncateRemoteDatabase(Database, StartingOffset);
FreePool(Entry);
DeleteRemoteDatabaseEntry(IN HANDLE Database,
IN LONG StartingOffset)
{
- LONG EndSize;
+ ULONG EndSize;
PVOID TmpBuffer;
NTSTATUS Status;
- LONG DatabaseSize;
+ ULONG DatabaseSize;
PDATABASE_ENTRY Entry;
IO_STATUS_BLOCK IoStatusBlock;
LARGE_INTEGER EndEntriesOffset;
/* Acquire workers lock */
KeWaitForSingleObject(&(DeviceExtension->WorkerSemaphore), Executive, KernelMode, FALSE, NULL);
- OldIrql = KfAcquireSpinLock(&(DeviceExtension->WorkerLock));
+ KeAcquireSpinLock(&(DeviceExtension->WorkerLock), &OldIrql);
+
/* Ensure there are workers */
while (!IsListEmpty(&(DeviceExtension->WorkerQueueListHead)))
{
RECONCILE_WORK_ITEM,
WorkerQueueListEntry);
- KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
+ KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
/* Call it */
WorkItem->WorkerRoutine(WorkItem->Context);
}
KeWaitForSingleObject(&(DeviceExtension->WorkerSemaphore), Executive, KernelMode, FALSE, NULL);
- OldIrql = KfAcquireSpinLock(&(DeviceExtension->WorkerLock));
+ KeAcquireSpinLock(&(DeviceExtension->WorkerLock), &OldIrql);
}
- KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
+ KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
InterlockedDecrement(&(DeviceExtension->WorkerReferences));
}
/* Otherwise queue worker for delayed execution */
- OldIrql = KfAcquireSpinLock(&(DeviceExtension->WorkerLock));
+ KeAcquireSpinLock(&(DeviceExtension->WorkerLock), &OldIrql);
InsertTailList(&(DeviceExtension->WorkerQueueListHead),
&(WorkItem->WorkerQueueListEntry));
- KfReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
+ KeReleaseSpinLock(&(DeviceExtension->WorkerLock), OldIrql);
KeReleaseSemaphore(&(DeviceExtension->WorkerSemaphore), IO_NO_INCREMENT, 1, FALSE);
}
/* Return the volume name */
- VolumeName->Length = FileNameInfo->FileNameLength;
- VolumeName->MaximumLength = FileNameInfo->FileNameLength + sizeof(WCHAR);
+ VolumeName->Length = (USHORT)FileNameInfo->FileNameLength;
+ VolumeName->MaximumLength = (USHORT)FileNameInfo->FileNameLength + sizeof(WCHAR);
VolumeName->Buffer = AllocatePool(VolumeName->MaximumLength);
if (!VolumeName->Buffer)
{
}
if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
{
- Status == STATUS_SUCCESS;
+ Status = STATUS_SUCCESS;
Complete = TRUE;
}
if (!NT_SUCCESS(Status) || Complete)
}
/* And write them into new database */
- Length = IoStatusBlock.Information;
+ Length = (ULONG)IoStatusBlock.Information;
Status = ZwWriteFile(Database,
NULL,
NULL,
if (IntUniqueId)
{
/* Copy data & return */
- IntUniqueId->UniqueIdLength = ValueLength;
+ IntUniqueId->UniqueIdLength = (USHORT)ValueLength;
RtlCopyMemory(&(IntUniqueId->UniqueId), ValueData, ValueLength);
UniqueId = Context;