News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Seeking more help on Windows XP System Registry

Started by Shooter, February 01, 2011, 01:48:51 PM

Previous topic - Next topic

Shooter

I've been searching and searching for any info within the system registry for these two dialog settings. Any help would be greatly appreciated if you know where I can find these settings using Regedit, and hopefully they're global.

I'm trying to write a program that sets the "Turn off monitor" setting to "Never", change the "When I press the power button on my computer" to "Do nothing", and remove the checkmark from "Prompt for password when computer resumes from standby".




I work for a company that is replacing computers by the dozens at multiple worldwide locations and every step I can take to shorten the time helps tremendously. These settings are having to be changed manually, along with many others, and I'd rather run one program to make it happen all at once. I also need to turn off the screensaver.

Many thanks,
-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.


Shooter

Michael,
I think I'd have to have a program running all the time to utilize those. What I'm looking for is a means to change those settings permanently so that a person has to press the power button for 10+ seconds in order to turn off the computer... harsh, I know, but since they placed the power button on these computers (Dell ELO model 15A1) in such an easy-to-hit-accidentally location, I need to disable it.

-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

donkey

Quote from: Shooter on February 01, 2011, 03:02:43 PM
Michael,
I think I'd have to have a program running all the time to utilize those. What I'm looking for is a means to change those settings permanently so that a person has to press the power button for 10+ seconds in order to turn off the computer... harsh, I know, but since they placed the power button on these computers (Dell ELO model 15A1) in such an easy-to-hit-accidentally location, I need to disable it.

-Shooter

The power policy API does not require that the program calling it be running all the time, it changes things on the system level either for a user policy or a global machine policy.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Shooter

Edgar,
I've been looking over those links that Michael gave me... I must be daft or something because I'm not finding anything that fits my specific need, well, at least nothing is popping out saying, "Ooh, ooh. Pick me! Pick me!" lol

Do you know of a specific function that disables the power button?

-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

Magnum

One idea would be to velcro something like a bottle cap and put it over the power button.

Have a great day,
                         Andy

oex

:lol or train them by giving a little electric shock every time they touch it
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

japheth


You could use the old RegMon tool to monitor the registry access. It will give at least some hints.

To get rid of most of the other traffic, which confuses and disturbs only, close all other apps, including windows explorer, then do the change. I tried it and got:


14.34620881 RUNDLL32.EXE:1928 CreateKey HKCU\Control Panel\PowerCfg\GlobalPowerPolicy SUCCESS Key: 0xE144DA68
14.34622920 RUNDLL32.EXE:1928 CreateKey HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\GlobalPowerPolicy SUCCESS Key: 0xE264C5F0
14.34661137 RUNDLL32.EXE:1928 SetValue HKCU\Control Panel\PowerCfg\GlobalPowerPolicy\Policies SUCCESS 01 00 00 00 00 00 00 00 ...
14.34663121 RUNDLL32.EXE:1928 SetValue HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\GlobalPowerPolicy\Policies SUCCESS 01 00 00 00 01 00 00 00 ...
14.34670915 RUNDLL32.EXE:1928 QueryValue HKCU\Control Panel\PowerCfg\CurrentPowerPolicy SUCCESS "0"
14.34682816 RUNDLL32.EXE:1928 CreateKey HKCU\Control Panel\PowerCfg\PowerPolicies\0 SUCCESS Key: 0xE264C5F0
14.34684771 RUNDLL32.EXE:1928 CreateKey HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\0 SUCCESS Key: 0xE268D3D8
14.34688822 RUNDLL32.EXE:1928 QueryValue HKCU\Control Panel\PowerCfg\PowerPolicies\0\Policies SUCCESS 01 00 00 00 00 00 00 00 ...
14.34690415 RUNDLL32.EXE:1928 QueryValue HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\0\Policies SUCCESS 01 00 00 00 02 00 00 00 ...
14.34696756 RUNDLL32.EXE:1928 CreateKey HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies\0 SUCCESS Key: 0xE1160430
14.34697957 RUNDLL32.EXE:1928 QueryValue HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies\0\Policies BUFOVRFLOW
14.34699522 RUNDLL32.EXE:1928 QueryValue HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies\0\Policies SUCCESS 01 00 00 00 01 00 00 00 ...
14.34710696 RUNDLL32.EXE:1928 CreateKey HKCU\Control Panel\PowerCfg\PowerPolicies\0 SUCCESS Key: 0xE264C5F0
14.34712512 RUNDLL32.EXE:1928 CreateKey HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\0 SUCCESS Key: 0xE1160430
14.34716396 RUNDLL32.EXE:1928 SetValue HKCU\Control Panel\PowerCfg\PowerPolicies\0\Policies SUCCESS 01 00 00 00 00 00 00 00 ...
14.34717876 RUNDLL32.EXE:1928 SetValue HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\0\Policies SUCCESS 01 00 00 00 02 00 00 00 ...
14.34727989 RUNDLL32.EXE:1928 CreateKey HKCU\Control Panel\PowerCfg\GlobalPowerPolicy SUCCESS Key: 0xE1160430
14.34729917 RUNDLL32.EXE:1928 CreateKey HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\GlobalPowerPolicy SUCCESS Key: 0xE268D3D8
14.34733940 RUNDLL32.EXE:1928 SetValue HKCU\Control Panel\PowerCfg\GlobalPowerPolicy\Policies SUCCESS 01 00 00 00 00 00 00 00 ...
14.34735560 RUNDLL32.EXE:1928 SetValue HKLM\Software\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\GlobalPowerPolicy\Policies SUCCESS 01 00 00 00 01 00 00 00 ...

Magnum

Quote from: oex on February 01, 2011, 05:44:09 PM
:lol or train them by giving a little electric shock every time they touch it

Like a fence charger?  :U

Have a great day,
                         Andy

donkey

Hi shooter,

I doubt that you will find one worded exactly the way you expect. Usually with APIs such as this one there is a generic function that is switched by a GUID that identifies the parameter you are setting. It is for the most part a complicated interface to work with but allows for a large amount of flexibility and expansion with fewer exported API functions. You will find interfaces like this for functions that involve a very large number of different parameters and device specific settings, exporting a particular API for each or defining a massive header and innumerable constants is impractical in these cases.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Gunner

Quote from: Shooter on February 01, 2011, 05:29:56 PM
Do you know of a specific function that disables the power button?

-Shooter

The BIOS? would be easier :-)

Actually the links posted loo to do what you want.. look into WriteGlobalPwrPolicy, GLOBAL_USER_POWER_POLICY


~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com


donkey

A quick look at the link MichaelW gave you shows the WriteGlobalPwrPolicy which appears to do most if not all of what you want. Magnum has posted a rudimentary example of how to call it so you should be able to figure it out from there. For the screen saver that's just SystemParametersInfo there are plenty of examples of that.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Shooter

Alrighty then, is there a library to include that holds these functions? PowrProf.lib doesn't appear to be a valid library.

-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.