Access Violation in LookupAccountSid Programming Software Development by BenWard … if that annoyed anyone. Anyway I have an issue using LookupAccountSid in a visual studio 2013 project running on Windows 7… Access violation reading location Programming Software Development by koleanu …d\n", GetLastError()); return NULL; } if(getGroup) bRtnBool = LookupAccountSid(NULL, pSidG, AcctName, (LPDWORD)&dwAcctName, DomainName, (LPDWORD)&dwDomainName…, &eUse); if(getOwner) bRtnBool = LookupAccountSid(NULL, pSidO, AcctName, (LPDWORD)&dwAcctName, DomainName, (LPDWORD)&… Re: Access violation reading location Programming Software Development by BenWard … violation on what looks like the FIRST call to to LookupAccountSid. It's as if something is not being cleared down… ACL TRUSTEE_TYPE is always Unknown. Programming Software Development by bigbadowl …; PSID_NAME_USE peUse = new SID_NAME_USE; PSID Sid = pListOfExplicitEntries[i].Trustee.ptstrName; LookupAccountSid(NULL, Sid, account, &AccountBufflength,domain,&DomainBufflength,peUse); _tprintf… Re: author of a file Programming Software Development by Ancient Dragon … SID obtained previously. name_len = sizeof(ownerName); domain_len = sizeof(domain_name); bSuccess = LookupAccountSid(NULL, pOwner, ownerName, &name_len, domain_name, &domain_len, &deUse… Re: how to get owner of a file for windows using python script Programming Software Development by ccandillo … (FILENAME, win32security.OWNER_SECURITY_INFORMATION) owner_sid = sd.GetSecurityDescriptorOwner () name, domain, type = win32security.LookupAccountSid (None, owner_sid) print "File owned by %s\\%s"… Re: Access Violation in LookupAccountSid Programming Software Development by nullptr AFAIK, the first call to LookupAccountSidW will return the buffer sizes needed in TCHARS. So you will need to allocate `bufsize * sizeof(wchar_t)` You also need to free the memory. Re: Access Violation in LookupAccountSid Programming Software Development by BenWard Thanks, I thought that is effectively what lines 23 and 24 are doing? Or are you refering to the variables that I currently have as DWORDs and am passing as references? Re: Access Violation in LookupAccountSid Programming Software Development by nullptr Because you are calling LookupAccountSidW(...), `myDwordNameLength` and `myDwordDomLength` will contain the buffer size needed in wide chars. Thus on lines 23 and 24 you are only allocating half the required size for each buffer. Change those lines to: myTrusteeName = (LPWSTR)GlobalAlloc(GMEM_FIXED, myDwordNameLength * sizeof(wchar_t)); … Re: Access Violation in LookupAccountSid Programming Software Development by BenWard ... good lord I could kiss you right now and I don't even care if you're a dude. I hadn't previously been using LookupAccountSidW() but the issue was still there before because the compiler was defaulting to wide chars anyway. Re: Access violation reading location Programming Software Development by Salem [url]http://msdn.microsoft.com/en-us/library/aa379166%28v=vs.85%29.aspx[/url] If you're calling it the first time to retrieve the length of the name, then you should pass NULL for the name, and make sure the length is initialised to zero. Otherwise, you're passing a pointer to a string in read-only memory, and it attempts to write 1 byte to it (… Re: ACL TRUSTEE_TYPE is always Unknown. Programming Software Development by marco93 It's a wrong method. Ask on Adv. Win32 api newsgroup [url]news://comp.os.ms-windows.programmer.win32[/url] for the well-known right method...