Click here to Skip to main content
12,078,370 members (50,378 online)
Click here to Skip to main content

Stats

149.1K views
6.2K downloads
87 bookmarked
Posted

An UMDF Driver for a Virtual Smart Card Reader

, 30 Jan 2014 CPOL
A simple implementation of a driver for a virtual smart card reader, based on UMDF
BixVReader.zip
exports.def
Win7_x64
WinXP_x86
Win7_x86
Win7
WinXP
BixVReader.inx
makefile
sources
BixVReader.inx
makefile
sources
BixVReader.dll
BixVReader.inf
BixVReader.dll
BixVReader.inf
BixVReader.dll
BixVReader.inf
#pragma once

#include <windows.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlstr.h>

//__user_driver;  // Macro letting the compiler know this is not a kernel driver (this will help surpress needless warnings)

// Common WPD and WUDF headers

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#endif

#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p)     {if ((p)) { (p)->Release(); (p) = NULL; }}
#endif

#define STATUS_SUCCESS                          ((NTSTATUS)0x00000000L) // ntsubauth
#define STATUS_NO_MEDIA							((NTSTATUS)0xC0000178L) 
#define STATUS_INVALID_DEVICE_STATE				((NTSTATUS)0xC0000184L)


//
// Include the WUDF DDI 
//
#include <devioctl.h>
#include <initguid.h>
#include <propkeydef.h>
#include <propvarutil.h>
#include "PortableDeviceTypes.h"
#include "PortableDeviceClassExtension.h"
#include "PortableDevice.h"

#include "wudfddi.h"

//
// Use specstrings for in/out annotation of function parameters.
//

#include "specstrings.h"

//
// Forward definitions of classes in the other header files.
//

typedef class CMyDriver *PCMyDriver;
typedef class CMyDevice *PCMyDevice;

//
DEFINE_GUID(SmartCardReaderGuid, 0x50DD5230, 0xBA8A, 0x11D1, 0xBF,0x5D,0x00,0x00,0xF8,0x05,0xF5,0x30);
//
// Include the type specific headers.
//

class funcTrace {
public:
	wchar_t funcN[500];
	funcTrace (char *func) {
		wchar_t funcName[500];
		wsprintf(funcN,L"%S",func);
		wsprintf(funcName,L"[BixVReader]IN -> %s",funcN);
		OutputDebugString(funcName);
	}
	~funcTrace () {
		wchar_t funcName[500];
		wsprintf(funcName,L"[BixVReader]OUT -> %s",funcN);
		OutputDebugString(funcName);
	}
};

//#define inFunc funcTrace _ftrace(__FUNCTION__);
#define inFunc

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Fabio Ottavi
Engineer
Italy Italy
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.160212.1 | Last Updated 30 Jan 2014
Article Copyright 2010 by Fabio Ottavi
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid