Unresolved external symbol @__security_check_cookie@4

I have a Visual Studio 2005 driver project that builds ok in VS 2005 (both Checked and Free). I converted the project to VS 2010 and I am getting the following linker error message. Any advice?

error LNK2019: unresolved external symbol @xxxxx@4 referenced in function “long __stdcall AddDevice(struct _DRIVER_OBJECT *,struct _DEVICE_OBJECT *)” (?AddDevice@@YGJPAU_DRIVER_OBJECT@@PAU_DEVICE_OBJECT@@@Z)

Looks like you are trying to build a driver with the build tool and
environment. This is a really stupid idea, but if you insist on
producing bad code look at the /GS switch.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

xxxxx@goodrich.com” wrote in message
news:xxxxx@ntdev:

> I have a Visual Studio 2005 driver project that builds ok in VS 2005 (both Checked and Free). I converted the project to VS 2010 and I am getting the following linker error message. Any advice?
>
> error LNK2019: unresolved external symbol @xxxxx@4 referenced in function “long __stdcall AddDevice(struct _DRIVER_OBJECT *,struct _DEVICE_OBJECT *)” (?AddDevice@@YGJPAU_DRIVER_OBJECT@@PAU_DEVICE_OBJECT@@@Z)

The __security_check_cookie reference was added by /gs. Link against bufferoverflowk.lib. as don said, though, you are off in undocumented and uncharted and unsupported waters by using VS to build your driver with any kit pre win8

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: Friday, September 16, 2011 1:25 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Unresolved external symbol @__security_check_cookie@4

Looks like you are trying to build a driver with the build tool and environment. This is a really stupid idea, but if you insist on producing bad code look at the /GS switch.

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

xxxxx@goodrich.com” wrote in message
news:xxxxx@ntdev:

> I have a Visual Studio 2005 driver project that builds ok in VS 2005 (both Checked and Free). I converted the project to VS 2010 and I am getting the following linker error message. Any advice?
>
> error LNK2019: unresolved external symbol @ security_check_cookie@4
> referenced in function "long
stdcall AddDevice(struct _DRIVER_OBJECT
> *,struct _DEVICE_OBJECT *)"
> (?AddDevice@@YGJPAU_DRIVER_OBJECT@@PAU_DEVICE_OBJECT@@@Z)


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

On 16/09/2011 21:33, Doron Holan wrote:

The __security_check_cookie reference was added by /gs. Link against bufferoverflowk.lib. as don said, though, you are off in undocumented and uncharted and unsupported waters by using VS to build your driver with any kit pre win8

It looks like the 7.1 WDK also supports /GS via the
BUFFER_OVERFLOW_CHECKS option in sources. I think you could avoid the
reference if you set BUFFER_OVERFLOW_CHECKS=0.


Bruce Cran

Creating driver projects in VS came from appendix B of Walter Oney’s book “Programming the Microsoft Windows Driver Model”.

I included bufferoverflowk.lib in the linker and got past that problem. However, there is another problem. So, I will just use VS 2005 and continue on my merry way.

Don’t set BUFFER_OVERFLOW_CHECKs to zero, it will make your driver less secure. A KMDF driver requires /GS btw

d

-----Original Message-----
From: Bruce Cran [mailto:xxxxx@cran.org.uk]
Sent: Friday, September 16, 2011 2:10 PM
To: Windows System Software Devs Interest List
Cc: Doron Holan
Subject: Re: [ntdev] Unresolved external symbol @__security_check_cookie@4

On 16/09/2011 21:33, Doron Holan wrote:

The __security_check_cookie reference was added by /gs. Link against
bufferoverflowk.lib. as don said, though, you are off in undocumented
and uncharted and unsupported waters by using VS to build your driver
with any kit pre win8

It looks like the 7.1 WDK also supports /GS via the BUFFER_OVERFLOW_CHECKS option in sources. I think you could avoid the reference if you set BUFFER_OVERFLOW_CHECKS=0.


Bruce Cran

In DDK 3790.1830 x86 build env, /GS- doesn’t work… x86 CL doesn’t
recognize the minus sign. I stumbled on this thing while I was using it to
build some code for my EFI boot ROM. The only way to get rid of the cookie
is to enable some sort of optimization if you don’t want to nake the
functions.

>win8

And even in Win8 you need a special kind of VS’s project, correct?


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

>will just use VS 2005 and continue on my merry way.

…from issue to issue :slight_smile:

Install the proper WDK and then DDKBUILD.BAT to run WDK as Custom Build Step from VS.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com