Desktop Functions: Smart Device Functions:
|
Search Results for "set" in [All]ws2_321: closesocket
[DllImport("ws2_32.dll", CharSet = CharSet.Unicode, SetLastError = true)] 2: Command
/// Set *argp to a nonzero value if the nonblocking mode should be enabled, 3: ControlCode
SIO_SET_QOS = -2013265909,
SIO_SET_GROUP_QOS = -2013265908,
SIO_SET_MULTICAST_FILTER = -2147191683,
SIO_UDP_CONNRESET = -1744830452,
/// Set *argp to a nonzero value if the nonblocking mode should be enabled, 4: gethostname
[DllImport("ws2_32.dll", SetLastError=true)] 5: getsockopt
set
Native.setsockopt(socketPtr, Native.SocketOptionLevel.Socket, Native.SocketOptionName.ReceiveTimeout, ref optval, optlen); 6: InetNtop
[DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "InetNtopW")]
[DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "InetNtopW")] 7: inet_addr
[DllImport("Ws2_32.dll", CharSet = CharSet.Ansi)] 8: inet_ntoa
[DllImport("Ws2_32.dll", CharSet = CharSet.Ansi)]
<System.Runtime.InteropServices.DllImport("ws2_32.dll", CharSet:=System.Runtime.InteropServices.CharSet.Ansi, SetLastError:=True)> 9: inet_pton
[DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "InetPtonW")]
[DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "InetPtonW")] 10: ntohs
[DllImport("ws2_32.dll", SetLastError=true)] 11: select
/* An optional pointer to a set of sockets to be checked for readability. */
ref fd_set readfds,
/* An optional pointer to a set of sockets to be checked for writability. */
ref fd_set writefds,
/* An optional pointer to a set of sockets to be checked for errors. */
ref fd_set exceptfds, 12: setsockopt
public static extern int setsockopt(IntPtr s, SocketOptionLevel level, SocketOptionName optname, ref int optval, int optlen);
Declare Function setsockopt Lib "ws2_32.dll" (TODO) As TODO
set
Native.setsockopt(socketPtr, Native.SocketOptionLevel.Socket, Native.SocketOptionName.ReceiveTimeout, ref optval, optlen); 13: shutdown
[DllImport("ws2_32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
/// Set/get IP options.
/// Set/get IPv6 routing header.
/// Set/get IPv6 hop-by-hop options.
/// Set/get IPv6 protection level.
/// Offset to checksum for raw IP socket send.
/// Set/get IPv6 routing header.
/// get/set the compartment for a socket
/// Enables or disables the Nagle algorithm for TCP sockets. This option is disabled (set to FALSE) by default.
/// (BSD) style (default) is used. This option can be set on the connection only once. Once this option is set on, this option cannot
/// Enables or disables the Nagle algorithm for TCP sockets. This option is disabled (set to FALSE) by default.
/// Set/get UDP-Lite checksum coverage
[DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "WSAAddressToStringW")]
[DllImport("Ws2_32.dll", CharSet = CharSet.Unicode, EntryPoint = "WSAAddressToStringW")] 16: WSACleanup
[DllImport("ws2_32.dll",CharSet = CharSet.Auto, SetLastError=true)] 17: WSAData
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] 18: WSAGetLastError
[DllImport("ws2_32.dll", CharSet = CharSet.Auto)]
[DllImport("ws2_32.dll", CharSet = CharSet.Auto, SetLastError=true)]
static extern Int32 WSALookupServiceBegin(WSAQUERYSET lpqsRestrictions, Int32 dwControlFlags, ref Int32 lphLookup);
[DllImport("ws2_32.dll", CharSet = CharSet.Auto, SetLastError=true)]
WSAQUERYSET lpRestrictions = new WSAQUERYSET();
WSAQUERYSET qs = new WSAQUERYSET();
qs = Marshal.PtrToStructure<WSAQUERYSET>(pqs); 22: WSANSIoctl
[DllImport("ws2_32.dll", CharSet = CharSet.Auto, SetLastError=true)] 23: WSAPROTOCOL_INFO
public int iProtocolMaxOffset; 24: WSASocket
[DllImport("ws2_32.dll", CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.StdCall)] 25: WSAStartup
[DllImport("ws2_32.dll", CharSet = CharSet.Auto, SetLastError=true)]
CharSet = CharSet.Unicode, fbwflib27: FbwfAddExclusion
[DllImport("fbwflib.dll", SetLastError=true)]
[DllImport("fbwflib.dll", SetLastError=true)] The API defines an Void-Pointer as a parameter. The pointer must point to a function with 4 parameters itself. The parameters are the same as a WaitHandle with its initial state set to false. So you can use the SafeHandle of the ResetEvent class.
_manualResetEvent = new ManualResetEvent(false);
NativeMethods.FbwfCacheThresholdNotification((uint)100, _manualResetEvent.SafeWaitHandle);
[DllImport("fbwflib.dll", SetLastError=true)]
[DllImport("fbwflib.dll", SetLastError=true)]
[DllImport("fbwflib.dll", SetLastError=true)] 32: FbwfEnableFilter
[DllImport("fbwflib.dll", SetLastError=true)]
[DllImport("fbwflib.dll", SetLastError=true)]
[DllImport("fbwflib.dll", SetLastError=true)]
[DllImport("fbwflib.dll", SetLastError=true)]
[DllImport("fbwflib.dll", SetLastError=true)]
[DllImport("fbwflib.dll", SetLastError=true)]
[DllImport("fbwflib.dll", SetLastError=true)]
[DllImport("fbwflib.dll", SetLastError=true)]
static extern uint FbwfSetCacheThreshold(
Declare Function FbwfSetCacheThreshold Lib "fbwflib.dll" (TODO) As TODO
[DllImport("fbwflib.dll", SetLastError=true)] gsapi
[DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
<DllImport("gsdll32.dll", CharSet:= CharSet.Ansi, CallingConvention:= CallingConvention.StdCall)> _ 42: gsapi_exit
[DllImport("gsdll32.dll",CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]
<DllImport("gsdll32.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
[DllImport("gsapi.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
[DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
<DllImport("gsdll32.dll", CharSet:= CharSet.Ansi, CallingConvention:= CallingConvention.StdCall)> _
[DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
[DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
[DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
[DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
[DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] 45: gsapi_revision
[DllImport("gsdll32.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)] misc46: Comments Great idea, thanks for setting it up! One question: The APIs here appear to be machanically created from some other source - from things like "System.Windows.Forms.NativeMethods"? The functions are present, but not the structures and data types used in the params. Any plans to do a mechanical dump of the structures as well? The real magic of marshalling is getting the param types set up correctly, which for structures can be quite a pain. [DllImport(“coredll.dll”, EntryPoint="CPAcquireContext", SetLastError=true)] [DllImport(“advapi32.dll”, EntryPoint="CPAcquireContext", SetLastError=true)] This site's been live for about a month, now -- either it's not getting indexed completely by Google, or there is nearly complete neglect for SetLastError=true. Or both. http://www.google.com/search?q=SetLastError+site:pinvoke.net http://www.windojitsu.com/blog/pleasesetlasterror.html IMHO, the hardest part of developing a good p/invoke signature is not substituting "LPCSTR" with "string" -- it's looking up the failure semantics of the methods' return values... (NULL or INVALID_HANDLE? Does it SetLastError? etc.) And then wrapping the call appropriately. I'd go so far as to recommend always mandating SetLastError -- explicitly setting SetLastError=false, to call out the (comparatively rare) Win32 functions that don't expose a failure path through GetLastError. And SetLastError is only half the problem -- remembering to actually check the return value is the other half! We should compel folks to check the return values properly, in the sample usage section -- assert success and/or throw Win32Exception, as appropriate. Discovered DISPLAY_DEVICE struct defined with CharSet=CharSet.Ansi. Works much better on Win7 with CharSet=CharSet.Auto. Suspect this is also true of a number of other structs and Win7 predecessors.
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] As long as the setup itself isn't updated, the PInvoke.net front page should not link to the setup directly, but to a page which describes the work-around. - Peter de Bruin It would be nice to have a way to package/ associate a set of definitions together. So if say I were doing BITS programming I could get all the BITS interfaces quickly and easily. This of course would be built on top of the previously mentioned signature/class builder. winmm49: mciSendString
mciSendString("set CDAudio door open", returnstring,127, IntPtr.Zero);
mciSendString("set CDAudio door open", rt, 127, IntPtr.Zero);
mciSendString("set CDAudio door closed", rt, 127, IntPtr.Zero);
mciSendString("set CDAudio door open", returnstring, 127, IntPtr.Zero) 50: MIDIHDR
public uint offset; 51: midiInClose
[DllImport("winmm.dll", SetLastError = true)] 52: midiInGetDevCaps
[DllImport("winmm.dll", SetLastError = true)] 53: midiInGetNumDevs
[DllImport("winmm.dll", SetLastError = true)] 54: midiInOpen
[DllImport("winmm.dll", SetLastError=true)] 55: midiInReset 56: midiInStart
[DllImport("winmm.dll", SetLastError = true)]
[DllImport("winmm.dll", SetLastError = true)]
[DllImport("winmm.dll", SetLastError = true)]
[DllImport("winmm.dll", SetLastError=true)] 59: midiStreamOut
int dwOffset;
Dim dwOffset As Integer 60: MixerFlags
MIXER_SETCONTROLDETAILSF_VALUE = 0,
MIXER_SETCONTROLDETAILSF_LISTTEXT = 1,
MIXER_SETCONTROLDETAILSF_QUERYMASK = 0xF, Cut off search results after 60. Please refine your search. |