I’m trying to use ExCreateCallback to detect a change from AC–>DC power
and back. I’m getting some initial calls into my callback function, but
not when I switch to DC power. Here’s the code I’m using, any ideas
what I’m doing wrong?
Thanks,
Daniel Nemiroff
OBJECT_ATTRIBUTES objectAttributes;
UNICODE_STRING unicodeName;
WCHAR NameBuffer = L"\Callback\PowerState";
RtlInitUnicodeString(&unicodeName, NameBuffer);
InitializeObjectAttributes(
&objectAttributes,
&unicodeName,
OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
NULL,
NULL);
status = ExCreateCallback(
&dx->pwrCallbackObject,
&objectAttributes,
FALSE,
FALSE);
PVOID callBackHandle = ExRegisterCallback(
dx->pwrCallbackObject,
powerStateCallBack,
dx);
If you’re getting some calls to your function, but none related to AC/DC
state, then the underlying machine probably doesn’t know what the AC/DC
state is. Do you get a battery icon in the task bar when you’re on DC? If
so, is it the one from Windows, or a custom one from an OEM?
“Nemiroff, Daniel” wrote in message
news:xxxxx@ntdev…
I’m trying to use ExCreateCallback to detect a change from ACàDC power and
back. I’m getting some initial calls into my callback function, but not
when I switch to DC power. Here’s the code I’m using, any ideas what I’m
doing wrong?
Thanks,
Daniel Nemiroff
OBJECT_ATTRIBUTES objectAttributes;
UNICODE_STRING unicodeName;
WCHAR NameBuffer = L"\Callback\PowerState";
RtlInitUnicodeString(&unicodeName, NameBuffer);
InitializeObjectAttributes(
&objectAttributes,
&unicodeName,
OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
NULL,
NULL);
status = ExCreateCallback(
&dx->pwrCallbackObject,
&objectAttributes,
FALSE,
FALSE);
PVOID callBackHandle = ExRegisterCallback(
dx->pwrCallbackObject,
powerStateCallBack,
dx);
Jake,
Thanks for responding. There is no generic battery icon. The system has a UPS on it with a custom tray icon.
Basically, I’m trying to detect (in my driver) when AC power is lost (and when it comes back).
With a custom tray icon (for this UPS) is there anyway to detect when this power transition occurs?
Thanks,
Daniel Nemiroff
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Jake Oshins
Sent: Wednesday, March 10, 2004 2:43 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] using ExRegisterCallBack for power state changes
If you’re getting some calls to your function, but none related to AC/DC
state, then the underlying machine probably doesn’t know what the AC/DC
state is. Do you get a battery icon in the task bar when you’re on DC? If
so, is it the one from Windows, or a custom one from an OEM?
“Nemiroff, Daniel” wrote in message
news:xxxxx@ntdev…
I’m trying to use ExCreateCallback to detect a change from AC?DC power and
back. I’m getting some initial calls into my callback function, but not
when I switch to DC power. Here’s the code I’m using, any ideas what I’m
doing wrong?
Thanks,
Daniel Nemiroff
OBJECT_ATTRIBUTES objectAttributes;
UNICODE_STRING unicodeName;
WCHAR NameBuffer = L"\Callback\PowerState";
RtlInitUnicodeString(&unicodeName, NameBuffer);
InitializeObjectAttributes(
&objectAttributes,
&unicodeName,
OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
NULL,
NULL);
status = ExCreateCallback(
&dx->pwrCallbackObject,
&objectAttributes,
FALSE,
FALSE);
PVOID callBackHandle = ExRegisterCallback(
dx->pwrCallbackObject,
powerStateCallBack,
dx);
—
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to xxxxx@lists.osr.com
If all you get is a custom tray icon, then Windows has no clue whether
the machine is running on AC or DC. You’d have to contact the people
who built your UPS and ask them how to get the data out of it, or out of
the software that they layered on top of it.
-----Original Message-----
Subject: RE: using ExRegisterCallBack for power state changes
From: “Nemiroff, Daniel”
Date: Wed, 10 Mar 2004 15:33:55 -0800
X-Message-Number: 15
Jake,
Thanks for responding. There is no generic battery icon. The system =
has a UPS on it with a custom tray icon. =20
Basically, I’m trying to detect (in my driver) when AC power is lost =
(and when it comes back).=20
With a custom tray icon (for this UPS) is there anyway to detect when =
this power transition occurs?
Thanks,
Daniel Nemiroff
-----Original Message-----
From: xxxxx@lists.osr.com =
[mailto:xxxxx@lists.osr.com] On Behalf Of Jake Oshins
Sent: Wednesday, March 10, 2004 2:43 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] using ExRegisterCallBack for power state changes
If you’re getting some calls to your function, but none related to AC/DC
state, then the underlying machine probably doesn’t know what the AC/DC
state is. Do you get a battery icon in the task bar when you’re on DC?
=
If
so, is it the one from Windows, or a custom one from an OEM?
- Jake Oshins
“Nemiroff, Daniel” wrote in message
news:xxxxx@ntdev…
I’m trying to use ExCreateCallback to detect a change from AC=E0DC power
=
and
back. I’m getting some initial calls into my callback function, but not
when I switch to DC power. Here’s the code I’m using, any ideas what =
I’m
doing wrong?
Thanks,
Daniel Nemiroff
OBJECT_ATTRIBUTES objectAttributes;
UNICODE_STRING unicodeName;
WCHAR NameBuffer =3D L"\Callback\PowerState";
RtlInitUnicodeString(&unicodeName, NameBuffer);
InitializeObjectAttributes(
&objectAttributes,
&unicodeName,
OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
NULL,
NULL);
status =3D ExCreateCallback(
&dx->pwrCallbackObject,
&objectAttributes,
FALSE,
FALSE);
PVOID callBackHandle =3D ExRegisterCallback(
dx->pwrCallbackObject,
powerStateCallBack,
dx);
—
Questions? First check the Kernel Driver FAQ at =
http://www.osronline.com/article.cfm?id=3D256
One final piece of information that goes to your point . . .
After uninstalling the SW that came with the UPS and used the in-the-box
driver from Microsoft I got the callback.
Thanks again,
Daniel
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jake Oshins
Sent: Wednesday, March 10, 2004 9:08 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] using ExRegisterCallBack for power state changes
If all you get is a custom tray icon, then Windows has no clue whether
the machine is running on AC or DC. You’d have to contact the people
who built your UPS and ask them how to get the data out of it, or out of
the software that they layered on top of it.
-----Original Message-----
Subject: RE: using ExRegisterCallBack for power state changes
From: “Nemiroff, Daniel”
Date: Wed, 10 Mar 2004 15:33:55 -0800
X-Message-Number: 15
Jake,
Thanks for responding. There is no generic battery icon. The system =
has a UPS on it with a custom tray icon. =20
Basically, I’m trying to detect (in my driver) when AC power is lost =
(and when it comes back).=20
With a custom tray icon (for this UPS) is there anyway to detect when =
this power transition occurs?
Thanks,
Daniel Nemiroff
-----Original Message-----
From: xxxxx@lists.osr.com =
[mailto:xxxxx@lists.osr.com] On Behalf Of Jake Oshins
Sent: Wednesday, March 10, 2004 2:43 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] using ExRegisterCallBack for power state changes
If you’re getting some calls to your function, but none related to AC/DC
state, then the underlying machine probably doesn’t know what the AC/DC
state is. Do you get a battery icon in the task bar when you’re on DC?
=
If
so, is it the one from Windows, or a custom one from an OEM?
- Jake Oshins
“Nemiroff, Daniel” wrote in message
news:xxxxx@ntdev…
I’m trying to use ExCreateCallback to detect a change from AC=E0DC power
=
and
back. I’m getting some initial calls into my callback function, but not
when I switch to DC power. Here’s the code I’m using, any ideas what =
I’m
doing wrong?
Thanks,
Daniel Nemiroff
OBJECT_ATTRIBUTES objectAttributes;
UNICODE_STRING unicodeName;
WCHAR NameBuffer =3D L"\Callback\PowerState";
RtlInitUnicodeString(&unicodeName, NameBuffer);
InitializeObjectAttributes(
&objectAttributes,
&unicodeName,
OBJ_CASE_INSENSITIVE | OBJ_PERMANENT,
NULL,
NULL);
status =3D ExCreateCallback(
&dx->pwrCallbackObject,
&objectAttributes,
FALSE,
FALSE);
PVOID callBackHandle =3D ExRegisterCallback(
dx->pwrCallbackObject,
powerStateCallBack,
dx);
—
Questions? First check the Kernel Driver FAQ at =
http://www.osronline.com/article.cfm?id=3D256
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
You are currently subscribed to ntdev as: xxxxx@intel.com
To unsubscribe send a blank email to xxxxx@lists.osr.com