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!

Comments (18)

  1. Matt says:

    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-AdminPrivBar.dll”) failed – The specified module could not be found. Any ideas?

  2. Robert says:

    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

  3. 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.)

  4. Robert says:

    That worked great! Thanx!!

  5. What’s the license? May I put it on a CD-ROM for distribution?

  6. Wez Furlong says:

    Can you build and make available x64 binaries for this? I’m feeling naked without it on my new win64 box.

    Thanks,

    –Wez.

  7. An x64 version would be great — could you send me an x64 computer? 🙂

  8. Complete list of Aaron Margosis’ non-admin / least privilege posts, for easy lookup.

  9. Rade says:

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

    …PrivBarKBBarBand.h(76): error C2501: ‘CKBBarBand::IInputObjectSitePtr’ : missing storage-class or type specifiers

    …PrivBarKBBarBand.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

  10. Darkangel says:

    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

  11. Desmond Lee says:

    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

  12. Desmond Lee says:

    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!

  13. Desmond Lee says:

    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

  14. Vaelek says:

    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

  15. marco donizelli says:

    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

  16. Shajeer says:

    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

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

  18. Anoop Kumar says:

    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 FilesMicrosoft SDKsWindowsv6.0Include

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

    Thats All.

    —— Anoop Kumar

Skip to main content