00001
00002
00003
00004
00005 #if ! defined( AFX_PRIV_H__C2404C08_2791_41F1_A45E_A62EF7364105__INCLUDED_ )
00006 #define AFX_PRIV_H__C2404C08_2791_41F1_A45E_A62EF7364105__INCLUDED_
00007 #pragma once
00008
00009
00013
00014
00015 namespace fksec {
00016
00072
00073 class priv
00074 {
00075 public:
00076
00077
00081 priv();
00082
00090 priv( const priv &s );
00091
00101 priv( const LUID s );
00102
00112 priv( unsigned __int64 s );
00113
00125 priv( const TCHAR *name );
00126
00133 virtual ~priv();
00134
00135
00136
00149 const priv &operator=( const priv &s );
00150
00161 const priv &operator=( const LUID s );
00162
00173 const priv &operator=( unsigned __int64 s );
00174
00187 const priv &operator=( const TCHAR *name );
00188
00189
00190
00202 bool operator==( const priv &r ) const;
00203
00215 bool operator!=( const priv &r ) const;
00216
00217
00218
00230 const TCHAR *GetPrivilegeName() const;
00231
00243 const TCHAR *GetDisplayName() const;
00244
00255 bool Enable();
00256
00267 bool Disable();
00268
00280 bool Toggle();
00281
00293 bool SetState( bool newState );
00294
00310 bool GetState() const;
00311
00326 void SetHandle( HANDLE h );
00327
00328
00329
00337 friend fkostream &operator<<( fkostream &o, const priv& p );
00338
00339 private:
00340
00347 void Init();
00348
00358 void openToken() const;
00359
00366 void closeToken() const;
00367
00376 void LookupNames() const;
00377
00387 void LookupValue( const TCHAR *name );
00388
00390 LUID privNum;
00391
00393 mutable fkstr privName;
00394
00396 mutable fkstr dispName;
00397
00404 mutable HANDLE ht;
00405 };
00406
00414 fkostream &operator<<( fkostream &o, const priv& p );
00415
00416 }
00417
00418 #endif // ! defined( AFX_PRIV_H__C2404C08_2791_41F1_A45E_A62EF7364105__INCLUDED_ )