From 10ab61225dfe255d9ac0104f7ced6fc6074308a8 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Tue, 30 Aug 2022 12:21:47 +0200 Subject: README.md update Signed-off-by: Toni Uhlig --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 160015a..4c5e4f0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Build](https://github.com/utoni/mingw-w64-ddk-template/actions/workflows/build.yml/badge.svg "Github Actions")](https://github.com/utoni/mingw-w64-ddk-template/actions/workflows/build.yml) -[![Gitlab-CI](https://gitlab.com/utoni/mingw-w64-ddk-template/badges/master/pipeline.svg "Gitlab-CI: master branch")](https://gitlab.com/utoni/mingw-w64-ddk-template/-/pipelines) +[![Gitlab-CI](https://gitlab.com/utoni/mingw-w64-ddk-template/badges/main/pipeline.svg "Gitlab-CI: main branch")](https://gitlab.com/utoni/mingw-w64-ddk-template/-/pipelines) [![Circle-CI](https://circleci.com/gh/utoni/mingw-w64-ddk-template.svg?style=shield "Circle-CI")](https://app.circleci.com/pipelines/github/utoni/mingw-w64-ddk-template) # Mingw64 Driver Plus Plus @@ -84,7 +84,7 @@ Most of the time copy&pasting missing libc/libgcc functions from various online Remember: The CRT/CRT++ **sets a driver unload function** meaning that code .e.g.: ```C -NTSTATUS MyDriverEntry(_In_ struct _DRIVER_OBJECT * DriverObject, _In_ PUNICODE_STRING RegistryPath) +NTSTATUS DriverEntry(_In_ struct _DRIVER_OBJECT * DriverObject, _In_ PUNICODE_STRING RegistryPath) { DriverObject->DriverUnload = MyDriverUnload; } @@ -96,6 +96,21 @@ Make sure that the symbol `DriverUnload` exists and has the usual ddk function s `void DriverUnload(_In_ struct _DRIVER_OBJECT * DriverObject)`. This is required to make ctors/dtors work without calling additional functions in `DriverEntry` / `DriverUnload`. +Do not forget to disable `C++ name mangeling` if your driver source is compiled with `g++`: + +```C++ +extern "C" { +NTSTATUS DriverEntry(_In_ struct _DRIVER_OBJECT *DriverObject, _In_ PUNICODE_STRING RegistryPath) +{ + // ... +} +VOID DriverUnload(_In_ struct _DRIVER_OBJECT *DriverObject) +{ + // ... +} +} +``` + ## Host EASTL/CRT/CRT++ Build It is possible to build parts of the repository for your host distribution. @@ -139,6 +154,8 @@ $(USERSPACE_TARGET): $(USERSPACE_OBJECTS) $(call LINK_CPP_USER_TARGET,$(USERSPACE_OBJECTS),$@) ``` +[A simple and stupid project example.](https://github.com/utoni/mingw-w64-driver) + ## Thanks goes to: - [Zeranoe](https://github.com/Zeranoe/mingw-w64-build) for the Mingw64 build script -- cgit v1.2.3