Desktop Functions: Smart Device Functions:
|
Search Results for "Service" in [All]userenvWhen a user logs on interactively, the system automatically loads the user's profile. If a service or an application impersonates a user, the system does not load the user's profile. Therefore, the service or application should load the user's profile with LoadUserProfile. Services and applications that call LoadUserProfile should check to see if the user has a roaming profile. If the user has a roaming profile, specify its path as the lpProfilePath member of PROFILEINFO. To retrieve the user's roaming profile path, you can call the NetUserGetInfo function, specifying information level 3 or 4. Upon successful return, the hProfile member of PROFILEINFO is a registry key handle opened to the root of the user's hive. It has been opened with full access (KEY_ALL_ACCESS). If a service that is impersonating a user needs to read or write to the user's registry file, use this handle instead of HKEY_CURRENT_USER. Do not close the hProfile handle. Instead, pass it to the UnloadUserProfile function. This function closes the handle. You should ensure that all handles to keys in the user's registry hive are closed. If you do not close all open registry handles, the user's profile fails to unload. For more information, see Registry Key Security and Access Rights and Registry Hives. mapi322: MAPILogon Microsoft Important Note: MAPI32 is not supported in a managed environment, memory leaks may be seen. Use the current alternatives: System.Net.Mail or WebDav or Exhange 2007 webservice interface. 3: MAPIReadMail
<Runtime.InteropServices.DllImport("MAPI32.DLL", CharSet:=System.Runtime.InteropServices.CharSet.Ansi)> _ icmp4: IcmpSendEcho
using System.Runtime.InteropServices; credui
<System.Runtime.InteropServices.DllImport("credui.dll", EntryPoint:="CredUIPromptForWindowsCredentials", CharSet:=CharSet.Unicode)> <CLSCompliant(False)> _ kernel32
public UInt16 wServicePackMajor;
public UInt16 wServicePackMinor;
Public wServicePackMajor As Integer
Public wServicePackMinor As Integer
using System.Runtime.InteropServices;
using System.Runtime.InteropServices; // Needed for the DllImport Attribute 9: CreateEvent
using System.Runtime.InteropServices; 10: CreateHardLink
using System.Runtime.InteropServices; 11: CreateMutex This implements a Mutex using a Null DACL (with all the security problems with that). This allows the Mutex to be sharable cross-process. In my implementation I access this Mutex from both ASP.Net and a Windows service running under different ids. 12: CreateNamedPipe
using System.Runtime.InteropServices;
[return: System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.I1)]
using System.Runtime.InteropServices;
[DllImport("kernel32", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
[DllImport("kernel32", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
[DllImport("kernel32", SetLastError = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)] 15: DeviceIoControl
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices Sample and signature code originally used System.Runtime.InteropServices.FILETIME, but this uses ints instead of uints (DWORDs) meaning that this line:
using System.Runtime.InteropServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices; 20: FormatMessage
<System.Runtime.InteropServices.DllImport("Kernel32.dll", EntryPoint:="FormatMessageW", SetLastError:=True, CharSet:=System.Runtime.InteropServices.CharSet.Unicode)>
<System.Runtime.InteropServices.DllImport("Kernel32.dll", SetLastError:=True)>
'so Runtime.InteropServices.Marshal.GetLastWin32Error() returns a valid error
Dim nLastError As Integer = Runtime.InteropServices.Marshal.GetLastWin32Error
Dim sRet As String = Runtime.InteropServices.Marshal.PtrToStringAuto(lpMsgBuf, dwChars)
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.U4)]
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)] 22: GetDateFormat
using System.Runtime.InteropServices; 23: GetDriveType
using System.Runtime.InteropServices;
throw new System.Runtime.InteropServices.ExternalException(" GetExitCodeProcess Error " + lastError, lastError); 25: GetLastError [System.Runtime.InteropServices.Marshal.GetLastWin32Error] 26: GetLocaleInfo using System.Runtime.InteropServices; 27: GetLocaleInfoEx using System.Runtime.InteropServices; 28: GetLocalTime
Imports System.Runtime.InteropServices 29: GetLogicalDrives
using System.Runtime.InteropServices;
using System.Runtime.InteropServices; 31: GetLongPathName
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices 34: GetProcAddress This API becomes a lot more interesting in .NET v2.0 because the System.Runtime.InteropServices.Marshal class gains a new API called GetDelegateForFunctionPointer(). This means that you will be able to write code like this: 35: GetProcessTimes
System.Runtime.InteropServices.FILETIME ftCreation, ftExit, ftKernel, ftUser;
out System.Runtime.InteropServices.FILETIME lpCreationTime,
out System.Runtime.InteropServices.FILETIME lpExitTime,
out System.Runtime.InteropServices.FILETIME lpKernelTime,
out System.Runtime.InteropServices.FILETIME lpUserTime);
public static DateTime FiletimeToDateTime(System.Runtime.InteropServices.FILETIME fileTime)
public static TimeSpan FiletimeToTimeSpan(System.Runtime.InteropServices.FILETIME fileTime) 36: GetProductInfo Here's something that worked for me, the 0,0 for the service pack is what they used at MSN...
using System.Runtime.InteropServices; 37: GetShortPathName
Imports System.Runtime.InteropServices
<MarshalAs(Runtime.InteropServices.UnmanagedType.U4)> ByVal bufferSize As Integer) As Integer
<Runtime.InteropServices.DllImport("kernel32.dll", SetLastError:=True, CharSet:=Runtime.InteropServices.CharSet.Auto)> _
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPTStr)> _
<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.U4)> _
using System.Runtime.InteropServices;
using System.Runtime.InteropServices; // Necessary!
using System.Runtime.InteropServices; using FILETIME=System.Runtime.InteropServices.ComTypes.FILETIME; 41: GetTempFileName
throw new Exception("Win32 Error: " + System.Runtime.InteropServices.Marshal.GetLastWin32Error());
Imports System.Runtime.InteropServices
Imports System.Runtime.InteropServices
Imports System.Runtime.InteropServices
Imports System.Runtime.InteropServices 44: LoadLibrary
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
using System.Runtime.InteropServices; 45: LoadLibraryEx
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
using System.Runtime.InteropServices; 46: LocalAlloc [System.Runtime.InteropServices.Marshal.AllocHGlobal] 47: LocalFree [System.Runtime.InteropServices.Marshal.FreeHGlobal] 48: lstrcat using System.Runtime.InteropServices; 49: MODULEENTRY32
[StructLayout(LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices
using System.Runtime.InteropServices;
private extern static void RegisterServiceProcess(long dwProcessId, long dwType);
Declare Function RegisterServiceProcess Lib "kernel32.dll" (TODO) As TODO Does Not work with XP and higher OS. "RegisterServiceProcess" is not part of Kernel32.dll
using System.Runtime.InteropServices; // for StructLayout 54: SetConsoleTitle using System.Runtime.InteropServices;
<System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError:=True)> _ 56: SetErrorMode using System.Runtime.InteropServices; //u need that for DLL IMPPORT 57: SetLocalTime
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices 58: SetPriorityClass
<Runtime.InteropServices.DllImport("kernel32.dll", CharSet:=Runtime.InteropServices.CharSet.Auto, CallingConvention:=Runtime.InteropServices.CallingConvention.StdCall)> _ 59: SetSystemTime
using System.Runtime.InteropServices; Be sure to include in the header: using System.Runtime.InteropServices; Cut off search results after 60. Please refine your search. |