Nov 192008

It’s quite normal that an administrator can set restrictions on certain users for security reasons, for e.g. in my company I’ve restrictions which prevents me from changing my screensaver etc, which is kinda bad in my opinion and there are other restrictions too.

So the question, is there an API which helps us in finding out the restrictions set? One day while doing some programming I bumped into a windows API function called SHRestricted which is very cool in my opinion. Very easy to use, it just takes an integer corresponding to an access right.

Signature of SHRestricted looks like this…

DWORD SHRestricted( RESTRICTIONS rest );

RESTRICTIONS is an enum with about 84 entries, plenty of them.

So lets take an example, I want to find out if there is a “web tab” in my desktop properties dialog, this is how I would do it…

if( SHRestricted( REST_NOWEB ))
    MessageBox( "I am not allowed to play around with the web tab, :( " );

There might be other API’s with bit more complexity but this one I loved using. But there is one caveat, MSDN says that this function can change or can be removed. So watch out and until then have fun. 😉

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.