flat assembler
Message board for the users of flat assembler.

Index > Windows > Two API questions

Author
Thread Post new topic Reply to topic
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 01 Oct 2009, 19:03
1)
What function(s) do I use to toggle the "Better performance (default)" "Enable write caching" and "Turn off Windows write-cache buffer flushing" storage device options? I want to make a program that automatically disables them when the UPS battery is low and enables them again when it is no longer low.

2)
What function(s) do I use to directly read from the screen, in userland? There are a lot of APIs for taking screenshots and stuff, but the only ones I've found are really inconsistent; e.g. they don't work with certain full screen 3D applications, and very slow..

_________________
Post 01 Oct 2009, 19:03
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 01 Oct 2009, 19:30
1) AFAIK you can't, those are just parameters you put into WriteFile, so if the app doesn't have it, then you can't.

_________________
Previously known as The_Grey_Beast
Post 01 Oct 2009, 19:30
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 01 Oct 2009, 19:32
Confused
I can change them in the GUI.. so doesn't the GUI call a function that can set them?
Image


I know I should try to disassemble explorer.exe to see how it does it, but I thought it would be easier if someone could just tell me, since there's a lot of stuff in it..

_________________
Post 01 Oct 2009, 19:32
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 01 Oct 2009, 23:22
Oh, you mean on the entire device. I don't know how to use device API, I'm not sure you're even allowed without a driver, are you? But then I'm no Windows internal guru, sorry Confused

_________________
Previously known as The_Grey_Beast
Post 01 Oct 2009, 23:22
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 02 Oct 2009, 05:54
Azu, use sysinternals' ProcMon to see what registry values are modified when changing the settings - I reckon that should be enough.

PS: you really don't want the "turn off windows write-cache buffer flushing on the device" (known in previous versions as "advanced performance") - what it does is make FlushFileBuffers() do absolutely nothing, which totally ruins applications' chance of ensuring safe write operations.
Post 02 Oct 2009, 05:54
View user's profile Send private message Visit poster's website Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 02 Oct 2009, 07:23
also keep in mind: some of such changes can be applied only after system restart
Post 02 Oct 2009, 07:23
View user's profile Send private message Visit poster's website Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 02 Oct 2009, 07:32
shoorick wrote:
also keep in mind: some of such changes can be applied only after system restart
!?!?


Gah!!

Crying or Very sad



It never said anything to me about restarting. But it does with some other things (like the pagefile).

Damn confusing Windows. X_X

_________________
Post 02 Oct 2009, 07:32
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 02 Oct 2009, 09:51
i'm just supposing, can be wrong about particular feature
Post 02 Oct 2009, 09:51
View user's profile Send private message Visit poster's website Reply with quote
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk 04 Oct 2009, 03:45
I didn't really gave a good look around it, but I suppose that you may call the driver directly, through ioctl call, and then pass IOCTL_DISK_SET_CACHE_INFORMATION as a flag (or kind of operation), filling a DISK_CACHE_INFORMATION structure.

Well, I guess that now you will have enough to google and figure out the rest by yourself.

Good Luck
Post 04 Oct 2009, 03:45
View user's profile Send private message Reply with quote
jbojarczuk



Joined: 21 Jun 2006
Posts: 27
jbojarczuk 05 Oct 2009, 11:10
Obs: The function used for this purpose is DeviceIoControl
Post 05 Oct 2009, 11:10
View user's profile Send private message Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 05 Oct 2009, 11:13
Thanks Very Happy
Post 05 Oct 2009, 11:13
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.