Lisp HUG Maillist Archive

FFI, COM and accessing fli pointers

Hi,

I'm playing with some COM interface under Vista with LWW 5.0.1.
I have a problem with one of the structures that has been generated.
I don't know how I can access one of its fields. The structure looks like 
this :

;;;;     typedef struct tagFOLDERPROPS {
;;;;         FOLDERPROPSSIZE      cbSize;                     // Size of 
this structure
;;;;         STOREFOLDERID        dwFolderId;                 // Handle of 
this folder
;;;;         INT                  cSubFolders;                // Number of 
sub-folders
;;;;         SPECIALFOLDER_XMIT   sfType;                     // Special 
folder type
;;;;         DWORD                cUnread;                    // Number of 
un-read messages
;;;;         DWORD                cMessage;                   // Total # of 
messages
;;;;         CHAR                 szName[256]; // The Folder Name
;;;;     } FOLDERPROPS, *LPFOLDERPROPS;

I can allocate an object :

(setq foo (fli:allocate-foreign-object :type 'FOLDERPROPS))

If I want to get the cbSize field, no problem :

36 > (fli:foreign-slot-value foo 'cb-size)
187

But :

37 > (fli:foreign-slot-value foo 'sz-name)

Error: Attempted to dereference a pointer to aggregate type (:C-ARRAY 
COM::CHAR 256).
  1 (abort) Return to level 0.
  2 Return to top loop level 0.

I have tried several things to access this szName field but I'm stuck. I'd 
like to copy this as a lisp string. Any idea ?

Thanks for any clue,

Fabrice Popineau
------------------------
e-mail:       Fabrice.Popineau@supelec.fr  |  The difference between theory
voice-mail:   +33 (0) 387764715            |  and practice, is that
surface-mail: Supelec, 2 rue E. Belin,     |  theoretically,
       F-57070 Metz             |  there is no difference !


Re: FFI, COM and accessing fli pointers

Unable to parse email body. Email id is 6456

Updated at: 2020-12-10 08:46 UTC