Your best source of information and news about windows, drivers and winvista on the internet

November 18th, 2007

You are currently browsing the articles from MS Windows Vista Compatible Software written on November 18th, 2007.

SetThreadPriority, Vista, and Autostart Locations

I ran across a post on the Vista Compatibility Team Blog entitled “SetThreadPriority from Run key” that discusses a change in Vista whereby calling SetThreadPriority from an application launched from the Startup folder and the “Run” key in the registry will not cause the thread’s priority to be increased.

Wanting to verify and play around with this, I wrote a simple program that called SetThreadPriority to set the priority of the thread to THREAD_PRIORITY_HIGHEST. The program then immediately called GetThreadPriority to determine if the call to SetThreadPriority had any effect. Next, in a loop, the program then called SetThreadPriority / GetThreadPriority until either an error was encountered, or GetThreadPriority returned the expected priority. The program logged before and after each call to SetThreadPriority / GetThreadPriority the time, the action, and the either the parameters or the return value.

I set the program to be launched automatically by placing a shortcut in the “Startup” folder, and rebooted. Once the system came back up, I waited a bit and then examined the log. The first call to SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_HIGHEST ); returned TRUE. The first call to GetThreadPriority( GetCurrentThread() ); returned 0 indicating THREAD_PRIORITY_NORMAL. In other words, the call to SetThreadPriority had succeeded, but the priority of the thread remained unchanged. The calls to SetThreadPriority and GetThreadPriority in the loop were identical, and returned identical values. That is, until about 45 seconds into the program’s execution, when the call to GetThreadPriority returned 2, indicating that the priority of the thread was THREAD_PRIORITY_HIGHEST. This matches what is mentioned in the “SetThreadPriority from Run key” blog entry, where it is stated that:

it is for about a minute or so after which the call to SetThreadPriority(THREAD_PRIORITY_HIGHEST ) will actually succeed in bumping up its priority level.

I repeated the same tests, using THREAD_PRIORITY_ABOVE_NORMAL in the call to SetThreadPriority, with the same results.

I also used THREAD_PRIORITY_BELOW_NORMAL in the call to SetThreadPriority as well as THREAD_PRIORITY_LOWEST; in these cases, the call indicated success and GetThreadPriority confirmed the change in priority immediately.

The next set of tests removed the call to SetThreadPriority in the loop - just the initial call to SetThreadPriority was made. The return indicated success, but the call to GetThreadPriority returned THREAD_PRIORITY_NORMAL for many minutes; as the loop was a tight loop, I terminated the process once it became apparent that there truly would be no change to the priority of the thread. This means that requests to increase the priority are not queued up or held for later processing. The call to increase priority indicates success, the priority is not changed, and unless the thread checks, it is none the wiser.

One other thing that I thought of trying was to see what happened when a thread in a process spawned by an “autostart” process called SetThreadPriority, as above. To do so, I modified the original program to accept a command-line parameter indicating that it should spawn another instance of itself. The thread in the spawned process behaved identically to the thread in the “autostart” process; this persisted 3 “levels” deep (”autostart” instance spawns instance x, which spawns instance y), which is as deep as I tried. The Vista Compatibility Team Blog entry only mentions the Startup folder and the “Run” key as being affected by this, but I wonder if other things may be affected. It is interesting (and a good thing!) that there is a mechanism in place to cause this behavior to affect processes spawned by autostart processes (otherwise, the “protection” offered by this feature is easily defeated).

As a last test, I invoked the test program manually as quickly as I could while Vista was still processing the login. The first attempt to change the priority of the thread succeeded, and the first call to GetThreadPriority confirmed the priority change. At the same time, Vista was processing the autostart instance of the program, which behaved as it had previously when started automatically. So there is not a blanket ban on priority boosting in the first minute or so - how a program is started truly affects what it can do.

»

Written by «/\/\Ø|ö±ò\/»®© on November 18th, 2007 with no comments.
Read more articles on threads and GetThreadPriority and priorities and autostart and run and startup and otherSoftware and SetThreadPriority and vista.

How To Change The Screensaver In Windows Vista

Years ago, people used screen savers to protect their monitors and to prevent what geeks call “burn in.”

Burn in, screen burn or phosphor burn in occurs when there is text or a static image that is displayed too long on a screen that’s not active, and a distortion results. Even when turned off, this distortion can be seen on the monitor.

You’d think that with improved CRT technology, screen savers would outlive their usefulness. Far from it. They’re very much around - one, they make your computer screen secure, and two, they’re fun and entertaining. (more…)

Written by MyVistaThemes.com on November 18th, 2007 with no comments.
Read more articles on change and screensaver and Articles and how to and vista and Windows.

How To Change The Icons In Windows Vista

One of the perks for using Windows Vista are the icons – not only are they great shortcuts but also are more flexible. When Microsoft introduced Vista, people were rather hesitant to adopt it because they had just gotten used to its predecessor – XP.

But those who wait are missing out on those cute Windows Vista icons that are visually pleasing on the screen – they’re like “signposts” making your work much easier.

Those who have made the transition from XP to Vista will find that the Windows Vista icons are a joy to work with. But first, what’s an icon? (more…)

Written by MyVistaThemes.com on November 18th, 2007 with no comments.
Read more articles on Articles and change and Icons and how to and vista and Windows.

How To Change The Wallpaper In Windows Vista

If friends and colleagues rave about their Windows Vista wallpapers and you don’t know what they’re talking about, don’t worry. Windows Vista wallpapers are actually just another name for “background.” And if you did make the move from XP to Vista, you have them right on your computer too!

Just as you would jazz up your bedroom or dining room with special wallpaper, you’d want to do the same for your computer screen. And whatever Windows Vista wallpaper you choose, it will no doubt add oomph to your screen, making it more visually appealing.

The simplest definition then for a Windows Vista wallpaper is the background or the picture that covers your desktop. (more…)

Written by MyVistaThemes.com on November 18th, 2007 with no comments.
Read more articles on Articles and change and how to and Wallpaper and vista and Windows.

How To Change The Theme In Windows Vista

The one good thing about Windows Vista Themes is that customization is entirely possible. And when you can customize you can naturally personalize. That’s right. Vista allows you to select your own themes in a few easy steps. This allows you to tinker with your computer to make it more attractive and less monotonous – when you want it and how you want it.

A Windows Vista theme is simply a group of customized tweeks that span the entire gamut of menu appearance, icons, colors, fonts, screen savers, background, and yes – even paints!

Let’s start with your desktop because it’s the most logical place to start. To select a desktop theme, perform the following steps: (more…)

Written by MyVistaThemes.com on November 18th, 2007 with no comments.
Read more articles on Articles and change and theme and how to and vista and Windows.

.NET Framework 3.5 Commonly Used Types and Namespaces Poster

A

Written by askars on November 18th, 2007 with 1 comment.
Read more articles on .NET Framework 3.0 and .NET Framework and Misc and .Net.

« Older articles

No newer articles