Home > Windows API > Function for retrieving user restrictions set by an administrator

Function for retrieving user restrictions set by an administrator

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. 😉

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: