Desktop Functions: Smart Device Functions:
|
Search Results for "Service" in [All]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 4: CreateEvent
using System.Runtime.InteropServices;
using System.Runtime.InteropServices; 6: 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.
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)] 10: 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; 15: 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)] 17: GetDateFormat
using System.Runtime.InteropServices; 18: GetDriveType
using System.Runtime.InteropServices;
throw new System.Runtime.InteropServices.ExternalException(" GetExitCodeProcess Error " + lastError, lastError); 20: GetLastError [System.Runtime.InteropServices.Marshal.GetLastWin32Error] 21: GetLocaleInfo using System.Runtime.InteropServices; 22: GetLocaleInfoEx using System.Runtime.InteropServices; 23: GetLocalTime
Imports System.Runtime.InteropServices 24: GetLogicalDrives
using System.Runtime.InteropServices;
using System.Runtime.InteropServices; 26: GetLongPathName
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices 29: 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: 30: 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) 31: 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; 32: 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; 36: 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 39: LoadLibrary
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
using System.Runtime.InteropServices; 40: LoadLibraryEx
[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]
using System.Runtime.InteropServices; 41: LocalAlloc [System.Runtime.InteropServices.Marshal.AllocHGlobal] 42: LocalFree [System.Runtime.InteropServices.Marshal.FreeHGlobal] 43: lstrcat using System.Runtime.InteropServices; 44: 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 49: SetConsoleTitle using System.Runtime.InteropServices;
<System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError:=True)> _ 51: SetErrorMode using System.Runtime.InteropServices; //u need that for DLL IMPPORT 52: SetLocalTime
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices 53: SetPriorityClass
<Runtime.InteropServices.DllImport("kernel32.dll", CharSet:=Runtime.InteropServices.CharSet.Auto, CallingConvention:=Runtime.InteropServices.CallingConvention.StdCall)> _ 54: SetSystemTime
using System.Runtime.InteropServices; Be sure to include in the header: using System.Runtime.InteropServices;
using System.Runtime.InteropServices; 57: SetVolumeLabel
using System.Runtime.InteropServices;
Imports System.Runtime.InteropServices 58: SuspendThread using System.Runtime.InteropServices;
public UInt16 wServicePackMajor;
public UInt16 wServicePackMinor; 60: WriteFileEx using System.Runtime.InteropServices; Cut off search results after 60. Please refine your search. |