

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
3 messages in net.java.dev.jna.usersRe: [jna-users] Structures in Structure| From | Sent On | Attachments |
|---|---|---|
| Мария Попова | Apr 30, 2009 4:16 am | |
| Timothy Wall | Apr 30, 2009 4:24 am | |
| Мария Попова | Apr 30, 2009 4:44 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [jna-users] Structures in Structure | Actions... |
|---|---|---|
| From: | Timothy Wall (twal...@dev.java.net) | |
| Date: | Apr 30, 2009 4:24:46 am | |
| List: | net.java.dev.jna.users | |
According to your usage (s1->s2->s3), your structure does not comprise other structures, but rather structure pointers. You can use Pointer or instances of Structure.ByReference as the type for those fields.
For example:
public class MyStructure extends Structure { public class ByReference extends MyStructure implements Structure.ByReference { } }
public class MyContainer extends Structure { public MyStructure.ByReference structPointerField; }
On Apr 30, 2009, at 7:17 AM, Мария Попова wrote:
---------- Forwarded message ---------- From: Мария Попова <fynt...@googlemail.com> Date: Thu, Apr 30, 2009 at 6:13 PM Subject: Structures in Structure To: use...@jna.dev.java.net
Hi,
I have Structure mapping poroblem. There is structures in structure.
I recieve CERT_CONTEXT structure (Structure wich consists of another Structures) from function, next step i need to use CERT_CONTEXT-
CERT_INFO->CERT_PUBLIC_KEY_INFO structure in another function, but
i have "An unexpected error has been detected by Java Runtime Environment" after calling it. I think i have incorrect structure mapping... There is my structures: // typedef struct _CERT_CONTEXT { // + DWORD dwCertEncodingType; // + BYTE * pbCertEncoded; // + DWORD cbCertEncoded; // + PCERT_INFO pCertInfo; // + HCERTSTORE hCertStore; }
public static class CERT_CONTEXT extends Structure { public DWORD dwCertEncodingType; public ByteByReference pbCertEncoded; public DWORD cbCertEncoded; public CERT_INFO pCertInfo; public HANDLE hCertStore; }
CERT_INFO is: // typedef struct _CERT_INFO { // DWORD dwVersion; // CRYPT_INTEGER_BLOB SerialNumber; // CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm; // CERT_NAME_BLOB Issuer; // FILETIME NotBefore; // FILETIME NotAfter; // CERT_NAME_BLOB Subject; // CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo; // CRYPT_BIT_BLOB IssuerUniqueId; // CRYPT_BIT_BLOB SubjectUniqueId; // DWORD cExtension; // PCERT_EXTENSION rgExtension; // } CERT_INFO, *PCERT_INFO;
public class CERT_INFO extends Structure implements Structure.ByReference { public DWORD dwVersion; public CRYPT_DATA_BLOB SerialNumber; public CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm; public CRYPT_DATA_BLOB Issuer; public Pointer NotBefore; public Pointer NotAfter; public CRYPT_DATA_BLOB Subject; public CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo; public CRYPT_BIT_BLOB IssuerUniqueId; public CRYPT_BIT_BLOB SubjectUniqueId; public DWORD cExtension; public CERT_EXTENSION rgExtension; // public static class ByReference extends CERT_EXTENSION implements // Structure.ByReference { // } } And CERT_PUBLIC_KEY_INFO is:
// typedef struct _CERT_PUBLIC_KEY_INFO { // CRYPT_ALGORITHM_IDENTIFIER Algorithm; // CRYPT_BIT_BLOB PublicKey; // } CERT_PUBLIC_KEY_INFO, *PCERT_PUBLIC_KEY_INFO; public class CERT_PUBLIC_KEY_INFO extends Structure { public CRYPT_ALGORITHM_IDENTIFIER Algorithm; public CRYPT_BIT_BLOB PublicKey; }
// typedef struct _CRYPT_ALGORITHM_IDENTIFIER { // LPSTR pszObjId; // CRYPT_OBJID_BLOB Parameters; // } CRYPT_ALGORITHM_IDENTIFIER, *PCRYPT_ALGORITHM_IDENTIFIER; public class CRYPT_ALGORITHM_IDENTIFIER extends Structure { public Pointer pszObjId; public CRYPT_DATA_BLOB Parameters; }
// typedef struct _CRYPT_BIT_BLOB { // DWORD cbData; // BYTE *pbData; // DWORD cUnusedBits; // } CRYPT_BIT_BLOB, *PCRYPT_BIT_BLOB; public class CRYPT_BIT_BLOB extends Structure { public DWORD cbData; public Pointer pbData; public DWORD cUnusedBits; }
// typedef struct _CRYPTOAPI_BLOB { // DWORD cbData; // BYTE *pbData; // } public class CRYPT_DATA_BLOB extends Structure { public DWORD cbData; public Pointer pbData; }







