WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Network Related

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

UDF - GetUserNameEx - Get Canonical Names, Etc.

Keywords: 	 UDF - GetUserNameEx - Get Canonical Names

;  NameUnknown = 0, 
;  NameFullyQualifiedDN = 1, 
;  NameSamCompatible = 2, 
;  NameDisplay = 3, 
;  NameUniqueId = 6, 
;  NameCanonical = 7, 
;  NameUserPrincipal = 8, 
;  NameCanonicalEx = 9, 
;  NameServicePrincipal = 10, 
;  NameDnsDomain = 12
;
;BOOLEAN GetUserNameEx(
;  EXTENDED_NAME_FORMAT NameFormat,
;  LPTSTR lpNameBuffer,
;  PULONG nSize
;);


#DefineFunction GetUserNameEx(type)
  dll=Strcat(DirWindows(1),"secur32.dll")
  bbsize=1000
  bb=BinaryAlloc(bbsize)
  BinaryEODSet(bb,bbsize)
  bbs=BinaryAlloc(4)
  BinaryPoke4(bbs,0,bbsize)
  DllCall(dll,long:"GetUserNameExA",long:type,lpbinary:bb,lpbinary:bbs)
  retval=BinaryPeekStr(bb,0,bbsize)
  BinaryFree(bb)
  BinaryFree(bbs)
  Return(retval)
#EndFunction


;demo
for xx=0 to 12
   uname=GetUserNameEx(xx)
   Message("Name code type = %xx%",uname)
next

Message("All","Done")



Article ID:   W15733
File Created: 2003:05:13:11:29:52
Last Updated: 2003:05:13:11:29:52