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.

92 lines
4.0 KiB

  1. //*************************************************************
  2. //
  3. // Header file for Util.c
  4. //
  5. // Microsoft Confidential
  6. // Copyright (c) Microsoft Corporation 1995
  7. // All rights reserved
  8. //
  9. //*************************************************************
  10. #define FreeProducedString(psz) if((psz) != NULL) {LocalFree(psz);} else
  11. LPWSTR ProduceWFromA(LPCSTR pszA);
  12. LPSTR ProduceAFromW(LPCWSTR pszW);
  13. LPTSTR CheckSlash (LPTSTR lpDir);
  14. LPTSTR CheckSemicolon (LPTSTR lpDir);
  15. BOOL Delnode (LPTSTR lpDir);
  16. UINT CreateNestedDirectory(LPCTSTR lpDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  17. UINT CreateNestedDirectoryEx(LPCTSTR lpDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes, BOOL bInheritEncryption);
  18. BOOL GetProfilesDirectoryEx(LPTSTR lpProfilesDir, LPDWORD lpcchSize, BOOL bExpand);
  19. BOOL GetDefaultUserProfileDirectoryEx (LPTSTR lpProfileDir, LPDWORD lpcchSize, BOOL bExpand);
  20. BOOL GetAllUsersProfileDirectoryEx (LPTSTR lpProfileDir, LPDWORD lpcchSize, BOOL bExpand);
  21. int StringToInt(LPTSTR lpNum);
  22. BOOL RegDelnode (HKEY hKeyRoot, LPTSTR lpSubKey);
  23. BOOL DeleteAllValues(HKEY hKey);
  24. BOOL MakeFileSecure (LPTSTR lpFile, DWORD dwOtherSids);
  25. BOOL GetSpecialFolderPath (INT csidl, LPTSTR lpPath);
  26. BOOL GetFolderPath (INT csidl, HANDLE hToken, LPTSTR lpPath);
  27. BOOL SetFolderPath (INT csidl, HANDLE hToken, LPTSTR lpPath);
  28. void CenterWindow (HWND hwnd);
  29. BOOL UnExpandSysRoot(LPCTSTR lpFile, LPTSTR lpResult);
  30. LPTSTR AllocAndExpandEnvironmentStrings(LPCTSTR lpszSrc);
  31. void IntToString( INT i, LPTSTR sz);
  32. BOOL IsUserAGuest(HANDLE hToken);
  33. BOOL IsUserAnAdminMember(HANDLE hToken);
  34. BOOL IsUserALocalSystemMember(HANDLE hToken);
  35. BOOL IsUserAnInteractiveUser(HANDLE hToken);
  36. BOOL MakeRegKeySecure(HANDLE hToken, HKEY hKeyRoot, LPTSTR lpKeyName);
  37. BOOL FlushSpecialFolderCache (void);
  38. BOOL CheckForVerbosePolicy (void);
  39. int ExtractCSIDL(LPCTSTR pcszPath, LPTSTR* ppszUsualPath);
  40. LPTSTR MyGetDomainName (VOID);
  41. LPTSTR MyGetUserName (EXTENDED_NAME_FORMAT NameFormat);
  42. LPTSTR MyGetUserNameEx (EXTENDED_NAME_FORMAT NameFormat);
  43. LPTSTR MyGetComputerName (EXTENDED_NAME_FORMAT NameFormat);
  44. void StringToGuid( TCHAR *szValue, GUID *pGuid );
  45. void GuidToString( const GUID *pGuid, TCHAR * szValue );
  46. BOOL ValidateGuid( TCHAR *szValue );
  47. INT CompareGuid( GUID *pGuid1, GUID *pGuid2 );
  48. BOOL ImpersonateUser (HANDLE hNewUser, HANDLE *hOldUser);
  49. BOOL RevertToUser (HANDLE *hUser);
  50. BOOL RegCleanUpValue (HKEY hKeyRoot, LPTSTR lpSubKey, LPTSTR lpValueName);
  51. BOOL CreateSecureAdminDirectory (LPTSTR lpDirectory, DWORD dwOtherSids);
  52. BOOL AddPowerUserAce (LPTSTR lpFile);
  53. void ClosePingCritSec(void);
  54. PISECURITY_DESCRIPTOR MakeGenericSecurityDesc();
  55. LPTSTR GetUserGuid(HANDLE hToken);
  56. LPTSTR GetOldSidString(HANDLE hToken, LPTSTR lpKeyName);
  57. BOOL SetOldSidString(HANDLE hToken, LPTSTR lpSidString, LPTSTR lpKeyName);
  58. LPTSTR GetErrString(DWORD dwErr, LPTSTR szErr);
  59. LONG RegRenameKey(HKEY hKeyRoot, LPTSTR lpSrcKey, LPTSTR lpDestKey);
  60. BOOL IsNullGUID (GUID *pguid);
  61. BOOL GetMachineRole (LPINT piRole);
  62. BOOL IsUNCPath(LPCTSTR lpPath);
  63. LPTSTR MakePathUNC(LPTSTR pwszFile, LPTSTR szComputerName);
  64. LPTSTR SupportLongFileName (LPTSTR lpDir, LPDWORD lpWrkDirSize);
  65. BOOL SecureNestedDir (LPTSTR lpDir, PSECURITY_DESCRIPTOR pDirSd, PSECURITY_DESCRIPTOR pFileSd);
  66. BOOL SetEnvironmentVariableInBlock(PVOID *pEnv, LPTSTR lpVariable,
  67. LPTSTR lpValue, BOOL bOverwrite);
  68. DWORD ExpandUserEnvironmentStrings(PVOID pEnv, LPCTSTR lpSrc,
  69. LPTSTR lpDst, DWORD nSize);
  70. LPTSTR ConvertToShareName(LPTSTR lpShare);
  71. DWORD AbleToBypassCSC(HANDLE hTokenUser, LPCTSTR lpDir, LPTSTR *lppCscBypassedPath, TCHAR *cpDrive);
  72. void CancelCSCBypassedConnection(HANDLE hTokenUser, TCHAR cDrive);
  73. LPTSTR GetUserNameFromSid(LPTSTR lpSid);
  74. int GetNetworkName( LPWSTR* pszName, DWORD dwAdapterIndex );
  75. //
  76. // Flags used to specify additional that needs to be present in ACEs
  77. //
  78. #define OTHERSIDS_EVERYONE 1
  79. #define OTHERSIDS_POWERUSERS 2
  80. #ifndef MAX
  81. #define MAX(a,b) (((a)>(b))?(a):(b))
  82. #endif
  83. #ifndef MIN
  84. #define MIN(a,b) (((a)<(b))?(a):(b))
  85. #endif