Desktop Functions: Smart Device Functions:
|
Search Results for "RECT" in [All]ntdll1: NtCreateFile
public IntPtr RootDirectory;
objAttributes.RootDirectory = _RootHandle;
public static extern int NtOpenDirectoryObject(
out SafeFileHandle DirectoryHandle,
var st = Win32.NtOpenDirectoryObject(
st = Win32.NtQueryDirectoryObject(h, buf, bufsz,
var odi = (OBJECT_DIRECTORY_INFORMATION)
Marshal.PtrToStructure(buf, typeof(OBJECT_DIRECTORY_INFORMATION));
FileDirectoryInformation = 1
FileFullDirectoryInformation
FileBothDirectoryInformation
FileIdBothDirectoryInformation
FileIdFullDirectoryInformation
FileDirectoryInformation = 1, // 1
FileFullDirectoryInformation, // 2
FileBothDirectoryInformation, // 3
FileIdBothDirectoryInformation, // 37
FileIdFullDirectoryInformation, // 38
FileDirectoryInformation = 1, // 1
FileFullDirectoryInformation, // 2
FileBothDirectoryInformation, // 3
FileIdBothDirectoryInformation, // 37
FileIdFullDirectoryInformation, // 38
FileAttributes.Directory,
// make the call, passing the correct SubAuthority count kernel32
public string lpAssemblyDirectory;
private const uint ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID = 0x004;
10: 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 11: CreateDirectory
static extern bool CreateDirectoryEx(string lpTemplateDirectory,
string lpNewDirectory, IntPtr lpSecurityAttributes); 13: CreateNamedPipe
Bidirectional = (int)(PIPE_ACCESS_INBOUND+PIPE_ACCESS_OUTBOUND)
case ServerMode.Bidirectional:
NamedPipeStream stream = NamedPipeStream.Create("testpipe", NamedPipeStream.ServerMode.Bidirectional); 14: 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 16: 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. 17: DeviceIoControl
InDirect = 1,
OutDirect = 2,
NetworkRedirector = 0x00000028, gave incorrect results due to signs. 20: FindFirstFile 21: 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? 24: FormatMessage ThrowExceptionForHR is for HRESULT values returned directly from NT functions, is it not? 25: 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 31: 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 33: 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)); 36: 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. 37: 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) ); 38: GetStringType
Public Const CT_TYPE2 As Int32 = &H2 ' Retrieves bi-directional layout info
BidirectionalLayout = CT_TYPE2 39: 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) 43: GetTempFileName
Directory.CreateDirectory(tempFolderName); 44: GetTempPath
Dim dirInfo As DirectoryInfo
If Not Directory.Exists(fFoldername) Then
dirInfo = Directory.CreateDirectory(fFoldername)
Throw New Exception("Directory '" + fFoldername + "' can not be created") 45: GetTickCount Note, the managed API is subtly different than the Win32 API call. The Win32 API call returns an unsigned int while the managed API returned a signed int. Also note that the MSDN documentation for System.Environment.TickCount() is not correct. This managed API rolls over to int.MinValue and not to 0 after 24.9 days. UPDATE, The MSDN documentation has been updated to correctly state the int.MinValue 24.9 day rollover. The new documentation also provides an example of how to correctly return a positive value from the method. http://msdn2.microsoft.com/en-us/library/system.environment.tickcount.aspx
/// <para>To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate the occurence of the day of the week within the month (first through fifth).</para>
/// <para>To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate the occurence of the day of the week within the month (first through fifth).</para>
/// The specified volume is a direct access (DAX) volume. This flag was introduced in Windows 10, version 1607.
''' for the specified directory. Works with UNC. Can throw an exception.
static extern uint GetWindowsDirectory(StringBuilder lpBuffer,
<DllImport("kernel32.dll", SetLastError:=true, EntryPoint:="GetWindowsDirectoryW", CharSet:=CharSet.Unicode)> _
Public Function GetWindowsDirectory(<MarshalAs(UnmanagedType.LPTSTR)>lpBuffer As System.Text.StringBuilder, _
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" _
Dim Res As Integer = GetWindowsDirectory(WinDir, WinDir.Length)
GetWindowsDirectory(sb,i)
int len = (int)GetWindowsDirectory(sb, MaxPathLength);
_windowsDirectory = sb.ToString(0, len);
GetWindowsDirectory(sb,ref i); 49: MoveMemory
Dim rect As Rectangle = New Rectangle(0, 0, Width, Height)
bitmapData = bitmap.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed) 50: OpenThread
DIRECT_IMPERSONATION = (0x0200)
static extern bool ReadDirectoryChangesW(IntPtr hDirectory, IntPtr lpBuffer,
ReadDirectoryChangesDelegate lpCompletionRoutine); 52: RemoveDirectory
static extern bool RemoveDirectory(string lpPathName); Only deletes the end-most directory. The directory must be empty. Iteratively Remove a Directory Tree I updated the create directory code (LongPathDirectory.Delete()) code in the Microsoft.Experimental.IO project (http://bcl.codeplex.com/releases/view/42783) so some of the classes referenced in the code below are from that project.
internal static extern bool RemoveDirectory(string lpPathName);
if (!NativeMethods.RemoveDirectory(normalizedPath))
RemoveDirectory(path); System.IO.Directory.Delete(). This is used for handling runtime-generated machine code on these platforms, which is quite rare to be doing directly from C#...
public SMALL_RECT srWindow;
internal struct SMALL_RECT
internal SMALL_RECT srWindow;
static extern bool SetCurrentDirectory(string lpPathName); Private Shared Function SetCurrentDirectory(lpPathName As String) As Boolean Directory.SetCurrentDirectory
static extern bool SetDefaultDllDirectories(uint directoryFlags); var result = SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); 57: SetDllDirectory
static extern bool SetDllDirectory(string lpPathName);
Declare Function SetDllDirectory Lib "kernel32.dll" (TODO) As TODO
did_it_work = SetDllDirectory(@"C:\SomeWhere\");
Directory = 0x00000010,
FileIdBothDirectoryInfo = 10, // 0xA
FileIdBothDirectoryRestartInfo = 11, // 0xB
FileFullDirectoryInfo = 14, // 0xE
FileFullDirectoryRestartInfo = 15, // 0xF
FileIdExtdDirectoryInfo = 19, // 0x13
FileIdExtdDirectoryRestartInfo = 20, // 0x14
/// <para>To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate the occurence of the day of the week within the month (first through fifth).</para>
/// <para>To select the correct day in the month, set the wYear member to zero, the wHour and wMinute members to the transition time, the wDayOfWeek member to the appropriate weekday, and the wDay member to indicate the occurence of the day of the week within the month (first through fifth).</para> Cut off search results after 60. Please refine your search. |