Desktop Functions: Smart Device Functions:
|
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 2: DsGetDcName
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; 5: NetDfsEnum [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(); 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 13: NetRemoteTOD
using System.DirectoryServices.ActiveDirectory; 14: NetServerGetInfo
public string UserDirectoryPath; 15: NetSessionEnum
/// Parameter was incorrect.
/// Unknown Directory. 16: NetShareAdd
NERR_RedirectedPath = (NERR_BASE + 17)
string path = @"C:\MyShareDirectory"; // do not append comma, it'll fail 17: NetShareEnum 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) 18: NetShareGetInfo
Corrected VB Signature 'ByVal Level As Long' --> 'ByVal Level as Integer', format tidy. 19: NetUseAdd 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. 20: NetUserEnum 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 22: NetWkstaUserEnum * 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. 23: USER_INFO_0 Isn't this supposed to be under 'Directory' - 'Structures', rather than 'Desktop Functions:' - 'netapi32'? kernel3224: ActivateActCtx
public string lpAssemblyDirectory;
private const uint ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID = 0x004; 25: AttachConsole,
26: AttachConsole
27: ConsoleFunctions
// 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 28: CreateDirectory
static extern bool CreateDirectoryEx(string lpTemplateDirectory,
string lpNewDirectory, IntPtr lpSecurityAttributes); 30: CreateNamedPipe
Bidirectional = (int)(PIPE_ACCESS_INBOUND+PIPE_ACCESS_OUTBOUND)
case ServerMode.Bidirectional:
NamedPipeStream stream = NamedPipeStream.Create("testpipe", NamedPipeStream.ServerMode.Bidirectional); 31: CreateProcess
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 33: CreateThread 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. 34: DeviceIoControl
InDirect = 1,
OutDirect = 2,
NetworkRedirector = 0x00000028, gave incorrect results due to signs. 37: FindFirstFile
38: FindFirstFileEx
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? 41: FormatMessage ThrowExceptionForHR is for HRESULT values returned directly from NT functions, is it not? 42: GetBinaryType
#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
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 48: GetDiskFreeSpace
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 50: GetDriveType
/// <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)); 53: GetLastError 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. 54: GetLongPathName 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) ); 55: GetStringType
Public Const CT_TYPE2 As Int32 = &H2 ' Retrieves bi-directional layout info
BidirectionalLayout = CT_TYPE2 56: GetStringTypeEx
Public Const CT_TYPE2 As Int32 = &H2 ' Retrieves bi-directional layout info
BidirectionalLayout = CT_TYPE2
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);
static extern TODO GetSystemWindowsDirectoryW(TODO);
Declare Function GetSystemWindowsDirectoryW Lib "kernel32.dll" (TODO) As TODO
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) 60: GetTempFileName
Directory.CreateDirectory(tempFolderName); Cut off search results after 60. Please refine your search. |