First of all, proceed to download the MyKad Reader Application Source Code (VB.NET) for 32-bit from:
The code is meant for 32-bit platform - it is compatible with Visual Studio 2008 onwards.
To support 64-bit platform, a few modifications are required.
The idea is to change all Handle type parameters to IntPtr instead of Int32
Refer to the following image for illustration:
Is that simple, save it and recompile.
I have tested this code and it supports HID Omnikey 3121 smart card reader on Windows 10 Pro 64-bit.
Why IntPtr ?
Refer to the following knowledgebase from Microsoft, it was quoted that:
Making all data types 64 bits in length would waste space, because most applications do not need the increased size. However, applications do need pointers to 64-bit data, and they need the ability to have 64-bit data types in selected cases. These considerations led the Windows team to select an abstract data model called LLP64 (or P64). In the LLP64 data model, only pointers expand to 64 bits; all other basic data types (integer and long) remain 32 bits in length.
The .NET CLR for 64-bit platforms uses the same LLP64 abstract data model. In .NET there is an integral data type, not widely known, that is specifically designated to hold 'pointer' information: IntPtr whose size is dependent on the platform (e.g., 32-bit or 64-bit) it is running on.
Other relevant discussion threads found in the Internet:
1.) Using the code targeting 32-bit on 64-bit platform, the scardconnect will returns 6 instead of zero.
3.) Using OpenSC library.
Dedicated to the spirit of open source and open society - happy coding !!!