mirror of
https://github.com/golang/go
synced 2024-09-29 13:34:30 -06:00
os/user: clean up grammar in comments
Change-Id: If9fe04894851d60a682346415c2e5523b2f04929 Reviewed-on: https://go-review.googlesource.com/96981 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
parent
7e9a8546e4
commit
db7af2e67b
@ -93,7 +93,7 @@ func getProfilesDirectory() (string, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lookupUsernameAndDomain obtains username and domain for usid.
|
// lookupUsernameAndDomain obtains the username and domain for usid.
|
||||||
func lookupUsernameAndDomain(usid *syscall.SID) (username, domain string, e error) {
|
func lookupUsernameAndDomain(usid *syscall.SID) (username, domain string, e error) {
|
||||||
username, domain, t, e := usid.LookupAccount("")
|
username, domain, t, e := usid.LookupAccount("")
|
||||||
if e != nil {
|
if e != nil {
|
||||||
@ -105,7 +105,7 @@ func lookupUsernameAndDomain(usid *syscall.SID) (username, domain string, e erro
|
|||||||
return username, domain, nil
|
return username, domain, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// findHomeDirInRegistry finds the user home path based on usid string
|
// findHomeDirInRegistry finds the user home path based on the uid.
|
||||||
func findHomeDirInRegistry(uid string) (dir string, e error) {
|
func findHomeDirInRegistry(uid string) (dir string, e error) {
|
||||||
k, e := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\`+uid, registry.QUERY_VALUE)
|
k, e := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\`+uid, registry.QUERY_VALUE)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
@ -180,21 +180,21 @@ func newUserFromSid(usid *syscall.SID) (*User, error) {
|
|||||||
if e != nil {
|
if e != nil {
|
||||||
return nil, e
|
return nil, e
|
||||||
}
|
}
|
||||||
// if this user has logged at least once his home path should be stored
|
// If this user has logged in at least once their home path should be stored
|
||||||
// in the registry under his SID. references:
|
// in the registry under the specified SID. References:
|
||||||
// https://social.technet.microsoft.com/wiki/contents/articles/13895.how-to-remove-a-corrupted-user-profile-from-the-registry.aspx
|
// https://social.technet.microsoft.com/wiki/contents/articles/13895.how-to-remove-a-corrupted-user-profile-from-the-registry.aspx
|
||||||
// https://support.asperasoft.com/hc/en-us/articles/216127438-How-to-delete-Windows-user-profiles
|
// https://support.asperasoft.com/hc/en-us/articles/216127438-How-to-delete-Windows-user-profiles
|
||||||
//
|
//
|
||||||
// the registry is the most reliable way to find the home path as the user
|
// The registry is the most reliable way to find the home path as the user
|
||||||
// might have decided to move it outside of the default location
|
// might have decided to move it outside of the default location,
|
||||||
// (e.g. c:\users). reference:
|
// (e.g. C:\users). Reference:
|
||||||
// https://answers.microsoft.com/en-us/windows/forum/windows_7-security/how-do-i-set-a-home-directory-outside-cusers-for-a/aed68262-1bf4-4a4d-93dc-7495193a440f
|
// https://answers.microsoft.com/en-us/windows/forum/windows_7-security/how-do-i-set-a-home-directory-outside-cusers-for-a/aed68262-1bf4-4a4d-93dc-7495193a440f
|
||||||
dir, e := findHomeDirInRegistry(uid)
|
dir, e := findHomeDirInRegistry(uid)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
// if the home path does not exists in the registry, the user might have
|
// If the home path does not exist in the registry, the user might
|
||||||
// not logged in yet; fall back to using getProfilesDirectory(). find the
|
// have not logged in yet; fall back to using getProfilesDirectory().
|
||||||
// username based on a SID and append that to the result of
|
// Find the username based on a SID and append that to the result of
|
||||||
// getProfilesDirectory(). the domain is not of relevance here.
|
// getProfilesDirectory(). The domain is not relevant here.
|
||||||
dir, e = getProfilesDirectory()
|
dir, e = getProfilesDirectory()
|
||||||
if e != nil {
|
if e != nil {
|
||||||
return nil, e
|
return nil, e
|
||||||
|
Loading…
Reference in New Issue
Block a user