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

rpcrt4

.

private static extern int UuidToString(ref UUID uuid, ref System.IntPtr str);

.

private static extern int RpcStringFree(ref System.IntPtr str);

.

     System.IntPtr str = new System.IntPtr();

.
System

Enums

.

        IntPtr outputBuffer,

.

        IntPtr deviceMode);

.

        int nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_DUPLEX, IntPtr.Zero, (IntPtr)null);

.

        nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_COLORDEVICE,    IntPtr.Zero, (IntPtr)null);

.

        int nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_BINS, (IntPtr)null, (IntPtr)null);

.

        IntPtr pAddr = Marshal.AllocHGlobal((int)nRes * 2);

.

        nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_BINS, pAddr, (IntPtr)null);

.

            BinNr.Add( Marshal.ReadInt16(new IntPtr(offset + i * 2)));

.

        nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_BINNAMES, (IntPtr)null, (IntPtr)null);

.

        nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_BINNAMES, pAddr, (IntPtr)null);

.

            BinName.Add(Marshal.PtrToStringAnsi(new IntPtr(offset + i * 24)));

.

    int nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_DUPLEX, IntPtr.Zero, (IntPtr)null);

.

    nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_COLORDEVICE,    IntPtr.Zero, (IntPtr)null);

.

    int nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_BINS, (IntPtr)null, (IntPtr)null);

.

    IntPtr pAddr = Marshal.AllocHGlobal((int)nRes * 2);

.

    nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_BINS, pAddr, (IntPtr)null);

.

        BinNr.Add( Marshal.ReadInt16(new IntPtr(offset + i * 2)));

.

    nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_BINNAMES, (IntPtr)null, (IntPtr)null);

.

    nRes = DeviceCapabilities(strDeviceName, strPort, DeviceCapabilitiesFlags.DC_BINNAMES, pAddr, (IntPtr)null);

.

        BinName.Add(Marshal.PtrToStringAnsi(new IntPtr(offset + i * 24)));

.

public static extern int DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attr, ref int attrValue, int attrSize);

.

Public Shared Function DwmSetWindowAttribute(hwnd As IntPtr, attr As DWMWINDOWATTRIBUTE, ByRef attrValue As Integer, attrSize As Integer) As Integer

.

        public IntPtr Sid;

.

        private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);

.

        private static extern bool InsertMenu (IntPtr hMenu, Int32 wPosition, Int32 wFlags, Int32 wIDNewItem, string lpNewItem);

.

            IntPtr sysMenuHandle = GetSystemMenu(this.Handle, false);

ntdll

.

static extern int NtClose(IntPtr hObject);

.

  Public Shared Function NtClose(ByVal hObject As IntPtr) As Integer

.

public static extern int NtCreateFile(out SafeFileHandle handle, FileAccess access, OBJECT_ATTRIBUTES* objectAttributes, IO_STATUS_BLOCK* ioStatus, ref long allocSize, uint fileAttributes, FileShare share, uint createDisposition, uint createOptions, IntPtr eaBuffer, uint eaLength);

.

        IntPtr eaBuffer,

.

   public IntPtr information;

.

   public IntPtr RootDirectory;

.

   public IntPtr ObjectName;

.

   public IntPtr SecurityDescriptor;

.

   public IntPtr SecurityQualityOfService;

.

    public IntPtr Buffer;

.

IntPtr _RootHandle; //This will need to be initialized with the root handle, can use CreateFile from kernel32.dll

.

IntPtr buffer = Marshal.AllocHGlobal(4096);

.

IntPtr refPtr = Marshal.AllocHGlobal(8);

.

IntPtr objAttIntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(objAttributes));

.

objAttributes.ObjectName = objAttIntPtr;

.

objAttributes.SecurityDescriptor = IntPtr.Zero;

.

objAttributes.SecurityQualityOfService = IntPtr.Zero;

.

                IntPtr.Zero, System.Convert.ToUInt32(0));

.

<DllImport("ntdll")> Private Shared Function NtGetContextThread(ByVal hThr As IntPtr, ByVal CNTXT As UInteger()) As <MarshalAs(UnmanagedType.Bool)> Boolean

.

   IntPtr Buffer,

.

