https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8b5423aa601b214532284…
commit 8b5423aa601b2145322841d4923bf95e2d06d2be
Author: George Bișoc <george.bisoc(a)reactos.org>
AuthorDate: Sat Dec 14 21:36:49 2024 +0100
Commit: George Bișoc <george.bisoc(a)reactos.org>
CommitDate: Wed Jan 8 23:20:06 2025 +0100
[COMPBATT] Annotate all functions with SAL2
---
drivers/bus/acpi/compbatt/compbatt.c | 87 +++++++++++++++++++++---------------
drivers/bus/acpi/compbatt/compmisc.c | 24 +++++-----
drivers/bus/acpi/compbatt/comppnp.c | 43 +++++++++++-------
3 files changed, 90 insertions(+), 64 deletions(-)
diff --git a/drivers/bus/acpi/compbatt/compbatt.c b/drivers/bus/acpi/compbatt/compbatt.c
index 2c947910c29..313780d2d34 100644
--- a/drivers/bus/acpi/compbatt/compbatt.c
+++ b/drivers/bus/acpi/compbatt/compbatt.c
@@ -20,8 +20,9 @@ ULONG CompBattDebug;
NTSTATUS
NTAPI
-CompBattOpenClose(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
+CompBattOpenClose(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PIRP Irp)
{
PAGED_CODE();
if (CompBattDebug & 0x100) DbgPrint("CompBatt: ENTERING
OpenClose\n");
@@ -38,8 +39,9 @@ CompBattOpenClose(IN PDEVICE_OBJECT DeviceObject,
NTSTATUS
NTAPI
-CompBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
+CompBattSystemControl(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PIRP Irp)
{
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
NTSTATUS Status;
@@ -67,17 +69,19 @@ CompBattSystemControl(IN PDEVICE_OBJECT DeviceObject,
NTSTATUS
NTAPI
-CompBattMonitorIrpComplete(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp,
- IN PKEVENT Event)
+CompBattMonitorIrpComplete(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PIRP Irp,
+ _In_ PVOID Context)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS
+VOID
NTAPI
-CompBattMonitorIrpCompleteWorker(IN PCOMPBATT_BATTERY_DATA BatteryData)
+CompBattMonitorIrpCompleteWorker(
+ _In_ PCOMPBATT_BATTERY_DATA BatteryData)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
@@ -85,7 +89,8 @@ CompBattMonitorIrpCompleteWorker(IN PCOMPBATT_BATTERY_DATA
BatteryData)
VOID
NTAPI
-CompBattRecalculateTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+CompBattRecalculateTag(
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
PCOMPBATT_BATTERY_DATA BatteryData;
ULONG Tag;
@@ -122,8 +127,9 @@ CompBattRecalculateTag(IN PCOMPBATT_DEVICE_EXTENSION
DeviceExtension)
NTSTATUS
NTAPI
-CompBattIoctl(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
+CompBattIoctl(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PIRP Irp)
{
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
NTSTATUS Status;
@@ -146,8 +152,9 @@ CompBattIoctl(IN PDEVICE_OBJECT DeviceObject,
NTSTATUS
NTAPI
-CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
- OUT PULONG Tag)
+CompBattQueryTag(
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
+ _Out_ PULONG Tag)
{
NTSTATUS Status;
PAGED_CODE();
@@ -181,7 +188,8 @@ CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
NTSTATUS
NTAPI
-CompBattDisableStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+CompBattDisableStatusNotify(
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
PCOMPBATT_BATTERY_DATA BatteryData;
PLIST_ENTRY ListHead, NextEntry;
@@ -208,9 +216,10 @@ CompBattDisableStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION
DeviceExtension)
NTSTATUS
NTAPI
-CompBattSetStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
- IN ULONG BatteryTag,
- IN PBATTERY_NOTIFY BatteryNotify)
+CompBattSetStatusNotify(
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
+ _In_ ULONG BatteryTag,
+ _In_ PBATTERY_NOTIFY BatteryNotify)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
@@ -218,9 +227,10 @@ CompBattSetStatusNotify(IN PCOMPBATT_DEVICE_EXTENSION
DeviceExtension,
NTSTATUS
NTAPI
-CompBattQueryStatus(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
- IN ULONG Tag,
- IN PBATTERY_STATUS BatteryStatus)
+CompBattQueryStatus(
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
+ _In_ ULONG Tag,
+ _Out_ PBATTERY_STATUS BatteryStatus)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
@@ -228,8 +238,9 @@ CompBattQueryStatus(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
NTSTATUS
NTAPI
-CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
- IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+CompBattGetBatteryInformation(
+ _Out_ PBATTERY_INFORMATION BatteryInfo,
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
NTSTATUS Status = STATUS_SUCCESS;
BATTERY_QUERY_INFORMATION InputBuffer;
@@ -384,8 +395,9 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
NTSTATUS
NTAPI
-CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
- IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+CompBattGetBatteryGranularity(
+ _Out_ PBATTERY_REPORTING_SCALE ReportingScale,
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
NTSTATUS Status = STATUS_SUCCESS;
BATTERY_QUERY_INFORMATION InputBuffer;
@@ -470,8 +482,9 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE
ReportingScale,
NTSTATUS
NTAPI
-CompBattGetEstimatedTime(OUT PULONG Time,
- IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+CompBattGetEstimatedTime(
+ _Out_ PULONG Time,
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
UNIMPLEMENTED;
return STATUS_NOT_IMPLEMENTED;
@@ -479,13 +492,14 @@ CompBattGetEstimatedTime(OUT PULONG Time,
NTSTATUS
NTAPI
-CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
- IN ULONG Tag,
- IN BATTERY_QUERY_INFORMATION_LEVEL InfoLevel,
- IN OPTIONAL LONG AtRate,
- IN PVOID Buffer,
- IN ULONG BufferLength,
- OUT PULONG ReturnedLength)
+CompBattQueryInformation(
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
+ _In_ ULONG Tag,
+ _In_ BATTERY_QUERY_INFORMATION_LEVEL InfoLevel,
+ _In_opt_ LONG AtRate,
+ _In_ PVOID Buffer,
+ _In_ ULONG BufferLength,
+ _Out_ PULONG ReturnedLength)
{
BATTERY_INFORMATION BatteryInfo;
BATTERY_REPORTING_SCALE BatteryGranularity[4];
@@ -593,8 +607,9 @@ CompBattQueryInformation(IN PCOMPBATT_DEVICE_EXTENSION
DeviceExtension,
NTSTATUS
NTAPI
-DriverEntry(IN PDRIVER_OBJECT DriverObject,
- IN PUNICODE_STRING RegistryPath)
+DriverEntry(
+ _In_ PDRIVER_OBJECT DriverObject,
+ _In_ PUNICODE_STRING RegistryPath)
{
/* Register add device routine */
DriverObject->DriverExtension->AddDevice = CompBattAddDevice;
diff --git a/drivers/bus/acpi/compbatt/compmisc.c b/drivers/bus/acpi/compbatt/compmisc.c
index e84a2512706..5992273863a 100644
--- a/drivers/bus/acpi/compbatt/compmisc.c
+++ b/drivers/bus/acpi/compbatt/compmisc.c
@@ -14,13 +14,14 @@
NTSTATUS
NTAPI
-BatteryIoctl(IN ULONG IoControlCode,
- IN PDEVICE_OBJECT DeviceObject,
- IN PVOID InputBuffer,
- IN ULONG InputBufferLength,
- IN PVOID OutputBuffer,
- IN ULONG OutputBufferLength,
- IN BOOLEAN InternalDeviceIoControl)
+BatteryIoctl(
+ _In_ ULONG IoControlCode,
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PVOID InputBuffer,
+ _In_ ULONG InputBufferLength,
+ _Out_ PVOID OutputBuffer,
+ _Inout_ ULONG OutputBufferLength,
+ _In_ BOOLEAN InternalDeviceIoControl)
{
IO_STATUS_BLOCK IoStatusBlock;
KEVENT Event;
@@ -71,10 +72,11 @@ BatteryIoctl(IN ULONG IoControlCode,
NTSTATUS
NTAPI
-CompBattGetDeviceObjectPointer(IN PUNICODE_STRING DeviceName,
- IN ACCESS_MASK DesiredAccess,
- OUT PFILE_OBJECT *FileObject,
- OUT PDEVICE_OBJECT *DeviceObject)
+CompBattGetDeviceObjectPointer(
+ _In_ PUNICODE_STRING DeviceName,
+ _In_ ACCESS_MASK DesiredAccess,
+ _Out_ PFILE_OBJECT *FileObject,
+ _Out_ PDEVICE_OBJECT *DeviceObject)
{
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
diff --git a/drivers/bus/acpi/compbatt/comppnp.c b/drivers/bus/acpi/compbatt/comppnp.c
index f16bfd2ed3d..efc40e9f62e 100644
--- a/drivers/bus/acpi/compbatt/comppnp.c
+++ b/drivers/bus/acpi/compbatt/comppnp.c
@@ -16,8 +16,9 @@
NTSTATUS
NTAPI
-CompBattPowerDispatch(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
+CompBattPowerDispatch(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PIRP Irp)
{
PCOMPBATT_DEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
if (CompBattDebug & 1) DbgPrint("CompBatt: PowerDispatch received power
IRP.\n");
@@ -32,8 +33,9 @@ CompBattPowerDispatch(IN PDEVICE_OBJECT DeviceObject,
PCOMPBATT_BATTERY_DATA
NTAPI
-RemoveBatteryFromList(IN PCUNICODE_STRING BatteryName,
- IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+RemoveBatteryFromList(
+ _In_ PCUNICODE_STRING BatteryName,
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
PLIST_ENTRY ListHead, NextEntry;
PCOMPBATT_BATTERY_DATA BatteryData;
@@ -74,8 +76,9 @@ RemoveBatteryFromList(IN PCUNICODE_STRING BatteryName,
BOOLEAN
NTAPI
-IsBatteryAlreadyOnList(IN PCUNICODE_STRING BatteryName,
- IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+IsBatteryAlreadyOnList(
+ _In_ PCUNICODE_STRING BatteryName,
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
PLIST_ENTRY ListHead, NextEntry;
PCOMPBATT_BATTERY_DATA BatteryData;
@@ -110,8 +113,9 @@ IsBatteryAlreadyOnList(IN PCUNICODE_STRING BatteryName,
NTSTATUS
NTAPI
-CompBattAddNewBattery(IN PUNICODE_STRING BatteryName,
- IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+CompBattAddNewBattery(
+ _In_ PUNICODE_STRING BatteryName,
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
NTSTATUS Status = STATUS_SUCCESS;
PCOMPBATT_BATTERY_DATA BatteryData;
@@ -220,8 +224,9 @@ CompBattAddNewBattery(IN PUNICODE_STRING BatteryName,
NTSTATUS
NTAPI
-CompBattRemoveBattery(IN PCUNICODE_STRING BatteryName,
- IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+CompBattRemoveBattery(
+ _In_ PCUNICODE_STRING BatteryName,
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
PCOMPBATT_BATTERY_DATA BatteryData;
if (CompBattDebug & 1) DbgPrint("CompBatt: RemoveBattery\n");
@@ -245,7 +250,8 @@ CompBattRemoveBattery(IN PCUNICODE_STRING BatteryName,
NTSTATUS
NTAPI
-CompBattGetBatteries(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+CompBattGetBatteries(
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
PWCHAR p;
NTSTATUS Status;
@@ -286,8 +292,9 @@ CompBattGetBatteries(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
NTSTATUS
NTAPI
-CompBattPnpEventHandler(IN PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification,
- IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
+CompBattPnpEventHandler(
+ _In_ PDEVICE_INTERFACE_CHANGE_NOTIFICATION Notification,
+ _In_ PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
{
if (CompBattDebug & 1) DbgPrint("CompBatt: ENTERING
PnpEventHandler\n");
if (CompBattDebug & 2) DbgPrint("CompBatt: Received device interface change
notification\n");
@@ -319,8 +326,9 @@ CompBattPnpEventHandler(IN PDEVICE_INTERFACE_CHANGE_NOTIFICATION
Notification,
NTSTATUS
NTAPI
-CompBattAddDevice(IN PDRIVER_OBJECT DriverObject,
- IN PDEVICE_OBJECT PdoDeviceObject)
+CompBattAddDevice(
+ _In_ PDRIVER_OBJECT DriverObject,
+ _In_ PDEVICE_OBJECT PdoDeviceObject)
{
NTSTATUS Status;
UNICODE_STRING DeviceName;
@@ -402,8 +410,9 @@ CompBattAddDevice(IN PDRIVER_OBJECT DriverObject,
NTSTATUS
NTAPI
-CompBattPnpDispatch(IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp)
+CompBattPnpDispatch(
+ _In_ PDEVICE_OBJECT DeviceObject,
+ _In_ PIRP Irp)
{
PIO_STACK_LOCATION IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
NTSTATUS Status;