Abstractions.WindowsApi.pInvokes.GetOrSetUserProfileDir C# (CSharp) 메소드

GetOrSetUserProfileDir() 공개 정적인 메소드

get or create user profile directory only if the ProfileList regkey is not of SID.bak (Abstractions.User.FixProfileList) an empty or null string means error
public static GetOrSetUserProfileDir ( string username, string domain, string password ) : string
username string
domain string
password string
리턴 string
        public static string GetOrSetUserProfileDir(string username, string domain, string password)
        {
            string ret = "";
            StringBuilder path = new StringBuilder(260);
            uint path_size = Convert.ToUInt32(path.Capacity);

            IntPtr hToken = GetUserToken(username, domain, password);
            if (hToken == IntPtr.Zero)
            {
                LibraryLogging.Error("GetOrSetUserProfileDir can't get userToken");
                return "";
            }

            ret = GetUserProfileDir(hToken);
            if (String.IsNullOrEmpty(ret))
            {
                ret = CreateUserProfileDir(hToken, username);
                if (String.IsNullOrEmpty(ret))
                {
                    LibraryLogging.Error("GetOrSetUserProfileDir failed to get and create profile error:{0}", LastError());
                }
            }
            SafeNativeMethods.CloseHandle(hToken);

            return ret;
        }