DllImport & SetLastError in C#

Home Forums Discussions Support DllImport & SetLastError in C#

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5242
    Onester
    Participant

      Hi there,

      I’m evaluating your software and samples for possible license and have a few questions.

      In the NtTdiApi.dll P/Invoke declarations in your samples the majority of calls have SetLastError=true, however in the NdisApi.dll declarations, none of the calls are decorated this way. I like to make all static P/Invoke methods private and wrap them with a public method which checks the return value and throws exceptions on error, because of this it’s important for me to know which functions will SetLastError so I can throw a Win32Exception with the correct error code. Could you please let me know which funtions in both Dlls will support this?

      Many thanks!

      #6720
      Onester
      Participant

        Doing some further research I find that the source for ndisapi.dll is included!

        Given that most functions are wrappers around DeviceIoControl, and DeviceIoControl supports GetLastError is my assumption correct that these should support what I am asking for already?

        #6721
        Anton
        Participant

          Hi,

          Yes, you are right.

          =Anton.

        Viewing 3 posts - 1 through 3 (of 3 total)
        • You must be logged in to reply to this topic.