[DllImport("ntdll.dll", SetLastError=true)] static extern IntPtr NtQueryInformationFile(IntPtr fileHandle, ref IO_STATUS_BLOCK IoStatusBlock, IntPtr pInfoBlock, uint length, FILE_INFORMATION_CLASS fileInformation);

.

Declare Function NtQueryInformationFile Lib "ntdll.dll" (ByVal fileHandle As IntPtr, ByRef IoStatusBlock As IO_STATUS_BLOCK, ByVal pInfoBlock As IntPtr, ByVal length As UInteger, ByVal fileInformation As FILE_INFORMATION_CLASS) As IntPtr

.

    static extern IntPtr NtQueryInformationFile(SafeFileHandle fileHandle, ref IO_STATUS_BLOCK IoStatusBlock, IntPtr pInfoBlock, uint length, FILE_INFORMATION_CLASS fileInformation);

.

        IntPtr p_fbi = IntPtr.Zero;

.

                IntPtr iprc = NtQueryInformationFile(fs.SafeFileHandle, ref iosb, p_fbi, (uint)Marshal.SizeOf(fbi), FILE_INFORMATION_CLASS.FileBasicInformation);

.

                brc = iprc == IntPtr.Zero && iosb.status == 0;

.

            if(p_fbi != IntPtr.Zero) { Marshal.FreeHGlobal(p_fbi); }

.

static extern int NtQueryInformationProcess(IntPtr processHandle,

.

   int processInformationClass, IntPtr processInformation, uint processInformationLength,

.

   IntPtr returnLength);

.

static extern int NtQueryInformationProcess(IntPtr hProcess, PROCESSINFOCLASS pic,

.

   processHandle As IntPtr, processInformationClass As Integer, _

.

   processInformation As IntPtr, processInformationLength As Integer, _

.

   returnLength As IntPtr) As Integer

.

    public static IntPtr GetPEBAddress()

.

        IntPtr hProc = OpenProcess(0x001F0FFF, false, Process.GetCurrentProcess().Id);

.

        IntPtr pbi = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(PROCESS_BASIC_INFORMATION)));

.

        IntPtr outLong = Marshal.AllocHGlobal(sizeof(long));

.

        IntPtr outPtr = IntPtr.Zero;

.

        IntPtr hProc = OpenProcess((ProcessAccessFlags)0x001F0FFF, false, Process.GetCurrentProcess().Id);

.

            if (!hProc.Equals(IntPtr.Zero))

.

            hProc = IntPtr.Zero;

.

public static extern NtStatus NtQueryObject(IntPtr objectHandle, OBJECT_INFORMATION_CLASS informationClass, IntPtr informationPtr, uint informationLength, ref uint returnLength);

.

public static IntPtr NtQueryObject(IntPtr handle, OBJECT_INFORMATION_CLASS infoClass, uint infoLength = 0)

.

    IntPtr infoPtr = Marshal.AllocHGlobal((int)infoLength);

.

    return IntPtr.Zero;

.

public static extern NtStatus NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS InfoClass, IntPtr Info, uint Size, out uint Length);

.

public static IntPtr NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS infoClass, uint infoLength = 0)

.

            return IntPtr.Zero;

.

            return IntPtr.Zero;

.

    IntPtr

.

public static extern IntPtr NtResumeProcess(IntPtr ProcessHandle);

.

    Public Shared Function NtResumeProcess(ByVal ProcessHandle As IntPtr) As IntPtr

.

static extern UInt32 NtSetSystemInformation(NtSystemInformation.SYSTEM_INFORMATION_CLASS InfoClass, IntPtr Info, UInt32 Length);

.

public static void SetSystemInformation(NtSystemInformation.SYSTEM_INFORMATION_CLASS InfoClass, IntPtr Info, UInt32 Length)

.

public static extern IntPtr NtSuspendProcess(IntPtr ProcessHandle);

.

    Public Shared Function NtSuspendProcess(ByVal ProcessHandle As IntPtr) As IntPtr

.

<DllImport("ntdll")> Private Shared Function NtUnmapViewOfSection(ByVal hProc As IntPtr, ByVal baseAddr As IntPtr) As UInteger

