internal static extern int NetUserAdd([MarshalAs(UnmanagedType.LPWStr)]string servername, UInt32 level, ref SafeNativeMethods.USER_INFO_1 buf, out Int32 parm_err);
internal static extern bool CreateProcessWithLogonW( string userName, string domain, IntPtr password, LogonFlags logonFlags, [MarshalAs(UnmanagedType.LPTStr)] string appName, StringBuilder cmdLine, int creationFlags, IntPtr environmentBlock, [MarshalAs(UnmanagedType.LPTStr)] string lpCurrentDirectory, // LPCTSTR STARTUPINFO lpStartupInfo, SafeNativeMethods.PROCESS_INFORMATION lpProcessInformation);
public static extern bool CreateProcess( [MarshalAs(UnmanagedType.LPTStr)] string lpApplicationName, // LPCTSTR StringBuilder lpCommandLine, // LPTSTR - note: CreateProcess might insert a null somewhere in this string SECURITY_ATTRIBUTES lpProcessAttributes, // LPSECURITY_ATTRIBUTES SECURITY_ATTRIBUTES lpThreadAttributes, // LPSECURITY_ATTRIBUTES bool bInheritHandles, // BOOL int dwCreationFlags, // DWORD IntPtr lpEnvironment, // LPVOID [MarshalAs(UnmanagedType.LPTStr)] string lpCurrentDirectory, // LPCTSTR STARTUPINFO lpStartupInfo, // LPSTARTUPINFO SafeNativeMethods.PROCESS_INFORMATION lpProcessInformation // LPPROCESS_INFORMATION );
public extern static bool CreateProcessAsUser(SafeHandle hToken, string lpApplicationName, string lpCommandLine, SECURITY_ATTRIBUTES lpProcessAttributes, SECURITY_ATTRIBUTES lpThreadAttributes, bool bInheritHandles, int dwCreationFlags, HandleRef lpEnvironment, string lpCurrentDirectory, STARTUPINFO lpStartupInfo, SafeNativeMethods.PROCESS_INFORMATION lpProcessInformation );
private static bool EqualConnectedState(SafeNativeMethods.InternetConnectionState expected) { SafeNativeMethods.InternetConnectionState state = 0; SafeNativeMethods.InternetGetConnectedState(ref state, 0); return (state & expected) != 0; }