From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: emacs 23.0.60.1 built today (11th feb 2008) crashes under Vista Date: Thu, 14 Feb 2008 21:47:41 +0200 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1203018511 25662 80.91.229.12 (14 Feb 2008 19:48:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Feb 2008 19:48:31 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eric Lilja Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 14 20:48:54 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JPk4X-0004nU-68 for ged-emacs-devel@m.gmane.org; Thu, 14 Feb 2008 20:48:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPk43-000766-8d for ged-emacs-devel@m.gmane.org; Thu, 14 Feb 2008 14:48:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JPk3y-00074E-WD for emacs-devel@gnu.org; Thu, 14 Feb 2008 14:48:07 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JPk3x-00072O-Eh for emacs-devel@gnu.org; Thu, 14 Feb 2008 14:48:06 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPk3x-00072D-8w for emacs-devel@gnu.org; Thu, 14 Feb 2008 14:48:05 -0500 Original-Received: from romy.inter.net.il ([213.8.233.24]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JPk3w-0006tW-IO for emacs-devel@gnu.org; Thu, 14 Feb 2008 14:48:05 -0500 Original-Received: from HOME-C4E4A596F7 (IGLD-83-130-247-140.inter.net.il [83.130.247.140]) by romy.inter.net.il (MOS 3.7.3-GA) with ESMTP id KFQ27378 (AUTH halo1); Thu, 14 Feb 2008 21:47:27 +0200 (IST) In-reply-to: (message from Eric Lilja on Thu, 14 Feb 2008 02:18:36 +0100) X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.7-5.2 (or MacOS X 10.2-10.4) (2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:89096 Archived-At: > From: Eric Lilja > Date: Thu, 14 Feb 2008 02:18:36 +0100 > > I am happy to report that Emacs does indeed not crash on Vista after > reverting the changes to w32.c, using the method suggested by Juanma. > Hopefully a proper fix (because I assume the changes I reverted have > some purpose too) isn't too hard to do. Could you please compile the program below and run it on Vista with some file name (a name of any existing file) as a single argument? Then please post here everything it prints. That might give me enough information to fix the code. Thanks. -------------------------- cut here -------------------- #include #include #include #include #include #include BOOL GetTextualSid( PSID pSid, // binary SID LPTSTR TextualSid, // buffer for Textual representation of SID LPDWORD lpdwBufferLen // required/provided TextualSid buffersize ) { PSID_IDENTIFIER_AUTHORITY psia; DWORD dwSubAuthorities; DWORD dwSidRev=SID_REVISION; DWORD dwCounter; DWORD dwSidSize; // Validate the binary SID. if(!IsValidSid(pSid)) return FALSE; // Get the identifier authority value from the SID. psia = GetSidIdentifierAuthority(pSid); // Get the number of subauthorities in the SID. dwSubAuthorities = *GetSidSubAuthorityCount(pSid); // Compute the buffer length. // S-SID_REVISION- + IdentifierAuthority- + subauthorities- + NULL dwSidSize=(15 + 12 + (12 * dwSubAuthorities) + 1) * sizeof(TCHAR); // Check input buffer length. // If too small, indicate the proper size and set the last error. if (*lpdwBufferLen < dwSidSize) { *lpdwBufferLen = dwSidSize; SetLastError(ERROR_INSUFFICIENT_BUFFER); return FALSE; } // Add 'S' prefix and revision number to the string. dwSidSize=_stprintf(TextualSid, TEXT("S-%lu-"), dwSidRev ); // Add a SID identifier authority to the string. if ( (psia->Value[0] != 0) || (psia->Value[1] != 0) ) { dwSidSize+=_stprintf(TextualSid + lstrlen(TextualSid), TEXT("0x%02hx%02hx%02hx%02hx%02hx%02hx"), (USHORT)psia->Value[0], (USHORT)psia->Value[1], (USHORT)psia->Value[2], (USHORT)psia->Value[3], (USHORT)psia->Value[4], (USHORT)psia->Value[5]); } else { dwSidSize+=_stprintf(TextualSid + lstrlen(TextualSid), TEXT("%lu"), (ULONG)(psia->Value[5] ) + (ULONG)(psia->Value[4] << 8) + (ULONG)(psia->Value[3] << 16) + (ULONG)(psia->Value[2] << 24) ); } // Add SID subauthorities to the string. // for (dwCounter=0 ; dwCounter < dwSubAuthorities ; dwCounter++) { dwSidSize+=_stprintf(TextualSid + dwSidSize, TEXT("-%lu"), *GetSidSubAuthority(pSid, dwCounter) ); } return TRUE; } int main (int argc, char *argv[]) { SECURITY_INFORMATION si = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION; /* The magic value 244 is returned by GetFileSecurity if one uses less storage for the three flags above. */ SECURITY_DESCRIPTOR *sd = malloc(244); const char *arg = (argv[1] ? argv[1] : argv[0]); DWORD len_needed; if (!GetFileSecurity (arg, si, sd, 244, &len_needed)) fprintf (stderr, "GetFileSecurity: %lu (%lu/%u)\n", GetLastError (), len_needed, 244); else { SID *psid, *pgsid; BOOL deflt, deflt1; char name[UNLEN + 1], gname[UNLEN + 1]; SID_NAME_USE snu, sng; char domain[1024]; DWORD nl = UNLEN + 1, gnl = UNLEN + 1; DWORD dl = 1024, gdl = 1024; char tusid[1024], tgsid[1024]; DWORD tsidlen = sizeof(tusid); BOOL daclpresent; PACL pdacl; if (!GetSecurityDescriptorOwner (sd, (PSID *)&psid, &deflt)) fprintf (stderr, "GetSecurityDescriptorOwner: %lu\n", GetLastError ()); else if (!LookupAccountSid (NULL, psid, name, &nl, domain, &dl, &snu)) fprintf (stderr, "LookupAccountSid: %lu\n", GetLastError ()); else if (!GetTextualSid (psid, tusid, &tsidlen)) fprintf (stderr, "GetTextualSid (owner): %lu\n", GetLastError ()); else if (!GetSecurityDescriptorGroup (sd, (PSID *)&pgsid, &deflt)) fprintf (stderr, "GetSecurityDescriptorGroup: %lu\n", GetLastError ()); else if (!LookupAccountSid (NULL, pgsid, gname, &gnl, domain, &gdl, &sng)) fprintf (stderr, "LookupAccountSid: %lu\n", GetLastError ()); else if (!GetTextualSid (pgsid, tgsid, &tsidlen)) fprintf (stderr, "GetTextualSid (group): %lu\n", GetLastError ()); else if (!GetSecurityDescriptorDacl (sd, &daclpresent, &pdacl, &deflt1)) fprintf (stderr, "GetSecurityDescriptorDacl: %lu\n", GetLastError ()); else if (!daclpresent) fprintf (stderr, "GetSecurityDescriptorDacl: NO DACL\n"); else { ACCESS_MASK umask, gmask; DWORD err; TRUSTEE trustee = { NULL, NO_MULTIPLE_TRUSTEE, TRUSTEE_IS_SID, TRUSTEE_IS_USER, NULL }; trustee.ptstrName = (LPTSTR)psid; if ((err = GetEffectiveRightsFromAcl (pdacl, &trustee, &umask)) != ERROR_SUCCESS) fprintf (stderr, "GetEffectiveRightsFromAcl (owner): %lu\n", err); else if (trustee.TrusteeType = TRUSTEE_IS_GROUP, trustee.ptstrName = (LPTSTR)pgsid, (err = GetEffectiveRightsFromAcl (pdacl, &trustee, &gmask)) != ERROR_SUCCESS) fprintf (stderr, "GetEffectiveRightsFromAcl (group): %lu\n", err); else printf ("%s:\n dflt=%d owner=%s grp=%s domain=%s use=%d\n Ownr SID=%s 0x%lx\n Grp SID=%s 0x%lx\n", arg, deflt, name, gname, domain, snu, tusid, umask, tgsid, gmask); } } return 0; }