Thanks. I will try your approach.

On Thursday, September 1, 2022 at 5:37:45 PM UTC+5:30 Marvin Renich wrote:

> * Chandan Kumar <cks...@gmail.com> [220901 07:29]:
> > Hi,
> > 
> > I am trying to implement a program in which I need the function 
> *LogonUserA 
> > function (winbase.h) *from windows API and this function is not 
> available 
> > in the package *golang.org/x/sys/windows* so any advice would be 
> helpful.
>
> First, you need to determine in which DLL the function is. Suppose it
> is in kernel32.dll:
>
> import (
> "golang.org/x/sys/windows"
> "syscall"
> "unsafe"
> )
>
> var (
> modKernel32 = windows.NewLazySystemDLL("kernel32.dll")
> procLogonUser = modKernel32.NewProc("LogonUserA")
> )
>
> func LogonUser(«arguments») («results», err error) {
> var r1, ..., e1 = syscall.Syscall(procLogonUser.Addr(), «converted 
> arguments», «fill with 0»)
> // Convert results and error and return them.
> }
>
> I didn't bother to look up what the real arguments are to LogonUser, but
> hopefully this gives you enough info to figure it out. Pointers will
> need to be converted like this: uintptr(unsafe.Pointer(userName)) when
> passing them to Syscall.
>
> If you need more help, post the function signature for LogonUser.
>
> ...Marvin
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/269f019d-86cb-4dc8-a3a0-01b8b6cc242bn%40googlegroups.com.

Reply via email to