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 "32" in [All]

psapi

.

Public Declare Function EmptyWorkingSet Lib "psapi.dll" (hwProc As IntPtr) As Int32

.

            ReDim MemEater(&O141231232)

.

    [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4)] [In][Out] UInt32[] ddAddresses,

.

    UInt32 arraySizeBytes,

.

    [MarshalAs(UnmanagedType.U4)] out UInt32 bytesNeeded

.

The signature above only works on 32-bit machines. Here's a stab at something that works on x86 as well as x864.

.

    UInt32 arraySizeBytes,

.

    [MarshalAs(UnmanagedType.U4)] out UInt32 bytesNeeded

.

            [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4)] [In][Out] UInt32[] ddAddresses,

.

            UInt32 arraySizeBytes,

.

            [MarshalAs(UnmanagedType.U4)] out UInt32 bytesNeeded

.

            UInt32 ddAddress,

.

            UInt32 arraySize;

.

            UInt32 arraySizeBytes;

.

            UInt32[] ddAddresses;

.

            UInt32 bytesNeeded;

.

            ddAddresses = new UInt32[arraySize];

.

   [MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.U4)] [In][Out] UInt32[] processIds,

.

   UInt32 arraySizeBytes,

.

   [MarshalAs(UnmanagedType.U4)] out UInt32 bytesCopied

.

         [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4)] [In][Out] UInt32[] processIds,

.

           UInt32 arraySizeBytes,

.

           [MarshalAs(UnmanagedType.U4)] out UInt32 bytesCopied);

.

         UInt32 arraySize = 120;

.

         UInt32 arrayBytesSize = arraySize * sizeof(UInt32);

.

         UInt32[] processIds = new UInt32[arraySize];

.

         UInt32 bytesCopied;

.

         UInt32 numIdsCopied = bytesCopied >> 2; ;

.

         UInt32 partialDwordBytes = bytesCopied & 3;

.

         for (UInt32 index = 0; index < numIdsCopied; index++)

.

            Int32 uiTotalNumberofModules = (Int32)(cbNeeded / (Marshal.SizeOf(typeof(IntPtr))));

.

    UInt32 ddAddress,

.

            [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4)] [In][Out] UInt32[] ddAddresses,

.

            UInt32 arraySizeBytes,

.

            [MarshalAs(UnmanagedType.U4)] out UInt32 bytesNeeded

.

            UInt32 ddAddress,

.

            UInt32 arraySize;

.

            UInt32 arraySizeBytes;

.

            UInt32[] ddAddresses;

.

            UInt32 bytesNeeded;

.

            ddAddresses = new UInt32[arraySize];

.

            Int32 uiTotalNumberofModules = (Int32)(cbNeeded / (Marshal.SizeOf(typeof(IntPtr))));

.

    /// <returns>True if the function call was successful, false otherwise.  Check <see cref="Marshal.GetLastWin32Error"/>

.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms683210%28v=vs.85%29.aspx (GetPerformanceInfo)

.

From MSDN: The GetProcessImageFileName function returns the path in device form, rather than drive letters. For example, the file name C:\Winnt\System32\Ctype.nls would look as follows in device form:

.

\Device\Harddisk0\Partition1\WINNT\System32\Ctype.nls

.

//simpler, but 32 bit only

.

   [DllImport("kernel32.dll")]

.

      Marshal.GetLastWin32Error());

.
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

netapi32

18: !!!!
19: !!!
20: !!
21: !
.

[DllImport("netapi32.dll", CharSet=CharSet.Auto)]

.

Declare Function DsAddressToSiteNames Lib "netapi32.dll" (TODO) As TODO

.

           throw new Win32Exception(result);

.

            throw new Win32Exception(result);

.

[DllImport("Netapi32.dll", CallingConvention=CallingConvention.Winapi, SetLastError=true, CharSet=CharSet.Auto)]

.

Declare Function DsEnumerateDomainTrusts Lib "netapi32.dll" (TODO) As TODO

.

     [DllImport("Netapi32.dll", CallingConvention=CallingConvention.Winapi, SetLastError=true, CharSet=CharSet.Auto)]

.

     [DllImport("Netapi32.dll",EntryPoint="NetApiBufferFree")]

.