.

    public static extern IntPtr RtlAdjustPrivilege(int Privilege, bool bEnablePrivilege,

.

Public Declare Function RtlAdjustPrivilege Lib "ntdll.dll" (ByVal Privilege As Integer, ByVal bEnablePrivilege As Boolean, ByVal IsThreadPrivilege As Boolean, ByRef PreviousValue As Boolean) As IntPtr

.

    IntPtr

.

public static extern IntPtr ZwClose(IntPtr handle);

.

Declare Sub ZwClose Lib "ntdll.dll" (Handle As Intptr)

.

public static extern IntPtr ZwOpenSection(

.

      out IntPtr sectionHandle, uint desiredAccess, ref OBJECT_ATTRIBUTES attributes);

wintrust

.

For .NET versions prior to 2.0, replace SafeFileHandle with IntPtr

.

SafeFileHandle invalidHandle = new SafeFileHandle(new IntPtr(-1), true);

.

     [In] IntPtr hwnd,

.

        IntPtr pszFilePath;                     // required, file name to be verified

.

        IntPtr hFile = IntPtr.Zero;             // optional, open handle to FilePath

.

        IntPtr pgKnownSubject = IntPtr.Zero;    // optional, subject type if it is known

.

        IntPtr PolicyCallbackData = IntPtr.Zero;

.

        IntPtr SIPClientData = IntPtr.Zero;

.

        IntPtr FileInfoPtr;

.

        IntPtr StateData = IntPtr.Zero;

.

        private static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1);

.

            [In] IntPtr hwnd,

msvcrt

25: fclose
.

public static extern Int32 fclose(IntPtr stream);

.

Public Shared Function fclose(ByVal stream As IntPtr) As Int32

26: fopen
.

public static extern Int32 fopen_s(out IntPtr pFile, String filename, String mode);

.

public static extern Int32 _wfopen_s(out IntPtr pFile, String filename, String mode);

.

Public Shared Function fopen_s(ByRef pFile As IntPtr, ByVal filename As String, ByVal mode As String) As Int32

.

Public Shared Function _wfopen_s(ByRef pFile As IntPtr, ByVal filename As String, ByVal mode As String) As Int32

.

IntPtr file;

.

IntPtr file;

.

Declare Function freopen Lib "msvcrt.dll" (ByVal filename As String, ByVal mode As String, ByVal stream As IntPtr) As IntPtr

28: fwrite
.

static extern IntPtr fwrite(byte[] buffer, IntPtr size, IntPtr number, IntPtr file);

.

Declare Function fwrite Lib "msvcrt.dll" (byte[] buffer, IntPtr size, IntPtr number, IntPtr file) As IntPtr

29: memcmp
.

static extern int memcmp(byte[] b1, byte[] b2, UIntPtr count);

.
WARNING
.

   private static extern int memcmp(byte[] b1, byte[] b2, UIntPtr count);

.

      return memcmp(b1, b2, new UIntPtr((uint)b1.Length)) == 0;

30: memcpy
.

public static extern IntPtr memcpy(IntPtr dest, IntPtr src, UIntPtr count);

.

    Public Shared Sub CopyMemory(ByVal dest As IntPtr, ByVal src As IntPtr, ByVal count As Integer)

.

    Dim pnt1 As IntPtr = Marshal.AllocHGlobal(size)

.

    Dim pnt2 As IntPtr = Marshal.AllocHGlobal(size)

.

        memcpy(dstData.Scan0, srcData.Scan0, new UIntPtr((uint)height * (uint)srcData.Stride));

.

static extern IntPtr memmove(IntPtr dest, IntPtr src, UIntPtr count);

32: memset
.

public static extern IntPtr MemSet(IntPtr dest, int c, int byteCount);

.

Public Shared Function MemSet(dest As IntPtr, c As Integer, byteCount As Integer) As IntPtr

33: _spawn
.

