|
-
August 24th, 1999, 03:27 AM
#1
Assigning a memory address to a variable
private Type SECURITY_DESCRIPTOR
Descriptor(SECURITY_DESCRIPTOR_MIN_LENGTH) as Byte
End Type
private Type SECURITY_ATTRIBUTES
nLength as Long
lpSecurityDescriptor as Long
bInheritHandle as Long
End Type
private Declare Function InitializeSecurityDescriptor Lib "advapi32.dll" (pSecurityDescriptor as SECURITY_DESCRIPTOR, byval dwRevision as Long) as Long
private Declare Function SetSecurityDescriptorDacl Lib "advapi32.dll" (pSecurityDescriptor as SECURITY_DESCRIPTOR, byval bDaclPresent as Long, byval pDacl as Long, byval bDaclDefaulted as Long) as Long
private Declare Function CreateNamedPipe Lib "kernel32" Alias "CreateNamedPipeA" (byval lpName as string, byval dwOpenMode as Long, byval dwPipeMode as Long, byval nMaxInstances as Long, byval nOutBufferSize as Long, byval nInBufferSize as Long, byval nDefaultTimeOut as Long, lpSecurityAttributes as SECURITY_ATTRIBUTES) as Long
Dim pSD as SECURITY_DESCRIPTOR
Dim sa as SECURITY_ATTRIBUTES
............
' create a security descriptor that allows anyone to write to
' the pipe...
'
result = InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)
' add a null disc. ACL to the security descriptor.
'
result = SetSecurityDescriptorDacl(pSD, 1, 0&, 0)
sa.nLength = len(sa)
sa.lpSecurityDescriptor = pSD <--------
sa.bInheritHandle = 1
.............
I wanna assign the memory address of variable pSD to sa.lpSecurityDescriptor; how could i do it ?
Thank you in advance for your help.....
-
August 24th, 1999, 04:25 AM
#2
Re: Assigning a memory address to a variable
try the CopyMemory API, expect crashes and save your work frequently... ;-)
call CopyMemory( sa.lpSecurityDescriptor , pSD )
-
August 24th, 1999, 07:53 AM
#3
Re: Assigning a memory address to a variable
-
August 24th, 1999, 08:19 AM
#4
Re: Assigning a memory address to a variable
... Or use the CopyMemory api, or the StrPtr, VarPtr or ObjPtr (undocumented) keywords in VB5/6.
Chris Eastwood
CodeGuru - the website for developers
http://www.codeguru.com/vb
-
August 24th, 1999, 09:23 AM
#5
Re: Assigning a memory address to a variable
Thanks for your answer; the function VarPtr works properly......Bye
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|