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
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy

Search Results for "as" in [All]

dtl

. .

[DllImport("dtl.dll", SetLastError=true)]

.

Declare Function DTL_C_DEFINE Lib "dtl.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

    /// Class dtl has all the p/invoke routines and

.

    public static class Dtl

.

    /// Returns message associated dtl status

.

    /// <param name="driverId">driver id to assign to this driver</param>

.

    /// <param name="nameId">name id assigned to the tag</param>

.

    internal static class UnsafeNativeMethods

.

            case 5:

.

                case 2:

.

                case 3:

.

                _portId = string.Format("AB:ASA/L:{0:d}", _nodeAddress);

.

            case 500:

.

                case 2:

.

            case 5000:

.

                case 1:

.

                case 2:

.

        string msg = string.Format("{0}", "Data file size passed is too large");

. .

[DllImport("dtl.dll", SetLastError=true)]

.

Declare Function DTL_DRIVER_CLOSE Lib "dtl.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

    /// Class dtl has all the p/invoke routines and

.

    public static class Dtl

.

    /// Returns message associated dtl status

.

    /// <param name="driverId">driver id to assign to this driver</param>

.

    /// <param name="nameId">name id assigned to the tag</param>

.

    internal static class UnsafeNativeMethods

. .

[DllImport("dtl.dll", SetLastError=true)]

.

Declare Function DTL_DRIVER_OPEN Lib "dtl.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

    /// Class dtl has all the p/invoke routines and

.

    public static class Dtl

.

    /// Returns message associated dtl status

.

    /// <param name="driverId">driver id to assign to this driver</param>

.

    /// <param name="nameId">name id assigned to the tag</param>

.

    internal static class UnsafeNativeMethods

. .

[DllImport("dtl.dll", SetLastError=true)]

.

Declare Function DTL_ERROR_S Lib "dtl.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

    /// Class dtl has all the p/invoke routines and

.

    public static class Dtl

.

    /// Returns message associated dtl status

.

    /// <param name="driverId">driver id to assign to this driver</param>

.

    /// <param name="nameId">name id assigned to the tag</param>

.

    internal static class UnsafeNativeMethods

. .

[DllImport("dtl.dll", SetLastError=true)]

.

Declare Function DTL_INIT Lib "dtl.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

    /// Class dtl has all the p/invoke routines and

.

    public static class Dtl

.

    /// Returns message associated dtl status

.

    /// <param name="driverId">driver id to assign to this driver</param>

.

    /// <param name="nameId">name id assigned to the tag</param>

.

    internal static class UnsafeNativeMethods

. .

[DllImport("dtl.dll", SetLastError=true)]

.

Declare Function DTL_READ_W Lib "dtl.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

    /// Class dtl has all the p/invoke routines and

.

    public static class Dtl

.

    /// Returns message associated dtl status

.

    /// <param name="driverId">driver id to assign to this driver</param>

.

    /// <param name="nameId">name id assigned to the tag</param>

.

    internal static class UnsafeNativeMethods

.

        msg = string.Format("{0}", "Dtl data file has not been defined");

. .

[DllImport("dtl.dll", SetLastError=true)]

.

Declare Function DTL_UNDEF Lib "dtl.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

    /// Class dtl has all the p/invoke routines and

.

    public static class Dtl

.

    /// Returns message associated dtl status

.

    /// <param name="driverId">driver id to assign to this driver</param>

.

    /// <param name="nameId">name id assigned to the tag</param>

.

    internal static class UnsafeNativeMethods

. .

[DllImport("dtl.dll", SetLastError=true)]

.

Declare Function DTL_UNINIT Lib "dtl.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

    /// Class dtl has all the p/invoke routines and

.

    public static class Dtl

.

    /// Returns message associated dtl status

.

    /// <param name="driverId">driver id to assign to this driver</param>

.

    /// <param name="nameId">name id assigned to the tag</param>

.

    internal static class UnsafeNativeMethods

. .

[DllImport("dtl.dll", SetLastError=true)]

.

Declare Function DTL_VERSION Lib "dtl.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

. .

[DllImport("dtl.dll", SetLastError=true)]

.

Declare Function DTL_WRITE_W Lib "dtl.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

    /// Class dtl has all the p/invoke routines and

.

    public static class Dtl

.

    /// Returns message associated dtl status

.

    /// <param name="driverId">driver id to assign to this driver</param>

.

    /// <param name="nameId">name id assigned to the tag</param>

.

    internal static class UnsafeNativeMethods

.

        bool currentDataWasRead = false;

.

                currentDataWasRead = true;

.

            if (currentDataWasRead)

.

            if (_disableChangeMask)