[DllImport("Netapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

Declare Function DsGetDcClose Lib "netapi32.dll" (TODO) As TODO

.

[DllImport("Netapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]

.

Declare Function DsGetDcName Lib "netapi32.dll" (TODO) As TODO

.

[DllImport("Netapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]        

.

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

.

     throw new Win32Exception(val);

.

using DWORD = System.UInt32;

.

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

.

[DllImport("Netapi32.dll", EntryPoint = "DsGetDcNextW", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]

.

Declare Function DsGetDcNext Lib "netapi32.dll" (TODO) As TODO

.

         throw new Win32Exception(); //internally calls GetLastWin32Error()

.

     if (!Win32.IsNullHandle(pDnsHostName)) //pNnsHostName != IntPtr.Zero;

.

using DWORD = System.UInt32;

.

[DllImport(Netapi32, CharSet=CharSet.Auto, SetLastError=true)]

.

[DllImport("Netapi32.dll", EntryPoint = "DsGetDcOpenW", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]

.

Declare Function DsGetDcOpen Lib "netapi32.dll" (TODO) As TODO

.

[DllImport("NetApi32.dll", CharSet=CharSet.Auto, SetLastError=true)]

.

internal static extern System.Int32 DsGetDcSiteCoverage(

.

[DllImport("NetApi32.dll", CharSet=CharSet.Auto, SetLastError=true)]

.

static extern UInt32 DsGetSiteName([MarshalAs(UnmanagedType.LPTStr)]string ComputerName, out IntPtr SiteNameBuffer);

.

    <DllImport("NetApi32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _

.

    <Out()> ByRef SiteNameBuffer As IntPtr) As UInt32

.

UInt32 result = DsGetSiteName(ComputerName, out pBuffer);

.

    Dim result As UInt32 = DsGetSiteName("MEASUS", pBuffer)

.

[DllImport("netapi32.dll")]

.

Declare Function DsRoleFreeMemory Lib "netapi32.dll" (TODO) As TODO

.

    /// <returns>Win32 error code.</returns>

.

    [DllImport("netapi32.dll", CharSet = CharSet.Unicode)]

.

Declare Function DsRoleGetPrimaryDomainInformation Lib "netapi32.dll" (TODO) As TODO

.

    /// <exception cref="Win32Exception">Thrown when the domain information cannot be retrieved.</exception>

.

    /// <exception cref="Win32Exception">Thrown when the domain information cannot be retrieved.</exception>

.

    /// <exception cref="Win32Exception">Thrown when the domain information cannot be retrieved.</exception>

.

    /// <exception cref="Win32Exception">Thrown when the domain information cannot be retrieved.</exception>

.

    /// <exception cref="Win32Exception">Thrown when the domain information cannot be retrieved.</exception>

.

    /// <exception cref="Win32Exception">Thrown when the domain information cannot be retrieved.</exception>

.

    /// <exception cref="Win32Exception">Thrown when the domain information cannot be retrieved.</exception>

.

        int lastWin32Error = DsRoleGetPrimaryDomainInformation(server, infoLevel, out buffer);

.

        if (lastWin32Error != 0)

.

            throw new Win32Exception(lastWin32Error);

.

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

.

Declare Function LsaQueryInformationPolicy Lib "Advapi32.dll" (ByVal PolicyHandle As IntPtr, ByVal InformationClass As UInteger, ByRef Buffer As IntPtr) As UInteger

.

        err = Marshal.GetLastWin32Error();

.

            err = Marshal.GetLastWin32Error();

.

         public Int32 MaximumAuditEventCount;

.

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

.

Declare Function NetApiBufferAllocate Lib "netapi32.dll" (TODO) As TODO

.

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

.

Declare Unicode Function NetApiBufferFree Lib "netapi32.dll" _

.

[DllImport("Netapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]

.

Declare Function NetDfsAdd Lib "NETAPI32.DLL" (ByVal DfsEntryPath As String, ByVal ServerName As String, ByVal ShareName As String, ByVal Comment As String, ByVal Flags As Long) As Long

.

Declare Function NetDfsAdd Lib "NETAPI32.DLL" (<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal DfsEntryPath As String, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal ServerName As String, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal ShareName As String, <Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> ByVal Comment As String, ByVal Flags As Uint32) As Long

.

I had a mapping error using the flag as a long. A DWORD is a unsigned 32 bit int. I modified this to match.

.

    [DllImport("Netapi32.dll", CharSet = CharSet.Auto/*, SetLastError=true //Return value (NET_API_STATUS) contains error */)]

.

    <DllImport("Netapi32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _

.

        Dim State As UInt32

.

        Dim NumberOfStorages As UInt32

.

    UInt32 State;

.

    UInt32 NumberOfStorages;

.

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

.

Declare Function NetDfsGetClientInfo  Lib "netapi32.dll" (TODO) As TODO

.

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

.

Declare Function NetDfsGetClientInfo Lib "netapi32.dll" (TODO) As TODO

.

[DllImport("Netapi32.dll", CharSet=CharSet.Unicode/*, SetLastError=true //Return value (NET_API_STATUS) contains error */)]

.

<DllImport("Netapi32.dll", CharSet:=CharSet.Unicode, SetLastError:=True)> _

.

    Dim State As UInt32

.

    Dim NumberOfStorages As UInt32

.

    Dim state As Int32

.

Declare Unicode Function NetDfsGetInfo Lib "NETAPI32.DLL" (ByVal DfsEntryPath As String, ByVal ServerName As String, ByVal ShareName As String, ByVal Level As Integer, ByRef Buffer As IntPtr) As Integer

.

    Public State As Int32

.

    Public NumberOfStorages As Int32

.

    Public storage As Int32

.

    /// <param name="Path">The current Win32 path for a Dfs link. The link path should include the Dfs root; for example, '\\MyServer\public\old\link'. </param>

.

    /// <param name="NewPath">The new Win32 path for a Dfs link. The link path should include the Dfs root; for example, '\\MyServer\public\new\link'. </param>

.

    [DllImport("Netapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

    '/ <param name="Path">The current Win32 path for a Dfs link. The link path should include the Dfs root; for example, '\\MyServer\public\old\link'. </param>

.

    '/ <param name="NewPath">The new Win32 path for a Dfs link. The link path should include the Dfs root; for example, '\\MyServer\public\new\link'. </param>

.

    <DllImport("Netapi32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _

.

    [DllImport("Netapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

    Declare Function NetDfsRemove Lib "NETAPI32.DLL" (<Runtime.InteropServices.MarshalAs(Runtime.InteropServices.UnmanagedType.LPWStr)> _

.

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

.

Declare Function NetDfsSetInfo Lib "netapi32.dll" (TODO) As TODO

.

                throw new Win32Exception(result);

.

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

.

Declare Unicode Function NetFileClose Lib "netapi32.dll"  _

.

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

.

Declare Unicode Function NetFileEnum Lib "netapi32.dll" ( _

.

        IntPtr iPtr = new IntPtr(pBuffer.ToInt32() + (dwIndex * Marshal.SizeOf(pCurrent)));            

.

        iPtr = New IntPtr(pBuffer.ToInt32 + (dwIndex * Marshal.SizeOf(pCurrent)))

.

[DllImport("Netapi32.dll")]

.

[DllImport("Netapi32.dll", CharSet=CharSet.Unicode)]

.

  <DllImport("Netapi32.dll")> _

.

  <DllImport("Netapi32.dll", CharSet:=CharSet.Unicode)> _

.

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

.

Private Declare Unicode Function NetGetJoinInformation Lib "Netapi32.dll" ( _

.

// Win32 Result Code Constant

.

[DllImport("Netapi32.dll")]

.

    Private Declare Unicode Function NetGetJoinInformation Lib "Netapi32.dll" ( _

.

    Private Declare Function NetApiBufferFree Lib "Netapi32.dll" _

.

[DllImport("NetApi32.dll", CharSet=CharSet.Auto, SetLastError=true)]

.

    private static extern Int32 NetGroupAdd(

.

    UInt32 level,    //info level

.

    out Int32 parm_err     //Parameter error index

.

Public Declare Function NetGroupAdd Lib "netapi32.dll" (ServerName As Any ByVal level As Long, Buffer As GroupInfo1, ParmError As Long) As Long

.

[DllImport("netapi32.dll", CharSet=CharSet.Unicode)]

.

Declare Unicode Function NetJoinDomain Lib "Netapi32.dll" _

.

    [DllImport("netapi32.dll", CharSet = CharSet.Unicode)]

.

        [DllImport("Netapi32.dll")]

.

Declare Function NetlGroupEnum Lib "netapi32.dll" (TODO) As TODO

.

[DllImport("NetApi32.dll", CharSet=CharSet.Auto, SetLastError=true)]

.

private static extern Int32 NetLocalGroupAddMembers(

.

    UInt32 level, //info level

.

    UInt32 totalentries //number of entries

.

Declare Function NetLocalGroupAddMembers Lib "netapi32.dll" (TODO) As TODO

.

    [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

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

.

    private static class Win32ErrorCodes

.

        byte[] baSid = new byte[] { 1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2 };

.

            if (result == Win32ErrorCodes.NERR_Success || result == Win32ErrorCodes.MemberInAlias)

.

            throw new Win32Exception(result);

.

    [DllImport("NetApi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

    static extern Int32 NetLocalGroupDelMembers(

.

        UInt32 level,

.

        UInt32 totalentries

.

Declare Function NetLocalGroupDelMembers Lib "netapi32.dll" (TODO) As TODO

.

        [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

        internal static class Win32ErrorCodes

.

            byte[] baSid = new byte[] { 1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2 };

.

                if (result == Win32ErrorCodes.NERR_Success || result == Win32ErrorCodes.MemberNotInAlias)

.

                throw new Win32Exception(result);

.

    [DllImport("NetApi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

    static extern Int32 NetLocalGroupDelMembers(

.

        UInt32 level,

.

        UInt32 totalentries

.

Declare Function NetLocalGroupDelMembers Lib "netapi32.dll" (TODO) As TODO

.

        [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]

.

            byte[] baSid = new byte[] { 1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2 };

.

[DllImport("Netapi32.dll")]

.

Declare Function NetLocalGroupEnum Lib "netapi32.dll" (TODO) As TODO

.

        [DllImport("Netapi32.dll")]

.

        [DllImport("Netapi32.dll")]

.

        [DllImport("NetAPI32.dll", CharSet=CharSet.Unicode)]

.

Declare Function NetLocalGroupGetMembers Lib "netapi32.dll" (TODO) As TODO

.

[DllImport("netapi32.dll")]

.

    Public Declare Function NetMessageBufferSend Lib "netapi32.dll" _

.

    [DllImport("netapi32.dll")]

.

    [DllImport("Netapi32.dll")]

.

    Declare Function NetQueryDisplayInformation Lib "Netapi32.dll"

.

    Declare Function NetQueryDisplayInformation Lib "Netapi32.dll" _

.

    [DllImport( "advapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]

.

    [DllImport("Netapi32.dll")]    static extern int NetQueryDisplayInformation([MarshalAs(UnmanagedType.LPWStr)] string serverName,

.

    [DllImport("netapi32.dll", CharSet=CharSet.Auto, SetLastError=true)] private static extern int NetApiBufferFree (System.IntPtr pBuffer);

.

    [DllImport("Netapi32.dll", EntryPoint = "NetRemoteComputerSupports", CharSet = CharSet.Unicode)]

.

    private static extern  Int32 NetRemoteComputerSupports(String uncServerName, NetSupportOption optionsWanted,ref NetSupportOption optionsSupported);

.

Declare Unicode Function NetRemoteComputerSupports Lib "Netapi32.dll" ( _

.

     Local = 32

.

    Local = 32,

.

    [DllImport("Netapi32.dll", EntryPoint = "NetRemoteComputerSupports", CharSet = CharSet.Unicode)]

.

    private static extern  Int32 NetRemoteComputerSupports(String uncServerName, NetSupportOption optionsWanted,ref NetSupportOption optionsSupported);

.

[DllImport("Netapi32.dll", CharSet=CharSet.Unicode)]

.

     <DllImport("netapi32", CharSet:=CharSet.Unicode)> Function NetRemoteTOD( _

.

        [DllImport( "netapi32.dll" , EntryPoint="NetRemoteTOD",  SetLastError=true,

.

        [DllImport( "netapi32.dll")] private static extern void NetApiBufferFree(IntPtr bufptr);

.

            if ( pintError > 0 ) { throw new System.ComponentModel.Win32Exception ( pintError ); }

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


 
Access PInvoke.net directly from VS: