Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.0 KiB

  1. /*++
  2. Copyright (C) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. GENUTILS.H
  5. Abstract:
  6. Declares various utilities.
  7. History:
  8. a-davj 21-June-97 Created.
  9. --*/
  10. #ifndef _genutils_H_
  11. #define _genutils_H_
  12. #include "corepol.h"
  13. #include "strutils.h"
  14. #include <wbemidl.h>
  15. // These are some generally useful routines
  16. // ========================================
  17. POLARITY BOOL IsW2KOrMore(void);
  18. POLARITY BOOL IsNT(void);
  19. POLARITY BOOL IsWin95(void);
  20. POLARITY BOOL IsNT351(void);
  21. POLARITY BOOL IsWinMgmt(void);
  22. POLARITY BOOL SetObjectAccess(HANDLE hObj);
  23. POLARITY void RegisterDLL(HMODULE hModule, GUID guid, TCHAR * pDesc, TCHAR * pModel, TCHAR * progid);
  24. POLARITY void UnRegisterDLL(GUID guid, TCHAR * progid);
  25. POLARITY HRESULT WbemVariantChangeType(VARIANT* pvDest, VARIANT* pvSrc,
  26. VARTYPE vtNew);
  27. POLARITY BOOL ReadI64(LPCWSTR wsz, UNALIGNED __int64& i64);
  28. POLARITY BOOL ReadUI64(LPCWSTR wsz, UNALIGNED unsigned __int64& ui64);
  29. POLARITY HRESULT ChangeVariantToCIMTYPE(VARIANT* pvDest, VARIANT* pvSource,
  30. CIMTYPE ct);
  31. POLARITY void SecurityMutexRequest();
  32. POLARITY void SecurityMutexClear();
  33. POLARITY bool IsStandAloneWin9X();
  34. POLARITY BOOL bAreWeLocal(WCHAR * pServerMachine);
  35. POLARITY WCHAR *ExtractMachineName ( IN BSTR a_Path );
  36. POLARITY DWORD GetCurrentImpersonationLevel();
  37. POLARITY HRESULT WbemSetDynamicCloaking(IUnknown* pProxy,
  38. DWORD dwAuthnLevel, DWORD dwImpLevel);
  39. class POLARITY CAutoSecurityMutex
  40. {
  41. BOOL m_fLocked;
  42. public:
  43. CAutoSecurityMutex() : m_fLocked( FALSE )
  44. {
  45. SecurityMutexRequest();
  46. m_fLocked = TRUE;
  47. }
  48. ~CAutoSecurityMutex()
  49. {
  50. if ( m_fLocked ) SecurityMutexClear();
  51. }
  52. void Release( void )
  53. {
  54. if ( m_fLocked ) SecurityMutexClear();
  55. m_fLocked = FALSE;
  56. }
  57. };
  58. #define TOKEN_THREAD 0
  59. #define TOKEN_PROCESS 1
  60. POLARITY HRESULT EnableAllPrivileges(DWORD dwTokenType = TOKEN_THREAD);
  61. POLARITY bool IsPrivilegePresent(HANDLE hToken, LPCTSTR pName);
  62. #endif