Has anyone a hint, what i'm doing wrong with the Call arguments? I think 
the last parameter is the problematic one, but i can't figure out how to 
pass that argument.

Any help would be most appreciated!

Cheers snmed

Am Dienstag, 21. Februar 2017 10:36:29 UTC+1 schrieb snmed:
>
> Hi all
>
> I try to use the syscall package to call a native Windows API and 
> struggling with the call parameters. I calling the api
>
> HRESULT WINAPI AmsiInitialize(
>   _In_  LPCWSTR      appName,
>   _In_  DWORD        coInit,
>   _Out_ HAMSICONTEXT *amsiContext
> );
>
>
> my test app looks like this
> package main
>
> import (
>     "fmt"
>
>     "syscall"
>     "unsafe"
>
>     "golang.org/x/sys/windows"
> )
>
> func main() {
>     h := windows.MustLoadDLL("Amsi.dll")
>     defer h.Release()
>
>     ainit := h.MustFindProc("AmsiInitialize")
>     auinit := h.MustFindProc("AmsiUninitialize")
>     ascanstring := h.MustFindProc("AmsiScanString")
>
>     var context uintptr
>     r1, r2, err := ainit.Call(uintptr(unsafe.Pointer(syscall.
> StringToUTF16Ptr("Scanner Tool"))), 0, uintptr(unsafe.Pointer(&context)))
>     fmt.Println(context)
>     fmt.Println(r1, r2, err)
>     // output:
>     // 0
>     // 2147942487 0 The operation completed successfully.
>
> unfortunately the call succeeds but the context is still zero. Probably i 
> call the function with the wrong parameters but i can't work it out.
> Has anybody a idea what could be wrong?
>
> Thank you in advance
> snmed
>
>

-- 
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