ybouan Posted December 28, 2007 Share Posted December 28, 2007 I am trying to get a list of smartcard readers on my machine using winscard.dll's scardlistreaders (http://msdn2.microsoft.com/en-us/library/aa379793.aspx) LONG SCardListReaders( __in SCARDCONTEXT hContext, __in LPCTSTR mszGroups, __out LPTSTR mszReaders, __inout LPDWORD pcchReaders ); with mszReaders being a "Multi-string that lists the card readers within the supplied reader groups. If this value is NULL, SCardListReaders ignores the buffer length supplied in pcchReaders, writes the length of the buffer that would have been returned if this parameter had not been NULL to pcchReaders, and returns a success code." In the result to my call I do have the first reader in $result[3] but I can't get the rest of the list... In my arguments to the dllcall I set the type for mszReaders to "str". I tried "str*" or "ptr" but those don't give anything back. In VB this would be defined as "String * 256" for example (256 may be a little exaggerated for a count of readers on my machine :-) ). Thanks for helping my find my lost data. Link to comment Share on other sites More sharing options...
therks Posted December 28, 2007 Share Posted December 28, 2007 Could we see the AutoIt code you have used so far? My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
ybouan Posted December 28, 2007 Author Share Posted December 28, 2007 Here is my code. You can ignore the declarations at the top since dllstruct seems to ignore them: Global Const $SCARD_SCOPE_USER = 0 Dim $hContext Dim $pcchReaders = 227 Dim $szReaderList = DllStructCreate ( "char var1[256];char var2[256];char var3[256];char var4[256]") Dim $mzGroup = "" $dll = DllOpen("WinScard.dll") if @error Then MsgBox(0,"1","Fail Load") $result = DllCall($dll, "long", "SCardEstablishContext","long",$SCARD_SCOPE_USER,"long",0,"long",0,"long*",$hContext) if @error Then MsgBox(0,"2","Fail" & @error & $hContext & $result) DllClose($dll) Exit EndIf ;MsgBox(0,"2","Success " & $result[4] & $hContext) _ArrayDisplay($result) $result = DllCall($dll, "lparam", "SCardListReaders","long",$result[4],"str",$mzGroup,"str",$szReaderList,"long*",$pcchReaders) if @error Then MsgBox(0,"3","Fail" & $pcchReaders & $result) DllClose($dll) Exit EndIf ;MsgBox(0,"3","Success " & $result[3] & $result[4] & $pcchReaders & $szReaderList[1]) _ArrayDisplay($result) DllClose($dll) Link to comment Share on other sites More sharing options...
ybouan Posted January 3, 2008 Author Share Posted January 3, 2008 ...Bump... Any ideas on this? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now