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();
}