Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

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

.

using System.Runtime.InteropServices;

.

  using System.Runtime.InteropServices;

.

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)]

.

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;

.

    <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)]

.

    using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

            throw new System.Runtime.InteropServices.ExternalException(" GetExitCodeProcess Error " + lastError, lastError);

.

[System.Runtime.InteropServices.Marshal.GetLastWin32Error]

.

using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

Imports System.Runtime.InteropServices

.

using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

Imports System.Runtime.InteropServices

.

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:

.

    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)

.

Here's something that worked for me, the 0,0 for the service pack is what they used at MSN...

.

using System.Runtime.InteropServices;

.

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;

.

      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

.

[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]

.

using System.Runtime.InteropServices;

.

[System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError = true)]

.

using System.Runtime.InteropServices;

.

[System.Runtime.InteropServices.Marshal.AllocHGlobal]

.

[System.Runtime.InteropServices.Marshal.FreeHGlobal]

.

using System.Runtime.InteropServices;

.

    [StructLayout(LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto)]

.

using System.Runtime.InteropServices;

.

Imports System.Runtime.InteropServices

.

    using System.Runtime.InteropServices;

.
Summary
The RegisterServiceProcess function registers or unregisters a service process. A service process continues to run after the user logs off.
.

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

.
Documentation
[RegisterServiceProcess] on MSDN
.

using System.Runtime.InteropServices;    // for StructLayout

.

using System.Runtime.InteropServices;

.

<System.Runtime.InteropServices.DllImport("kernel32.dll", SetLastError:=True)> _

.

using System.Runtime.InteropServices; //u need that for DLL IMPPORT

.

    using System.Runtime.InteropServices;

.

Imports System.Runtime.InteropServices

.

  <Runtime.InteropServices.DllImport("kernel32.dll", CharSet:=Runtime.InteropServices.CharSet.Auto, CallingConvention:=Runtime.InteropServices.CallingConvention.StdCall)> _

.

using System.Runtime.InteropServices;

.

Be sure to include in the header: using System.Runtime.InteropServices;

.

    using System.Runtime.InteropServices;

.

using System.Runtime.InteropServices;

.

Imports System.Runtime.InteropServices

.

using System.Runtime.InteropServices;

.

   public UInt16 wServicePackMajor;

.

   public UInt16 wServicePackMinor;

.

using System.Runtime.InteropServices;

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: