Desktop Functions: Smart Device Functions:
|
Search Results for "Run" in [All]dmcl401: dmAPIGet
return System.Runtime.Interop.Marshal.PtrToStringAnsi( res ); msdelta2: CreateDeltaW
ref System.Runtime.InteropServices.ComTypes.FILETIME lpTargetFileTime, advapi32
int lastError = System.Runtime.InteropServices.Marshal.GetLastWin32Error(); You will need to reference System.Runtime.InteropServices
' do a "dry run" to get the size of the SID and Domain string
SERVICE_RUNNING = 0x00000004,
SERVICE_RUNNING = &H4
using System.Runtime.InteropServices;
ServiceBase.Run (new TestService());
System.Runtime.InteropServices.Marshal.Copy(SID, 0, sidPtr, SID.Length);
System.Runtime.InteropServices.Marshal.FreeHGlobal( sidPtr );
sSID = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(ptrSID)
sSID = System.Runtime.InteropServices.Marshal.PtrToStringAuto(ptrSID)
System.Runtime.InteropServices.Marshal.FreeHGlobal(ptrSID)
Imports System.Runtime.InteropServices
Console.WriteLine("Running ...")
using System.Runtime.InteropServices;
namespace RunAs
Console.WriteLine("Running ..."); For .NET 2.0, System.Diagnostics.Process.Start has new overloads that allows you to run under different user accounts. 10: CreateService
/// the right to change the executable file that the system runs,
/// Service that runs in its own process.
''' the right to change the executable file that the system runs
''' Service that runs in its own process. 11: CredDelete
$cred.target = [System.Runtime.InteropServices.Marshal]::StringToCoTaskMemUni('server') 12: CredRead
MAXIMUM_EX = (MAXIMUM + 1000), // Allow new applications to run on old OSes
public System.Runtime.InteropServices.ComTypes.FILETIME LastWritten;
public System.Runtime.InteropServices.ComTypes.FILETIME LastWritten; 13: CredWrite
//public System.Runtime.InteropServices.FILETIME lastWritten; // .NET 1.1
public System.Runtime.InteropServices.ComTypes.FILETIME lastWritten; // .NET 2.0
public System.Runtime.InteropServices.ComTypes.FILETIME lastWritten;
$cred.targetName = [System.Runtime.InteropServices.Marshal]::StringToCoTaskMemUni('server1')
$cred.userName = [System.Runtime.InteropServices.Marshal]::StringToCoTaskMemUni('domain\user')
$cred.credentialBlob = [System.Runtime.InteropServices.Marshal]::StringToCoTaskMemUni($password)
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] 17: GetSecurityInfo using System.Runtime.InteropServices;
Runtime.InteropServices.Marshal.Copy(GetSidIdentifierAuthority(pSID), sia, 0, 6) Dim pSID As IntPtr = Runtime.InteropServices.Marshal.AllocHGlobal(GetSidLengthRequired(iSubAuthorityCount))
Dim numSubAuthorities As Byte = Runtime.InteropServices.Marshal.ReadByte(GetSidSubAuthorityCount(pSID), 0)
Dim numSubAuthorities As Byte = Runtime.InteropServices.Marshal.ReadByte(GetSidSubAuthorityCount(pSID), 0) using System.Runtime.InteropServices; 23: GetUserName
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices 24: InitializeSid
Dim pSID As IntPtr = Runtime.InteropServices.Marshal.AllocHGlobal(GetSidLengthRequired(sidParts.Length - 1)) 25: LogonUser
26: LogonUserEx
using System.Runtime.InteropServices; 28: LookupAccountSid
using System.Runtime.InteropServices;
err = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
err = System.Runtime.InteropServices.Marshal.GetLastWin32Error(); The privileges that Windows knows about vary from one system to another. If you run your code on a Windows version other than the one you developed it on, you'll need to handle this one. (Answer: Nobody knows why, but the runtime seems to screw it up)
using System.Runtime.InteropServices; 32: LsaFreeMemory
[System.Runtime.InteropServices.DllImport("advapi32.dll", SetLastError=true)] 33: LsaLookupSids
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices; 34: LsaOpenPolicy I used a custom marshaler to live a happier life with the "own super special" string type that LSA uses. It marshals LSA_UNICODE_STRINGS to and from normal .NET strings. See "Alternate Sample Code" way below. However I'm quite new to p/invoke and this is my first custom marshaler ever, so please keep your eyes open for problems and bugs with my code. (A problem I had was CleanUpNativeData for data converted from managed to unmanaged aswell as for data converted from unmanaged to managed. Since I didn't allocate the data myself in the latter case my marshaler uses a hash table to keep track of the native data it allocated itself. Don't know if that's the correct way, however. Feel free to mail me at pi AT removethispart frohwalt removethisaswell DOT de for suggestions/corrections. (However, these won't do when you need to modify COM runas Passwords ...) using System.Runtime.InteropServices; 36: OpenThreadToken
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
[System.Runtime.InteropServices.DllImport("advapi32.dll", SetLastError = true)]
[System.Runtime.InteropServices.DllImport("advapi32.dll", SetLastError = true)]
[System.Runtime.InteropServices.DllImport("advapi32.dll", SetLastError = true)]
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
dw = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
dw = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
dw = System.Runtime.InteropServices.Marshal.GetLastWin32Error();
dw = System.Runtime.InteropServices.Marshal.GetLastWin32Error(); using System.Runtime.InteropServices;
throw new System.Runtime.InteropServices.ExternalException( "Error OpenSCManager\n" );
throw new System.Runtime.InteropServices.ExternalException( "Error OpenService\n" );
[MarshalAs( System.Runtime.InteropServices.UnmanagedType.LPWStr )] using System.Runtime.InteropServices;
throw new System.Runtime.InteropServices.ExternalException( "Error OpenSCManager\n" );
throw new System.Runtime.InteropServices.ExternalException( "Error OpenService\n" );
[MarshalAs( System.Runtime.InteropServices.UnmanagedType.LPWStr )]
SERVICE_RUNNING = 0x00000004, 40: RegLoadKey When run from a remote PC (via RegConnectRegistry), the path to the hive file is local to that PC.
using System.Runtime.InteropServices; 42: RegOpenKey - Changed IntPtr to UIntPtr: When invoking with IntPtr for the handles, you will run into an Overflow. UIntPtr is the right choice if you wish this to work correctly on 32 and 64 bit platforms. Note that the root key should specify the registry path above where WOW6432node gets inserted, otherwise the KEY_WOW64_64 flag is ignored when used in a 32 bit application running on a 64 bit machine. So
' Ignore the 64-bit flags when running from <= Win2k
Dim Handle As System.Runtime.InteropServices.SafeHandle = CType(Info.GetValue(RegisteryKey), System.Runtime.InteropServices.SafeHandle) Microsoft .NET Framework 4.0 - how to get the above sample running43: RegOpenKeyEx - Changed IntPtr to UIntPtr: When invoking with IntPtr for the handles, you will run into an Overflow. UIntPtr is the right choice if you wish this to work correctly on 32 and 64 bit platforms. Note that the root key should specify the registry path above where WOW6432node gets inserted, otherwise the KEY_WOW64_64 flag is ignored when used in a 32 bit application running on a 64 bit machine. So
' Ignore the 64-bit flags when running from <= Win2k
Dim Handle As System.Runtime.InteropServices.SafeHandle = CType(Info.GetValue(RegisteryKey), System.Runtime.InteropServices.SafeHandle) Microsoft .NET Framework 4.0 - how to get the above sample running44: RegQueryValue
<System.Runtime.InteropServices.DllImport("advapi32.dll", SetLastError:=True)> _
<System.Runtime.InteropServices.DllImport("advapi32.dll", SetLastError:=True)> _ 45: RegQueryValueEx
<System.Runtime.InteropServices.DllImport("advapi32.dll", SetLastError:=True)> _
<System.Runtime.InteropServices.DllImport("advapi32.dll", SetLastError:=True)> _ 46: RegSetValueEx
<System.Runtime.InteropServices.DllImport("advapi32.dll", SetLastError:=True)> _ 47: SC_ACTION
/// Run a command.
SC_ACTION_RUN_COMMAND = 3
using System.Runtime.InteropServices; 49: Windows Services I'm developing one windows service, which sould run and goes to database for every hour and changes the current user desktop accordingly.
using System.Runtime.InteropServices; //DllImport, MarshalAs Imports System.Runtime.InteropServices
<System.Runtime.CompilerServices.Extension()> _ setupapi51: SetupCopyOEMInf
SP_COPY_NOPRUNE = 0x0100000 // never prune this file
public System.Runtime.InteropServices.ComTypes.FILETIME DriverDate; Note that the maximum length of any single string specified in an INF Strings section is 512 characters, including the terminating NULL. If the string length is greater than 512 it will be truncated and no error will be returned. The maximum length of any concatenated string created from one or more tokens is 4096 characters. rpcrt454: UuidFromStringA pin_ptr<unsigned char> UuidSringPtr = static_cast<unsigned char *>(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi("C3ECE8CB-E9F8-47f9-AC61-8EA8572403F2").ToPointer()); powrprof55: SetSuspendState
using System.Runtime.InteropServices; odbc3256: SQLAllocStmt
<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _
Private Shared Function SQLAllocStmt(ByVal connectionHandle As IntPtr, <Runtime.InteropServices.Out()> _ 57: SQLConnect
<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _ 58: SQLDataSources
/// source name in *ServerName is truncated to BufferLength1 minus the length of a null-termination character. </param>
/// the driver description in *Description is truncated to BufferLength2 minus the length of a null-termination character.</param> 59: SQLDriverConnect
<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _
<Runtime.InteropServices.Out()> ByRef pbcConnStrOut As Short, ByVal fDriverCompletion As Short) As Short 60: SQLExecDirect
<Runtime.InteropServices.DllImport("odbc32.dll", CharSet:=Runtime.InteropServices.CharSet.Unicode)> _ Cut off search results after 60. Please refine your search. |