Building driver with VS Express 2013 + WDK 8.1 update

Hi,

I’ve successfully installed VS Express 2013 with WDK 8.1 Update.

I got Intel Performance Counter Monitoring (PCM) source code and I would like to build the driver shipped with it (Driver folder holds .c code and .h files, a file named “sources” and an makefile).

Can you help me in building it using VS Express 2013 ?

Regards

This is an old-style build procedure, that dates back to before Windows 8. You might be better off asking Intel. It might not even work anymore.

But, you can give it a try: In VS you should be able to do “File… Convert Sources/Dirs Project…” or something similar and select the SOURCES file.

Peter
OSR
@OSRDrivers

quote “In VS you should be able to do “File… Convert Sources/Dirs Project…” or something similar and select the SOURCES file”

sorry, but under File menu I can not find any option to make the conversion…anyway, Does exist any way to build it using MSbuild directly ?

Thanks

You need to convert it. There is also a command line tool, nmake2msbuild.exe which does the conversion

Sent from Outlook Mailhttp: for Windows 10 phone

From: xxxxx@alice.it
Sent: Sunday, October 18, 2015 12:49 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Building driver with VS Express 2013 + WDK 8.1 update

quote “In VS you should be able to do “File… Convert Sources/Dirs Project…” or something similar and select the SOURCES file”

sorry, but under File menu I can not find any option to make the conversion…anyway, Does exist any way to build it using MSbuild directly ?

Thanks


NTDEV is sponsored by OSR

Visit the list at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osronline.com%2Fshowlists.cfm%3Flist%3Dntdev&data=01|01|Doron.Holan%40microsoft.com|d42cff7073a047914e1c08d2d7f53840|72f988bf86f141af91ab2d7cd011db47|1&sdata=NppFgSpX921l1CyeAlSEo25htbxCujz4m7cP66zifqk%3D

OSR is HIRING!! See https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osr.com%2Fcareers&data=01|01|Doron.Holan%40microsoft.com|d42cff7073a047914e1c08d2d7f53840|72f988bf86f141af91ab2d7cd011db47|1&sdata=2LlS1bhBxYluuCiqiNPqDj%2BSm0YVVMS2fbrVzMMtEhE%3D

For our schedule of WDF, WDM, debugging and other seminars visit:
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osr.com%2Fseminars&data=01|01|Doron.Holan%40microsoft.com|d42cff7073a047914e1c08d2d7f53840|72f988bf86f141af91ab2d7cd011db47|1&sdata=H%2Fc3I2HgNH7du3BOTgIRKICuK5sF1JLvPDJNkh%2B%2Fbnc%3D

To unsubscribe, visit the List Server section of OSR Online at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osronline.com%2Fpage.cfm%3Fname%3DListServer&amp;data=01|01|Doron.Holan%40microsoft.com|d42cff7073a047914e1c08d2d7f53840|72f988bf86f141af91ab2d7cd011db47|1&amp;sdata=IqgXQCdaj7n%2BT2sQEuC9ZFd90T6QiI29LShzLPzoPSA%3D</http:>

Look around, Mr. Cianfarani – Try under Project… I’m not sitting in front of my computer so I can’t point you directly to it. But “Sources/Dirs” is what you’re looking for.

Like I said earlier, you might ask on an Intel forum.

Peter
OSR
@OSRDrivers

Hi,

I managed to build it with “nmake2msbuild.exe sources”. Build process stores the .sys driver and .cer file in the /Debug folder. Now, how can I install it to sign the newly built driver ?

Regards

In Solution Explorer, in the created driver PROJECT, right click and select properties. Select “Signing”… Done.

Or sign the produced .SYS file with SignTool.

Unless you have a Code Signing Certificate the best you’re going to be able to do is test sign the driver. Google “Signing Drivers during Development and Test”…

Peter
OSR
@OSRDrivers

I believe built driver is correctly signed. The following are the last lines of build process output:

“DriverTestSign:
C:\Program Files\Windows Kits\8.1\bin\x86\signtool.exe sign /ph /sha1 “2FB371DDB70252DD9BBD598EB62942A32F2C4618”
Done Adding Additional Store
Successfully signed: C:\Users\20144620\Documents\Visual Studio 2013\Projects\WinMSRDriver\Win7\Win7Debug\x86\msr.sys”

Basic question: conversion process creates a solution (msr.sln) with a project (msr.vcxproj) and a folder named msr-Package when build complete. What is the purpose of msr-Package ?

Anyway I get the following error when I try to execute the application that loads the msr.sys driver

“Starting MSR service failed with error 3 Trying to load winring0.dll/winring0.sy
s driver…
Failed to load winring0.dll/winring0.sys driver.”

It seems there exist some problem with winring0.dll/winring0.sys driver…

xxxxx@alice.it wrote:

Basic question: conversion process creates a solution (msr.sln) with a project (msr.vcxproj) and a folder named msr-Package when build complete. What is the purpose of msr-Package ?

Anyway I get the following error when I try to execute the application that loads the msr.sys driver

“Starting MSR service failed with error 3 Trying to load winring0.dll/winring0.sy
s driver…
Failed to load winring0.dll/winring0.sys driver.”

It seems there exist some problem with winring0.dll/winring0.sys driver…

Error 3 is ERROR_PATH_NOT_FOUND. If I had to guess, I would guess that
your application expected the driver to be called “winring0.sys” and not
“msr.sys”.

How did you install the driver? Remember that you can’t just copy it
into \Windows\System32\Drivers. You have to create a service entry for it.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Tim,

maybe you are right. Excuse me for the basic question: how can I rename built .sys driver in VS2013 project ?

As said before from the conversion (using “nmake2msbuild.exe sources”) I get a solution and a project named “msr”. Now I tried to change “TargetName” under msr Project->Properties->General from “msr” to “winring0”. Name project actually changed to “winring0” but nothing about .sys driver newly built

Can you help me ? Thanks

xxxxx@alice.it wrote:

maybe you are right.

You shouldn’t be guessing about this. You have the source code for the
tool, go look at it. What was the TARGETNAME in the “sources” file?

Excuse me for the basic question: how can I rename built .sys driver in VS2013 project ?

The name of the driver comes from the tag in the project
file, which by default comes from the , which by default
comes from the name of the project file. So, one answer is to rename
the .vcxproj. You’ll have to change the .sln file as well. However,
before you do that, make sure you need to do that.

> As said before from the conversion (using “nmake2msbuild.exe sources”) I get a solution and a project named “msr”. Now I tried to change “TargetName” under msr Project->Properties->General from “msr” to “winring0”. Name project actually changed to “winring0” but nothing about .sys driver newly built

If you can’t figure it out, send me the vcxproj file, but only AFTER you
are 100% sure what driver your application is calling.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

On Wed, 21 Oct 2015, Tim Roberts wrote:

The name of the driver comes from the tag in the project
> file, which by default comes from the , which by default
> comes from the name of the project file. So, one answer is to rename
> the .vcxproj. You’ll have to change the .sln file as well. However,
> before you do that, make sure you need to do that.

Note that if you import an Sources file to Visual Studio it will create an
sources.props file that contains a line like this:
Condition=“‘$(OVERRIDE_TARGETNAME)’!=‘true’”>the_target_name_from_the_sources_file

/Bo

> Note that if you import an Sources file to Visual Studio it will create an sources.props file that contains a line like this: the_target_name_from_the_sources_fil e

Sure, as Bo said, a sources.propos file has been created upon nmake2msbuild.exe conversion.
Now even if I modify tag value to “winring0” into .vcxproj project file (as far as I can see it is an xml-based format) the built .sys name is taken from TARGETNAME tag value stored in sources.propos

So I managed to solve it changing the value of TARGETNAME in sources.propos file itself.

Anyway it seems a known problem…
https://software.intel.com/en-us/forums/software-tuning-performance-optimization-platform-monitoring/topic/473927

I tried to register & start the service using OSRLOADER: the driver actually is loaded but anyway the application (pcm.exe) does not work.

xxxxx@alice.it wrote:

So I managed to solve it changing the value of TARGETNAME in sources.propos file itself.

Well, you’ll have to change it back.

Anyway it seems a known problem…
https://software.intel.com/en-us/forums/software-tuning-performance-optimization-platform-monitoring/topic/473927

I tried to register & start the service using OSRLOADER: the driver actually is loaded but anyway the application (pcm.exe) does not work.

You know, this ALL would have gone a lot more smoothly if you had just
told us right from the beginning that you were trying to install and run
the Intel Performance Counter Monitor. I just assumed you were doing
some hacky thing for your own. I did not realize that you were trying
to build an off-the-shelf distribution from Intel.

Did you read the instructions? PCM needs both msr.sys and
winring0.sys. The source for msr.sys is included in the package, and it
does need to be called “msr.sys”. You have to get winring0 from another
location.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.