Does Win32 API use 64 bit length pointers on 64 bit system ?

Diakov Dmytro 1 Reputation point

I have Win32 API (cloud filter api). On Windows 10 x64 it does not work when I create x64 app and pass IntPtr to it's function . (I have access violation memory exception).
But when I build x86 app and use IntPtr with 32 length it works.
So my question is: win32 api is 32 bitness API and can work only with pointers with 32 bits length, is it true ?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,511 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. David Lowndes 4,711 Reputation points

    On 64-bit Windows (with a 64-bit application), pointers are 64-bit.
    You'll have to give some more details about what you're doing. Presumably there's something amiss somewhere.

  2. RLWA32 43,046 Reputation points

    Make sure that your managed code is actually running as 64-bit code. An IntPtr is 32-bits in 32-bit code and 64-bits in 64-bit code.

    Check to make sure that you are not building managed code for AnyCpu with prefer 32-bits selected.

  3. RLWA32 43,046 Reputation points

    An access violation can result for any number of reasons. Chances are that there is a problem in the code that is exposed when building for x64.

  4. Rita Han - MSFT 2,161 Reputation points

    Hello @Diakov Dmytro ,

    CfExecute API works well with 64 bit length pointers on 64 bit system in C++. You can test official sample: CloudMirror and get pointer size using sizeof(). The following snapshot shows an example and its result.


    Thank you!

    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.