From: Park Heesob Date: 2006-03-18T16:16:52+09:00 Subject: Re: Win32API struct member help Hi, > >Hi all, > >I'm trying to figure out how to get the acl attributes of a simple text >file, and I need a little help getting data out of a struct. >Specifically, I need to get the AceCount from an access control list >(ACL struct) after a call to GetSecurityDescriptorDacl(). Here's what >I've got so far: > > >require 'Win32API' > > ... > >acl_ptr = [0].pack('L') # what should this be? > > >val = GetSecurityDescriptorDacl.call( > sec_buf, > dacl_present, > acl_ptr, > dacl_defaulted >) > > >if val == 0 > raise ArgumentError, 'GetSecurityDescriptorDacl failed' >end > > >p acl_ptr.unpack('CCSSS') # [228, 50, 632, nil, nil] > > >I was expecting 4 for the 4th attribute (AceCount). I tried changing >the initial value of acl_ptr to [0,0,0,0,0].pack('CCSSS') but that >didn't help. What did I do wrong? > memcpy is required for pointer reference,try this: memcpy = Win32API.new('msvcrt','memcpy','PLL','P') acl_buf = "\0" * 8 memcpy.call(acl_buf,acl_ptr.unpack('L')[0],8) p acl_buf.unpack('CCSSS') Regards, Park Heesob