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

netapi32

.

     DS_DOMAIN_DIRECT_OUTBOUND     = 0x0002,  // Domain is directly trusted

.

     DS_DOMAIN_DIRECT_INBOUND      = 0x0020   // Domain is directly trusting

.

     uint trustTypes = (uint)(DS_DOMAIN_TRUST_TYPE.DS_DOMAIN_PRIMARY | DS_DOMAIN_TRUST_TYPE.DS_DOMAIN_DIRECT_OUTBOUND);

.

     DS_DOMAIN_DIRECT_OUTBOUND     = 0x0002,  // Domain is directly trusted

.

     DS_DOMAIN_DIRECT_INBOUND      = 0x0020   // Domain is directly trusting

.

    DS_DIRECTORY_SERVICE_REQUIRED = 0x00000010,

.

    DS_DIRECTORY_SERVICE_PREFERRED = 0x00000020,

.

     DSGETDCNAME_FLAGS.DS_DIRECTORY_SERVICE_REQUIRED|

.

System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain()

.

    /// <summary>Retrieves state data for the computer, which includes the state of the directory service installation and domain data.</summary>

.

    /// <summary>The directory service is running on this computer.</summary>

.

    /// <summary>The directory service is running in mixed mode.</summary>

.

    /// <summary>The directory service is running as read-only on this computer.</summary>

.

    /// <summary>Gets state data for the computer, which includes the state of the directory service installation and domain data.</summary>

.

        Policies = new string[9, 2] { { "System", "" }, { "Logon", "" }, { "Object Access", "" }, { "Privilige Use", "" }, { "Detailed Tracking", "" }, { "Policy Change", "" }, { "Account Management", "" }, { "Directory Service Access", "" }, { "Account Logon", "" } };

.

        aObjectAttributes.RootDirectory = IntPtr.Zero;

.

[2014-02-27] The function does not set the last error value, the error is returned directly and is in NET_API_STATUS format /Stoyan Sabev/

.

[Stoyan Sabev] The function does not set the last error value, the error is returned directly and is NET_API_STATUS form

.

System.DirectoryServices.ActiveDirectory.Domain.GetComputerDomain();

.
ERROR_INVALID_PARAMETER
A parameter is incorrect.
.

Here's some sample code that can do this using System.DirectoryServices

.

        DirectoryEntry localDE = new DirectoryEntry(localDirEntryString);

.

        DirectoryEntry domainDE = new DirectoryEntry(domainDirEntryString);

.

        DirectoryEntry user = domainDE.Children.Find(userName, "user");

.

        DirectoryEntry group = localDE.Children.Find(groupName, "group");

.

        catch (DirectoryServicesCOMException e)

.

        /// of domain controllers, the Active Directory. Local group members can be users or global groups.

