mimidrv is now a Makefile project

This commit is contained in:
Benjamin DELPY 2014-04-12 21:43:49 +02:00
parent 4d77d1c0e6
commit a828f6d35e
9 changed files with 176 additions and 30 deletions

27
mimidrv/_build_.cmd Normal file
View File

@ -0,0 +1,27 @@
@echo off
set winddk=c:\WinDDK\7600.16385.1
set mimidrv=%~dp0
set path=%systemroot%;%systemroot%\system32
set origplatform=%1
set destination=%2
if %origplatform%==Win32 (
set platform=x86
set beginsource=x86
set endsource=i386
) else (
set platform=x64
set beginsource=amd64
set endsource=amd64
)
if exist %winddk% (
call %winddk%\bin\setenv.bat %winddk%\ fre %platform% WNET no_oacr
cd /d %mimidrv%
build
if errorlevel 0 (copy /y %mimidrv%\objfre_wnet_%beginsource%\%endsource%\*.sys %destination%) else echo Build failed :(
) else echo No WDK found :(
rd /s /q %mimidrv%\obj
rd /s /q %mimidrv%\%origplatform%

21
mimidrv/_clean_.cmd Normal file
View File

@ -0,0 +1,21 @@
@echo off
set mimidrv=%~dp0
set path=%systemroot%;%systemroot%\system32
set origplatform=%1
set destination=%2
if %origplatform%==Win32 (
set platform=x86
set beginsource=x86
set endsource=i386
) else (
set platform=x64
set beginsource=amd64
set endsource=amd64
)
del /f /q /a %destination%\*.sys
rd /s /q %mimidrv%\obj
rd /s /q %mimidrv%\objfre_wnet_%beginsource%
del /f /q /a %mimidrv%\buildfre_wnet_%beginsource%.log

3
mimidrv/_rebuild_.cmd Normal file
View File

@ -0,0 +1,3 @@
@echo off
call _clean_.cmd %1 "%2"
call _build_.cmd %1 "%2"

View File

@ -9,20 +9,21 @@
#include <ntddk.h>
#include <aux_klib.h>
#include <ntstrsafe.h>
#include <string.h>
#include "ioctl.h"
#define POOL_TAG 'kiwi'
#define MIMIDRV L"mimidrv"
#define kprintf(KiwiBuffer, Format, ...) (RtlStringCbPrintfExW(*((KiwiBuffer)->Buffer), *((KiwiBuffer)->szBuffer), (PWSTR *) ((KiwiBuffer)->Buffer), ((KiwiBuffer)->szBuffer), STRSAFE_NO_TRUNCATION, Format, __VA_ARGS__))
#define kprintf(KiwiBuffer, Format, ...) (RtlStringCbPrintfExW(*(KiwiBuffer)->Buffer, *(KiwiBuffer)->szBuffer, (KiwiBuffer)->Buffer, (KiwiBuffer)->szBuffer, STRSAFE_NO_TRUNCATION, Format, __VA_ARGS__))
extern char * PsGetProcessImageFileName(PEPROCESS monProcess);
extern NTSYSAPI NTSTATUS NTAPI ZwSetInformationProcess (__in HANDLE ProcessHandle, __in PROCESSINFOCLASS ProcessInformationClass, __in_bcount(ProcessInformationLength) PVOID ProcessInformation, __in ULONG ProcessInformationLength);
extern NTSYSAPI NTSTATUS NTAPI ZwUnloadKey(IN POBJECT_ATTRIBUTES DestinationKeyName);
typedef struct _KIWI_BUFFER {
SIZE_T * szBuffer;
PVOID * Buffer;
size_t * szBuffer;
PWSTR * Buffer;
} KIWI_BUFFER, *PKIWI_BUFFER;
typedef enum _KIWI_OS_INDEX {

View File

@ -98,7 +98,7 @@ NTSTATUS kkll_m_minifilters_list(PKIWI_BUFFER outBuffer)
if((status == STATUS_BUFFER_TOO_SMALL) && NumberFiltersReturned)
{
sizeOfBuffer = sizeof(PFLT_FILTER) * NumberFiltersReturned;
if(FilterList = ExAllocatePoolWithTag(NonPagedPool, sizeOfBuffer, POOL_TAG))
if(FilterList = (PFLT_FILTER *) ExAllocatePoolWithTag(NonPagedPool, sizeOfBuffer, POOL_TAG))
{
status = FltEnumerateFilters(FilterList, sizeOfBuffer, &NumberFiltersReturned);
for(i = 0; NT_SUCCESS(status) && (i < NumberFiltersReturned); i++)
@ -106,7 +106,7 @@ NTSTATUS kkll_m_minifilters_list(PKIWI_BUFFER outBuffer)
status = FltGetFilterInformation(FilterList[i], FilterFullInformation, NULL, 0, &sizeOfBuffer);
if((status == STATUS_BUFFER_TOO_SMALL) && sizeOfBuffer)
{
if(myFilterFullInformation = ExAllocatePoolWithTag(NonPagedPool, sizeOfBuffer, POOL_TAG))
if(myFilterFullInformation = (PFILTER_FULL_INFORMATION) ExAllocatePoolWithTag(NonPagedPool, sizeOfBuffer, POOL_TAG))
{
status = FltGetFilterInformation(FilterList[i], FilterFullInformation, myFilterFullInformation, sizeOfBuffer, &sizeOfBuffer);
if(NT_SUCCESS(status))
@ -117,7 +117,7 @@ NTSTATUS kkll_m_minifilters_list(PKIWI_BUFFER outBuffer)
status = FltEnumerateInstances(NULL, FilterList[i], NULL, 0, &NumberInstancesReturned);
if((status == STATUS_BUFFER_TOO_SMALL) && NumberInstancesReturned)
{
if(InstanceList = ExAllocatePoolWithTag(NonPagedPool, sizeof(PFLT_INSTANCE) * NumberInstancesReturned, POOL_TAG))
if(InstanceList = (PFLT_INSTANCE *) ExAllocatePoolWithTag(NonPagedPool, sizeof(PFLT_INSTANCE) * NumberInstancesReturned, POOL_TAG))
{
status = FltEnumerateInstances(NULL, FilterList[i], InstanceList, NumberInstancesReturned, &NumberInstancesReturned);
for(j = 0; NT_SUCCESS(status) && (j < NumberInstancesReturned); j++)

View File

@ -48,9 +48,9 @@ NTSTATUS MimiDispatchDeviceControl(IN OUT DEVICE_OBJECT *DeviceObject, IN OUT IR
{
NTSTATUS status = STATUS_NOT_SUPPORTED;
PIO_STACK_LOCATION pIoStackIrp = NULL;
SIZE_T szBufferIn, szBufferOut, szReallyOut = 0;
size_t szBufferIn, szBufferOut, szReallyOut = 0;
PVOID bufferIn, bufferOut;
KIWI_BUFFER kOutputBuffer = {&szBufferOut, &bufferOut};
KIWI_BUFFER kOutputBuffer = {&szBufferOut, (PWSTR *) &bufferOut};
ULONG i;
pIoStackIrp = IoGetCurrentIrpStackLocation(Irp);
if(pIoStackIrp)

63
mimidrv/mimidrv.vcxproj Normal file
View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{86FF6D04-208C-442F-B27C-E4255DD39402}</ProjectGuid>
<Keyword>MakeFileProj</Keyword>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType>Makefile</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v100</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
<IntDir>$(Platform)\</IntDir>
<NMakeBuildCommandLine>_build_.cmd $(Platform) $(SolutionDir)$(Platform)\</NMakeBuildCommandLine>
<NMakeCleanCommandLine>_clean_.cmd $(Platform) $(SolutionDir)$(Platform)\</NMakeCleanCommandLine>
<NMakeReBuildCommandLine>_rebuild_.cmd $(Platform) $(SolutionDir)$(Platform)\</NMakeReBuildCommandLine>
<NMakeIncludeSearchPath>C:\WinDDK\7600.16385.1\inc;C:\WinDDK\7600.16385.1\inc\api;C:\WinDDK\7600.16385.1\inc\ddk</NMakeIncludeSearchPath>
<NMakePreprocessorDefinitions>WIN32;NDEBUG;_X86_</NMakePreprocessorDefinitions>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ItemGroup>
<ClInclude Include="globals.h" />
<ClInclude Include="ioctl.h" />
<ClInclude Include="kkll_m_filters.h" />
<ClInclude Include="kkll_m_memory.h" />
<ClInclude Include="kkll_m_modules.h" />
<ClInclude Include="kkll_m_notify.h" />
<ClInclude Include="kkll_m_process.h" />
<ClInclude Include="kkll_m_ssdt.h" />
<ClInclude Include="mimidrv.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="kkll_m_filters.c" />
<ClCompile Include="kkll_m_memory.c" />
<ClCompile Include="kkll_m_modules.c" />
<ClCompile Include="kkll_m_notify.c" />
<ClCompile Include="kkll_m_process.c" />
<ClCompile Include="kkll_m_ssdt.c" />
<ClCompile Include="mimidrv.c" />
</ItemGroup>
<ItemGroup>
<None Include="MAKEFILE" />
<None Include="SOURCES" />
<None Include="_build_.cmd" />
<None Include="_clean_.cmd" />
<None Include="_rebuild_.cmd" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="mimidrv.rc" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="globals.h" />
<ClInclude Include="ioctl.h" />
<ClInclude Include="kkll_m_filters.h" />
<ClInclude Include="kkll_m_memory.h" />
<ClInclude Include="kkll_m_modules.h" />
<ClInclude Include="kkll_m_notify.h" />
<ClInclude Include="kkll_m_process.h" />
<ClInclude Include="kkll_m_ssdt.h" />
<ClInclude Include="mimidrv.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="kkll_m_filters.c" />
<ClCompile Include="kkll_m_memory.c" />
<ClCompile Include="kkll_m_modules.c" />
<ClCompile Include="kkll_m_notify.c" />
<ClCompile Include="kkll_m_process.c" />
<ClCompile Include="kkll_m_ssdt.c" />
<ClCompile Include="mimidrv.c" />
</ItemGroup>
<ItemGroup>
<None Include="MAKEFILE">
<Filter>winddk</Filter>
</None>
<None Include="SOURCES">
<Filter>winddk</Filter>
</None>
<None Include="_build_.cmd">
<Filter>winddk</Filter>
</None>
<None Include="_clean_.cmd">
<Filter>winddk</Filter>
</None>
<None Include="_rebuild_.cmd">
<Filter>winddk</Filter>
</None>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="mimidrv.rc" />
</ItemGroup>
<ItemGroup>
<Filter Include="winddk">
<UniqueIdentifier>{72bed6ab-78d7-441d-9009-8445ec0e72e6}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

View File

@ -38,28 +38,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "x64", "x64", "{E9D1619F-D4A
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mimilib", "mimilib\mimilib.vcxproj", "{E049487C-C5BD-471E-99AE-C756E70B6520}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "mimidrv", "mimidrv", "{3C603B1F-4427-402F-9704-65B3652B5F01}"
ProjectSection(SolutionItems) = preProject
mimidrv\globals.h = mimidrv\globals.h
mimidrv\ioctl.h = mimidrv\ioctl.h
mimidrv\kkll_m_filters.c = mimidrv\kkll_m_filters.c
mimidrv\kkll_m_filters.h = mimidrv\kkll_m_filters.h
mimidrv\kkll_m_memory.c = mimidrv\kkll_m_memory.c
mimidrv\kkll_m_memory.h = mimidrv\kkll_m_memory.h
mimidrv\kkll_m_modules.c = mimidrv\kkll_m_modules.c
mimidrv\kkll_m_modules.h = mimidrv\kkll_m_modules.h
mimidrv\kkll_m_notify.c = mimidrv\kkll_m_notify.c
mimidrv\kkll_m_notify.h = mimidrv\kkll_m_notify.h
mimidrv\kkll_m_process.c = mimidrv\kkll_m_process.c
mimidrv\kkll_m_process.h = mimidrv\kkll_m_process.h
mimidrv\kkll_m_ssdt.c = mimidrv\kkll_m_ssdt.c
mimidrv\kkll_m_ssdt.h = mimidrv\kkll_m_ssdt.h
mimidrv\MAKEFILE = mimidrv\MAKEFILE
mimidrv\mimidrv.c = mimidrv\mimidrv.c
mimidrv\mimidrv.h = mimidrv\mimidrv.h
mimidrv\mimidrv.rc = mimidrv\mimidrv.rc
mimidrv\SOURCES = mimidrv\SOURCES
EndProjectSection
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mimidrv", "mimidrv\mimidrv.vcxproj", "{86FF6D04-208C-442F-B27C-E4255DD39402}"
EndProject
Global
GlobalSection(SubversionScc) = preSolution
@ -79,6 +58,10 @@ Global
{E049487C-C5BD-471E-99AE-C756E70B6520}.Release|Win32.Build.0 = Release|Win32
{E049487C-C5BD-471E-99AE-C756E70B6520}.Release|x64.ActiveCfg = Release|x64
{E049487C-C5BD-471E-99AE-C756E70B6520}.Release|x64.Build.0 = Release|x64
{86FF6D04-208C-442F-B27C-E4255DD39402}.Release|Win32.ActiveCfg = Release|Win32
{86FF6D04-208C-442F-B27C-E4255DD39402}.Release|Win32.Build.0 = Release|Win32
{86FF6D04-208C-442F-B27C-E4255DD39402}.Release|x64.ActiveCfg = Release|x64
{86FF6D04-208C-442F-B27C-E4255DD39402}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE