devman

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • in reply to: I have a problem rewriting NDIS in Go #13911
    devman
    Participant

      I think I managed to fix it but not with C interface, I used the initial code that I wrote purely in go, I can now ReadPackets but instead of using windows.Handle or uintptr I created an 8 bytes array (type HANDLE [8]byte) for network adapter handle and used it and it’s working

      I’m not sure what did I do wrong maybe go did some type-casting or something…

      in reply to: I have a problem rewriting NDIS in Go #13910
      devman
      Participant

        Could it be size of Handle difference?
        I mean if uintptr is unsigned int and if I’m on 64bit, I should use uint64 instead of uintptr?

        in reply to: I have a problem rewriting NDIS in Go #13908
        devman
        Participant

          I tried to use the C Interface and I think I have same problem and I think it’s related to Handle.
          I think I’m using wrong datatype for Handle, let’s say I’m getting AdapterMode and on I should have a AdapterHandle that I got from TCPAdapterList and for now I used uintptr datatype to store handle, I’m not sure if it’s actualy uintptr or something else. (Because windows.Handle or syscall.Handle actual datatype on go is uintptr).

          I can get AdapterList and store it into a struct which is exactly like C/C++ version but when I want to for example SetEvent or any API that wants AdapterHandle I get error: “The parameter is incorrect.”

          AdapterList (works without error):
          type TCP_AdapterList struct {
          AdapterCount uint32
          AdapterNameList [ADAPTER_LIST_SIZE][ADAPTER_NAME_SIZE]byte
          AdapterHandle [ADAPTER_LIST_SIZE]uintptr
          AdapterMediumList [ADAPTER_LIST_SIZE]uint32
          CurrentAddress [ADAPTER_LIST_SIZE][ETHER_ADDR_LENGTH]byte
          MTU [ADAPTER_LIST_SIZE]uint16
          }
          func (a *NdisApi) GetTcpipBoundAdaptersInfo() (*TCP_AdapterList, error) {
          var adapterList TCP_AdapterList
          _, _, err := a.c.GetTcpipBoundAdaptersInfo.Call(a.handle, uintptr(unsafe.Pointer(&adapterList)))

          if !errors.Is(err, windows.ERROR_SUCCESS) {
          return nil, err
          }

          return &adapterList, nil
          }

          GetAdapterMode (error: “The parameter is incorrect.”):
          type AdapterMode struct {
          AdapterHandle uintptr
          Flags uint32
          }
          func (a *NdisApi) GetAdapterMode(currentMode *AdapterMode) (error) {
          r1, r2, err := a.c.GetAdapterMode.Call(a.handle, uintptr(unsafe.Pointer(currentMode)))
          fmt.Println(r1, r2, err, a.handle)

          if !errors.Is(err, windows.ERROR_SUCCESS) {
          return err
          }

          return nil
          }

          I actually don’t know whether if I’m correct or wrong, I’ll appreciate it if you help me solve this.
          How can I make sure I’m using windows native event handle or if I got the Handle correctly, because I think thats what my problem is about?

          Note that, I’m using 64-bit.

          • This reply was modified 1 month, 3 weeks ago by devman.
          in reply to: I have a problem rewriting NDIS in Go #13907
          devman
          Participant

            I don’t know how I didn’t think of using C interface, thank you, I think I’m going to do that.

            in reply to: Socksify or Proxifyre not tunneling without error #13693
            devman
            Participant

              Looks like the problem was on my end and I should’ve added the Proxyre to the firewall allowed apps.

            Viewing 5 posts - 1 through 5 (of 5 total)