equal
deleted
inserted
replaced
106 } |
106 } |
107 |
107 |
108 JNIEXPORT jlong JNICALL Java_sun_security_smartcardio_PCSC_SCardEstablishContext |
108 JNIEXPORT jlong JNICALL Java_sun_security_smartcardio_PCSC_SCardEstablishContext |
109 (JNIEnv *env, jclass thisClass, jint dwScope) |
109 (JNIEnv *env, jclass thisClass, jint dwScope) |
110 { |
110 { |
111 SCARDCONTEXT context; |
111 SCARDCONTEXT context = 0; |
112 LONG rv; |
112 LONG rv; |
113 dprintf("-establishContext\n"); |
113 dprintf("-establishContext\n"); |
114 rv = CALL_SCardEstablishContext(dwScope, NULL, NULL, &context); |
114 rv = CALL_SCardEstablishContext(dwScope, NULL, NULL, &context); |
115 if (handleRV(env, rv)) { |
115 if (handleRV(env, rv)) { |
116 return 0; |
116 return 0; |
178 (JNIEnv *env, jclass thisClass, jlong jContext) |
178 (JNIEnv *env, jclass thisClass, jlong jContext) |
179 { |
179 { |
180 SCARDCONTEXT context = (SCARDCONTEXT)jContext; |
180 SCARDCONTEXT context = (SCARDCONTEXT)jContext; |
181 LONG rv; |
181 LONG rv; |
182 LPTSTR mszReaders; |
182 LPTSTR mszReaders; |
183 DWORD size; |
183 DWORD size = 0; |
184 jobjectArray result; |
184 jobjectArray result; |
185 |
185 |
186 dprintf1("-context: %x\n", context); |
186 dprintf1("-context: %x\n", context); |
187 rv = CALL_SCardListReaders(context, NULL, NULL, &size); |
187 rv = CALL_SCardListReaders(context, NULL, NULL, &size); |
188 if (handleRV(env, rv)) { |
188 if (handleRV(env, rv)) { |
213 jint jShareMode, jint jPreferredProtocols) |
213 jint jShareMode, jint jPreferredProtocols) |
214 { |
214 { |
215 SCARDCONTEXT context = (SCARDCONTEXT)jContext; |
215 SCARDCONTEXT context = (SCARDCONTEXT)jContext; |
216 LONG rv; |
216 LONG rv; |
217 LPCTSTR readerName; |
217 LPCTSTR readerName; |
218 SCARDHANDLE card; |
218 SCARDHANDLE card = 0; |
219 DWORD proto; |
219 DWORD proto = 0; |
220 |
220 |
221 readerName = (*env)->GetStringUTFChars(env, jReaderName, NULL); |
221 readerName = (*env)->GetStringUTFChars(env, jReaderName, NULL); |
222 if (readerName == NULL) { |
222 if (readerName == NULL) { |
223 return 0; |
223 return 0; |
224 } |
224 } |
278 LONG rv; |
278 LONG rv; |
279 char readerName[READERNAME_BUFFER_SIZE]; |
279 char readerName[READERNAME_BUFFER_SIZE]; |
280 DWORD readerLen = READERNAME_BUFFER_SIZE; |
280 DWORD readerLen = READERNAME_BUFFER_SIZE; |
281 unsigned char atr[ATR_BUFFER_SIZE]; |
281 unsigned char atr[ATR_BUFFER_SIZE]; |
282 DWORD atrLen = ATR_BUFFER_SIZE; |
282 DWORD atrLen = ATR_BUFFER_SIZE; |
283 DWORD state; |
283 DWORD state = 0; |
284 DWORD protocol; |
284 DWORD protocol = 0; |
285 jbyteArray jArray; |
285 jbyteArray jArray; |
286 jbyte status[2]; |
286 jbyte status[2]; |
287 |
287 |
288 rv = CALL_SCardStatus(card, readerName, &readerLen, &state, &protocol, atr, &atrLen); |
288 rv = CALL_SCardStatus(card, readerName, &readerLen, &state, &protocol, atr, &atrLen); |
289 if (handleRV(env, rv)) { |
289 if (handleRV(env, rv)) { |