mirror of
https://gitea.tendokyu.moe/self/even
synced 2024-12-18 02:26:02 +01:00
build: refactor makefile
This commit is contained in:
parent
189aac97a0
commit
5ca6ecab0e
243
.clang-format
243
.clang-format
@ -1,246 +1,5 @@
|
|||||||
---
|
---
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
# BasedOnStyle: Microsoft
|
BasedOnStyle: Microsoft
|
||||||
AccessModifierOffset: -2
|
|
||||||
AlignAfterOpenBracket: Align
|
|
||||||
AlignArrayOfStructures: None
|
|
||||||
AlignConsecutiveAssignments:
|
|
||||||
Enabled: false
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignCompound: false
|
|
||||||
AlignFunctionPointers: false
|
|
||||||
PadOperators: true
|
|
||||||
AlignConsecutiveBitFields:
|
|
||||||
Enabled: false
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignCompound: false
|
|
||||||
AlignFunctionPointers: false
|
|
||||||
PadOperators: false
|
|
||||||
AlignConsecutiveDeclarations:
|
|
||||||
Enabled: false
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignCompound: false
|
|
||||||
AlignFunctionPointers: false
|
|
||||||
PadOperators: false
|
|
||||||
AlignConsecutiveMacros:
|
|
||||||
Enabled: false
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignCompound: false
|
|
||||||
AlignFunctionPointers: false
|
|
||||||
PadOperators: false
|
|
||||||
AlignConsecutiveShortCaseStatements:
|
|
||||||
Enabled: false
|
|
||||||
AcrossEmptyLines: false
|
|
||||||
AcrossComments: false
|
|
||||||
AlignCaseColons: false
|
|
||||||
AlignEscapedNewlines: Right
|
|
||||||
AlignOperands: Align
|
|
||||||
AlignTrailingComments:
|
|
||||||
Kind: Always
|
|
||||||
OverEmptyLines: 0
|
|
||||||
AllowAllArgumentsOnNextLine: true
|
|
||||||
AllowAllParametersOfDeclarationOnNextLine: true
|
|
||||||
AllowBreakBeforeNoexceptSpecifier: Never
|
|
||||||
AllowShortBlocksOnASingleLine: Never
|
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
|
||||||
AllowShortCompoundRequirementOnASingleLine: true
|
|
||||||
AllowShortEnumsOnASingleLine: false
|
|
||||||
AllowShortFunctionsOnASingleLine: None
|
|
||||||
AllowShortIfStatementsOnASingleLine: Never
|
|
||||||
AllowShortLambdasOnASingleLine: All
|
|
||||||
AllowShortLoopsOnASingleLine: false
|
|
||||||
AlwaysBreakAfterDefinitionReturnType: None
|
|
||||||
AlwaysBreakAfterReturnType: None
|
|
||||||
AlwaysBreakBeforeMultilineStrings: false
|
|
||||||
AlwaysBreakTemplateDeclarations: MultiLine
|
|
||||||
AttributeMacros:
|
|
||||||
- __capability
|
|
||||||
BinPackArguments: true
|
|
||||||
BinPackParameters: true
|
|
||||||
BitFieldColonSpacing: Both
|
|
||||||
BraceWrapping:
|
|
||||||
AfterCaseLabel: false
|
|
||||||
AfterClass: true
|
|
||||||
AfterControlStatement: Always
|
|
||||||
AfterEnum: true
|
|
||||||
AfterExternBlock: true
|
|
||||||
AfterFunction: true
|
|
||||||
AfterNamespace: true
|
|
||||||
AfterObjCDeclaration: true
|
|
||||||
AfterStruct: true
|
|
||||||
AfterUnion: false
|
|
||||||
BeforeCatch: true
|
|
||||||
BeforeElse: true
|
|
||||||
BeforeLambdaBody: false
|
|
||||||
BeforeWhile: false
|
|
||||||
IndentBraces: false
|
|
||||||
SplitEmptyFunction: true
|
|
||||||
SplitEmptyRecord: true
|
|
||||||
SplitEmptyNamespace: true
|
|
||||||
BreakAdjacentStringLiterals: true
|
|
||||||
BreakAfterAttributes: Leave
|
|
||||||
BreakAfterJavaFieldAnnotations: false
|
|
||||||
BreakArrays: true
|
|
||||||
BreakBeforeBinaryOperators: None
|
|
||||||
BreakBeforeConceptDeclarations: Always
|
|
||||||
BreakBeforeBraces: Custom
|
|
||||||
BreakBeforeInlineASMColon: OnlyMultiline
|
|
||||||
BreakBeforeTernaryOperators: true
|
|
||||||
BreakConstructorInitializers: BeforeColon
|
|
||||||
BreakInheritanceList: BeforeColon
|
|
||||||
BreakStringLiterals: true
|
|
||||||
ColumnLimit: 120
|
|
||||||
CommentPragmas: '^ IWYU pragma:'
|
|
||||||
CompactNamespaces: false
|
|
||||||
ConstructorInitializerIndentWidth: 4
|
|
||||||
ContinuationIndentWidth: 4
|
|
||||||
Cpp11BracedListStyle: true
|
|
||||||
DerivePointerAlignment: false
|
|
||||||
DisableFormat: false
|
|
||||||
EmptyLineAfterAccessModifier: Never
|
|
||||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
|
||||||
ExperimentalAutoDetectBinPacking: false
|
|
||||||
FixNamespaceComments: true
|
|
||||||
ForEachMacros:
|
|
||||||
- foreach
|
|
||||||
- Q_FOREACH
|
|
||||||
- BOOST_FOREACH
|
|
||||||
IfMacros:
|
|
||||||
- KJ_IF_MAYBE
|
|
||||||
IncludeBlocks: Preserve
|
|
||||||
IncludeCategories:
|
|
||||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
|
||||||
Priority: 2
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
|
||||||
Priority: 3
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
- Regex: '.*'
|
|
||||||
Priority: 1
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
IncludeIsMainRegex: '(Test)?$'
|
|
||||||
IncludeIsMainSourceRegex: ''
|
|
||||||
IndentAccessModifiers: false
|
|
||||||
IndentCaseBlocks: false
|
|
||||||
IndentCaseLabels: false
|
|
||||||
IndentExternBlock: AfterExternBlock
|
|
||||||
IndentGotoLabels: true
|
|
||||||
IndentPPDirectives: None
|
|
||||||
IndentRequiresClause: true
|
|
||||||
IndentWidth: 4
|
|
||||||
IndentWrappedFunctionNames: false
|
|
||||||
InsertBraces: false
|
|
||||||
InsertNewlineAtEOF: false
|
|
||||||
InsertTrailingCommas: None
|
|
||||||
IntegerLiteralSeparator:
|
|
||||||
Binary: 0
|
|
||||||
BinaryMinDigits: 0
|
|
||||||
Decimal: 0
|
|
||||||
DecimalMinDigits: 0
|
|
||||||
Hex: 0
|
|
||||||
HexMinDigits: 0
|
|
||||||
JavaScriptQuotes: Leave
|
|
||||||
JavaScriptWrapImports: true
|
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
|
||||||
KeepEmptyLinesAtEOF: false
|
|
||||||
LambdaBodyIndentation: Signature
|
|
||||||
LineEnding: DeriveLF
|
|
||||||
MacroBlockBegin: ''
|
|
||||||
MacroBlockEnd: ''
|
|
||||||
MaxEmptyLinesToKeep: 1
|
|
||||||
NamespaceIndentation: None
|
|
||||||
ObjCBinPackProtocolList: Auto
|
|
||||||
ObjCBlockIndentWidth: 2
|
|
||||||
ObjCBreakBeforeNestedBlockParam: true
|
|
||||||
ObjCSpaceAfterProperty: false
|
|
||||||
ObjCSpaceBeforeProtocolList: true
|
|
||||||
PackConstructorInitializers: BinPack
|
|
||||||
PenaltyBreakAssignment: 2
|
|
||||||
PenaltyBreakBeforeFirstCallParameter: 19
|
|
||||||
PenaltyBreakComment: 300
|
|
||||||
PenaltyBreakFirstLessLess: 120
|
|
||||||
PenaltyBreakOpenParenthesis: 0
|
|
||||||
PenaltyBreakScopeResolution: 500
|
|
||||||
PenaltyBreakString: 1000
|
|
||||||
PenaltyBreakTemplateDeclaration: 10
|
|
||||||
PenaltyExcessCharacter: 1000000
|
|
||||||
PenaltyIndentedWhitespace: 0
|
|
||||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
|
||||||
PointerAlignment: Right
|
|
||||||
PPIndentWidth: -1
|
|
||||||
QualifierAlignment: Leave
|
|
||||||
ReferenceAlignment: Pointer
|
|
||||||
ReflowComments: true
|
|
||||||
RemoveBracesLLVM: false
|
|
||||||
RemoveParentheses: Leave
|
|
||||||
RemoveSemicolon: false
|
|
||||||
RequiresClausePosition: OwnLine
|
|
||||||
RequiresExpressionIndentation: OuterScope
|
|
||||||
SeparateDefinitionBlocks: Leave
|
|
||||||
ShortNamespaceLines: 1
|
|
||||||
SkipMacroDefinitionBody: false
|
|
||||||
SortIncludes: CaseSensitive
|
|
||||||
SortJavaStaticImport: Before
|
|
||||||
SortUsingDeclarations: LexicographicNumeric
|
|
||||||
SpaceAfterCStyleCast: false
|
|
||||||
SpaceAfterLogicalNot: false
|
|
||||||
SpaceAfterTemplateKeyword: true
|
|
||||||
SpaceAroundPointerQualifiers: Default
|
|
||||||
SpaceBeforeAssignmentOperators: true
|
|
||||||
SpaceBeforeCaseColon: false
|
|
||||||
SpaceBeforeCpp11BracedList: false
|
|
||||||
SpaceBeforeCtorInitializerColon: true
|
|
||||||
SpaceBeforeInheritanceColon: true
|
|
||||||
SpaceBeforeJsonColon: false
|
|
||||||
SpaceBeforeParens: ControlStatements
|
|
||||||
SpaceBeforeParensOptions:
|
|
||||||
AfterControlStatements: true
|
|
||||||
AfterForeachMacros: true
|
|
||||||
AfterFunctionDefinitionName: false
|
|
||||||
AfterFunctionDeclarationName: false
|
|
||||||
AfterIfMacros: true
|
|
||||||
AfterOverloadedOperator: false
|
|
||||||
AfterPlacementOperator: true
|
|
||||||
AfterRequiresInClause: false
|
|
||||||
AfterRequiresInExpression: false
|
|
||||||
BeforeNonEmptyParentheses: false
|
|
||||||
SpaceBeforeRangeBasedForLoopColon: true
|
|
||||||
SpaceBeforeSquareBrackets: false
|
|
||||||
SpaceInEmptyBlock: false
|
|
||||||
SpacesBeforeTrailingComments: 1
|
|
||||||
SpacesInAngles: Never
|
|
||||||
SpacesInContainerLiterals: true
|
|
||||||
SpacesInLineCommentPrefix:
|
|
||||||
Minimum: 1
|
|
||||||
Maximum: -1
|
|
||||||
SpacesInParens: Never
|
|
||||||
SpacesInParensOptions:
|
|
||||||
InCStyleCasts: false
|
|
||||||
InConditionalStatements: false
|
|
||||||
InEmptyParentheses: false
|
|
||||||
Other: false
|
|
||||||
SpacesInSquareBrackets: false
|
|
||||||
Standard: Latest
|
|
||||||
StatementAttributeLikeMacros:
|
|
||||||
- Q_EMIT
|
|
||||||
StatementMacros:
|
|
||||||
- Q_UNUSED
|
|
||||||
- QT_REQUIRE_VERSION
|
|
||||||
TabWidth: 4
|
|
||||||
UseTab: Never
|
|
||||||
VerilogBreakBetweenInstancePorts: true
|
|
||||||
WhitespaceSensitiveMacros:
|
|
||||||
- BOOST_PP_STRINGIZE
|
|
||||||
- CF_SWIFT_NAME
|
|
||||||
- NS_SWIFT_NAME
|
|
||||||
- PP_STRINGIZE
|
|
||||||
- STRINGIZE
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
21
.gitignore
vendored
21
.gitignore
vendored
@ -1,5 +1,5 @@
|
|||||||
# Created by https://www.toptal.com/developers/gitignore/api/c
|
compile_commands.json
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=c
|
.peru/
|
||||||
|
|
||||||
### C ###
|
### C ###
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
# Shared objects (inc. Windows DLLs)
|
# Shared objects (inc. Windows DLLs)
|
||||||
*.dll
|
*.dll
|
||||||
|
*.sys
|
||||||
*.so
|
*.so
|
||||||
*.so.*
|
*.so.*
|
||||||
*.dylib
|
*.dylib
|
||||||
@ -45,19 +46,3 @@
|
|||||||
*.su
|
*.su
|
||||||
*.idb
|
*.idb
|
||||||
*.pdb
|
*.pdb
|
||||||
|
|
||||||
# Kernel Module Compile Results
|
|
||||||
*.mod*
|
|
||||||
*.cmd
|
|
||||||
.tmp_versions/
|
|
||||||
modules.order
|
|
||||||
Module.symvers
|
|
||||||
Mkfile.old
|
|
||||||
dkms.conf
|
|
||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/c
|
|
||||||
|
|
||||||
*.sys
|
|
||||||
*.base
|
|
||||||
compile_commands.json
|
|
||||||
*.zip
|
|
||||||
|
97
Makefile
97
Makefile
@ -1,86 +1,51 @@
|
|||||||
#
|
CC = x86_64-w64-mingw32-gcc
|
||||||
# by Frank Rysanek <rysanek@fccps.cz>
|
RC = x86_64-w64-mingw32-windres
|
||||||
#
|
|
||||||
# Based on the source code of ioperm.c by Marcel Telka <marcel@telka.sk>
|
|
||||||
# - thanks a million :-)
|
|
||||||
#
|
|
||||||
|
|
||||||
# See also my_names.h
|
CFLAGS = -Wall -Wpedantic -DNDEBUG -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/ddk -O0 -std=c2x
|
||||||
# Note that after changing the driver name, you also have
|
LDFLAGS = -Wl,--subsystem,native \
|
||||||
# to rename $(DRVNAME).c manually in this directory :-)
|
-Wl,--image-base,0x10000 \
|
||||||
DRVNAME = even
|
-Wl,--file-alignment,0x1000 \
|
||||||
|
-Wl,--section-alignment,0x1000 \
|
||||||
|
-Wl,--entry,DriverEntry@8 \
|
||||||
|
-mdll -nostartfiles -nostdlib \
|
||||||
|
-s
|
||||||
|
|
||||||
INCLUDES = -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/ddk
|
VERSION = $(shell git describe --long --tags --dirty)
|
||||||
INCLUDES +=
|
|
||||||
|
|
||||||
|
ifneq ($(VERSION),)
|
||||||
# We could in fact just add -DEVEN_DRIVER_NAME=\"$(DRVNAME)\" to CFLAGS,
|
CFLAGS += -DEVEN_VERSION=\"$(VERSION)\"
|
||||||
# but we'd have to be careful to "make clean" after changing
|
RCFLAGS += -DEVEN_VERSION=\\\"$(VERSION)\\\"
|
||||||
# the driver name here in the makefile...
|
|
||||||
#CFLAGS = -Wall $(INCLUDES) -DEVEN_DRIVER_NAME=\"$(DRVNAME)\"
|
|
||||||
CFLAGS = -Wall -Wpedantic -DNDEBUG $(INCLUDES)
|
|
||||||
|
|
||||||
ifneq ($(RELEASE),)
|
|
||||||
VERSION = $(shell git describe --tags --always --dirty)
|
|
||||||
CFLAGS += -DEVEN_VERSION=\"$(VERSION)\"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Kernel-mode libs:
|
# Kernel-mode libs:
|
||||||
# libntoskrnl = basic kernel-mode environment
|
# libntoskrnl = basic kernel-mode environment
|
||||||
# libhal = WRITE_PORT_UCHAR et al.
|
# libhal = WRITE_PORT_UCHAR et al.
|
||||||
#KRNLIBS = -lntoskrnl -lhal
|
#KRNLIBS = -lntoskrnl -lhal
|
||||||
KRNLIBS = -lntoskrnl
|
KRNLIBS = -lntoskrnl
|
||||||
|
|
||||||
CC = x86_64-w64-mingw32-gcc
|
LDFLAGS += $(KRNLIBS)
|
||||||
DLLTOOL = x86_64-w64-mingw32-dlltool
|
|
||||||
STRIP = x86_64-w64-mingw32-strip
|
|
||||||
#STRIP = true
|
|
||||||
|
|
||||||
all: $(DRVNAME).sys
|
.SUFFIXES: .sys
|
||||||
|
|
||||||
# Dependencies on header files:
|
.PHONY: clean third_party
|
||||||
$(DRVNAME).sys: even_names.h even_ioctl.h even_peb.h utlist.h
|
|
||||||
|
|
||||||
# This shall get appended to the built-in set of suffixes supported:
|
all: even.sys
|
||||||
.SUFFIXES: .sys .exe
|
|
||||||
# Otherwise the custom inference rules below wouldn't ever kick in.
|
|
||||||
|
|
||||||
# This is implicit, no need to define this explicitly:
|
even.o: even_names.h even_ioctl.h even_peb.h third_party/utlist.h
|
||||||
#.c.o:
|
|
||||||
# $(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
# This inference rule allows us to turn an .o into a .sys without
|
%.res.o: %.rc
|
||||||
# much hassle, implicitly.
|
$(RC) -i $< -o $@ $(RCFLAGS)
|
||||||
# The downside is, that you cannot potentially add further object files
|
|
||||||
# to get linked into the .sys driver (such as, some custom ASM routines).
|
|
||||||
# Oh wait, maybe you can... try adding your .o after the last $(CC) in the rule...
|
|
||||||
.o.sys:
|
|
||||||
$(CC) -Wl,--base-file,$*.base \
|
|
||||||
-Wl,--entry,DriverEntry@8 \
|
|
||||||
-nostartfiles -nostdlib \
|
|
||||||
-o junk.tmp \
|
|
||||||
$*.o \
|
|
||||||
$(KRNLIBS)
|
|
||||||
-rm -f junk.tmp
|
|
||||||
$(DLLTOOL) --dllname $*.sys \
|
|
||||||
--base-file $*.base --output-exp $*.exp
|
|
||||||
$(CC) -Wl,--subsystem,native \
|
|
||||||
-Wl,--image-base,0x10000 \
|
|
||||||
-Wl,--file-alignment,0x1000 \
|
|
||||||
-Wl,--section-alignment,0x1000 \
|
|
||||||
-Wl,--entry,DriverEntry@8 \
|
|
||||||
-Wl,$*.exp \
|
|
||||||
-mdll -nostartfiles -nostdlib \
|
|
||||||
-o $*.sys \
|
|
||||||
$*.o \
|
|
||||||
$(KRNLIBS)
|
|
||||||
$(STRIP) $*.sys
|
|
||||||
|
|
||||||
JUNK = *.base *.exp *.o *~ junk.tmp
|
%.sys: %.o %.res.o
|
||||||
|
$(CC) $^ -o $@ $(LDFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(JUNK) *.sys
|
$(RM) *.o *.sys
|
||||||
|
|
||||||
semiclean:
|
third_party/utlist.h: .peru/lastimports
|
||||||
rm -f $(JUNK)
|
|
||||||
|
|
||||||
|
third_party: .peru/lastimports
|
||||||
|
peru reup
|
||||||
|
|
||||||
|
.peru/lastimports: peru.yaml
|
||||||
|
peru sync
|
||||||
|
36
README.md
Normal file
36
README.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
even.sys
|
||||||
|
========
|
||||||
|
|
||||||
|
> Even is not odd.
|
||||||
|
|
||||||
|
A stub for Htsysm7679.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
This project uses the MinGW toolchain to build.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
This stub didn't implement Htsysm7679's signature checks.
|
||||||
|
It's not a 1:1 replacement, but good enough to get executables running.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
even.sys - a stub for Htsysm7679
|
||||||
|
Copyright (C) 2024 Zephyr Lykos <self@mochaa.ws>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
8
even.c
8
even.c
@ -24,7 +24,7 @@
|
|||||||
#include "even_names.h"
|
#include "even_names.h"
|
||||||
|
|
||||||
#include "even_peb.h"
|
#include "even_peb.h"
|
||||||
#include "utlist.h"
|
#include "third_party/utlist.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Htsysm7679 constatns
|
* Htsysm7679 constatns
|
||||||
@ -99,7 +99,7 @@ static VOID __stdcall even_unload(IN PDRIVER_OBJECT DriverObject)
|
|||||||
ANSI_STRING SymbolicLinkNameA;
|
ANSI_STRING SymbolicLinkNameA;
|
||||||
UNICODE_STRING SymbolicLinkNameW;
|
UNICODE_STRING SymbolicLinkNameW;
|
||||||
|
|
||||||
DbgPrint("Even Htsysm7679: DriverUnload called\r\n"); // catch this using DBGVIEW from www.sysinternals.com
|
DbgPrint("Even Htsysm7679: DriverUnload called\r\n");
|
||||||
|
|
||||||
even_peb_t *el, *tmp;
|
even_peb_t *el, *tmp;
|
||||||
DL_FOREACH_SAFE(even_fake_peb, el, tmp)
|
DL_FOREACH_SAFE(even_fake_peb, el, tmp)
|
||||||
@ -108,8 +108,6 @@ static VOID __stdcall even_unload(IN PDRIVER_OBJECT DriverObject)
|
|||||||
ExFreePool(el);
|
ExFreePool(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*RtlInitUnicodeString( &SymbolicLinkName, EVEN_DOSDEVICE_NAME );*/
|
|
||||||
/* If I want to use normal string combining logic in my_names.h, I need to mess with ANSI vs. Unicode */
|
|
||||||
RtlInitString(&SymbolicLinkNameA, EVEN_DOSDEVICE_NAME);
|
RtlInitString(&SymbolicLinkNameA, EVEN_DOSDEVICE_NAME);
|
||||||
RtlAnsiStringToUnicodeString(&SymbolicLinkNameW, &SymbolicLinkNameA,
|
RtlAnsiStringToUnicodeString(&SymbolicLinkNameW, &SymbolicLinkNameA,
|
||||||
TRUE); /* Init from an ANSI string, and do allocate target buffer */
|
TRUE); /* Init from an ANSI string, and do allocate target buffer */
|
||||||
@ -422,7 +420,7 @@ NTSTATUS __stdcall DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRIN
|
|||||||
"GNU General Public License for more details."
|
"GNU General Public License for more details."
|
||||||
"\r\n");
|
"\r\n");
|
||||||
|
|
||||||
DbgPrint("Even Htsysm7679: DriverEntry Called\r\n"); // catch this using DBGVIEW from www.sysinternals.com
|
DbgPrint("Even Htsysm7679: DriverEntry Called\r\n");
|
||||||
|
|
||||||
/* support for service stopping */
|
/* support for service stopping */
|
||||||
DriverObject->DriverUnload = even_unload;
|
DriverObject->DriverUnload = even_unload;
|
||||||
|
33
even.rc
Normal file
33
even.rc
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include <windows.h>
|
||||||
|
#include "even_names.h"
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION 0,0,0,0
|
||||||
|
PRODUCTVERSION 0,0,0,0
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
#ifdef _DEBUG
|
||||||
|
FILEFLAGS 0x1L
|
||||||
|
#else
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
#endif
|
||||||
|
FILEOS VOS_UNKNOWN
|
||||||
|
FILETYPE VFT_DLL
|
||||||
|
FILESUBTYPE VFT2_UNKNOWN
|
||||||
|
{
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
{
|
||||||
|
BLOCK "040904b0"
|
||||||
|
{
|
||||||
|
VALUE "CompanyName", "Zephyr Lykos"
|
||||||
|
VALUE "FileDescription", "Even is not odd (Htsysm7679 stub)"
|
||||||
|
#ifdef EVEN_VERSION
|
||||||
|
VALUE "FileVersion", EVEN_VERSION
|
||||||
|
VALUE "ProductVersion", EVEN_VERSION
|
||||||
|
#endif
|
||||||
|
VALUE "InternalName", "odd.sys"
|
||||||
|
VALUE "LegalCopyright", "\xA9 2024 Zephyr Lykos"
|
||||||
|
VALUE "OriginalFilename", "even.sys"
|
||||||
|
VALUE "ProductName", "Even"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
96
even_ioctl.h
96
even_ioctl.h
@ -1,46 +1,50 @@
|
|||||||
#ifndef _EVEN_IOCTL_H_
|
/*
|
||||||
#define _EVEN_IOCTL_H_ 1
|
* even.sys - a stub for Htsysm7679
|
||||||
|
* Copyright (C) 2024 Zephyr Lykos <self@mochaa.ws>
|
||||||
/*
|
*
|
||||||
METHOD_BUFFERED handles the copy_to_user/copy_from_user automagically for us, at the cost of some overhead
|
* This program is free software; you can redistribute it and/or modify
|
||||||
METHOD_OUT_DIRECT = no automagical copy, MDL set up for "Kernel_driver -> User_mode_app" direction
|
* it under the terms of the GNU General Public License as published by
|
||||||
METHOD_IN_DIRECT = no automagical copy, MDL set up for "User_mode_app -> Kernel_driver" direction
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
METHOD_NEITHER = no automagical copy, no automagical MDL setup. Driver (ioctl code) must be guaranteed
|
* (at your option) any later version.
|
||||||
to run in the context of the calling user-space thread and ask for the user->system
|
*
|
||||||
mapping itself, and its access to the buffer should be wrapped in a try/catch to handle
|
* This program is distributed in the hope that it will be useful,
|
||||||
potential exceptions...
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
That's right, DIRECT IN/OUT are from the driver's point of view, relative to the user-space app!!!
|
* GNU General Public License for more details.
|
||||||
Both the MSDN and the Coreproject.com article say so, the CodeProject article with added emphasis.
|
*
|
||||||
*/
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
/* CTL Codes above 0x800 are free for your custom use
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
Note: using METHOD_BUFFERED = we're lazy and we don't care about a bit of overhead */
|
*
|
||||||
|
*/
|
||||||
#define IOCTL_CHECK_1 CTL_CODE(0xaa01, 0xe10, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
||||||
#define IOCTL_CHECK_2 CTL_CODE(0xaa01, 0xe30, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
#ifndef _EVEN_IOCTL_H_
|
||||||
#define IOCTL_CHECK_3 CTL_CODE(0xaa01, 0xe31, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
#define _EVEN_IOCTL_H_ 1
|
||||||
#define IOCTL_WRITE_PEB_1 CTL_CODE(0xaa01, 0xe20, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
||||||
#define IOCTL_WRITE_PEB_2 CTL_CODE(0xaa01, 0xe21, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
#define IOCTL_CHECK_1 CTL_CODE(0xaa01, 0xe10, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
#define IOCTL_READ_PEB CTL_CODE(0xaa01, 0xe22, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
#define IOCTL_CHECK_2 CTL_CODE(0xaa01, 0xe30, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
|
#define IOCTL_CHECK_3 CTL_CODE(0xaa01, 0xe31, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
struct even_ioctl_in_data
|
#define IOCTL_WRITE_PEB_1 CTL_CODE(0xaa01, 0xe20, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
{
|
#define IOCTL_WRITE_PEB_2 CTL_CODE(0xaa01, 0xe21, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
unsigned int offset;
|
#define IOCTL_READ_PEB CTL_CODE(0xaa01, 0xe22, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
||||||
unsigned int value;
|
|
||||||
};
|
struct even_ioctl_in_data
|
||||||
|
{
|
||||||
struct even_ioctl_out_data
|
unsigned int offset;
|
||||||
{
|
unsigned int value;
|
||||||
unsigned int result;
|
};
|
||||||
};
|
|
||||||
|
struct even_ioctl_out_data
|
||||||
#define USE_EVEN_IOCTL_OUT_DATA(x) \
|
{
|
||||||
struct even_ioctl_out_data##x \
|
unsigned int result;
|
||||||
{ \
|
};
|
||||||
unsigned int result; \
|
|
||||||
unsigned char data[x * 4]; \
|
#define USE_EVEN_IOCTL_OUT_DATA(x) \
|
||||||
};
|
struct even_ioctl_out_data##x \
|
||||||
|
{ \
|
||||||
#endif /* _EVEN_IOCTL_H_ */
|
unsigned int result; \
|
||||||
// vim: sw=4 et
|
unsigned char data[x * 4]; \
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _EVEN_IOCTL_H_ */
|
||||||
|
// vim: sw=4 et
|
||||||
|
46
even_names.h
46
even_names.h
@ -1,15 +1,31 @@
|
|||||||
#ifndef _EVEN_NAMES_H_
|
/*
|
||||||
#define _EVEN_NAMES_H_ 1
|
* even.sys - a stub for Htsysm7679
|
||||||
|
* Copyright (C) 2024 Zephyr Lykos <self@mochaa.ws>
|
||||||
/* Remember: two "string literals" "will get concatenated into one"
|
*
|
||||||
if there's no punctuation between them:
|
* This program is free software; you can redistribute it and/or modify
|
||||||
"hello" "world" => "hello world"
|
* it under the terms of the GNU General Public License as published by
|
||||||
*/
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
#ifndef EVEN_DRIVER_NAME
|
* (at your option) any later version.
|
||||||
#define EVEN_DRIVER_NAME "Htsysm7679" /* not used itself outside of this header file */
|
*
|
||||||
#endif
|
* This program is distributed in the hope that it will be useful,
|
||||||
/* for the driver */
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
#define EVEN_DEVICE_NAME "\\Device\\" EVEN_DRIVER_NAME
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
#define EVEN_DOSDEVICE_NAME "\\DosDevices\\" EVEN_DRIVER_NAME /* AKA symlink name */
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
#endif /* _EVEN_NAMES_H_ */
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _EVEN_NAMES_H_
|
||||||
|
#define _EVEN_NAMES_H_ 1
|
||||||
|
|
||||||
|
#ifndef EVEN_DRIVER_NAME
|
||||||
|
#define EVEN_DRIVER_NAME "Htsysm7679"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EVEN_DEVICE_NAME "\\Device\\" EVEN_DRIVER_NAME
|
||||||
|
#define EVEN_DOSDEVICE_NAME "\\DosDevices\\" EVEN_DRIVER_NAME /* AKA symlink name */
|
||||||
|
|
||||||
|
#endif /* _EVEN_NAMES_H_ */
|
||||||
|
22
even_peb.h
22
even_peb.h
@ -1,3 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* even.sys - a stub for Htsysm7679
|
||||||
|
* Copyright (C) 2024 Zephyr Lykos <self@mochaa.ws>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _EVEN_PEB_H_
|
#ifndef _EVEN_PEB_H_
|
||||||
#define _EVEN_PEB_H_ 1
|
#define _EVEN_PEB_H_ 1
|
||||||
|
|
||||||
@ -11,5 +31,5 @@ typedef struct even_peb
|
|||||||
struct even_peb *next, *prev;
|
struct even_peb *next, *prev;
|
||||||
} even_peb_t;
|
} even_peb_t;
|
||||||
|
|
||||||
#endif
|
#endif /* _EVEN_PEB_H_ */
|
||||||
// vim: sw=4 et
|
// vim: sw=4 et
|
||||||
|
8
peru.yaml
Normal file
8
peru.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
imports:
|
||||||
|
utlist: third_party/
|
||||||
|
|
||||||
|
git module utlist:
|
||||||
|
url: https://github.com/troydhanson/uthash.git
|
||||||
|
rev: eeba1961f203869116a865e57c968e9c86e1b8c4
|
||||||
|
export: src/
|
||||||
|
pick: src/utlist.h
|
1076
third_party/utlist.h
vendored
Normal file
1076
third_party/utlist.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user