static extern IntPtr _wspawnl(

.

    static extern IntPtr _wspawnl(

comctl32

.

static extern IntPtr CreatePropertySheetPage(ref PROPSHEETPAGE psp);

.

Declare Function CreatePropertySheetPage Lib "comctl32" (ByRef PROPSHEETPAGE) As IntPtr

.

static extern int DestroyPropertySheetPage(IntPtr hPage);

.

Private Shared Function DestroyPropertySheetPage(ByVal hPage As IntPtr) As Integer

.

        Dim hwnd As IntPtr

.

        Dim prc As IntPtr

.

        Dim lParam As IntPtr

.

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

.

        SetReaderModeInfo.lParam = IntPtr.Zero

.

    Public Shared Function GetScrollPos(ByVal hWnd As IntPtr, ByVal nBar As Integer) As Integer

.

    Private Shared Function SetScrollPos(ByVal hWnd As IntPtr, ByVal nBar As Integer, ByVal nPos As Integer, ByVal bRedraw As Boolean) As Integer

.

static extern bool ImageList_AddMasked(IntPtr hImageList, IntPtr hBitmap, int crMask);

.

Private Shared Function ImageList_AddMasked(hImageList As IntPtr, hBitmap As IntPtr, crMask As Integer) As Boolean

.

static extern bool ImageList_AddMasked(IntPtr hImageList, IntPtr hBitmap, int crMask);

.

internal static extern bool ImageList_BeginDrag(IntPtr himlTrack, int iTrack, int dxHotspot, int dyHotspot);

.

Friend Shared Function ImageList_BeginDrag(himlTrack As IntPtr, iTrack As Integer, dxHotspot As Integer, dyHotspot As Integer) As <MarshalAs(UnmanagedType.Bool)> Boolean

.

static extern IntPtr ImageList_Create(int cx, int cy, uint flags, int cInitial, int cGrow);

.

Declare Function ImageList_Add Lib "comctl32.dll" (ByVal cx As Integer, ByVal cy As Integer, ByVal flags As uint, ByVal cInitial as Integer, ByVal cGrow as Integer) As IntPtr

.

internal static extern bool ImageList_DragEnter(IntPtr hwndLock, int x, int y);

.

Friend Shared Function ImageList_DragEnter(hwndLock As IntPtr, x As Integer, y As Integer) As <MarshalAs(UnmanagedType.Bool)> Boolean

.

internal static extern bool ImageList_DragLeave(IntPtr hwndLock);

.

Friend Shared Function ImageList_DragLeave(hwndLock As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean

.

static extern bool ImageList_DrawEx(IntPtr himl, int i, IntPtr hdcDst, int x, int y, int dx, int dy, int rgbBk, int rgbFg, int fStyle);

.

Private Shared Function ImageList_DrawEx(himl As IntPtr, i As Integer, hdcDst As IntPtr, x As Integer, y As Integer, dx As Integer, _

.

       public extern static bool ImageList_SetOverlayImage(IntPtr himl, int iImage, int iOverlay);

.

       public extern static bool ImageList_DrawEx(IntPtr himl, int i, IntPtr hdcDst, int x, int y, int dx, int dy, uint rgbBk, uint rgbFg, ImageListDrawingStyle fStyle);

.

static extern IntPtr ImageList_Duplicate(IntPtr original);

.

Declare Function ImageList_Duplicate Lib "comctl32.dll" (IntPtr ) As IntPtr

.

Private Shared Function ImageList_Duplicate(original As IntPtr) As IntPtr

.

static extern bool ImageList_GetIconSize(IntPtr himl, out int cx, out int cy);

.

Private Shared Function ImageList_GetIconSize(himl As IntPtr, ByRef cx As Integer, ByRef cy As Integer) As Boolean

.

static extern bool ImageList_GetIconSize(IntPtr himl, out int cx, out int cy);

.

static extern bool ImageList_SetIconSize(IntPtr hImageList, int cx, int cy);

.

Declare Function ImageList_SetIconSize Lib "comctl32.dll" (ByVal hImageList As IntPtr, ByVal cx As Integer, ByVal cy As Integer) As Boolean

.

static extern bool ImageList_SetOverlayImage(IntPtr hImageList, int iImage, int iOverlay);

.

Private Shared Function ImageList_SetOverlayImage(hImageList As IntPtr, iImage As Integer, iOverlay As Integer) As Boolean

.

       public extern static bool ImageList_SetOverlayImage(IntPtr himl, int iImage, int iOverlay);

.

       public extern static bool ImageList_DrawEx(IntPtr himl, int i, IntPtr hdcDst, int x, int y, int dx, int dy, uint rgbBk, uint rgbFg, ImageListDrawingStyle fStyle);

.

    public static extern IntPtr TaskDialogIndirect

.

        public IntPtr hwndParent;

.

        public IntPtr hInstance;

.

        public IntPtr hMainIcon;

.

        public IntPtr pButtons;

.

        public IntPtr pRadioButtons;

.

        public IntPtr hFooterIcon;

.

        public IntPtr lpCallbackData;

.

    public static extern IntPtr TaskDialogIndirect

.

        public IntPtr hwndParent;

.

        public IntPtr hInstance;

.

        public IntPtr hMainIcon;

.

        public IntPtr pButtons;

.

        public IntPtr pRadioButtons;

.

        public IntPtr hFooterIcon;

.

        public IntPtr lpCallbackData;

msdrm

.

   <Out()> ByRef phClient As IntPtr) As IntPtr

.

static extern IntPtr DRMRegisterContent(bool fRegister);

misc

.

Things like RegisterWindowClass and GetClassInfo using the WNDCLASS structure in different ways requires creating separate structures with different field types in order to satisfy the marshaller (The WndProc pointer as a raw IntPtr in some cases, or as a method pointer in other cases). I can see that the params for GetClassInfo and RegisterWindowClass do take different structure types, but those types do not appear to be documented here.

.

public static bool CPAcquireContext(out IntPtr phProv, StringBuilder pszContainer, uint dwFlags, byte[] pVTable){

.

private static extern bool CPAcquireContextCe(out IntPtr phProv, StringBuilder pszContainer, uint dwFlags, byte[] pVTable);

.

private static extern bool CPAcquireContextXp(out IntPtr phProv, StringBuilder pszContainer, uint dwFlags, byte[] pVTable);

.

    public static extern long GetPackageFamilyName(IntPtr hProcess, ref uint packageFamilyNameLength, StringBuilder packageFamilyName);

.

    static extern int GetPackageFullName(IntPtr hProcess, ref UInt32 packageFullNameLength, StringBuilder fullName);

54: FAQ
.
Question
Why use IntPtr in PInvoke signatures when int (Integer) works just fine?
.

For pointer-sized entities such as handles, they must be defined such that they will be 32 bits on a 32-bit machine and 64 bits on a 64-bit machine. IntPtr (or UIntPtr) accomplishes this. The use of int will appear to be fine if you only run the code on a 32-bit machine, but will likely cause your application/component to crash as soon as it gets on a 64-bit machine.

Interfaces

.

     int AddDesktopItemWithUI(IntPtr hwnd, ref COMPONENT pcomp, DtiAddUI dwFlags);

.

     int GetDesktopItemByID(IntPtr dwID, ref COMPONENT pcomp, int dwReserved);

.

     int AddUrl(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)] string pszSource, ref COMPONENT pcomp, AddURL dwFlags);

.

    Function AddDesktopItemWithUI(ByVal hwnd As IntPtr, ByRef pcomp As COMPONENT, ByVal dwFlags As DtiAddUI) As Integer

.

    Function GetDesktopItemByID(ByVal dwID As IntPtr, ByRef pcomp As COMPONENT, ByVal dwReserved As Integer) As Integer

.

    Function AddUrl(ByVal hwnd As IntPtr, <MarshalAs(UnmanagedType.LPWStr)> ByVal pszSource As String, ByRef pcomp As COMPONENT, ByVal dwFlags As AddURL) As Integer

56: IADs
.

IntPtr fetched = IntPtr.Zero;

.

IntPtr fetched = IntPtr.Zero;

.

   void Authenticate(IntPtr phwnd,

.

   Sub Authenticate(IntPtr phwnd,

.

    URLDownloadToFile(IntPtr.Zero, SourcePath , LocalPath ,0,(IBindStatusCallback)this);

.

    public void Authenticate(IntPtr phwnd, ref string pszUsername, ref string pszPassword)

.

        phwnd = IntPtr.Zero;

.

        IntPtr hwndEdit,

.

        public IntPtr ptd;

.

        public IntPtr data;

.

                    URLDownloadToFile(IntPtr.Zero, SourcePath , LocalPath ,0,(IBindStatusCallback)this);//use 0x10 for new download

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


 
Access PInvoke.net directly from VS: