473,806 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

About Winscard SCardConnect!

Hi there,

I had 2 questions.

In SCardConnect function in Winscard.h:

extern WINSCARDAPI LONG WINAPI
SCardConnectA(
IN SCARDCONTEXT hContext,
IN LPCSTR szReader,
IN DWORD dwShareMode,
IN DWORD dwPreferredProt ocols,
OUT LPSCARDHANDLE phCard,
OUT LPDWORD pdwActiveProtoc ol);

How do we simulate IN and OUT in C#? I know you can simulate either this:

out keyword

or

[In] attribute

or

[Out] attribute

But there is no In keyword?

And i used DWORD in C# as System.UInt32. I hope it is a right conversion.

[DllImport("wins card.dll", SetLastError=tr ue)]
private static extern int SCardConnectA(U Int32 hContext, String szReader,
UInt32 dwShareMode, UInt32 dwPreferredProt ocols, out UInt32 phCard, out
UInt32 pdwActiveProtoc ol);

Please correct me if i am wrong.

2)

I had some confusion when to use SCardConnectA or SCardConnectW. Unicode and
non unicode, does it makes difference? Can anyone elaborate please?

Below are the codes extracted from Winscard.h:

extern WINSCARDAPI LONG WINAPI
SCardConnectA(
IN SCARDCONTEXT hContext,
IN LPCSTR szReader,
IN DWORD dwShareMode,
IN DWORD dwPreferredProt ocols,
OUT LPSCARDHANDLE phCard,
OUT LPDWORD pdwActiveProtoc ol);
extern WINSCARDAPI LONG WINAPI
SCardConnectW(
IN SCARDCONTEXT hContext,
IN LPCWSTR szReader,
IN DWORD dwShareMode,
IN DWORD dwPreferredProt ocols,
OUT LPSCARDHANDLE phCard,
OUT LPDWORD pdwActiveProtoc ol);
#ifdef UNICODE
#define SCardConnect SCardConnectW
#else
#define SCardConnect SCardConnectA
#endif // !UNICODE

Thanks.
--
Regards,
Chua Wen Ching :)
Nov 16 '05 #1
0 5841

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2861
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew story is so funny that eScrew will have to take break from time to time because eScrew needs some rest from laughing. Oh boy, here it comes... eScrew funny laugh laughing screaming crying must stop can not take any more this is killing eScrew...
220
19201
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have any preconceived ideas about it. I have noticed, however, that every programmer I talk to who's aware of Python is also talking about Ruby. So it seems that Ruby has the potential to compete with and displace Python. I'm curious on what basis it...
8
2467
by: eScrewDotCom | last post by:
eScrew Welcome to eScrew! eScrew is eScrew and this is eScrew story. eScrew will tell you eScrew story if you promise eScrew to consider eScrew story as joke. eScrew story is very funny. eScrew story is so funny that eScrew will have to take break from time to time because eScrew needs some rest from laughing. Oh boy, here it comes... eScrew funny laugh laughing screaming crying must stop can not take any more this is killing eScrew...
0
1895
by: Ray | last post by:
I am having a problem with issuing commands to my smartcard, I converted the call to SCardTransmit as follows: public static extern uint SCardTransmit( uint hCard, byte pioSendPci, byte pbSendBuffer,
0
7526
by: Ramazzotti... | last post by:
Hi All i am using Asp.net2.0, C#, VS2005 and i am using winscrsd.dll, ScardTransmit. i have this error no. = 2148532228 in return, so please i need your help. thank you in advance. this is the code i wrote: int pContextHandle;
0
2400
by: DavidL | last post by:
Error Code meaning in Winscard.dll functions? I am using the SCardTransmit function from winscard and getting errors back like: 0x00000006 0x0000054f 0x0000045d I can not find the definition of these error code. Scarderr.h () does not seem to have it, nor from MSDN.
0
1319
by: amitgoel25aug | last post by:
Hi All, I am trying to take a certificate (smart card logon certificate) via "Microsoft Base Smart Card Crypto Provider" by using the sc mini driver (CardModule). If the context is acquired by the "Microsoft Base Smart Card Crypto Provider" and some other application try to call SCardConnect, it gets blocked inside it. It neither returns error nor success. If i remove the token/smart card, SCardConnect returns with an error.
0
1643
by: nieve | last post by:
Hello all, I'm working on a c# application using smart cards. I've been using vs2008 on an XP machine and everything was ok till I tried installing and running a demo on a vista machine. What happens is that when I get to call this method: public static extern int SCardListReaderGroups(int hContext, ref string cGroups, ref int nStringSize); I get the "Attempted to read or write protected memory" exception. I've tried editbin.exe...
2
5800
by: John Whitworth | last post by:
Hi, I'm rewriting an old VB6 app of mine in VB2008. All has been going well with calls to winscard.dll, until I needed to send an array of bytes as part of a structure. When using a winscard trace, I can see that the bytes in the array suddenly become nonsense, whereas I know that what I called the DLL with was good. I think I need to do something along the lines of MarshalAs, but I haven't the first clue where to start. Any...
0
10623
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5683
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.