RE: SECURITY_ATTRIBUTES

new topic     » goto parent     » topic index » view thread      » older message » newer message

William Heimbigner wrote:
> 
> 
> posted by: William Heimbigner <icxcnika at hotpop.com>
> 
> William Heimbigner wrote:
> > 
> > 
> > Hi guys!
> > I'm doing some dll interface and ive come upon a problem.
> > I need to pass a pointer to a structure, to a dll. How is this 
> > accomplished?
> > typedef struct _SECURITY_ATTRIBUTES { // sa
> >     DWORD  nLength;
> >     LPVOID lpSecurityDescriptor;
> >     BOOL   bInheritHandle;
> > } SECURITY_ATTRIBUTES;
> > 
> > Thx
> > William Heimbigner
> > icxcnika at hotpop.com
> 
> Well, if you are using Win32Lib then you could do something like this:
> }}}
<eucode>
> -- define SECURITY_ATTRIBUTES structure
> constant
>   SAnLength = w32allot( DWord ),
>   SAlpSecurityDescriptor = w32allot( Ptr ),
>   SAbInheritHandle = w32allot( UInt ),
>   SIZEOF_SECURITY_ATTRIBUTES = w32alloted_size()
> 
> Then use other memory management functions to store and peek values to 
> the structure.  (w32acquire_mem, w32store, w32fetch, w32release_mem, 
> etc.).
> 
> -- Brian
> </eucode>
{{{

> Yah... but what pointer do i give it?
> The other thing... this program has (so far) NOT required win32lib,
> and for portability reasons, i'd like it to stay that way....
> William Heimbigner
> icxcnika at hotpop.com
> UBoard Administrator http://uboard.proboards32.com

OK, then
atom ptr

ptr = allocate( 3*4 ) -- three members in structure
                      -- each member is 4 bytes

-- fill the structure
poke4(ptr,nLength)
poke4(ptr+4,lpSecurityDescriptor)
poke4(ptr+8,bInheritHandle)

-- pass the pointer to your function
result = c_func( whatever, {ptr} )

-- free the allocated memory
free(ptr)


-- Brian

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu