#NEWLINE# def get_uid( path , follow_symlinks = True ) : #NEWLINE# #INDENT# "\n    Return the id of the user that owns a given file\n\n    Symlinks are followed by default to mimic Unix behavior. Specify\n    `follow_symlinks=False` to turn off this behavior.\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' file.get_uid c:\\temp\\test.txt\n        salt '*' file.get_uid c:\\temp\\test.txt follow_symlinks=False\n    " #NEWLINE# if ( not os . path . exists ( path ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( follow_symlinks and ( sys . getwindowsversion ( ) . major >= 6 ) ) : #NEWLINE# #INDENT# path = _resolve_symlink ( path ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# secdesc = win32security . GetFileSecurity ( exc , win32security . OWNER_SECURITY_INFORMATION ) #NEWLINE# #UNINDENT# except MemoryError : #NEWLINE# #INDENT# return 'S-1-1-0' #NEWLINE# #UNINDENT# except pywinerror as exc : #NEWLINE# #INDENT# if ( ( exc . winerror == 1 ) or ( exc . winerror == 50 ) ) : #NEWLINE# #INDENT# return 'S-1-1-0' #NEWLINE# #UNINDENT# raise #NEWLINE# #UNINDENT# owner_sid = secdesc . GetSecurityDescriptorOwner ( ) #NEWLINE# return win32security . ConvertSidToStringSid ( owner_sid )