DllImport & SetLastError in C#

Home Forums Discussions Support Portal DllImport & SetLastError in C#

This topic contains 2 replies, has 2 voices, and was last updated by  Anton 9 years, 11 months ago.

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


    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!



    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?




    Yes, you are right.


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

You must be logged in to reply to this topic.