Anonymous
|
I'd suggest that you use NSFBuildNamesList to obtain the handle to the names_list structure. Then use OSLockObject to obtain the pointer (and of course OSUnLockObject to release the lock at the end). In this case you pass pointer ByVal ... as Long, instead of passing a structure by ref: Declare Private Function W32ACLLookupAccess Lib "nnotes" Alias "ACLLookupAccess" (_ Byval hACL As Long, _ Byval psName As Long, _ retAccessLevel As Integer, _ retPrivileges As Long, _ retAccessFlags As Integer, _ retHPrivNames As Long _ ) As Integer Why does not it work if you want to build structures by yourself? I think it's because of alignment problems when declaring a structure. For example, I tried to declare the structure like this: Private Type NamesListTYPE nameCount As Integer license(0 To 3) As Integer authenticated As Long users As String * 256 End Type and to pass the parameter "sName As LMBCS NamesListTYPE" (LMBCS so that it converts the structure member "users" to LMBCS). Still this has one problem that I do not know how to deal easily with. The alignment of "authenticated" is not tight -- there are extra 2 bytes of space before. And even if we define "authenticated (1) As Integer" that fixes the alignment of "authenticated", the next member "users" does not get correct alignment. It is possible to solve this by brute force, by using memory buffer to build the structure in, and then pass the pointer to this buffer "Byval psName As Long" just like in the first solution I suggested, but there seems to be no downside of using NSFBuildNamesList , right?
|