Thanks,

  I thought I tried that before, but I may have had some other
error at the time throwing me off the track.

This works:

(define net-wksta-get-info
  (get-ffi-obj "NetWkstaGetInfo" netapi-lib
               (_fun [_int = 0] [_int = 100] [rets : (_ptr o 
_wksta-info-100-pointer)]
                   -> [ret : _int]
                   -> (if (zero? ret) ; 0x0 = NERR_Success
                          rets
                          (display "fail")))))


(wksta-info-100-platform_id (net-wksta-get-info))


-----Original Message-----
From: John Clements [mailto:[email protected]]
Sent: Tuesday, November 16, 2010 12:24 PM
To: Altenburg, Robert
Cc: users Users
Subject: Re: [racket] ffi: handling return values in arguments?



On Nov 16, 2010, at 9:09 AM, Altenburg, Robert wrote:

> This is probably a simple question, but I can't seem
> to make this work:
>
> The Windows SDK defines the following function:
>
> NET_API_STATUS NetWkstaGetInfo(
>  __in   LPWSTR servername,
>  __in   DWORD level,
>  __out  LPBYTE *bufptr
> );
>
> In this case "bufptr" points to a structure allocated by
> the system that contains the results.
>
> How does one indicate this to get-ffi-obj, and get the returned value
> from the buffer?

I could be wrong, but it looks like this is a standard use of the "o" style 
parameter; the ffi interface will allocate it for you at call time, and you can 
retrieve the contents after the call returns.

Apologies if I'm misunderstanding your request.

John

_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to