Desktop Functions: Smart Device Functions:
|
Search Results for "OVERLAPPED " in [All]Constants1: WINBASE
private const uint FILE_FLAG_OVERLAPPED = 0x40000000;
public const uint WS_OVERLAPPED = 0x00000000;
( WS_OVERLAPPED |
WS_OVERLAPPED = 0x00000000,
WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
WS_OVERLAPPED = 0
WS_OVERLAPPEDWINDOW = WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or _ 3: WINERROR
/// Overlapped I/O event is not in a signaled state.
/// Overlapped I/O operation is in progress. 4: WM
iphlpapi5: EnableRouter
static extern int EnableRouter(IntPtr pHandle, ref System.Threading.NativeOverlapped pOverlapped);
Public Shared Function EnableRouter(pHandle As IntPtr, ByRef pOverlapped As OVERLAPPED) As Integer
Public Shared Function EnableRouter(pHandle As IntPtr, ByRef pOverlapped As OVERLAPPED) As Integer
Private pOverlapped As OVERLAPPED ' <- Important! This should also be used when calling UnenableRouter() API Function.
' OVERLAPPED strucutre fields can be NULLED except hEvent field.
static extern int UnenableRouter(ref System.Threading.NativeOverlapped pOverlapped, IntPtr lpdwEnableCount);
Public Shared Function UnenableRouter(pOverlapped As IntPtr, ByRef lpdwEnableCount As Long) As Integer
Public Shared Function UnenableRouter(pOverlapped As IntPtr, ByRef lpdwEnableCount As Long) As Integer
Private pOverlapped As OVERLAPPED <- Important! Created from EnableRouter() call. Enums
/// This message is sent by the OS to all top-level and overlapped windows after the window with the keyboard focus realizes its logical palette.
'''This message is sent by the OS to all top-level and overlapped windows after the window with the keyboard focus realizes its logical palette. This message enables windows that do not have the keyboard focus to realize their logical palettes and update their client areas. 8: WindowStyles
/// <summary>Specifies an overlapped window.</summary>
''' <summary>Specifies an overlapped window.</summary>
/// <summary>Specifies an overlapped window.</summary>
''' <summary>Specifies an overlapped window.</summary> Structures10: OVERLAPPED
11: OVERLAPPED
struct OVERLAPPED { EventHandle: Specifies the handle to an event set to the signaled state when the operation is complete. The calling process must set this member either to zero or to a valid event handle before calling any overlapped functions. This structure is already defined as System.Threading.NativeOverlapped in the .NET Framework. It is not supported for the .NET Compact Framework. user3212: AnyPopup The AnyPopup function indicates whether an owned, visible, top-level pop-up, or overlapped window exists on the screen. The function searches the entire screen, not just the calling application's client area. 13: CreateWindowEx
/// <param name="x">Specifies the initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area. If x is set to CW_USEDEFAULT, the system selects the default position for the window's upper-left corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child window, the x and y parameters are set to zero.</param>
/// <param name="y">Specifies the initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. For a list box y is the initial y-coordinate of the upper-left corner of the list box's client area relative to the upper-left corner of the parent window's client area.
/// <para>If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to CW_USEDEFAULT, then the y parameter determines how the window is shown. If the y parameter is CW_USEDEFAULT, then the window manager calls ShowWindow with the SW_SHOW flag after the window has been created. If the y parameter is some other value, then the window manager calls ShowWindow with that value as the nCmdShow parameter.</para></param>
/// <param name="nWidth">Specifies the width, in device units, of the window. For overlapped windows, nWidth is the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, the system selects a default width and height for the window; the default width extends from the initial x-coordinates to the right edge of the screen; the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, the nWidth and nHeight parameter are set to zero.</param>
/// <param name="nHeight">Specifies the height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If the nWidth parameter is set to CW_USEDEFAULT, the system ignores nHeight.</param> <param name="hWndParent">Handle to the parent or owner window of the window being created. To create a child window or an owned window, supply a valid window handle. This parameter is optional for pop-up windows.
/// <param name="hMenu">Handle to a menu, or specifies a child-window identifier, depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window.</param>
''' <param name="x">Specifies the initial horizontal position of the window. For an overlapped or pop-up window, the x parameter is the initial x-coordinate of the window's upper-left corner, in screen coordinates. For a child window, x is the x-coordinate of the upper-left corner of the window relative to the upper-left corner of the parent window's client area. If x is set to CW_USEDEFAULT, the system selects the default position for the window's upper-left corner and ignores the y parameter. CW_USEDEFAULT is valid only for overlapped windows; if it is specified for a pop-up or child window, the x and y parameters are set to zero.</param>
''' <param name="y">Specifies the initial vertical position of the window. For an overlapped or pop-up window, the y parameter is the initial y-coordinate of the window's upper-left corner, in screen coordinates. For a child window, y is the initial y-coordinate of the upper-left corner of the child window relative to the upper-left corner of the parent window's client area. For a list box y is the initial y-coordinate of the upper-left corner of the list box's client area relative to the upper-left corner of the parent window's client area.
''' <para>If an overlapped window is created with the WS_VISIBLE style bit set and the x parameter is set to CW_USEDEFAULT, then the y parameter determines how the window is shown. If the y parameter is CW_USEDEFAULT, then the window manager calls ShowWindow with the SW_SHOW flag after the window has been created. If the y parameter is some other value, then the window manager calls ShowWindow with that value as the nCmdShow parameter.</para></param>
''' <param name="nWidth">Specifies the width, in device units, of the window. For overlapped windows, nWidth is the window's width, in screen coordinates, or CW_USEDEFAULT. If nWidth is CW_USEDEFAULT, the system selects a default width and height for the window; the default width extends from the initial x-coordinates to the right edge of the screen; the default height extends from the initial y-coordinate to the top of the icon area. CW_USEDEFAULT is valid only for overlapped windows; if CW_USEDEFAULT is specified for a pop-up or child window, the nWidth and nHeight parameter are set to zero.</param>
''' <param name="nHeight">Specifies the height, in device units, of the window. For overlapped windows, nHeight is the window's height, in screen coordinates. If the nWidth parameter is set to CW_USEDEFAULT, the system ignores nHeight.</param> <param name="hWndParent">Handle to the parent or owner window of the window being created. To create a child window or an owned window, supply a valid window handle. This parameter is optional for pop-up windows.
''' <param name="hMenu">Handle to a menu, or specifies a child-window identifier, depending on the window style. For an overlapped or pop-up window, hMenu identifies the menu to be used with the window; it can be NULL if the class menu is to be used. For a child window, hMenu specifies the child-window identifier, an integer value used by a dialog box control to notify its parent about events. The application determines the child-window identifier; it must be unique for all child windows with the same parent window.</param> coredll14: DeviceIOControl
ByRef lpBytesReturned As Integer, ByVal lpOverlapped As Integer) As Integer 15: WriteFile
ByVal lpOverlapped As Long) As Long kernel3216: ConnectNamedPipe
[In] ref System.Threading.NativeOverlapped lpOverlapped); 17: CreateNamedPipe
FILE_FLAG_OVERLAPPED = 0x40000000,
IntPtr lpOverlapped // overlapped structure
private const UInt32 FILE_FLAG_OVERLAPPED = 0x40000000; 18: DeviceIoControl
[In] ref NativeOverlapped lpOverlapped);
[In] ref System.Threading.NativeOverlapped Overlapped
Shared Function DeviceIoControl(ByVal hDevice As IntPtr, ByVal dwIoControlCode As UInteger, ByVal lpInBuffer As IntPtr, ByVal nInBufferSize As UInteger, ByVal lpOutBuffer As IntPtr, ByVal nOutBufferSize As UInteger, ByRef lpBytesReturned As UInteger, ByVal lpOverlapped As IntPtr) As Boolean
<[In]()> ByRef lpOverlapped As NativeOverlapped) As Boolean
ByRef Overlapped As System.Threading.NativeOverlapped) As Boolean lpOverlapped - Main use in asynchronous deviceIoControl. NativeOverlapped is the managed version of the structure and use is the same. The difference between NativeOverlapped and Overlapped is managed Struct vs managed Class respectively. NativeOverlapped was more condusive for one-way device driver communication. Convert from Overlapped to NativeOverlapped to make the call, since NativeOverlapped is explicitly defined to mimic the unmanaged Overlapped structure. Pin your NativeOverlapped structure, DeviceIoControl is asynchronous and will write into the overlapped structure upon completion of IO requested. If you NativeOverlapped structure has been moved by garbage collection it will write into the wrong area causing heap corruption. If you want x64 proccessor support, you CANNOT use the System.Threading.NativeOverlapped structure as a ref parameter described above. The overlap structure must be allocated in global memory space. See the section "DeviceIoControl w/x64 support":
public bool DeviceIoControl( IntPtr hDevice, uint dwIoControlCode, ref long buffer, int bufferSize, ref NativeOverlapped pOverlapped)
return DeviceIoControl( hDevice, dwIoControlCode, ref buffer, bufferSize, ref buffer, bufferSize, ref NoReturn, ref pOverlapped );
private IntPtr mPtrOverlapped = IntPtr.Zero;
// Globally allocate the memory for the overlapped structure
mPtrOverlapped = Marshal.AllocHGlobal(Marshal.SizeOf(typeof (NativeOverlapped)));
// Find the structural starting positions in the NativeOverlapped structure.
/// The overlapped event wait handle.
/// Set the overlapped wait handle and clear out the rest of the structure.
if (mPtrOverlapped != IntPtr.Zero)
mPtrOverlapped = IntPtr.Zero;
DeviceIoOverlapped deviceIoOverlapped = new DeviceIoOverlapped(); The DeviceIoControl API must declare an IntPtr for the OVERLAPPED parameter. All other deviations are OK.
Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, ByRef lpInBuffer As IntPtr, ByVal nInBufferSize As Integer, ByRef lpOutBuffer As IntPtr, ByVal nOutBufferSize As Integer, ByRef lpBytesReturned As Integer, ByVal lpOverlapped As IntPtr) As Integer
Private Declare Ansi Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, ByVal lpInBuffer As Integer, ByVal nInBufferSize As Integer, ByRef lpOutBuffer As Integer, ByVal nOutBufferSize As Integer, ByRef lpBytesReturned As Integer, ByVal lpOverlapped As Integer) As Integer
Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, ByRef lpInBuffer As IntPtr, ByVal nInBufferSize As Integer, ByRef lpOutBuffer As DISK_GEOMETRY, ByVal nOutBufferSize As Integer, ByRef lpBytesReturned As Integer, ByVal lpOverlapped As IntPtr) As Integer
Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, ByRef lpInBuffer As IntPtr, ByVal nInBufferSize As Integer, ByRef lpOutBuffer As GETVERSIONOUTPARAMS, ByVal nOutBufferSize As Integer, ByRef lpBytesReturned As Integer, ByVal lpOverlapped As IntPtr) As Integer
Private Declare Function DeviceIoControl Lib "kernel32" (ByVal hDevice As Integer, ByVal dwIoControlCode As Integer, ByRef lpInBuffer As SENDCMDINPARAMS, ByVal nInBufferSize As Integer, ByRef lpOutBuffer As IntPtr, ByVal nOutBufferSize As Integer, ByRef lpBytesReturned As Integer, ByVal lpOverlapped As IntPtr) As Integer
[In] ref System.Threading.NativeOverlapped lpOverlapped, Private Shared Function GetOverlappedResult(ByVal hFile As IntPtr, <[In]()> ByRef lpOverlapped As System.Threading.NativeOverlapped, ByRef lpNumberOfBytesTransferred As UInteger, ByVal bWait As Boolean) As Boolean
NativeOverlapped lpOverlapped = new NativeOverlapped(); 20: LockFile
[In] ref System.Threading.NativeOverlapped lpOverlapped); 21: LockFileEx
[In] ref System.Threading.NativeOverlapped lpOverlapped);
[In] ref System.Threading.NativeOverlapped lpOverlapped); 23: ReadFile
[In] ref System.Threading.NativeOverlapped lpOverlapped); The documentation for the Scatter/Gather functions states that the buffer addresses used must be page aligned (not just storage aligned). Indeed, passing a managed allocation, such as a byte array, causes error 87 (Invalid Parameter). This function is asynchronous only so an use the AsyncResult and Overlapped pattern established by the FileStream. 24: ReadFileEx
uint nNumberOfBytesToRead, [In] ref System.Threading.NativeOverlapped lpOverlapped, 25: ReadFileScatter
[In] ref System.Threading.NativeOverlapped lpOverlapped);
Overlapped = 0x40000000, 27: UnlockFile
[In] ref System.Threading.NativeOverlapped lpOverlapped); 28: WriteFile
[In] ref System.Threading.NativeOverlapped lpOverlapped); The documentation for the Scatter/Gather functions states that the buffer addresses used must be page aligned (not just storage aligned). Indeed, passing a managed allocation, such as a byte array, causes error 87 (Invalid Parameter). This function is asynchronous only so an use the AsyncResult and Overlapped pattern established by the FileStream. 29: WriteFileEx
uint nNumberOfBytesToWrite, [In] ref System.Threading.NativeOverlapped lpOverlapped,
UInt32 dwNumberOfBytesTransfered, ref NativeOverlapped lpOverlapped);
uint nNumberOfBytesToWrite, [In] ref NativeOverlapped lpOverlapped,
NativeOverlapped ol = new NativeOverlapped();
private static void callback(UInt32 dwErrorCode, UInt32 dwNumberOfBytesTransfered, ref NativeOverlapped lpOverlapped) 30: WriteFileGather
[In] ref System.Threading.NativeOverlapped lpOverlapped); The documentation for the Scatter/Gather functions states that the buffer addresses used must be page aligned (not just storage aligned). Indeed, passing a managed allocation, such as a byte array, causes error 87 (Invalid Parameter). This function is asynchronous only so an use the AsyncResult and Overlapped pattern established by the FileStream. |