Windows-driver-samples | repo contains driver samples

 by   microsoft C Version: win11-22h2 License: MS-PL

kandi X-RAY | Windows-driver-samples Summary

kandi X-RAY | Windows-driver-samples Summary

Windows-driver-samples is a C library. Windows-driver-samples has no bugs, it has no vulnerabilities, it has a Weak Copyleft License and it has medium support. You can download it from GitHub.

These are the official Microsoft Windows Driver Kit (WDK) driver code samples for Windows 10. They provide a foundation for Universal Windows driver support of all hardware form factors, from phones to desktop PCs. Use these samples with Visual Studio 2019 and Windows Driver Kit (WDK) 10.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Windows-driver-samples has a medium active ecosystem.
              It has 6051 star(s) with 4766 fork(s). There are 584 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 322 open issues and 159 have been closed. On average issues are closed in 301 days. There are 52 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Windows-driver-samples is win11-22h2

            kandi-Quality Quality

              Windows-driver-samples has no bugs reported.

            kandi-Security Security

              Windows-driver-samples has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              Windows-driver-samples is licensed under the MS-PL License. This license is Weak Copyleft.
              Weak Copyleft licenses have some restrictions, but you can use them in commercial projects.

            kandi-Reuse Reuse

              Windows-driver-samples releases are available to install and integrate.
              Installation instructions are available. Examples and code snippets are not available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Windows-driver-samples
            Get all kandi verified functions for this library.

            Windows-driver-samples Key Features

            No Key Features are available at this moment for Windows-driver-samples.

            Windows-driver-samples Examples and Code Snippets

            No Code Snippets are available at this moment for Windows-driver-samples.

            Community Discussions

            QUESTION

            UMDF PnP Driver creates no trace logs
            Asked 2022-Feb-02 at 20:59

            Im trying to create trace log messages for this Idd Sample Driver. I am following this document.

            I add WPP_INIT_TRACING(pDriverObject, pRegistryPath) to the DriverEntry, and WPP_CLEANUP(pDriverObject)to the EvtCleanupCallback.

            ...

            ANSWER

            Answered 2022-Feb-02 at 20:59

            Solved my problem. I wasnt actually installing my driver, since it was still installed from the first time I installed it, so it was always using that driver instead of my new one with WPP enabled. I was installing and uninstalling the driver with pnputil. I was doing pnputil -d oem20.inf -f for example to uninstall the driver. This is BAD. I have learned now that force deleting a driver does nothing. The reason I was force deleting was because it wouldnt delete when i still had a device, even though i would exit the sample app.

            So what you have to do in order to properly delete the driver is enumerate the devices with pnputil, remove the ones that use your driver, then delete the driver. This allows a proper fresh driver installation.

            Source https://stackoverflow.com/questions/70932124

            QUESTION

            Error 87 in WriteFile function (NDIS) when using EtherType 0x88A4 (EtherCat)
            Asked 2021-Jun-01 at 23:15

            I am trying to send a Raw Ethernet frame over layer 2, using the prottest.c example code for the NDIS driver, in C. The example works without problem, but when I modify the Ether Type (0x88A4 EtherCat) and adapt the frame with the necessary structure and information, the Writefile function always returns Error 87 (Incorrect parameters).

            Is it not possible to write with this function on Layer 2, in Raw, without the TCP/IP stack, what could be wrong?

            Thanks for your help. Best regards.

            ...

            ANSWER

            Answered 2021-Jun-01 at 23:15

            For security, the driver refuses to send these types of packets by default.

            Of course, since you have the source code to the driver, you are free to modify this restriction however you like — it's your driver. You can add a line to specifically allow the 0x88A4 EtherType, or delete the entire if-statement to allow all EtherTypes. You can require the usermode process to be running as Administrator if it wants to send "suspicious" network frames.

            A bit more detail on the security angle. If you allow untrusted users/programs to place arbitrary data onto the network, that may compromise or weaken network security. This is why the sample driver (and Windows in general) does not allow arbitrary programs to put arbitrary data on the network.

            For example, a malicious program that has unrestricted access to the Ethernet layer can advertise a malicious DHCP server that points clients to a malicious DNS server, conduct ARP poisoning attacks on your switch, DoS a switch (with, for example, 802.3x PAUSE frames, or with LLDPDUs that undermine the QoS policy), or circumvent any firewall policies you might have.

            These potential attacks aren't necessarily a deal-breaker: consider that this is roughly the equivalent of allowing someone to plug an arbitrary unmanaged device into an Ethernet jack on your network. If your network already has measures in place to defend against hostile Ethernet endpoints, then removing restrictions from the sample driver not making things much worse. Alternatively, if you have some level of trust for all the users & code on the PCs that will run your driver, then modifying the driver won't matter. Or if your threat model already assumes the network is hostile and unreliable, then removing these restrictions will only help fulfill your threat model's expectations. ;)

            Source https://stackoverflow.com/questions/67785400

            QUESTION

            Windows Network Device Driver: Set link UP/DOWN from within the driver
            Asked 2020-Oct-08 at 13:45

            I am writing a network driver for Windows. I want to do something like the pseudocode below:

            ...

            ANSWER

            Answered 2020-Oct-08 at 13:45

            Found inspiration from a proprietary network driver code. This function turns interface on/off:

            Source https://stackoverflow.com/questions/64174830

            QUESTION

            How to open device driver for IOCTL
            Asked 2020-Aug-08 at 18:23

            I am trying to open a device driver in order to send it an ioctl. There are many examples on SO and elsewhere but virtually all address opening "\\.\PhysicalDrive0" or the like. But I am trying to open a non-disk driver, compiled from Microsoft sample code at GitHub "Windows-driver-samples", namely "simgpio". It appears to have installed correctly but I don't know what "\\.\name" to use. I tried "\\.\simgpio" with no joy. Suggestions?

            For reference, I've included the driver's .INF file below.

            ...

            ANSWER

            Answered 2020-Jul-18 at 20:06

            Thanks to comment by @Eryk, I was able to open a driver. I include a sample program below. All error checking was omitted for clarity. I used the CDROM driver class in this example. The real challenge is finding the elusive GUID to use - you must do some deep digging in the SDK, DDK, include files or your driver.

            Source https://stackoverflow.com/questions/62717684

            QUESTION

            How can I read the received packets with a NDIS filter driver?
            Asked 2020-Jul-23 at 04:03

            I am currently experimenting with the NDIS driver samples. I am trying to print the packets contents (including the MAC-addresses, EtherType and the data).

            My first guess was to implement this in the function FilterReceiveNetBufferLists. Unfortunately I am not sure how to extract the packets contents out of the NetBufferLists.

            ...

            ANSWER

            Answered 2020-Jul-23 at 04:03

            That's the right place to start. Consider this code:

            Source https://stackoverflow.com/questions/63040275

            QUESTION

            How to get file size in Windows kernel
            Asked 2020-Jul-14 at 15:01

            I need to get file size in Windows kernel. I read the file into a buffer in kernel, while the code is as below. And I dig out a lot.

            ...

            ANSWER

            Answered 2020-Jul-14 at 15:01

            GetFileSize is not a WDK function. Use ZwQueryInformationFile instead of GetFileSize.

            Use the codes below

            Source https://stackoverflow.com/questions/62514325

            QUESTION

            How capture Etw in kernelmode?
            Asked 2020-Mar-12 at 17:35

            I'm trying to capture some syscalls using Etw in my driver, to be more precise I need capture NtWriteVirtualMemory and NtReadVirtualMemory usermode calls, i tried using the provider: Microsoft Windows Threat Intelligence, I used PerfView to dump the Threat Inteligence xml for Windows 10 1909 and used message compiler to compile the manifest(exactly what microsoft said to do) and checked Microsoft Etw sample code, but for some reason my callback is called only once(when EtwRegister is called in my DriverEntry), to register my callback i just called EtwRegister, what i should do for my callback be called? I'm using Microsoft sample code with a header file that was generated by mc.exe(message compiler)

            ...

            ANSWER

            Answered 2020-Mar-12 at 17:35

            The sample you looked at is for an ETW Provider, not a consumer. I'm not sure there is a documented way to consume ETW events from kernel. You can check samples for consuming events from user mode: https://github.com/microsoft/Windows-driver-samples/tree/master/general/tracing/SystemTraceControl

            Also note that Microsoft Windows Threat Intelligence ETW provider can only be consumed in Anti-Malware PPL type process. It requires having an Early Launch AntiMalware driver with a matching AntiMalware service. More info can be found at: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/early-launch-antimalware https://docs.microsoft.com/en-us/windows/win32/services/protecting-anti-malware-services-

            Source https://stackoverflow.com/questions/60344846

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Windows-driver-samples

            If you're writing your first driver, use these exercises to get started. Each exercise is independent of the others, so you can do them in any order.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries