Welcome to MSDN Blogs Sign in | Join | Help

PrivBar source (finally)

[Aug 15 2008:  Click here for updated links and instructions.] 

Finally, here is the often-requested and long-awaited source code for PrivBar.  In the process of code review, I’ve made minor updates to the DLL – which is now at v1.0.2.1. [2005-10-27:  Updated to remove dependency on VC/MFC DLLs.]

It’s originally based on the old “KBBar” IE toolband sample (KB 246234), and also incorporates some of Keith Brown’s “tokdumpsrv” token-dumping code.  It’s now a VS.NET 2003 project, but it was originally created and built with earlier versions of Visual Studio.  And, oh, it's all C++.

It could probably use a lot more internal documentation, but here are some random notes:

The mechanism that captures the security info might at first seem to be more complex than necessary.  There are a couple of classes that need to consume the security information.  The public interface to that information is a class with all static methods.  Behind it is a privately declared class in a .cpp file and a module-level singleton instantiation of that class, so that it gets instantiated exactly once when the DLL loads.  The group name lookups for the token-dumping dialog can be time consuming, so I kick off a background thread to get them so as not to hold up the rendering of the Explorer/IE window.  That requires proper synchronization of access to the string info, which requires proper one-time initialization of a CRITICAL_SECTION, etc.  I decided that the easiest way to do that was with the singleton.  It was thrown together pretty quickly, to be quite honest!  If I spent more time on it, I might have come up with something else.  It works, though, and as far as I can tell does not offer any exploitable surface area!

Published Thursday, October 13, 2005 9:56 PM by Aaron Margosis
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: PrivBar source (finally)

Wednesday, October 19, 2005 7:16 PM by Matt
After you released 1.0.2 I can not get the new DLL to load. When I try to use regsvr32 I get the error message “LoadLibrary(“C:\Non-Admin\PrivBar.dll”) failed – The specified module could not be found. Any ideas?

# Having trouble registering the file

Tuesday, October 25, 2005 8:24 AM by Robert
Hi Aaron, Great tool, I have been using the Privbar and MakemeAdmin for a while on my laptop, but just downloaded the brivbar zip at work and tried to register it, and I get the following error that I cannot seem to resolve: Loadlibrary("privbar.dll") failed - The Specified module could not be found I am a local admin on this system. Its very strange

# re: PrivBar source (finally)

Thursday, October 27, 2005 7:30 PM by Aaron Margosis
I've updated this - the original version had dependencies on DLLs that ship with Windows XP. The version I posted on Oct. 13 had dependencies on updated DLLs that aren't installed by default. The version I've just uploaded statically links all that stuff, so it should work on your machine! (Sorry for any inconvenience.)

# re: PrivBar source (finally)

Monday, October 31, 2005 12:25 PM by Robert
That worked great! Thanx!!

# re: PrivBar source (finally)

Wednesday, December 28, 2005 8:12 AM by Johannes Endres
What's the license? May I put it on a CD-ROM for distribution?

# re: PrivBar source (finally)

Saturday, January 28, 2006 11:08 AM by Wez Furlong
Can you build and make available x64 binaries for this? I'm feeling naked without it on my new win64 box. Thanks, --Wez.

# re: PrivBar source (finally)

Saturday, February 04, 2006 11:50 AM by Aaron Margosis
An x64 version would be great -- could you send me an x64 computer? :-)

# Table of contents, Aaron Margosis' non-admin blog

Sunday, February 05, 2006 11:30 PM by Aaron Margosis' WebLog
Complete list of Aaron Margosis' non-admin / least privilege posts, for easy lookup.

# re: PrivBar source (finally)

Sunday, July 23, 2006 8:41 AM by Rade

I am having problems compiling this project in Visual Studio 2003, I am geting following errors:

...\PrivBar\KBBarBand.h(76): error C2501: 'CKBBarBand::IInputObjectSitePtr' : missing storage-class or type specifiers

...\PrivBar\KBBarBand.h(76): error C2501: 'CKBBarBand::m_pIOSite' : missing storage-class or type specifiers

I download this source and tryed to compiple it, I haven't made any changes to it.

Make sure you have installed a relatively recent Platform SDK and that its directories are in the include path, etc.

-- Aaron

# re: PrivBar source (finally)

Friday, September 15, 2006 8:06 PM by Darkangel

Hello, sorry for my english, i'm french!
I have downloaded the source of this project and i have the same errors that "Rade" has...
I don't know if my SDK is up to date and i don't know qhere i can add the good directories to the projet.

Please could you help me?

