mirror of
https://github.com/UzixLS/KernelEx.git
synced 2025-07-19 07:21:20 +03:00
import KernelEx-4.0-RC1
This commit is contained in:
5
auxiliary/pdh/kord.def
Normal file
5
auxiliary/pdh/kord.def
Normal file
@ -0,0 +1,5 @@
|
||||
LIBRARY KERNEL32.dll
|
||||
|
||||
EXPORTS
|
||||
CommonUnimpStub@0 @17 NONAME
|
||||
|
43
auxiliary/pdh/makefile
Normal file
43
auxiliary/pdh/makefile
Normal file
@ -0,0 +1,43 @@
|
||||
# Makefile for GNU C Compiler (GCC)
|
||||
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
RCC = windres
|
||||
OBJ = pdh.o
|
||||
RES =
|
||||
DEF = pdh.def
|
||||
LIBS = kord.a -nostdlib -lkernel32
|
||||
LDFLAGS = -s -shared -e _DllMain@12 -Wl,--enable-stdcall-fixup
|
||||
BIN = ..\pdh.dll
|
||||
CFLAGS = -Os -Wall
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
.SUFFIXES: .rc
|
||||
|
||||
all : $(BIN)
|
||||
|
||||
.PHONY : clean
|
||||
clean :
|
||||
-@if exist *.o del *.o
|
||||
-@if exist *.po del *.po
|
||||
-@if exist *.a del *.a
|
||||
|
||||
realclean : clean
|
||||
-@if exist $(BIN) del $(BIN)
|
||||
|
||||
$(BIN) : $(OBJ) $(RES) kord.a
|
||||
$(CXX) $(LDFLAGS) -o $(BIN) $(OBJ) $(RES) $(LIBS) $(DEF)
|
||||
|
||||
.c.o :
|
||||
$(CC) $(CFLAGS) -c -MMD -MF $*.po -o $@ $<
|
||||
|
||||
.cpp.o :
|
||||
$(CXX) $(CXXFLAGS) -c -MMD -MF $*.po -o $@ $<
|
||||
|
||||
.rc.o :
|
||||
$(RCC) $< $@
|
||||
|
||||
.def.a :
|
||||
dlltool --def $< -l $@
|
||||
|
||||
-include $(OBJ:.o=.po)
|
38
auxiliary/pdh/makefile.msv
Normal file
38
auxiliary/pdh/makefile.msv
Normal file
@ -0,0 +1,38 @@
|
||||
# Makefile for Microsoft Visual C++ Compiler (MSVC)
|
||||
|
||||
OBJ = kord.lib pdh.obj
|
||||
RES =
|
||||
DEF = /DEF:pdh.def
|
||||
BIN = ..\pdh.dll
|
||||
LIBS = -nodefaultlib kernel32.lib gdi32.lib
|
||||
LDFLAGS = /DLL /OPT:NOWIN98 /ENTRY:DllMain@12
|
||||
CFLAGS = /W3 /O2 /Oi /FD
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
all : $(BIN)
|
||||
-@if exist $(BIN:.dll=.exp) del $(BIN:.dll=.exp)
|
||||
-@if exist $(BIN:.dll=.lib) del $(BIN:.dll=.lib)
|
||||
|
||||
.PHONY : clean
|
||||
clean :
|
||||
-@if exist *.obj del *.obj
|
||||
-@if exist *.idb del *.idb
|
||||
-@if exist *.res del *.res
|
||||
-@if exist *.exp del *.exp
|
||||
-@if exist *.lib del *.lib
|
||||
|
||||
realclean : clean
|
||||
-@if exist $(BIN) del $(BIN)
|
||||
|
||||
$(BIN) : $(OBJ) $(RES)
|
||||
link /nologo $(LDFLAGS) $(DEF) /OUT:$(BIN) $(LIBS) $(OBJ) $(RES)
|
||||
|
||||
.c.obj :
|
||||
cl /nologo $(CFLAGS) /c /Fo$@ $<
|
||||
|
||||
.cpp.obj :
|
||||
cl /nologo $(CXXFLAGS) /c /Fo$@ $<
|
||||
|
||||
kord.lib : kord.def
|
||||
link /LIB /NOLOGO /MACHINE:IX86 /DEF:$? /OUT:$@
|
||||
|
137
auxiliary/pdh/pdh.c
Normal file
137
auxiliary/pdh/pdh.c
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2007, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx 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; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
int WINAPI CommonUnimpStub(void);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UNIMPL_FUNC(name,params) \
|
||||
__asm__( ".text\n" \
|
||||
".globl _" #name "@0\n" \
|
||||
"_" #name "_new@0:\n\t" \
|
||||
"xor %eax, %eax\n\t" \
|
||||
"movb $" #params ", %cl\n\t" \
|
||||
"jmp _CommonUnimpStub@0\n\t" \
|
||||
)
|
||||
#else
|
||||
#define UNIMPL_FUNC(name,params) \
|
||||
int __declspec(naked) __stdcall name() \
|
||||
{ \
|
||||
__asm xor eax,eax \
|
||||
__asm mov cl, params \
|
||||
__asm jmp CommonUnimpStub \
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
OSVERSIONINFO osv;
|
||||
osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx(&osv);
|
||||
if (osv.dwMajorVersion < 5)
|
||||
return FALSE;
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
break;
|
||||
}
|
||||
case DLL_PROCESS_DETACH:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UNIMPL_FUNC(PdhGetDllVersion, 1);
|
||||
UNIMPL_FUNC(PdhOpenQueryA, 3);
|
||||
UNIMPL_FUNC(PdhOpenQueryW, 3);
|
||||
UNIMPL_FUNC(PdhAddCounterA, 4);
|
||||
UNIMPL_FUNC(PdhAddCounterW, 4);
|
||||
UNIMPL_FUNC(PdhRemoveCounter, 1);
|
||||
UNIMPL_FUNC(PdhCollectQueryData, 1);
|
||||
UNIMPL_FUNC(PdhCloseQuery, 1);
|
||||
UNIMPL_FUNC(PdhGetFormattedCounterValue, 4);
|
||||
UNIMPL_FUNC(PdhGetFormattedCounterArrayA, 5);
|
||||
UNIMPL_FUNC(PdhGetFormattedCounterArrayW, 5);
|
||||
UNIMPL_FUNC(PdhGetRawCounterValue, 3);
|
||||
UNIMPL_FUNC(PdhGetRawCounterArrayA, 4);
|
||||
UNIMPL_FUNC(PdhGetRawCounterArrayW, 4);
|
||||
UNIMPL_FUNC(PdhCalculateCounterFromRawValue, 5);
|
||||
UNIMPL_FUNC(PdhComputeCounterStatistics, 6);
|
||||
UNIMPL_FUNC(PdhGetCounterInfoA, 4);
|
||||
UNIMPL_FUNC(PdhGetCounterInfoW, 4);
|
||||
UNIMPL_FUNC(PdhSetCounterScaleFactor, 2);
|
||||
UNIMPL_FUNC(PdhConnectMachineA, 1);
|
||||
UNIMPL_FUNC(PdhConnectMachineW, 1);
|
||||
UNIMPL_FUNC(PdhEnumMachinesA, 3);
|
||||
UNIMPL_FUNC(PdhEnumMachinesW, 3);
|
||||
UNIMPL_FUNC(PdhEnumObjectsA, 6);
|
||||
UNIMPL_FUNC(PdhEnumObjectsW, 6);
|
||||
UNIMPL_FUNC(PdhEnumObjectItemsA, 9);
|
||||
UNIMPL_FUNC(PdhEnumObjectItemsW, 9);
|
||||
UNIMPL_FUNC(PdhMakeCounterPathA, 4);
|
||||
UNIMPL_FUNC(PdhMakeCounterPathW, 4);
|
||||
UNIMPL_FUNC(PdhParseCounterPathA, 4);
|
||||
UNIMPL_FUNC(PdhParseCounterPathW, 4);
|
||||
UNIMPL_FUNC(PdhParseInstanceNameA, 6);
|
||||
UNIMPL_FUNC(PdhParseInstanceNameW, 6);
|
||||
UNIMPL_FUNC(PdhValidatePathA, 1);
|
||||
UNIMPL_FUNC(PdhValidatePathW, 1);
|
||||
UNIMPL_FUNC(PdhGetDefaultPerfObjectA, 4);
|
||||
UNIMPL_FUNC(PdhGetDefaultPerfObjectW, 4);
|
||||
UNIMPL_FUNC(PdhGetDefaultPerfCounterA, 5);
|
||||
UNIMPL_FUNC(PdhGetDefaultPerfCounterW, 5);
|
||||
UNIMPL_FUNC(PdhBrowseCountersA, 1);
|
||||
UNIMPL_FUNC(PdhBrowseCountersW, 1);
|
||||
UNIMPL_FUNC(PdhExpandCounterPathA, 3);
|
||||
UNIMPL_FUNC(PdhExpandCounterPathW, 3);
|
||||
UNIMPL_FUNC(PdhLookupPerfNameByIndexA, 4);
|
||||
UNIMPL_FUNC(PdhLookupPerfNameByIndexW, 4);
|
||||
UNIMPL_FUNC(PdhLookupPerfIndexByNameA, 3);
|
||||
UNIMPL_FUNC(PdhLookupPerfIndexByNameW, 3);
|
||||
UNIMPL_FUNC(PdhOpenLogA, 7);
|
||||
UNIMPL_FUNC(PdhOpenLogW, 7);
|
||||
UNIMPL_FUNC(PdhUpdateLogA, 2);
|
||||
UNIMPL_FUNC(PdhUpdateLogW, 2);
|
||||
UNIMPL_FUNC(PdhGetLogFileSize, 2);
|
||||
UNIMPL_FUNC(PdhCloseLog, 2);
|
||||
UNIMPL_FUNC(PdhSelectDataSourceA, 4);
|
||||
UNIMPL_FUNC(PdhSelectDataSourceW, 4);
|
||||
UNIMPL_FUNC(PdhIsRealTimeQuery, 1);
|
||||
UNIMPL_FUNC(PdhSetQueryTimeRange, 2);
|
||||
UNIMPL_FUNC(PdhGetDataSourceTimeRangeA, 4);
|
||||
UNIMPL_FUNC(PdhGetDataSourceTimeRangeW, 4);
|
||||
UNIMPL_FUNC(PdhCollectQueryDataEx, 3);
|
||||
UNIMPL_FUNC(PdhFormatFromRawValue, 6);
|
||||
UNIMPL_FUNC(PdhGetCounterTimeBase, 2);
|
||||
UNIMPL_FUNC(PdhEncodeWmiPathA, 5);
|
||||
UNIMPL_FUNC(PdhEncodeWmiPathW, 5);
|
||||
UNIMPL_FUNC(PdhDecodeWmiPathA, 5);
|
||||
UNIMPL_FUNC(PdhDecodeWmiPathW, 5);
|
||||
UNIMPL_FUNC(PdhReadRawLogRecord, 4);
|
||||
UNIMPL_FUNC(PdhLogServiceCommandA, 4);
|
||||
UNIMPL_FUNC(PdhLogServiceCommandW, 4);
|
||||
UNIMPL_FUNC(PdhLogServiceControlA, 5);
|
||||
UNIMPL_FUNC(PdhLogServiceControlW, 5);
|
73
auxiliary/pdh/pdh.def
Normal file
73
auxiliary/pdh/pdh.def
Normal file
@ -0,0 +1,73 @@
|
||||
LIBRARY pdh.dll BASE=0x7D050000
|
||||
EXPORTS
|
||||
PdhGetDllVersion
|
||||
PdhOpenQueryA
|
||||
PdhOpenQueryW
|
||||
PdhAddCounterA
|
||||
PdhAddCounterW
|
||||
PdhRemoveCounter
|
||||
PdhCollectQueryData
|
||||
PdhCloseQuery
|
||||
PdhGetFormattedCounterValue
|
||||
PdhGetFormattedCounterArrayA
|
||||
PdhGetFormattedCounterArrayW
|
||||
PdhGetRawCounterValue
|
||||
PdhGetRawCounterArrayA
|
||||
PdhGetRawCounterArrayW
|
||||
PdhCalculateCounterFromRawValue
|
||||
PdhComputeCounterStatistics
|
||||
PdhGetCounterInfoA
|
||||
PdhGetCounterInfoW
|
||||
PdhSetCounterScaleFactor
|
||||
PdhConnectMachineA
|
||||
PdhConnectMachineW
|
||||
PdhEnumMachinesA
|
||||
PdhEnumMachinesW
|
||||
PdhEnumObjectsA
|
||||
PdhEnumObjectsW
|
||||
PdhEnumObjectItemsA
|
||||
PdhEnumObjectItemsW
|
||||
PdhMakeCounterPathA
|
||||
PdhMakeCounterPathW
|
||||
PdhParseCounterPathA
|
||||
PdhParseCounterPathW
|
||||
PdhParseInstanceNameA
|
||||
PdhParseInstanceNameW
|
||||
PdhValidatePathA
|
||||
PdhValidatePathW
|
||||
PdhGetDefaultPerfObjectA
|
||||
PdhGetDefaultPerfObjectW
|
||||
PdhGetDefaultPerfCounterA
|
||||
PdhGetDefaultPerfCounterW
|
||||
PdhBrowseCountersA
|
||||
PdhBrowseCountersW
|
||||
PdhExpandCounterPathA
|
||||
PdhExpandCounterPathW
|
||||
PdhLookupPerfNameByIndexA
|
||||
PdhLookupPerfNameByIndexW
|
||||
PdhLookupPerfIndexByNameA
|
||||
PdhLookupPerfIndexByNameW
|
||||
PdhOpenLogA
|
||||
PdhOpenLogW
|
||||
PdhUpdateLogA
|
||||
PdhUpdateLogW
|
||||
PdhGetLogFileSize
|
||||
PdhCloseLog
|
||||
PdhSelectDataSourceA
|
||||
PdhSelectDataSourceW
|
||||
PdhIsRealTimeQuery
|
||||
PdhSetQueryTimeRange
|
||||
PdhGetDataSourceTimeRangeA
|
||||
PdhGetDataSourceTimeRangeW
|
||||
PdhCollectQueryDataEx
|
||||
PdhFormatFromRawValue
|
||||
PdhGetCounterTimeBase
|
||||
PdhEncodeWmiPathA
|
||||
PdhEncodeWmiPathW
|
||||
PdhDecodeWmiPathA
|
||||
PdhDecodeWmiPathW
|
||||
PdhReadRawLogRecord
|
||||
PdhLogServiceCommandA
|
||||
PdhLogServiceCommandW
|
||||
PdhLogServiceControlA
|
||||
PdhLogServiceControlW
|
Reference in New Issue
Block a user