@@ -111,7 +111,7 @@ CompBattRecalculateTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension)
111111 }
112112
113113 /* No tag for this device extension, clear it */
114- DeviceExtension -> Tag = 0 ;
114+ DeviceExtension -> Tag = BATTERY_TAG_INVALID ;
115115 NextEntry = NextEntry -> Flink ;
116116 }
117117
@@ -161,7 +161,7 @@ CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
161161 }
162162
163163 /* Do we have a tag now? */
164- if ((DeviceExtension -> Flags & COMPBATT_TAG_ASSIGNED ) && ( DeviceExtension -> Tag ) )
164+ if ((DeviceExtension -> Flags & COMPBATT_TAG_ASSIGNED ) && DeviceExtension -> Tag != BATTERY_TAG_INVALID )
165165 {
166166 /* Return the tag */
167167 * Tag = DeviceExtension -> Tag ;
@@ -170,7 +170,7 @@ CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension,
170170 else
171171 {
172172 /* No tag */
173- * Tag = 0 ;
173+ * Tag = BATTERY_TAG_INVALID ;
174174 Status = STATUS_NO_SUCH_DEVICE ;
175175 }
176176
@@ -261,7 +261,7 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo,
261261 InputBuffer .AtRate = 0 ;
262262
263263 /* Make sure the battery has a tag */
264- if (BatteryData -> Tag )
264+ if (BatteryData -> Tag != BATTERY_TAG_INVALID )
265265 {
266266 /* Do we already have the data? */
267267 if (!(BatteryData -> Flags & COMPBATT_BATTERY_INFORMATION_PRESENT ))
@@ -419,7 +419,7 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale,
419419 InputBuffer .InformationLevel = BatteryGranularityInformation ;
420420
421421 /* Make sure the battery has a tag */
422- if (BatteryData -> Tag )
422+ if (BatteryData -> Tag != BATTERY_TAG_INVALID )
423423 {
424424 /* Send the IOCTL to query the information */
425425 RtlZeroMemory (& BatteryData -> BatteryInformation ,
0 commit comments