.

                writeNeeded = MoveWithMask(_rawData, _changeMask, ref currentData );

.

            Array.Clear(_changeMask, 0, _changeMask.Length);

.

        msg = string.Format("{0}", "Dtl data file has not been defined");

.
Import
credui,advapi32,gdi32,kernel32,ole32,shell32,user32,glossary,coredll,rasapi32,mpr,netapi32,uxtheme,avifil32,aygshell,winscard,crypt32,secur32,wtsapi32,shlwapi,winspool,oleacc,rapi,oleaut32,winfax,odbc32,msi,cards,powrprof,urlmon,Constants,Delegates,Enums,Interfaces,Structures

fltlib

. .

[DllImport("fltlib.dll", SetLastError = true, CharSet = CharSet.Unicode)]

.

static extern uint FilterLoad([MarshalAs(UnmanagedType.LPWStr)]string strDriverName);

.

Declare Function FilterLoad Lib "fltlib.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Consider using RtlAdjustPrivilege() to adjust privileges, much easier than getting AdjustTokenPrivileges() to work

.

Please add some!

mscorsn

. .
Summary
Reads permission requests from an assembly manifest.
.

Console.WriteLine("assembly RequestMinimum: {0}", requestMinimum);

.

See Shawn Farkas' blog entry at http://blogs.msdn.com/shawnfa/archive/2004/02/24/79598.aspx for sample code to convert the XML string into a SecurityElement, for use by PermissionSet.FromXml.

. .
Summary
.

///     Return the last error

.

/// <returns>error information for the last strong name call</returns>

.

This function is exported from mscorsn.dll in v1.0 and v1.1 of the .NET framework, but it will be moved to mscorwks.dll in v2.0. There is a shim in mscoree.dll which will redirect to the appropriate implementation dll, which has the same name.

.

See the sample on Shawn Farkas' blog for a complete sample of using this API: http://blogs.msdn.com/shawnfa/archive/2004/07/09/178902.aspx

. .

This function is exported from mscorsn.dll in v1.0 and v1.1 of the .NET framework, but it will be moved to mscorwks.dll in v2.0. There is a shim in mscoree.dll which will redirect to the appropriate implementation dll, which has the same name.

.

See the sample on Shawn Farkas' blog for a complete sample of using this API: http://blogs.msdn.com/shawnfa/archive/2004/07/09/178902.aspx

. .

/// <returns>true if the key was generated, false if there was an error</returns>

.

extern static bool StrongNameKeyGenEx([MarshalAs(UnmanagedType.LPWStr)] string

.

This strong name API has been moved to mscoree.dll for Whidbey. It is not available in the v1.0 or v1.1 versions of the framework.

.

For a sample of generating a key, and some more documentation on this function, see Shawn Farkas' blog: http://blogs.msdn.com/shawnfa/archive/2004/07/09/178902.aspx

. .

/// <returns>true if the key was generated, false if there was an error</returns>

.

public extern static bool StrongNameKeyGenEx([MarshalAs(UnmanagedType.LPWStr)]string wszKeyContainer, StrongNameKeyGenFlags dwFlags, int dwKeySize, Out IntPtr ppbKeyBlob, Out long pcbKeyBlob);

.

This strong name API has been moved to mscoree.dll for Whidbey. It is not available in the v1.0 or v1.1 versions of the framework.

.

For a sample of generating a key, and some more documentation on this function, see Shawn Farkas' blog: http://blogs.msdn.com/shawnfa/archive/2004/07/09/178902.aspx

. .

static extern bool StrongNameSignatureVerificationFromImage(byte[] pbBase, int dwLength, StrongNameInFlags dwInFlags, [Out]out StrongNameOutFlags pdwOutFlags);

.

This function is exported from mscorsn.dll in v1.0 and v1.1 of the .NET framework, but it will be moved to mscorwks.dll in v2.0. There is a shim in mscoree.dll which will redirect to the appropriate implementation dll, which has the same name.

.

Please add some!

.

Please add some!

. .

    [DllImport("mscorsn.dll", SetLastError = true)]

.

    [return: MarshalAs(UnmanagedType.U1)]

.

         [MarshalAs(UnmanagedType.LPWStr)]string wszFilePath,

.

         [MarshalAs(UnmanagedType.U1)]bool fForceVerification,

.

         [MarshalAs(UnmanagedType.U1)]ref bool pfWasVerified);

.

This function is exported from mscorsn.dll in v1.0 and v1.1 of the .NET framework, but it will be moved to mscorwks.dll in v2.0. There is a shim in mscoree.dll which will redirect to the appropriate implementation dll, which has the same name.

.