.

    ''' <remarks>If you call this function on a domain controller that is running Active Directory, access is allowed or denied based on

.
Summary
Queries the redirector to retrieve the optional features the remote system supports. Features include Unicode, Remote Procedure Call (RPC), and Remote Administration Protocol support.
.

    using System.DirectoryServices.ActiveDirectory;

.

    public string UserDirectoryPath;

.

        /// Parameter was incorrect.

.

        /// Unknown Directory.

.

        NERR_RedirectedPath = (NERR_BASE + 17)

.

    string path = @"C:\MyShareDirectory"; // do not append comma, it'll fail

.

I believe that all of these samples are slightly incorrect in that they do not deal with the case where NetShareEnum does not retrieve all of the shares on a server in a single call. The caller is supposed to check for ERROR_MORE_DATA and then do the appropriate thing. This may be an edge case not worrying about, but anyone writing code for big environments should validate the assumption that all shares will be fetched with a single call.

.

                Dim si As SHARE_INFO_1 = DirectCast(Marshal.PtrToStructure(pItem, t), SHARE_INFO_1)

.

                Dim si As SHARE_INFO_2 = DirectCast(Marshal.PtrToStructure(pItem, t), SHARE_INFO_2)

.

            Dim si As SHARE_INFO_1 = DirectCast(Marshal.PtrToStructure(pItem, t), SHARE_INFO_1)

.

            Dim si As SHARE_INFO_2 = DirectCast(Marshal.PtrToStructure(pItem, t), SHARE_INFO_2)

.

Corrected VB Signature 'ByVal Level As Long' --> 'ByVal Level as Integer', format tidy.

.

You can also use the WNetAddConnection2 and WNetAddConnection3 functions to redirect a local device to a network resource. Connections added by NetUseAdd are not shown in the Explorer. You should use one of the WNetAddConnection methods to make the networkdrive visible in the explorer.

.

using System.DirectoryServices; //System.DirectoryServices

.

        DirectoryEntry directoryEntry = new DirectoryEntry("WinNT://" + Environment.MachineName);

.

        foreach (DirectoryEntry child in directoryEntry.Children) {

.

        //LG_INCLUDE_INDIRECT=1

.

        //LG_INCLUDE_INDIRECT=1

.

* On Windows 8+ when users log in with a MicrosoftAccount the username is returned like "MicrosoftAccount\user.email@thedomain.com" rather than the ID. This means for example that it won't match their directory name in C:\Users.

.

Isn't this supposed to be under 'Directory' - 'Structures', rather than 'Desktop Functions:' - 'netapi32'?

kernel32

.

    public string lpAssemblyDirectory;

.

    private const uint ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID = 0x004;

.
  • Not sure how this interacts with console redirection, didn't try it... i suppose it will work fine but if it doesnt let me know
.
  • Not sure how this interacts with console redirection, didn't try it... i suppose it will work fine but if it doesnt let me know
.

// 11/21/2012 Correcting signature for GetConsoleScreenBufferInfoEx and cleaned up CONSOLE_SCREEN_BUFFER_INFO_EX.ColorTable

.

        ref SMALL_RECT lpReadRegion

.

       [In] ref SMALL_RECT lpScrollRectangle,

.

        IntPtr lpClipRectangle,

.

        [In] ref SMALL_RECT lpConsoleWindow

.

        ref SMALL_RECT lpWriteRegion

.

    public struct SMALL_RECT

.

        public SMALL_RECT srWindow;

.

        public SMALL_RECT srWindow;

.

        SMALL_RECT Selection;

.

        const uint CONSOLE_SELECTION_NOT_EMPTY = 0x0002; //Selection rectangle is not empty

.
Summary
.

static extern bool CreateDirectoryEx(string lpTemplateDirectory,

.

   string lpNewDirectory, IntPtr lpSecurityAttributes);

.
Documentation
[CreateDirectoryEx] on MSDN
.

        Bidirectional = (int)(PIPE_ACCESS_INBOUND+PIPE_ACCESS_OUTBOUND)

.

        case ServerMode.Bidirectional:

.

        NamedPipeStream stream = NamedPipeStream.Create("testpipe", NamedPipeStream.ServerMode.Bidirectional);

.

   string lpCurrentDirectory,

.

    lpCurrentDirectory As String, _

.

0x1 The link target is a directory.

.

The unmanaged prototype contains a return directive because the CreateSymbolicLink API function returns BOOLEAN, a one-byte data type. The default marshaling for bool is four bytes (to allow seamless integration with BOOL return values). If you were to use the default marshaling for BOOLEAN values, it's likely that you will get erroneous results. The return directive forces PInvoke to marshal just one byte of the return value. Source: http://www.informit.com/guides/content.aspx?g=dotnet&seqNum=762&ns=16196

.

Try System.Threading.Thread.Start. It doesn't give you all the control of directly calling CreateThread, (such as specifing the flags), but it will get you a vanilla thread to spin up.

.

    InDirect    = 1,

.

    OutDirect    = 2,

.

    NetworkRedirector    = 0x00000028,

.

gave incorrect results due to signs.

.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/obtaining_directory_change_notifications.asp (dead link)

.
OBS
The correct VB signature is:
.

        if ((findData.dwFileAttributes & FileAttributes.Directory) != FileAttributes.Directory)

.

        if ((findData.dwFileAttributes & FileAttributes.Directory) != FileAttributes.Directory)

.

    //"CONIN$" will allow you to grab the input buffer regardless if it is being redirected.

.

    //0x00000001 - FILE_SHARE_READ - seems to be required to get the buffer correctly.

.

    //3 - OPEN_EXISTING - recommended by MSDN to get the buffer correctly

.

ThrowExceptionForHR is for HRESULT values returned directly from NT functions, is it not?

.

ThrowExceptionForHR is for HRESULT values returned directly from NT functions, is it not?

.

                #Attempts to get the binary type of all files in the current directory

.

                #Attempts to get the binary type of all exe files in the windows directory,

.

                #in the windows system32 directory by bypassing filesystem redirection using "sysnative",

.

                        #Put enum object directly into pipeline

.

The code below correctly obtains the compressed file size also if above 4GB. (Fixed VB and C# code, 2012 Eske Rahn)

.

        public SMALL_RECT srWindow;

.

        public SMALL_RECT srWindow;

.

        SMALL_RECT Selection;

.

        const uint CONSOLE_SELECTION_NOT_EMPTY = 0x0002; //Selection rectangle is not empty

.
Summary
.

static extern uint GetCurrentDirectory(uint nBufferLength,

.

* This sample uses: GetCurrentDirectoryW *

.

static extern uint GetCurrentDirectoryW(uint nBufferLength, StringBuilder lpBuffer);

.

uint folderNameLength = GetCurrentDirectory(MAX_DEEP_PATH, nameBuffer);

.

   Console.WriteLine("Failed to get initial working directory; error = '{0}'", lastError);

.

   Console.WriteLine("Failed to get initial working directory; allocated buffer is shorter than required: '{0}'<'{1}'", MAX_DEEP_PATH, folderNameLength);

.

Directory.GetCurrentDirectory

.
Documentation
[GetCurrentDirectory] on MSDN
.

   static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,

.

   static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,

.

/// <param name="folderName">Directory or unc folder name of the volume to

.

   static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,

.

   static extern bool GetDiskFreeSpaceEx(string lpDirectoryName,

.

/// <param name="folderName">Directory or unc folder name of the volume to

.

  /// <param name="lpRootPathName">A pointer to a null-terminated string that specifies the root directory and returns information about the disk.A trailing backslash is required. If this parameter is NULL, the function uses the root of the current directory.</param>

.

    internal static Int64 GetDirectoryId(string dir)

.

        GetFileInformationByHandleEx(handle, FILE_INFO_BY_HANDLE_CLASS.FileIdBothDirectoryInfo, out fileStruct, (uint)Marshal.SizeOf(fileStruct));

.

    internal static Int64 GetDirectoryId(string dir)

.

        GetFileInformationByHandleEx(handle, FILE_INFO_BY_HANDLE_CLASS.FileIdBothDirectoryInfo, out fileStruct, (uint)Marshal.SizeOf(fileStruct));

.

Calling GetLastError directly via PInvoke is not guaranteed to work due to the CLR's internal interaction with the operating system. Instead, call Marshal.GetLastWin32Error.

.

The file must exist to get the correct path. This is because the full path comes from the file system information. If an invalid name is given and exception is not thrown rather the name is just a blank space.

.

    string[] paths = Directory.GetFiles( Path.GetDirectoryName(shortName), Path.GetFileName(shortName) );

.

Public Const CT_TYPE2 As Int32 = &H2    ' Retrieves bi-directional layout info

.

    BidirectionalLayout = CT_TYPE2

.

Public Const CT_TYPE2 As Int32 = &H2    ' Retrieves bi-directional layout info

.

    BidirectionalLayout = CT_TYPE2

.
Summary
.

static extern uint GetSystemDirectory([Out] StringBuilder lpBuffer,

.

<DllImport("kernel32.dll", SetLastError:=true, EntryPoint:="GetSystemDirectoryW", CharSet:=CharSet.Unicode)> _

.

Public Function GetSystemDirectory(<MarshalAs(UnmanagedType.LPTSTR)>lpBuffer As System.Text.StringBuilder, _

.

Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" _

.

    res = GetSystemDirectory(sbSystemDir,256);

.
Documentation
[GetSystemDirectory] on MSDN
.

static extern TODO GetSystemWindowsDirectoryW(TODO);

.

Declare Function GetSystemWindowsDirectoryW Lib "kernel32.dll" (TODO) As TODO

.
Documentation
[GetSystemWindowsDirectoryW] on MSDN
.
Summary
Retrieves the path of the system directory used by WOW64. This directory is not present on 32-bit Windows.
.

public static extern int GetSystemWow64Directory([In, Out] char[] lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

.

public static extern int GetSystemWow64Directory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

.

Private Declare Function GetSystemWow64Directory Lib "Kernel32.dll" Alias _

.

      "GetSystemWow64DirectoryA" (ByVal lpBuffer As String, ByVal uSize As Long) As Integer

.

    public static extern int GetSystemWow64Directory([In, Out] char[] lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

.

    int result = GetSystemWow64Directory(path, (uint)path.Length);

.

    private static extern int GetSystemWow64Directory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder lpBuffer, [MarshalAs(UnmanagedType.U4)] uint size);

.

    if (GetSystemWow64Directory(buffer, (uint)buffer.Capacity) != 0)

.

    Private Declare Function GetSystemWow64Directory Lib "Kernel32.dll" Alias _

.

      "GetSystemWow64DirectoryA" (ByVal lpBuffer As String, ByVal uSize As Integer) As Integer

.

    Dim Result As Integer = GetSystemWow64Directory(DirPath, DirPath.Length)

.
Documentation
.

      Directory.CreateDirectory(tempFolderName);

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


 
Access PInvoke.net directly from VS: