Desktop Functions: Smart Device Functions:
|
Search Results for "connect" in [All]hidRetrieves the serial number string from a connected device. winfax
static extern bool FaxConnectFaxServer (string MachineName, out IntPtr FaxHandle);
Declare Function FaxConnectFaxServer Lib "winfax.dll" (TODO) As TODO 3: FaxEnumJobs 4: FaxEnumPorts credui
credui.pszCaptionText = "Connect to your application"; kernel32
static extern bool ConnectNamedPipe(IntPtr hNamedPipe, Good example of named pipes using ConnectNamedPipe() can be found at http://wyday.com/blog/2010/multi-process-c-sharp-application-like-google-chrome-using-named-pipes/
/// 2. Call Listen(). This will block until a client connects. Sorry, the alternatives
/// 3. Call DataAvailable() in a loop with Read(), Write, ReadLine(), etc. until IsConnected turns false.
private static extern bool DisconnectNamedPipe(
private static extern bool ConnectNamedPipe(
/// Waits indefinitely when connecting to a pipe.
private const ulong ERROR_PIPE_CONNECTED = 535;
/// Server only: block until client connects
DisconnectNamedPipe(_handle);
if (ConnectNamedPipe(_handle, IntPtr.Zero) != true)
if (lastErr == ERROR_PIPE_CONNECTED)
/// Server only: disconnect the pipe. For most applications, you should just call Listen()
/// instead, which automatically does a disconnect of any old connection.
public void Disconnect()
throw new Exception("Disconnect() is only for server-side streams");
DisconnectNamedPipe(_handle);
/// Returns true if client is connected. Should only be called after Listen() succeeds.
public bool IsConnected
throw new Exception("IsConnected() is only for server-side streams");
if (ConnectNamedPipe(_handle, IntPtr.Zero) == false)
if ((uint)Marshal.GetLastWin32Error() == ERROR_PIPE_CONNECTED)
} while (stream.IsConnected); Structures
MIXERLINE_LINEF_DISCONNECTED = &H8000
public bool fConnected;
internal bool fReturnConnected; 14: MIXERLINE
DISCONNECTED = 0x00008000u, 15: NETRESOURCE Without the Structlayout the WNetAddConnection2 does not work !!! 16: RASDIALPARAMS 17: RAS_STATS
public int dwConnectionDuration;
Public dwConnectionDuration As Integer See docs for RasGetConnectionStatistics
// Connection/Session counts
public int Reconnects;
public int CoreConnects;
public int Lanman20Connects;
public int Lanman21Connects;
public int LanmanNtConnects;
public int ServerDisconnects;
public bool AoAcConnectivitySupported; // Ignore if earlier than Windows 10 (10.0.10240.0) 20: TCP_TABLE_CLASS
TCP_TABLE_BASIC_CONNECTIONS,
TCP_TABLE_OWNER_PID_CONNECTIONS,
TCP_TABLE_OWNER_MODULE_CONNECTIONS,
TCP_TABLE_BASIC_CONNECTIONS
TCP_TABLE_OWNER_PID_CONNECTIONS
TCP_TABLE_OWNER_MODULE_CONNECTIONS
TCP_TABLE_CLASS = (TCP_TABLE_BASIC_LISTENER,TCP_TABLE_BASIC_CONNECTIONS,
TCP_TABLE_OWNER_PID_CONNECTIONS,TCP_TABLE_OWNER_PID_ALL,
TCP_TABLE_OWNER_MODULE_LISTENER,TCP_TABLE_OWNER_MODULE_CONNECTIONS, TCP_TABLE_BASIC_CONNECTIONS A MIB_TCPTABLE table that contains all connected TCP endpoints on the machine is returned to the caller. TCP_TABLE_OWNER_PID_CONNECTIONS A MIB_TCPTABLE_OWNER_PID or MIB_TCP6TABLE_OWNER_PID that all connected TCP endpoints on the machine is returned to the caller. TCP_TABLE_OWNER_MODULE_CONNECTIONS A MIB_TCPTABLE_OWNER_MODULE or MIB_TCP6TABLE_OWNER_MODULE that contains all connected TCP endpoints on the machine is returned to the caller.
public int ConnectionIndex;
ULONG ConnectionIndex;
Request.ConnectionIndex = PortPortNumber;
if (DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero)) Is often used as a type inside a USB_NODE_CONNECTION_INFORMATION_EX structure, hence the need for the "Pack=1"
struct USB_NODE_CONNECTION_DRIVERKEY_NAME
public int ConnectionIndex;
Structure USB_NODE_CONNECTION_DRIVERKEY_NAME Identical to the USB_NODE_CONNECTION_NAME structure
typedef struct _USB_NODE_CONNECTION_DRIVERKEY_NAME {
ULONG ConnectionIndex;
} USB_NODE_CONNECTION_DRIVERKEY_NAME, *PUSB_NODE_CONNECTION_DRIVERKEY_NAME;
USB_NODE_CONNECTION_DRIVERKEY_NAME DriverKey = new USB_NODE_CONNECTION_DRIVERKEY_NAME();
DriverKey.ConnectionIndex = PortPortNumber;
if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_DRIVERKEY_NAME, ptrDriverKey, nBytes, ptrDriverKey, nBytes, out nBytesReturned, IntPtr.Zero))
DriverKey = (USB_NODE_CONNECTION_DRIVERKEY_NAME)Marshal.PtrToStructure(ptrDriverKey, typeof(USB_NODE_CONNECTION_DRIVERKEY_NAME));
struct USB_NODE_CONNECTION_INFORMATION_EX
public int ConnectionIndex;
public int ConnectionStatus;
Structure USB_NODE_CONNECTION_INFORMATION_EX
typedef struct _USB_NODE_CONNECTION_INFORMATION_EX {
ULONG ConnectionIndex;
USB_CONNECTION_STATUS ConnectionStatus;
} USB_NODE_CONNECTION_INFORMATION_EX, *PUSB_NODE_CONNECTION_INFORMATION_EX;
int nBytes = Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX));
IntPtr ptrNodeConnection = Marshal.AllocHGlobal(nBytes);
USB_NODE_CONNECTION_INFORMATION_EX NodeConnection = new USB_NODE_CONNECTION_INFORMATION_EX();
NodeConnection.ConnectionIndex = i;
Marshal.StructureToPtr(NodeConnection, ptrNodeConnection, true);
if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptrNodeConnection, nBytes, ptrNodeConnection, nBytes, out nBytesReturned, IntPtr.Zero))
NodeConnection = (USB_NODE_CONNECTION_INFORMATION_EX)Marshal.PtrToStructure(ptrNodeConnection, typeof(USB_NODE_CONNECTION_INFORMATION_EX));
Marshal.FreeHGlobal(ptrNodeConnection);
USB_NODE_CONNECTION_INFORMATION_EX connection = new USB_NODE_CONNECTION_INFORMATION_EX();
connection.ConnectionIndex = i;
size = Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX)) + 32 * Marshal.SizeOf(typeof(USB_PIPE_INFO)); // Assuming 32 should be enough, you can make this larger
IntPtr ptr_connection = Marshal.AllocHGlobal(size);
Marshal.StructureToPtr(connection, ptr_connection, true);
if (DeviceIoControl(hHub, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, ptr_connection, size, ptr_connection, size, out bytes_returned, IntPtr.Zero))
connection = (USB_NODE_CONNECTION_INFORMATION_EX)Marshal.PtrToStructure(ptr_connection, typeof(USB_NODE_CONNECTION_INFORMATION_EX));
if (bytes_returned != Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX)))
int num = (bytes_returned - Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX))) / Marshal.SizeOf(typeof(USB_PIPE_INFO));
IntPtr ptr_pipeinfo = new IntPtr((byte*)ptr_connection.ToPointer()
+ Marshal.SizeOf(typeof(USB_NODE_CONNECTION_INFORMATION_EX))
Marshal.FreeHGlobal(ptr_connection);
struct USB_NODE_CONNECTION_NAME
public int ConnectionIndex;
Structure USB_NODE_CONNECTION_NAME
typedef struct _USB_NODE_CONNECTION_NAME {
ULONG ConnectionIndex;
} USB_NODE_CONNECTION_NAME, *PUSB_NODE_CONNECTION_NAME;
USB_NODE_CONNECTION_NAME NodeName = new USB_NODE_CONNECTION_NAME();
NodeName.ConnectionIndex = PortPortNumber;
if (DeviceIoControl(h, IOCTL_USB_GET_NODE_CONNECTION_NAME, ptrNodeName, nBytes, ptrNodeName, nBytes, out nBytesReturned, IntPtr.Zero))
NodeName = (USB_NODE_CONNECTION_NAME)Marshal.PtrToStructure(ptrNodeName, typeof(USB_NODE_CONNECTION_NAME)); You don't use an IOCTL call directly with a USB_STRING_DESCRIPTOR structure. Instead you use a USB_DESCRIPTOR_REQUEST "request packet" with IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION. The USB_STRING_DESCRIPTOR structure is returned at the very end of the request packet. The whole idea of "writing off the edge" of a structure is counter to the way C#/VB.Net was designed to work, so you'll have to make sure to allocate sufficient amount of memory to handle both the "request packet" and the USB_STRING_DESCRIPTOR structure.
Request.ConnectionIndex = PortPortNumber;
if (DeviceIoControl(h, IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION, ptrRequest, nBytes, ptrRequest, nBytes, out nBytesReturned, IntPtr.Zero))
Byte[] ConnectState;
System.Runtime.InteropServices.ComTypes.FILETIME ConnectTime;
System.Runtime.InteropServices.ComTypes.FILETIME DisconnectTime;
public struct WLAN_CONNECTION_ATTRIBUTES
/// WLAN_CONNECTION_MODE->_WLAN_CONNECTION_MODE
public WLAN_CONNECTION_MODE wlanConnectionMode;
Public Structure WLAN_CONNECTION_ATTRIBUTES
''' WLAN_CONNECTION_MODE->_WLAN_CONNECTION_MODE
Public wlanConnectionMode As WLAN_CONNECTION_MODE
public struct WLAN_CONNECTION_PARAMETERS
public WLAN_CONNECTION_MODE wlanConnectionMode;
Structure WLAN_CONNECTION_PARAMETERS The rationale behind the change in the history for this is because is that he/she wanted to "unmarshal". However, in functions like WlanConnect(), it is used as an "input". So, it needs to be marshaled. Then I believe they should be IntPtr.
public struct WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS
Structure WLAN_HOSTED_NETWORK_CONNECTION_SETTINGS
wlan_notification_acm_connection_start,
wlan_notification_acm_connection_complete,
wlan_notification_acm_connection_attempt_fail,
wlan_notification_acm_disconnecting,
wlan_notification_acm_disconnected,
wlan_notification_acm_connection_start
wlan_notification_acm_connection_complete
wlan_notification_acm_connection_attempt_fail
wlan_notification_acm_disconnecting
wlan_notification_acm_disconnected
wlan_notification_msm_connected,
wlan_notification_msm_disconnected,
public WTS_CONNECTSTATE_CLASS State; wlanapi
byte *connectionData = null;
uint sizeConnectionData = 0;
UInt32 result = EapHostPeerInvokeConfigUI(handle, 0, method, 0, null, &sizeConnectionData, &connectionData, ref er);
MessageBox.Show(sizeConnectionData+"jfdgkj");
output = new byte[sizeConnectionData];
for (int i = 0; i < sizeConnectionData; i++)
output[i] = *connectionData;
//MessageBox.Show(*connectionData+" value"+i);
connectionData++; 38: WlanConnect
public static extern uint WlanConnect(IntPtr hClientHandle,ref Guid pInterfaceGuid,ref WLAN_CONNECTION_PARAMETERS pConnectionParameters,IntPtr pReserved);
Declare Function WlanConnect Lib "wlanapi.dll" (ByVal hClientHandle As IntPtr, _
ByRef pConnectionParameters As WLAN_CONNECTION_PARAMETERS, _
WLAN_CONNECTION_PARAMETERS wlanConnectionParameters = new WLAN_CONNECTION_PARAMETERS();
wlanConnectionParameters.dot11BssType = DOT11_BSS_TYPE.dot11_BSS_type_any;
wlanConnectionParameters.dwFlags = 0;
wlanConnectionParameters.strProfile = "dlink";
wlanConnectionParameters.wlanConnectionMode = WLAN_CONNECTION_MODE.wlan_connection_mode_profile;
WlanConnect(ClientHandle,ref pInterfaceGuid,ref wlanConnectionParameters ,new IntPtr());
Dim wlanConnectionParameters As New WLAN_CONNECTION_PARAMETERS
wlanConnectionParameters.dot11BssType = DOT11_BSS_TYPE.dot11_BSS_type_any
wlanConnectionParameters.dwFlags = 0
wlanConnectionParameters.strProfile = "dlink"
wlanConnectionParameters.wlanConnectionMode = WLAN_CONNECTION_MODE.wlan_connection_mode_profile
WlanConnect(ClientHandle, pInterfaceGuid, wlanConnectionParameters, IntPtr.Zero) 39: WlanDisconnect
public static extern uint WlanDisconnect(IntPtr hClientHandle,ref Guid pInterfaceGuid,IntPtr pReserved);
Declare Function WlanDisconnect Lib "wlanapi.dll" (TODO) As TODO
WLAN_CONNECTION_ATTRIBUTES connection;
if (WlanQueryInterface(handle, ref guid, WLAN_INTF_OPCODE.wlan_intf_opcode_current_connection, IntPtr.Zero, out dataSize, ref ptr, IntPtr.Zero) != 0)
connection = (WLAN_CONNECTION_ATTRIBUTES)Marshal.PtrToStructure(ptr, typeof(WLAN_CONNECTION_ATTRIBUTES));
// Do something here with the connection info....
Dim connection As WLAN_CONNECTION_ATTRIBUTES
If WlanQueryInterface(handle, guid, WLAN_INTF_OPCODE.wlan_intf_opcode_current_connection, IntPtr.Zero, dataSize, ptr, _
connection = DirectCast(Marshal.PtrToStructure(ptr, GetType(WLAN_CONNECTION_ATTRIBUTES)), WLAN_CONNECTION_ATTRIBUTES)
' Do something here with the connection info.... secur32
public const int ISC_REQ_CONNECTION = 0x00000800;
public const int STANDARD_CONTEXT_ATTRIBUTES = ISC_REQ_CONFIDENTIALITY | ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT | ISC_REQ_CONNECTION;
/// <param name="LsaHandle">[in] Handle obtained from a previous call to LsaRegisterLogonProcess or LsaConnectUntrusted.</param>
public static extern WinStatusCodes LsaConnectUntrusted([Out] out IntPtr LsaHandle);
Declare Function LsaConnectUntrusted Lib "secur32.dll" (TODO) As TODO
NewCredentials, // Allows the caller to clone its current token and specify new credentials for outbound connections. 46: LsaLogonUser
public static extern WinStatusCodes LsaConnectUntrusted([Out] out IntPtr LsaHandle);
OSCalls.WinStatusCodes status = OSCalls.LsaConnectUntrusted(out lsaHandle); Interfaces
,BINDSTATUS_CONNECTING
// IConnectionPoint errors
CONNECT_E_FIRST = 0x80040200,
CONNECT_E_NOCONNECTION, // there is no connection for this connection id
CONNECT_E_ADVISELIMIT, // this implementation's limit for advisory connections has been reached
CONNECT_E_CANNOTCONNECT, // connection attempt failed
CONNECT_E_OVERRIDDEN, // must use a derived interface to connect
INET_E_CANNOT_CONNECT = 0x800C0004,
INET_E_CONNECTION_TIMEOUT = 0x800C000B,
case HRESULTS.INET_E_CANNOT_CONNECT:
Description = "Cannot Connect";break;
case HRESULTS.INET_E_CONNECTION_TIMEOUT:
Description = "Connection Timeout.";break; 48: IConnector
public interface IConnector
int GetType(out ConnectorType pType);
int ConnectTo([In] IConnector connector);
int Disconnect();
int IsConnected(out bool pbConnected);
int GetConnectedTo([Out, MarshalAs(UnmanagedType.LPArray)] out IConnector ppConTo);
int GetConnectorIdConnectedTo(out string ppwstrConnectorId);
int GetDeviceIdConnectedTo(out string ppwstrDeviceId);
Interface IConnector 49: IDataObject
int DAdvise([In] ref FORMATETC pFormatetc, ADVF advf, IAdviseSink adviseSink, out int connection);
void DUnadvise(int connection); 50: IDeviceTopology
int GetConnectorCount([Out] out int pConnectorCount);
int GetConnector(int nIndex, out IConnector ppConnector); Starting point only - I only got as far as making getconnectorcount and getconnector return valid information on my machine. The other functions may or may not work! 51: IOleObject
void Advise(object pAdvSink, uint pdwConnection);
void Unadvise(uint dwConnection);
TASK_FLAG_RUN_IF_CONNECTED_TO_INTERNET = 0x400, 53: IUICollection
// Connection Sink for listening to collection changes 54: IUIFramework
// Connects the framework and the application user3255: DdeConnect
static extern IntPtr DdeConnect(uint idInst, IntPtr hszService, IntPtr handle = DdeConnect(instanceId, serviceHandle, topicHandle, IntPtr.Zero); 56: DdeConnectList 57: DdeDisconnect 59: DdeReconnect comdlg3260: FtpCommand
static extern bool FtpCommand(IntPtr hConnect, bool fExpectResponse, [MarshalAs(UnmanagedType.U4)] int dwFlags, string lpszCommand, IntPtr dwContext, ref IntPtr phFtpCommand);
Private Shared Function FtpCommand(ByVal hConnect As IntPtr, ByVal fExpectResponse As Boolean, <MarshalAs(UnmanagedType.U4)> ByVal dwFlags As Integer, ByVal lpszCommand As String, ByVal dwContext As IntPtr, ByRef phFtpCommand As IntPtr) As Boolean Cut off search results after 60. Please refine your search. |