Hello friends,

i am trying to write some win api in golang ,because  these API not 
implemented any PKG.

"syscall"

"github.com/contester/runlib/win32"

"golang.org/x/sys/windows"


API are code in C++


OpenDesktop

        hdesk = OpenDesktop(
                _T("default"),     // the interactive window station 
                0,             // no interaction with other desktop processes
                FALSE,         // handle is not inheritable
                READ_CONTROL | // request the rights to read and write the DACL
                WRITE_DAC | 
                DESKTOP_WRITEOBJECTS | 
                DESKTOP_READOBJECTS);



OpenWindowStation


        hwinsta = OpenWindowStation(
                _T("winsta0"),                   // the interactive window 
station 
                FALSE,                       // handle is not inheritable
                READ_CONTROL | WRITE_DAC);

is my implemention correct or i did some mistake.


Now my implemented code in GOLANG

func OpenWindowStation() (win32.Hwinsta, error) {


    winst, _ := syscall.UTF16FromString("winsta0")

    //    r1, _, e1 := syscall.Syscall(procOpenWindowStation.Addr(), 
uintptr(unsafe.Pointer(&winst[0])), uintptr(0), uintptr(READ_CONTROL), 
uintptr(WRITE_DAC))

    r1, _, e1 := procOpenWindowStation.Call(

        uintptr(unsafe.Pointer(&winst[0])),

        uintptr(0),

        uintptr(READ_CONTROL),

        uintptr(WRITE_DAC))


    if int(r1) == 0 {

        return win32.Hwinsta(r1), os.NewSyscallError("OpenWindowStation", e1)

    }

    return win32.Hwinsta(r1), nil

}

func OpenDesktop(lpszDesktop *uint16, dwFlags uint32, fInherit uint32) 
(win32.Hdesk, error) {


    r1, _, e1 := procOpenDesktop.Call(

        uintptr(unsafe.Pointer(lpszDesktop)),

        uintptr(dwFlags),

        uintptr(READ_CONTROL),

        uintptr(WRITE_DAC),

        uintptr(DESKTOP_WRITEOBJECTS),

        uintptr(DESKTOP_READOBJECTS),

        uintptr(fInherit))


    if int(r1) == 0 {

        return win32.Hdesk(r1), os.NewSyscallError("OpenWindowStation", e1)

    }

    return win32.Hdesk(r1), nil

}


My another question is when to use which function listed below like 
(syscal.syscall,logonProc.Addr(),logonProc.call())

But i am not able to understand some time 

>>>>>>>syscall.Syscall6(logonProc.Addr(), 6, uintptr(unsafe.Pointer(&pu[0])),

        uintptr(unsafe.Pointer(&domain[0])),

        uintptr(unsafe.Pointer(&pp[0])),

        LOGON32_LOGON_NETWORK,

        LOGON32_PROVIDER_DEFAULT,

        uintptr(unsafe.Pointer(&token)))


>>>>>>>>logonProc.Call()

>>>>>>>>syscall.Syscall()

>>>>>>>>syscall.Syscall9()



Please suggest from where do i get this info.

Thanks


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