C++ in driver

Hello,

There is pretty old (but pretty useful) blogpost on OSR: https://www.osronline.com/article.cfm?article=490 about using C++ for drivers.
I’m thinking about templates usage in driver code and thinking whether new compilers solves somehow problem of inlning templates? (case mentioned in above article, that I can have inlined code in paged section of driver code (beacuse of includes order for instance) and using it in code section that is nonpaged, but we are at DISPTACH.

I came across following article https://msdn.microsoft.com/en-us/library/jj620896.aspx
there is mentioned usage of marker for a class to give compiler ifnormaiton to not place code into paged section, but I dont think it is solution… how to mark stl as nonpagable code ?

Thank you for any feedback :slight_smile:

stl uses exceptions and that is a problem. templates by themselves are not
a problem as, for example, you can now explicitly declare c++ classes as
nonpaged.

Mark Roddy

On Thu, Jan 14, 2016 at 5:39 AM, wrote:

> Hello,
>
> There is pretty old (but pretty useful) blogpost on OSR:
> https://www.osronline.com/article.cfm?article=490 about using C++ for
> drivers.
> I’m thinking about templates usage in driver code and thinking whether new
> compilers solves somehow problem of inlning templates? (case mentioned in
> above article, that I can have inlined code in paged section of driver code
> (beacuse of includes order for instance) and using it in code section that
> is nonpaged, but we are at DISPTACH.
>
> I came across following article
> https://msdn.microsoft.com/en-us/library/jj620896.aspx
> there is mentioned usage of marker for a class to give compiler
> ifnormaiton to not place code into paged section, but I dont think it is
> solution… how to mark stl as nonpagable code ?
>
> Thank you for any feedback :slight_smile:
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: <
> http://www.osronline.com/showlists.cfm?list=ntdev&gt;
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:>

You can’t use stl or boost or any template library that relies on EH in driver code

Sent from Outlook Mail for Windows 10 phone

From: xxxxx@gmail.com
Sent: Thursday, January 14, 2016 2:40 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] C++ in driver

Hello,

There is pretty old (but pretty useful) blogpost on OSR: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.osronline.com%2Farticle.cfm%3Farticle%3D490&data=01|01|Doron.Holan%40microsoft.com|e9471057053f4e420b8408d31ccf1502|72f988bf86f141af91ab2d7cd011db47|1&sdata=cWle8lP14%2FxwYAJ%2BcsHouUMLUf2iRS28kkZIYBDe1wE%3D about using C++ for drivers.
I’m thinking about templates usage in driver code and thinking whether new compilers solves somehow problem of inlning templates? (case mentioned in above article, that I can have inlined code in paged section of driver code (beacuse of includes order for instance) and using it in code section that is nonpaged, but we are at DISPTACH.

I came across following article https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fjj620896.aspx&data=01|01|Doron.Holan%40microsoft.com|e9471057053f4e420b8408d31ccf1502|72f988bf86f141af91ab2d7cd011db47|1&sdata=E1Wh67I%2FThbiJBm9DLBYs6iP7I1%2Bb8kbxHKXRkZN6pY%3D
there is mentioned usage of marker for a class to give compiler ifnormaiton to not place code into paged section, but I dont think it is solution… how to mark stl as nonpagable code ?

Thank you for any feedback :slight_smile:


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>

Guys,
Thank you for answers.
This is pretty obvious that EH eliminates using it in kernel.
My question was about mentioned article and templates in general.
There are many implementations that are exception-safe, boost also. My question is about templates compilation and mentioned placement (implicitly) in paged code section.

So assume we talk not about std or boost. Lets say we have created our own my::unique_ptr that is template. Is it safe to use it across all code or not?

Thank you

The old problems with templates code sharing should not be a problem anymore. Furthermore, you can now declare which section a template’s instantiation can be placed into with much cleaner syntax.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Thursday, January 14, 2016 7:22 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] C++ in driver

Guys,
Thank you for answers.
This is pretty obvious that EH eliminates using it in kernel.
My question was about mentioned article and templates in general.
There are many implementations that are exception-safe, boost also. My question is about templates compilation and mentioned placement (implicitly) in paged code section.

So assume we talk not about std or boost. Lets say we have created our own my::unique_ptr that is template. Is it safe to use it across all code or not?

Thank you


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>

xxxxx@gmail.com wrote:

My question was about mentioned article and templates in general.
There are many implementations that are exception-safe, boost also.

Note that there is a huge difference between “exception-safe” and
“exception-free”. Kernel code requires the latter.

So assume we talk not about std or boost. Lets say we have created our own my::unique_ptr that is template. Is it safe to use it across all code or not?

Yes. This has always been true, assuming you just tossed out the idea
of using paged code in a driver at all.


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

with perhaps too much effort one could control the paging of various sorts
of objects such that some were safe at dispatch level and some suitable
only for passive.

Mark Roddy

On Thu, Jan 14, 2016 at 1:14 PM, Tim Roberts wrote:

> xxxxx@gmail.com wrote:
> > My question was about mentioned article and templates in general.
> > There are many implementations that are exception-safe, boost also.
>
> Note that there is a huge difference between “exception-safe” and
> “exception-free”. Kernel code requires the latter.
>
>
> > So assume we talk not about std or boost. Lets say we have created our
> own my::unique_ptr that is template. Is it safe to use it across all code
> or not?
>
> Yes. This has always been true, assuming you just tossed out the idea
> of using paged code in a driver at all.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list online at: <
> http://www.osronline.com/showlists.cfm?list=ntdev&gt;
>
> MONTHLY seminars on crash dump analysis, WDF, Windows internals and
> software drivers!
> Details at http:
>
> To unsubscribe, visit the List Server section of OSR Online at <
> http://www.osronline.com/page.cfm?name=ListServer&gt;
></http:>