Abstractions.WindowsApi.pInvokes.GetUserProfilePath C# (CSharp) Метод

GetUserProfilePath() публичный статический Метод

returns userprofile based on SHGetFolderPath only if the profile realy exists and the ProfileList regkey is not of SID.bak (Abstractions.User.FixProfileList) empty string means error
public static GetUserProfilePath ( IntPtr hToken ) : string
hToken IntPtr
Результат string
        public static string GetUserProfilePath(IntPtr hToken)
        {
            const int MaxPath = 260;
            StringBuilder sb = new StringBuilder(MaxPath);

            int hResult = SafeNativeMethods.SHGetFolderPath(IntPtr.Zero, 0x0028/*CSIDL_PROFILE*/, hToken, 0x0000, sb);
            if (hResult != 0)
            {
                LibraryLogging.Error("SHGetFolderPath error:{0}", LastError());
                return "";
            }

            return sb.ToString();
        }