typedef struct _CERT_CONTEXT {
DWORD dwCertEncodingType;
BYTE *pbCertEncoded;
DWORD cbCertEncoded;
PCERT_INFO pCertInfo;
HCERTSTORE hCertStore;
} CERT_CONTEXT, *PCERT_CONTEXT;
type CERT_CONTEXT struct {
dwCertEncodingType uint32
pbCertEncoded uintptr
cbCertEncoded uint32
pCertInfo uintptr
hCertStore uintptr
}
certctx = (*CERT_CONTEXT) (unsafe.Pointer(pccert_context))
fmt.Printf("%v\n", certctx)
>&{1 807520 674 833008 789360}
func C.GoBytes(unsafe.Pointer, C.int) []byte
ca := (*[1000000]byte) (unsafe.Pointer(certctx.pbCertEncoded))[:certctx.cbCertEncoded]
mm := make([]byte, certctx.cbCertEncoded)
for i := uint32(0) ; i < certctx.cbCertEncoded; i++ {
mm[i] = *((*byte)(unsafe.Pointer(certctx.pbCertEncoded + uintptr(i) * unsafe.Sizeof(new(byte)))))
}
main.go:106: possible misuse of unsafe.Pointer
main.go:109: possible misuse of unsafe.Pointer
104 certctx := new(CERT_CONTEXT)
105
106 certctx = (*CERT_CONTEXT) (unsafe.Pointer(pccert_context))
107
108
109 ca := (*[1000000]byte) (unsafe.Pointer(certctx.pbCertEncoded))[:certctx.cbCertEncoded]
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/0JYB0-ZcFpk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The returned pointer is freed when passed as the pPrevCertContext parameter on a subsequent call to the function. Otherwise, the pointer must be explicitly freed by calling CertFreeCertificateContext. A pPrevCertContext that is not NULL is always freed by CertFindCertificateInStore using a call to CertFreeCertificateContext, even if there is an error in the function.
--