(X) Hide this
    • Login
    • Join
      • Generate New Image
        By clicking 'Register' you accept the terms of use .

Near Field Communication in Windows 8: Part 1

(2 votes)
Walter Ferrari
Walter Ferrari
Joined Dec 17, 2009
Articles:   19
Comments:   12
More Articles
8 comments   /   posted on Sep 27, 2012
Categories:   Windows 8 , Design

Near fied communication (NFC) is a breakthrough technology aimed at facilitating communication between two devices in close proximity, within a 4-cm distance. In Windows 8 the support for this technology has been included in a broader application scope that Microsoft named Near Field Proximity. This article will give you a general view of NFC explaining how Microsoft has reinterpreted it, and we will learn how to build an environment by using 2 virtual machines to test the classes contained in the namespace Windows.Networking.Proximity.

What is NFC?

In a nutshell NFC is a short range wireless communication system between two NFC enabled  devices. The communication occurs at a 13.56 Mhz frequency, the same as the Radio Frequency Identification (RFID). As opposed to RFID, NFC works only in conditions of proximity, i.e. few centimeters.
The difference lies in the fact that NFC enabled devices can be mobile phones, tablets, PCs, NFC readers and NFC passive tags. This variety of devices opens the door to various applications and services like identification, access control, e-payment, e-ticketing, health data access and so on. In other words Near fied communication (NFC) is a technology with a potentially major impact on people’s economic and social life. It can be seen as something that simplifies the daily human life. 

Let me describe a possible scenario: imagine to wake up in the morning for another workday, take your NFC enabled mobile phone and go to the train station, and to open the turnstile just put your mobile phone close to a NFC reader. To enter your office building you simply use your mobile to punch the clock. In the morning you have a meeting with a new customer: you can swap your business cards by simply approaching your card to his/her NFC-enabled mobile. Then if you wish to offer him/her a coffee from a vending machine, simply approach your phone to the NFC symbol exposed on the machine and you can process the payment

One of the primary information source on NFC is the NFC Forum (http://www.nfc-forum.org).

clip_image002The NFC Forum was established to specify the NFC standards based on ISO/IEC standards and to promote the NFC technology thus providing guidance on the interoperability among devices and services. In the “specifications” section of the forum you can find all the technical documents which describe protocols, data exchange format and so on.

Regarding the NFC core capabilities, and consequently the interoperability amongst devices, three methods are foreseen for applications using NFC:


  1. Card emulation Mode
    This mode allows a NFC device to work as a contact-less smart card (i.e. a credit card). This feature can be used in applications for payments, e-ticketing and so on.
  2. Peer-to-Peer Mode
    This mode enables two NFC devices to exchange data using a bidirectional half duplex communication. From the point of view of the users, this mode simplifies information sharing: they just have to tap together their NFC devices with no need for any prior setup.  
  3. Reader/Writer Mode
    This mode allows an active NFC device to read from/write to a passive NFC tag. Typical examples are applications for smart posters.


The image below shows the underlying layers:


(source: http://www.nfc-forum.org)

The question that may come to mind is now: is this technology widely adopted, or will it be? is it worth learning more about this topic from the point of view of a developer? Judging from the list of

NFC phones already on the market (http://www.nfcworld.com/nfc-phones-list/#available) and the list of newer phones coming soon (http://www.nfcworld.com/nfc-phones-list/#soon) the answer is yes. Let’s learn how Microsoft is addressing this topic in the next paragraph.


The Microsoft interpretation: “Tap and Do”

According to first rumors Microsoft may be including NFC support in Windows 8 raised in September 2011 as announced by NXP. Later, in February 2012, Microsoft published a document entitled “Windows 8 Near Field Proximity Implementation Specification”, available here. It is mainly intended for system integrators and it provides guidelines and requirements that reveal the “Microsoft vision” on NFC. It is worth giving it a read. In this white paper Microsoft defines the communication between two devices in close proximity using a level of abstraction called “Tap and Do”.

Literally the definition of “Tap and Do” is:

“A gesture that is a natural interaction between people in close proximity used to trigger doing something together between the devices they are holding.”

It sounds very similar to the general concept of NFC but in the vision of Microsoft it is something more general. It stands on a system called Near Field Proximity (NFP) provider model. This NFP provider model is a common surface for all the NFP scenarios and use cases, and hides the underlying technology which could be NFC, WI-Direct, Bluetooth or something else. the image below shows the three layers:



The NFP scenarios taken into consideration are the “Ad-Hoch interaction in the Real World” and the “peripheral Wireless Device Setup”. The first fills a gap of Windows and provides an easy way to make two devices communicate together. The second one regards the user experience while installing wireless peripheral devices in Windows. With “Tap and Do” it is stated that this has been extremely simplified.

What about the use cases? “Tap and Do” gesture is the “compendium” of the case uses in the table below:


Use case Description
Tap and Setup Tap and pair and set up a peripheral wireless device with Windows
Tap and Reconnect Tap and reconnect a previously paired and set-up device with Windows
Tap and Use Tap and connect your app with one running on another machine
Tap and Launch Tap and invite a user on another machine to launch an app you’re running
Tap and Acquire Tap and invite a user on another machine to obtain an app you’re running
Tap and Share Tap and share content you have selected to another device
Tap and Receive Tap and receive content from another device or poster


Here is a short description of each of these:

Tap and Setup e Tab and Reconnect -> two use cases for installation and unidirectional pairing of wireless peripherals; placing a peripheral (a wireless keyboard or headphone etc) near a PC triggers the device setup or reconnection.

Tap and Use -> it occurs when for instance two users are running the same app (say a battleship game) and tap their PCs toghether; this action triggers an event that can be handled by the two apps to communicate toghether.

Tap and Launch -> this case is particularly intriguing because, when in proximity, one app running on one PC can invite the user of the other PC to start the same app, if installed.

Tap and Acquire -> similar to the previous case but here the second user does not have the app installed and so he is invited to acquire and install the app.

Tap and Share -> imagine you are visiting a website and want to share it with your friend; just tap your PC to the PC (or phone or tablet) of your friend and he will receive a confirmation request to accept the shared


Tap and Receive -> with this user case a user can tap his PC to another device (a PC, phone or even a passive tag) which is exposing content, and he is invited to receive that content.


The Windows.Networking.Proximity namespace

In the previous paragraph we have seen that a unique Near Field proximity (NFP) provider model is expected for all the underlying wireless technology used. For developers this means good news: there is a common API set to deal with all these technologies (including NFC) and it is available in all the languages that can use WinRT, currently C#, C++ and JS.

Windows.Network.Proximity namespace includes six classes that we can use to realize the use cases described above:

  • ProximityDevice
  • ProximityMessage
  • PeerFinder
  • PeerInformation
  • ConnectionRequestedEventArgs

In the second part of this article we will give a close look at the proximity API and we will provide some examples. But before that we need to build a test environment, and this is what the next paragraph is about.


A simulation environment to test Proximity API

At the time of writing this article there is just one device, to my knowledge, available on the market with NFC enabled: Samsung slate PC. Does that mean that we should buy two of these devices for trialling the Proximity API? Fortunately not, there is another way to get a kick out of it. We can use a proximity driver sample included in Windows Driver Kit (WDK) to simulate a tap gesture over a network connection. To do this we can use two virtual machines with Windows 8 onboard and install the driver on both machines. In the following pages you find all the necessary steps to realize that. But before that let's take a look at the recipe needed to build the environment:

  • Windows 8 Release Preview build
    → I suggest a 64-bit version, you can download it here
  • Virtualization software capable of running the above build
    → I used VirtualBox 4.1.8 available here
  • Visual Studio 2012 RC
    → available here
  • Windows Driver Kit 8.0 (WDK)
    → available here
  • Windows 8 Driver samples
    → download the full package (C# & C++) from here
  • Windows Driver Frameworks (WDF) Co-Installers
    → download from here


1. Setup of virtual machines

Using VirtualBox is fairly easy to set up a virtual machine. Just pay attention to name the two VM differently and to choose network settings that allow the VM to communicate together. I used “Bridged adapter” as network adapter as in figure:


Then install Windows 8 and proceed with the installation of Visual Studio 2012, Windows Driver Kit 8.0 and the WDF coinstallers on both VM.

The Windows 8 Driver samples includes a sample called NetNfpProvider which contains the proximity driver. In sample description page there is some guidance for installing and using the proximity driver but the installation is a bit tricky because some steps are skipped. To bring it to a successful conclusion I suggest you follow the steps below.


2. Extract NetNfpProvider sample package

Unzip Windows 8 Driver Samples package in a directory and explore it to locate “NetNfpControl” subdirectory. Open the “netnfp” solution that you will find in the “C++” subdirectory. The solution contains 3 projects:

- NetNfpProvider that contains the driver

- NetNfpControl that contains a command-line executable to interact with the driver

- Package contains driver package



In the Solution Explorer window, right-click Solution 'netnfp' and choose Configuration Manager: make sure that all the projects are configured for x64 platform, as in figure below:



3. Sign the driver

To install a driver on a 64-bit version of Windows, you must sign the driver package. The following procedure helps you to test signing the driver, which is a simplified procedure useful for testing purposes.

Right-click the driver package project, and choose Properties as in figure below:



In the Properties window expand the “Configuration Properties” branch in the tree on the left, click on “Driver Signing” and select Test Sign in the Sign Mode drop-down list as below:



Then click on Inf2Cat > General. In the Run Inf2Cat drop-down list, select Yes as below:



If we now try to build the solution, a catalog file (.CER) will be created.


4. Export the certificate

Now we have to share our signing certificate. Still in Properties, for the package select Configuration Properties > Driver Signing > General and in the Test Certificate choose Select From Store as below:



In the Select Certificate dialog box, select the certificate named “WDKTestCertyourUserName” as in figure below:



Click on Properties of the certificate selected and from the “Details” tab click “Copy to File” as in figure below:



An export wizard will open to guide you to export a .pbx file :



Click on Next to proceed; then you will be asked to choose the export format of the file; choose .PFX as in figure below:



Click Next and protect your private key with a password. Don’t forget your password since you will need it when you import the certificate into your local machine:



Click Next and name the file to be exported as below:



click Save to get the final summary view:



5. Import the certificate into your local machine

Obviously the local machine is one of the 2 VM. Go to the directory where you exported your pfx file and right-click the file; the contextual menu should look like in figure below:



Click Install PFX and in the “certificate Import wizard” dialog box select “Local Machine” as Store location as below:

15_installPFX_Local Machine


Click Next and in the next screen , browse for the .pbx file you previously created:



Click Next and type in the password you previously set for your private key:



Click on “Browse” to specify a location for the certificate:



Click on “Show physical stores” check box as in figure below then select “Trusted Root Certification Authorities\Registry” and click OK.



Finally, click the Finish button to complete the import:



5. Install the driver

To sum up, we have test signed the driver, exported the certificate and imported it into the local VM. Now we can install the driver. Create a directory (for instance c:\NetNfpprovider) and copy the following files from the output directory of the VS solution ( i.e. : ..\NetNfpProvider\C++\Package\x64\Win8Release\Package):

  • driver binary and inf: NetNfpProvider.dll, NetNfpProvider.inf
  • coinstaller: WdfCoinstaller01011.dll
  • wdfupdate: WudfUpdate_01011.dll

since you have to run the device console devcon.exe, copy it from \Program Files (x86)\Windows Kits\8.0\Tools\x64 or add the path to the environment variables.

Disable the Windows Firewall or, as suggested by the official guide create an inbound rule to allow incoming requests to NetNfpProvider to the port 9929.

Open a command-line windows as Administrator in the directory in which you copied the files and launch the following command:

“devcon.exe install NetNfpProvider.inf WUDF\NetNfpProvider”

If everything is OK you should be notified that the driver has been succesfully installed as in figure below:

23_DriverDevCon Successfully


You can now install the driver onto the second virtual machine by importing the certificate driver, copy the directory you created above and launch devcon.exe with the same parameters as above.

In the second part we will learn how to use the driver.



We have introduced Near field Communication technology highlighting how it could be applied to the everyday life. We have then seen the Microsoft concept of Proximity intended as something more general. With “Tap and Do” Microsoft has summed up with a slogan the communication between two devices in close proximity. In this first part we have minutely described how to install a sample driver onto two virtual machines in order to simulate a tap gesture over the network and have the possibility to test the Proximity API. In the second part we will see how to use the driver and how easy it is to use the Proximity API.

Want to test your understanding of this article? Walter Ferrari challenges you to prove you got it all right! Take the challenge below:  
Create Two Virtual Machines with Windows 8
Challenges powered by 



  • AlexKrul

    Re: Near Field Communication in Windows 8: Part 1

    posted by AlexKrul on Oct 16, 2012 10:44


    I successful build c++ project, install *.pfx file on test computer.
    Then copied  needed files to 'C:/NetNfpprovider' directory and have problem with install driver on main computer(not test):

    C:\NetNfpprovider>devcon.exe install NetNfpProvider.inf WUDF\NetNfpProvider Device node created. Install is complete when drivers are installed... Updating drivers for WUDF\NetNfpProvider from C:\NetNfpprovider\NetNfpProvider.inf.

    devcon.exe failed.

    Any ideas how fix it?

  • AlexKrul

    Re: Near Field Communication in Windows 8: Part 1

    posted by AlexKrul on Oct 16, 2012 10:58


    I successful build c++ project, install *.pfx file on test computer.
    Then copied  needed files to 'C:/NetNfpprovider' directory and have problem with install driver on main computer(not test):

    C:\NetNfpprovider>devcon.exe install NetNfpProvider.inf WUDF\NetNfpProvider Device node created. Install is complete when drivers are installed... Updating drivers for WUDF\NetNfpProvider from C:\NetNfpprovider\NetNfpProvider.inf.

    devcon.exe failed.

    Any ideas how fix it?

  • walterf

    Re: Near Field Communication in Windows 8: Part 1

    posted by walterf on Oct 16, 2012 11:03


    please post the log of setupapi. You can locate the file at “%windir%\inf\setupapi.dev.log”.

  • AlexKrul

    Re: Near Field Communication in Windows 8: Part 1

    posted by AlexKrul on Oct 16, 2012 11:22
    >>>  [Device Install (UpdateDriverForPlugAndPlayDevices) - WUDF\NetNfpProvider]
    >>>  Section start 2012/10/16 11:18:16.147
          cmd: devcon.exe  install NetNfpProvider.inf WUDF\NetNfpProvider
         dvi: {Build Driver List} 11:18:16.150
         dvi:      Searching for hardware ID(s):
         dvi:           wudf\netnfpprovider
         cpy:      Policy is set to make all digital signatures equal.
         sig:      {_VERIFY_FILE_SIGNATURE} 11:18:16.155
         sig:           Key      = netnfpprovider.inf
         sig:           FilePath = c:\netnfpprovider\netnfpprovider.inf
         sig:           Catalog  = c:\netnfpprovider\nfp.cat
    !    sig:           Verifying file against specific (valid) catalog failed! (0x00000057)
    !    sig:           Error 87: The parameter is incorrect.
         sig:      {_VERIFY_FILE_SIGNATURE exit(0x00000057)} 11:18:16.164
         sig:      {_VERIFY_FILE_SIGNATURE} 11:18:16.165
         sig:           Key      = netnfpprovider.inf
         sig:           FilePath = c:\netnfpprovider\netnfpprovider.inf
         sig:           Catalog  = c:\netnfpprovider\nfp.cat
    !    sig:           Verifying file against specific Authenticode(tm) catalog failed! (0x80092003)
    !    sig:           Error 0x80092003: An error occurred while reading or writing to a file.
         sig:      {_VERIFY_FILE_SIGNATURE exit(0x80092003)} 11:18:16.172
         dvi:      Created Driver Node:
         dvi:           HardwareID   - WUDF\NetNfpProvider
         dvi:           InfName      - c:\netnfpprovider\netnfpprovider.inf
         dvi:           DevDesc      - Network NearFieldProximity Provider
         dvi:           Section      - NetNfpProvider_Install
         dvi:           Rank         - 0x80ff0000
         dvi:           Signer Score - Not digitally signed
         dvi:           DrvDate      - 10/16/2012
         dvi:           Version      -
         dvi: {Build Driver List - exit(0x00000000)} 11:18:16.183
         dvi: {DIF_SELECTBESTCOMPATDRV} 11:18:16.183
         dvi:      No class installer for 'Proximity devices'
         dvi:      No CoInstallers found
         dvi:      Default installer: Enter 11:18:16.186
         dvi:           {Select Best Driver}
         dvi:                Class GUID of device changed to: {5630831c-06c9-4856-b327-f5d32586e060}.
         dvi:                Selected:
         dvi:                     Description - [Network NearFieldProximity Provider]
         dvi:                     InfFile     - [c:\netnfpprovider\netnfpprovider.inf]
         dvi:                     Section     - [NetNfpProvider_Install]
         dvi:           {Select Best Driver - exit(0x00000000)}
         dvi:      Default installer: Exit
         dvi: {DIF_SELECTBESTCOMPATDRV - exit(0x00000000)} 11:18:16.196
         sto: {Import Driver Package: c:\netnfpprovider\netnfpprovider.inf} 11:18:16.197
         sto:      Driver Store   = C:\WINDOWS\System32\DriverStore [Online] (6.2.9200)
         sto:      Driver Package = c:\netnfpprovider\netnfpprovider.inf
         sto:      Architecture   = amd64
         sto:      Flags          = 0x00000000
         inf:      Provider       = Microsoft
         inf:      Class GUID     = {5630831c-06c9-4856-b327-f5d32586e060}
         inf:      Driver Version = 10/16/2012,
         inf:      Catalog File   = nfp.cat
         inf:      Version Flags  = 0x00000001
         flq:      Copying 'c:\netnfpprovider\NetNfpProvider.dll' to 'C:\Users\LOCALA~1\AppData\Local\Temp\{24746cf2-9d1d-1c40-baed-b1098a1b0c7d}\NetNfpProvider.dll'.
         flq:      Copying 'c:\netnfpprovider\netnfpprovider.inf' to 'C:\Users\LOCALA~1\AppData\Local\Temp\{24746cf2-9d1d-1c40-baed-b1098a1b0c7d}\netnfpprovider.inf'.
         pol:      {Driver package policy check} 11:18:16.322
         pol:      {Driver package policy check - exit(0x00000000)} 11:18:16.323
         sto:      {Stage Driver Package: C:\Users\LOCALA~1\AppData\Local\Temp\{24746cf2-9d1d-1c40-baed-b1098a1b0c7d}\netnfpprovider.inf} 11:18:16.323
         inf:           {Query Configurability: C:\Users\LOCALA~1\AppData\Local\Temp\{24746cf2-9d1d-1c40-baed-b1098a1b0c7d}\netnfpprovider.inf} 11:18:16.327
         inf:                Driver package uses WDF.
         inf:                Driver package 'netnfpprovider.inf' is configurable.
         inf:           {Query Configurability: exit(0x00000000)} 11:18:16.330
         flq:           Copying 'C:\Users\LOCALA~1\AppData\Local\Temp\{24746cf2-9d1d-1c40-baed-b1098a1b0c7d}\NetNfpProvider.dll' to 'C:\WINDOWS\System32\DriverStore\Temp\{78b4006e-bb2d-6c46-986a-fc61b4631423}\NetNfpProvider.dll'.
         flq:           Copying 'C:\Users\LOCALA~1\AppData\Local\Temp\{24746cf2-9d1d-1c40-baed-b1098a1b0c7d}\netnfpprovider.inf' to 'C:\WINDOWS\System32\DriverStore\Temp\{78b4006e-bb2d-6c46-986a-fc61b4631423}\netnfpprovider.inf'.
         sto:           {DRIVERSTORE IMPORT VALIDATE} 11:18:16.371
    !!!  sig:                Driver package does not contain a catalog file, and Code Integrity is enforced.
    !!!  sig:                Driver package failed signature validation. Error = 0xE000022F
         sto:           {DRIVERSTORE IMPORT VALIDATE: exit(0xe000022f)} 11:18:16.372
    !!!  sig:           Driver package failed signature verification. Error = 0xE000022F
    !!!  sto:           Failed to import driver package into Driver Store. Error = 0xE000022F
         sto:      {Stage Driver Package: exit(0xe000022f)} 11:18:16.373
         sto: {Import Driver Package: exit(0xe000022f)} 11:18:16.375
    !!!  ndv: Driver package import failed for device.
    !!!  ndv: Error 0xe000022f: The third-party INF does not contain digital signature information.
         ndv: Installing NULL driver.
         dvi: {Plug and Play Service: Device Install for ROOT\PROXIMITY\0000}
    !    ndv:      Installing NULL driver!
         dvi:      {DIF_ALLOW_INSTALL} 11:18:16.494
         dvi:           No class installer for 'Unknown driver software package'
         dvi:           No CoInstallers found
         dvi:           Default installer: Enter 11:18:16.495
         dvi:           Default installer: Exit
         dvi:      {DIF_ALLOW_INSTALL - exit(0xe000020e)} 11:18:16.496
         dvi:      {DIF_REGISTER_COINSTALLERS} 11:18:16.497
         dvi:           No class installer for 'Unknown driver software package'
         dvi:           Default installer: Enter 11:18:16.498
         dvi:           Default installer: Exit
         dvi:      {DIF_REGISTER_COINSTALLERS - exit(0x00000000)} 11:18:16.499
         dvi:      {DIF_INSTALLDEVICE} 11:18:16.500
         dvi:           No class installer for 'Unknown driver software package'
         dvi:           No CoInstallers found
         dvi:           Default installer: Enter 11:18:16.501
    !    dvi:                Installing NULL driver!
         dvi:                Install Device: Restarting device. 11:18:16.508
         dvi:                Install Device: Restarting device completed. 11:18:16.596
         dvi:           Default installer: Exit
         dvi:      {DIF_INSTALLDEVICE - exit(0x00000000)} 11:18:16.598
         ump: {Plug and Play Service: Device Install exit(00000000)}
    <<<  Section end 2012/10/16 11:18:16.602
    <<<  [Exit status: SUCCESS]
  • walterf

    Re: Near Field Communication in Windows 8: Part 1

    posted by walterf on Oct 16, 2012 12:03
    It looks like the signing certificate was not installed  in your main computer; try to install pfx on your main PC.
  • AlexKrul

    Re: Near Field Communication in Windows 8: Part 1

    posted by AlexKrul on Oct 16, 2012 12:19

    I install it on another computer. Thx.

  • AlexKrul

    Re: Near Field Communication in Windows 8: Part 1

    posted by AlexKrul on Oct 16, 2012 12:21

    *Upd: om main PC .pfx couldn't install, I dont know why, but I try to fix it singly. Thanks for help. :)

  • deesymtc

    Re: Near Field Communication in Windows 8: Part 1

    posted by deesymtc on Jul 18, 2013 07:47

    Hi, I am trying to build the NFP driver sample,I followed the steps mentioned but am unable to complete the "devcon.exe install" command.

     It shows :

    Device node created. Install is complete when drivers are installed...
    Updating drivers for WUDF\UMDFDriver1 from C:\NetNfpProvider\UMDFDriver1
    devcon.exe failed.

    I am also including the error log:

    >>>  [Device Install (UpdateDriverForPlugAndPlayDevices) - WUDF\UMDFDriver1]
    >>>  Section start 2013/07/17 17:36:13.821
          cmd: devcon.exe  install UMDFDriver1.inf WUDF\UMDFDriver1
         dvi: {Build Driver List} 17:36:13.867
         dvi:      Searching for hardware ID(s):
         dvi:           wudf\umdfdriver1
         cpy:      Policy is set to make all digital signatures equal.
         dvi: {Build Driver List - exit(0x00000000)} 17:36:13.867
         dvi: {DIF_SELECTBESTCOMPATDRV} 17:36:13.867
         dvi:      No class installer for 'Unknown driver software package'
         dvi:      No CoInstallers found
         dvi:      Default installer: Enter 17:36:13.883
         dvi:           {Select Best Driver}
    !    dvi:                Selecting driver failed(0xe0000228)
         dvi:           {Select Best Driver - exit(0xe0000228)}
    !    dvi:      Default installer: failed!
    !    dvi:      Error 0xe0000228: There are no compatible drivers for this device.
         dvi: {DIF_SELECTBESTCOMPATDRV - exit(0xe0000228)} 17:36:13.883
    <<<  Section end 2013/07/17 17:36:13.899
    <<<  [Exit status: SUCCESS]

    Kindly help.

Add Comment

Login to comment:
  *      *       

From this series