0

I'm writing a windows client application, and i wish to have a global unique identifier which is not generated by my application (I don't want to generate a GUID and save it locally).
Also - each application is installed separately for each windows user.

I have no problem uniquely identify the machine, but I'm not sure about uniquely identify user. i can use the logged in user's SID (security identifier), but i'm not sure what is the life span of SID.

Is the SID per user constant? Or perhaps it changes every session?

Any ideas on how to uniquely identify a user with a permanent ID?

(I want a pre-existing identifier, so i could detect returning users) Should be supported for Windows XP through Win7.

Thanks,

Community
  • 1
  • 1
Bagelzone Ha'bonè
  • 1,192
  • 1
  • 14
  • 29
  • Isn't the SID that token that is stored on the hdd for file ACLs? It should better not change too often then... – PlasmaHH Feb 07 '12 at 15:01
  • @PlasmaHH - I don't want to change the SID, i just want to make sure that it's constant and won't change ever – Bagelzone Ha'bonè Feb 07 '12 at 15:04
  • 1
    I think you want to identify *user accounts*, not *users*. Users are humans, and no SID will uniquely identify a human being. Multiple people could log in using the same account, and a single person could log in under multiple accounts. SIDs won't help you detect that, and it's not clear whether you even care about detecting that. Just be clear whether you're tracking people or accounts. – Rob Kennedy Feb 07 '12 at 15:28
  • 1
    @RobKennedy - Of course i meant identifying user accounts, and not actual human beings. – Bagelzone Ha'bonè Feb 07 '12 at 15:36

1 Answers1

2

The SID for a given user is constant and will not change between sessions.

However, for domain accounts the same user has the same SID on multiple machines.

Michael
  • 54,279
  • 5
  • 125
  • 144
  • Thanks! that's all i wanted to know. so just to make sure i understand you correctly - on a specific machine the SID per user is constant. Can you back up that statement with an MSDN article or something? – Bagelzone Ha'bonè Feb 07 '12 at 15:09
  • http://msdn.microsoft.com/en-us/library/windows/desktop/ms721625.aspx#_security_security_identifier_gly – Roger Lipscombe Feb 07 '12 at 15:20