You can download the Platform SDK from msdn.microsoft.com/downloads, or get it as part of an MSDN Subscription.

In Visual Studio, choose Tools / Options, then look for VC++ Directories (actual location may vary based on Visual Studio version).

Hope this helps.

-- Aaron

# re: PrivBar source (finally)

Sunday, October 22, 2006 8:08 AM by Desmond Lee

Hi Aaron,

We met a couple of times at a few Tech.Ed / IT.Forum events (US and EMEA). Now that IE 7 is officially out, will there be an update of PrivBar available? Otherwise what is the equivalent?

Thanks (contactable on blog > Feedback link) !

Hi, Desmond.  I've used PrivBar on Vista without any problems.  I haven't tried it on XP+IE7 yet but I'm not aware of any issues.  Have you tried it yet?

-- Aaron

# re: PrivBar source (finally)

Friday, October 27, 2006 7:53 PM by Desmond Lee

Aaron hello,

System: XP SP2 with IE7 RTM installed. Looks like PrivBar has been auto migrated from IE6 SP2 (on XP SP2) without reinstallation and it seems to function without any problems so far except:

a. it cannot be positioned on the same row as the new IE7 menu toolbar (where the back/forth buttons and the address bar sit). This was possible with IE6 previously. Perhaps it has got to do with the fact that this IE7 "toolbar" is permanently anchored and UNmovable even when the Lock the Toolbar option is disabled (default).

b. the font size of PrivBar seems to shrink or expand depending on the active tabs being selected.

Anything a user can do to fix these 2 annoyances?

Thanks again!

# re: PrivBar source (finally)

Monday, November 27, 2006 8:31 AM by Desmond Lee

Hello Aaron,

Did you have time to check into my last feedback? Incidentally I did not manage to meet you in IT Forum 2006; were you there?

Thanks & rgds,

Desmond, sorry for the delay -- I didn't have an XP+IE7 system until recently.  I think you are correct about the toolbar issue -- the row with the back/forward buttons, address bar, etc., does not appear to be available for adding custom toolbars.  Regarding the font size issue, I don't see that happening.  Can you provide repro steps?

Wish I could have been at IT Forum this year.  Maybe next year? :-)

-- Aaron

# re: PrivBar source (finally)

Thursday, December 28, 2006 10:37 AM by Vaelek

Specifically what directories need to be included from the platform sdk? I have attempted both privbar and kbbar and get the same errors listed above. I have added several directories from src and include to the project and it doesn't seem to make a difference.

Vaelek:  You should install the Platform SDK using its installer, installing it to an appropriate system-wide location (the default is for it to go under %ProgramFiles%).  If I remember correctly, if you have Visual Studio installed already, it will offer to add its directories to VS' settings.  If not, in Visual Studio 2005, choose Tools / Options, navigate to Projects and Solutions \ VC++ Directories.  For each of the items in the "Show directories for" dropdown (particularly for the "Include" and "Libraries" folders), ensure that the appropriate Platform SDK folder is listed first.  For Visual Studio .NET 2003, the same thing is in Tools / Options, navigate to Projects, VC++ Directories.

HTH

-- Aaron

# re: PrivBar source (finally)

Wednesday, May 23, 2007 10:58 AM by marco donizelli

same issues as Vaelek, despite downloading Microsoft Platform SDK for Windows Server 2003 R2, and including the Include and all subdirectories in Visual C++ Express 2005. I also explicitly added an extra:

#include <comdef.h>

as per KBBAR postings.

Did you try to compile the bar using Visual C++ Express 2005?

m

# re: PrivBar source (finally)

Friday, October 05, 2007 4:52 AM by Shajeer

Hi Aaron

I am in the phase of converting my source code from vc++6.0 to vc++8.0. I am using IInputObjectSitePtr(same as KBBar) and when I compile it is throwing me the error. I am using Vista Business edition and I have updated latest SDK and included it in the directories. Please do advice.

--Shaj

# Resource Kit Done!

Friday, February 15, 2008 1:31 AM by Jesper's Blog

Last Friday the last of the Windows Server 2008 Security Resource Kit finally went to press! This was

# re: PrivBar source (finally)

Tuesday, June 02, 2009 7:32 AM by Anoop Kumar

Keep  this file in stdafx.h

#include <comdef.h>

And also make sure you have installed SDK and specify the path of SDK include Folder (Given Below)

C:\Program Files\Microsoft SDKs\Windows\v6.0\Include

in Visual Studio 2008, choose Tools / Options, navigate to Projects and Solutions \ VC++ Directories .

Thats All.

------ Anoop Kumar

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker