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]

dwmapi

.

A more reliable approach to get the colorization parameters would be to implement your own method that tries to lookup each parameter directly from the Windows registry, with proper exception handling in the case a value cannot be obtained. The colorization parameters can be found under the key "HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM". Please note that these are also undocumented and as such can also be changed or removed in the future.

.

static extern int DwmGetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE dwAttribute, out RECT pvAttribute, int cbAttribute);

.

DWMWINDOWATTRIBUTE, RECT

.

You cannot call this function directly. This is how to use it (VB.NET):

.

A more reliable approach to set the colorization parameters would be to implement your own method that tries to set each parameter directly in the Windows registry and sends the WM_DWMCOLORIZATIONCOLORCHANGED message to notify all top-level windows about the change, with proper exception handling in the case a value cannot be set. The colorization parameters can be found under the key "HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM". Please note that these are also undocumented and as such can also be changed or removed in the future.

.

public struct RECT

.

     public RECT rcDestination;

.

     public RECT rcSource;

comctl32

.
Summary
Enters the control in 'ReaderMode' a mouse scrolling mode that allows you to scroll in any direction by moving the mouse pointer. Callbacks are used to inform the control of the offset it should scroll. The Control is responsible for updating the scroll position. The function must be passed the READERMODEINFO structure. This function has no public header and must be referenced as ordinal 383, as per MSDN documentation.
.

RECT

.

        Dim rect As New RECT(Me.Width / 2 - 20, Me.Height / 2 - 20, Me.Width / 2 + 20, Me.Height / 2 + 20)

.

        Dim pnt As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(rect))

.

        Marshal.StructureToPtr(rect, pnt, True)

.

       public static void Draw(this ImageList imageList, Graphics g, Rectangle bounds, int index, ImageListDrawColor bgColor, ImageListDrawColor fgColor, NativeMethods.ImageListDrawingStyle style = NativeMethods.ImageListDrawingStyle.Normal, int overlayImageIndex = 0)

.

       public static void Draw(this ImageList imageList, Graphics g, Rectangle bounds, int index, ImageListDrawColor bgColor, ImageListDrawColor fgColor, NativeMethods.ImageListDrawingStyle style = NativeMethods.ImageListDrawingStyle.Normal, int overlayImageIndex = 0)

.
Summary
TaskDialogIndirect - Show a Vista TaskDialog with custom button names and many other features.
.

static extern HRESULT TaskDialogIndirect

.

    public static extern IntPtr TaskDialogIndirect

.

TaskDialogIndirect(ref config, out ret, out selRadio, out setVerification);

.

Declare Function TaskDialogIndirect Lib "comctl32.dll" (TODO) As TODO

.

Private Shared Function TaskDialogIndirect(<[In]> pTaskConfig As TASKDIALOGCONFIG, <Out> ByRef pnButton As Integer, <Out> ByRef pnRadioButton As Integer, <MarshalAs(UnmanagedType.Bool), Out> ByRef pfverificationFlagChecked As Boolean) As HRESULT

.

A full wrapper for Vista's TaskDialog & TaskDialogIndirect can be found here:

.

    /// <summary>The TaskDialogIndirect function creates, displays, and operates a task dialog. The task dialog contains application-defined icons, messages, title, verification check box, command links, push buttons, and radio buttons. This function can register a callback function to receive notification messages.</summary>

.

    internal static extern Result TaskDialogIndirect([In] TaskDialogConfig taskConfig, [Out] out int button, [Out] out int radioButton, [MarshalAs(UnmanagedType.Bool), Out] out bool verificationFlagChecked);

.
Documentation
[TaskDialogIndirect] on MSDN
.
Summary
TaskDialogIndirect - Show a Vista TaskDialog with custom button names and many other features.
.

static extern HRESULT TaskDialogIndirect

.

    public static extern IntPtr TaskDialogIndirect

.

TaskDialogIndirect(ref config, out ret, out selRadio, out setVerification);

.

Declare Function TaskDialogIndirect Lib "comctl32.dll" (TODO) As TODO

.

Private Shared Function TaskDialogIndirect(<[In]> pTaskConfig As TASKDIALOGCONFIG, <Out> ByRef pnButton As Integer, <Out> ByRef pnRadioButton As Integer, <MarshalAs(UnmanagedType.Bool), Out> ByRef pfverificationFlagChecked As Boolean) As HRESULT

.

A full wrapper for Vista's TaskDialog & TaskDialogIndirect can be found here:

.

    /// <summary>The TaskDialogIndirect function creates, displays, and operates a task dialog. The task dialog contains application-defined icons, messages, title, verification check box, command links, push buttons, and radio buttons. This function can register a callback function to receive notification messages.</summary>

.

    internal static extern Result TaskDialogIndirect([In] TaskDialogConfig taskConfig, [Out] out int button, [Out] out int radioButton, [MarshalAs(UnmanagedType.Bool), Out] out bool verificationFlagChecked);

.
Documentation
[TaskDialogIndirect] on MSDN

winhttp

.

ERROR_WINHTTP_INCORRECT_HANDLE_TYPE - The type of handle supplied is incorrect for this operation.

dhcpsapi

.
Summary
Enumerate directory server for DHCP servers. Works with Active Directory.

ntdll

.

   public IntPtr RootDirectory;

.

objAttributes.RootDirectory = _RootHandle;

.
Summary
Creates a new file or directory, or opens an existing file, device, directory, or volume.
.

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));

.
Documentation
[NtOpenDirectoryObject] on MSDN
.

cf. NtOpenDirectoryObject

.
Summary
Retrieves information about the specified directory object.
.

public static extern int NtQueryDirectoryObject(

.

   SafeFileHandle DirectoryHandle,

.

cf. NtOpenDirectoryObject.

.
Documentation
[NtQueryDirectoryObject] on MSDN
.

        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

advapi32

.

    void SaveLog(string eventLogName, string destinationDirectory)

.

        string exportedEventLogFileName = Path.Combine(destinationDirectory, eventLogName + ".evt");

.

As explained [here], memory for the returned unmanaged string must be freed by calling LocalFree. Therefore, you must define the string as an IntPtr in managed code and call LocalFree yourself. Otherwise, the marshaler would call CoTaskMemFree which is not correct in this case.

.

// Another C# Sample that converts a sid from a DirectoryEntry object

.

private string GetTextualSID(DirectoryEntry objGroup){

.

    ManagementObject Share = new ManagementObject("Win32_Directory='" + ToPath + "'");

.

        public static uint FILE_LIST_DIRECTORY = 0x1;

.

        public static uint FILE_ADD_SUBDIRECTORY = 0x4;

.

    string lpCurrentDirectory,

.

                           ByVal lpCurrentDirectory As String, _

.

     String             currentDirectory,

.

    Public Function CreateProcessWithLogonW(ByVal userName As String, ByVal domain As String, ByVal password As String, ByVal logonFlags As UInt32, ByVal applicationName As String, ByVal commandLine As String, ByVal creationFlags As UInt32, ByVal environment As UInt32, ByVal currentDirectory As String, ByRef startupInfo As StartupInfo, ByRef processInformation As ProcessInformation) As Boolean

.

    Public Function CreateProcessWithLogonW(ByVal userName As String, ByVal domain As String, ByVal password As String, ByVal logonFlags As UInt32, ByVal applicationName As String, ByVal commandLine As String, ByVal creationFlags As UInt32, ByVal environment As UInt32, ByVal currentDirectory As String, ByRef startupInfo As StartupInfo, ByRef processInformation As ProcessInformation) As Boolean

.

    Dim currentDirectory As String = System.IO.Directory.GetCurrentDirectory()

.

        currentDirectory, startupInfo, processInfo)

.

            String currentDirectory,

.

            String currentDirectory = System.IO.Directory.GetCurrentDirectory();

.

                    currentDirectory,

.

I changed the C# version from using "out uint lpdwTagId" to "string lpdwTagId". Without that change, the C# call to CreateService always returned an incorrect parameter error.

.
Summary
The CryptSignHash function signs data. Because all signature algorithms are asymmetric and thus slow, the CryptoAPI does not allow data to be signed directly. Instead, data is first hashed and CryptSignHash is used to sign the hash.
.

For Directories

.

System.Security.AccessControl.DirectorySecurity

.

Local or remote files or directories on an NTFS file system

.

Directory service objects

.

    internal IntPtr RootDirectory;

.

        lsaAttr.RootDirectory = IntPtr.Zero;

.

    internal IntPtr RootDirectory;

.

        lsaAttr.RootDirectory = IntPtr.Zero;

.

I used a custom marshaler to live a happier life with the "own super special" string type that LSA uses. It marshals LSA_UNICODE_STRINGS to and from normal .NET strings. See "Alternate Sample Code" way below. However I'm quite new to p/invoke and this is my first custom marshaler ever, so please keep your eyes open for problems and bugs with my code. (A problem I had was CleanUpNativeData for data converted from managed to unmanaged aswell as for data converted from unmanaged to managed. Since I didn't allocate the data myself in the latter case my marshaler uses a hash table to keep track of the native data it allocated itself. Don't know if that's the correct way, however. Feel free to mail me at pi AT removethispart frohwalt removethisaswell DOT de for suggestions/corrections. ) Oh, by the way this also contains an example for LSARetrievePrivateData in case you want to read out some RunAs passwords from the LSA. (My goal is to ultimateley change them, not to read them )

.

        aObjectAttributes.RootDirectory = IntPtr.Zero;

.

            ObjectAttributes.RootDirectory = IntPtr.Zero;

.

            public IntPtr RootDirectory;

.

        public IntPtr RootDirectory;

.

        objectAttributes.RootDirectory = IntPtr.Zero;

.
Summary
Returns the list of sub key names from a given registry key. Analogous to getting a list of subdirectories
.

- Changed IntPtr to UIntPtr: When invoking with IntPtr for the handles, you will run into an Overflow. UIntPtr is the right choice if you wish this to work correctly on 32 and 64 bit platforms.

.

    ' Create a new Registry key using the private constructor using the safeHandle - this should then behave like a .NET natively opened handle and disposed of correctly

.

    Dim result = DirectCast(registryKeyConstructor.Invoke(New Object() {safeHandle, writable}), RegistryKey)

.

    ' Create a new Registry key using the private constructor using the safeHandle - this should then behave like a .NET natively opened handle and disposed of correctly

.

    Dim result As Microsoft.Win32.RegistryKey = DirectCast(registryKeyConstructor.Invoke(New Object() {safeHandle, writable}), Microsoft.Win32.RegistryKey)

.

To correct this, I changed the call to pointerToRegistryKey in openSubKey to pass true (ownsHandle).

.

All code above is for versions of .NET Framework prior to 4.0. In version 4.0, Microsoft.Win32.SafeHandles.SafeRegistryHandle is now public instead of private causing the examples above to error. This was to added support for Microsoft.Win32.RegistryView which negates the need to directly call advapi32.dll and the RegOpenKeyEx function by making the process managed. Here are examples of how to access 32-bit registry keys from a 64-bit application using .NET Framework 4.0:

.

- Changed IntPtr to UIntPtr: When invoking with IntPtr for the handles, you will run into an Overflow. UIntPtr is the right choice if you wish this to work correctly on 32 and 64 bit platforms.

.

    ' Create a new Registry key using the private constructor using the safeHandle - this should then behave like a .NET natively opened handle and disposed of correctly

.

    Dim result = DirectCast(registryKeyConstructor.Invoke(New Object() {safeHandle, writable}), RegistryKey)

.

    ' Create a new Registry key using the private constructor using the safeHandle - this should then behave like a .NET natively opened handle and disposed of correctly

.

    Dim result As Microsoft.Win32.RegistryKey = DirectCast(registryKeyConstructor.Invoke(New Object() {safeHandle, writable}), Microsoft.Win32.RegistryKey)

.

All code above is for versions of .NET Framework prior to 4.0. In version 4.0, Microsoft.Win32.SafeHandles.SafeRegistryHandle is now public instead of private causing the examples above to error. This was to added support for Microsoft.Win32.RegistryView which negates the need to directly call advapi32.dll and the RegOpenKeyEx function by making the process managed. Here are examples of how to access 32-bit registry keys from a 64-bit application using .NET Framework 4.0:

.

// Alternate definition - more correct

.

Dim ParentKey As IntPtr = DirectCast(environmentRegHKey.GetValue(environmentReg), IntPtr)

.

// Alternate definition - more correct

.

Dim ParentKey As IntPtr = DirectCast(environmentRegHKey.GetValue(environmentReg), IntPtr)

.

// Alternate definition - more correct

.

       temp = DirectCast(Value, System.Byte())

.

       lines = DirectCast(Value, System.String())

.

        // aligned correctly.

.

            // aligned correctly.

.

        Dim dirInfo As DirectoryInfo = New DirectoryInfo(mainFolderBrowserDialog.SelectedPath)

.

    ''' Not Inhertitable Shared Class that Computes and Returns the UNC Path for any file or directory,

.

       Private _di As IO.DirectoryInfo = Nothing

.

       ''' Gets UNC Fully Qualified Path to File or Directory

.

       ''' Gets the Path location within the Connection to the Directory or File

.

       ''' Gets the Original File/Directory provided the UNCPath Class

.

       ''' <remarks>Returns Nothing if the Provided Path was a Directory</remarks>

.

       ''' Gets an IO.DirectoryInfo Object pointing to the UNC Share

.

       ''' <returns>IO.DirectoryInfo</returns>

.

       ''' <remarks>Returns the Directory of the File if the Provided Path was a File</remarks>

.

       Public ReadOnly Property Directory() As IO.DirectoryInfo

.

       ''' <param name="Path">Fully Qualified Path to File or Directory</param>

.

                _di = _fi.Directory

.

             Else : _di = New IO.DirectoryInfo(_unc)

.

       ''' Returns a IO.DirectoryInfo object to the UNC Qualified Path to a Directory, or the Directory containing a File

.

       ''' <param name="filepath">Fully Qualifie Path, either with UNC, Local, or Mapped Drive to either a File or a Directory</param>

.

       ''' <returns>On Error, Returns Nothing, else IO.DirectoryInfo</returns>

.

       Public Shared Function GetUNCDir(ByVal filepath As String) As IO.DirectoryInfo

.

          Dim di As IO.DirectoryInfo = unc.Directory

.

       ''' Creates a UNCPath object to a File or Directory and returns whether or the operation was successful.

.

       ''' Returns a UNCPath object to a File or Directory

.

       ''' <param name="FilePath">Fully Qualifie Path, either with UNC, Local, or Mapped Drive to either a File or a Directory</param>

.

       ''' This code added by Visual Basic to correctly implement the disposable pattern.

mpr

.

        RESOURCEDISPLAYTYPE_DIRECTORY,

.

        CONNECT_REDIRECT = 0X80,

.
Summary
The WNetAddConnection2 function makes a connection to a network resource. The function can redirect a local device to the network resource.
.

  //      RESOURCEDISPLAYTYPE_DIRECTORY,

.

    Directory = 0x09,

.

        RESOURCEDISPLAYTYPE_DIRECTORY,

.

    RESOURCEDISPLAYTYPE_DIRECTORY = 0x00000009,

.

    RESOURCEDISPLAYTYPE_DIRECTORY = &H9

.
Summary
Makes a connection to a network resource. The function can redirect a local device to a network resource.
.

    DIRECTORY    = 0x00000009,

.

    REDIRECT        = 0x00000080,

wintrust

.

         UntrustedRoot = 0x800B0109          // CERT_E_UNTRUSTEDROOT - A certification chain processed correctly but terminated in a root certificate that is not trusted by the trust provider.

setupapi

.

        SetupDiGetDeviceRegistryProperty(NewDeviceInfoSet, DeviceInfoData, DirectCast(SPDRP_FRIENDLYNAME, Integer), propRegDataType, sbDesc, MAX_LEN, reqSize)

.

            SetupDiGetDeviceRegistryProperty(NewDeviceInfoSet, DeviceInfoData, DirectCast(SPDRP_DEVICEDESC, Integer), propRegDataType, sbDesc, MAX_LEN, reqSize)

.

        SetupDiGetDeviceRegistryProperty(NewDeviceInfoSet, DeviceInfoData, DirectCast(SPDRP_HARDWAREID, Integer), propRegDataType, sbHWID, MAX_LEN, reqSize)

.

    This is not the correct signature for 64-bit Windows...

.

‘ Should be a Do While > looking for the correct devicename…

.

The SetupCopyOEMInf function copies a specified INF file to the /Inf directory.

.

in Specifies how the INF file is copied into the INF directory. The following flags can be combined. Value Meaning

.

SP_COPY_REPLACEONLY Copy only if this file already exists in the INF directory. This flag could be used to update the source location information for an existing INF.

.

SP_COPY_NOOVERWRITE Copy only if the specified files don't currently exist in the INF directory. If the INF does currently exist, this API will fail and GetLastError returns ERROR_FILE_EXISTS. In this case, the existing INF file's filename will be placed into the appropriate field in the destination INF file's information output buffers.

.

SP_COPY_OEMINF_CATALOG_ONLY The specified INF file's corresponding catalog files is copied to \Inf. If this flag is specified, the destination filename information is entered upon successful return if the specified INF file already exists in the Inf directory.

.

[out, optional] Pointer to a buffer to receive the INF file name assigned to it at the time it was copied to the INF directory. The buffer, if specified, should typically be MAX_PATH in length. If the SP_COPY_NOOVERWRITE flag is specified and the SetupCopyOEMInf function fails with a return code of ERROR_FILE_EXISTS, this buffer will contain the name of the existing INF file. If the SP_COPY_OEMINF_CATALOG_ONLY flag is specified, this buffer will contain the destination INF filename if the INF file is already present in the INF directory. Otherwise, this buffer will be set to the empty string. This parameter can be NULL.

.

[out, optional] Pointer to a variable that receives the size (in characters) required to store the destination INF file name including a terminating NULL. If the SP_COPY_OEMINF_CATALOG_ONLY flag is specified, this variable will receive a string length only if the INF file already exists in the INF directory. Otherwise, this variable will be set to zero. This parameter can be NULL.

.

The SetupCopyOEMInf function copies a specified INF file into the \Inf directory. SetupCopyOEMInf does not recopy the file if it finds that a binary image of the specified INF file already exists in the INF directory with the same name or a name of the form OEM*.INF. When SetupCopyOEMInf copies a file, it renames the copied file to OEM*.INF. Name provided is unique and cannot be predicted.

.

SetupCopyOEMInf uses the following procedure to determine if the INF file already exists in the INF directory:

.

The INF directory is searched for the source filename of the INF file. If an INF file of the same name exists and is the same size as that of the specified INF file, the two files are binary compared to determine if they are identical.

.

If the specified INF file already exists a further check is performed to determine if the specified INF file contains a CatalogFile= entry in its Version section. If it does, the INF files's \Inf primary filename with a ".CAT" extension is used to determine if the catalog is already installed. If there is a catalog installed, but it isn't the same as the catalog associated with the source INF, this is not considered to be a match and enumerations continue. It is possible to have multiple identical INF files with unique catalogs contained in \Inf directory. If an existing match is not found, the INF and CAT files are installed under a new and unique name.

.

In cases where the INF file must be copied to the \Inf directory, any digital signature verification failures are reported

.

    //                  directly after ChangeIt to see whether or not you need

.

The DeviceGUID parameter will be device dependent. Look in the Manufacturer's SDK or API for the correct guid for your device.

.

SP_DEVICE_INTERFACE_DETAIL_DATA needs a ByVal TCHAR[ANYSIZE_ARRAY] member, which could conceivably be any size. This does not bode well for determining the correct size, however DevicePath should be no longer than MAX_PATH (256).

.

    //                  directly after ChangeIt to see whether or not you need

.
FileName Pointer to a null-terminated string containing the name (and optional path) of the INF file to be opened. If the filename does not contain path separator characters, it is searched for, first in the \inf directory, and then in the \system32 directory. If the filename contains path separator characters, it is assumed to be a full path specification and no further processing is performed on it.
.

   if (0 == GetWindowsDirectory(winDir, winDir.Capacity)) return (false);

.

   string[] infFiles = Directory.GetFiles(infDir, "*.inf");

user32

.
Summary
.

static extern bool AdjustWindowRectEx(ref Rect lpRect, uint dwStyle,

.

Public Function AdjustWindowRectEx(<MarshalAs(UnmanagedType.Struct)>byref lpRect As RECT, _

.

Public Declare Function AdjustWindowRectEx Lib "user32" _

.

         (lpRect As RECT, _

.

RECT

.

System.Windows.Rect

.
Documentation
[AdjustWindowRectEx] on MSDN
.
Summary
.

static extern bool AdjustWindowRectEx(ref RECT lpRect, uint dwStyle,

.

Public Function AdjustWindowRectEx(<MarshalAs(UnmanagedType.Struct)>byref lpRect As RECT, _

.

Public Declare Function AdjustWindowRectEx Lib "user32" _

.

         (lpRect As RECT, _

.

RECT

.
Documentation
[AdjustWindowRectEx] on MSDN
.

static extern TODO AlignRects(TODO);

.

Declare Function AlignRects Lib "user32.dll" (TODO) As TODO

.
Documentation
[AlignRects] on MSDN
.

The multiple-window-position structure is an internal structure; an application cannot access it directly.

.

Useful to create a temporary block in input for sensitive GUI operations. For instance when manually activating a screen saver from within a GUI function, a short blocking delay will prevent the user mouse movements directly after selection from accidently escaping the screen saver.

.

///     installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call

.

   IntPtr lpRect, uint cKids, IntPtr [] lpKids);

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


 
Access PInvoke.net directly from VS: