Giter VIP home page Giter VIP logo

Comments (4)

weltkante avatar weltkante commented on May 19, 2024 2

Not really fixed, but good enough. What follows is some additional thoughts on the matter, not necessarily correct, nor really that important. I wouldn't mind if you leave the samples as it currently is in the dev branch since I understand that event security isn't the focus of the samples.

CreateEventEx(nullptr, nullptr, FALSE, EVENT_ALL_ACCESS) is somewhat better but still not entirely right. The 3rd parameter is a bitflag not a boolean. But at least it'd do something sensible if someone passed TRUE.

Actually I'm not entirely sure why you need to use CreateEventEx instead of CreateEvent in the first place, something to do with the gpu driver needing additional access rights? The MSDN docs of DX12 suggest to use CreateEvent and not CreateEventEx, which works just fine according to my tests. Also the original (wrong) parameters of the samples hint that your code originally used CreateEvent and then someone changed it to CreateEventEx to specify access rights, but didn't realize the signature is totally different.

From what I understand the handle returned by CreateEvent already has full access, as does the handle returned from CreateEventEx, regardless of what you specify, the initial handle always has full access. The access rights you specify, I believe, is intended for other sites accessing the event. Since you don't give the event a name that could only happen by handle inheritance (or possibly handle duplication, not sure). So basically you give everyone full access to that event, as long as he can get a hand on the handle in some way. Not really best practice, but I doubt someone can do much harm by getting control over these event handles. Maybe crash your app/game by messing with the fence waits.

As I said, thats just some thoughts, and I'm no expert on handle security, so some of this might be wrong. It's just a bit of a mystery to me why the samples use the more complex CreateEventEx and have to specify additional security stuff, when it seems to work perfectly fine (for me) going with the simple CreateEvent and default security settings.

from directx-graphics-samples.

bobbrow avatar bobbrow commented on May 19, 2024

Fixed in develop branch. Will merge to master with next release.

from directx-graphics-samples.

bobbrow avatar bobbrow commented on May 19, 2024

sigh. And it's only Monday. I agree that there's no added benefit to using CreateEventEx. I switched the code back to using CreateEvent.

from directx-graphics-samples.

weltkante avatar weltkante commented on May 19, 2024

👍 Thanks, and sorry for bothering with these minor details

from directx-graphics-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.