The fForceVerification / pfWasVerified parameters can be confusion. A good blog entry to read, which explains how these work can be found here: http://blogs.msdn.com/shawnfa/archive/2004/06/07/150378.aspx

.

See the supporting function below for the code to the CheckToken() function - it verifies that an assembly contains the correct token data.

.

bool verified = StrongNameSignatureVerificationEx(assembly, false, ref notForced);

.

// check to see if it is a Microsoft assembly

.

bool isMsAsm = CheckToken(assembly, msClrToken) || CheckToken(assembly, msFxToken);

.

if(isMsAsm && verified && notForced)

.

    Console.WriteLine("Microsoft signed assembly");

.

else if(isMsAsm && verified && !notForced)

.

    Console.WriteLine("Microsoft delay signed assembly");

.

else if(isMsAsm && !verified)

.

    Console.WriteLine("Microsoft assembly, modified since signing");

.

    Console.WriteLine("Not a Microsoft assembly");

.

    /// Check an assembly to see if it has the given public key token

.

    /// Does not check to make sure the assembly's signature is valid.

.

    /// Loads the assembly in the LoadFrom context.

.

    /// <param name='assembly'>Path to the assembly to check</param>

.

    /// <exception cref='System.ArgumentNullException'>If assembly or expectedToken are null</exception>

.

    /// <returns>true if the assembly was signed with a key that has this token, false otherwise</returns>

.

    public static bool CheckToken(string assembly, byte[] expectedToken)

.

        if (assembly == null)

.

        throw new ArgumentNullException("assembly");

.

        // Get the public key token of the given assembly

.

        Assembly asm = Assembly.LoadFrom(assembly);

.

        byte[] asmToken = asm.GetName().GetPublicKeyToken();

.

        if (asmToken.Length != expectedToken.Length)

.

        for (int i = 0; i < asmToken.Length; i++)

.

            if (asmToken[i] != expectedToken[i])

.

        // couldn't find the assembly

. .

static extern bool StrongNameSignatureVerificationFromImage(byte[] pbBase, int dwLength, StrongNameInFlags dwInFlags, Out StrongNameOutFlags pdwOutFlags);

.

Do you know one? Please contribute it!

.

Please add some!

.

Please add some!

.
Import
credui,advapi32,gdi32,kernel32,ole32,shell32,user32,glossary,coredll,rasapi32,mpr,netapi32,uxtheme,avifil32,aygshell,winscard,crypt32,secur32,wtsapi32,shlwapi,winspool,oleacc,rapi,oleaut32,winfax,odbc32,msi,cards,powrprof,urlmon,xolehlp,twain_32,winmm,wininet,comdlg32,imm32,ntdsapi,odbccp32,Constants,Delegates,Enums,Interfaces,Structures

urlmon

. .

[DllImport("urlmon.dll", SetLastError=true)]

.

Declare Function cointernetsetfactureenabled Lib "urlmon.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

Please add some!

. .

[return:MarshalAs(UnmanagedType.Error)]

.

     [MarshalAs(UnmanagedType.U4)] int dwFlags,

.

    ByVal FeatureEntry As INTERNETFEATURELIST, ByVal dwFlags As Long, _

.

    ByVal fEnable As Long) As Long

.

Do you know one? Please contribute it!

.

The SET_FEATURE_* values are not defined as an enum in urlmon.h, so I kept them as constants.

.

The return value from CoInternetSetFeatureEnabled should be passed to the static ThrowExceptionForHR method on the Marshal class as well, in case a fail code is returned (or better yet, a wrapper can be created to this method).

.

Please add some!

.

Please add some!

. .

[DllImport("kernel32.dll", EntryPoint = "CopyMemory", SetLastError = false)]

.

Public Declare Auto Sub CopyMemory lib "kernel32.dll" Alias "CopyMemory"(destination As IntPtr, source As IntPtr, length As UInteger)

.

<DllImport("kernel32.dll", SetLastError:= True, EntryPoint:= "CopyMemory")>

.

Public Shared Sub CopyMemory(destination As IntPtr, source As IntPtr, length As UInteger)

.

Do you know one? Please contribute it!

.

Please add some!

