Enum logged on users and SID`s

Share your advanced PureBasic knowledge/code with the community.
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 796
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Enum logged on users and SID`s

Post by Zebuddi123 »

Hi to All

Using Droopy`s UserLogged() to enumerate logged on users and there SID`s ( because UserLogged() returns a csv string) i wrote this little string parser

Fell free to amend do as you will if its of use to anyone

Code: Select all

Global NewList s$()

ProcedureDLL Parse4Strings(t$, delim$ , List string$())
	NewList Delimpos.l()
	Protected r, x, a :  r=0
	Repeat
		x=FindString(t$,delim$,r+1)
		If x :	AddElement(DelimPos()) :	DelimPos()=x : 	EndIf
		r=x :	t+1
	Until x=0
	ResetList(DelimPos())
	FirstElement(DelimPos())
	a=0
	For i=1 To t
		AddElement(string$())
		string$()=Mid(t$,a,DelimPos.l()-1)
		NextElement(DelimPos.l())
		a=DelimPos.l()+1
	Next
	FreeList(Delimpos())
EndProcedure


Parse4Strings(UserLogged() , "," , s$())

ResetList(s$())
FirstElement(s$())
ForEach s$()
	Debug s$()	+ "  " + GetUserSid(s$())
Next
Zebuddi. :)
malleo, caput, bang. Ego, comprehendunt in tempore