Desktop Functions: Smart Device Functions:
|
Search Results for "connect" in [All]odbccp32
vAttributes &= "Trusted_Connection=Yes" & Convert.ToChar(0) This function persists a system data source with the provided name and connection string. Remember to add your own error checking mechanisms.
// Connection string for SQLConfigDataSource must be null- This function persists a system data source with the provided name and connection string. Remember to add your own error checking mechanisms.
// Connection string for SQLConfigDataSource must be null- winmm4: midiConnect
static extern UInt32 midiConnect(IntPtr hMidi, IntPtr hmo, IntPtr pReserved);
Declare Function midiConnect Lib "winmm.dll" (TODO) As TODO
UInt32 Connect(IntPtr midiInputHandle, IntPtr midiOutputHandle)
return midiConnect(midiInputHandle, midiOutputHandle, IntPtr.Zero);
static extern UInt32 midiDisconnect(IntPtr hMidi, IntPtr hmo, IntPtr pReserved);
Declare Function midiDisconnect Lib "winmm.dll" (TODO) As TODO
UInt32 Disconnect(IntPtr midiInputHandle, IntPtr midiOutputHandle)
return midiDisconnect(midiInputHandle, midiOutputHandle, IntPtr.Zero); mpr
static extern int MultinetGetConnectionPerformance(
ref NetConnectInfoStruct lpNetConnectInfoStruct);
public struct NetConnectInfoStruct {
/// In the absence of information about the actual connection,
/// the current connection with the resource, with any routing
/// The connection is not being routed.
/// If this flag is not set, the connection may be going through
/// The connection is over a medium that is typically slow (for
NetConnectInfoStruct ci = new NetConnectInfoStruct();
RESOURCE_CONNECTED = 1,
RESOURCEUSAGE_CONNECTABLE = 0x00000001,
RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED),
public enum ResourceConnection
CONNECT_UPDATE_PROFILE = 1,
CONNECT_UPDATE_RECENT = 2,
CONNECT_TEMPORARY = 4,
CONNECT_INTERACTIVE = 8,
CONNECT_PROMPT= 0X10,
CONNECT_REDIRECT = 0X80,
CONNECT_CURRENT_MEDIA = 0X200,
CONNECT_COMMAND_LINE = 0X800,
CONNECT_CMD_SAVECRED = 0X1000,
CONNECT_CRED_RESET = 0X2000 private static extern int WNetAddConnection2( NETRESOURCE lpNetResource,
Declare Function VVNetAddConnection2 Lib "mpr.dll" (TODO) As TODO nr.dwUsage = ResourceUsage.RESOURCEUSAGE_CONNECTABLE; int result = WNetAddConnection2(nr, password, user, (int)ResourceConnection.CONNECT_TEMPORARY);
private static extern int WNetAddConnection3(IntPtr hWndOwner,
Private Shared Function WNetAddConnection3(ByVal hWndOwner As IntPtr, _
private const int CONNECT_INTERACTIVE = 0x8;
private const int CONNECT_PROMPT = 0x10;
WNetAddConnection3(hWnd, ref ConnInf, null, null,
CONNECT_INTERACTIVE | CONNECT_PROMPT); http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wnet/wnet/wnetaddconnection2.asp The WNetAddConnection2 function supersedes the WNetAddConnection function. If you can pass a handle to a window that the provider of network resources can use as an owner window for dialog boxes, call the WNetAddConnection3 function instead.
public static extern int WNetAddConnection2(ref NETRESOURCE netResource,
public static extern int WNetAddConnection2(NETRESOURCE netResource,
// RESOURCE_CONNECTED = 1,
// RESOURCEUSAGE_CONNECTABLE = 0x00000001,
// RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED),
// [DllImport("Mpr.dll", EntryPoint="WNetAddConnection2", CallingConvention=CallingConvention.Winapi)]
// private static extern ErrorCodes WNetAddConnection2(NETRESOURCE lpNetResource,ref string lpPassword,ref
public static extern int WNetAddConnection2( [In] NETRESOURCE netResource,
Declare Function WNetAddConnection2 Lib "mpr.dll" (ByRef netResource As _
Declare Function WNetAddConnection2 Lib "mpr.dll" (netResource As _ // int ret = WNetAddConnection2( myNetResource, "username", "password", 0);
int ret = WNetAddConnection2( myNetResource, "password", "username", 0); //by honglinlee
public class NetworkConnection : IDisposable
public NetworkConnection(string networkName,
var result = WNetAddConnection2(
throw new IOException("Error connecting to remote share",
~NetworkConnection()
WNetCancelConnection2(_networkName, 0, true);
private static extern int WNetAddConnection2(NetResource netResource,
private static extern int WNetCancelConnection2(string name, int flags,
Connected = 1,
RESOURCE_CONNECTED = 1,
RESOURCEUSAGE_CONNECTABLE = 0x00000001,
RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED),
private static extern int WNetAddConnection2(NETRESOURCE lpNetResource, string lpPassword, string lpUsername, int dwFlags);
int result = WNetAddConnection2(myNetResource, password, user, 0); This is a function which connects to a share. Will throw a message box with any errors. Example connect code: ConnectDrive("\\server\share", "s:", "username", "password")
Public Function ConnectDrive(ByVal RemoteName As String, ByVal LocalName As String, Optional ByVal username As String = Nothing, Optional ByVal password As String = Nothing)
returnValue = WNetAddConnection2(myResource, password, username, 0)
MsgBox("Could not connect to " & myResource.RemoteName & ". The server said this: " & vbNewLine & vbNewLine & "(Error " & returnValue & ") " & errorM)
private static extern int WNetAddConnection3(IntPtr hWndOwner,
Private Shared Function WNetAddConnection3(ByVal hWndOwner As IntPtr, _
private const int CONNECT_INTERACTIVE = 0x8;
private const int CONNECT_PROMPT = 0x10;
WNetAddConnection3(hWnd, ref ConnInf, null, null,
CONNECT_INTERACTIVE | CONNECT_PROMPT); http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wnet/wnet/wnetaddconnection2.asp
static extern int WNetCancelConnection2(string lpName, Int32 dwFlags, bool bForce);
Declare Function WNetCancelConnection2 Lib "mpr.dll" Alias "WNetCancelConnection2A" (ByVal lpName As String, ByVal dwFlags As Integer, ByVal fForce As Integer) As Integer
''' The WNetCancelConnection2 function cancels an existing network connection.
''' You can also call the function to remove remembered network connections that are not currently connected.
Private Shared Function WNetCancelConnection2(ByVal lpName As String, _ The system updates the user profile with the information that the connection is no longer a persistent one if you pass this constant as <dwFlags>
private const int CONNECT_UPDATE_PROFILE = 0x1;
public static extern int WNetCancelConnection2(string lpName, Int32 dwFlags, bool fForce);
private const int CONNECT_UPDATE_PROFILE = 0x1;
int result=WNetCancelConnection2("Y:", CONNECT_UPDATE_PROFILE, true);
static extern int WNetCancelConnection2(string lpName, Int32 dwFlags, bool bForce);
Declare Function WNetCancelConnection2 Lib "mpr.dll" Alias "WNetCancelConnection2A" (ByVal lpName As String, ByVal dwFlags As Long, ByVal fForce As Long) As Long
''' The WNetCancelConnection2 function cancels an existing network connection.
''' You can also call the function to remove remembered network connections that are not currently connected.
Private Shared Function WNetCancelConnection2(ByVal lpName As String, _ The system updates the user profile with the information that the connection is no longer a persistent one if you pass this constant as <dwFlags>
private const int CONNECT_UPDATE_PROFILE = 0x1;
public static extern int WNetCancelConnection2(string lpName, Int32 dwFlags, bool fForce);
private const int CONNECT_UPDATE_PROFILE = 0x1;
int result=WNetCancelConnection2("Y:", CONNECT_UPDATE_PROFILE, true); 13: WNetEnumResource
RESOURCE_CONNECTED = 0x00000001,
RESOURCEUSAGE_CONNECTABLE =0x00000001,
RESOURCEUSAGE_ALL =(RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED),
RESOURCE_CONNECTED = &H1
RESOURCEUSAGE_CONNECTABLE = &H1
RESOURCEUSAGE_ALL = (RESOURCEUSAGE_CONNECTABLE Or RESOURCEUSAGE_CONTAINER Or RESOURCEUSAGE_ATTACHED)
public static extern int WNetGetConnection([MarshalAs(UnmanagedType.LPTStr)] string localName, [MarshalAs(UnmanagedType.LPTStr)] StringBuilder remoteName, ref int length);
Shared Function WNetGetConnection(<MarshalAs(UnmanagedType.LPTStr)> _
Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal localName As String, ByVal remoteName As System.Text.StringBuilder, ByRef length As Integer) As Integer rc = WNetGetConnection("p:", rname, ref bsize);
Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" (ByVal localName As String, _
WNetGetConnection(Microsoft.VisualBasic.Left(path, 2), UNC, length)
Declare Function WNetGetConnection Lib "mpr.dll" Alias "WNetGetConnectionA" _
Dim err As Integer = WNetGetConnection(theDriveName, uncPathBuf, uncPathBuf.Capacity)
private static extern int WNetUseConnection
Connect dwFlags,
Declare Function WNetUseConnection Lib "mpr.dll" (TODO) As TODO
CONNECTED = 0x00000001,
CONNECTABLE = 0x00000001,
public enum Connect
public static void UseConnection(string localName, string remoteName, string username, string password)
ThrowIfError(WNetUseConnection(IntPtr.Zero, nr, password, username, 0, null, null, null));
public static void UseConnection(string localName, string remoteName, bool promptUser = false)
ThrowIfError(WNetUseConnection(IntPtr.Zero, nr, null, null, promptUser ? Connect.INTERACTIVE | Connect.PROMPT : 0, null, null, null)); winhttp16: WinHttpConnect
static extern IntPtr WinHttpConnect(IntPtr hSession,
Declare Function WinHttpConnect Lib "winhttp.dll" (ByVal hSession As IntPtr, ByVal pswzServerName As String, ByVal nServerPort As Short, ByVal dwReserved As Integer) As IntPtr 18: WinHttpOpen
IntPtr hConnect,
IntPtr hConnect,
Declare Function WinHttpOpenRequest Lib "winhttp.dll" (ByVal hConnect As IntPtr, ByVal pwszVerb As String, ByVal pwszObjectName As String, ByVal pwszVersion As String, ByVal pwszReferrer As String, ByRef ppwszAcceptTypes As Byte(), ByVal dwFlags As Integer) As IntPtr
IntPtr hConnect,
Declare Function WinHttpOpenRequest Lib "winhttp.dll" (ByVal hConnect As IntPtr, ByVal pwszVerb As String, ByVal pwszObjectName As String, ByVal pwszVersion As String, ByVal pwszReferrer As String, ByRef ppwszAcceptTypes As Byte(), ByVal dwFlags As Integer) As IntPtr
int dwConnectTimeout,
Declare Function WinHttpSetTimeouts Lib "winhttp.dll" (ByVal hInternet As IntPtr, ByVal dwResolveTimeout As Integer, ByVal dwConnectTimeout As Integer, ByVal dwSendTimeout As Integer, ByVal dwReceiveTimeout As Integer) As Boolean shell3221: CSIDL
CSIDL_CONNECTIONS = 0x0031, // Network and Dial-up Connections
/// The computer has disconnected from a server.
/// <i>dwItem1</i> contains the server from which the computer was disconnected.
SHCNE_SERVERDISCONNECT = 0x00004000,
' The computer has disconnected from a server.
' <i>dwItem1</i> contains the server from which the computer was disconnected.
SHCNE_SERVERDISCONNECT = &H4000 23: ShellExecuteEx
SEE_MASK_CONNECTNETDRV = 0x00000080, 24: SHFileOperation
FOF_NO_CONNECTED_ELEMENTS = 0x2000, // don't operate on connected elements.
public bool FOF_NO_CONNECTED_ELEMENTS = false;
if ( this.FOF_NO_CONNECTED_ELEMENTS )
ReturnValue |= (ushort)FILEOP_FLAGS_ENUM.FOF_NO_CONNECTED_ELEMENTS; 25: SHGetFolderPath
CSIDL_CONNECTIONS = 0x0031, // Network and Dial-up Connections
public static readonly Guid ConnectionsFolder = new Guid( "6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD" );
CONNECTIONS = &H31
CSIDL_CONNECTIONS = 0x0031, // Network and Dial-up Connections
public static Guid ConnectionsFolder = new Guid("6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD"); rapi30: CeRegDeleteValue user3231: DdeConnect
static extern IntPtr DdeConnect(uint idInst, IntPtr hszService, IntPtr handle = DdeConnect(instanceId, serviceHandle, topicHandle, IntPtr.Zero); 32: DdeConnectList 33: DdeDisconnect 35: DdeReconnect Constants
const int IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION = 0x220410; 41: NERR_
/// <summary> 2107 - The device is not connected. </summary>
/// <summary> 2250 - The network connection could not be found. </summary>
/// <summary> 2372 - The system cannot delete current connections to network resources. </summary>
/// <summary> 2392 - The shared resource you are connected to could not be found. </summary>
/// <summary> 2401 - There are open files on the connection. </summary>
/// <summary> 2402 - Active connections still exist. </summary>
/// <summary> 2462 - The connection identification does not specify a valid connection. </summary>
public const int NoSuchConnection = 2462;
/// <summary> 2465 - The server has reached the maximum number of connections it supports. </summary>
public const int TooManyConnections = 2465;
/// <summary> 2513 - Cannot connect to the Remoteboot server. </summary>
public const int CantConnectRplSrvr = 2513;
/// <summary> 2515 - Connecting to the Remoteboot server... </summary>
/// <summary> 2516 - Connecting to the Remoteboot server... </summary>
/// <summary> 2519 - A second connection to a Remoteboot resource is not allowed. </summary>
public const int RPL_CONNECTED = 2519; 42: PROPERTYKEY
public static PropertyKey PKEY_Device_NoConnectSound = new PropertyKey(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 17); // DEVPROP_TYPE_BOOLEAN
public static PropertyKey PKEY_DeviceDisplay_IsConnected = new PropertyKey(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000037); // VT_BOOL
public static PropertyKey PKEY_DeviceDisplay_Last_Connected = new PropertyKey(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000043); // VT_FILETIME
public static PropertyKey PKEY_DeviceDisplay_IsShowInDisconnectedState = new PropertyKey(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000044); // VT_BOOL
public static PropertyKey PKEY_DeviceDisplay_LaunchDeviceStageOnDeviceConnect = new PropertyKey(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x0000004C); // VT_BOOL
public static PropertyKey PKEY_DeviceDisplay_AlwaysShowDeviceAsConnected = new PropertyKey(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x00000065); // VT_BOOL
public static PropertyKey SENSOR_PROPERTY_CONNECTION_TYPE = new PropertyKey(0X7F8383EC, 0XD3EC, 0X495C, 0XA8, 0XCF, 0XB8, 0XBB, 0XE8, 0X5C, 0X29, 0X20, 11); //[VT_UI4] 43: RESOURCE
const UInt32 RESOURCE_CONNECTED = 0x00000001;
const UInt32 RESOURCEUSAGE_CONNECTABLE = 0x00000001; 44: SCM
Const SC_MANAGER_CONNECT As Int32 = &H1
SC_MANAGER_CONNECT Or _ 45: ShellAPI
public const int FOF_NO_CONNECTED_ELEMENTS = 0x2000; // don't operate on connected elements.
public const int PO_PORTCHANGE = 0x0020; // port this printer connected to is being changed
public const int SEE_MASK_CONNECTNETDRV = 0x00000080; 46: ShellAPI
public const int FOF_NO_CONNECTED_ELEMENTS = 0x2000; // don't operate on connected elements.
public const int PO_PORTCHANGE = 0x0020; // port this printer connected to is being changed
public const int SEE_MASK_CONNECTNETDRV = 0x00000080; 47: WINERROR
/// You were not connected because a duplicate name exists on the network. Go to System in Control Panel to change the computer name and try again.
/// No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.
public const int ERROR_PIPE_NOT_CONNECTED = 233;
public const int ERROR_VC_DISCONNECTED = 240;
public const int ERROR_PIPE_CONNECTED = 535;
/// The service process could not connect to the service controller.
public const int ERROR_FAILED_SERVICE_CONTROLLER_CONNECT = 1063;
/// The device is not connected.
public const int ERROR_DEVICE_NOT_CONNECTED = 1167;
/// The device is not currently connected but it is a remembered connection.
public const int ERROR_CONNECTION_UNAVAIL = 1201;
/// The local device name has a remembered connection to another network resource.
/// Unable to open the network connection profile.
/// The network connection profile is corrupted.
/// Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again..
/// The remote system refused the network connection.
public const int ERROR_CONNECTION_REFUSED = 1225;
/// The network connection was gracefully closed.
public const int ERROR_GRACEFUL_DISCONNECT = 1226;
/// An operation was attempted on a nonexistent network connection.
public const int ERROR_CONNECTION_INVALID = 1229;
/// An invalid operation was attempted on an active network connection.
public const int ERROR_CONNECTION_ACTIVE = 1230;
/// The network connection was aborted by the local system.
public const int ERROR_CONNECTION_ABORTED = 1236;
/// A connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached.
public const int ERROR_CONNECTION_COUNT_LIMIT = 1238;
/// This operation is supported only when you are connected to the server.
public const int ERROR_ONLY_IF_CONNECTED = 1251;
/// The service being accessed is licensed for a particular number of connections.
/// No more connections can be made to the service at this time because there are already as many connections as the service can accept.
public const int ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED = 1936;
/// The network connection was made successfully, but the user had to be prompted for a password other than the one originally specified.
public const int ERROR_CONNECTED_OTHER_PASSUInt16 = 2108;
/// The network connection was made successfully using default credentials.
public const int ERROR_CONNECTED_OTHER_PASSUInt16_DEFAULT = 2109;
/// This network connection does not exist.
public const int ERROR_NOT_CONNECTED = 2250;
/// This network connection has files open or requests pending.
/// Active connections still exist.
public const int ERROR_ACTIVE_CONNECTIONS = 2402;
/// The device is in use by an active process and cannot be disconnected.
public const int ERROR_WMI_GUID_DISCONNECTED = 4207;
/// The specified terminal connection driver was not found in the system path.
/// Carrier detect has failed or carrier has been dropped due to disconnect.
/// The requested operation cannot be completed because the terminal connection is currently busy processing a connect, disconnect, reset, or delete operation.
/// An attempt has been made to connect to a session whose video mode is not supported by the current client.
/// The client failed to respond to the server connect message.
/// Disconnecting the console session is not supported.
public const int ERROR_CTX_CONSOLE_DISCONNECT = 7041;
/// Reconnecting a disconnected session to the console is not supported.
public const int ERROR_CTX_CONSOLE_CONNECT = 7042;
/// The specified terminal connection driver is invalid.
/// This may be because the session is disconnected or does not currently have a user logged on.
/// Your request to connect to this Terminal Server has been rejected. Your Terminal Server client license number is currently being used by another user.
/// Your request to connect to this Terminal Server has been rejected. Your Terminal Server client license number has not been entered for this copy of the Terminal Server client.
/// This request requires a secure connection.
public const int ERROR_DS_DRA_CONNECTION_FAILED = 8444;
public const int ERROR_DS_DRA_EXTN_CONNECTION_FAILED = 8466;
/// The connection between client and server requires packet privacy or better.
public const int ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION = 8533;
/// The connection has been broken due to keep-alive activity detecting a failure while the operation was in progress.
/// An established connection was aborted by the software in your host machine.
/// An existing connection was forcibly closed by the remote host.
/// A connect request was made on an already connected socket.
/// A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied.
/// A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
/// No connection could be made because the target machine actively refused it.
/// There is no connection for this connection ID
public const int OLE_E_NOCONNECTION = (int)(0x80040004 - 0x100000000);
/// Moniker needs to be connected manually
/// Moniker needs to be connected manually
public const int MK_E_CONNECTMANUALLY = (int)(0x800401E0 - 0x100000000);
/// Object is not connected to server
public const int CO_E_OBJNOTCONNECTED = (int)(0x800401FD - 0x100000000);
/// A connection with the transaction manager was lost.
public const int XACT_E_CONNECTION_DOWN = (int)(0x8004D01C - 0x100000000);
/// A request to establish a connection with the transaction manager was denied.
public const int XACT_E_CONNECTION_DENIED = (int)(0x8004D01D - 0x100000000);
/// This transaction manager failed to establish a connection with another TIP transaction manager.
public const int XACT_E_TIP_CONNECT_FAILED = (int)(0x8004D01F - 0x100000000);
/// The connection terminated or is in a bogus state and cannot be used any more. Other connections are still valid.
public const int RPC_E_CONNECTION_TERMINATED = (int)(0x80010006 - 0x100000000);
/// The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call may have executed.
/// The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call did not execute.
/// The object invoked has disconnected from its clients.
public const int RPC_E_DISCONNECTED = (int)(0x80010108 - 0x100000000);
/// The smart card cannot be accessed because of other connections outstanding. advapi32
throw new Exception(String.Format("Error connecting to Service Control Manager. Error provided was: 0x{0:X}", Marshal.GetLastWin32Error()));
throw new Exception(String.Format("Error connecting to Service Control Manager. Error provided was: 0x{0:X}", Marshal.GetLastWin32Error())); 50: DefaultPassword 51: DeleteService
SC_MANAGER_CONNECT = 0x00001,
SC_MANAGER_CONNECT |
private enum ServiceControlManagerType { SC_MANAGER_CONNECT = 0x1, SC_MANAGER_CREATE_SERVICE = 0x2, SC_MANAGER_ENUMERATE_SERVICE = 0x4, SC_MANAGER_LOCK = 0x8, SC_MANAGER_QUERY_LOCK_STATUS = 0x10, SC_MANAGER_MODIFY_BOOT_CONFIG = 0x20, SC_MANAGER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK | SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG }
SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = 0x00000014,
SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = &H14UI
SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = 0x00000014,
SHTDN_REASON_MINOR_NETWORK_CONNECTIVITY = &H14UI 55: LsaOpenPolicy To administer the local security policy of a local or remote system, you must call the LsaOpenPolicy function to establish a session with that system's LSA subsystem. LsaOpenPolicy connects to the LSA of the target system and returns a handle to the Policy object of that system. You can use this handle in subsequent LSA function calls to administer the local security policy information of the target system. 56: OpenSCManager
/// Required to connect to the service control manager.
SC_MANAGER_CONNECT = 0x00001,
SC_MANAGER_CONNECT |
SC_MANAGER_CONNECT | SC_MANAGER_LOCK,
''' Required to connect to the service control manager.
SC_MANAGER_CONNECT = &H1
SC_MANAGER_CONNECT Or _
SC_MANAGER_CONNECT Or SC_MANAGER_LOCK
Const SC_MANAGER_CONNECT As Int32 = &H1
SC_MANAGER_CONNECT Or _
static extern int RegConnectRegistry(string lpmachineName, int hKey, ref int phKResult);
Declare Auto Function RegConnectRegistry Lib "Advapi32" ( _
LONG RegConnectRegistry(
ret = RegConnectRegistry("\\" & RemotePC, New IntPtr(Hive), hRemoteKey)
iResult = ConnectToRemoteReg(@"\\" + computerName, HKEY_LOCAL_MACHINE, ref bOK);
con = sValue; //'0' connection exists
private int ConnectToRemoteReg(string computerName, int HKEY, ref bool bOK)
iReturn = RegConnectRegistry(computerName, HKEY, ref iResult); 58: RegLoadKey When run from a remote PC (via RegConnectRegistry), the path to the hive file is local to that PC.
LPTSTR lpConnectionName;
public IntPtr lpConnectionName;
public string connectionName;
const int ERROR_NOT_CONNECTED = 2250;
// if the return value is ERROR_NOT_CONNECTED, then
if (apiRetVal == ERROR_NOT_CONNECTED)
retVal.connectionName = Path.GetPathRoot(localPath);
retVal.connectionName = Marshal.PtrToStringAuto(rni.lpConnectionName);
Throw New ArgumentException("Not Connected")
<MarshalAs(UnmanagedType.LPTStr)> Public ConnectionName As String
Private Const ERROR_NOT_CONNECTED As Integer = 2250
Private _connect As String
''' Gets the Connection or UNC Initial Share Point [\\ComputerName\Share]
Public ReadOnly Property Connection() As String
Return _connect
''' Gets the Path location within the Connection to the Directory or File
If _local.Assign(_error = ERROR_NOT_CONNECTED) Then
_connect = IO.Path.GetPathRoot(_origpath)
_path = _origpath.Substring(_connect.Length)
_unc = String.Format(UNCFMT, My.Computer.Name, _connect(0), _path)
_connect = Marshal.PtrToStringAuto(rni.lpConnectionName)
Public lpConnectionName As IntPtr dhcpsapi
//left connected overnight should have their IP dynamic lease left untouched.
SqlConnection sqlConnection1 = new SqlConnection("Data Source=" + SqlServer + ";Initial Catalog=DhcpDB;Persist Security Info=True;User ID=user");
SqlCommand selCommand = new SqlCommand(strSQL, sqlConnection1);
sqlConnection1.Open();
sqlConnection1.Close(); Cut off search results after 60. Please refine your search. |