.

     [DllImport("kernel32.dll", SetLastError=true, EntryPoint="CopyMemory")

.

     Console.WriteLine("Is assuming equals : {0}", BitConverter.ToInt32(dst, 0) == data[0] &&

.

      Public Declare Auto Sub CopyMemory lib "kernel32.dll" Alias "CopyMemory"(destination As IntPtr, source As IntPtr, length As UInteger)

.

      Public Sub Main(ParamArray args As String())

.

    Dim source As Byte() = File.ReadAllBytes("C:\Windows\explorer.exe"),

.

        destination(source.GetUpperBound(0)) As Byte,

.

        length As UInteger = CUInt(source.Length),

.

        sourcePtr As IntPtr = Marshal.UnsafeAddrOfPinnedArrayElement(source, 0),

.

        targetPtr As IntPtr = Marshal.UnsafeAddrOfPinnedArrayElement(target, 0)

.

    Dim sw As Stopwatch = Stopwatch.StartNew()

.

      Dim sourceChecksum = sha.ComputeHash(source),

.

          destinationCheksum = sha.ComputeHash(destination),

.

    Erase source, destination

. .

        [MarshalAs(UnmanagedType.LPWStr)] string sURI,

.

        [MarshalAs(UnmanagedType.U4)] CreateUriFlags dwFlags,

.

        [MarshalAs(UnmanagedType.IUnknown)]

.

Declare Function CreateUri Lib "urlmon.dll" (TODO) As TODO

.

Do you know one? Please contribute it!

.

Please add some!

.

Please add some!

. .

    [DllImport("urlmon.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = false)]

.

          [MarshalAs(UnmanagedType.LPWStr)] string pwzUrl,

.

         [MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.I1, SizeParamIndex=3)]

.

             [MarshalAs(UnmanagedType.LPWStr)]  string pwzMimeProposed,

.

VB.NET dwMimeFlags: (http://msdn.microsoft.com/en-us/library/ie/ms775107(v=vs.85).aspx)

.

<Flags()> Public Enum MIMEFlags As UInteger

.

    ''' <summary>Treat the specified pwzUrl as a file name. </summary>

.

    URLAsFileName = &H1

.

        ByVal pBC As IntPtr, _

.

        <MarshalAs(UnmanagedType.LPWStr)> _

.

        ByVal pwzUrl As String, _

.

        <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.I1, SizeParamIndex:=3)> ByVal _

.

        pBuffer As Byte(), _

.

        ByVal cbSize As Integer, _

.

        <MarshalAs(UnmanagedType.LPWStr)> _

.

        ByVal pwzMimeProposed As String, _

.

        ByVal dwMimeFlags As Integer, _

.

        <MarshalAs(UnmanagedType.LPWStr)> _

.

        ByRef ppwzMimeOut As String, _

.

        ByVal dwReserved As Integer) As Integer

.

        ByVal pbc As Long, _

.

        ByVal pwzUrl As String, _

.

        pBuffer As Any, _

.

        cbSize As Long, _

.

        ByVal pwzMimeProposed As String, _

.

        dwMimeFlags As Long, _

.

        ppwzMimeOut As Long, _

.

        dwReserved As Long) As Long

.

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)

.

Public Declare Function lstrlenW Lib "kernel32.dll" (ByVal lpString As Long) As Long

.

    Private Function PtrToString(lpwString As Long) As String

.

        Dim Buffer() As Byte

.

        Dim nLen As Long

.

            ReDim Buffer(0 To (nLen - 1)) As Byte

.
  • Use Marshal.StringToCoTaskMemUni() to prepare input parameters (IntPtr) declared to receive strings.
.

     //suggestPtr = Marshal.StringToCoTaskMemUni(mimeProposed); // for your experiments ;-)

.

     Marshal.FreeCoTaskMem(outPtr); //msdn docs wrongly states that operator 'delete' must be used. Do not remove FreeCoTaskMem

.

Trace.Write("MimeType is " + MimeTypeFrom(Encoding.ASCII.GetBytes("%PDF-"), "text/plain"));

.

Do you know one? Please contribute it!

.

        Marshal.FreeCoTaskMem(mimeout);

.

    Public Shared Function getMimeFromFile(ByVal file As String) As String

.

    Dim mimeout As IntPtr

.

    Dim MaxContent As Integer = CInt(New FileInfo(file).Length)

.

    Dim fs As New FileStream(file, FileMode.Open)

.

    Dim buf(MaxContent) As Byte

.

    Dim result As Integer = FindMimeFromData(IntPtr.Zero, file, buf, MaxContent, Nothing, 0, mimeout, 0)

.

    Dim mime As String = Marshal.PtrToStringUni(mimeout)

.

    Marshal.FreeCoTaskMem(mimeout)

.

    ''' The second to last parameter errors out if its data type is set to string.

.

    ByVal pBC As IntPtr,

.

    <MarshalAs(UnmanagedType.LPWStr)> ByVal pwzUrl As String,

.

    <MarshalAs(UnmanagedType.LPArray, ArraySubType:=UnmanagedType.I1, SizeParamIndex:=3)> ByVal pBuffer As Byte(),