Hi all

I'm trying to map a C structure to an equivalent go struct, but I bumped 
into a problem with a pointer to byte that is actually an array of bytes.

Here is the C struct:

typedef struct _CERT_CONTEXT {
  DWORD      dwCertEncodingType;
  BYTE       *pbCertEncoded;
  DWORD      cbCertEncoded;
  PCERT_INFO pCertInfo;
  HCERTSTORE hCertStore;
} CERT_CONTEXT, *PCERT_CONTEXT;


and this is my go struct:

type CERT_CONTEXT struct {
    dwCertEncodingType uint32
    pbCertEncoded      uintptr
    cbCertEncoded      uint32
    pCertInfo          uintptr
    hCertStore         uintptr
}

for my case I need only the first 3 fields and I do not have any problem to 
get 1 and 3, but I can't remember how to translate the second field to a 
slice of bytes.
This is how I map the struct from an uintptr and print it to the console:

    certctx = (*CERT_CONTEXT) (unsafe.Pointer(pccert_context))
    fmt.Printf("%v\n", certctx)
    
    >&{1 807520 674 833008 789360}

Any advise is warmly welcome.

Cheers,
Sandro

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to