diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:21:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-11 08:21:29 +0000 |
commit | 29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc (patch) | |
tree | 63ef546b10a81d461e5cf5ed9e98a68cd7dee1aa /src/lib/kStuff/kProfiler2 | |
parent | Initial commit. (diff) | |
download | kbuild-29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc.tar.xz kbuild-29cd838eab01ed7110f3ccb2e8c6a35c8a31dbcc.zip |
Adding upstream version 1:0.1.9998svn3589+dfsg.upstream/1%0.1.9998svn3589+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib/kStuff/kProfiler2')
32 files changed, 19703 insertions, 0 deletions
diff --git a/src/lib/kStuff/kProfiler2/Makefile.kmk b/src/lib/kStuff/kProfiler2/Makefile.kmk new file mode 100644 index 0000000..b3650c9 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/Makefile.kmk @@ -0,0 +1,237 @@ +# $Id: Makefile.kmk 29 2009-07-01 20:30:29Z bird $ +## @file +# kProfiler Mark 2, sub-makefile. +# + +# +# Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +DEPTH ?= .. +SUB_DEPTH = .. +include $(PATH_KBUILD)/subheader.kmk + +#LIBRARIES += kPrf2GC kPrf2R0 +DLLS += kPrf2 +PROGRAMS += kPrf2Read + + +# +# Our template. +# +TEMPLATE_kPrf2 = kProfiler Template +if1of ($(BUILD_TARGET), win) +TEMPLATE_kPrf2_EXTENDS = kStuff + +else # Eliminate these +TEMPLATE_kPrf2_TOOL = GCC3 +TEMPLATE_kPrf2_TOOL.os2 = GCC3OMF +TEMPLATE_kPrf2_TOOL.win.x86 = VCC70 +TEMPLATE_kPrf2_TOOL.win.amd64 = VCC80AMD64 +TEMPLATE_kPrf2_ASTOOL = YASM +TEMPLATE_kPrf2_ASTOOL.os2 = NASM + +TEMPLATE_kPrf2_SDKS.win = WINPSDK + +TEMPLATE_kPrf2_CXXFLAGS.freebsd = -g +TEMPLATE_kPrf2_CXXFLAGS.linux = -g +TEMPLATE_kPrf2_CXXFLAGS.os2 = -g +TEMPLATE_kPrf2_CXXFLAGS.win = -Zi -Zl -W3 -GF -GR- +TEMPLATE_kPrf2_CXXFLAGS.win.amd64 = -GS- #-FAcs +ifneq ($(BUILD_TYPE),debug) +TEMPLATE_kPrf2_CXXFLAGS.freebsd+= -O3 +TEMPLATE_kPrf2_CXXFLAGS.linux += -O3 +TEMPLATE_kPrf2_CXXFLAGS.os2 += -O3 +TEMPLATE_kPrf2_CXXFLAGS.win += -O2b2 +endif + +TEMPLATE_kPrf2_ASFLAGS.freebsd = -f elf +TEMPLATE_kPrf2_ASFLAGS.linux = -f elf +TEMPLATE_kPrf2_ASFLAGS.os2 = -f omf +TEMPLATE_kPrf2_ASFLAGS.win.x86 = -f win32 -g cv8 +TEMPLATE_kPrf2_ASFLAGS.win.amd64 = -f win64 -g cv8 + +TEMPLATE_kPrf2_INCS = \ + ../include + +TEMPLATE_kPrf2_LDFLAGS.freebsd = -g +TEMPLATE_kPrf2_LDFLAGS.linux = -g +TEMPLATE_kPrf2_LDFLAGS.os2 = -g +TEMPLATE_kPrf2_LDFLAGS.win = /DEBUG + +TEMPLATE_kPrf2_LIBS.freebsd = +TEMPLATE_kPrf2_LIBS.linux = +TEMPLATE_kPrf2_LIBS.os2 = +TEMPLATE_kPrf2_LIBS.win = \ + $(PATH_SDK_WINPSDK_LIB)/psapi.Lib +TEMPLATE_kPrf2_LIBS.win.x86 = \ + $(PATH_TOOL_VCC70_LIB)/libcmt.lib \ + $(PATH_TOOL_VCC70_LIB)/oldnames.lib +TEMPLATE_kPrf2_LIBS.win.amd64 = \ + $(PATH_TOOL_VCC80AMD64_LIB)/oldnames.lib \ + $(PATH_TOOL_VCC80AMD64_LIB)/libcmt.lib +endif + + +# +# kPrf2 - The profiler module. +# +kPrf2_TEMPLATE = kPrf2 +kPrf2_DEFS.x86 = KPRF_BITS=32 +kPrf2_DEFS.amd64 = KPRF_BITS=64 +kPrf2_LDFLAGS.win.amd64 = -Entry:DllMain + +kPrf2_SOURCES = \ + kProfileR3.cpp +# kProfileGC.cpp +# kProfileR0.cpp + +kPrf2_SOURCES.win = \ + dllmain-win.cpp \ + kPrf2WinApiWrapperHlp.c \ + prf$(BUILD_TARGET_ARCH)msc.asm \ + kPrf2-win-$(BUILD_TARGET_ARCH).def +prfx86msc.asm_DEFS.win.x86 = \ + KPRF_ENTER=_KPrfEnter \ + KPRF_LEAVE=_KPrfLeave +prfamd64msc.asm_DEFS.win.amd64 = \ + KPRF_ENTER=KPrfEnter \ + KPRF_LEAVE=KPrfLeave + +# +# kPrf2Read - The read & producer of statistics. +# +kPrf2Read_TEMPLATE = kStuffEXE +kPrf2Read_SOURCES = \ + kPrf2Read.cpp +kPrf2Read_LIBS = \ + $(PATH_LIB)/kDbgStatic$(SUFF_LIB) \ + $(PATH_LIB)/kRdrStatic$(SUFF_LIB) \ + $(PATH_LIB)/kHlpCRTStatic$(SUFF_LIB) + +# +# kPrf2WinApiWrappers +# +IMPORT_LIBS.win += kPrf2WinApiWrappersImp +kPrf2WinApiWrappersImp_TEMPLATE = kStuffEXE +kPrf2WinApiWrappersImp_SOURCES.x86 = kPrf2WinApiWrappersImp-x86.def +kPrf2WinApiWrappersImp_SOURCES.amd64 = kPrf2WinApiWrappersImp-amd64.def + +DLLS.win += kPrf2WinApiWrappers +kPrf2WinApiWrappers_TEMPLATE = kPrf2 +kPrf2WinApiWrappers_CFLAGS = -GH -Gh +kPrf2WinApiWrappers_LDFLAGS.win.x86 = -Entry:DllMain@12 +kPrf2WinApiWrappers_LDFLAGS.win.amd64 = -Entry:DllMain +kPrf2WinApiWrappers_SOURCES = \ + kPrf2WinApiWrappers.c \ + kPrf2WinApiWrappersImp-$(BUILD_TARGET_ARCH).def +kPrf2WinApiWrappers_LIBS = \ + $(PATH_kPrf2)/kPrf2.lib + +ifeq (0,1) +kPrf2WinApiWrappers-kernel32.h: + $(SED) -f kPrf2WinApi-pre.sed --output $@.tmp \ + $(PATH_SDK_WINPSDK_INC)/WinBase.h \ + $(PATH_SDK_WINPSDK_INC)/WinCon.h \ + $(PATH_SDK_WINPSDK_INC)/WinNLS.h \ + $(PATH_SDK_WINPSDK_INC)/WinVer.h \ + $(PATH_SDK_WINPSDK_INC)/WinNT.h \ + $(PATH_SDK_WINPSDK_INC)/TlHelp32.h + $(APPEND) $@.tmp 'BOOL WINAPI ReplaceFile( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved );' + $(APPEND) $@.tmp 'BOOL WINAPI SetConsoleCursor( PVOID pvUnknown1, PVOID pvUnknown2 );' + $(APPEND) $@.tmp 'LPCH WINAPI GetEnvironmentStringsA( VOID );' + $(APPEND) $@.tmp 'BOOL WINAPI GetBinaryType( LPCSTR lpApplicationName, LPDWORD lpBinaryType );' + $(APPEND) $@.tmp 'WORD NTAPI RtlCaptureStackBackTrace( DWORD FramesToSkip, DWORD FramesToCapture, PVOID * BackTrace, PDWORD BackTraceHash );' + $(APPEND) $@.tmp 'PVOID RtlFillMemory( PVOID pv, int ch, SIZE_T cb );' + $(APPEND) $@.tmp 'PVOID RtlZeroMemory( PVOID pv, SIZE_T cb );' + $(APPEND) $@.tmp 'PVOID RtlMoveMemory( PVOID pvDst, PVOID pvSrc, SIZE_T cb );' + $(APPEND) $@.tmp 'VOID NTAPI RtlUnwind( PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue );' + $(APPEND) $@.tmp 'VOID NTAPI RtlUnwindEx( FRAME_POINTERS TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable );' + $(APPEND) $@.tmp 'ULONGLONG WINAPI RtlVirtualUnwind( ULONG HandlerType, ULONGLONG ImageBase, ULONGLONG ControlPC, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT ContextRecord, PBOOLEAN InFunction, PFRAME_POINTERS EstablisherFrame, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers );' + $(APPEND) $@.tmp 'PVOID WINAPI RtlPcToFileHeader( PVOID PcValue, PVOID * BaseOfImage );' + $(APPEND) $@.tmp 'PVOID WINAPI RtlLookupFunctionEntry( ULONGLONG ControlPC, PULONGLONG ImageBase, PULONGLONG TargetGp );' + $(APPEND) $@.tmp 'void WINAPI RtlRaiseException(PEXCEPTION_RECORD pXcpRec);' + $(APPEND) $@.tmp 'int WINAPI uaw_lstrcmpW( LPCUWSTR lpString1, LPCUWSTR lpString2 );' + $(APPEND) $@.tmp 'int WINAPI uaw_lstrcmpiW( LPCUWSTR lpString1, LPCUWSTR lpString2 );' + $(APPEND) $@.tmp 'int WINAPI uaw_lstrlenW( LPCUWSTR lpString );' + $(APPEND) $@.tmp 'LPUWSTR WINAPI uaw_wcschr( LPCUWSTR lpString, WCHAR wc );' + $(APPEND) $@.tmp 'LPUWSTR WINAPI uaw_wcscpy( LPUWSTR lpDst, LPCUWSTR lpSrc );' + $(APPEND) $@.tmp 'int WINAPI uaw_wcsicmp( LPCUWSTR lp1, LPCUWSTR lp2 );' + $(APPEND) $@.tmp 'SIZE_T WINAPI uaw_wcslen( LPCUWSTR lp1 );' + $(APPEND) $@.tmp 'LPUWSTR WINAPI uaw_wcsrchr( LPCUWSTR lpString, WCHAR wc );' + $(APPEND) $@.tmp 'LPSTR WINAPI lstrcat( LPSTR lpString1, LPCSTR lpString2 );' + $(APPEND) $@.tmp 'int WINAPI lstrcmp( LPCSTR lpString1, LPCSTR lpString2 );' + $(APPEND) $@.tmp 'int WINAPI lstrcmpi( LPCSTR lpString1, LPCSTR lpString2 );' + $(APPEND) $@.tmp 'LPSTR WINAPI lstrcpy( LPSTR lpString1, LPCSTR lpString2 );' + $(APPEND) $@.tmp 'LPSTR WINAPI lstrcpyn( LPSTR lpString1, LPCSTR lpString2, int iMaxLength );' + $(APPEND) $@.tmp 'int WINAPI lstrlen( LPCSTR lpString );' + $(SED) -f kPrf2WinApi-gencode.sed --output $@ $@.tmp + $(RM) -f $@.tmp + +kPrf2WinApiWrappersImp-$(KBUILD_TARGET_ARCH).def: + $(RM) -f $@ + $(PATH_TOOL_$(TEMPLATE_kStuff_TOOL.win.$(BUILD_TARGET_ARCH))_BIN)/dumpbin.exe /EXPORTS /OUT:$@.tmp $(PATH_SDK_WINPSDK_LIB)/Kernel32.lib + $(SED) -f kPrf2WinApi-dumpbin.sed --output $@.tmp2 $@.tmp + $(APPEND) $@ 'LIBRARY kPrf2WinApiWrappers' + $(APPEND) $@ 'EXPORTS' + $(SED) -f kPrf2WinApi-genimp.sed --append $@ $@.tmp2 + $(RM) -f $@.tmp $@.tmp2 +endif + +# +# A simple testcase. +# +PROGRAMS.win.x86 += tst +tst_TOOL = VCC70 +tst_SDKS = WINPSDK +tst_CFLAGS = -GH -Gh -Zi -Zl -GR- -GX- -GF- -W3 -wd4244 +tst_SOURCES = tst.c +tst.c_CFLAGS = -Od +tst_LDFLAGS = /DEBUG +tst_LIBS = \ + $(PATH_TOOL_VCC70_LIB)/msvcrt.lib \ + $(PATH_TOOL_VCC70_LIB)/msvcprt.lib \ + $(PATH_TOOL_VCC70_LIB)/oldnames.lib \ + $(PATH_kPrf2)/kPrf2.lib + +PROGRAMS += tstlongjmp +tstlongjmp_TEMPLATE = kStuffEXE +tstlongjmp_CFLAGS.win = -GH -Gh -Zi +tstlongjmp_SOURCES = tstlongjmp.c +tstlongjmp_LIBS = \ + $(PATH_kPrf2)/kPrf2.lib + +# Generate the rules +include $(PATH_KBUILD)/subfooter.kmk + + +# +# Aliases for .cpp.h files so we can more easily do syntax checking from the editor. +# +CORE := $(wildcard *core*.cpp.h *core*.h.h) +$(CORE:.h=.o) $(CORE:.h=.obj) : kProfileR3.o + +READ := $(wildcard *read*.cpp.h *read*.h.h) +$(READ:.h=.o) $(READ:.h=.obj) : kPrf2Read.o + diff --git a/src/lib/kStuff/kProfiler2/dllmain-win.cpp b/src/lib/kStuff/kProfiler2/dllmain-win.cpp new file mode 100644 index 0000000..56928d9 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/dllmain-win.cpp @@ -0,0 +1,75 @@ +/* $Id: dllmain-win.cpp 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - The Windows DllMain for the profiler DLL. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#include <Windows.h> +#include "kProfileR3.h" + + +/** + * The DLL Main for the kPrf DLL. + * + * This is required because we need to initialize the profiler at some point + * and because we need to know when threads terminate. (We don't care about + * when threads get created, we simply pick them up when we see them the + * first time.) + * + * @returns Success indicator. + * @param hInstDll The instance handle of the DLL. (i.e. the module handle) + * @param fdwReason The reason why we're here. This is a 'flag' for reasons of + * tradition, it's really a kind of enum. + * @param pReserved Reserved / undocumented something. + */ +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, PVOID pReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + if (kPrfInitialize()) + return FALSE; + break; + + case DLL_PROCESS_DETACH: + kPrfTerminate(); + break; + + case DLL_THREAD_ATTACH: + break; + + case DLL_THREAD_DETACH: + kPrfTerminateThread(); + break; + } + + return TRUE; +} + diff --git a/src/lib/kStuff/kProfiler2/kPrf2-win-amd64.def b/src/lib/kStuff/kProfiler2/kPrf2-win-amd64.def new file mode 100644 index 0000000..33bb8e2 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2-win-amd64.def @@ -0,0 +1,37 @@ +; $Id: kPrf2-win-amd64.def 29 2009-07-01 20:30:29Z bird $LIBRARY kPrf2 +;; @file +; kProfiler Mark 2 - Windows Linker Definition File, AMD64. +; + +; +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +; +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: +; +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. +; + +LIBRARY kPrf2 +EXPORTS + _penter + _pexit + KPrfInit + kPrf2WrapResolve + diff --git a/src/lib/kStuff/kProfiler2/kPrf2-win-x86.def b/src/lib/kStuff/kProfiler2/kPrf2-win-x86.def new file mode 100644 index 0000000..d486a09 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2-win-x86.def @@ -0,0 +1,36 @@ +; $Id: kPrf2-win-x86.def 29 2009-07-01 20:30:29Z bird $ +;; @file +; kProfiler Mark 2 - Windows Linker Definition File, x86. +; + +; +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +; +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: +; +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. +; + +LIBRARY kPrf2 +EXPORTS + _penter + _pexit + KPrfInit + kPrf2WrapResolve diff --git a/src/lib/kStuff/kProfiler2/kPrf2Read.cpp b/src/lib/kStuff/kProfiler2/kPrf2Read.cpp new file mode 100644 index 0000000..5f24e4a --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2Read.cpp @@ -0,0 +1,503 @@ +/* $Id: kPrf2Read.cpp 77 2016-06-22 17:03:55Z bird $ */ +/** @file + * kProfiler Mark 2 - The reader and producer of statistics. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include <k/kDbg.h> + + +/** @def KPRF_OFF2PTR + * Internal helper for converting a offset to a pointer. + * @internal + */ +#define KPRF_OFF2PTR(TypePrefix, TypeName, off, pHdr) \ + ( (KPRF_TYPE(TypePrefix, TypeName)) ((off) + (KUPTR)pHdr) ) + +/** @def KPRF_ALIGN + * The usual align macro. + * @internal + */ +#define KPRF_ALIGN(n, align) ( ((n) + ( (align) - 1)) & ~((align) - 1) ) + +/** @def KPRF_OFFSETOF + * My usual extended offsetof macro, except this returns KU32 and mangles the type name. + * @internal + */ +#define KPRF_OFFSETOF(kPrfType, Member) ( (KU32)(KUPTR)&((KPRF_TYPE(P,kPrfType))0)->Member ) + +/** @def PRF_SIZEOF + * Size of a kPrf type. + * @internal + */ +#define KPRF_SIZEOF(kPrfType) sizeof(KPRF_TYPE(,kPrfType)) + +#ifdef _MSC_VER +# define KPRF_FMT_U64 "I64u" +# define KPRF_FMT_X64 "I64x" +# define KPRF_FMT_I64 "I64d" +#else +# define KPRF_FMT_X64 "llx" +# define KPRF_FMT_U64 "llu" +# define KPRF_FMT_I64 "lld" +#endif + + +/* + * Instantiate the readers. + */ +/* 32-bit */ +#define KPRF_NAME(Suffix) KPrf32##Suffix +#define KPRF_TYPE(Prefix,Suffix) Prefix##KPRF32##Suffix +#define KPRF_BITS 32 +#define KPRF_FMT_UPTR "#010x" + +#include "prfcore.h.h" +#include "prfreader.cpp.h" + +#undef KPRF_FMT_UPTR +#undef KPRF_NAME +#undef KPRF_TYPE +#undef KPRF_BITS + +/* 64-bit */ +#define KPRF_NAME(Suffix) KPrf64##Suffix +#define KPRF_TYPE(Prefix,Suffix) Prefix##KPRF64##Suffix +#define KPRF_BITS 64 +#ifdef _MSC_VER +# define KPRF_FMT_UPTR "#018I64x" +#else +# define KPRF_FMT_UPTR "#018llx" +#endif + +#include "prfcore.h.h" +#include "prfreader.cpp.h" + +#undef KPRF_FMT_UPTR +#undef KPRF_NAME +#undef KPRF_TYPE +#undef KPRF_BITS + + +/******************************************************************************* +* Structures and Typedefs * +*******************************************************************************/ +/** + * Header union type. + */ +typedef union KPRFHDR +{ + KPRF32HDR Hdr32; + KPRF64HDR Hdr64; +} KPRFHDR; +typedef KPRFHDR *PKPRFHDR; +typedef const KPRFHDR *PCKPRFHDR; + + + +/** + * Read the data set into memory. + * + * @returns Pointer to the loaded data set. (release using free()). + * + * @param pszFilename The path to the profiler data set. + * @param pcb Where to store the size of the data set. + * @param pOut Where to write errors. + */ +PKPRFHDR kPrfLoad(const char *pszFilename, KU32 *pcb, FILE *pOut) +{ + FILE *pFile = fopen(pszFilename, "rb"); + if (!pFile) + { + fprintf(pOut, "Cannot open '%s' for reading!\n", pszFilename); + return NULL; + } + + /* + * Read the file into memory. + */ + long cbFile; + if ( !fseek(pFile, 0, SEEK_END) + && (cbFile = ftell(pFile)) >= 0 + && !fseek(pFile, 0, SEEK_SET) + ) + { + if (pcb) + *pcb = cbFile; + + void *pvData = malloc(cbFile); + if (pvData) + { + if (fread(pvData, cbFile, 1, pFile)) + { + + fclose(pFile); + return (PKPRFHDR)pvData; + } + fprintf(pOut, "Failed reading '%s' into memory!\n", pszFilename); + free(pvData); + } + else + fprintf(pOut, "Failed to allocate %ld bytes of memory for reading the file '%s' into!\n", cbFile, pszFilename); + } + else + fprintf(pOut, "Failed to determin the size of '%s'!\n", pszFilename); + + fclose(pFile); + return NULL; +} + + +/** + * Validates the data set + * + * @returns true if valid. + * @returns false if invalid. + * + * @param pHdr Pointer to the data set. + * @param cb The size of the data set. + * @param pOut Where to write error messages. + */ +static bool kPrfIsValidate(PCKPRFHDR pHdr, KU32 cb, FILE *pOut) +{ + /* + * We ASSUMES that the header is identicial with the exception + * of the uBasePtr size. (this is padded out and the upper bits are all zero) + */ + + if ( pHdr->Hdr32.u32Magic != KPRF32HDR_MAGIC + && pHdr->Hdr32.u32Magic != KPRF64HDR_MAGIC) + { + fprintf(pOut, "Invalid magic %#x\n", pHdr->Hdr32.u32Magic); + return false; + } + + if ( pHdr->Hdr32.cFormatBits != 32 + && pHdr->Hdr32.cFormatBits != 64) + { + fprintf(pOut, "Invalid/Unsupported bit count %u\n", pHdr->Hdr32.cFormatBits); + return false; + } + + if (pHdr->Hdr32.cb > cb) + { + fprintf(pOut, "Data set size mismatch. Header say %#x, input is %#x\n", pHdr->Hdr32.cb, cb); + return false; + } + +#define KPRF_VALIDATE_SIZE(MemBaseName, cb32, cb64) do {\ + if (pHdr->Hdr32.cb##MemBaseName > (pHdr->Hdr32.cFormatBits == 32 ? cb32 : cb64)) \ + { \ + fprintf(pOut, "cb" #MemBaseName " was expected to be %#x but is %#x. Probably a format change, rebuild.\n", \ + (unsigned)(pHdr->Hdr32.cFormatBits == 32 ? cb32 : cb64), pHdr->Hdr32.cb##MemBaseName); \ + return false; \ + }\ + } while (0) + + KPRF_VALIDATE_SIZE(Function, sizeof(KPRF32FUNC), sizeof(KPRF64FUNC)); + KPRF_VALIDATE_SIZE(Thread, sizeof(KPRF32THREAD), sizeof(KPRF64THREAD)); + KPRF_VALIDATE_SIZE(Stack, + (KU32)&((PKPRF32STACK)0)->aFrames[pHdr->Hdr32.cMaxStackFrames], + (KU32)&((PKPRF64STACK)0)->aFrames[pHdr->Hdr32.cMaxStackFrames]); + + KUPTR cbHeader = (KUPTR)&pHdr->Hdr32.aiFunctions[pHdr->Hdr32.cFunctions] - (KUPTR)pHdr; + if ( cbHeader != (KU32)cbHeader + || cbHeader >= cb) + { + fprintf(pOut, "cFunctions (%#x) is too large to fit the lookup table inside the data set.\n", + pHdr->Hdr32.cFunctions); + return false; + } + + /* The space assignment is hereby required to be equal to the member order in the header. */ + KU32 offMin = cbHeader; +#define KPRF_VALIDATE_OFF(off, name) do {\ + if ( off > 0 \ + && off < offMin) \ + { \ + fprintf(pOut, #name " (%#x) is overlapping with other element or invalid space assignment order.\n", off); \ + return false; \ + }\ + if (off >= cb) \ + { \ + fprintf(pOut, #name " (%#x) is outside the data set (%#x)\n", off, cb); \ + return false; \ + }\ + } while (0) +#define KPRF_VALIDATE_MEM(MemBaseName) do {\ + KPRF_VALIDATE_OFF(pHdr->Hdr32.off##MemBaseName##s, off##MemBaseName##s); \ + if ( pHdr->Hdr32.off##MemBaseName##s \ + && ( pHdr->Hdr32.off##MemBaseName##s + pHdr->Hdr32.cb##MemBaseName * pHdr->Hdr32.cMax##MemBaseName##s > cb \ + || pHdr->Hdr32.off##MemBaseName##s + pHdr->Hdr32.cb##MemBaseName * pHdr->Hdr32.cMax##MemBaseName##s < pHdr->Hdr32.off##MemBaseName##s)\ + ) \ + { \ + fprintf(pOut, #MemBaseName " (%#x) is outside the data set (%#x)\n", \ + pHdr->Hdr32.off##MemBaseName##s + pHdr->Hdr32.cb##MemBaseName * pHdr->Hdr32.cMax##MemBaseName##s, cb); \ + return false; \ + }\ + if (pHdr->Hdr32.c##MemBaseName##s > pHdr->Hdr32.cMax##MemBaseName##s) \ + { \ + fprintf(pOut, "c" #MemBaseName " (%#x) higher than the max (%#x)\n", \ + pHdr->Hdr32.c##MemBaseName##s, pHdr->Hdr32.cMax##MemBaseName##s); \ + return false; \ + } \ + if (pHdr->Hdr32.off##MemBaseName##s) \ + offMin += pHdr->Hdr32.cb##MemBaseName * pHdr->Hdr32.cMax##MemBaseName##s; \ + } while (0) + + KPRF_VALIDATE_MEM(Function); + KPRF_VALIDATE_OFF(pHdr->Hdr32.offModSegs, offModSegs); + if (pHdr->Hdr32.offModSegs) + KPRF_VALIDATE_OFF(pHdr->Hdr32.offModSegs + pHdr->Hdr32.cbMaxModSegs, cbMaxModSegs); + if (pHdr->Hdr32.cbModSegs > pHdr->Hdr32.cbMaxModSegs) + { + fprintf(pOut, "ccbModSegs (%#x) higher than the max (%#x)\n", + pHdr->Hdr32.cbModSegs, pHdr->Hdr32.cbMaxModSegs); + return false; + } + if (pHdr->Hdr32.offModSegs) \ + offMin += pHdr->Hdr32.cbMaxModSegs; \ + KPRF_VALIDATE_MEM(Thread); + KPRF_VALIDATE_MEM(Stack); + KPRF_VALIDATE_OFF(pHdr->Hdr32.offCommandLine, offCommandLine); + KPRF_VALIDATE_OFF(pHdr->Hdr32.offCommandLine + pHdr->Hdr32.cchCommandLine, cchCommandLine); + + /* + * Validate the function lookup table + */ + for (KU32 i = 0; i < pHdr->Hdr32.cFunctions; i++) + if (pHdr->Hdr32.aiFunctions[i] >= pHdr->Hdr32.cFunctions) + { + fprintf(pOut, "Function lookup entry %#x is invalid: index %#x, max is %#x\n", + i, pHdr->Hdr32.aiFunctions[i], pHdr->Hdr32.cFunctions); + return false; + } + + /* + * Validate the functions. + */ + switch (pHdr->Hdr32.cFormatBits) + { + case 32: + return KPrf32IsValid(&pHdr->Hdr32, cb, pOut); + + case 64: + return KPrf64IsValid(&pHdr->Hdr64, cb, pOut); + } + return false; +#undef KPRF_VALIDATE_SIZE +#undef KPRF_VALIDATE_MEM +#undef KPRF_VALIDATE_OFF +} + + +/** + * Dumps a kProfiler 2 format file. + * + * @returns 0 on success. + * @returns -1 on failure. + * + * @param pszFilename The path to the profiler data set. + * @param pOut Where to write the output. + */ +int KPrfDumpFile(const char *pszFilename, FILE *pOut) +{ + /* + * Load and validate the data set. + */ + KU32 cb; + PKPRFHDR pHdr = kPrfLoad(pszFilename, &cb, pOut); + if (!pHdr) + return -1; + if (!kPrfIsValidate(pHdr, cb, pOut)) + return -1; + + /* + * Switch to the appropirate dumper routine. + */ + int rc; + switch (pHdr->Hdr32.cFormatBits) + { + case 32: + rc = KPrf32Dump(&pHdr->Hdr32, pOut); + break; + + case 64: + rc = KPrf64Dump(&pHdr->Hdr64, pOut); + break; + + default: + fprintf(stderr, "Unsupported bit count %d\n", pHdr->Hdr32.cFormatBits); + rc = -1; + break; + } + + return rc; +} + + +/** + * Creates a HTML report from a kProfiler 2 format file. + * + * @returns 0 on success. + * @returns -1 on failure. + * + * @param pszFilename The path to the profiler data set. + * @param pOut Where to write the output. + */ +int KPrfHtmlReport(const char *pszFilename, FILE *pOut) +{ + /* + * Load and validate the data set. + */ + KU32 cb; + PKPRFHDR pHdr = kPrfLoad(pszFilename, &cb, pOut); + if (!pHdr) + return -1; + if (!kPrfIsValidate(pHdr, cb, pOut)) + return -1; + + /* + * Switch to the appropirate dumper routine. + */ + int rc; + switch (pHdr->Hdr32.cFormatBits) + { + case 32: + { + PKPRF32REPORT pReport; + rc = KPrf32Analyse(&pHdr->Hdr32, &pReport); + if (!rc) + { + rc = KPrf32WriteHtmlReport(pReport, pOut); + if (rc) + fprintf(stderr, "Error while writing HTML report for '%s'\n", pszFilename); + KPrf32DeleteReport(pReport); + } + else + fprintf(stderr, "Analysis of '%s' failed!\n", pszFilename); + break; + } + + case 64: + { + PKPRF64REPORT pReport; + rc = KPrf64Analyse(&pHdr->Hdr64, &pReport); + if (!rc) + { + rc = KPrf64WriteHtmlReport(pReport, pOut); + if (rc) + fprintf(stderr, "Error while writing HTML report for '%s'\n", pszFilename); + KPrf64DeleteReport(pReport); + } + else + fprintf(stderr, "Analysis of '%s' failed!\n", pszFilename); + break; + } + + default: + fprintf(stderr, "Unsupported bit count %d\n", pHdr->Hdr32.cFormatBits); + rc = -1; + break; + } + + return rc; +} + + + +/** + * Prints the usage. + */ +static int Usage(void) +{ + printf("kProfiler MK2 - Reader & Producer of Statistics\n" + "usage: kPrf2Read [-r|-d] <file1> [[-r|-d] file2 []]\n" + ); + return 1; +} + + +int main(int argc, char **argv) +{ + /* + * Parse arguments. + */ + if (argc <= 1) + return Usage(); + enum { OP_DUMP, OP_HTML } enmOp = OP_DUMP; + for (int i = 1; i < argc; i++) + { + if (argv[i][0] == '-') + { + switch (argv[i][1]) + { + case 'h': + case 'H': + case '?': + case '-': + return Usage(); + + case 'd': + enmOp = OP_DUMP; + break; + + case 'r': + enmOp = OP_HTML; + break; + + default: + printf("Syntax error: Unknown argument '%s'\n", argv[i]); + return 1; + } + } + else + { + int rc; + switch (enmOp) + { + case OP_DUMP: + rc = KPrfDumpFile(argv[i], stdout); + break; + case OP_HTML: + rc = KPrfHtmlReport(argv[i], stdout); + break; + } + if (rc) + return rc; + } + } + + return 0; +} diff --git a/src/lib/kStuff/kProfiler2/kPrf2WinApi-dumpbin.sed b/src/lib/kStuff/kProfiler2/kPrf2WinApi-dumpbin.sed new file mode 100644 index 0000000..a9a44f2 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2WinApi-dumpbin.sed @@ -0,0 +1,96 @@ +# $Id: kPrf2WinApi-dumpbin.sed 29 2009-07-01 20:30:29Z bird $ +## @file +# Strip down dumpbin /export output. +# + +# +# Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +# +# State switch +# +x +/^exports$/b exports +/^summary$/b summary +b header + +# +# Header +# +:header +x +/^[[:space:]][[:space:]]*ordinal[[:space:]]*name[[:space:]]*$/b switch_to_exports +b drop_line + +# +# Exports +# +:switch_to_exports +s/^.*$/exports/ +h +b drop_line + +:exports +x +/^[[:space:]][[:space:]]*Summary[[:space:]]*$/b switch_to_summary +s/^[[:space:]]*// +s/[[:space:]]*$// +s/[[:space:]][[:space:]]*/ /g +/^$/b drop_line + +# Filter out APIs that hasn't been implemented. +/AddLocalAlternateComputerNameA/b drop_line +/AddLocalAlternateComputerNameW/b drop_line +/EnumerateLocalComputerNamesA/b drop_line +/EnumerateLocalComputerNamesW/b drop_line +/RemoveLocalAlternateComputerNameA/b drop_line +/RemoveLocalAlternateComputerNameW/b drop_line +/SetLocalPrimaryComputerNameA/b drop_line +/SetLocalPrimaryComputerNameW/b drop_line +/__C_specific_handler/b drop_line +/__misaligned_access/b drop_line +/_local_unwind/b drop_line + +b end + +# +# Summary +# +:switch_to_summary +s/^.*$/summary/ +h +b drop_line + +:summary +x +b drop_line + +# +# Tail +# +:drop_line +d +:end + diff --git a/src/lib/kStuff/kProfiler2/kPrf2WinApi-gencode.sed b/src/lib/kStuff/kProfiler2/kPrf2WinApi-gencode.sed new file mode 100644 index 0000000..7d39edf --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2WinApi-gencode.sed @@ -0,0 +1,120 @@ +# $Id: kPrf2WinApi-gencode.sed 29 2009-07-01 20:30:29Z bird $ +## @file +# Generate code (for kernel32). +# + +# +# Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +# Example: +# BOOL WINAPI FindActCtxSectionGuid( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, const GUID * lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); +# +# Should be turned into: +# typedef BOOL WINAPI FN_FindActCtxSectionGuid( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, const GUID * lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); +# __declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindActCtxSectionGuid( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, const GUID * lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ) +# { +# static FN_FindActCtxSectionGuid *pfn = 0; +# if (!pfn) +# kPrfWrapResolve((void **)&pfn, "FindActCtxSectionGuid", &g_Kernel32); +# return pfn( dwFlags, lpExtensionGuid, ulSectionId, lpGuidToFind, ReturnedData ); +# } +# + +# Ignore empty lines. +/^[[:space:]]*$/b delete + +# Some hacks. +/([[:space:]]*VOID[[:space:]]*)/b no_hacking_void +s/([[:space:]]*\([A-Z][A-Z0-9_]*\)[[:space:]]*)/( \1 a)/ +:no_hacking_void + + +# Save the pattern space. +h + +# Make the typedef. +s/[[:space:]]\([A-Za-z_][A-Za-z0-9_]*\)(/ FN_\1(/ +s/^/typedef / +p + +# Function definition +g +s/\n//g +s/\r//g +s/[[:space:]]\([A-Za-z_][A-Za-z0-9_]*\)(/ kPrf2Wrap_\1(/ +s/^/__declspec(dllexport) / +s/;// +p +i\ +{ + +# static FN_FindActCtxSectionGuid *pfn = 0; +# if (!pfn) +g +s/^.*[[:space:]]\([A-Za-z_][A-Za-z0-9_]*\)(.*$/ static FN_\1 *pfn = 0;/ +p +i\ + if (!pfn) + +# kPrfWrapResolve((void **)&pfn, "FindActCtxSectionGuid", &g_Kernel32); +g +s/^.*[[:space:]]\([A-Za-z_][A-Za-z0-9_]*\)(.*$/ kPrf2WrapResolve((void **)\&pfn, "\1\", \&g_Kernel32);/ +p + +# The invocation and return statement. +# Some trouble here.... +g +/^VOID WINAPI/b void_return +/^void WINAPI/b void_return +/^VOID __cdecl/b void_return +/^void __cdecl/b void_return +/^VOID NTAPI/b void_return +/^void NTAPI/b void_return +s/^.*(/ return pfn(/ +b morph_params + +:void_return +s/^.*(/ pfn(/ + +:morph_params +s/ *\[\] *// +s/ \*/ /g +s/, *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *)\)/, \1/g +s/( *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *[,)]\)/( \1/g +s/, *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *,\)/, \1/g +s/, *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *,\)/, \1/g +s/, *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *,\)/, \1/g +s/, *[a-zA-Z_][^,)]* \([a-zA-Z_][a-zA-Z_0-9]* *,\)/, \1/g +s/( VOID )/ ()/ +s/( void )/ ()/ +p +i\ +} +i\ + +# Done +:delete +d + diff --git a/src/lib/kStuff/kProfiler2/kPrf2WinApi-genimp.sed b/src/lib/kStuff/kProfiler2/kPrf2WinApi-genimp.sed new file mode 100644 index 0000000..1473ed0 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2WinApi-genimp.sed @@ -0,0 +1,55 @@ +# $Id: kPrf2WinApi-genimp.sed 29 2009-07-01 20:30:29Z bird $ +## +# Generate imports from normalized dumpbin output. +# + +# +# Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +# Normalize the input a bit. +s/[[:space:]][[:space:]]*/ /g +s/^[[:space:]]// +s/[[:space:]]$// +/^$/b drop_line + +# Expects a single name - no ordinals yet. +/\@/b have_at + +s/^\(.*\)$/ \1=kPrf2Wrap_\1/ +b end + +:have_at +h +s/^\([^ ]\)\(@[0-9]*\)$/ \1\2=kPrf2Wrap_\1/ +p +g +s/^\([^ ]\)\(@[0-9]*\)$/ \1=kPrf2Wrap_\1/ +b end + +:drop_line +d +b end + +:end diff --git a/src/lib/kStuff/kProfiler2/kPrf2WinApi-pre.sed b/src/lib/kStuff/kProfiler2/kPrf2WinApi-pre.sed new file mode 100644 index 0000000..de90156 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2WinApi-pre.sed @@ -0,0 +1,117 @@ +# $Id: kPrf2WinApi-pre.sed 29 2009-07-01 20:30:29Z bird $ +## @file +# This SED script will try normalize a windows header +# in order to make it easy to pick out function prototypes. +# + +# +# Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +# +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this software and associated documentation +# files (the "Software"), to deal in the Software without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following +# conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + + +# Drop all preprocessor lines (#if/#else/#endif/#define/#undef/#pragma/comments) +# (we don't bother with multi line comments ATM.) +/^[[:space:]]*#/b drop_line +/^[[:space:]]*\/\//b drop_line + +# Drop empty lines. +/^[[:space:]]*$/b drop_line + +# Drop trailing comments and trailing whitespace +s/[[:space:]][[:space:]]*\/\.*$//g +s,[[:space:]][[:space:]]*/\*[^*/]*\*/[[:space:]]*$,,g +s/[[:space:]][[:space:]]*$//g + +# Pick out the WINBASEAPI stuff (WinBase.h) +/^WINBASEAPI/b winapi +/^NTSYSAPI/b winapi +/^WINAPI$/b winapi_perhaps +/^APIENTRY$/b winapi_perhaps +h +d +b end + +# No WINBASEAPI, so we'll have to carefully check the hold buffer. +:winapi_perhaps +x +/^[A-Z][A-Z0-9_][A-Z0-9_]*[A-Z0-9]$/!b drop_line +G +s/\r/ /g +s/\n/ /g +b winapi + +# Make it one line and a bit standardized +:winapi +/;/b winapi_got_it +N +b winapi +:winapi_got_it +s/\n/ /g +s/[[:space:]][[:space:]]*\/\*[^*/]*\*\/[[:space:]]*//g +s/[[:space:]][[:space:]]*(/(/g +s/)[[:space:]][[:space:]]*/)/g +s/(\([^[:space:]]\)/( \1/g +s/\([^[:space:]]\))/\1 )/g +s/[*]\([^[:space:]]\)/* \1/g +s/\([^[:space:]]\)[*]/\1 */g +s/[[:space:]][[:space:]]*/ /g +s/[[:space:]][[:space:]]*,/,/g +s/,/, /g +s/,[[:space:]][[:space:]]*/, /g + +# Drop the nasty bit of the sal.h / SpecString.h stuff. +s/[[:space:]]__[a-z][a-z_]*([^()]*)[[:space:]]*/ /g +s/[[:space:]]__out[a-z_]*[[:space:]]*/ /g +s/[[:space:]]__in[a-z_]*[[:space:]]*/ /g +s/[[:space:]]__deref[a-z_]*[[:space:]]*/ /g +s/[[:space:]]__reserved[[:space:]]*/ /g +s/[[:space:]]__nullnullterminated[[:space:]]*/ /g +s/[[:space:]]__checkReturn[[:space:]]*/ /g + +# Drop some similar stuff. +s/[[:space:]]OPTIONAL[[:space:]]/ /g +s/[[:space:]]OPTIONAL,/ ,/g + +# The __declspec() bit isn't necessary +s/WINBASEAPI *// +s/NTSYSAPI *// +s/DECLSPEC_NORETURN *// +s/__declspec([^()]*) *// + +# Normalize spaces. +s/[[:space:]]/ /g + +# Clear the hold space +x +s/^.*$// +x +b end + +:drop_line +s/^.*$// +h +d + +:end + diff --git a/src/lib/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.c b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.c new file mode 100644 index 0000000..0788cdf --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.c @@ -0,0 +1,53 @@ +/* $Id: kPrf2WinApiWrapperHlp.c 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * Helpers for the Windows API wrapper DLL. + */ + +/* + * Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#include <Windows.h> +#include "kPRf2WinApiWRapperHlp.h" + + +FARPROC kPrf2WrapResolve(void **ppfn, const char *pszName, PKPRF2WRAPDLL pDll) +{ + FARPROC pfn; + HMODULE hmod = pDll->hmod; + if (hmod == INVALID_HANDLE_VALUE) + { + hmod = LoadLibraryA(pDll->szName); + pDll->hmod = hmod; + } + + pfn = GetProcAddress(hmod, pszName); + *ppfn = (void *)pfn; + return pfn; +} + + diff --git a/src/lib/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.h b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.h new file mode 100644 index 0000000..b75d303 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrapperHlp.h @@ -0,0 +1,41 @@ +/* $Id: kPrf2WinApiWrapperHlp.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * Helpers for the Windows API wrapper DLL. + */ + +/* + * Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +typedef struct KPRF2WRAPDLL +{ + HMODULE hmod; + char szName[32]; +} KPRF2WRAPDLL; +typedef KPRF2WRAPDLL *PKPRF2WRAPDLL; +typedef KPRF2WRAPDLL const *PCKPRF2WRAPDLL; + +FARPROC kPrf2WrapResolve(void **ppfn, const char *pszName, PKPRF2WRAPDLL pDll); + + diff --git a/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappers-kernel32.h b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappers-kernel32.h new file mode 100644 index 0000000..dde33cf --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappers-kernel32.h @@ -0,0 +1,9360 @@ +typedef PVOID WINAPI FN_EncodePointer( PVOID Ptr ); +__declspec(dllexport) PVOID WINAPI kPrf2Wrap_EncodePointer( PVOID Ptr ) +{ + static FN_EncodePointer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EncodePointer", &g_Kernel32); + return pfn( Ptr ); +} + +typedef PVOID WINAPI FN_DecodePointer( PVOID Ptr ); +__declspec(dllexport) PVOID WINAPI kPrf2Wrap_DecodePointer( PVOID Ptr ) +{ + static FN_DecodePointer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DecodePointer", &g_Kernel32); + return pfn( Ptr ); +} + +typedef PVOID WINAPI FN_EncodeSystemPointer( PVOID Ptr ); +__declspec(dllexport) PVOID WINAPI kPrf2Wrap_EncodeSystemPointer( PVOID Ptr ) +{ + static FN_EncodeSystemPointer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EncodeSystemPointer", &g_Kernel32); + return pfn( Ptr ); +} + +typedef PVOID WINAPI FN_DecodeSystemPointer( PVOID Ptr ); +__declspec(dllexport) PVOID WINAPI kPrf2Wrap_DecodeSystemPointer( PVOID Ptr ) +{ + static FN_DecodeSystemPointer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DecodeSystemPointer", &g_Kernel32); + return pfn( Ptr ); +} + +typedef DWORD WINAPI FN_GetFreeSpace( UINT a); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFreeSpace( UINT a) +{ + static FN_GetFreeSpace *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFreeSpace", &g_Kernel32); + return pfn( a); +} + +typedef LONG WINAPI FN_InterlockedIncrement( LONG volatile * lpAddend ); +__declspec(dllexport) LONG WINAPI kPrf2Wrap_InterlockedIncrement( LONG volatile * lpAddend ) +{ + static FN_InterlockedIncrement *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InterlockedIncrement", &g_Kernel32); + return pfn( lpAddend ); +} + +typedef LONG WINAPI FN_InterlockedDecrement( LONG volatile * lpAddend ); +__declspec(dllexport) LONG WINAPI kPrf2Wrap_InterlockedDecrement( LONG volatile * lpAddend ) +{ + static FN_InterlockedDecrement *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InterlockedDecrement", &g_Kernel32); + return pfn( lpAddend ); +} + +typedef LONG WINAPI FN_InterlockedExchange( LONG volatile * Target, LONG Value ); +__declspec(dllexport) LONG WINAPI kPrf2Wrap_InterlockedExchange( LONG volatile * Target, LONG Value ) +{ + static FN_InterlockedExchange *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InterlockedExchange", &g_Kernel32); + return pfn( Target, Value ); +} + +typedef LONG WINAPI FN_InterlockedExchangeAdd( LONG volatile * Addend, LONG Value ); +__declspec(dllexport) LONG WINAPI kPrf2Wrap_InterlockedExchangeAdd( LONG volatile * Addend, LONG Value ) +{ + static FN_InterlockedExchangeAdd *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InterlockedExchangeAdd", &g_Kernel32); + return pfn( Addend, Value ); +} + +typedef LONG WINAPI FN_InterlockedCompareExchange( LONG volatile * Destination, LONG Exchange, LONG Comperand ); +__declspec(dllexport) LONG WINAPI kPrf2Wrap_InterlockedCompareExchange( LONG volatile * Destination, LONG Exchange, LONG Comperand ) +{ + static FN_InterlockedCompareExchange *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InterlockedCompareExchange", &g_Kernel32); + return pfn( Destination, Exchange, Comperand ); +} + +typedef LONGLONG WINAPI FN_InterlockedCompareExchange64( LONGLONG volatile * Destination, LONGLONG Exchange, LONGLONG Comperand ); +__declspec(dllexport) LONGLONG WINAPI kPrf2Wrap_InterlockedCompareExchange64( LONGLONG volatile * Destination, LONGLONG Exchange, LONGLONG Comperand ) +{ + static FN_InterlockedCompareExchange64 *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InterlockedCompareExchange64", &g_Kernel32); + return pfn( Destination, Exchange, Comperand ); +} + +typedef VOID WINAPI FN_InitializeSListHead( PSLIST_HEADER ListHead ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_InitializeSListHead( PSLIST_HEADER ListHead ) +{ + static FN_InitializeSListHead *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InitializeSListHead", &g_Kernel32); + pfn( ListHead ); +} + +typedef PSLIST_ENTRY WINAPI FN_InterlockedPopEntrySList( PSLIST_HEADER ListHead ); +__declspec(dllexport) PSLIST_ENTRY WINAPI kPrf2Wrap_InterlockedPopEntrySList( PSLIST_HEADER ListHead ) +{ + static FN_InterlockedPopEntrySList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InterlockedPopEntrySList", &g_Kernel32); + return pfn( ListHead ); +} + +typedef PSLIST_ENTRY WINAPI FN_InterlockedPushEntrySList( PSLIST_HEADER ListHead, PSLIST_ENTRY ListEntry ); +__declspec(dllexport) PSLIST_ENTRY WINAPI kPrf2Wrap_InterlockedPushEntrySList( PSLIST_HEADER ListHead, PSLIST_ENTRY ListEntry ) +{ + static FN_InterlockedPushEntrySList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InterlockedPushEntrySList", &g_Kernel32); + return pfn( ListHead, ListEntry ); +} + +typedef PSLIST_ENTRY WINAPI FN_InterlockedFlushSList( PSLIST_HEADER ListHead ); +__declspec(dllexport) PSLIST_ENTRY WINAPI kPrf2Wrap_InterlockedFlushSList( PSLIST_HEADER ListHead ) +{ + static FN_InterlockedFlushSList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InterlockedFlushSList", &g_Kernel32); + return pfn( ListHead ); +} + +typedef USHORT WINAPI FN_QueryDepthSList( PSLIST_HEADER ListHead ); +__declspec(dllexport) USHORT WINAPI kPrf2Wrap_QueryDepthSList( PSLIST_HEADER ListHead ) +{ + static FN_QueryDepthSList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "QueryDepthSList", &g_Kernel32); + return pfn( ListHead ); +} + +typedef BOOL WINAPI FN_FreeResource( HGLOBAL hResData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeResource( HGLOBAL hResData ) +{ + static FN_FreeResource *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FreeResource", &g_Kernel32); + return pfn( hResData ); +} + +typedef LPVOID WINAPI FN_LockResource( HGLOBAL hResData ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_LockResource( HGLOBAL hResData ) +{ + static FN_LockResource *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LockResource", &g_Kernel32); + return pfn( hResData ); +} + +typedef BOOL WINAPI FN_FreeLibrary( HMODULE hLibModule ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeLibrary( HMODULE hLibModule ) +{ + static FN_FreeLibrary *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FreeLibrary", &g_Kernel32); + return pfn( hLibModule ); +} + +typedef VOID WINAPI FN_FreeLibraryAndExitThread( HMODULE hLibModule, DWORD dwExitCode ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_FreeLibraryAndExitThread( HMODULE hLibModule, DWORD dwExitCode ) +{ + static FN_FreeLibraryAndExitThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FreeLibraryAndExitThread", &g_Kernel32); + pfn( hLibModule, dwExitCode ); +} + +typedef BOOL WINAPI FN_DisableThreadLibraryCalls( HMODULE hLibModule ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DisableThreadLibraryCalls( HMODULE hLibModule ) +{ + static FN_DisableThreadLibraryCalls *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DisableThreadLibraryCalls", &g_Kernel32); + return pfn( hLibModule ); +} + +typedef FARPROC WINAPI FN_GetProcAddress( HMODULE hModule, LPCSTR lpProcName ); +__declspec(dllexport) FARPROC WINAPI kPrf2Wrap_GetProcAddress( HMODULE hModule, LPCSTR lpProcName ) +{ + static FN_GetProcAddress *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcAddress", &g_Kernel32); + return pfn( hModule, lpProcName ); +} + +typedef DWORD WINAPI FN_GetVersion( VOID ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetVersion( VOID ) +{ + static FN_GetVersion *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVersion", &g_Kernel32); + return pfn (); +} + +typedef HGLOBAL WINAPI FN_GlobalAlloc( UINT uFlags, SIZE_T dwBytes ); +__declspec(dllexport) HGLOBAL WINAPI kPrf2Wrap_GlobalAlloc( UINT uFlags, SIZE_T dwBytes ) +{ + static FN_GlobalAlloc *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalAlloc", &g_Kernel32); + return pfn( uFlags, dwBytes ); +} + +typedef HGLOBAL WINAPI FN_GlobalReAlloc( HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags ); +__declspec(dllexport) HGLOBAL WINAPI kPrf2Wrap_GlobalReAlloc( HGLOBAL hMem, SIZE_T dwBytes, UINT uFlags ) +{ + static FN_GlobalReAlloc *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalReAlloc", &g_Kernel32); + return pfn( hMem, dwBytes, uFlags ); +} + +typedef SIZE_T WINAPI FN_GlobalSize( HGLOBAL hMem ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_GlobalSize( HGLOBAL hMem ) +{ + static FN_GlobalSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalSize", &g_Kernel32); + return pfn( hMem ); +} + +typedef UINT WINAPI FN_GlobalFlags( HGLOBAL hMem ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GlobalFlags( HGLOBAL hMem ) +{ + static FN_GlobalFlags *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalFlags", &g_Kernel32); + return pfn( hMem ); +} + +typedef LPVOID WINAPI FN_GlobalLock( HGLOBAL hMem ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_GlobalLock( HGLOBAL hMem ) +{ + static FN_GlobalLock *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalLock", &g_Kernel32); + return pfn( hMem ); +} + +typedef HGLOBAL WINAPI FN_GlobalHandle( LPCVOID pMem ); +__declspec(dllexport) HGLOBAL WINAPI kPrf2Wrap_GlobalHandle( LPCVOID pMem ) +{ + static FN_GlobalHandle *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalHandle", &g_Kernel32); + return pfn( pMem ); +} + +typedef BOOL WINAPI FN_GlobalUnlock( HGLOBAL hMem ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GlobalUnlock( HGLOBAL hMem ) +{ + static FN_GlobalUnlock *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalUnlock", &g_Kernel32); + return pfn( hMem ); +} + +typedef HGLOBAL WINAPI FN_GlobalFree( HGLOBAL hMem ); +__declspec(dllexport) HGLOBAL WINAPI kPrf2Wrap_GlobalFree( HGLOBAL hMem ) +{ + static FN_GlobalFree *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalFree", &g_Kernel32); + return pfn( hMem ); +} + +typedef SIZE_T WINAPI FN_GlobalCompact( DWORD dwMinFree ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_GlobalCompact( DWORD dwMinFree ) +{ + static FN_GlobalCompact *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalCompact", &g_Kernel32); + return pfn( dwMinFree ); +} + +typedef VOID WINAPI FN_GlobalFix( HGLOBAL hMem ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_GlobalFix( HGLOBAL hMem ) +{ + static FN_GlobalFix *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalFix", &g_Kernel32); + pfn( hMem ); +} + +typedef VOID WINAPI FN_GlobalUnfix( HGLOBAL hMem ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_GlobalUnfix( HGLOBAL hMem ) +{ + static FN_GlobalUnfix *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalUnfix", &g_Kernel32); + pfn( hMem ); +} + +typedef LPVOID WINAPI FN_GlobalWire( HGLOBAL hMem ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_GlobalWire( HGLOBAL hMem ) +{ + static FN_GlobalWire *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalWire", &g_Kernel32); + return pfn( hMem ); +} + +typedef BOOL WINAPI FN_GlobalUnWire( HGLOBAL hMem ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GlobalUnWire( HGLOBAL hMem ) +{ + static FN_GlobalUnWire *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalUnWire", &g_Kernel32); + return pfn( hMem ); +} + +typedef VOID WINAPI FN_GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) +{ + static FN_GlobalMemoryStatus *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalMemoryStatus", &g_Kernel32); + pfn( lpBuffer ); +} + +typedef BOOL WINAPI FN_GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpBuffer ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpBuffer ) +{ + static FN_GlobalMemoryStatusEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalMemoryStatusEx", &g_Kernel32); + return pfn( lpBuffer ); +} + +typedef HLOCAL WINAPI FN_LocalAlloc( UINT uFlags, SIZE_T uBytes ); +__declspec(dllexport) HLOCAL WINAPI kPrf2Wrap_LocalAlloc( UINT uFlags, SIZE_T uBytes ) +{ + static FN_LocalAlloc *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalAlloc", &g_Kernel32); + return pfn( uFlags, uBytes ); +} + +typedef HLOCAL WINAPI FN_LocalReAlloc( HLOCAL hMem, SIZE_T uBytes, UINT uFlags ); +__declspec(dllexport) HLOCAL WINAPI kPrf2Wrap_LocalReAlloc( HLOCAL hMem, SIZE_T uBytes, UINT uFlags ) +{ + static FN_LocalReAlloc *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalReAlloc", &g_Kernel32); + return pfn( hMem, uBytes, uFlags ); +} + +typedef LPVOID WINAPI FN_LocalLock( HLOCAL hMem ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_LocalLock( HLOCAL hMem ) +{ + static FN_LocalLock *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalLock", &g_Kernel32); + return pfn( hMem ); +} + +typedef HLOCAL WINAPI FN_LocalHandle( LPCVOID pMem ); +__declspec(dllexport) HLOCAL WINAPI kPrf2Wrap_LocalHandle( LPCVOID pMem ) +{ + static FN_LocalHandle *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalHandle", &g_Kernel32); + return pfn( pMem ); +} + +typedef BOOL WINAPI FN_LocalUnlock( HLOCAL hMem ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LocalUnlock( HLOCAL hMem ) +{ + static FN_LocalUnlock *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalUnlock", &g_Kernel32); + return pfn( hMem ); +} + +typedef SIZE_T WINAPI FN_LocalSize( HLOCAL hMem ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_LocalSize( HLOCAL hMem ) +{ + static FN_LocalSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalSize", &g_Kernel32); + return pfn( hMem ); +} + +typedef UINT WINAPI FN_LocalFlags( HLOCAL hMem ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_LocalFlags( HLOCAL hMem ) +{ + static FN_LocalFlags *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalFlags", &g_Kernel32); + return pfn( hMem ); +} + +typedef HLOCAL WINAPI FN_LocalFree( HLOCAL hMem ); +__declspec(dllexport) HLOCAL WINAPI kPrf2Wrap_LocalFree( HLOCAL hMem ) +{ + static FN_LocalFree *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalFree", &g_Kernel32); + return pfn( hMem ); +} + +typedef SIZE_T WINAPI FN_LocalShrink( HLOCAL hMem, UINT cbNewSize ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_LocalShrink( HLOCAL hMem, UINT cbNewSize ) +{ + static FN_LocalShrink *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalShrink", &g_Kernel32); + return pfn( hMem, cbNewSize ); +} + +typedef SIZE_T WINAPI FN_LocalCompact( UINT uMinFree ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_LocalCompact( UINT uMinFree ) +{ + static FN_LocalCompact *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalCompact", &g_Kernel32); + return pfn( uMinFree ); +} + +typedef BOOL WINAPI FN_FlushInstructionCache( HANDLE hProcess, LPCVOID lpBaseAddress, SIZE_T dwSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlushInstructionCache( HANDLE hProcess, LPCVOID lpBaseAddress, SIZE_T dwSize ) +{ + static FN_FlushInstructionCache *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FlushInstructionCache", &g_Kernel32); + return pfn( hProcess, lpBaseAddress, dwSize ); +} + +typedef LPVOID WINAPI FN_VirtualAlloc( LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_VirtualAlloc( LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ) +{ + static FN_VirtualAlloc *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VirtualAlloc", &g_Kernel32); + return pfn( lpAddress, dwSize, flAllocationType, flProtect ); +} + +typedef BOOL WINAPI FN_VirtualFree( LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualFree( LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType ) +{ + static FN_VirtualFree *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VirtualFree", &g_Kernel32); + return pfn( lpAddress, dwSize, dwFreeType ); +} + +typedef BOOL WINAPI FN_VirtualProtect( LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualProtect( LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect ) +{ + static FN_VirtualProtect *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VirtualProtect", &g_Kernel32); + return pfn( lpAddress, dwSize, flNewProtect, lpflOldProtect ); +} + +typedef SIZE_T WINAPI FN_VirtualQuery( LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_VirtualQuery( LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength ) +{ + static FN_VirtualQuery *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VirtualQuery", &g_Kernel32); + return pfn( lpAddress, lpBuffer, dwLength ); +} + +typedef LPVOID WINAPI FN_VirtualAllocEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_VirtualAllocEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect ) +{ + static FN_VirtualAllocEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VirtualAllocEx", &g_Kernel32); + return pfn( hProcess, lpAddress, dwSize, flAllocationType, flProtect ); +} + +typedef UINT WINAPI FN_GetWriteWatch( DWORD dwFlags, PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID * lpAddresses, ULONG_PTR * lpdwCount, PULONG lpdwGranularity ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetWriteWatch( DWORD dwFlags, PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID * lpAddresses, ULONG_PTR * lpdwCount, PULONG lpdwGranularity ) +{ + static FN_GetWriteWatch *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetWriteWatch", &g_Kernel32); + return pfn( dwFlags, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity ); +} + +typedef UINT WINAPI FN_ResetWriteWatch( LPVOID lpBaseAddress, SIZE_T dwRegionSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_ResetWriteWatch( LPVOID lpBaseAddress, SIZE_T dwRegionSize ) +{ + static FN_ResetWriteWatch *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ResetWriteWatch", &g_Kernel32); + return pfn( lpBaseAddress, dwRegionSize ); +} + +typedef SIZE_T WINAPI FN_GetLargePageMinimum( VOID ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_GetLargePageMinimum( VOID ) +{ + static FN_GetLargePageMinimum *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLargePageMinimum", &g_Kernel32); + return pfn (); +} + +typedef UINT WINAPI FN_EnumSystemFirmwareTables( DWORD FirmwareTableProviderSignature, PVOID pFirmwareTableEnumBuffer, DWORD BufferSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_EnumSystemFirmwareTables( DWORD FirmwareTableProviderSignature, PVOID pFirmwareTableEnumBuffer, DWORD BufferSize ) +{ + static FN_EnumSystemFirmwareTables *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumSystemFirmwareTables", &g_Kernel32); + return pfn( FirmwareTableProviderSignature, pFirmwareTableEnumBuffer, BufferSize ); +} + +typedef UINT WINAPI FN_GetSystemFirmwareTable( DWORD FirmwareTableProviderSignature, DWORD FirmwareTableID, PVOID pFirmwareTableBuffer, DWORD BufferSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemFirmwareTable( DWORD FirmwareTableProviderSignature, DWORD FirmwareTableID, PVOID pFirmwareTableBuffer, DWORD BufferSize ) +{ + static FN_GetSystemFirmwareTable *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemFirmwareTable", &g_Kernel32); + return pfn( FirmwareTableProviderSignature, FirmwareTableID, pFirmwareTableBuffer, BufferSize ); +} + +typedef BOOL WINAPI FN_VirtualFreeEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualFreeEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType ) +{ + static FN_VirtualFreeEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VirtualFreeEx", &g_Kernel32); + return pfn( hProcess, lpAddress, dwSize, dwFreeType ); +} + +typedef BOOL WINAPI FN_VirtualProtectEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualProtectEx( HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect ) +{ + static FN_VirtualProtectEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VirtualProtectEx", &g_Kernel32); + return pfn( hProcess, lpAddress, dwSize, flNewProtect, lpflOldProtect ); +} + +typedef SIZE_T WINAPI FN_VirtualQueryEx( HANDLE hProcess, LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_VirtualQueryEx( HANDLE hProcess, LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength ) +{ + static FN_VirtualQueryEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VirtualQueryEx", &g_Kernel32); + return pfn( hProcess, lpAddress, lpBuffer, dwLength ); +} + +typedef HANDLE WINAPI FN_HeapCreate( DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_HeapCreate( DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize ) +{ + static FN_HeapCreate *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapCreate", &g_Kernel32); + return pfn( flOptions, dwInitialSize, dwMaximumSize ); +} + +typedef BOOL WINAPI FN_HeapDestroy( HANDLE hHeap ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapDestroy( HANDLE hHeap ) +{ + static FN_HeapDestroy *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapDestroy", &g_Kernel32); + return pfn( hHeap ); +} + +typedef LPVOID WINAPI FN_HeapAlloc( HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_HeapAlloc( HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes ) +{ + static FN_HeapAlloc *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapAlloc", &g_Kernel32); + return pfn( hHeap, dwFlags, dwBytes ); +} + +typedef LPVOID WINAPI FN_HeapReAlloc( HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_HeapReAlloc( HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes ) +{ + static FN_HeapReAlloc *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapReAlloc", &g_Kernel32); + return pfn( hHeap, dwFlags, lpMem, dwBytes ); +} + +typedef BOOL WINAPI FN_HeapFree( HANDLE hHeap, DWORD dwFlags, LPVOID lpMem ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapFree( HANDLE hHeap, DWORD dwFlags, LPVOID lpMem ) +{ + static FN_HeapFree *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapFree", &g_Kernel32); + return pfn( hHeap, dwFlags, lpMem ); +} + +typedef SIZE_T WINAPI FN_HeapSize( HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_HeapSize( HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem ) +{ + static FN_HeapSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapSize", &g_Kernel32); + return pfn( hHeap, dwFlags, lpMem ); +} + +typedef BOOL WINAPI FN_HeapValidate( HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapValidate( HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem ) +{ + static FN_HeapValidate *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapValidate", &g_Kernel32); + return pfn( hHeap, dwFlags, lpMem ); +} + +typedef SIZE_T WINAPI FN_HeapCompact( HANDLE hHeap, DWORD dwFlags ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_HeapCompact( HANDLE hHeap, DWORD dwFlags ) +{ + static FN_HeapCompact *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapCompact", &g_Kernel32); + return pfn( hHeap, dwFlags ); +} + +typedef HANDLE WINAPI FN_GetProcessHeap( VOID ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_GetProcessHeap( VOID ) +{ + static FN_GetProcessHeap *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessHeap", &g_Kernel32); + return pfn (); +} + +typedef DWORD WINAPI FN_GetProcessHeaps( DWORD NumberOfHeaps, PHANDLE ProcessHeaps ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProcessHeaps( DWORD NumberOfHeaps, PHANDLE ProcessHeaps ) +{ + static FN_GetProcessHeaps *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessHeaps", &g_Kernel32); + return pfn( NumberOfHeaps, ProcessHeaps ); +} + +typedef BOOL WINAPI FN_HeapLock( HANDLE hHeap ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapLock( HANDLE hHeap ) +{ + static FN_HeapLock *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapLock", &g_Kernel32); + return pfn( hHeap ); +} + +typedef BOOL WINAPI FN_HeapUnlock( HANDLE hHeap ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapUnlock( HANDLE hHeap ) +{ + static FN_HeapUnlock *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapUnlock", &g_Kernel32); + return pfn( hHeap ); +} + +typedef BOOL WINAPI FN_HeapWalk( HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapWalk( HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry ) +{ + static FN_HeapWalk *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapWalk", &g_Kernel32); + return pfn( hHeap, lpEntry ); +} + +typedef BOOL WINAPI FN_HeapSetInformation( HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation, SIZE_T HeapInformationLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapSetInformation( HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation, SIZE_T HeapInformationLength ) +{ + static FN_HeapSetInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapSetInformation", &g_Kernel32); + return pfn( HeapHandle, HeapInformationClass, HeapInformation, HeapInformationLength ); +} + +typedef BOOL WINAPI FN_HeapQueryInformation( HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation, SIZE_T HeapInformationLength, PSIZE_T ReturnLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_HeapQueryInformation( HANDLE HeapHandle, HEAP_INFORMATION_CLASS HeapInformationClass, PVOID HeapInformation, SIZE_T HeapInformationLength, PSIZE_T ReturnLength ) +{ + static FN_HeapQueryInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "HeapQueryInformation", &g_Kernel32); + return pfn( HeapHandle, HeapInformationClass, HeapInformation, HeapInformationLength, ReturnLength ); +} + +typedef BOOL WINAPI FN_GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType ) +{ + static FN_GetBinaryTypeA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetBinaryTypeA", &g_Kernel32); + return pfn( lpApplicationName, lpBinaryType ); +} + +typedef BOOL WINAPI FN_GetBinaryTypeW( LPCWSTR lpApplicationName, LPDWORD lpBinaryType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetBinaryTypeW( LPCWSTR lpApplicationName, LPDWORD lpBinaryType ) +{ + static FN_GetBinaryTypeW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetBinaryTypeW", &g_Kernel32); + return pfn( lpApplicationName, lpBinaryType ); +} + +typedef DWORD WINAPI FN_GetShortPathNameA( LPCSTR lpszLongPath, LPSTR lpszShortPath, DWORD cchBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetShortPathNameA( LPCSTR lpszLongPath, LPSTR lpszShortPath, DWORD cchBuffer ) +{ + static FN_GetShortPathNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetShortPathNameA", &g_Kernel32); + return pfn( lpszLongPath, lpszShortPath, cchBuffer ); +} + +typedef DWORD WINAPI FN_GetShortPathNameW( LPCWSTR lpszLongPath, LPWSTR lpszShortPath, DWORD cchBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetShortPathNameW( LPCWSTR lpszLongPath, LPWSTR lpszShortPath, DWORD cchBuffer ) +{ + static FN_GetShortPathNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetShortPathNameW", &g_Kernel32); + return pfn( lpszLongPath, lpszShortPath, cchBuffer ); +} + +typedef DWORD WINAPI FN_GetLongPathNameA( LPCSTR lpszShortPath, LPSTR lpszLongPath, DWORD cchBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLongPathNameA( LPCSTR lpszShortPath, LPSTR lpszLongPath, DWORD cchBuffer ) +{ + static FN_GetLongPathNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLongPathNameA", &g_Kernel32); + return pfn( lpszShortPath, lpszLongPath, cchBuffer ); +} + +typedef DWORD WINAPI FN_GetLongPathNameW( LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLongPathNameW( LPCWSTR lpszShortPath, LPWSTR lpszLongPath, DWORD cchBuffer ) +{ + static FN_GetLongPathNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLongPathNameW", &g_Kernel32); + return pfn( lpszShortPath, lpszLongPath, cchBuffer ); +} + +typedef BOOL WINAPI FN_GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR lpProcessAffinityMask, PDWORD_PTR lpSystemAffinityMask ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessAffinityMask( HANDLE hProcess, PDWORD_PTR lpProcessAffinityMask, PDWORD_PTR lpSystemAffinityMask ) +{ + static FN_GetProcessAffinityMask *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessAffinityMask", &g_Kernel32); + return pfn( hProcess, lpProcessAffinityMask, lpSystemAffinityMask ); +} + +typedef BOOL WINAPI FN_SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR dwProcessAffinityMask ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetProcessAffinityMask( HANDLE hProcess, DWORD_PTR dwProcessAffinityMask ) +{ + static FN_SetProcessAffinityMask *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetProcessAffinityMask", &g_Kernel32); + return pfn( hProcess, dwProcessAffinityMask ); +} + +typedef BOOL WINAPI FN_GetProcessHandleCount( HANDLE hProcess, PDWORD pdwHandleCount ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessHandleCount( HANDLE hProcess, PDWORD pdwHandleCount ) +{ + static FN_GetProcessHandleCount *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessHandleCount", &g_Kernel32); + return pfn( hProcess, pdwHandleCount ); +} + +typedef BOOL WINAPI FN_GetProcessTimes( HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessTimes( HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ) +{ + static FN_GetProcessTimes *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessTimes", &g_Kernel32); + return pfn( hProcess, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime ); +} + +typedef BOOL WINAPI FN_GetProcessIoCounters( HANDLE hProcess, PIO_COUNTERS lpIoCounters ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessIoCounters( HANDLE hProcess, PIO_COUNTERS lpIoCounters ) +{ + static FN_GetProcessIoCounters *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessIoCounters", &g_Kernel32); + return pfn( hProcess, lpIoCounters ); +} + +typedef BOOL WINAPI FN_GetProcessWorkingSetSize( HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessWorkingSetSize( HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize ) +{ + static FN_GetProcessWorkingSetSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessWorkingSetSize", &g_Kernel32); + return pfn( hProcess, lpMinimumWorkingSetSize, lpMaximumWorkingSetSize ); +} + +typedef BOOL WINAPI FN_GetProcessWorkingSetSizeEx( HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize, PDWORD Flags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessWorkingSetSizeEx( HANDLE hProcess, PSIZE_T lpMinimumWorkingSetSize, PSIZE_T lpMaximumWorkingSetSize, PDWORD Flags ) +{ + static FN_GetProcessWorkingSetSizeEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessWorkingSetSizeEx", &g_Kernel32); + return pfn( hProcess, lpMinimumWorkingSetSize, lpMaximumWorkingSetSize, Flags ); +} + +typedef BOOL WINAPI FN_SetProcessWorkingSetSize( HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetProcessWorkingSetSize( HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize ) +{ + static FN_SetProcessWorkingSetSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetProcessWorkingSetSize", &g_Kernel32); + return pfn( hProcess, dwMinimumWorkingSetSize, dwMaximumWorkingSetSize ); +} + +typedef BOOL WINAPI FN_SetProcessWorkingSetSizeEx( HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize, DWORD Flags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetProcessWorkingSetSizeEx( HANDLE hProcess, SIZE_T dwMinimumWorkingSetSize, SIZE_T dwMaximumWorkingSetSize, DWORD Flags ) +{ + static FN_SetProcessWorkingSetSizeEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetProcessWorkingSetSizeEx", &g_Kernel32); + return pfn( hProcess, dwMinimumWorkingSetSize, dwMaximumWorkingSetSize, Flags ); +} + +typedef HANDLE WINAPI FN_OpenProcess( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenProcess( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwProcessId ) +{ + static FN_OpenProcess *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenProcess", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, dwProcessId ); +} + +typedef HANDLE WINAPI FN_GetCurrentProcess( VOID ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_GetCurrentProcess( VOID ) +{ + static FN_GetCurrentProcess *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentProcess", &g_Kernel32); + return pfn (); +} + +typedef DWORD WINAPI FN_GetCurrentProcessId( VOID ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCurrentProcessId( VOID ) +{ + static FN_GetCurrentProcessId *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentProcessId", &g_Kernel32); + return pfn (); +} + +typedef VOID WINAPI FN_ExitProcess( UINT uExitCode ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_ExitProcess( UINT uExitCode ) +{ + static FN_ExitProcess *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ExitProcess", &g_Kernel32); + pfn( uExitCode ); +} + +typedef BOOL WINAPI FN_TerminateProcess( HANDLE hProcess, UINT uExitCode ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_TerminateProcess( HANDLE hProcess, UINT uExitCode ) +{ + static FN_TerminateProcess *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TerminateProcess", &g_Kernel32); + return pfn( hProcess, uExitCode ); +} + +typedef BOOL WINAPI FN_GetExitCodeProcess( HANDLE hProcess, LPDWORD lpExitCode ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetExitCodeProcess( HANDLE hProcess, LPDWORD lpExitCode ) +{ + static FN_GetExitCodeProcess *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetExitCodeProcess", &g_Kernel32); + return pfn( hProcess, lpExitCode ); +} + +typedef VOID WINAPI FN_FatalExit( int ExitCode ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_FatalExit( int ExitCode ) +{ + static FN_FatalExit *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FatalExit", &g_Kernel32); + pfn( ExitCode ); +} + +typedef LPCH WINAPI FN_GetEnvironmentStrings( VOID ); +__declspec(dllexport) LPCH WINAPI kPrf2Wrap_GetEnvironmentStrings( VOID ) +{ + static FN_GetEnvironmentStrings *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetEnvironmentStrings", &g_Kernel32); + return pfn (); +} + +typedef LPWCH WINAPI FN_GetEnvironmentStringsW( VOID ); +__declspec(dllexport) LPWCH WINAPI kPrf2Wrap_GetEnvironmentStringsW( VOID ) +{ + static FN_GetEnvironmentStringsW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetEnvironmentStringsW", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_SetEnvironmentStringsA( LPCH NewEnvironment ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEnvironmentStringsA( LPCH NewEnvironment ) +{ + static FN_SetEnvironmentStringsA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetEnvironmentStringsA", &g_Kernel32); + return pfn( NewEnvironment ); +} + +typedef BOOL WINAPI FN_SetEnvironmentStringsW( LPWCH NewEnvironment ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEnvironmentStringsW( LPWCH NewEnvironment ) +{ + static FN_SetEnvironmentStringsW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetEnvironmentStringsW", &g_Kernel32); + return pfn( NewEnvironment ); +} + +typedef BOOL WINAPI FN_FreeEnvironmentStringsA( LPCH a); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeEnvironmentStringsA( LPCH a) +{ + static FN_FreeEnvironmentStringsA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FreeEnvironmentStringsA", &g_Kernel32); + return pfn( a); +} + +typedef BOOL WINAPI FN_FreeEnvironmentStringsW( LPWCH a); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeEnvironmentStringsW( LPWCH a) +{ + static FN_FreeEnvironmentStringsW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FreeEnvironmentStringsW", &g_Kernel32); + return pfn( a); +} + +typedef VOID WINAPI FN_RaiseException( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments, CONST ULONG_PTR * lpArguments ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_RaiseException( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments, CONST ULONG_PTR * lpArguments ) +{ + static FN_RaiseException *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RaiseException", &g_Kernel32); + pfn( dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments ); +} + +typedef LONG WINAPI FN_UnhandledExceptionFilter( struct _EXCEPTION_POINTERS * ExceptionInfo ); +__declspec(dllexport) LONG WINAPI kPrf2Wrap_UnhandledExceptionFilter( struct _EXCEPTION_POINTERS * ExceptionInfo ) +{ + static FN_UnhandledExceptionFilter *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "UnhandledExceptionFilter", &g_Kernel32); + return pfn( ExceptionInfo ); +} + +typedef LPTOP_LEVEL_EXCEPTION_FILTER WINAPI FN_SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter ); +__declspec(dllexport) LPTOP_LEVEL_EXCEPTION_FILTER WINAPI kPrf2Wrap_SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter ) +{ + static FN_SetUnhandledExceptionFilter *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetUnhandledExceptionFilter", &g_Kernel32); + return pfn( lpTopLevelExceptionFilter ); +} + +typedef LPVOID WINAPI FN_CreateFiber( SIZE_T dwStackSize, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_CreateFiber( SIZE_T dwStackSize, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter ) +{ + static FN_CreateFiber *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateFiber", &g_Kernel32); + return pfn( dwStackSize, lpStartAddress, lpParameter ); +} + +typedef LPVOID WINAPI FN_CreateFiberEx( SIZE_T dwStackCommitSize, SIZE_T dwStackReserveSize, DWORD dwFlags, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_CreateFiberEx( SIZE_T dwStackCommitSize, SIZE_T dwStackReserveSize, DWORD dwFlags, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter ) +{ + static FN_CreateFiberEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateFiberEx", &g_Kernel32); + return pfn( dwStackCommitSize, dwStackReserveSize, dwFlags, lpStartAddress, lpParameter ); +} + +typedef VOID WINAPI FN_DeleteFiber( LPVOID lpFiber ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_DeleteFiber( LPVOID lpFiber ) +{ + static FN_DeleteFiber *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteFiber", &g_Kernel32); + pfn( lpFiber ); +} + +typedef LPVOID WINAPI FN_ConvertThreadToFiber( LPVOID lpParameter ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_ConvertThreadToFiber( LPVOID lpParameter ) +{ + static FN_ConvertThreadToFiber *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ConvertThreadToFiber", &g_Kernel32); + return pfn( lpParameter ); +} + +typedef LPVOID WINAPI FN_ConvertThreadToFiberEx( LPVOID lpParameter, DWORD dwFlags ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_ConvertThreadToFiberEx( LPVOID lpParameter, DWORD dwFlags ) +{ + static FN_ConvertThreadToFiberEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ConvertThreadToFiberEx", &g_Kernel32); + return pfn( lpParameter, dwFlags ); +} + +typedef BOOL WINAPI FN_ConvertFiberToThread( VOID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ConvertFiberToThread( VOID ) +{ + static FN_ConvertFiberToThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ConvertFiberToThread", &g_Kernel32); + return pfn (); +} + +typedef VOID WINAPI FN_SwitchToFiber( LPVOID lpFiber ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_SwitchToFiber( LPVOID lpFiber ) +{ + static FN_SwitchToFiber *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SwitchToFiber", &g_Kernel32); + pfn( lpFiber ); +} + +typedef BOOL WINAPI FN_SwitchToThread( VOID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SwitchToThread( VOID ) +{ + static FN_SwitchToThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SwitchToThread", &g_Kernel32); + return pfn (); +} + +typedef HANDLE WINAPI FN_CreateThread( LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateThread( LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ) +{ + static FN_CreateThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateThread", &g_Kernel32); + return pfn( lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId ); +} + +typedef HANDLE WINAPI FN_CreateRemoteThread( HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateRemoteThread( HANDLE hProcess, LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ) +{ + static FN_CreateRemoteThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateRemoteThread", &g_Kernel32); + return pfn( hProcess, lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId ); +} + +typedef HANDLE WINAPI FN_GetCurrentThread( VOID ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_GetCurrentThread( VOID ) +{ + static FN_GetCurrentThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentThread", &g_Kernel32); + return pfn (); +} + +typedef DWORD WINAPI FN_GetCurrentThreadId( VOID ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCurrentThreadId( VOID ) +{ + static FN_GetCurrentThreadId *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentThreadId", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_SetThreadStackGuarantee( PULONG StackSizeInBytes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetThreadStackGuarantee( PULONG StackSizeInBytes ) +{ + static FN_SetThreadStackGuarantee *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetThreadStackGuarantee", &g_Kernel32); + return pfn( StackSizeInBytes ); +} + +typedef DWORD WINAPI FN_GetProcessIdOfThread( HANDLE Thread ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProcessIdOfThread( HANDLE Thread ) +{ + static FN_GetProcessIdOfThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessIdOfThread", &g_Kernel32); + return pfn( Thread ); +} + +typedef DWORD WINAPI FN_GetThreadId( HANDLE Thread ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetThreadId( HANDLE Thread ) +{ + static FN_GetThreadId *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetThreadId", &g_Kernel32); + return pfn( Thread ); +} + +typedef DWORD WINAPI FN_GetProcessId( HANDLE Process ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProcessId( HANDLE Process ) +{ + static FN_GetProcessId *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessId", &g_Kernel32); + return pfn( Process ); +} + +typedef DWORD WINAPI FN_GetCurrentProcessorNumber( VOID ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCurrentProcessorNumber( VOID ) +{ + static FN_GetCurrentProcessorNumber *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentProcessorNumber", &g_Kernel32); + return pfn (); +} + +typedef DWORD_PTR WINAPI FN_SetThreadAffinityMask( HANDLE hThread, DWORD_PTR dwThreadAffinityMask ); +__declspec(dllexport) DWORD_PTR WINAPI kPrf2Wrap_SetThreadAffinityMask( HANDLE hThread, DWORD_PTR dwThreadAffinityMask ) +{ + static FN_SetThreadAffinityMask *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetThreadAffinityMask", &g_Kernel32); + return pfn( hThread, dwThreadAffinityMask ); +} + +typedef DWORD WINAPI FN_SetThreadIdealProcessor( HANDLE hThread, DWORD dwIdealProcessor ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetThreadIdealProcessor( HANDLE hThread, DWORD dwIdealProcessor ) +{ + static FN_SetThreadIdealProcessor *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetThreadIdealProcessor", &g_Kernel32); + return pfn( hThread, dwIdealProcessor ); +} + +typedef BOOL WINAPI FN_SetProcessPriorityBoost( HANDLE hProcess, BOOL bDisablePriorityBoost ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetProcessPriorityBoost( HANDLE hProcess, BOOL bDisablePriorityBoost ) +{ + static FN_SetProcessPriorityBoost *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetProcessPriorityBoost", &g_Kernel32); + return pfn( hProcess, bDisablePriorityBoost ); +} + +typedef BOOL WINAPI FN_GetProcessPriorityBoost( HANDLE hProcess, PBOOL pDisablePriorityBoost ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessPriorityBoost( HANDLE hProcess, PBOOL pDisablePriorityBoost ) +{ + static FN_GetProcessPriorityBoost *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessPriorityBoost", &g_Kernel32); + return pfn( hProcess, pDisablePriorityBoost ); +} + +typedef BOOL WINAPI FN_RequestWakeupLatency( LATENCY_TIME latency ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_RequestWakeupLatency( LATENCY_TIME latency ) +{ + static FN_RequestWakeupLatency *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RequestWakeupLatency", &g_Kernel32); + return pfn( latency ); +} + +typedef BOOL WINAPI FN_IsSystemResumeAutomatic( VOID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsSystemResumeAutomatic( VOID ) +{ + static FN_IsSystemResumeAutomatic *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsSystemResumeAutomatic", &g_Kernel32); + return pfn (); +} + +typedef HANDLE WINAPI FN_OpenThread( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenThread( DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId ) +{ + static FN_OpenThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenThread", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, dwThreadId ); +} + +typedef BOOL WINAPI FN_SetThreadPriority( HANDLE hThread, int nPriority ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetThreadPriority( HANDLE hThread, int nPriority ) +{ + static FN_SetThreadPriority *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetThreadPriority", &g_Kernel32); + return pfn( hThread, nPriority ); +} + +typedef BOOL WINAPI FN_SetThreadPriorityBoost( HANDLE hThread, BOOL bDisablePriorityBoost ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetThreadPriorityBoost( HANDLE hThread, BOOL bDisablePriorityBoost ) +{ + static FN_SetThreadPriorityBoost *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetThreadPriorityBoost", &g_Kernel32); + return pfn( hThread, bDisablePriorityBoost ); +} + +typedef BOOL WINAPI FN_GetThreadPriorityBoost( HANDLE hThread, PBOOL pDisablePriorityBoost ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetThreadPriorityBoost( HANDLE hThread, PBOOL pDisablePriorityBoost ) +{ + static FN_GetThreadPriorityBoost *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetThreadPriorityBoost", &g_Kernel32); + return pfn( hThread, pDisablePriorityBoost ); +} + +typedef int WINAPI FN_GetThreadPriority( HANDLE hThread ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetThreadPriority( HANDLE hThread ) +{ + static FN_GetThreadPriority *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetThreadPriority", &g_Kernel32); + return pfn( hThread ); +} + +typedef BOOL WINAPI FN_GetThreadTimes( HANDLE hThread, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetThreadTimes( HANDLE hThread, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ) +{ + static FN_GetThreadTimes *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetThreadTimes", &g_Kernel32); + return pfn( hThread, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime ); +} + +typedef BOOL WINAPI FN_GetThreadIOPendingFlag( HANDLE hThread, PBOOL lpIOIsPending ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetThreadIOPendingFlag( HANDLE hThread, PBOOL lpIOIsPending ) +{ + static FN_GetThreadIOPendingFlag *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetThreadIOPendingFlag", &g_Kernel32); + return pfn( hThread, lpIOIsPending ); +} + +typedef VOID WINAPI FN_ExitThread( DWORD dwExitCode ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_ExitThread( DWORD dwExitCode ) +{ + static FN_ExitThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ExitThread", &g_Kernel32); + pfn( dwExitCode ); +} + +typedef BOOL WINAPI FN_TerminateThread( HANDLE hThread, DWORD dwExitCode ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_TerminateThread( HANDLE hThread, DWORD dwExitCode ) +{ + static FN_TerminateThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TerminateThread", &g_Kernel32); + return pfn( hThread, dwExitCode ); +} + +typedef BOOL WINAPI FN_GetExitCodeThread( HANDLE hThread, LPDWORD lpExitCode ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetExitCodeThread( HANDLE hThread, LPDWORD lpExitCode ) +{ + static FN_GetExitCodeThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetExitCodeThread", &g_Kernel32); + return pfn( hThread, lpExitCode ); +} + +typedef BOOL WINAPI FN_GetThreadSelectorEntry( HANDLE hThread, DWORD dwSelector, LPLDT_ENTRY lpSelectorEntry ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetThreadSelectorEntry( HANDLE hThread, DWORD dwSelector, LPLDT_ENTRY lpSelectorEntry ) +{ + static FN_GetThreadSelectorEntry *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetThreadSelectorEntry", &g_Kernel32); + return pfn( hThread, dwSelector, lpSelectorEntry ); +} + +typedef EXECUTION_STATE WINAPI FN_SetThreadExecutionState( EXECUTION_STATE esFlags ); +__declspec(dllexport) EXECUTION_STATE WINAPI kPrf2Wrap_SetThreadExecutionState( EXECUTION_STATE esFlags ) +{ + static FN_SetThreadExecutionState *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetThreadExecutionState", &g_Kernel32); + return pfn( esFlags ); +} + +typedef DWORD WINAPI FN_GetLastError( VOID ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLastError( VOID ) +{ + static FN_GetLastError *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLastError", &g_Kernel32); + return pfn (); +} + +typedef VOID WINAPI FN_SetLastError( DWORD dwErrCode ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_SetLastError( DWORD dwErrCode ) +{ + static FN_SetLastError *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetLastError", &g_Kernel32); + pfn( dwErrCode ); +} + +typedef VOID WINAPI FN_RestoreLastError( DWORD dwErrCode ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_RestoreLastError( DWORD dwErrCode ) +{ + static FN_RestoreLastError *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RestoreLastError", &g_Kernel32); + pfn( dwErrCode ); +} + +typedef BOOL WINAPI FN_GetOverlappedResult( HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetOverlappedResult( HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait ) +{ + static FN_GetOverlappedResult *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetOverlappedResult", &g_Kernel32); + return pfn( hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait ); +} + +typedef HANDLE WINAPI FN_CreateIoCompletionPort( HANDLE FileHandle, HANDLE ExistingCompletionPort, ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateIoCompletionPort( HANDLE FileHandle, HANDLE ExistingCompletionPort, ULONG_PTR CompletionKey, DWORD NumberOfConcurrentThreads ) +{ + static FN_CreateIoCompletionPort *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateIoCompletionPort", &g_Kernel32); + return pfn( FileHandle, ExistingCompletionPort, CompletionKey, NumberOfConcurrentThreads ); +} + +typedef BOOL WINAPI FN_GetQueuedCompletionStatus( HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred, PULONG_PTR lpCompletionKey, LPOVERLAPPED * lpOverlapped, DWORD dwMilliseconds ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetQueuedCompletionStatus( HANDLE CompletionPort, LPDWORD lpNumberOfBytesTransferred, PULONG_PTR lpCompletionKey, LPOVERLAPPED * lpOverlapped, DWORD dwMilliseconds ) +{ + static FN_GetQueuedCompletionStatus *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetQueuedCompletionStatus", &g_Kernel32); + return pfn( CompletionPort, lpNumberOfBytesTransferred, lpCompletionKey, lpOverlapped, dwMilliseconds ); +} + +typedef BOOL WINAPI FN_PostQueuedCompletionStatus( HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred, ULONG_PTR dwCompletionKey, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_PostQueuedCompletionStatus( HANDLE CompletionPort, DWORD dwNumberOfBytesTransferred, ULONG_PTR dwCompletionKey, LPOVERLAPPED lpOverlapped ) +{ + static FN_PostQueuedCompletionStatus *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "PostQueuedCompletionStatus", &g_Kernel32); + return pfn( CompletionPort, dwNumberOfBytesTransferred, dwCompletionKey, lpOverlapped ); +} + +typedef UINT WINAPI FN_SetErrorMode( UINT uMode ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_SetErrorMode( UINT uMode ) +{ + static FN_SetErrorMode *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetErrorMode", &g_Kernel32); + return pfn( uMode ); +} + +typedef BOOL WINAPI FN_ReadProcessMemory( HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T * lpNumberOfBytesRead ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadProcessMemory( HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T * lpNumberOfBytesRead ) +{ + static FN_ReadProcessMemory *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadProcessMemory", &g_Kernel32); + return pfn( hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead ); +} + +typedef BOOL WINAPI FN_WriteProcessMemory( HANDLE hProcess, LPVOID lpBaseAddress, LPCVOID lpBuffer, SIZE_T nSize, SIZE_T * lpNumberOfBytesWritten ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteProcessMemory( HANDLE hProcess, LPVOID lpBaseAddress, LPCVOID lpBuffer, SIZE_T nSize, SIZE_T * lpNumberOfBytesWritten ) +{ + static FN_WriteProcessMemory *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteProcessMemory", &g_Kernel32); + return pfn( hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesWritten ); +} + +typedef BOOL WINAPI FN_GetThreadContext( HANDLE hThread, LPCONTEXT lpContext ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetThreadContext( HANDLE hThread, LPCONTEXT lpContext ) +{ + static FN_GetThreadContext *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetThreadContext", &g_Kernel32); + return pfn( hThread, lpContext ); +} + +typedef BOOL WINAPI FN_SetThreadContext( HANDLE hThread, CONST CONTEXT * lpContext ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetThreadContext( HANDLE hThread, CONST CONTEXT * lpContext ) +{ + static FN_SetThreadContext *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetThreadContext", &g_Kernel32); + return pfn( hThread, lpContext ); +} + +typedef DWORD WINAPI FN_SuspendThread( HANDLE hThread ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SuspendThread( HANDLE hThread ) +{ + static FN_SuspendThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SuspendThread", &g_Kernel32); + return pfn( hThread ); +} + +typedef DWORD WINAPI FN_ResumeThread( HANDLE hThread ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_ResumeThread( HANDLE hThread ) +{ + static FN_ResumeThread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ResumeThread", &g_Kernel32); + return pfn( hThread ); +} + +typedef DWORD WINAPI FN_QueueUserAPC( PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_QueueUserAPC( PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData ) +{ + static FN_QueueUserAPC *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "QueueUserAPC", &g_Kernel32); + return pfn( pfnAPC, hThread, dwData ); +} + +typedef BOOL WINAPI FN_IsDebuggerPresent( VOID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsDebuggerPresent( VOID ) +{ + static FN_IsDebuggerPresent *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsDebuggerPresent", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_CheckRemoteDebuggerPresent( HANDLE hProcess, PBOOL pbDebuggerPresent ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CheckRemoteDebuggerPresent( HANDLE hProcess, PBOOL pbDebuggerPresent ) +{ + static FN_CheckRemoteDebuggerPresent *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CheckRemoteDebuggerPresent", &g_Kernel32); + return pfn( hProcess, pbDebuggerPresent ); +} + +typedef VOID WINAPI FN_DebugBreak( VOID ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_DebugBreak( VOID ) +{ + static FN_DebugBreak *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DebugBreak", &g_Kernel32); + pfn (); +} + +typedef BOOL WINAPI FN_WaitForDebugEvent( LPDEBUG_EVENT lpDebugEvent, DWORD dwMilliseconds ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WaitForDebugEvent( LPDEBUG_EVENT lpDebugEvent, DWORD dwMilliseconds ) +{ + static FN_WaitForDebugEvent *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WaitForDebugEvent", &g_Kernel32); + return pfn( lpDebugEvent, dwMilliseconds ); +} + +typedef BOOL WINAPI FN_ContinueDebugEvent( DWORD dwProcessId, DWORD dwThreadId, DWORD dwContinueStatus ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ContinueDebugEvent( DWORD dwProcessId, DWORD dwThreadId, DWORD dwContinueStatus ) +{ + static FN_ContinueDebugEvent *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ContinueDebugEvent", &g_Kernel32); + return pfn( dwProcessId, dwThreadId, dwContinueStatus ); +} + +typedef BOOL WINAPI FN_DebugActiveProcess( DWORD dwProcessId ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DebugActiveProcess( DWORD dwProcessId ) +{ + static FN_DebugActiveProcess *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DebugActiveProcess", &g_Kernel32); + return pfn( dwProcessId ); +} + +typedef BOOL WINAPI FN_DebugActiveProcessStop( DWORD dwProcessId ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DebugActiveProcessStop( DWORD dwProcessId ) +{ + static FN_DebugActiveProcessStop *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DebugActiveProcessStop", &g_Kernel32); + return pfn( dwProcessId ); +} + +typedef BOOL WINAPI FN_DebugSetProcessKillOnExit( BOOL KillOnExit ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DebugSetProcessKillOnExit( BOOL KillOnExit ) +{ + static FN_DebugSetProcessKillOnExit *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DebugSetProcessKillOnExit", &g_Kernel32); + return pfn( KillOnExit ); +} + +typedef BOOL WINAPI FN_DebugBreakProcess( HANDLE Process ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DebugBreakProcess( HANDLE Process ) +{ + static FN_DebugBreakProcess *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DebugBreakProcess", &g_Kernel32); + return pfn( Process ); +} + +typedef VOID WINAPI FN_InitializeCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_InitializeCriticalSection( LPCRITICAL_SECTION lpCriticalSection ) +{ + static FN_InitializeCriticalSection *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InitializeCriticalSection", &g_Kernel32); + pfn( lpCriticalSection ); +} + +typedef VOID WINAPI FN_EnterCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_EnterCriticalSection( LPCRITICAL_SECTION lpCriticalSection ) +{ + static FN_EnterCriticalSection *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnterCriticalSection", &g_Kernel32); + pfn( lpCriticalSection ); +} + +typedef VOID WINAPI FN_LeaveCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_LeaveCriticalSection( LPCRITICAL_SECTION lpCriticalSection ) +{ + static FN_LeaveCriticalSection *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LeaveCriticalSection", &g_Kernel32); + pfn( lpCriticalSection ); +} + +typedef BOOL WINAPI FN_InitializeCriticalSectionAndSpinCount( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_InitializeCriticalSectionAndSpinCount( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount ) +{ + static FN_InitializeCriticalSectionAndSpinCount *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InitializeCriticalSectionAndSpinCount", &g_Kernel32); + return pfn( lpCriticalSection, dwSpinCount ); +} + +typedef DWORD WINAPI FN_SetCriticalSectionSpinCount( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetCriticalSectionSpinCount( LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount ) +{ + static FN_SetCriticalSectionSpinCount *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetCriticalSectionSpinCount", &g_Kernel32); + return pfn( lpCriticalSection, dwSpinCount ); +} + +typedef BOOL WINAPI FN_TryEnterCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_TryEnterCriticalSection( LPCRITICAL_SECTION lpCriticalSection ) +{ + static FN_TryEnterCriticalSection *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TryEnterCriticalSection", &g_Kernel32); + return pfn( lpCriticalSection ); +} + +typedef VOID WINAPI FN_DeleteCriticalSection( LPCRITICAL_SECTION lpCriticalSection ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_DeleteCriticalSection( LPCRITICAL_SECTION lpCriticalSection ) +{ + static FN_DeleteCriticalSection *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteCriticalSection", &g_Kernel32); + pfn( lpCriticalSection ); +} + +typedef BOOL WINAPI FN_SetEvent( HANDLE hEvent ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEvent( HANDLE hEvent ) +{ + static FN_SetEvent *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetEvent", &g_Kernel32); + return pfn( hEvent ); +} + +typedef BOOL WINAPI FN_ResetEvent( HANDLE hEvent ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ResetEvent( HANDLE hEvent ) +{ + static FN_ResetEvent *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ResetEvent", &g_Kernel32); + return pfn( hEvent ); +} + +typedef BOOL WINAPI FN_PulseEvent( HANDLE hEvent ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_PulseEvent( HANDLE hEvent ) +{ + static FN_PulseEvent *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "PulseEvent", &g_Kernel32); + return pfn( hEvent ); +} + +typedef BOOL WINAPI FN_ReleaseSemaphore( HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReleaseSemaphore( HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount ) +{ + static FN_ReleaseSemaphore *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReleaseSemaphore", &g_Kernel32); + return pfn( hSemaphore, lReleaseCount, lpPreviousCount ); +} + +typedef BOOL WINAPI FN_ReleaseMutex( HANDLE hMutex ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReleaseMutex( HANDLE hMutex ) +{ + static FN_ReleaseMutex *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReleaseMutex", &g_Kernel32); + return pfn( hMutex ); +} + +typedef DWORD WINAPI FN_WaitForSingleObject( HANDLE hHandle, DWORD dwMilliseconds ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_WaitForSingleObject( HANDLE hHandle, DWORD dwMilliseconds ) +{ + static FN_WaitForSingleObject *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WaitForSingleObject", &g_Kernel32); + return pfn( hHandle, dwMilliseconds ); +} + +typedef DWORD WINAPI FN_WaitForMultipleObjects( DWORD nCount, CONST HANDLE * lpHandles, BOOL bWaitAll, DWORD dwMilliseconds ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_WaitForMultipleObjects( DWORD nCount, CONST HANDLE * lpHandles, BOOL bWaitAll, DWORD dwMilliseconds ) +{ + static FN_WaitForMultipleObjects *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WaitForMultipleObjects", &g_Kernel32); + return pfn( nCount, lpHandles, bWaitAll, dwMilliseconds ); +} + +typedef VOID WINAPI FN_Sleep( DWORD dwMilliseconds ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_Sleep( DWORD dwMilliseconds ) +{ + static FN_Sleep *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Sleep", &g_Kernel32); + pfn( dwMilliseconds ); +} + +typedef HGLOBAL WINAPI FN_LoadResource( HMODULE hModule, HRSRC hResInfo ); +__declspec(dllexport) HGLOBAL WINAPI kPrf2Wrap_LoadResource( HMODULE hModule, HRSRC hResInfo ) +{ + static FN_LoadResource *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LoadResource", &g_Kernel32); + return pfn( hModule, hResInfo ); +} + +typedef DWORD WINAPI FN_SizeofResource( HMODULE hModule, HRSRC hResInfo ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SizeofResource( HMODULE hModule, HRSRC hResInfo ) +{ + static FN_SizeofResource *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SizeofResource", &g_Kernel32); + return pfn( hModule, hResInfo ); +} + +typedef ATOM WINAPI FN_GlobalDeleteAtom( ATOM nAtom ); +__declspec(dllexport) ATOM WINAPI kPrf2Wrap_GlobalDeleteAtom( ATOM nAtom ) +{ + static FN_GlobalDeleteAtom *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalDeleteAtom", &g_Kernel32); + return pfn( nAtom ); +} + +typedef BOOL WINAPI FN_InitAtomTable( DWORD nSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_InitAtomTable( DWORD nSize ) +{ + static FN_InitAtomTable *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InitAtomTable", &g_Kernel32); + return pfn( nSize ); +} + +typedef ATOM WINAPI FN_DeleteAtom( ATOM nAtom ); +__declspec(dllexport) ATOM WINAPI kPrf2Wrap_DeleteAtom( ATOM nAtom ) +{ + static FN_DeleteAtom *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteAtom", &g_Kernel32); + return pfn( nAtom ); +} + +typedef UINT WINAPI FN_SetHandleCount( UINT uNumber ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_SetHandleCount( UINT uNumber ) +{ + static FN_SetHandleCount *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetHandleCount", &g_Kernel32); + return pfn( uNumber ); +} + +typedef DWORD WINAPI FN_GetLogicalDrives( VOID ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLogicalDrives( VOID ) +{ + static FN_GetLogicalDrives *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLogicalDrives", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_LockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh ) +{ + static FN_LockFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LockFile", &g_Kernel32); + return pfn( hFile, dwFileOffsetLow, dwFileOffsetHigh, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh ); +} + +typedef BOOL WINAPI FN_UnlockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_UnlockFile( HANDLE hFile, DWORD dwFileOffsetLow, DWORD dwFileOffsetHigh, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh ) +{ + static FN_UnlockFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "UnlockFile", &g_Kernel32); + return pfn( hFile, dwFileOffsetLow, dwFileOffsetHigh, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh ); +} + +typedef BOOL WINAPI FN_LockFileEx( HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LockFileEx( HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped ) +{ + static FN_LockFileEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LockFileEx", &g_Kernel32); + return pfn( hFile, dwFlags, dwReserved, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, lpOverlapped ); +} + +typedef BOOL WINAPI FN_UnlockFileEx( HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_UnlockFileEx( HANDLE hFile, DWORD dwReserved, DWORD nNumberOfBytesToUnlockLow, DWORD nNumberOfBytesToUnlockHigh, LPOVERLAPPED lpOverlapped ) +{ + static FN_UnlockFileEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "UnlockFileEx", &g_Kernel32); + return pfn( hFile, dwReserved, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh, lpOverlapped ); +} + +typedef BOOL WINAPI FN_GetFileInformationByHandle( HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileInformationByHandle( HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation ) +{ + static FN_GetFileInformationByHandle *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileInformationByHandle", &g_Kernel32); + return pfn( hFile, lpFileInformation ); +} + +typedef DWORD WINAPI FN_GetFileType( HANDLE hFile ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFileType( HANDLE hFile ) +{ + static FN_GetFileType *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileType", &g_Kernel32); + return pfn( hFile ); +} + +typedef DWORD WINAPI FN_GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFileSize( HANDLE hFile, LPDWORD lpFileSizeHigh ) +{ + static FN_GetFileSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileSize", &g_Kernel32); + return pfn( hFile, lpFileSizeHigh ); +} + +typedef BOOL WINAPI FN_GetFileSizeEx( HANDLE hFile, PLARGE_INTEGER lpFileSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileSizeEx( HANDLE hFile, PLARGE_INTEGER lpFileSize ) +{ + static FN_GetFileSizeEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileSizeEx", &g_Kernel32); + return pfn( hFile, lpFileSize ); +} + +typedef HANDLE WINAPI FN_GetStdHandle( DWORD nStdHandle ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_GetStdHandle( DWORD nStdHandle ) +{ + static FN_GetStdHandle *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetStdHandle", &g_Kernel32); + return pfn( nStdHandle ); +} + +typedef BOOL WINAPI FN_SetStdHandle( DWORD nStdHandle, HANDLE hHandle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetStdHandle( DWORD nStdHandle, HANDLE hHandle ) +{ + static FN_SetStdHandle *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetStdHandle", &g_Kernel32); + return pfn( nStdHandle, hHandle ); +} + +typedef BOOL WINAPI FN_WriteFile( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteFile( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped ) +{ + static FN_WriteFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteFile", &g_Kernel32); + return pfn( hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped ); +} + +typedef BOOL WINAPI FN_ReadFile( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadFile( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped ) +{ + static FN_ReadFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadFile", &g_Kernel32); + return pfn( hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped ); +} + +typedef BOOL WINAPI FN_FlushFileBuffers( HANDLE hFile ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlushFileBuffers( HANDLE hFile ) +{ + static FN_FlushFileBuffers *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FlushFileBuffers", &g_Kernel32); + return pfn( hFile ); +} + +typedef BOOL WINAPI FN_DeviceIoControl( HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeviceIoControl( HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped ) +{ + static FN_DeviceIoControl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeviceIoControl", &g_Kernel32); + return pfn( hDevice, dwIoControlCode, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesReturned, lpOverlapped ); +} + +typedef BOOL WINAPI FN_RequestDeviceWakeup( HANDLE hDevice ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_RequestDeviceWakeup( HANDLE hDevice ) +{ + static FN_RequestDeviceWakeup *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RequestDeviceWakeup", &g_Kernel32); + return pfn( hDevice ); +} + +typedef BOOL WINAPI FN_CancelDeviceWakeupRequest( HANDLE hDevice ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CancelDeviceWakeupRequest( HANDLE hDevice ) +{ + static FN_CancelDeviceWakeupRequest *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CancelDeviceWakeupRequest", &g_Kernel32); + return pfn( hDevice ); +} + +typedef BOOL WINAPI FN_GetDevicePowerState( HANDLE hDevice, BOOL * pfOn ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDevicePowerState( HANDLE hDevice, BOOL * pfOn ) +{ + static FN_GetDevicePowerState *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDevicePowerState", &g_Kernel32); + return pfn( hDevice, pfOn ); +} + +typedef BOOL WINAPI FN_SetMessageWaitingIndicator( HANDLE hMsgIndicator, ULONG ulMsgCount ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetMessageWaitingIndicator( HANDLE hMsgIndicator, ULONG ulMsgCount ) +{ + static FN_SetMessageWaitingIndicator *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetMessageWaitingIndicator", &g_Kernel32); + return pfn( hMsgIndicator, ulMsgCount ); +} + +typedef BOOL WINAPI FN_SetEndOfFile( HANDLE hFile ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEndOfFile( HANDLE hFile ) +{ + static FN_SetEndOfFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetEndOfFile", &g_Kernel32); + return pfn( hFile ); +} + +typedef DWORD WINAPI FN_SetFilePointer( HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetFilePointer( HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod ) +{ + static FN_SetFilePointer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFilePointer", &g_Kernel32); + return pfn( hFile, lDistanceToMove, lpDistanceToMoveHigh, dwMoveMethod ); +} + +typedef BOOL WINAPI FN_SetFilePointerEx( HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFilePointerEx( HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod ) +{ + static FN_SetFilePointerEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFilePointerEx", &g_Kernel32); + return pfn( hFile, liDistanceToMove, lpNewFilePointer, dwMoveMethod ); +} + +typedef BOOL WINAPI FN_FindClose( HANDLE hFindFile ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindClose( HANDLE hFindFile ) +{ + static FN_FindClose *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindClose", &g_Kernel32); + return pfn( hFindFile ); +} + +typedef BOOL WINAPI FN_GetFileTime( HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileTime( HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime ) +{ + static FN_GetFileTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileTime", &g_Kernel32); + return pfn( hFile, lpCreationTime, lpLastAccessTime, lpLastWriteTime ); +} + +typedef BOOL WINAPI FN_SetFileTime( HANDLE hFile, CONST FILETIME * lpCreationTime, CONST FILETIME * lpLastAccessTime, CONST FILETIME * lpLastWriteTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileTime( HANDLE hFile, CONST FILETIME * lpCreationTime, CONST FILETIME * lpLastAccessTime, CONST FILETIME * lpLastWriteTime ) +{ + static FN_SetFileTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFileTime", &g_Kernel32); + return pfn( hFile, lpCreationTime, lpLastAccessTime, lpLastWriteTime ); +} + +typedef BOOL WINAPI FN_SetFileValidData( HANDLE hFile, LONGLONG ValidDataLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileValidData( HANDLE hFile, LONGLONG ValidDataLength ) +{ + static FN_SetFileValidData *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFileValidData", &g_Kernel32); + return pfn( hFile, ValidDataLength ); +} + +typedef BOOL WINAPI FN_SetFileShortNameA( HANDLE hFile, LPCSTR lpShortName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileShortNameA( HANDLE hFile, LPCSTR lpShortName ) +{ + static FN_SetFileShortNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFileShortNameA", &g_Kernel32); + return pfn( hFile, lpShortName ); +} + +typedef BOOL WINAPI FN_SetFileShortNameW( HANDLE hFile, LPCWSTR lpShortName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileShortNameW( HANDLE hFile, LPCWSTR lpShortName ) +{ + static FN_SetFileShortNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFileShortNameW", &g_Kernel32); + return pfn( hFile, lpShortName ); +} + +typedef BOOL WINAPI FN_CloseHandle( HANDLE hObject ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CloseHandle( HANDLE hObject ) +{ + static FN_CloseHandle *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CloseHandle", &g_Kernel32); + return pfn( hObject ); +} + +typedef BOOL WINAPI FN_DuplicateHandle( HANDLE hSourceProcessHandle, HANDLE hSourceHandle, HANDLE hTargetProcessHandle, LPHANDLE lpTargetHandle, DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwOptions ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DuplicateHandle( HANDLE hSourceProcessHandle, HANDLE hSourceHandle, HANDLE hTargetProcessHandle, LPHANDLE lpTargetHandle, DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwOptions ) +{ + static FN_DuplicateHandle *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DuplicateHandle", &g_Kernel32); + return pfn( hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, lpTargetHandle, dwDesiredAccess, bInheritHandle, dwOptions ); +} + +typedef BOOL WINAPI FN_GetHandleInformation( HANDLE hObject, LPDWORD lpdwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetHandleInformation( HANDLE hObject, LPDWORD lpdwFlags ) +{ + static FN_GetHandleInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetHandleInformation", &g_Kernel32); + return pfn( hObject, lpdwFlags ); +} + +typedef BOOL WINAPI FN_SetHandleInformation( HANDLE hObject, DWORD dwMask, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetHandleInformation( HANDLE hObject, DWORD dwMask, DWORD dwFlags ) +{ + static FN_SetHandleInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetHandleInformation", &g_Kernel32); + return pfn( hObject, dwMask, dwFlags ); +} + +typedef DWORD WINAPI FN_LoadModule( LPCSTR lpModuleName, LPVOID lpParameterBlock ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_LoadModule( LPCSTR lpModuleName, LPVOID lpParameterBlock ) +{ + static FN_LoadModule *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LoadModule", &g_Kernel32); + return pfn( lpModuleName, lpParameterBlock ); +} + +typedef UINT WINAPI FN_WinExec( LPCSTR lpCmdLine, UINT uCmdShow ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_WinExec( LPCSTR lpCmdLine, UINT uCmdShow ) +{ + static FN_WinExec *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WinExec", &g_Kernel32); + return pfn( lpCmdLine, uCmdShow ); +} + +typedef BOOL WINAPI FN_ClearCommBreak( HANDLE hFile ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ClearCommBreak( HANDLE hFile ) +{ + static FN_ClearCommBreak *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ClearCommBreak", &g_Kernel32); + return pfn( hFile ); +} + +typedef BOOL WINAPI FN_ClearCommError( HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpStat ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ClearCommError( HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpStat ) +{ + static FN_ClearCommError *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ClearCommError", &g_Kernel32); + return pfn( hFile, lpErrors, lpStat ); +} + +typedef BOOL WINAPI FN_SetupComm( HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetupComm( HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue ) +{ + static FN_SetupComm *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetupComm", &g_Kernel32); + return pfn( hFile, dwInQueue, dwOutQueue ); +} + +typedef BOOL WINAPI FN_EscapeCommFunction( HANDLE hFile, DWORD dwFunc ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EscapeCommFunction( HANDLE hFile, DWORD dwFunc ) +{ + static FN_EscapeCommFunction *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EscapeCommFunction", &g_Kernel32); + return pfn( hFile, dwFunc ); +} + +typedef BOOL WINAPI FN_GetCommConfig( HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommConfig( HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ) +{ + static FN_GetCommConfig *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCommConfig", &g_Kernel32); + return pfn( hCommDev, lpCC, lpdwSize ); +} + +typedef BOOL WINAPI FN_GetCommMask( HANDLE hFile, LPDWORD lpEvtMask ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommMask( HANDLE hFile, LPDWORD lpEvtMask ) +{ + static FN_GetCommMask *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCommMask", &g_Kernel32); + return pfn( hFile, lpEvtMask ); +} + +typedef BOOL WINAPI FN_GetCommProperties( HANDLE hFile, LPCOMMPROP lpCommProp ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommProperties( HANDLE hFile, LPCOMMPROP lpCommProp ) +{ + static FN_GetCommProperties *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCommProperties", &g_Kernel32); + return pfn( hFile, lpCommProp ); +} + +typedef BOOL WINAPI FN_GetCommModemStatus( HANDLE hFile, LPDWORD lpModemStat ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommModemStatus( HANDLE hFile, LPDWORD lpModemStat ) +{ + static FN_GetCommModemStatus *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCommModemStatus", &g_Kernel32); + return pfn( hFile, lpModemStat ); +} + +typedef BOOL WINAPI FN_GetCommState( HANDLE hFile, LPDCB lpDCB ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommState( HANDLE hFile, LPDCB lpDCB ) +{ + static FN_GetCommState *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCommState", &g_Kernel32); + return pfn( hFile, lpDCB ); +} + +typedef BOOL WINAPI FN_GetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts ) +{ + static FN_GetCommTimeouts *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCommTimeouts", &g_Kernel32); + return pfn( hFile, lpCommTimeouts ); +} + +typedef BOOL WINAPI FN_PurgeComm( HANDLE hFile, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_PurgeComm( HANDLE hFile, DWORD dwFlags ) +{ + static FN_PurgeComm *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "PurgeComm", &g_Kernel32); + return pfn( hFile, dwFlags ); +} + +typedef BOOL WINAPI FN_SetCommBreak( HANDLE hFile ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCommBreak( HANDLE hFile ) +{ + static FN_SetCommBreak *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetCommBreak", &g_Kernel32); + return pfn( hFile ); +} + +typedef BOOL WINAPI FN_SetCommConfig( HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCommConfig( HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize ) +{ + static FN_SetCommConfig *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetCommConfig", &g_Kernel32); + return pfn( hCommDev, lpCC, dwSize ); +} + +typedef BOOL WINAPI FN_SetCommMask( HANDLE hFile, DWORD dwEvtMask ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCommMask( HANDLE hFile, DWORD dwEvtMask ) +{ + static FN_SetCommMask *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetCommMask", &g_Kernel32); + return pfn( hFile, dwEvtMask ); +} + +typedef BOOL WINAPI FN_SetCommState( HANDLE hFile, LPDCB lpDCB ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCommState( HANDLE hFile, LPDCB lpDCB ) +{ + static FN_SetCommState *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetCommState", &g_Kernel32); + return pfn( hFile, lpDCB ); +} + +typedef BOOL WINAPI FN_SetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts ) +{ + static FN_SetCommTimeouts *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetCommTimeouts", &g_Kernel32); + return pfn( hFile, lpCommTimeouts ); +} + +typedef BOOL WINAPI FN_TransmitCommChar( HANDLE hFile, char cChar ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_TransmitCommChar( HANDLE hFile, char cChar ) +{ + static FN_TransmitCommChar *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TransmitCommChar", &g_Kernel32); + return pfn( hFile, cChar ); +} + +typedef BOOL WINAPI FN_WaitCommEvent( HANDLE hFile, LPDWORD lpEvtMask, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WaitCommEvent( HANDLE hFile, LPDWORD lpEvtMask, LPOVERLAPPED lpOverlapped ) +{ + static FN_WaitCommEvent *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WaitCommEvent", &g_Kernel32); + return pfn( hFile, lpEvtMask, lpOverlapped ); +} + +typedef DWORD WINAPI FN_SetTapePosition( HANDLE hDevice, DWORD dwPositionMethod, DWORD dwPartition, DWORD dwOffsetLow, DWORD dwOffsetHigh, BOOL bImmediate ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetTapePosition( HANDLE hDevice, DWORD dwPositionMethod, DWORD dwPartition, DWORD dwOffsetLow, DWORD dwOffsetHigh, BOOL bImmediate ) +{ + static FN_SetTapePosition *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetTapePosition", &g_Kernel32); + return pfn( hDevice, dwPositionMethod, dwPartition, dwOffsetLow, dwOffsetHigh, bImmediate ); +} + +typedef DWORD WINAPI FN_GetTapePosition( HANDLE hDevice, DWORD dwPositionType, LPDWORD lpdwPartition, LPDWORD lpdwOffsetLow, LPDWORD lpdwOffsetHigh ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTapePosition( HANDLE hDevice, DWORD dwPositionType, LPDWORD lpdwPartition, LPDWORD lpdwOffsetLow, LPDWORD lpdwOffsetHigh ) +{ + static FN_GetTapePosition *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTapePosition", &g_Kernel32); + return pfn( hDevice, dwPositionType, lpdwPartition, lpdwOffsetLow, lpdwOffsetHigh ); +} + +typedef DWORD WINAPI FN_PrepareTape( HANDLE hDevice, DWORD dwOperation, BOOL bImmediate ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_PrepareTape( HANDLE hDevice, DWORD dwOperation, BOOL bImmediate ) +{ + static FN_PrepareTape *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "PrepareTape", &g_Kernel32); + return pfn( hDevice, dwOperation, bImmediate ); +} + +typedef DWORD WINAPI FN_EraseTape( HANDLE hDevice, DWORD dwEraseType, BOOL bImmediate ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_EraseTape( HANDLE hDevice, DWORD dwEraseType, BOOL bImmediate ) +{ + static FN_EraseTape *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EraseTape", &g_Kernel32); + return pfn( hDevice, dwEraseType, bImmediate ); +} + +typedef DWORD WINAPI FN_CreateTapePartition( HANDLE hDevice, DWORD dwPartitionMethod, DWORD dwCount, DWORD dwSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_CreateTapePartition( HANDLE hDevice, DWORD dwPartitionMethod, DWORD dwCount, DWORD dwSize ) +{ + static FN_CreateTapePartition *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateTapePartition", &g_Kernel32); + return pfn( hDevice, dwPartitionMethod, dwCount, dwSize ); +} + +typedef DWORD WINAPI FN_WriteTapemark( HANDLE hDevice, DWORD dwTapemarkType, DWORD dwTapemarkCount, BOOL bImmediate ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_WriteTapemark( HANDLE hDevice, DWORD dwTapemarkType, DWORD dwTapemarkCount, BOOL bImmediate ) +{ + static FN_WriteTapemark *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteTapemark", &g_Kernel32); + return pfn( hDevice, dwTapemarkType, dwTapemarkCount, bImmediate ); +} + +typedef DWORD WINAPI FN_GetTapeStatus( HANDLE hDevice ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTapeStatus( HANDLE hDevice ) +{ + static FN_GetTapeStatus *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTapeStatus", &g_Kernel32); + return pfn( hDevice ); +} + +typedef DWORD WINAPI FN_GetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPDWORD lpdwSize, LPVOID lpTapeInformation ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPDWORD lpdwSize, LPVOID lpTapeInformation ) +{ + static FN_GetTapeParameters *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTapeParameters", &g_Kernel32); + return pfn( hDevice, dwOperation, lpdwSize, lpTapeInformation ); +} + +typedef DWORD WINAPI FN_SetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPVOID lpTapeInformation ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPVOID lpTapeInformation ) +{ + static FN_SetTapeParameters *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetTapeParameters", &g_Kernel32); + return pfn( hDevice, dwOperation, lpTapeInformation ); +} + +typedef BOOL WINAPI FN_Beep( DWORD dwFreq, DWORD dwDuration ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Beep( DWORD dwFreq, DWORD dwDuration ) +{ + static FN_Beep *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Beep", &g_Kernel32); + return pfn( dwFreq, dwDuration ); +} + +typedef int WINAPI FN_MulDiv( int nNumber, int nNumerator, int nDenominator ); +__declspec(dllexport) int WINAPI kPrf2Wrap_MulDiv( int nNumber, int nNumerator, int nDenominator ) +{ + static FN_MulDiv *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MulDiv", &g_Kernel32); + return pfn( nNumber, nNumerator, nDenominator ); +} + +typedef VOID WINAPI FN_GetSystemTime( LPSYSTEMTIME lpSystemTime ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_GetSystemTime( LPSYSTEMTIME lpSystemTime ) +{ + static FN_GetSystemTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemTime", &g_Kernel32); + pfn( lpSystemTime ); +} + +typedef VOID WINAPI FN_GetSystemTimeAsFileTime( LPFILETIME lpSystemTimeAsFileTime ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_GetSystemTimeAsFileTime( LPFILETIME lpSystemTimeAsFileTime ) +{ + static FN_GetSystemTimeAsFileTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemTimeAsFileTime", &g_Kernel32); + pfn( lpSystemTimeAsFileTime ); +} + +typedef BOOL WINAPI FN_SetSystemTime( CONST SYSTEMTIME * lpSystemTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSystemTime( CONST SYSTEMTIME * lpSystemTime ) +{ + static FN_SetSystemTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetSystemTime", &g_Kernel32); + return pfn( lpSystemTime ); +} + +typedef VOID WINAPI FN_GetLocalTime( LPSYSTEMTIME lpSystemTime ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_GetLocalTime( LPSYSTEMTIME lpSystemTime ) +{ + static FN_GetLocalTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLocalTime", &g_Kernel32); + pfn( lpSystemTime ); +} + +typedef BOOL WINAPI FN_SetLocalTime( CONST SYSTEMTIME * lpSystemTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetLocalTime( CONST SYSTEMTIME * lpSystemTime ) +{ + static FN_SetLocalTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetLocalTime", &g_Kernel32); + return pfn( lpSystemTime ); +} + +typedef VOID WINAPI FN_GetSystemInfo( LPSYSTEM_INFO lpSystemInfo ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_GetSystemInfo( LPSYSTEM_INFO lpSystemInfo ) +{ + static FN_GetSystemInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemInfo", &g_Kernel32); + pfn( lpSystemInfo ); +} + +typedef BOOL WINAPI FN_SetSystemFileCacheSize( SIZE_T MinimumFileCacheSize, SIZE_T MaximumFileCacheSize, DWORD Flags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSystemFileCacheSize( SIZE_T MinimumFileCacheSize, SIZE_T MaximumFileCacheSize, DWORD Flags ) +{ + static FN_SetSystemFileCacheSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetSystemFileCacheSize", &g_Kernel32); + return pfn( MinimumFileCacheSize, MaximumFileCacheSize, Flags ); +} + +typedef BOOL WINAPI FN_GetSystemFileCacheSize( PSIZE_T lpMinimumFileCacheSize, PSIZE_T lpMaximumFileCacheSize, PDWORD lpFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSystemFileCacheSize( PSIZE_T lpMinimumFileCacheSize, PSIZE_T lpMaximumFileCacheSize, PDWORD lpFlags ) +{ + static FN_GetSystemFileCacheSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemFileCacheSize", &g_Kernel32); + return pfn( lpMinimumFileCacheSize, lpMaximumFileCacheSize, lpFlags ); +} + +typedef BOOL WINAPI FN_GetSystemRegistryQuota( PDWORD pdwQuotaAllowed, PDWORD pdwQuotaUsed ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSystemRegistryQuota( PDWORD pdwQuotaAllowed, PDWORD pdwQuotaUsed ) +{ + static FN_GetSystemRegistryQuota *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemRegistryQuota", &g_Kernel32); + return pfn( pdwQuotaAllowed, pdwQuotaUsed ); +} + +typedef BOOL WINAPI FN_GetSystemTimes( LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSystemTimes( LPFILETIME lpIdleTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ) +{ + static FN_GetSystemTimes *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemTimes", &g_Kernel32); + return pfn( lpIdleTime, lpKernelTime, lpUserTime ); +} + +typedef VOID WINAPI FN_GetNativeSystemInfo( LPSYSTEM_INFO lpSystemInfo ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_GetNativeSystemInfo( LPSYSTEM_INFO lpSystemInfo ) +{ + static FN_GetNativeSystemInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNativeSystemInfo", &g_Kernel32); + pfn( lpSystemInfo ); +} + +typedef BOOL WINAPI FN_IsProcessorFeaturePresent( DWORD ProcessorFeature ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsProcessorFeaturePresent( DWORD ProcessorFeature ) +{ + static FN_IsProcessorFeaturePresent *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsProcessorFeaturePresent", &g_Kernel32); + return pfn( ProcessorFeature ); +} + +typedef BOOL WINAPI FN_SystemTimeToTzSpecificLocalTime( LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SystemTimeToTzSpecificLocalTime( LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpUniversalTime, LPSYSTEMTIME lpLocalTime ) +{ + static FN_SystemTimeToTzSpecificLocalTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SystemTimeToTzSpecificLocalTime", &g_Kernel32); + return pfn( lpTimeZoneInformation, lpUniversalTime, lpLocalTime ); +} + +typedef BOOL WINAPI FN_TzSpecificLocalTimeToSystemTime( LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_TzSpecificLocalTimeToSystemTime( LPTIME_ZONE_INFORMATION lpTimeZoneInformation, LPSYSTEMTIME lpLocalTime, LPSYSTEMTIME lpUniversalTime ) +{ + static FN_TzSpecificLocalTimeToSystemTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TzSpecificLocalTimeToSystemTime", &g_Kernel32); + return pfn( lpTimeZoneInformation, lpLocalTime, lpUniversalTime ); +} + +typedef DWORD WINAPI FN_GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation ) +{ + static FN_GetTimeZoneInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTimeZoneInformation", &g_Kernel32); + return pfn( lpTimeZoneInformation ); +} + +typedef BOOL WINAPI FN_SetTimeZoneInformation( CONST TIME_ZONE_INFORMATION * lpTimeZoneInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetTimeZoneInformation( CONST TIME_ZONE_INFORMATION * lpTimeZoneInformation ) +{ + static FN_SetTimeZoneInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetTimeZoneInformation", &g_Kernel32); + return pfn( lpTimeZoneInformation ); +} + +typedef BOOL WINAPI FN_SystemTimeToFileTime( CONST SYSTEMTIME * lpSystemTime, LPFILETIME lpFileTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SystemTimeToFileTime( CONST SYSTEMTIME * lpSystemTime, LPFILETIME lpFileTime ) +{ + static FN_SystemTimeToFileTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SystemTimeToFileTime", &g_Kernel32); + return pfn( lpSystemTime, lpFileTime ); +} + +typedef BOOL WINAPI FN_FileTimeToLocalFileTime( CONST FILETIME * lpFileTime, LPFILETIME lpLocalFileTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FileTimeToLocalFileTime( CONST FILETIME * lpFileTime, LPFILETIME lpLocalFileTime ) +{ + static FN_FileTimeToLocalFileTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FileTimeToLocalFileTime", &g_Kernel32); + return pfn( lpFileTime, lpLocalFileTime ); +} + +typedef BOOL WINAPI FN_LocalFileTimeToFileTime( CONST FILETIME * lpLocalFileTime, LPFILETIME lpFileTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LocalFileTimeToFileTime( CONST FILETIME * lpLocalFileTime, LPFILETIME lpFileTime ) +{ + static FN_LocalFileTimeToFileTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LocalFileTimeToFileTime", &g_Kernel32); + return pfn( lpLocalFileTime, lpFileTime ); +} + +typedef BOOL WINAPI FN_FileTimeToSystemTime( CONST FILETIME * lpFileTime, LPSYSTEMTIME lpSystemTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FileTimeToSystemTime( CONST FILETIME * lpFileTime, LPSYSTEMTIME lpSystemTime ) +{ + static FN_FileTimeToSystemTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FileTimeToSystemTime", &g_Kernel32); + return pfn( lpFileTime, lpSystemTime ); +} + +typedef LONG WINAPI FN_CompareFileTime( CONST FILETIME * lpFileTime1, CONST FILETIME * lpFileTime2 ); +__declspec(dllexport) LONG WINAPI kPrf2Wrap_CompareFileTime( CONST FILETIME * lpFileTime1, CONST FILETIME * lpFileTime2 ) +{ + static FN_CompareFileTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CompareFileTime", &g_Kernel32); + return pfn( lpFileTime1, lpFileTime2 ); +} + +typedef BOOL WINAPI FN_FileTimeToDosDateTime( CONST FILETIME * lpFileTime, LPWORD lpFatDate, LPWORD lpFatTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FileTimeToDosDateTime( CONST FILETIME * lpFileTime, LPWORD lpFatDate, LPWORD lpFatTime ) +{ + static FN_FileTimeToDosDateTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FileTimeToDosDateTime", &g_Kernel32); + return pfn( lpFileTime, lpFatDate, lpFatTime ); +} + +typedef BOOL WINAPI FN_DosDateTimeToFileTime( WORD wFatDate, WORD wFatTime, LPFILETIME lpFileTime ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DosDateTimeToFileTime( WORD wFatDate, WORD wFatTime, LPFILETIME lpFileTime ) +{ + static FN_DosDateTimeToFileTime *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DosDateTimeToFileTime", &g_Kernel32); + return pfn( wFatDate, wFatTime, lpFileTime ); +} + +typedef DWORD WINAPI FN_GetTickCount( VOID ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTickCount( VOID ) +{ + static FN_GetTickCount *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTickCount", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_SetSystemTimeAdjustment( DWORD dwTimeAdjustment, BOOL bTimeAdjustmentDisabled ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSystemTimeAdjustment( DWORD dwTimeAdjustment, BOOL bTimeAdjustmentDisabled ) +{ + static FN_SetSystemTimeAdjustment *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetSystemTimeAdjustment", &g_Kernel32); + return pfn( dwTimeAdjustment, bTimeAdjustmentDisabled ); +} + +typedef BOOL WINAPI FN_GetSystemTimeAdjustment( PDWORD lpTimeAdjustment, PDWORD lpTimeIncrement, PBOOL lpTimeAdjustmentDisabled ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSystemTimeAdjustment( PDWORD lpTimeAdjustment, PDWORD lpTimeIncrement, PBOOL lpTimeAdjustmentDisabled ) +{ + static FN_GetSystemTimeAdjustment *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemTimeAdjustment", &g_Kernel32); + return pfn( lpTimeAdjustment, lpTimeIncrement, lpTimeAdjustmentDisabled ); +} + +typedef DWORD WINAPI FN_FormatMessageA( DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, va_list * Arguments ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_FormatMessageA( DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPSTR lpBuffer, DWORD nSize, va_list * Arguments ) +{ + static FN_FormatMessageA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FormatMessageA", &g_Kernel32); + return pfn( dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments ); +} + +typedef DWORD WINAPI FN_FormatMessageW( DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, va_list * Arguments ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_FormatMessageW( DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, va_list * Arguments ) +{ + static FN_FormatMessageW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FormatMessageW", &g_Kernel32); + return pfn( dwFlags, lpSource, dwMessageId, dwLanguageId, lpBuffer, nSize, Arguments ); +} + +typedef BOOL WINAPI FN_CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize ) +{ + static FN_CreatePipe *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreatePipe", &g_Kernel32); + return pfn( hReadPipe, hWritePipe, lpPipeAttributes, nSize ); +} + +typedef BOOL WINAPI FN_ConnectNamedPipe( HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ConnectNamedPipe( HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped ) +{ + static FN_ConnectNamedPipe *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ConnectNamedPipe", &g_Kernel32); + return pfn( hNamedPipe, lpOverlapped ); +} + +typedef BOOL WINAPI FN_DisconnectNamedPipe( HANDLE hNamedPipe ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DisconnectNamedPipe( HANDLE hNamedPipe ) +{ + static FN_DisconnectNamedPipe *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DisconnectNamedPipe", &g_Kernel32); + return pfn( hNamedPipe ); +} + +typedef BOOL WINAPI FN_SetNamedPipeHandleState( HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetNamedPipeHandleState( HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout ) +{ + static FN_SetNamedPipeHandleState *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetNamedPipeHandleState", &g_Kernel32); + return pfn( hNamedPipe, lpMode, lpMaxCollectionCount, lpCollectDataTimeout ); +} + +typedef BOOL WINAPI FN_GetNamedPipeInfo( HANDLE hNamedPipe, LPDWORD lpFlags, LPDWORD lpOutBufferSize, LPDWORD lpInBufferSize, LPDWORD lpMaxInstances ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNamedPipeInfo( HANDLE hNamedPipe, LPDWORD lpFlags, LPDWORD lpOutBufferSize, LPDWORD lpInBufferSize, LPDWORD lpMaxInstances ) +{ + static FN_GetNamedPipeInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNamedPipeInfo", &g_Kernel32); + return pfn( hNamedPipe, lpFlags, lpOutBufferSize, lpInBufferSize, lpMaxInstances ); +} + +typedef BOOL WINAPI FN_PeekNamedPipe( HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail, LPDWORD lpBytesLeftThisMessage ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_PeekNamedPipe( HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail, LPDWORD lpBytesLeftThisMessage ) +{ + static FN_PeekNamedPipe *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "PeekNamedPipe", &g_Kernel32); + return pfn( hNamedPipe, lpBuffer, nBufferSize, lpBytesRead, lpTotalBytesAvail, lpBytesLeftThisMessage ); +} + +typedef BOOL WINAPI FN_TransactNamedPipe( HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_TransactNamedPipe( HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, LPOVERLAPPED lpOverlapped ) +{ + static FN_TransactNamedPipe *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TransactNamedPipe", &g_Kernel32); + return pfn( hNamedPipe, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesRead, lpOverlapped ); +} + +typedef HANDLE WINAPI FN_CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) +{ + static FN_CreateMailslotA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateMailslotA", &g_Kernel32); + return pfn( lpName, nMaxMessageSize, lReadTimeout, lpSecurityAttributes ); +} + +typedef HANDLE WINAPI FN_CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateMailslotW( LPCWSTR lpName, DWORD nMaxMessageSize, DWORD lReadTimeout, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) +{ + static FN_CreateMailslotW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateMailslotW", &g_Kernel32); + return pfn( lpName, nMaxMessageSize, lReadTimeout, lpSecurityAttributes ); +} + +typedef BOOL WINAPI FN_GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize, LPDWORD lpNextSize, LPDWORD lpMessageCount, LPDWORD lpReadTimeout ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetMailslotInfo( HANDLE hMailslot, LPDWORD lpMaxMessageSize, LPDWORD lpNextSize, LPDWORD lpMessageCount, LPDWORD lpReadTimeout ) +{ + static FN_GetMailslotInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetMailslotInfo", &g_Kernel32); + return pfn( hMailslot, lpMaxMessageSize, lpNextSize, lpMessageCount, lpReadTimeout ); +} + +typedef BOOL WINAPI FN_SetMailslotInfo( HANDLE hMailslot, DWORD lReadTimeout ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetMailslotInfo( HANDLE hMailslot, DWORD lReadTimeout ) +{ + static FN_SetMailslotInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetMailslotInfo", &g_Kernel32); + return pfn( hMailslot, lReadTimeout ); +} + +typedef LPVOID WINAPI FN_MapViewOfFile( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_MapViewOfFile( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap ) +{ + static FN_MapViewOfFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MapViewOfFile", &g_Kernel32); + return pfn( hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap ); +} + +typedef BOOL WINAPI FN_FlushViewOfFile( LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlushViewOfFile( LPCVOID lpBaseAddress, SIZE_T dwNumberOfBytesToFlush ) +{ + static FN_FlushViewOfFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FlushViewOfFile", &g_Kernel32); + return pfn( lpBaseAddress, dwNumberOfBytesToFlush ); +} + +typedef BOOL WINAPI FN_UnmapViewOfFile( LPCVOID lpBaseAddress ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_UnmapViewOfFile( LPCVOID lpBaseAddress ) +{ + static FN_UnmapViewOfFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "UnmapViewOfFile", &g_Kernel32); + return pfn( lpBaseAddress ); +} + +typedef BOOL WINAPI FN_EncryptFileA( LPCSTR lpFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EncryptFileA( LPCSTR lpFileName ) +{ + static FN_EncryptFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EncryptFileA", &g_Kernel32); + return pfn( lpFileName ); +} + +typedef BOOL WINAPI FN_EncryptFileW( LPCWSTR lpFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EncryptFileW( LPCWSTR lpFileName ) +{ + static FN_EncryptFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EncryptFileW", &g_Kernel32); + return pfn( lpFileName ); +} + +typedef BOOL WINAPI FN_DecryptFileA( LPCSTR lpFileName, DWORD dwReserved ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DecryptFileA( LPCSTR lpFileName, DWORD dwReserved ) +{ + static FN_DecryptFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DecryptFileA", &g_Kernel32); + return pfn( lpFileName, dwReserved ); +} + +typedef BOOL WINAPI FN_DecryptFileW( LPCWSTR lpFileName, DWORD dwReserved ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DecryptFileW( LPCWSTR lpFileName, DWORD dwReserved ) +{ + static FN_DecryptFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DecryptFileW", &g_Kernel32); + return pfn( lpFileName, dwReserved ); +} + +typedef BOOL WINAPI FN_FileEncryptionStatusA( LPCSTR lpFileName, LPDWORD lpStatus ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FileEncryptionStatusA( LPCSTR lpFileName, LPDWORD lpStatus ) +{ + static FN_FileEncryptionStatusA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FileEncryptionStatusA", &g_Kernel32); + return pfn( lpFileName, lpStatus ); +} + +typedef BOOL WINAPI FN_FileEncryptionStatusW( LPCWSTR lpFileName, LPDWORD lpStatus ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FileEncryptionStatusW( LPCWSTR lpFileName, LPDWORD lpStatus ) +{ + static FN_FileEncryptionStatusW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FileEncryptionStatusW", &g_Kernel32); + return pfn( lpFileName, lpStatus ); +} + +typedef DWORD WINAPI FN_OpenEncryptedFileRawA( LPCSTR lpFileName, ULONG ulFlags, PVOID * pvContext ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_OpenEncryptedFileRawA( LPCSTR lpFileName, ULONG ulFlags, PVOID * pvContext ) +{ + static FN_OpenEncryptedFileRawA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenEncryptedFileRawA", &g_Kernel32); + return pfn( lpFileName, ulFlags, pvContext ); +} + +typedef DWORD WINAPI FN_OpenEncryptedFileRawW( LPCWSTR lpFileName, ULONG ulFlags, PVOID * pvContext ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_OpenEncryptedFileRawW( LPCWSTR lpFileName, ULONG ulFlags, PVOID * pvContext ) +{ + static FN_OpenEncryptedFileRawW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenEncryptedFileRawW", &g_Kernel32); + return pfn( lpFileName, ulFlags, pvContext ); +} + +typedef DWORD WINAPI FN_ReadEncryptedFileRaw( PFE_EXPORT_FUNC pfExportCallback, PVOID pvCallbackContext, PVOID pvContext ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_ReadEncryptedFileRaw( PFE_EXPORT_FUNC pfExportCallback, PVOID pvCallbackContext, PVOID pvContext ) +{ + static FN_ReadEncryptedFileRaw *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadEncryptedFileRaw", &g_Kernel32); + return pfn( pfExportCallback, pvCallbackContext, pvContext ); +} + +typedef DWORD WINAPI FN_WriteEncryptedFileRaw( PFE_IMPORT_FUNC pfImportCallback, PVOID pvCallbackContext, PVOID pvContext ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_WriteEncryptedFileRaw( PFE_IMPORT_FUNC pfImportCallback, PVOID pvCallbackContext, PVOID pvContext ) +{ + static FN_WriteEncryptedFileRaw *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteEncryptedFileRaw", &g_Kernel32); + return pfn( pfImportCallback, pvCallbackContext, pvContext ); +} + +typedef VOID WINAPI FN_CloseEncryptedFileRaw( PVOID pvContext ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_CloseEncryptedFileRaw( PVOID pvContext ) +{ + static FN_CloseEncryptedFileRaw *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CloseEncryptedFileRaw", &g_Kernel32); + pfn( pvContext ); +} + +typedef int WINAPI FN_lstrcmpA( LPCSTR lpString1, LPCSTR lpString2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmpA( LPCSTR lpString1, LPCSTR lpString2 ) +{ + static FN_lstrcmpA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcmpA", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef int WINAPI FN_lstrcmpW( LPCWSTR lpString1, LPCWSTR lpString2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmpW( LPCWSTR lpString1, LPCWSTR lpString2 ) +{ + static FN_lstrcmpW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcmpW", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef int WINAPI FN_lstrcmpiA( LPCSTR lpString1, LPCSTR lpString2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmpiA( LPCSTR lpString1, LPCSTR lpString2 ) +{ + static FN_lstrcmpiA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcmpiA", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef int WINAPI FN_lstrcmpiW( LPCWSTR lpString1, LPCWSTR lpString2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmpiW( LPCWSTR lpString1, LPCWSTR lpString2 ) +{ + static FN_lstrcmpiW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcmpiW", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef LPSTR WINAPI FN_lstrcpynA( LPSTR lpString1, LPCSTR lpString2, int iMaxLength ); +__declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcpynA( LPSTR lpString1, LPCSTR lpString2, int iMaxLength ) +{ + static FN_lstrcpynA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcpynA", &g_Kernel32); + return pfn( lpString1, lpString2, iMaxLength ); +} + +typedef LPWSTR WINAPI FN_lstrcpynW( LPWSTR lpString1, LPCWSTR lpString2, int iMaxLength ); +__declspec(dllexport) LPWSTR WINAPI kPrf2Wrap_lstrcpynW( LPWSTR lpString1, LPCWSTR lpString2, int iMaxLength ) +{ + static FN_lstrcpynW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcpynW", &g_Kernel32); + return pfn( lpString1, lpString2, iMaxLength ); +} + +typedef LPSTR WINAPI FN_lstrcpyA( LPSTR lpString1, LPCSTR lpString2 ); +__declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcpyA( LPSTR lpString1, LPCSTR lpString2 ) +{ + static FN_lstrcpyA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcpyA", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef LPWSTR WINAPI FN_lstrcpyW( LPWSTR lpString1, LPCWSTR lpString2 ); +__declspec(dllexport) LPWSTR WINAPI kPrf2Wrap_lstrcpyW( LPWSTR lpString1, LPCWSTR lpString2 ) +{ + static FN_lstrcpyW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcpyW", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef LPSTR WINAPI FN_lstrcatA( LPSTR lpString1, LPCSTR lpString2 ); +__declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcatA( LPSTR lpString1, LPCSTR lpString2 ) +{ + static FN_lstrcatA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcatA", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef LPWSTR WINAPI FN_lstrcatW( LPWSTR lpString1, LPCWSTR lpString2 ); +__declspec(dllexport) LPWSTR WINAPI kPrf2Wrap_lstrcatW( LPWSTR lpString1, LPCWSTR lpString2 ) +{ + static FN_lstrcatW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcatW", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef int WINAPI FN_lstrlenA( LPCSTR lpString ); +__declspec(dllexport) int WINAPI kPrf2Wrap_lstrlenA( LPCSTR lpString ) +{ + static FN_lstrlenA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrlenA", &g_Kernel32); + return pfn( lpString ); +} + +typedef int WINAPI FN_lstrlenW( LPCWSTR lpString ); +__declspec(dllexport) int WINAPI kPrf2Wrap_lstrlenW( LPCWSTR lpString ) +{ + static FN_lstrlenW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrlenW", &g_Kernel32); + return pfn( lpString ); +} + +typedef HFILE WINAPI FN_OpenFile( LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle ); +__declspec(dllexport) HFILE WINAPI kPrf2Wrap_OpenFile( LPCSTR lpFileName, LPOFSTRUCT lpReOpenBuff, UINT uStyle ) +{ + static FN_OpenFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenFile", &g_Kernel32); + return pfn( lpFileName, lpReOpenBuff, uStyle ); +} + +typedef HFILE WINAPI FN__lopen( LPCSTR lpPathName, int iReadWrite ); +__declspec(dllexport) HFILE WINAPI kPrf2Wrap__lopen( LPCSTR lpPathName, int iReadWrite ) +{ + static FN__lopen *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "_lopen", &g_Kernel32); + return pfn( lpPathName, iReadWrite ); +} + +typedef HFILE WINAPI FN__lcreat( LPCSTR lpPathName, int iAttribute ); +__declspec(dllexport) HFILE WINAPI kPrf2Wrap__lcreat( LPCSTR lpPathName, int iAttribute ) +{ + static FN__lcreat *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "_lcreat", &g_Kernel32); + return pfn( lpPathName, iAttribute ); +} + +typedef UINT WINAPI FN__lread( HFILE hFile, LPVOID lpBuffer, UINT uBytes ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap__lread( HFILE hFile, LPVOID lpBuffer, UINT uBytes ) +{ + static FN__lread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "_lread", &g_Kernel32); + return pfn( hFile, lpBuffer, uBytes ); +} + +typedef UINT WINAPI FN__lwrite( HFILE hFile, LPCCH lpBuffer, UINT uBytes ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap__lwrite( HFILE hFile, LPCCH lpBuffer, UINT uBytes ) +{ + static FN__lwrite *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "_lwrite", &g_Kernel32); + return pfn( hFile, lpBuffer, uBytes ); +} + +typedef long WINAPI FN__hread( HFILE hFile, LPVOID lpBuffer, long lBytes ); +__declspec(dllexport) long WINAPI kPrf2Wrap__hread( HFILE hFile, LPVOID lpBuffer, long lBytes ) +{ + static FN__hread *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "_hread", &g_Kernel32); + return pfn( hFile, lpBuffer, lBytes ); +} + +typedef long WINAPI FN__hwrite( HFILE hFile, LPCCH lpBuffer, long lBytes ); +__declspec(dllexport) long WINAPI kPrf2Wrap__hwrite( HFILE hFile, LPCCH lpBuffer, long lBytes ) +{ + static FN__hwrite *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "_hwrite", &g_Kernel32); + return pfn( hFile, lpBuffer, lBytes ); +} + +typedef HFILE WINAPI FN__lclose( HFILE hFile ); +__declspec(dllexport) HFILE WINAPI kPrf2Wrap__lclose( HFILE hFile ) +{ + static FN__lclose *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "_lclose", &g_Kernel32); + return pfn( hFile ); +} + +typedef LONG WINAPI FN__llseek( HFILE hFile, LONG lOffset, int iOrigin ); +__declspec(dllexport) LONG WINAPI kPrf2Wrap__llseek( HFILE hFile, LONG lOffset, int iOrigin ) +{ + static FN__llseek *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "_llseek", &g_Kernel32); + return pfn( hFile, lOffset, iOrigin ); +} + +typedef BOOL WINAPI FN_IsTextUnicode( CONST VOID * lpv, int iSize, LPINT lpiResult ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsTextUnicode( CONST VOID * lpv, int iSize, LPINT lpiResult ) +{ + static FN_IsTextUnicode *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsTextUnicode", &g_Kernel32); + return pfn( lpv, iSize, lpiResult ); +} + +typedef DWORD WINAPI FN_FlsAlloc( PFLS_CALLBACK_FUNCTION lpCallback ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_FlsAlloc( PFLS_CALLBACK_FUNCTION lpCallback ) +{ + static FN_FlsAlloc *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FlsAlloc", &g_Kernel32); + return pfn( lpCallback ); +} + +typedef PVOID WINAPI FN_FlsGetValue( DWORD dwFlsIndex ); +__declspec(dllexport) PVOID WINAPI kPrf2Wrap_FlsGetValue( DWORD dwFlsIndex ) +{ + static FN_FlsGetValue *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FlsGetValue", &g_Kernel32); + return pfn( dwFlsIndex ); +} + +typedef BOOL WINAPI FN_FlsSetValue( DWORD dwFlsIndex, PVOID lpFlsData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlsSetValue( DWORD dwFlsIndex, PVOID lpFlsData ) +{ + static FN_FlsSetValue *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FlsSetValue", &g_Kernel32); + return pfn( dwFlsIndex, lpFlsData ); +} + +typedef BOOL WINAPI FN_FlsFree( DWORD dwFlsIndex ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlsFree( DWORD dwFlsIndex ) +{ + static FN_FlsFree *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FlsFree", &g_Kernel32); + return pfn( dwFlsIndex ); +} + +typedef DWORD WINAPI FN_TlsAlloc( VOID ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_TlsAlloc( VOID ) +{ + static FN_TlsAlloc *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TlsAlloc", &g_Kernel32); + return pfn (); +} + +typedef LPVOID WINAPI FN_TlsGetValue( DWORD dwTlsIndex ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_TlsGetValue( DWORD dwTlsIndex ) +{ + static FN_TlsGetValue *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TlsGetValue", &g_Kernel32); + return pfn( dwTlsIndex ); +} + +typedef BOOL WINAPI FN_TlsSetValue( DWORD dwTlsIndex, LPVOID lpTlsValue ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_TlsSetValue( DWORD dwTlsIndex, LPVOID lpTlsValue ) +{ + static FN_TlsSetValue *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TlsSetValue", &g_Kernel32); + return pfn( dwTlsIndex, lpTlsValue ); +} + +typedef BOOL WINAPI FN_TlsFree( DWORD dwTlsIndex ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_TlsFree( DWORD dwTlsIndex ) +{ + static FN_TlsFree *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TlsFree", &g_Kernel32); + return pfn( dwTlsIndex ); +} + +typedef DWORD WINAPI FN_SleepEx( DWORD dwMilliseconds, BOOL bAlertable ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SleepEx( DWORD dwMilliseconds, BOOL bAlertable ) +{ + static FN_SleepEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SleepEx", &g_Kernel32); + return pfn( dwMilliseconds, bAlertable ); +} + +typedef DWORD WINAPI FN_WaitForSingleObjectEx( HANDLE hHandle, DWORD dwMilliseconds, BOOL bAlertable ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_WaitForSingleObjectEx( HANDLE hHandle, DWORD dwMilliseconds, BOOL bAlertable ) +{ + static FN_WaitForSingleObjectEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WaitForSingleObjectEx", &g_Kernel32); + return pfn( hHandle, dwMilliseconds, bAlertable ); +} + +typedef DWORD WINAPI FN_WaitForMultipleObjectsEx( DWORD nCount, CONST HANDLE * lpHandles, BOOL bWaitAll, DWORD dwMilliseconds, BOOL bAlertable ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_WaitForMultipleObjectsEx( DWORD nCount, CONST HANDLE * lpHandles, BOOL bWaitAll, DWORD dwMilliseconds, BOOL bAlertable ) +{ + static FN_WaitForMultipleObjectsEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WaitForMultipleObjectsEx", &g_Kernel32); + return pfn( nCount, lpHandles, bWaitAll, dwMilliseconds, bAlertable ); +} + +typedef DWORD WINAPI FN_SignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, DWORD dwMilliseconds, BOOL bAlertable ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SignalObjectAndWait( HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, DWORD dwMilliseconds, BOOL bAlertable ) +{ + static FN_SignalObjectAndWait *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SignalObjectAndWait", &g_Kernel32); + return pfn( hObjectToSignal, hObjectToWaitOn, dwMilliseconds, bAlertable ); +} + +typedef BOOL WINAPI FN_ReadFileEx( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadFileEx( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) +{ + static FN_ReadFileEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadFileEx", &g_Kernel32); + return pfn( hFile, lpBuffer, nNumberOfBytesToRead, lpOverlapped, lpCompletionRoutine ); +} + +typedef BOOL WINAPI FN_WriteFileEx( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteFileEx( HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) +{ + static FN_WriteFileEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteFileEx", &g_Kernel32); + return pfn( hFile, lpBuffer, nNumberOfBytesToWrite, lpOverlapped, lpCompletionRoutine ); +} + +typedef BOOL WINAPI FN_BackupRead( HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, BOOL bAbort, BOOL bProcessSecurity, LPVOID * lpContext ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_BackupRead( HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, BOOL bAbort, BOOL bProcessSecurity, LPVOID * lpContext ) +{ + static FN_BackupRead *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BackupRead", &g_Kernel32); + return pfn( hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, bAbort, bProcessSecurity, lpContext ); +} + +typedef BOOL WINAPI FN_BackupSeek( HANDLE hFile, DWORD dwLowBytesToSeek, DWORD dwHighBytesToSeek, LPDWORD lpdwLowByteSeeked, LPDWORD lpdwHighByteSeeked, LPVOID * lpContext ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_BackupSeek( HANDLE hFile, DWORD dwLowBytesToSeek, DWORD dwHighBytesToSeek, LPDWORD lpdwLowByteSeeked, LPDWORD lpdwHighByteSeeked, LPVOID * lpContext ) +{ + static FN_BackupSeek *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BackupSeek", &g_Kernel32); + return pfn( hFile, dwLowBytesToSeek, dwHighBytesToSeek, lpdwLowByteSeeked, lpdwHighByteSeeked, lpContext ); +} + +typedef BOOL WINAPI FN_BackupWrite( HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, BOOL bAbort, BOOL bProcessSecurity, LPVOID * lpContext ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_BackupWrite( HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, BOOL bAbort, BOOL bProcessSecurity, LPVOID * lpContext ) +{ + static FN_BackupWrite *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BackupWrite", &g_Kernel32); + return pfn( hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, bAbort, bProcessSecurity, lpContext ); +} + +typedef BOOL WINAPI FN_ReadFileScatter( HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToRead, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadFileScatter( HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToRead, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped ) +{ + static FN_ReadFileScatter *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadFileScatter", &g_Kernel32); + return pfn( hFile, aSegmentArray, nNumberOfBytesToRead, lpReserved, lpOverlapped ); +} + +typedef BOOL WINAPI FN_WriteFileGather( HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToWrite, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteFileGather( HANDLE hFile, FILE_SEGMENT_ELEMENT aSegmentArray[], DWORD nNumberOfBytesToWrite, LPDWORD lpReserved, LPOVERLAPPED lpOverlapped ) +{ + static FN_WriteFileGather *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteFileGather", &g_Kernel32); + return pfn( hFile, aSegmentArray, nNumberOfBytesToWrite, lpReserved, lpOverlapped ); +} + +typedef HANDLE WINAPI FN_CreateMutexA( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateMutexA( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCSTR lpName ) +{ + static FN_CreateMutexA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateMutexA", &g_Kernel32); + return pfn( lpMutexAttributes, bInitialOwner, lpName ); +} + +typedef HANDLE WINAPI FN_CreateMutexW( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCWSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateMutexW( LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCWSTR lpName ) +{ + static FN_CreateMutexW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateMutexW", &g_Kernel32); + return pfn( lpMutexAttributes, bInitialOwner, lpName ); +} + +typedef HANDLE WINAPI FN_OpenMutexA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenMutexA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ) +{ + static FN_OpenMutexA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenMutexA", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpName ); +} + +typedef HANDLE WINAPI FN_OpenMutexW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenMutexW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ) +{ + static FN_OpenMutexW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenMutexW", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpName ); +} + +typedef HANDLE WINAPI FN_CreateEventA( LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateEventA( LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCSTR lpName ) +{ + static FN_CreateEventA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateEventA", &g_Kernel32); + return pfn( lpEventAttributes, bManualReset, bInitialState, lpName ); +} + +typedef HANDLE WINAPI FN_CreateEventW( LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateEventW( LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName ) +{ + static FN_CreateEventW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateEventW", &g_Kernel32); + return pfn( lpEventAttributes, bManualReset, bInitialState, lpName ); +} + +typedef HANDLE WINAPI FN_OpenEventA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenEventA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ) +{ + static FN_OpenEventA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenEventA", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpName ); +} + +typedef HANDLE WINAPI FN_OpenEventW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenEventW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ) +{ + static FN_OpenEventW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenEventW", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpName ); +} + +typedef HANDLE WINAPI FN_CreateSemaphoreA( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateSemaphoreA( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCSTR lpName ) +{ + static FN_CreateSemaphoreA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateSemaphoreA", &g_Kernel32); + return pfn( lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName ); +} + +typedef HANDLE WINAPI FN_CreateSemaphoreW( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateSemaphoreW( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName ) +{ + static FN_CreateSemaphoreW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateSemaphoreW", &g_Kernel32); + return pfn( lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName ); +} + +typedef HANDLE WINAPI FN_OpenSemaphoreA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenSemaphoreA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ) +{ + static FN_OpenSemaphoreA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenSemaphoreA", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpName ); +} + +typedef HANDLE WINAPI FN_OpenSemaphoreW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenSemaphoreW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ) +{ + static FN_OpenSemaphoreW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenSemaphoreW", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpName ); +} + +typedef HANDLE WINAPI FN_CreateWaitableTimerA( LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCSTR lpTimerName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateWaitableTimerA( LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCSTR lpTimerName ) +{ + static FN_CreateWaitableTimerA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateWaitableTimerA", &g_Kernel32); + return pfn( lpTimerAttributes, bManualReset, lpTimerName ); +} + +typedef HANDLE WINAPI FN_CreateWaitableTimerW( LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCWSTR lpTimerName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateWaitableTimerW( LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManualReset, LPCWSTR lpTimerName ) +{ + static FN_CreateWaitableTimerW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateWaitableTimerW", &g_Kernel32); + return pfn( lpTimerAttributes, bManualReset, lpTimerName ); +} + +typedef HANDLE WINAPI FN_OpenWaitableTimerA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpTimerName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenWaitableTimerA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpTimerName ) +{ + static FN_OpenWaitableTimerA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenWaitableTimerA", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpTimerName ); +} + +typedef HANDLE WINAPI FN_OpenWaitableTimerW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpTimerName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenWaitableTimerW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpTimerName ) +{ + static FN_OpenWaitableTimerW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenWaitableTimerW", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpTimerName ); +} + +typedef BOOL WINAPI FN_SetWaitableTimer( HANDLE hTimer, const LARGE_INTEGER * lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, BOOL fResume ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetWaitableTimer( HANDLE hTimer, const LARGE_INTEGER * lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, BOOL fResume ) +{ + static FN_SetWaitableTimer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetWaitableTimer", &g_Kernel32); + return pfn( hTimer, lpDueTime, lPeriod, pfnCompletionRoutine, lpArgToCompletionRoutine, fResume ); +} + +typedef BOOL WINAPI FN_CancelWaitableTimer( HANDLE hTimer ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CancelWaitableTimer( HANDLE hTimer ) +{ + static FN_CancelWaitableTimer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CancelWaitableTimer", &g_Kernel32); + return pfn( hTimer ); +} + +typedef HANDLE WINAPI FN_CreateFileMappingA( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateFileMappingA( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName ) +{ + static FN_CreateFileMappingA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateFileMappingA", &g_Kernel32); + return pfn( hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName ); +} + +typedef HANDLE WINAPI FN_CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateFileMappingW( HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCWSTR lpName ) +{ + static FN_CreateFileMappingW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateFileMappingW", &g_Kernel32); + return pfn( hFile, lpFileMappingAttributes, flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName ); +} + +typedef HANDLE WINAPI FN_OpenFileMappingA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenFileMappingA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ) +{ + static FN_OpenFileMappingA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenFileMappingA", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpName ); +} + +typedef HANDLE WINAPI FN_OpenFileMappingW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenFileMappingW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ) +{ + static FN_OpenFileMappingW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenFileMappingW", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpName ); +} + +typedef DWORD WINAPI FN_GetLogicalDriveStringsA( DWORD nBufferLength, LPSTR lpBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLogicalDriveStringsA( DWORD nBufferLength, LPSTR lpBuffer ) +{ + static FN_GetLogicalDriveStringsA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLogicalDriveStringsA", &g_Kernel32); + return pfn( nBufferLength, lpBuffer ); +} + +typedef DWORD WINAPI FN_GetLogicalDriveStringsW( DWORD nBufferLength, LPWSTR lpBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLogicalDriveStringsW( DWORD nBufferLength, LPWSTR lpBuffer ) +{ + static FN_GetLogicalDriveStringsW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLogicalDriveStringsW", &g_Kernel32); + return pfn( nBufferLength, lpBuffer ); +} + +typedef HANDLE WINAPI FN_CreateMemoryResourceNotification( MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateMemoryResourceNotification( MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType ) +{ + static FN_CreateMemoryResourceNotification *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateMemoryResourceNotification", &g_Kernel32); + return pfn( NotificationType ); +} + +typedef BOOL WINAPI FN_QueryMemoryResourceNotification( HANDLE ResourceNotificationHandle, PBOOL ResourceState ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueryMemoryResourceNotification( HANDLE ResourceNotificationHandle, PBOOL ResourceState ) +{ + static FN_QueryMemoryResourceNotification *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "QueryMemoryResourceNotification", &g_Kernel32); + return pfn( ResourceNotificationHandle, ResourceState ); +} + +typedef HMODULE WINAPI FN_LoadLibraryA( LPCSTR lpLibFileName ); +__declspec(dllexport) HMODULE WINAPI kPrf2Wrap_LoadLibraryA( LPCSTR lpLibFileName ) +{ + static FN_LoadLibraryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LoadLibraryA", &g_Kernel32); + return pfn( lpLibFileName ); +} + +typedef HMODULE WINAPI FN_LoadLibraryW( LPCWSTR lpLibFileName ); +__declspec(dllexport) HMODULE WINAPI kPrf2Wrap_LoadLibraryW( LPCWSTR lpLibFileName ) +{ + static FN_LoadLibraryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LoadLibraryW", &g_Kernel32); + return pfn( lpLibFileName ); +} + +typedef HMODULE WINAPI FN_LoadLibraryExA( LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ); +__declspec(dllexport) HMODULE WINAPI kPrf2Wrap_LoadLibraryExA( LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ) +{ + static FN_LoadLibraryExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LoadLibraryExA", &g_Kernel32); + return pfn( lpLibFileName, hFile, dwFlags ); +} + +typedef HMODULE WINAPI FN_LoadLibraryExW( LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ); +__declspec(dllexport) HMODULE WINAPI kPrf2Wrap_LoadLibraryExW( LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags ) +{ + static FN_LoadLibraryExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LoadLibraryExW", &g_Kernel32); + return pfn( lpLibFileName, hFile, dwFlags ); +} + +typedef DWORD WINAPI FN_GetModuleFileNameA( HMODULE hModule, LPCH lpFilename, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetModuleFileNameA( HMODULE hModule, LPCH lpFilename, DWORD nSize ) +{ + static FN_GetModuleFileNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetModuleFileNameA", &g_Kernel32); + return pfn( hModule, lpFilename, nSize ); +} + +typedef DWORD WINAPI FN_GetModuleFileNameW( HMODULE hModule, LPWCH lpFilename, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetModuleFileNameW( HMODULE hModule, LPWCH lpFilename, DWORD nSize ) +{ + static FN_GetModuleFileNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetModuleFileNameW", &g_Kernel32); + return pfn( hModule, lpFilename, nSize ); +} + +typedef HMODULE WINAPI FN_GetModuleHandleA( LPCSTR lpModuleName ); +__declspec(dllexport) HMODULE WINAPI kPrf2Wrap_GetModuleHandleA( LPCSTR lpModuleName ) +{ + static FN_GetModuleHandleA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetModuleHandleA", &g_Kernel32); + return pfn( lpModuleName ); +} + +typedef HMODULE WINAPI FN_GetModuleHandleW( LPCWSTR lpModuleName ); +__declspec(dllexport) HMODULE WINAPI kPrf2Wrap_GetModuleHandleW( LPCWSTR lpModuleName ) +{ + static FN_GetModuleHandleW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetModuleHandleW", &g_Kernel32); + return pfn( lpModuleName ); +} + +typedef BOOL WINAPI FN_GetModuleHandleExA( DWORD dwFlags, LPCSTR lpModuleName, HMODULE * phModule ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetModuleHandleExA( DWORD dwFlags, LPCSTR lpModuleName, HMODULE * phModule ) +{ + static FN_GetModuleHandleExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetModuleHandleExA", &g_Kernel32); + return pfn( dwFlags, lpModuleName, phModule ); +} + +typedef BOOL WINAPI FN_GetModuleHandleExW( DWORD dwFlags, LPCWSTR lpModuleName, HMODULE * phModule ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetModuleHandleExW( DWORD dwFlags, LPCWSTR lpModuleName, HMODULE * phModule ) +{ + static FN_GetModuleHandleExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetModuleHandleExW", &g_Kernel32); + return pfn( dwFlags, lpModuleName, phModule ); +} + +typedef BOOL WINAPI FN_NeedCurrentDirectoryForExePathA( LPCSTR ExeName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_NeedCurrentDirectoryForExePathA( LPCSTR ExeName ) +{ + static FN_NeedCurrentDirectoryForExePathA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "NeedCurrentDirectoryForExePathA", &g_Kernel32); + return pfn( ExeName ); +} + +typedef BOOL WINAPI FN_NeedCurrentDirectoryForExePathW( LPCWSTR ExeName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_NeedCurrentDirectoryForExePathW( LPCWSTR ExeName ) +{ + static FN_NeedCurrentDirectoryForExePathW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "NeedCurrentDirectoryForExePathW", &g_Kernel32); + return pfn( ExeName ); +} + +typedef BOOL WINAPI FN_CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessA( LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) +{ + static FN_CreateProcessA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateProcessA", &g_Kernel32); + return pfn( lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); +} + +typedef BOOL WINAPI FN_CreateProcessW( LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessW( LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) +{ + static FN_CreateProcessW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateProcessW", &g_Kernel32); + return pfn( lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); +} + +typedef BOOL WINAPI FN_SetProcessShutdownParameters( DWORD dwLevel, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetProcessShutdownParameters( DWORD dwLevel, DWORD dwFlags ) +{ + static FN_SetProcessShutdownParameters *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetProcessShutdownParameters", &g_Kernel32); + return pfn( dwLevel, dwFlags ); +} + +typedef BOOL WINAPI FN_GetProcessShutdownParameters( LPDWORD lpdwLevel, LPDWORD lpdwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetProcessShutdownParameters( LPDWORD lpdwLevel, LPDWORD lpdwFlags ) +{ + static FN_GetProcessShutdownParameters *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessShutdownParameters", &g_Kernel32); + return pfn( lpdwLevel, lpdwFlags ); +} + +typedef DWORD WINAPI FN_GetProcessVersion( DWORD ProcessId ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProcessVersion( DWORD ProcessId ) +{ + static FN_GetProcessVersion *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProcessVersion", &g_Kernel32); + return pfn( ProcessId ); +} + +typedef VOID WINAPI FN_FatalAppExitA( UINT uAction, LPCSTR lpMessageText ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_FatalAppExitA( UINT uAction, LPCSTR lpMessageText ) +{ + static FN_FatalAppExitA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FatalAppExitA", &g_Kernel32); + pfn( uAction, lpMessageText ); +} + +typedef VOID WINAPI FN_FatalAppExitW( UINT uAction, LPCWSTR lpMessageText ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_FatalAppExitW( UINT uAction, LPCWSTR lpMessageText ) +{ + static FN_FatalAppExitW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FatalAppExitW", &g_Kernel32); + pfn( uAction, lpMessageText ); +} + +typedef VOID WINAPI FN_GetStartupInfoA( LPSTARTUPINFOA lpStartupInfo ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_GetStartupInfoA( LPSTARTUPINFOA lpStartupInfo ) +{ + static FN_GetStartupInfoA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetStartupInfoA", &g_Kernel32); + pfn( lpStartupInfo ); +} + +typedef VOID WINAPI FN_GetStartupInfoW( LPSTARTUPINFOW lpStartupInfo ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_GetStartupInfoW( LPSTARTUPINFOW lpStartupInfo ) +{ + static FN_GetStartupInfoW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetStartupInfoW", &g_Kernel32); + pfn( lpStartupInfo ); +} + +typedef LPSTR WINAPI FN_GetCommandLineA( VOID ); +__declspec(dllexport) LPSTR WINAPI kPrf2Wrap_GetCommandLineA( VOID ) +{ + static FN_GetCommandLineA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCommandLineA", &g_Kernel32); + return pfn (); +} + +typedef LPWSTR WINAPI FN_GetCommandLineW( VOID ); +__declspec(dllexport) LPWSTR WINAPI kPrf2Wrap_GetCommandLineW( VOID ) +{ + static FN_GetCommandLineW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCommandLineW", &g_Kernel32); + return pfn (); +} + +typedef DWORD WINAPI FN_GetEnvironmentVariableA( LPCSTR lpName, LPSTR lpBuffer, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetEnvironmentVariableA( LPCSTR lpName, LPSTR lpBuffer, DWORD nSize ) +{ + static FN_GetEnvironmentVariableA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetEnvironmentVariableA", &g_Kernel32); + return pfn( lpName, lpBuffer, nSize ); +} + +typedef DWORD WINAPI FN_GetEnvironmentVariableW( LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetEnvironmentVariableW( LPCWSTR lpName, LPWSTR lpBuffer, DWORD nSize ) +{ + static FN_GetEnvironmentVariableW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetEnvironmentVariableW", &g_Kernel32); + return pfn( lpName, lpBuffer, nSize ); +} + +typedef BOOL WINAPI FN_SetEnvironmentVariableA( LPCSTR lpName, LPCSTR lpValue ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEnvironmentVariableA( LPCSTR lpName, LPCSTR lpValue ) +{ + static FN_SetEnvironmentVariableA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetEnvironmentVariableA", &g_Kernel32); + return pfn( lpName, lpValue ); +} + +typedef BOOL WINAPI FN_SetEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpValue ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpValue ) +{ + static FN_SetEnvironmentVariableW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetEnvironmentVariableW", &g_Kernel32); + return pfn( lpName, lpValue ); +} + +typedef DWORD WINAPI FN_ExpandEnvironmentStringsA( LPCSTR lpSrc, LPSTR lpDst, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_ExpandEnvironmentStringsA( LPCSTR lpSrc, LPSTR lpDst, DWORD nSize ) +{ + static FN_ExpandEnvironmentStringsA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ExpandEnvironmentStringsA", &g_Kernel32); + return pfn( lpSrc, lpDst, nSize ); +} + +typedef DWORD WINAPI FN_ExpandEnvironmentStringsW( LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_ExpandEnvironmentStringsW( LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSize ) +{ + static FN_ExpandEnvironmentStringsW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ExpandEnvironmentStringsW", &g_Kernel32); + return pfn( lpSrc, lpDst, nSize ); +} + +typedef DWORD WINAPI FN_GetFirmwareEnvironmentVariableA( LPCSTR lpName, LPCSTR lpGuid, PVOID pBuffer, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFirmwareEnvironmentVariableA( LPCSTR lpName, LPCSTR lpGuid, PVOID pBuffer, DWORD nSize ) +{ + static FN_GetFirmwareEnvironmentVariableA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFirmwareEnvironmentVariableA", &g_Kernel32); + return pfn( lpName, lpGuid, pBuffer, nSize ); +} + +typedef DWORD WINAPI FN_GetFirmwareEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pBuffer, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFirmwareEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pBuffer, DWORD nSize ) +{ + static FN_GetFirmwareEnvironmentVariableW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFirmwareEnvironmentVariableW", &g_Kernel32); + return pfn( lpName, lpGuid, pBuffer, nSize ); +} + +typedef BOOL WINAPI FN_SetFirmwareEnvironmentVariableA( LPCSTR lpName, LPCSTR lpGuid, PVOID pValue, DWORD nSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFirmwareEnvironmentVariableA( LPCSTR lpName, LPCSTR lpGuid, PVOID pValue, DWORD nSize ) +{ + static FN_SetFirmwareEnvironmentVariableA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFirmwareEnvironmentVariableA", &g_Kernel32); + return pfn( lpName, lpGuid, pValue, nSize ); +} + +typedef BOOL WINAPI FN_SetFirmwareEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pValue, DWORD nSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFirmwareEnvironmentVariableW( LPCWSTR lpName, LPCWSTR lpGuid, PVOID pValue, DWORD nSize ) +{ + static FN_SetFirmwareEnvironmentVariableW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFirmwareEnvironmentVariableW", &g_Kernel32); + return pfn( lpName, lpGuid, pValue, nSize ); +} + +typedef VOID WINAPI FN_OutputDebugStringA( LPCSTR lpOutputString ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_OutputDebugStringA( LPCSTR lpOutputString ) +{ + static FN_OutputDebugStringA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OutputDebugStringA", &g_Kernel32); + pfn( lpOutputString ); +} + +typedef VOID WINAPI FN_OutputDebugStringW( LPCWSTR lpOutputString ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_OutputDebugStringW( LPCWSTR lpOutputString ) +{ + static FN_OutputDebugStringW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OutputDebugStringW", &g_Kernel32); + pfn( lpOutputString ); +} + +typedef HRSRC WINAPI FN_FindResourceA( HMODULE hModule, LPCSTR lpName, LPCSTR lpType ); +__declspec(dllexport) HRSRC WINAPI kPrf2Wrap_FindResourceA( HMODULE hModule, LPCSTR lpName, LPCSTR lpType ) +{ + static FN_FindResourceA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindResourceA", &g_Kernel32); + return pfn( hModule, lpName, lpType ); +} + +typedef HRSRC WINAPI FN_FindResourceW( HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType ); +__declspec(dllexport) HRSRC WINAPI kPrf2Wrap_FindResourceW( HMODULE hModule, LPCWSTR lpName, LPCWSTR lpType ) +{ + static FN_FindResourceW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindResourceW", &g_Kernel32); + return pfn( hModule, lpName, lpType ); +} + +typedef HRSRC WINAPI FN_FindResourceExA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLanguage ); +__declspec(dllexport) HRSRC WINAPI kPrf2Wrap_FindResourceExA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, WORD wLanguage ) +{ + static FN_FindResourceExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindResourceExA", &g_Kernel32); + return pfn( hModule, lpType, lpName, wLanguage ); +} + +typedef HRSRC WINAPI FN_FindResourceExW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage ); +__declspec(dllexport) HRSRC WINAPI kPrf2Wrap_FindResourceExW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage ) +{ + static FN_FindResourceExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindResourceExW", &g_Kernel32); + return pfn( hModule, lpType, lpName, wLanguage ); +} + +typedef BOOL WINAPI FN_EnumResourceTypesA( HMODULE hModule, ENUMRESTYPEPROCA lpEnumFunc, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceTypesA( HMODULE hModule, ENUMRESTYPEPROCA lpEnumFunc, LONG_PTR lParam ) +{ + static FN_EnumResourceTypesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumResourceTypesA", &g_Kernel32); + return pfn( hModule, lpEnumFunc, lParam ); +} + +typedef BOOL WINAPI FN_EnumResourceTypesW( HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceTypesW( HMODULE hModule, ENUMRESTYPEPROCW lpEnumFunc, LONG_PTR lParam ) +{ + static FN_EnumResourceTypesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumResourceTypesW", &g_Kernel32); + return pfn( hModule, lpEnumFunc, lParam ); +} + +typedef BOOL WINAPI FN_EnumResourceNamesA( HMODULE hModule, LPCSTR lpType, ENUMRESNAMEPROCA lpEnumFunc, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceNamesA( HMODULE hModule, LPCSTR lpType, ENUMRESNAMEPROCA lpEnumFunc, LONG_PTR lParam ) +{ + static FN_EnumResourceNamesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumResourceNamesA", &g_Kernel32); + return pfn( hModule, lpType, lpEnumFunc, lParam ); +} + +typedef BOOL WINAPI FN_EnumResourceNamesW( HMODULE hModule, LPCWSTR lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceNamesW( HMODULE hModule, LPCWSTR lpType, ENUMRESNAMEPROCW lpEnumFunc, LONG_PTR lParam ) +{ + static FN_EnumResourceNamesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumResourceNamesW", &g_Kernel32); + return pfn( hModule, lpType, lpEnumFunc, lParam ); +} + +typedef BOOL WINAPI FN_EnumResourceLanguagesA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, ENUMRESLANGPROCA lpEnumFunc, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceLanguagesA( HMODULE hModule, LPCSTR lpType, LPCSTR lpName, ENUMRESLANGPROCA lpEnumFunc, LONG_PTR lParam ) +{ + static FN_EnumResourceLanguagesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumResourceLanguagesA", &g_Kernel32); + return pfn( hModule, lpType, lpName, lpEnumFunc, lParam ); +} + +typedef BOOL WINAPI FN_EnumResourceLanguagesW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, ENUMRESLANGPROCW lpEnumFunc, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumResourceLanguagesW( HMODULE hModule, LPCWSTR lpType, LPCWSTR lpName, ENUMRESLANGPROCW lpEnumFunc, LONG_PTR lParam ) +{ + static FN_EnumResourceLanguagesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumResourceLanguagesW", &g_Kernel32); + return pfn( hModule, lpType, lpName, lpEnumFunc, lParam ); +} + +typedef HANDLE WINAPI FN_BeginUpdateResourceA( LPCSTR pFileName, BOOL bDeleteExistingResources ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_BeginUpdateResourceA( LPCSTR pFileName, BOOL bDeleteExistingResources ) +{ + static FN_BeginUpdateResourceA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BeginUpdateResourceA", &g_Kernel32); + return pfn( pFileName, bDeleteExistingResources ); +} + +typedef HANDLE WINAPI FN_BeginUpdateResourceW( LPCWSTR pFileName, BOOL bDeleteExistingResources ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_BeginUpdateResourceW( LPCWSTR pFileName, BOOL bDeleteExistingResources ) +{ + static FN_BeginUpdateResourceW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BeginUpdateResourceW", &g_Kernel32); + return pfn( pFileName, bDeleteExistingResources ); +} + +typedef BOOL WINAPI FN_UpdateResourceA( HANDLE hUpdate, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_UpdateResourceA( HANDLE hUpdate, LPCSTR lpType, LPCSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb ) +{ + static FN_UpdateResourceA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "UpdateResourceA", &g_Kernel32); + return pfn( hUpdate, lpType, lpName, wLanguage, lpData, cb ); +} + +typedef BOOL WINAPI FN_UpdateResourceW( HANDLE hUpdate, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_UpdateResourceW( HANDLE hUpdate, LPCWSTR lpType, LPCWSTR lpName, WORD wLanguage, LPVOID lpData, DWORD cb ) +{ + static FN_UpdateResourceW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "UpdateResourceW", &g_Kernel32); + return pfn( hUpdate, lpType, lpName, wLanguage, lpData, cb ); +} + +typedef BOOL WINAPI FN_EndUpdateResourceA( HANDLE hUpdate, BOOL fDiscard ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EndUpdateResourceA( HANDLE hUpdate, BOOL fDiscard ) +{ + static FN_EndUpdateResourceA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EndUpdateResourceA", &g_Kernel32); + return pfn( hUpdate, fDiscard ); +} + +typedef BOOL WINAPI FN_EndUpdateResourceW( HANDLE hUpdate, BOOL fDiscard ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EndUpdateResourceW( HANDLE hUpdate, BOOL fDiscard ) +{ + static FN_EndUpdateResourceW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EndUpdateResourceW", &g_Kernel32); + return pfn( hUpdate, fDiscard ); +} + +typedef ATOM WINAPI FN_GlobalAddAtomA( LPCSTR lpString ); +__declspec(dllexport) ATOM WINAPI kPrf2Wrap_GlobalAddAtomA( LPCSTR lpString ) +{ + static FN_GlobalAddAtomA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalAddAtomA", &g_Kernel32); + return pfn( lpString ); +} + +typedef ATOM WINAPI FN_GlobalAddAtomW( LPCWSTR lpString ); +__declspec(dllexport) ATOM WINAPI kPrf2Wrap_GlobalAddAtomW( LPCWSTR lpString ) +{ + static FN_GlobalAddAtomW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalAddAtomW", &g_Kernel32); + return pfn( lpString ); +} + +typedef ATOM WINAPI FN_GlobalFindAtomA( LPCSTR lpString ); +__declspec(dllexport) ATOM WINAPI kPrf2Wrap_GlobalFindAtomA( LPCSTR lpString ) +{ + static FN_GlobalFindAtomA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalFindAtomA", &g_Kernel32); + return pfn( lpString ); +} + +typedef ATOM WINAPI FN_GlobalFindAtomW( LPCWSTR lpString ); +__declspec(dllexport) ATOM WINAPI kPrf2Wrap_GlobalFindAtomW( LPCWSTR lpString ) +{ + static FN_GlobalFindAtomW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalFindAtomW", &g_Kernel32); + return pfn( lpString ); +} + +typedef UINT WINAPI FN_GlobalGetAtomNameA( ATOM nAtom, LPSTR lpBuffer, int nSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GlobalGetAtomNameA( ATOM nAtom, LPSTR lpBuffer, int nSize ) +{ + static FN_GlobalGetAtomNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalGetAtomNameA", &g_Kernel32); + return pfn( nAtom, lpBuffer, nSize ); +} + +typedef UINT WINAPI FN_GlobalGetAtomNameW( ATOM nAtom, LPWSTR lpBuffer, int nSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GlobalGetAtomNameW( ATOM nAtom, LPWSTR lpBuffer, int nSize ) +{ + static FN_GlobalGetAtomNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GlobalGetAtomNameW", &g_Kernel32); + return pfn( nAtom, lpBuffer, nSize ); +} + +typedef ATOM WINAPI FN_AddAtomA( LPCSTR lpString ); +__declspec(dllexport) ATOM WINAPI kPrf2Wrap_AddAtomA( LPCSTR lpString ) +{ + static FN_AddAtomA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAtomA", &g_Kernel32); + return pfn( lpString ); +} + +typedef ATOM WINAPI FN_AddAtomW( LPCWSTR lpString ); +__declspec(dllexport) ATOM WINAPI kPrf2Wrap_AddAtomW( LPCWSTR lpString ) +{ + static FN_AddAtomW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAtomW", &g_Kernel32); + return pfn( lpString ); +} + +typedef ATOM WINAPI FN_FindAtomA( LPCSTR lpString ); +__declspec(dllexport) ATOM WINAPI kPrf2Wrap_FindAtomA( LPCSTR lpString ) +{ + static FN_FindAtomA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindAtomA", &g_Kernel32); + return pfn( lpString ); +} + +typedef ATOM WINAPI FN_FindAtomW( LPCWSTR lpString ); +__declspec(dllexport) ATOM WINAPI kPrf2Wrap_FindAtomW( LPCWSTR lpString ) +{ + static FN_FindAtomW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindAtomW", &g_Kernel32); + return pfn( lpString ); +} + +typedef UINT WINAPI FN_GetAtomNameA( ATOM nAtom, LPSTR lpBuffer, int nSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetAtomNameA( ATOM nAtom, LPSTR lpBuffer, int nSize ) +{ + static FN_GetAtomNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetAtomNameA", &g_Kernel32); + return pfn( nAtom, lpBuffer, nSize ); +} + +typedef UINT WINAPI FN_GetAtomNameW( ATOM nAtom, LPWSTR lpBuffer, int nSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetAtomNameW( ATOM nAtom, LPWSTR lpBuffer, int nSize ) +{ + static FN_GetAtomNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetAtomNameW", &g_Kernel32); + return pfn( nAtom, lpBuffer, nSize ); +} + +typedef UINT WINAPI FN_GetProfileIntA( LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetProfileIntA( LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault ) +{ + static FN_GetProfileIntA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProfileIntA", &g_Kernel32); + return pfn( lpAppName, lpKeyName, nDefault ); +} + +typedef UINT WINAPI FN_GetProfileIntW( LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetProfileIntW( LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault ) +{ + static FN_GetProfileIntW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProfileIntW", &g_Kernel32); + return pfn( lpAppName, lpKeyName, nDefault ); +} + +typedef DWORD WINAPI FN_GetProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize ) +{ + static FN_GetProfileStringA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProfileStringA", &g_Kernel32); + return pfn( lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize ); +} + +typedef DWORD WINAPI FN_GetProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize ) +{ + static FN_GetProfileStringW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProfileStringW", &g_Kernel32); + return pfn( lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize ); +} + +typedef BOOL WINAPI FN_WriteProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString ) +{ + static FN_WriteProfileStringA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteProfileStringA", &g_Kernel32); + return pfn( lpAppName, lpKeyName, lpString ); +} + +typedef BOOL WINAPI FN_WriteProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString ) +{ + static FN_WriteProfileStringW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteProfileStringW", &g_Kernel32); + return pfn( lpAppName, lpKeyName, lpString ); +} + +typedef DWORD WINAPI FN_GetProfileSectionA( LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProfileSectionA( LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize ) +{ + static FN_GetProfileSectionA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProfileSectionA", &g_Kernel32); + return pfn( lpAppName, lpReturnedString, nSize ); +} + +typedef DWORD WINAPI FN_GetProfileSectionW( LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetProfileSectionW( LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize ) +{ + static FN_GetProfileSectionW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetProfileSectionW", &g_Kernel32); + return pfn( lpAppName, lpReturnedString, nSize ); +} + +typedef BOOL WINAPI FN_WriteProfileSectionA( LPCSTR lpAppName, LPCSTR lpString ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteProfileSectionA( LPCSTR lpAppName, LPCSTR lpString ) +{ + static FN_WriteProfileSectionA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteProfileSectionA", &g_Kernel32); + return pfn( lpAppName, lpString ); +} + +typedef BOOL WINAPI FN_WriteProfileSectionW( LPCWSTR lpAppName, LPCWSTR lpString ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteProfileSectionW( LPCWSTR lpAppName, LPCWSTR lpString ) +{ + static FN_WriteProfileSectionW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteProfileSectionW", &g_Kernel32); + return pfn( lpAppName, lpString ); +} + +typedef UINT WINAPI FN_GetPrivateProfileIntA( LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetPrivateProfileIntA( LPCSTR lpAppName, LPCSTR lpKeyName, INT nDefault, LPCSTR lpFileName ) +{ + static FN_GetPrivateProfileIntA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileIntA", &g_Kernel32); + return pfn( lpAppName, lpKeyName, nDefault, lpFileName ); +} + +typedef UINT WINAPI FN_GetPrivateProfileIntW( LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault, LPCWSTR lpFileName ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetPrivateProfileIntW( LPCWSTR lpAppName, LPCWSTR lpKeyName, INT nDefault, LPCWSTR lpFileName ) +{ + static FN_GetPrivateProfileIntW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileIntW", &g_Kernel32); + return pfn( lpAppName, lpKeyName, nDefault, lpFileName ); +} + +typedef DWORD WINAPI FN_GetPrivateProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpDefault, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName ) +{ + static FN_GetPrivateProfileStringA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileStringA", &g_Kernel32); + return pfn( lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize, lpFileName ); +} + +typedef DWORD WINAPI FN_GetPrivateProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpDefault, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName ) +{ + static FN_GetPrivateProfileStringW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileStringW", &g_Kernel32); + return pfn( lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize, lpFileName ); +} + +typedef BOOL WINAPI FN_WritePrivateProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString, LPCSTR lpFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileStringA( LPCSTR lpAppName, LPCSTR lpKeyName, LPCSTR lpString, LPCSTR lpFileName ) +{ + static FN_WritePrivateProfileStringA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileStringA", &g_Kernel32); + return pfn( lpAppName, lpKeyName, lpString, lpFileName ); +} + +typedef BOOL WINAPI FN_WritePrivateProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileStringW( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName ) +{ + static FN_WritePrivateProfileStringW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileStringW", &g_Kernel32); + return pfn( lpAppName, lpKeyName, lpString, lpFileName ); +} + +typedef DWORD WINAPI FN_GetPrivateProfileSectionA( LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileSectionA( LPCSTR lpAppName, LPSTR lpReturnedString, DWORD nSize, LPCSTR lpFileName ) +{ + static FN_GetPrivateProfileSectionA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileSectionA", &g_Kernel32); + return pfn( lpAppName, lpReturnedString, nSize, lpFileName ); +} + +typedef DWORD WINAPI FN_GetPrivateProfileSectionW( LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileSectionW( LPCWSTR lpAppName, LPWSTR lpReturnedString, DWORD nSize, LPCWSTR lpFileName ) +{ + static FN_GetPrivateProfileSectionW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileSectionW", &g_Kernel32); + return pfn( lpAppName, lpReturnedString, nSize, lpFileName ); +} + +typedef BOOL WINAPI FN_WritePrivateProfileSectionA( LPCSTR lpAppName, LPCSTR lpString, LPCSTR lpFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileSectionA( LPCSTR lpAppName, LPCSTR lpString, LPCSTR lpFileName ) +{ + static FN_WritePrivateProfileSectionA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileSectionA", &g_Kernel32); + return pfn( lpAppName, lpString, lpFileName ); +} + +typedef BOOL WINAPI FN_WritePrivateProfileSectionW( LPCWSTR lpAppName, LPCWSTR lpString, LPCWSTR lpFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileSectionW( LPCWSTR lpAppName, LPCWSTR lpString, LPCWSTR lpFileName ) +{ + static FN_WritePrivateProfileSectionW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileSectionW", &g_Kernel32); + return pfn( lpAppName, lpString, lpFileName ); +} + +typedef DWORD WINAPI FN_GetPrivateProfileSectionNamesA( LPSTR lpszReturnBuffer, DWORD nSize, LPCSTR lpFileName ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileSectionNamesA( LPSTR lpszReturnBuffer, DWORD nSize, LPCSTR lpFileName ) +{ + static FN_GetPrivateProfileSectionNamesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileSectionNamesA", &g_Kernel32); + return pfn( lpszReturnBuffer, nSize, lpFileName ); +} + +typedef DWORD WINAPI FN_GetPrivateProfileSectionNamesW( LPWSTR lpszReturnBuffer, DWORD nSize, LPCWSTR lpFileName ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPrivateProfileSectionNamesW( LPWSTR lpszReturnBuffer, DWORD nSize, LPCWSTR lpFileName ) +{ + static FN_GetPrivateProfileSectionNamesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileSectionNamesW", &g_Kernel32); + return pfn( lpszReturnBuffer, nSize, lpFileName ); +} + +typedef BOOL WINAPI FN_GetPrivateProfileStructA( LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetPrivateProfileStructA( LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile ) +{ + static FN_GetPrivateProfileStructA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileStructA", &g_Kernel32); + return pfn( lpszSection, lpszKey, lpStruct, uSizeStruct, szFile ); +} + +typedef BOOL WINAPI FN_GetPrivateProfileStructW( LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetPrivateProfileStructW( LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile ) +{ + static FN_GetPrivateProfileStructW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateProfileStructW", &g_Kernel32); + return pfn( lpszSection, lpszKey, lpStruct, uSizeStruct, szFile ); +} + +typedef BOOL WINAPI FN_WritePrivateProfileStructA( LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileStructA( LPCSTR lpszSection, LPCSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCSTR szFile ) +{ + static FN_WritePrivateProfileStructA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileStructA", &g_Kernel32); + return pfn( lpszSection, lpszKey, lpStruct, uSizeStruct, szFile ); +} + +typedef BOOL WINAPI FN_WritePrivateProfileStructW( LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WritePrivateProfileStructW( LPCWSTR lpszSection, LPCWSTR lpszKey, LPVOID lpStruct, UINT uSizeStruct, LPCWSTR szFile ) +{ + static FN_WritePrivateProfileStructW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WritePrivateProfileStructW", &g_Kernel32); + return pfn( lpszSection, lpszKey, lpStruct, uSizeStruct, szFile ); +} + +typedef UINT WINAPI FN_GetDriveTypeA( LPCSTR lpRootPathName ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetDriveTypeA( LPCSTR lpRootPathName ) +{ + static FN_GetDriveTypeA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDriveTypeA", &g_Kernel32); + return pfn( lpRootPathName ); +} + +typedef UINT WINAPI FN_GetDriveTypeW( LPCWSTR lpRootPathName ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetDriveTypeW( LPCWSTR lpRootPathName ) +{ + static FN_GetDriveTypeW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDriveTypeW", &g_Kernel32); + return pfn( lpRootPathName ); +} + +typedef UINT WINAPI FN_GetSystemDirectoryA( LPSTR lpBuffer, UINT uSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemDirectoryA( LPSTR lpBuffer, UINT uSize ) +{ + static FN_GetSystemDirectoryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemDirectoryA", &g_Kernel32); + return pfn( lpBuffer, uSize ); +} + +typedef UINT WINAPI FN_GetSystemDirectoryW( LPWSTR lpBuffer, UINT uSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemDirectoryW( LPWSTR lpBuffer, UINT uSize ) +{ + static FN_GetSystemDirectoryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemDirectoryW", &g_Kernel32); + return pfn( lpBuffer, uSize ); +} + +typedef DWORD WINAPI FN_GetTempPathA( DWORD nBufferLength, LPSTR lpBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTempPathA( DWORD nBufferLength, LPSTR lpBuffer ) +{ + static FN_GetTempPathA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTempPathA", &g_Kernel32); + return pfn( nBufferLength, lpBuffer ); +} + +typedef DWORD WINAPI FN_GetTempPathW( DWORD nBufferLength, LPWSTR lpBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetTempPathW( DWORD nBufferLength, LPWSTR lpBuffer ) +{ + static FN_GetTempPathW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTempPathW", &g_Kernel32); + return pfn( nBufferLength, lpBuffer ); +} + +typedef UINT WINAPI FN_GetTempFileNameA( LPCSTR lpPathName, LPCSTR lpPrefixString, UINT uUnique, LPSTR lpTempFileName ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetTempFileNameA( LPCSTR lpPathName, LPCSTR lpPrefixString, UINT uUnique, LPSTR lpTempFileName ) +{ + static FN_GetTempFileNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTempFileNameA", &g_Kernel32); + return pfn( lpPathName, lpPrefixString, uUnique, lpTempFileName ); +} + +typedef UINT WINAPI FN_GetTempFileNameW( LPCWSTR lpPathName, LPCWSTR lpPrefixString, UINT uUnique, LPWSTR lpTempFileName ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetTempFileNameW( LPCWSTR lpPathName, LPCWSTR lpPrefixString, UINT uUnique, LPWSTR lpTempFileName ) +{ + static FN_GetTempFileNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTempFileNameW", &g_Kernel32); + return pfn( lpPathName, lpPrefixString, uUnique, lpTempFileName ); +} + +typedef UINT WINAPI FN_GetWindowsDirectoryA( LPSTR lpBuffer, UINT uSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetWindowsDirectoryA( LPSTR lpBuffer, UINT uSize ) +{ + static FN_GetWindowsDirectoryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetWindowsDirectoryA", &g_Kernel32); + return pfn( lpBuffer, uSize ); +} + +typedef UINT WINAPI FN_GetWindowsDirectoryW( LPWSTR lpBuffer, UINT uSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetWindowsDirectoryW( LPWSTR lpBuffer, UINT uSize ) +{ + static FN_GetWindowsDirectoryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetWindowsDirectoryW", &g_Kernel32); + return pfn( lpBuffer, uSize ); +} + +typedef UINT WINAPI FN_GetSystemWindowsDirectoryA( LPSTR lpBuffer, UINT uSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemWindowsDirectoryA( LPSTR lpBuffer, UINT uSize ) +{ + static FN_GetSystemWindowsDirectoryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemWindowsDirectoryA", &g_Kernel32); + return pfn( lpBuffer, uSize ); +} + +typedef UINT WINAPI FN_GetSystemWindowsDirectoryW( LPWSTR lpBuffer, UINT uSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemWindowsDirectoryW( LPWSTR lpBuffer, UINT uSize ) +{ + static FN_GetSystemWindowsDirectoryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemWindowsDirectoryW", &g_Kernel32); + return pfn( lpBuffer, uSize ); +} + +typedef UINT WINAPI FN_GetSystemWow64DirectoryA( LPSTR lpBuffer, UINT uSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemWow64DirectoryA( LPSTR lpBuffer, UINT uSize ) +{ + static FN_GetSystemWow64DirectoryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemWow64DirectoryA", &g_Kernel32); + return pfn( lpBuffer, uSize ); +} + +typedef UINT WINAPI FN_GetSystemWow64DirectoryW( LPWSTR lpBuffer, UINT uSize ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetSystemWow64DirectoryW( LPWSTR lpBuffer, UINT uSize ) +{ + static FN_GetSystemWow64DirectoryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemWow64DirectoryW", &g_Kernel32); + return pfn( lpBuffer, uSize ); +} + +typedef BOOLEAN WINAPI FN_Wow64EnableWow64FsRedirection( BOOLEAN Wow64FsEnableRedirection ); +__declspec(dllexport) BOOLEAN WINAPI kPrf2Wrap_Wow64EnableWow64FsRedirection( BOOLEAN Wow64FsEnableRedirection ) +{ + static FN_Wow64EnableWow64FsRedirection *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Wow64EnableWow64FsRedirection", &g_Kernel32); + return pfn( Wow64FsEnableRedirection ); +} + +typedef BOOL WINAPI FN_Wow64DisableWow64FsRedirection( PVOID * OldValue ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Wow64DisableWow64FsRedirection( PVOID * OldValue ) +{ + static FN_Wow64DisableWow64FsRedirection *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Wow64DisableWow64FsRedirection", &g_Kernel32); + return pfn( OldValue ); +} + +typedef BOOL WINAPI FN_Wow64RevertWow64FsRedirection( PVOID OlValue ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Wow64RevertWow64FsRedirection( PVOID OlValue ) +{ + static FN_Wow64RevertWow64FsRedirection *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Wow64RevertWow64FsRedirection", &g_Kernel32); + return pfn( OlValue ); +} + +typedef BOOL WINAPI FN_SetCurrentDirectoryA( LPCSTR lpPathName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCurrentDirectoryA( LPCSTR lpPathName ) +{ + static FN_SetCurrentDirectoryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetCurrentDirectoryA", &g_Kernel32); + return pfn( lpPathName ); +} + +typedef BOOL WINAPI FN_SetCurrentDirectoryW( LPCWSTR lpPathName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCurrentDirectoryW( LPCWSTR lpPathName ) +{ + static FN_SetCurrentDirectoryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetCurrentDirectoryW", &g_Kernel32); + return pfn( lpPathName ); +} + +typedef DWORD WINAPI FN_GetCurrentDirectoryA( DWORD nBufferLength, LPSTR lpBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCurrentDirectoryA( DWORD nBufferLength, LPSTR lpBuffer ) +{ + static FN_GetCurrentDirectoryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentDirectoryA", &g_Kernel32); + return pfn( nBufferLength, lpBuffer ); +} + +typedef DWORD WINAPI FN_GetCurrentDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCurrentDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer ) +{ + static FN_GetCurrentDirectoryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentDirectoryW", &g_Kernel32); + return pfn( nBufferLength, lpBuffer ); +} + +typedef BOOL WINAPI FN_SetDllDirectoryA( LPCSTR lpPathName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetDllDirectoryA( LPCSTR lpPathName ) +{ + static FN_SetDllDirectoryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetDllDirectoryA", &g_Kernel32); + return pfn( lpPathName ); +} + +typedef BOOL WINAPI FN_SetDllDirectoryW( LPCWSTR lpPathName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetDllDirectoryW( LPCWSTR lpPathName ) +{ + static FN_SetDllDirectoryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetDllDirectoryW", &g_Kernel32); + return pfn( lpPathName ); +} + +typedef DWORD WINAPI FN_GetDllDirectoryA( DWORD nBufferLength, LPSTR lpBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetDllDirectoryA( DWORD nBufferLength, LPSTR lpBuffer ) +{ + static FN_GetDllDirectoryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDllDirectoryA", &g_Kernel32); + return pfn( nBufferLength, lpBuffer ); +} + +typedef DWORD WINAPI FN_GetDllDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetDllDirectoryW( DWORD nBufferLength, LPWSTR lpBuffer ) +{ + static FN_GetDllDirectoryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDllDirectoryW", &g_Kernel32); + return pfn( nBufferLength, lpBuffer ); +} + +typedef BOOL WINAPI FN_GetDiskFreeSpaceA( LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDiskFreeSpaceA( LPCSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters ) +{ + static FN_GetDiskFreeSpaceA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDiskFreeSpaceA", &g_Kernel32); + return pfn( lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters ); +} + +typedef BOOL WINAPI FN_GetDiskFreeSpaceW( LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDiskFreeSpaceW( LPCWSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters ) +{ + static FN_GetDiskFreeSpaceW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDiskFreeSpaceW", &g_Kernel32); + return pfn( lpRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters ); +} + +typedef BOOL WINAPI FN_GetDiskFreeSpaceExA( LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDiskFreeSpaceExA( LPCSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ) +{ + static FN_GetDiskFreeSpaceExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDiskFreeSpaceExA", &g_Kernel32); + return pfn( lpDirectoryName, lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes ); +} + +typedef BOOL WINAPI FN_GetDiskFreeSpaceExW( LPCWSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDiskFreeSpaceExW( LPCWSTR lpDirectoryName, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes ) +{ + static FN_GetDiskFreeSpaceExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDiskFreeSpaceExW", &g_Kernel32); + return pfn( lpDirectoryName, lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes ); +} + +typedef BOOL WINAPI FN_CreateDirectoryA( LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateDirectoryA( LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) +{ + static FN_CreateDirectoryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateDirectoryA", &g_Kernel32); + return pfn( lpPathName, lpSecurityAttributes ); +} + +typedef BOOL WINAPI FN_CreateDirectoryW( LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateDirectoryW( LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) +{ + static FN_CreateDirectoryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateDirectoryW", &g_Kernel32); + return pfn( lpPathName, lpSecurityAttributes ); +} + +typedef BOOL WINAPI FN_CreateDirectoryExA( LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateDirectoryExA( LPCSTR lpTemplateDirectory, LPCSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) +{ + static FN_CreateDirectoryExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateDirectoryExA", &g_Kernel32); + return pfn( lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes ); +} + +typedef BOOL WINAPI FN_CreateDirectoryExW( LPCWSTR lpTemplateDirectory, LPCWSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateDirectoryExW( LPCWSTR lpTemplateDirectory, LPCWSTR lpNewDirectory, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) +{ + static FN_CreateDirectoryExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateDirectoryExW", &g_Kernel32); + return pfn( lpTemplateDirectory, lpNewDirectory, lpSecurityAttributes ); +} + +typedef BOOL WINAPI FN_RemoveDirectoryA( LPCSTR lpPathName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_RemoveDirectoryA( LPCSTR lpPathName ) +{ + static FN_RemoveDirectoryA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RemoveDirectoryA", &g_Kernel32); + return pfn( lpPathName ); +} + +typedef BOOL WINAPI FN_RemoveDirectoryW( LPCWSTR lpPathName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_RemoveDirectoryW( LPCWSTR lpPathName ) +{ + static FN_RemoveDirectoryW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RemoveDirectoryW", &g_Kernel32); + return pfn( lpPathName ); +} + +typedef DWORD WINAPI FN_GetFullPathNameA( LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR * lpFilePart ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFullPathNameA( LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR * lpFilePart ) +{ + static FN_GetFullPathNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFullPathNameA", &g_Kernel32); + return pfn( lpFileName, nBufferLength, lpBuffer, lpFilePart ); +} + +typedef DWORD WINAPI FN_GetFullPathNameW( LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR * lpFilePart ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFullPathNameW( LPCWSTR lpFileName, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR * lpFilePart ) +{ + static FN_GetFullPathNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFullPathNameW", &g_Kernel32); + return pfn( lpFileName, nBufferLength, lpBuffer, lpFilePart ); +} + +typedef BOOL WINAPI FN_DefineDosDeviceA( DWORD dwFlags, LPCSTR lpDeviceName, LPCSTR lpTargetPath ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DefineDosDeviceA( DWORD dwFlags, LPCSTR lpDeviceName, LPCSTR lpTargetPath ) +{ + static FN_DefineDosDeviceA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DefineDosDeviceA", &g_Kernel32); + return pfn( dwFlags, lpDeviceName, lpTargetPath ); +} + +typedef BOOL WINAPI FN_DefineDosDeviceW( DWORD dwFlags, LPCWSTR lpDeviceName, LPCWSTR lpTargetPath ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DefineDosDeviceW( DWORD dwFlags, LPCWSTR lpDeviceName, LPCWSTR lpTargetPath ) +{ + static FN_DefineDosDeviceW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DefineDosDeviceW", &g_Kernel32); + return pfn( dwFlags, lpDeviceName, lpTargetPath ); +} + +typedef DWORD WINAPI FN_QueryDosDeviceA( LPCSTR lpDeviceName, LPSTR lpTargetPath, DWORD ucchMax ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_QueryDosDeviceA( LPCSTR lpDeviceName, LPSTR lpTargetPath, DWORD ucchMax ) +{ + static FN_QueryDosDeviceA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "QueryDosDeviceA", &g_Kernel32); + return pfn( lpDeviceName, lpTargetPath, ucchMax ); +} + +typedef DWORD WINAPI FN_QueryDosDeviceW( LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_QueryDosDeviceW( LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax ) +{ + static FN_QueryDosDeviceW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "QueryDosDeviceW", &g_Kernel32); + return pfn( lpDeviceName, lpTargetPath, ucchMax ); +} + +typedef HANDLE WINAPI FN_CreateFileA( LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateFileA( LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ) +{ + static FN_CreateFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateFileA", &g_Kernel32); + return pfn( lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile ); +} + +typedef HANDLE WINAPI FN_CreateFileW( LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateFileW( LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile ) +{ + static FN_CreateFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateFileW", &g_Kernel32); + return pfn( lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile ); +} + +typedef HANDLE WINAPI FN_ReOpenFile( HANDLE hOriginalFile, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwFlagsAndAttributes ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_ReOpenFile( HANDLE hOriginalFile, DWORD dwDesiredAccess, DWORD dwShareMode, DWORD dwFlagsAndAttributes ) +{ + static FN_ReOpenFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReOpenFile", &g_Kernel32); + return pfn( hOriginalFile, dwDesiredAccess, dwShareMode, dwFlagsAndAttributes ); +} + +typedef BOOL WINAPI FN_SetFileAttributesA( LPCSTR lpFileName, DWORD dwFileAttributes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileAttributesA( LPCSTR lpFileName, DWORD dwFileAttributes ) +{ + static FN_SetFileAttributesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFileAttributesA", &g_Kernel32); + return pfn( lpFileName, dwFileAttributes ); +} + +typedef BOOL WINAPI FN_SetFileAttributesW( LPCWSTR lpFileName, DWORD dwFileAttributes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileAttributesW( LPCWSTR lpFileName, DWORD dwFileAttributes ) +{ + static FN_SetFileAttributesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFileAttributesW", &g_Kernel32); + return pfn( lpFileName, dwFileAttributes ); +} + +typedef DWORD WINAPI FN_GetFileAttributesA( LPCSTR lpFileName ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFileAttributesA( LPCSTR lpFileName ) +{ + static FN_GetFileAttributesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileAttributesA", &g_Kernel32); + return pfn( lpFileName ); +} + +typedef DWORD WINAPI FN_GetFileAttributesW( LPCWSTR lpFileName ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetFileAttributesW( LPCWSTR lpFileName ) +{ + static FN_GetFileAttributesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileAttributesW", &g_Kernel32); + return pfn( lpFileName ); +} + +typedef BOOL WINAPI FN_GetFileAttributesExA( LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileAttributesExA( LPCSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ) +{ + static FN_GetFileAttributesExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileAttributesExA", &g_Kernel32); + return pfn( lpFileName, fInfoLevelId, lpFileInformation ); +} + +typedef BOOL WINAPI FN_GetFileAttributesExW( LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileAttributesExW( LPCWSTR lpFileName, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation ) +{ + static FN_GetFileAttributesExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileAttributesExW", &g_Kernel32); + return pfn( lpFileName, fInfoLevelId, lpFileInformation ); +} + +typedef DWORD WINAPI FN_GetCompressedFileSizeA( LPCSTR lpFileName, LPDWORD lpFileSizeHigh ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCompressedFileSizeA( LPCSTR lpFileName, LPDWORD lpFileSizeHigh ) +{ + static FN_GetCompressedFileSizeA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCompressedFileSizeA", &g_Kernel32); + return pfn( lpFileName, lpFileSizeHigh ); +} + +typedef DWORD WINAPI FN_GetCompressedFileSizeW( LPCWSTR lpFileName, LPDWORD lpFileSizeHigh ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetCompressedFileSizeW( LPCWSTR lpFileName, LPDWORD lpFileSizeHigh ) +{ + static FN_GetCompressedFileSizeW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCompressedFileSizeW", &g_Kernel32); + return pfn( lpFileName, lpFileSizeHigh ); +} + +typedef BOOL WINAPI FN_DeleteFileA( LPCSTR lpFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteFileA( LPCSTR lpFileName ) +{ + static FN_DeleteFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteFileA", &g_Kernel32); + return pfn( lpFileName ); +} + +typedef BOOL WINAPI FN_DeleteFileW( LPCWSTR lpFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteFileW( LPCWSTR lpFileName ) +{ + static FN_DeleteFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteFileW", &g_Kernel32); + return pfn( lpFileName ); +} + +typedef BOOL WINAPI FN_CheckNameLegalDOS8Dot3A( LPCSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces , PBOOL pbNameLegal ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CheckNameLegalDOS8Dot3A( LPCSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces , PBOOL pbNameLegal ) +{ + static FN_CheckNameLegalDOS8Dot3A *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CheckNameLegalDOS8Dot3A", &g_Kernel32); + return pfn( lpName, lpOemName, OemNameSize, pbNameContainsSpaces , pbNameLegal ); +} + +typedef BOOL WINAPI FN_CheckNameLegalDOS8Dot3W( LPCWSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces , PBOOL pbNameLegal ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CheckNameLegalDOS8Dot3W( LPCWSTR lpName, LPSTR lpOemName, DWORD OemNameSize, PBOOL pbNameContainsSpaces , PBOOL pbNameLegal ) +{ + static FN_CheckNameLegalDOS8Dot3W *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CheckNameLegalDOS8Dot3W", &g_Kernel32); + return pfn( lpName, lpOemName, OemNameSize, pbNameContainsSpaces , pbNameLegal ); +} + +typedef HANDLE WINAPI FN_FindFirstFileExA( LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstFileExA( LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ) +{ + static FN_FindFirstFileExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstFileExA", &g_Kernel32); + return pfn( lpFileName, fInfoLevelId, lpFindFileData, fSearchOp, lpSearchFilter, dwAdditionalFlags ); +} + +typedef HANDLE WINAPI FN_FindFirstFileExW( LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstFileExW( LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags ) +{ + static FN_FindFirstFileExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstFileExW", &g_Kernel32); + return pfn( lpFileName, fInfoLevelId, lpFindFileData, fSearchOp, lpSearchFilter, dwAdditionalFlags ); +} + +typedef HANDLE WINAPI FN_FindFirstFileA( LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstFileA( LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData ) +{ + static FN_FindFirstFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstFileA", &g_Kernel32); + return pfn( lpFileName, lpFindFileData ); +} + +typedef HANDLE WINAPI FN_FindFirstFileW( LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstFileW( LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData ) +{ + static FN_FindFirstFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstFileW", &g_Kernel32); + return pfn( lpFileName, lpFindFileData ); +} + +typedef BOOL WINAPI FN_FindNextFileA( HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextFileA( HANDLE hFindFile, LPWIN32_FIND_DATAA lpFindFileData ) +{ + static FN_FindNextFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindNextFileA", &g_Kernel32); + return pfn( hFindFile, lpFindFileData ); +} + +typedef BOOL WINAPI FN_FindNextFileW( HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextFileW( HANDLE hFindFile, LPWIN32_FIND_DATAW lpFindFileData ) +{ + static FN_FindNextFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindNextFileW", &g_Kernel32); + return pfn( hFindFile, lpFindFileData ); +} + +typedef DWORD WINAPI FN_SearchPathA( LPCSTR lpPath, LPCSTR lpFileName, LPCSTR lpExtension, DWORD nBufferLength, LPSTR lpBuffer, LPSTR * lpFilePart ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SearchPathA( LPCSTR lpPath, LPCSTR lpFileName, LPCSTR lpExtension, DWORD nBufferLength, LPSTR lpBuffer, LPSTR * lpFilePart ) +{ + static FN_SearchPathA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SearchPathA", &g_Kernel32); + return pfn( lpPath, lpFileName, lpExtension, nBufferLength, lpBuffer, lpFilePart ); +} + +typedef DWORD WINAPI FN_SearchPathW( LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR * lpFilePart ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SearchPathW( LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension, DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR * lpFilePart ) +{ + static FN_SearchPathW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SearchPathW", &g_Kernel32); + return pfn( lpPath, lpFileName, lpExtension, nBufferLength, lpBuffer, lpFilePart ); +} + +typedef BOOL WINAPI FN_CopyFileA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CopyFileA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExists ) +{ + static FN_CopyFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CopyFileA", &g_Kernel32); + return pfn( lpExistingFileName, lpNewFileName, bFailIfExists ); +} + +typedef BOOL WINAPI FN_CopyFileW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CopyFileW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, BOOL bFailIfExists ) +{ + static FN_CopyFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CopyFileW", &g_Kernel32); + return pfn( lpExistingFileName, lpNewFileName, bFailIfExists ); +} + +typedef BOOL WINAPI FN_CopyFileExA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CopyFileExA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ) +{ + static FN_CopyFileExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CopyFileExA", &g_Kernel32); + return pfn( lpExistingFileName, lpNewFileName, lpProgressRoutine, lpData, pbCancel, dwCopyFlags ); +} + +typedef BOOL WINAPI FN_CopyFileExW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CopyFileExW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags ) +{ + static FN_CopyFileExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CopyFileExW", &g_Kernel32); + return pfn( lpExistingFileName, lpNewFileName, lpProgressRoutine, lpData, pbCancel, dwCopyFlags ); +} + +typedef BOOL WINAPI FN_MoveFileA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName ) +{ + static FN_MoveFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MoveFileA", &g_Kernel32); + return pfn( lpExistingFileName, lpNewFileName ); +} + +typedef BOOL WINAPI FN_MoveFileW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName ) +{ + static FN_MoveFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MoveFileW", &g_Kernel32); + return pfn( lpExistingFileName, lpNewFileName ); +} + +typedef BOOL WINAPI FN_MoveFileExA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileExA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags ) +{ + static FN_MoveFileExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MoveFileExA", &g_Kernel32); + return pfn( lpExistingFileName, lpNewFileName, dwFlags ); +} + +typedef BOOL WINAPI FN_MoveFileExW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileExW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, DWORD dwFlags ) +{ + static FN_MoveFileExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MoveFileExW", &g_Kernel32); + return pfn( lpExistingFileName, lpNewFileName, dwFlags ); +} + +typedef BOOL WINAPI FN_MoveFileWithProgressA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileWithProgressA( LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags ) +{ + static FN_MoveFileWithProgressA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MoveFileWithProgressA", &g_Kernel32); + return pfn( lpExistingFileName, lpNewFileName, lpProgressRoutine, lpData, dwFlags ); +} + +typedef BOOL WINAPI FN_MoveFileWithProgressW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MoveFileWithProgressW( LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags ) +{ + static FN_MoveFileWithProgressW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MoveFileWithProgressW", &g_Kernel32); + return pfn( lpExistingFileName, lpNewFileName, lpProgressRoutine, lpData, dwFlags ); +} + +typedef BOOL WINAPI FN_ReplaceFileA( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReplaceFileA( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ) +{ + static FN_ReplaceFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReplaceFileA", &g_Kernel32); + return pfn( lpReplacedFileName, lpReplacementFileName, lpBackupFileName, dwReplaceFlags, lpExclude, lpReserved ); +} + +typedef BOOL WINAPI FN_ReplaceFileW( LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileName, LPCWSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReplaceFileW( LPCWSTR lpReplacedFileName, LPCWSTR lpReplacementFileName, LPCWSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ) +{ + static FN_ReplaceFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReplaceFileW", &g_Kernel32); + return pfn( lpReplacedFileName, lpReplacementFileName, lpBackupFileName, dwReplaceFlags, lpExclude, lpReserved ); +} + +typedef BOOL WINAPI FN_CreateHardLinkA( LPCSTR lpFileName, LPCSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateHardLinkA( LPCSTR lpFileName, LPCSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) +{ + static FN_CreateHardLinkA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateHardLinkA", &g_Kernel32); + return pfn( lpFileName, lpExistingFileName, lpSecurityAttributes ); +} + +typedef BOOL WINAPI FN_CreateHardLinkW( LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateHardLinkW( LPCWSTR lpFileName, LPCWSTR lpExistingFileName, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) +{ + static FN_CreateHardLinkW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateHardLinkW", &g_Kernel32); + return pfn( lpFileName, lpExistingFileName, lpSecurityAttributes ); +} + +typedef HANDLE WINAPI FN_FindFirstStreamW( LPCWSTR lpFileName, STREAM_INFO_LEVELS InfoLevel, LPVOID lpFindStreamData, DWORD dwFlags ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstStreamW( LPCWSTR lpFileName, STREAM_INFO_LEVELS InfoLevel, LPVOID lpFindStreamData, DWORD dwFlags ) +{ + static FN_FindFirstStreamW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstStreamW", &g_Kernel32); + return pfn( lpFileName, InfoLevel, lpFindStreamData, dwFlags ); +} + +typedef BOOL APIENTRY FN_FindNextStreamW( HANDLE hFindStream, LPVOID lpFindStreamData ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_FindNextStreamW( HANDLE hFindStream, LPVOID lpFindStreamData ) +{ + static FN_FindNextStreamW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindNextStreamW", &g_Kernel32); + return pfn( hFindStream, lpFindStreamData ); +} + +typedef HANDLE WINAPI FN_CreateNamedPipeA( LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateNamedPipeA( LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) +{ + static FN_CreateNamedPipeA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateNamedPipeA", &g_Kernel32); + return pfn( lpName, dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes ); +} + +typedef HANDLE WINAPI FN_CreateNamedPipeW( LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateNamedPipeW( LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes ) +{ + static FN_CreateNamedPipeW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateNamedPipeW", &g_Kernel32); + return pfn( lpName, dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes ); +} + +typedef BOOL WINAPI FN_GetNamedPipeHandleStateA( HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPSTR lpUserName, DWORD nMaxUserNameSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNamedPipeHandleStateA( HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPSTR lpUserName, DWORD nMaxUserNameSize ) +{ + static FN_GetNamedPipeHandleStateA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNamedPipeHandleStateA", &g_Kernel32); + return pfn( hNamedPipe, lpState, lpCurInstances, lpMaxCollectionCount, lpCollectDataTimeout, lpUserName, nMaxUserNameSize ); +} + +typedef BOOL WINAPI FN_GetNamedPipeHandleStateW( HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPWSTR lpUserName, DWORD nMaxUserNameSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNamedPipeHandleStateW( HANDLE hNamedPipe, LPDWORD lpState, LPDWORD lpCurInstances, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout, LPWSTR lpUserName, DWORD nMaxUserNameSize ) +{ + static FN_GetNamedPipeHandleStateW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNamedPipeHandleStateW", &g_Kernel32); + return pfn( hNamedPipe, lpState, lpCurInstances, lpMaxCollectionCount, lpCollectDataTimeout, lpUserName, nMaxUserNameSize ); +} + +typedef BOOL WINAPI FN_CallNamedPipeA( LPCSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CallNamedPipeA( LPCSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut ) +{ + static FN_CallNamedPipeA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CallNamedPipeA", &g_Kernel32); + return pfn( lpNamedPipeName, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesRead, nTimeOut ); +} + +typedef BOOL WINAPI FN_CallNamedPipeW( LPCWSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CallNamedPipeW( LPCWSTR lpNamedPipeName, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, DWORD nTimeOut ) +{ + static FN_CallNamedPipeW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CallNamedPipeW", &g_Kernel32); + return pfn( lpNamedPipeName, lpInBuffer, nInBufferSize, lpOutBuffer, nOutBufferSize, lpBytesRead, nTimeOut ); +} + +typedef BOOL WINAPI FN_WaitNamedPipeA( LPCSTR lpNamedPipeName, DWORD nTimeOut ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WaitNamedPipeA( LPCSTR lpNamedPipeName, DWORD nTimeOut ) +{ + static FN_WaitNamedPipeA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WaitNamedPipeA", &g_Kernel32); + return pfn( lpNamedPipeName, nTimeOut ); +} + +typedef BOOL WINAPI FN_WaitNamedPipeW( LPCWSTR lpNamedPipeName, DWORD nTimeOut ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WaitNamedPipeW( LPCWSTR lpNamedPipeName, DWORD nTimeOut ) +{ + static FN_WaitNamedPipeW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WaitNamedPipeW", &g_Kernel32); + return pfn( lpNamedPipeName, nTimeOut ); +} + +typedef BOOL WINAPI FN_SetVolumeLabelA( LPCSTR lpRootPathName, LPCSTR lpVolumeName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetVolumeLabelA( LPCSTR lpRootPathName, LPCSTR lpVolumeName ) +{ + static FN_SetVolumeLabelA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetVolumeLabelA", &g_Kernel32); + return pfn( lpRootPathName, lpVolumeName ); +} + +typedef BOOL WINAPI FN_SetVolumeLabelW( LPCWSTR lpRootPathName, LPCWSTR lpVolumeName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetVolumeLabelW( LPCWSTR lpRootPathName, LPCWSTR lpVolumeName ) +{ + static FN_SetVolumeLabelW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetVolumeLabelW", &g_Kernel32); + return pfn( lpRootPathName, lpVolumeName ); +} + +typedef VOID WINAPI FN_SetFileApisToOEM( VOID ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_SetFileApisToOEM( VOID ) +{ + static FN_SetFileApisToOEM *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFileApisToOEM", &g_Kernel32); + pfn (); +} + +typedef VOID WINAPI FN_SetFileApisToANSI( VOID ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_SetFileApisToANSI( VOID ) +{ + static FN_SetFileApisToANSI *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFileApisToANSI", &g_Kernel32); + pfn (); +} + +typedef BOOL WINAPI FN_AreFileApisANSI( VOID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AreFileApisANSI( VOID ) +{ + static FN_AreFileApisANSI *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AreFileApisANSI", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_GetVolumeInformationA( LPCSTR lpRootPathName, LPSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumeInformationA( LPCSTR lpRootPathName, LPSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ) +{ + static FN_GetVolumeInformationA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVolumeInformationA", &g_Kernel32); + return pfn( lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize ); +} + +typedef BOOL WINAPI FN_GetVolumeInformationW( LPCWSTR lpRootPathName, LPWSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPWSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumeInformationW( LPCWSTR lpRootPathName, LPWSTR lpVolumeNameBuffer, DWORD nVolumeNameSize, LPDWORD lpVolumeSerialNumber, LPDWORD lpMaximumComponentLength, LPDWORD lpFileSystemFlags, LPWSTR lpFileSystemNameBuffer, DWORD nFileSystemNameSize ) +{ + static FN_GetVolumeInformationW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVolumeInformationW", &g_Kernel32); + return pfn( lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize ); +} + +typedef BOOL WINAPI FN_CancelIo( HANDLE hFile ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CancelIo( HANDLE hFile ) +{ + static FN_CancelIo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CancelIo", &g_Kernel32); + return pfn( hFile ); +} + +typedef BOOL WINAPI FN_ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ClearEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName ) +{ + static FN_ClearEventLogA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ClearEventLogA", &g_Kernel32); + return pfn( hEventLog, lpBackupFileName ); +} + +typedef BOOL WINAPI FN_ClearEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ClearEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ) +{ + static FN_ClearEventLogW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ClearEventLogW", &g_Kernel32); + return pfn( hEventLog, lpBackupFileName ); +} + +typedef BOOL WINAPI FN_BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_BackupEventLogA( HANDLE hEventLog, LPCSTR lpBackupFileName ) +{ + static FN_BackupEventLogA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BackupEventLogA", &g_Kernel32); + return pfn( hEventLog, lpBackupFileName ); +} + +typedef BOOL WINAPI FN_BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_BackupEventLogW( HANDLE hEventLog, LPCWSTR lpBackupFileName ) +{ + static FN_BackupEventLogW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BackupEventLogW", &g_Kernel32); + return pfn( hEventLog, lpBackupFileName ); +} + +typedef BOOL WINAPI FN_CloseEventLog( HANDLE hEventLog ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CloseEventLog( HANDLE hEventLog ) +{ + static FN_CloseEventLog *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CloseEventLog", &g_Kernel32); + return pfn( hEventLog ); +} + +typedef BOOL WINAPI FN_DeregisterEventSource( HANDLE hEventLog ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeregisterEventSource( HANDLE hEventLog ) +{ + static FN_DeregisterEventSource *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeregisterEventSource", &g_Kernel32); + return pfn( hEventLog ); +} + +typedef BOOL WINAPI FN_NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_NotifyChangeEventLog( HANDLE hEventLog, HANDLE hEvent ) +{ + static FN_NotifyChangeEventLog *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "NotifyChangeEventLog", &g_Kernel32); + return pfn( hEventLog, hEvent ); +} + +typedef BOOL WINAPI FN_GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumberOfEventLogRecords( HANDLE hEventLog, PDWORD NumberOfRecords ) +{ + static FN_GetNumberOfEventLogRecords *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNumberOfEventLogRecords", &g_Kernel32); + return pfn( hEventLog, NumberOfRecords ); +} + +typedef BOOL WINAPI FN_GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetOldestEventLogRecord( HANDLE hEventLog, PDWORD OldestRecord ) +{ + static FN_GetOldestEventLogRecord *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetOldestEventLogRecord", &g_Kernel32); + return pfn( hEventLog, OldestRecord ); +} + +typedef HANDLE WINAPI FN_OpenEventLogA( LPCSTR lpUNCServerName, LPCSTR lpSourceName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenEventLogA( LPCSTR lpUNCServerName, LPCSTR lpSourceName ) +{ + static FN_OpenEventLogA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenEventLogA", &g_Kernel32); + return pfn( lpUNCServerName, lpSourceName ); +} + +typedef HANDLE WINAPI FN_OpenEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ) +{ + static FN_OpenEventLogW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenEventLogW", &g_Kernel32); + return pfn( lpUNCServerName, lpSourceName ); +} + +typedef HANDLE WINAPI FN_RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_RegisterEventSourceA( LPCSTR lpUNCServerName, LPCSTR lpSourceName ) +{ + static FN_RegisterEventSourceA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RegisterEventSourceA", &g_Kernel32); + return pfn( lpUNCServerName, lpSourceName ); +} + +typedef HANDLE WINAPI FN_RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_RegisterEventSourceW( LPCWSTR lpUNCServerName, LPCWSTR lpSourceName ) +{ + static FN_RegisterEventSourceW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RegisterEventSourceW", &g_Kernel32); + return pfn( lpUNCServerName, lpSourceName ); +} + +typedef HANDLE WINAPI FN_OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenBackupEventLogA( LPCSTR lpUNCServerName, LPCSTR lpFileName ) +{ + static FN_OpenBackupEventLogA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenBackupEventLogA", &g_Kernel32); + return pfn( lpUNCServerName, lpFileName ); +} + +typedef HANDLE WINAPI FN_OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenBackupEventLogW( LPCWSTR lpUNCServerName, LPCWSTR lpFileName ) +{ + static FN_OpenBackupEventLogW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenBackupEventLogW", &g_Kernel32); + return pfn( lpUNCServerName, lpFileName ); +} + +typedef BOOL WINAPI FN_ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD * pnBytesRead, DWORD * pnMinNumberOfBytesNeeded ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadEventLogA( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD * pnBytesRead, DWORD * pnMinNumberOfBytesNeeded ) +{ + static FN_ReadEventLogA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadEventLogA", &g_Kernel32); + return pfn( hEventLog, dwReadFlags, dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded ); +} + +typedef BOOL WINAPI FN_ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD * pnBytesRead, DWORD * pnMinNumberOfBytesNeeded ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadEventLogW( HANDLE hEventLog, DWORD dwReadFlags, DWORD dwRecordOffset, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, DWORD * pnBytesRead, DWORD * pnMinNumberOfBytesNeeded ) +{ + static FN_ReadEventLogW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadEventLogW", &g_Kernel32); + return pfn( hEventLog, dwReadFlags, dwRecordOffset, lpBuffer, nNumberOfBytesToRead, pnBytesRead, pnMinNumberOfBytesNeeded ); +} + +typedef BOOL WINAPI FN_ReportEventA( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR * lpStrings, LPVOID lpRawData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReportEventA( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCSTR * lpStrings, LPVOID lpRawData ) +{ + static FN_ReportEventA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReportEventA", &g_Kernel32); + return pfn( hEventLog, wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData ); +} + +typedef BOOL WINAPI FN_ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR * lpStrings, LPVOID lpRawData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReportEventW( HANDLE hEventLog, WORD wType, WORD wCategory, DWORD dwEventID, PSID lpUserSid, WORD wNumStrings, DWORD dwDataSize, LPCWSTR * lpStrings, LPVOID lpRawData ) +{ + static FN_ReportEventW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReportEventW", &g_Kernel32); + return pfn( hEventLog, wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData ); +} + +typedef BOOL WINAPI FN_GetEventLogInformation( HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetEventLogInformation( HANDLE hEventLog, DWORD dwInfoLevel, LPVOID lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded ) +{ + static FN_GetEventLogInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetEventLogInformation", &g_Kernel32); + return pfn( hEventLog, dwInfoLevel, lpBuffer, cbBufSize, pcbBytesNeeded ); +} + +typedef BOOL WINAPI FN_DuplicateToken( HANDLE ExistingTokenHandle, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, PHANDLE DuplicateTokenHandle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DuplicateToken( HANDLE ExistingTokenHandle, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, PHANDLE DuplicateTokenHandle ) +{ + static FN_DuplicateToken *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DuplicateToken", &g_Kernel32); + return pfn( ExistingTokenHandle, ImpersonationLevel, DuplicateTokenHandle ); +} + +typedef BOOL WINAPI FN_GetKernelObjectSecurity( HANDLE Handle, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetKernelObjectSecurity( HANDLE Handle, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ) +{ + static FN_GetKernelObjectSecurity *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetKernelObjectSecurity", &g_Kernel32); + return pfn( Handle, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded ); +} + +typedef BOOL WINAPI FN_ImpersonateNamedPipeClient( HANDLE hNamedPipe ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ImpersonateNamedPipeClient( HANDLE hNamedPipe ) +{ + static FN_ImpersonateNamedPipeClient *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ImpersonateNamedPipeClient", &g_Kernel32); + return pfn( hNamedPipe ); +} + +typedef BOOL WINAPI FN_ImpersonateSelf( SECURITY_IMPERSONATION_LEVEL ImpersonationLevel ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ImpersonateSelf( SECURITY_IMPERSONATION_LEVEL ImpersonationLevel ) +{ + static FN_ImpersonateSelf *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ImpersonateSelf", &g_Kernel32); + return pfn( ImpersonationLevel ); +} + +typedef BOOL WINAPI FN_RevertToSelf( VOID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_RevertToSelf( VOID ) +{ + static FN_RevertToSelf *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RevertToSelf", &g_Kernel32); + return pfn (); +} + +typedef BOOL APIENTRY FN_SetThreadToken( PHANDLE Thread, HANDLE Token ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_SetThreadToken( PHANDLE Thread, HANDLE Token ) +{ + static FN_SetThreadToken *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetThreadToken", &g_Kernel32); + return pfn( Thread, Token ); +} + +typedef BOOL WINAPI FN_AccessCheck( PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheck( PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus ) +{ + static FN_AccessCheck *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheck", &g_Kernel32); + return pfn( pSecurityDescriptor, ClientToken, DesiredAccess, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus ); +} + +typedef BOOL WINAPI FN_AccessCheckByType( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByType( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus ) +{ + static FN_AccessCheckByType *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheckByType", &g_Kernel32); + return pfn( pSecurityDescriptor, PrincipalSelfSid, ClientToken, DesiredAccess, ObjectTypeList, ObjectTypeListLength, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, AccessStatus ); +} + +typedef BOOL WINAPI FN_AccessCheckByTypeResultList( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccessList, LPDWORD AccessStatusList ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeResultList( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID PrincipalSelfSid, HANDLE ClientToken, DWORD DesiredAccess, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccessList, LPDWORD AccessStatusList ) +{ + static FN_AccessCheckByTypeResultList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeResultList", &g_Kernel32); + return pfn( pSecurityDescriptor, PrincipalSelfSid, ClientToken, DesiredAccess, ObjectTypeList, ObjectTypeListLength, GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccessList, AccessStatusList ); +} + +typedef BOOL WINAPI FN_OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle ) +{ + static FN_OpenProcessToken *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenProcessToken", &g_Kernel32); + return pfn( ProcessHandle, DesiredAccess, TokenHandle ); +} + +typedef BOOL WINAPI FN_OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, PHANDLE TokenHandle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, PHANDLE TokenHandle ) +{ + static FN_OpenThreadToken *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenThreadToken", &g_Kernel32); + return pfn( ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle ); +} + +typedef BOOL WINAPI FN_GetTokenInformation( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetTokenInformation( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength ) +{ + static FN_GetTokenInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTokenInformation", &g_Kernel32); + return pfn( TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength, ReturnLength ); +} + +typedef BOOL WINAPI FN_SetTokenInformation( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetTokenInformation( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength ) +{ + static FN_SetTokenInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetTokenInformation", &g_Kernel32); + return pfn( TokenHandle, TokenInformationClass, TokenInformation, TokenInformationLength ); +} + +typedef BOOL WINAPI FN_AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength ) +{ + static FN_AdjustTokenPrivileges *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AdjustTokenPrivileges", &g_Kernel32); + return pfn( TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength ); +} + +typedef BOOL WINAPI FN_AdjustTokenGroups( HANDLE TokenHandle, BOOL ResetToDefault, PTOKEN_GROUPS NewState, DWORD BufferLength, PTOKEN_GROUPS PreviousState, PDWORD ReturnLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AdjustTokenGroups( HANDLE TokenHandle, BOOL ResetToDefault, PTOKEN_GROUPS NewState, DWORD BufferLength, PTOKEN_GROUPS PreviousState, PDWORD ReturnLength ) +{ + static FN_AdjustTokenGroups *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AdjustTokenGroups", &g_Kernel32); + return pfn( TokenHandle, ResetToDefault, NewState, BufferLength, PreviousState, ReturnLength ); +} + +typedef BOOL WINAPI FN_PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_PrivilegeCheck( HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult ) +{ + static FN_PrivilegeCheck *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "PrivilegeCheck", &g_Kernel32); + return pfn( ClientToken, RequiredPrivileges, pfResult ); +} + +typedef BOOL WINAPI FN_AccessCheckAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ) +{ + static FN_AccessCheckAndAuditAlarmA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheckAndAuditAlarmA", &g_Kernel32); + return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, pfGenerateOnClose ); +} + +typedef BOOL WINAPI FN_AccessCheckAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, LPWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, LPWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ) +{ + static FN_AccessCheckAndAuditAlarmW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheckAndAuditAlarmW", &g_Kernel32); + return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, DesiredAccess, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, pfGenerateOnClose ); +} + +typedef BOOL WINAPI FN_AccessCheckByTypeAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ) +{ + static FN_AccessCheckByTypeAndAuditAlarmA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeAndAuditAlarmA", &g_Kernel32); + return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, pfGenerateOnClose ); +} + +typedef BOOL WINAPI FN_AccessCheckByTypeAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPBOOL AccessStatus, LPBOOL pfGenerateOnClose ) +{ + static FN_AccessCheckByTypeAndAuditAlarmW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeAndAuditAlarmW", &g_Kernel32); + return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatus, pfGenerateOnClose ); +} + +typedef BOOL WINAPI FN_AccessCheckByTypeResultListAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeResultListAndAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ) +{ + static FN_AccessCheckByTypeResultListAndAuditAlarmA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeResultListAndAuditAlarmA", &g_Kernel32); + return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatusList, pfGenerateOnClose ); +} + +typedef BOOL WINAPI FN_AccessCheckByTypeResultListAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeResultListAndAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ) +{ + static FN_AccessCheckByTypeResultListAndAuditAlarmW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeResultListAndAuditAlarmW", &g_Kernel32); + return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatusList, pfGenerateOnClose ); +} + +typedef BOOL WINAPI FN_AccessCheckByTypeResultListAndAuditAlarmByHandleA( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeResultListAndAuditAlarmByHandleA( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCSTR ObjectTypeName, LPCSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ) +{ + static FN_AccessCheckByTypeResultListAndAuditAlarmByHandleA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeResultListAndAuditAlarmByHandleA", &g_Kernel32); + return pfn( SubsystemName, HandleId, ClientToken, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatusList, pfGenerateOnClose ); +} + +typedef BOOL WINAPI FN_AccessCheckByTypeResultListAndAuditAlarmByHandleW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AccessCheckByTypeResultListAndAuditAlarmByHandleW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, LPCWSTR ObjectTypeName, LPCWSTR ObjectName, PSECURITY_DESCRIPTOR SecurityDescriptor, PSID PrincipalSelfSid, DWORD DesiredAccess, AUDIT_EVENT_TYPE AuditType, DWORD Flags, POBJECT_TYPE_LIST ObjectTypeList, DWORD ObjectTypeListLength, PGENERIC_MAPPING GenericMapping, BOOL ObjectCreation, LPDWORD GrantedAccess, LPDWORD AccessStatusList, LPBOOL pfGenerateOnClose ) +{ + static FN_AccessCheckByTypeResultListAndAuditAlarmByHandleW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AccessCheckByTypeResultListAndAuditAlarmByHandleW", &g_Kernel32); + return pfn( SubsystemName, HandleId, ClientToken, ObjectTypeName, ObjectName, SecurityDescriptor, PrincipalSelfSid, DesiredAccess, AuditType, Flags, ObjectTypeList, ObjectTypeListLength, GenericMapping, ObjectCreation, GrantedAccess, AccessStatusList, pfGenerateOnClose ); +} + +typedef BOOL WINAPI FN_ObjectOpenAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, LPBOOL GenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectOpenAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, LPSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, LPBOOL GenerateOnClose ) +{ + static FN_ObjectOpenAuditAlarmA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ObjectOpenAuditAlarmA", &g_Kernel32); + return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, pSecurityDescriptor, ClientToken, DesiredAccess, GrantedAccess, Privileges, ObjectCreation, AccessGranted, GenerateOnClose ); +} + +typedef BOOL WINAPI FN_ObjectOpenAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, LPWSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, LPBOOL GenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectOpenAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, LPWSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, LPBOOL GenerateOnClose ) +{ + static FN_ObjectOpenAuditAlarmW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ObjectOpenAuditAlarmW", &g_Kernel32); + return pfn( SubsystemName, HandleId, ObjectTypeName, ObjectName, pSecurityDescriptor, ClientToken, DesiredAccess, GrantedAccess, Privileges, ObjectCreation, AccessGranted, GenerateOnClose ); +} + +typedef BOOL WINAPI FN_ObjectPrivilegeAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectPrivilegeAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted ) +{ + static FN_ObjectPrivilegeAuditAlarmA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ObjectPrivilegeAuditAlarmA", &g_Kernel32); + return pfn( SubsystemName, HandleId, ClientToken, DesiredAccess, Privileges, AccessGranted ); +} + +typedef BOOL WINAPI FN_ObjectPrivilegeAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectPrivilegeAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted ) +{ + static FN_ObjectPrivilegeAuditAlarmW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ObjectPrivilegeAuditAlarmW", &g_Kernel32); + return pfn( SubsystemName, HandleId, ClientToken, DesiredAccess, Privileges, AccessGranted ); +} + +typedef BOOL WINAPI FN_ObjectCloseAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectCloseAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ) +{ + static FN_ObjectCloseAuditAlarmA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ObjectCloseAuditAlarmA", &g_Kernel32); + return pfn( SubsystemName, HandleId, GenerateOnClose ); +} + +typedef BOOL WINAPI FN_ObjectCloseAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectCloseAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ) +{ + static FN_ObjectCloseAuditAlarmW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ObjectCloseAuditAlarmW", &g_Kernel32); + return pfn( SubsystemName, HandleId, GenerateOnClose ); +} + +typedef BOOL WINAPI FN_ObjectDeleteAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectDeleteAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ) +{ + static FN_ObjectDeleteAuditAlarmA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ObjectDeleteAuditAlarmA", &g_Kernel32); + return pfn( SubsystemName, HandleId, GenerateOnClose ); +} + +typedef BOOL WINAPI FN_ObjectDeleteAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ObjectDeleteAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose ) +{ + static FN_ObjectDeleteAuditAlarmW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ObjectDeleteAuditAlarmW", &g_Kernel32); + return pfn( SubsystemName, HandleId, GenerateOnClose ); +} + +typedef BOOL WINAPI FN_PrivilegedServiceAuditAlarmA( LPCSTR SubsystemName, LPCSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_PrivilegedServiceAuditAlarmA( LPCSTR SubsystemName, LPCSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOL AccessGranted ) +{ + static FN_PrivilegedServiceAuditAlarmA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "PrivilegedServiceAuditAlarmA", &g_Kernel32); + return pfn( SubsystemName, ServiceName, ClientToken, Privileges, AccessGranted ); +} + +typedef BOOL WINAPI FN_PrivilegedServiceAuditAlarmW( LPCWSTR SubsystemName, LPCWSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOL AccessGranted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_PrivilegedServiceAuditAlarmW( LPCWSTR SubsystemName, LPCWSTR ServiceName, HANDLE ClientToken, PPRIVILEGE_SET Privileges, BOOL AccessGranted ) +{ + static FN_PrivilegedServiceAuditAlarmW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "PrivilegedServiceAuditAlarmW", &g_Kernel32); + return pfn( SubsystemName, ServiceName, ClientToken, Privileges, AccessGranted ); +} + +typedef BOOL WINAPI FN_IsWellKnownSid( PSID pSid, WELL_KNOWN_SID_TYPE WellKnownSidType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsWellKnownSid( PSID pSid, WELL_KNOWN_SID_TYPE WellKnownSidType ) +{ + static FN_IsWellKnownSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsWellKnownSid", &g_Kernel32); + return pfn( pSid, WellKnownSidType ); +} + +typedef BOOL WINAPI FN_CreateWellKnownSid( WELL_KNOWN_SID_TYPE WellKnownSidType, PSID DomainSid, PSID pSid, DWORD * cbSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateWellKnownSid( WELL_KNOWN_SID_TYPE WellKnownSidType, PSID DomainSid, PSID pSid, DWORD * cbSid ) +{ + static FN_CreateWellKnownSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateWellKnownSid", &g_Kernel32); + return pfn( WellKnownSidType, DomainSid, pSid, cbSid ); +} + +typedef BOOL WINAPI FN_EqualDomainSid( PSID pSid1, PSID pSid2, BOOL * pfEqual ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EqualDomainSid( PSID pSid1, PSID pSid2, BOOL * pfEqual ) +{ + static FN_EqualDomainSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EqualDomainSid", &g_Kernel32); + return pfn( pSid1, pSid2, pfEqual ); +} + +typedef BOOL WINAPI FN_GetWindowsAccountDomainSid( PSID pSid, PSID pDomainSid, DWORD * cbDomainSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetWindowsAccountDomainSid( PSID pSid, PSID pDomainSid, DWORD * cbDomainSid ) +{ + static FN_GetWindowsAccountDomainSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetWindowsAccountDomainSid", &g_Kernel32); + return pfn( pSid, pDomainSid, cbDomainSid ); +} + +typedef BOOL WINAPI FN_IsValidSid( PSID pSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidSid( PSID pSid ) +{ + static FN_IsValidSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsValidSid", &g_Kernel32); + return pfn( pSid ); +} + +typedef BOOL WINAPI FN_EqualSid( PSID pSid1, PSID pSid2 ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EqualSid( PSID pSid1, PSID pSid2 ) +{ + static FN_EqualSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EqualSid", &g_Kernel32); + return pfn( pSid1, pSid2 ); +} + +typedef BOOL WINAPI FN_EqualPrefixSid( PSID pSid1, PSID pSid2 ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EqualPrefixSid( PSID pSid1, PSID pSid2 ) +{ + static FN_EqualPrefixSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EqualPrefixSid", &g_Kernel32); + return pfn( pSid1, pSid2 ); +} + +typedef DWORD WINAPI FN_GetSidLengthRequired( UCHAR nSubAuthorityCount ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetSidLengthRequired( UCHAR nSubAuthorityCount ) +{ + static FN_GetSidLengthRequired *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSidLengthRequired", &g_Kernel32); + return pfn( nSubAuthorityCount ); +} + +typedef BOOL WINAPI FN_AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID * pSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AllocateAndInitializeSid( PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID * pSid ) +{ + static FN_AllocateAndInitializeSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AllocateAndInitializeSid", &g_Kernel32); + return pfn( pIdentifierAuthority, nSubAuthorityCount, nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, pSid ); +} + +typedef PVOID WINAPI FN_FreeSid( PSID pSid ); +__declspec(dllexport) PVOID WINAPI kPrf2Wrap_FreeSid( PSID pSid ) +{ + static FN_FreeSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FreeSid", &g_Kernel32); + return pfn( pSid ); +} + +typedef BOOL WINAPI FN_InitializeSid( PSID Sid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_InitializeSid( PSID Sid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount ) +{ + static FN_InitializeSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InitializeSid", &g_Kernel32); + return pfn( Sid, pIdentifierAuthority, nSubAuthorityCount ); +} + +typedef PSID_IDENTIFIER_AUTHORITY WINAPI FN_GetSidIdentifierAuthority( PSID pSid ); +__declspec(dllexport) PSID_IDENTIFIER_AUTHORITY WINAPI kPrf2Wrap_GetSidIdentifierAuthority( PSID pSid ) +{ + static FN_GetSidIdentifierAuthority *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSidIdentifierAuthority", &g_Kernel32); + return pfn( pSid ); +} + +typedef PDWORD WINAPI FN_GetSidSubAuthority( PSID pSid, DWORD nSubAuthority ); +__declspec(dllexport) PDWORD WINAPI kPrf2Wrap_GetSidSubAuthority( PSID pSid, DWORD nSubAuthority ) +{ + static FN_GetSidSubAuthority *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSidSubAuthority", &g_Kernel32); + return pfn( pSid, nSubAuthority ); +} + +typedef PUCHAR WINAPI FN_GetSidSubAuthorityCount( PSID pSid ); +__declspec(dllexport) PUCHAR WINAPI kPrf2Wrap_GetSidSubAuthorityCount( PSID pSid ) +{ + static FN_GetSidSubAuthorityCount *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSidSubAuthorityCount", &g_Kernel32); + return pfn( pSid ); +} + +typedef DWORD WINAPI FN_GetLengthSid( PSID pSid ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetLengthSid( PSID pSid ) +{ + static FN_GetLengthSid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLengthSid", &g_Kernel32); + return pfn( pSid ); +} + +typedef BOOL WINAPI FN_CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid ) +{ + static FN_CopySid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CopySid", &g_Kernel32); + return pfn( nDestinationSidLength, pDestinationSid, pSourceSid ); +} + +typedef BOOL WINAPI FN_AreAllAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AreAllAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ) +{ + static FN_AreAllAccessesGranted *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AreAllAccessesGranted", &g_Kernel32); + return pfn( GrantedAccess, DesiredAccess ); +} + +typedef BOOL WINAPI FN_AreAnyAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AreAnyAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ) +{ + static FN_AreAnyAccessesGranted *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AreAnyAccessesGranted", &g_Kernel32); + return pfn( GrantedAccess, DesiredAccess ); +} + +typedef VOID WINAPI FN_MapGenericMask( PDWORD AccessMask, PGENERIC_MAPPING GenericMapping ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_MapGenericMask( PDWORD AccessMask, PGENERIC_MAPPING GenericMapping ) +{ + static FN_MapGenericMask *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MapGenericMask", &g_Kernel32); + pfn( AccessMask, GenericMapping ); +} + +typedef BOOL WINAPI FN_IsValidAcl( PACL pAcl ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidAcl( PACL pAcl ) +{ + static FN_IsValidAcl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsValidAcl", &g_Kernel32); + return pfn( pAcl ); +} + +typedef BOOL WINAPI FN_InitializeAcl( PACL pAcl, DWORD nAclLength, DWORD dwAclRevision ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_InitializeAcl( PACL pAcl, DWORD nAclLength, DWORD dwAclRevision ) +{ + static FN_InitializeAcl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InitializeAcl", &g_Kernel32); + return pfn( pAcl, nAclLength, dwAclRevision ); +} + +typedef BOOL WINAPI FN_GetAclInformation( PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetAclInformation( PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass ) +{ + static FN_GetAclInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetAclInformation", &g_Kernel32); + return pfn( pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass ); +} + +typedef BOOL WINAPI FN_SetAclInformation( PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetAclInformation( PACL pAcl, LPVOID pAclInformation, DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass ) +{ + static FN_SetAclInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetAclInformation", &g_Kernel32); + return pfn( pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass ); +} + +typedef BOOL WINAPI FN_AddAce( PACL pAcl, DWORD dwAceRevision, DWORD dwStartingAceIndex, LPVOID pAceList, DWORD nAceListLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAce( PACL pAcl, DWORD dwAceRevision, DWORD dwStartingAceIndex, LPVOID pAceList, DWORD nAceListLength ) +{ + static FN_AddAce *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAce", &g_Kernel32); + return pfn( pAcl, dwAceRevision, dwStartingAceIndex, pAceList, nAceListLength ); +} + +typedef BOOL WINAPI FN_DeleteAce( PACL pAcl, DWORD dwAceIndex ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteAce( PACL pAcl, DWORD dwAceIndex ) +{ + static FN_DeleteAce *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteAce", &g_Kernel32); + return pfn( pAcl, dwAceIndex ); +} + +typedef BOOL WINAPI FN_GetAce( PACL pAcl, DWORD dwAceIndex, LPVOID * pAce ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetAce( PACL pAcl, DWORD dwAceIndex, LPVOID * pAce ) +{ + static FN_GetAce *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetAce", &g_Kernel32); + return pfn( pAcl, dwAceIndex, pAce ); +} + +typedef BOOL WINAPI FN_AddAccessAllowedAce( PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessAllowedAce( PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid ) +{ + static FN_AddAccessAllowedAce *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAccessAllowedAce", &g_Kernel32); + return pfn( pAcl, dwAceRevision, AccessMask, pSid ); +} + +typedef BOOL WINAPI FN_AddAccessAllowedAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessAllowedAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ) +{ + static FN_AddAccessAllowedAceEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAccessAllowedAceEx", &g_Kernel32); + return pfn( pAcl, dwAceRevision, AceFlags, AccessMask, pSid ); +} + +typedef BOOL WINAPI FN_AddAccessDeniedAce( PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessDeniedAce( PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid ) +{ + static FN_AddAccessDeniedAce *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAccessDeniedAce", &g_Kernel32); + return pfn( pAcl, dwAceRevision, AccessMask, pSid ); +} + +typedef BOOL WINAPI FN_AddAccessDeniedAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessDeniedAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, PSID pSid ) +{ + static FN_AddAccessDeniedAceEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAccessDeniedAceEx", &g_Kernel32); + return pfn( pAcl, dwAceRevision, AceFlags, AccessMask, pSid ); +} + +typedef BOOL WINAPI FN_AddAuditAccessAce( PACL pAcl, DWORD dwAceRevision, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAuditAccessAce( PACL pAcl, DWORD dwAceRevision, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ) +{ + static FN_AddAuditAccessAce *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAuditAccessAce", &g_Kernel32); + return pfn( pAcl, dwAceRevision, dwAccessMask, pSid, bAuditSuccess, bAuditFailure ); +} + +typedef BOOL WINAPI FN_AddAuditAccessAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAuditAccessAceEx( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD dwAccessMask, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ) +{ + static FN_AddAuditAccessAceEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAuditAccessAceEx", &g_Kernel32); + return pfn( pAcl, dwAceRevision, AceFlags, dwAccessMask, pSid, bAuditSuccess, bAuditFailure ); +} + +typedef BOOL WINAPI FN_AddAccessAllowedObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessAllowedObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid ) +{ + static FN_AddAccessAllowedObjectAce *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAccessAllowedObjectAce", &g_Kernel32); + return pfn( pAcl, dwAceRevision, AceFlags, AccessMask, ObjectTypeGuid, InheritedObjectTypeGuid, pSid ); +} + +typedef BOOL WINAPI FN_AddAccessDeniedObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAccessDeniedObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid ) +{ + static FN_AddAccessDeniedObjectAce *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAccessDeniedObjectAce", &g_Kernel32); + return pfn( pAcl, dwAceRevision, AceFlags, AccessMask, ObjectTypeGuid, InheritedObjectTypeGuid, pSid ); +} + +typedef BOOL WINAPI FN_AddAuditAccessObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AddAuditAccessObjectAce( PACL pAcl, DWORD dwAceRevision, DWORD AceFlags, DWORD AccessMask, GUID * ObjectTypeGuid, GUID * InheritedObjectTypeGuid, PSID pSid, BOOL bAuditSuccess, BOOL bAuditFailure ) +{ + static FN_AddAuditAccessObjectAce *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddAuditAccessObjectAce", &g_Kernel32); + return pfn( pAcl, dwAceRevision, AceFlags, AccessMask, ObjectTypeGuid, InheritedObjectTypeGuid, pSid, bAuditSuccess, bAuditFailure ); +} + +typedef BOOL WINAPI FN_FindFirstFreeAce( PACL pAcl, LPVOID * pAce ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindFirstFreeAce( PACL pAcl, LPVOID * pAce ) +{ + static FN_FindFirstFreeAce *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstFreeAce", &g_Kernel32); + return pfn( pAcl, pAce ); +} + +typedef BOOL WINAPI FN_InitializeSecurityDescriptor( PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_InitializeSecurityDescriptor( PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision ) +{ + static FN_InitializeSecurityDescriptor *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "InitializeSecurityDescriptor", &g_Kernel32); + return pfn( pSecurityDescriptor, dwRevision ); +} + +typedef BOOL WINAPI FN_IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR pSecurityDescriptor ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR pSecurityDescriptor ) +{ + static FN_IsValidSecurityDescriptor *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsValidSecurityDescriptor", &g_Kernel32); + return pfn( pSecurityDescriptor ); +} + +typedef DWORD WINAPI FN_GetSecurityDescriptorLength( PSECURITY_DESCRIPTOR pSecurityDescriptor ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetSecurityDescriptorLength( PSECURITY_DESCRIPTOR pSecurityDescriptor ) +{ + static FN_GetSecurityDescriptorLength *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorLength", &g_Kernel32); + return pfn( pSecurityDescriptor ); +} + +typedef BOOL WINAPI FN_GetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision ) +{ + static FN_GetSecurityDescriptorControl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorControl", &g_Kernel32); + return pfn( pSecurityDescriptor, pControl, lpdwRevision ); +} + +typedef BOOL WINAPI FN_SetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet ) +{ + static FN_SetSecurityDescriptorControl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorControl", &g_Kernel32); + return pfn( pSecurityDescriptor, ControlBitsOfInterest, ControlBitsToSet ); +} + +typedef BOOL WINAPI FN_SetSecurityDescriptorDacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSecurityDescriptorDacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted ) +{ + static FN_SetSecurityDescriptorDacl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorDacl", &g_Kernel32); + return pfn( pSecurityDescriptor, bDaclPresent, pDacl, bDaclDefaulted ); +} + +typedef BOOL WINAPI FN_GetSecurityDescriptorDacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL * pDacl, LPBOOL lpbDaclDefaulted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSecurityDescriptorDacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL * pDacl, LPBOOL lpbDaclDefaulted ) +{ + static FN_GetSecurityDescriptorDacl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorDacl", &g_Kernel32); + return pfn( pSecurityDescriptor, lpbDaclPresent, pDacl, lpbDaclDefaulted ); +} + +typedef BOOL WINAPI FN_SetSecurityDescriptorSacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bSaclPresent, PACL pSacl, BOOL bSaclDefaulted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSecurityDescriptorSacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bSaclPresent, PACL pSacl, BOOL bSaclDefaulted ) +{ + static FN_SetSecurityDescriptorSacl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorSacl", &g_Kernel32); + return pfn( pSecurityDescriptor, bSaclPresent, pSacl, bSaclDefaulted ); +} + +typedef BOOL WINAPI FN_GetSecurityDescriptorSacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent, PACL * pSacl, LPBOOL lpbSaclDefaulted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSecurityDescriptorSacl( PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbSaclPresent, PACL * pSacl, LPBOOL lpbSaclDefaulted ) +{ + static FN_GetSecurityDescriptorSacl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorSacl", &g_Kernel32); + return pfn( pSecurityDescriptor, lpbSaclPresent, pSacl, lpbSaclDefaulted ); +} + +typedef BOOL WINAPI FN_SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner, BOOL bOwnerDefaulted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner, BOOL bOwnerDefaulted ) +{ + static FN_SetSecurityDescriptorOwner *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorOwner", &g_Kernel32); + return pfn( pSecurityDescriptor, pOwner, bOwnerDefaulted ); +} + +typedef BOOL WINAPI FN_GetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID * pOwner, LPBOOL lpbOwnerDefaulted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID * pOwner, LPBOOL lpbOwnerDefaulted ) +{ + static FN_GetSecurityDescriptorOwner *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorOwner", &g_Kernel32); + return pfn( pSecurityDescriptor, pOwner, lpbOwnerDefaulted ); +} + +typedef BOOL WINAPI FN_SetSecurityDescriptorGroup( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pGroup, BOOL bGroupDefaulted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSecurityDescriptorGroup( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pGroup, BOOL bGroupDefaulted ) +{ + static FN_SetSecurityDescriptorGroup *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorGroup", &g_Kernel32); + return pfn( pSecurityDescriptor, pGroup, bGroupDefaulted ); +} + +typedef BOOL WINAPI FN_GetSecurityDescriptorGroup( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID * pGroup, LPBOOL lpbGroupDefaulted ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSecurityDescriptorGroup( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID * pGroup, LPBOOL lpbGroupDefaulted ) +{ + static FN_GetSecurityDescriptorGroup *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorGroup", &g_Kernel32); + return pfn( pSecurityDescriptor, pGroup, lpbGroupDefaulted ); +} + +typedef DWORD WINAPI FN_SetSecurityDescriptorRMControl( PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_SetSecurityDescriptorRMControl( PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl ) +{ + static FN_SetSecurityDescriptorRMControl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetSecurityDescriptorRMControl", &g_Kernel32); + return pfn( SecurityDescriptor, RMControl ); +} + +typedef DWORD WINAPI FN_GetSecurityDescriptorRMControl( PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetSecurityDescriptorRMControl( PSECURITY_DESCRIPTOR SecurityDescriptor, PUCHAR RMControl ) +{ + static FN_GetSecurityDescriptorRMControl *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSecurityDescriptorRMControl", &g_Kernel32); + return pfn( SecurityDescriptor, RMControl ); +} + +typedef BOOL WINAPI FN_CreatePrivateObjectSecurity( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, BOOL IsDirectoryObject, HANDLE Token, PGENERIC_MAPPING GenericMapping ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreatePrivateObjectSecurity( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, BOOL IsDirectoryObject, HANDLE Token, PGENERIC_MAPPING GenericMapping ) +{ + static FN_CreatePrivateObjectSecurity *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreatePrivateObjectSecurity", &g_Kernel32); + return pfn( ParentDescriptor, CreatorDescriptor, NewDescriptor, IsDirectoryObject, Token, GenericMapping ); +} + +typedef BOOL WINAPI FN_ConvertToAutoInheritPrivateObjectSecurity( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CurrentSecurityDescriptor, PSECURITY_DESCRIPTOR * NewSecurityDescriptor, GUID * ObjectType, BOOLEAN IsDirectoryObject, PGENERIC_MAPPING GenericMapping ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ConvertToAutoInheritPrivateObjectSecurity( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CurrentSecurityDescriptor, PSECURITY_DESCRIPTOR * NewSecurityDescriptor, GUID * ObjectType, BOOLEAN IsDirectoryObject, PGENERIC_MAPPING GenericMapping ) +{ + static FN_ConvertToAutoInheritPrivateObjectSecurity *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ConvertToAutoInheritPrivateObjectSecurity", &g_Kernel32); + return pfn( ParentDescriptor, CurrentSecurityDescriptor, NewSecurityDescriptor, ObjectType, IsDirectoryObject, GenericMapping ); +} + +typedef BOOL WINAPI FN_CreatePrivateObjectSecurityEx( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, GUID * ObjectType, BOOL IsContainerObject, ULONG AutoInheritFlags, HANDLE Token, PGENERIC_MAPPING GenericMapping ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreatePrivateObjectSecurityEx( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, GUID * ObjectType, BOOL IsContainerObject, ULONG AutoInheritFlags, HANDLE Token, PGENERIC_MAPPING GenericMapping ) +{ + static FN_CreatePrivateObjectSecurityEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreatePrivateObjectSecurityEx", &g_Kernel32); + return pfn( ParentDescriptor, CreatorDescriptor, NewDescriptor, ObjectType, IsContainerObject, AutoInheritFlags, Token, GenericMapping ); +} + +typedef BOOL WINAPI FN_CreatePrivateObjectSecurityWithMultipleInheritance( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, GUID * *ObjectTypes, ULONG GuidCount, BOOL IsContainerObject, ULONG AutoInheritFlags, HANDLE Token, PGENERIC_MAPPING GenericMapping ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreatePrivateObjectSecurityWithMultipleInheritance( PSECURITY_DESCRIPTOR ParentDescriptor, PSECURITY_DESCRIPTOR CreatorDescriptor, PSECURITY_DESCRIPTOR * NewDescriptor, GUID * *ObjectTypes, ULONG GuidCount, BOOL IsContainerObject, ULONG AutoInheritFlags, HANDLE Token, PGENERIC_MAPPING GenericMapping ) +{ + static FN_CreatePrivateObjectSecurityWithMultipleInheritance *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreatePrivateObjectSecurityWithMultipleInheritance", &g_Kernel32); + return pfn( ParentDescriptor, CreatorDescriptor, NewDescriptor, ObjectTypes, GuidCount, IsContainerObject, AutoInheritFlags, Token, GenericMapping ); +} + +typedef BOOL WINAPI FN_SetPrivateObjectSecurity( SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR * ObjectsSecurityDescriptor, PGENERIC_MAPPING GenericMapping, HANDLE Token ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetPrivateObjectSecurity( SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR * ObjectsSecurityDescriptor, PGENERIC_MAPPING GenericMapping, HANDLE Token ) +{ + static FN_SetPrivateObjectSecurity *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetPrivateObjectSecurity", &g_Kernel32); + return pfn( SecurityInformation, ModificationDescriptor, ObjectsSecurityDescriptor, GenericMapping, Token ); +} + +typedef BOOL WINAPI FN_SetPrivateObjectSecurityEx( SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR * ObjectsSecurityDescriptor, ULONG AutoInheritFlags, PGENERIC_MAPPING GenericMapping, HANDLE Token ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetPrivateObjectSecurityEx( SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ModificationDescriptor, PSECURITY_DESCRIPTOR * ObjectsSecurityDescriptor, ULONG AutoInheritFlags, PGENERIC_MAPPING GenericMapping, HANDLE Token ) +{ + static FN_SetPrivateObjectSecurityEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetPrivateObjectSecurityEx", &g_Kernel32); + return pfn( SecurityInformation, ModificationDescriptor, ObjectsSecurityDescriptor, AutoInheritFlags, GenericMapping, Token ); +} + +typedef BOOL WINAPI FN_GetPrivateObjectSecurity( PSECURITY_DESCRIPTOR ObjectDescriptor, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ResultantDescriptor, DWORD DescriptorLength, PDWORD ReturnLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetPrivateObjectSecurity( PSECURITY_DESCRIPTOR ObjectDescriptor, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR ResultantDescriptor, DWORD DescriptorLength, PDWORD ReturnLength ) +{ + static FN_GetPrivateObjectSecurity *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPrivateObjectSecurity", &g_Kernel32); + return pfn( ObjectDescriptor, SecurityInformation, ResultantDescriptor, DescriptorLength, ReturnLength ); +} + +typedef BOOL WINAPI FN_DestroyPrivateObjectSecurity( PSECURITY_DESCRIPTOR * ObjectDescriptor ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DestroyPrivateObjectSecurity( PSECURITY_DESCRIPTOR * ObjectDescriptor ) +{ + static FN_DestroyPrivateObjectSecurity *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DestroyPrivateObjectSecurity", &g_Kernel32); + return pfn( ObjectDescriptor ); +} + +typedef BOOL WINAPI FN_MakeSelfRelativeSD( PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, LPDWORD lpdwBufferLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MakeSelfRelativeSD( PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, LPDWORD lpdwBufferLength ) +{ + static FN_MakeSelfRelativeSD *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MakeSelfRelativeSD", &g_Kernel32); + return pfn( pAbsoluteSecurityDescriptor, pSelfRelativeSecurityDescriptor, lpdwBufferLength ); +} + +typedef BOOL WINAPI FN_MakeAbsoluteSD( PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, LPDWORD lpdwAbsoluteSecurityDescriptorSize, PACL pDacl, LPDWORD lpdwDaclSize, PACL pSacl, LPDWORD lpdwSaclSize, PSID pOwner, LPDWORD lpdwOwnerSize, PSID pPrimaryGroup, LPDWORD lpdwPrimaryGroupSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MakeAbsoluteSD( PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, LPDWORD lpdwAbsoluteSecurityDescriptorSize, PACL pDacl, LPDWORD lpdwDaclSize, PACL pSacl, LPDWORD lpdwSaclSize, PSID pOwner, LPDWORD lpdwOwnerSize, PSID pPrimaryGroup, LPDWORD lpdwPrimaryGroupSize ) +{ + static FN_MakeAbsoluteSD *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MakeAbsoluteSD", &g_Kernel32); + return pfn( pSelfRelativeSecurityDescriptor, pAbsoluteSecurityDescriptor, lpdwAbsoluteSecurityDescriptorSize, pDacl, lpdwDaclSize, pSacl, lpdwSaclSize, pOwner, lpdwOwnerSize, pPrimaryGroup, lpdwPrimaryGroupSize ); +} + +typedef BOOL WINAPI FN_MakeAbsoluteSD2( PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, LPDWORD lpdwBufferSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MakeAbsoluteSD2( PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, LPDWORD lpdwBufferSize ) +{ + static FN_MakeAbsoluteSD2 *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MakeAbsoluteSD2", &g_Kernel32); + return pfn( pSelfRelativeSecurityDescriptor, lpdwBufferSize ); +} + +typedef BOOL WINAPI FN_SetFileSecurityA( LPCSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileSecurityA( LPCSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ) +{ + static FN_SetFileSecurityA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFileSecurityA", &g_Kernel32); + return pfn( lpFileName, SecurityInformation, pSecurityDescriptor ); +} + +typedef BOOL WINAPI FN_SetFileSecurityW( LPCWSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetFileSecurityW( LPCWSTR lpFileName, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor ) +{ + static FN_SetFileSecurityW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetFileSecurityW", &g_Kernel32); + return pfn( lpFileName, SecurityInformation, pSecurityDescriptor ); +} + +typedef BOOL WINAPI FN_GetFileSecurityA( LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileSecurityA( LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ) +{ + static FN_GetFileSecurityA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileSecurityA", &g_Kernel32); + return pfn( lpFileName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded ); +} + +typedef BOOL WINAPI FN_GetFileSecurityW( LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetFileSecurityW( LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded ) +{ + static FN_GetFileSecurityW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileSecurityW", &g_Kernel32); + return pfn( lpFileName, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded ); +} + +typedef BOOL WINAPI FN_SetKernelObjectSecurity( HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetKernelObjectSecurity( HANDLE Handle, SECURITY_INFORMATION SecurityInformation, PSECURITY_DESCRIPTOR SecurityDescriptor ) +{ + static FN_SetKernelObjectSecurity *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetKernelObjectSecurity", &g_Kernel32); + return pfn( Handle, SecurityInformation, SecurityDescriptor ); +} + +typedef HANDLE WINAPI FN_FindFirstChangeNotificationA( LPCSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstChangeNotificationA( LPCSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter ) +{ + static FN_FindFirstChangeNotificationA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstChangeNotificationA", &g_Kernel32); + return pfn( lpPathName, bWatchSubtree, dwNotifyFilter ); +} + +typedef HANDLE WINAPI FN_FindFirstChangeNotificationW( LPCWSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstChangeNotificationW( LPCWSTR lpPathName, BOOL bWatchSubtree, DWORD dwNotifyFilter ) +{ + static FN_FindFirstChangeNotificationW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstChangeNotificationW", &g_Kernel32); + return pfn( lpPathName, bWatchSubtree, dwNotifyFilter ); +} + +typedef BOOL WINAPI FN_FindNextChangeNotification( HANDLE hChangeHandle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextChangeNotification( HANDLE hChangeHandle ) +{ + static FN_FindNextChangeNotification *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindNextChangeNotification", &g_Kernel32); + return pfn( hChangeHandle ); +} + +typedef BOOL WINAPI FN_FindCloseChangeNotification( HANDLE hChangeHandle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindCloseChangeNotification( HANDLE hChangeHandle ) +{ + static FN_FindCloseChangeNotification *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindCloseChangeNotification", &g_Kernel32); + return pfn( hChangeHandle ); +} + +typedef BOOL WINAPI FN_ReadDirectoryChangesW( HANDLE hDirectory, LPVOID lpBuffer, DWORD nBufferLength, BOOL bWatchSubtree, DWORD dwNotifyFilter, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadDirectoryChangesW( HANDLE hDirectory, LPVOID lpBuffer, DWORD nBufferLength, BOOL bWatchSubtree, DWORD dwNotifyFilter, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped, LPOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine ) +{ + static FN_ReadDirectoryChangesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadDirectoryChangesW", &g_Kernel32); + return pfn( hDirectory, lpBuffer, nBufferLength, bWatchSubtree, dwNotifyFilter, lpBytesReturned, lpOverlapped, lpCompletionRoutine ); +} + +typedef BOOL WINAPI FN_VirtualLock( LPVOID lpAddress, SIZE_T dwSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualLock( LPVOID lpAddress, SIZE_T dwSize ) +{ + static FN_VirtualLock *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VirtualLock", &g_Kernel32); + return pfn( lpAddress, dwSize ); +} + +typedef BOOL WINAPI FN_VirtualUnlock( LPVOID lpAddress, SIZE_T dwSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_VirtualUnlock( LPVOID lpAddress, SIZE_T dwSize ) +{ + static FN_VirtualUnlock *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VirtualUnlock", &g_Kernel32); + return pfn( lpAddress, dwSize ); +} + +typedef LPVOID WINAPI FN_MapViewOfFileEx( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress ); +__declspec(dllexport) LPVOID WINAPI kPrf2Wrap_MapViewOfFileEx( HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress ) +{ + static FN_MapViewOfFileEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MapViewOfFileEx", &g_Kernel32); + return pfn( hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh, dwFileOffsetLow, dwNumberOfBytesToMap, lpBaseAddress ); +} + +typedef BOOL WINAPI FN_SetPriorityClass( HANDLE hProcess, DWORD dwPriorityClass ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetPriorityClass( HANDLE hProcess, DWORD dwPriorityClass ) +{ + static FN_SetPriorityClass *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetPriorityClass", &g_Kernel32); + return pfn( hProcess, dwPriorityClass ); +} + +typedef DWORD WINAPI FN_GetPriorityClass( HANDLE hProcess ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetPriorityClass( HANDLE hProcess ) +{ + static FN_GetPriorityClass *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetPriorityClass", &g_Kernel32); + return pfn( hProcess ); +} + +typedef BOOL WINAPI FN_IsBadReadPtr( CONST VOID * lp, UINT_PTR ucb ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadReadPtr( CONST VOID * lp, UINT_PTR ucb ) +{ + static FN_IsBadReadPtr *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsBadReadPtr", &g_Kernel32); + return pfn( lp, ucb ); +} + +typedef BOOL WINAPI FN_IsBadWritePtr( LPVOID lp, UINT_PTR ucb ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadWritePtr( LPVOID lp, UINT_PTR ucb ) +{ + static FN_IsBadWritePtr *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsBadWritePtr", &g_Kernel32); + return pfn( lp, ucb ); +} + +typedef BOOL WINAPI FN_IsBadHugeReadPtr( CONST VOID * lp, UINT_PTR ucb ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadHugeReadPtr( CONST VOID * lp, UINT_PTR ucb ) +{ + static FN_IsBadHugeReadPtr *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsBadHugeReadPtr", &g_Kernel32); + return pfn( lp, ucb ); +} + +typedef BOOL WINAPI FN_IsBadHugeWritePtr( LPVOID lp, UINT_PTR ucb ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadHugeWritePtr( LPVOID lp, UINT_PTR ucb ) +{ + static FN_IsBadHugeWritePtr *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsBadHugeWritePtr", &g_Kernel32); + return pfn( lp, ucb ); +} + +typedef BOOL WINAPI FN_IsBadCodePtr( FARPROC lpfn ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadCodePtr( FARPROC lpfn ) +{ + static FN_IsBadCodePtr *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsBadCodePtr", &g_Kernel32); + return pfn( lpfn ); +} + +typedef BOOL WINAPI FN_IsBadStringPtrA( LPCSTR lpsz, UINT_PTR ucchMax ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadStringPtrA( LPCSTR lpsz, UINT_PTR ucchMax ) +{ + static FN_IsBadStringPtrA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsBadStringPtrA", &g_Kernel32); + return pfn( lpsz, ucchMax ); +} + +typedef BOOL WINAPI FN_IsBadStringPtrW( LPCWSTR lpsz, UINT_PTR ucchMax ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsBadStringPtrW( LPCWSTR lpsz, UINT_PTR ucchMax ) +{ + static FN_IsBadStringPtrW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsBadStringPtrW", &g_Kernel32); + return pfn( lpsz, ucchMax ); +} + +typedef BOOL WINAPI FN_LookupAccountSidA( LPCSTR lpSystemName, PSID Sid, LPSTR Name, LPDWORD cchName, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupAccountSidA( LPCSTR lpSystemName, PSID Sid, LPSTR Name, LPDWORD cchName, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ) +{ + static FN_LookupAccountSidA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LookupAccountSidA", &g_Kernel32); + return pfn( lpSystemName, Sid, Name, cchName, ReferencedDomainName, cchReferencedDomainName, peUse ); +} + +typedef BOOL WINAPI FN_LookupAccountSidW( LPCWSTR lpSystemName, PSID Sid, LPWSTR Name, LPDWORD cchName, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupAccountSidW( LPCWSTR lpSystemName, PSID Sid, LPWSTR Name, LPDWORD cchName, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ) +{ + static FN_LookupAccountSidW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LookupAccountSidW", &g_Kernel32); + return pfn( lpSystemName, Sid, Name, cchName, ReferencedDomainName, cchReferencedDomainName, peUse ); +} + +typedef BOOL WINAPI FN_LookupAccountNameA( LPCSTR lpSystemName, LPCSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupAccountNameA( LPCSTR lpSystemName, LPCSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ) +{ + static FN_LookupAccountNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LookupAccountNameA", &g_Kernel32); + return pfn( lpSystemName, lpAccountName, Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse ); +} + +typedef BOOL WINAPI FN_LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, LPDWORD cbSid, LPWSTR ReferencedDomainName, LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ) +{ + static FN_LookupAccountNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LookupAccountNameW", &g_Kernel32); + return pfn( lpSystemName, lpAccountName, Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse ); +} + +typedef BOOL WINAPI FN_LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeValueA( LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid ) +{ + static FN_LookupPrivilegeValueA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeValueA", &g_Kernel32); + return pfn( lpSystemName, lpName, lpLuid ); +} + +typedef BOOL WINAPI FN_LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeValueW( LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid ) +{ + static FN_LookupPrivilegeValueW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeValueW", &g_Kernel32); + return pfn( lpSystemName, lpName, lpLuid ); +} + +typedef BOOL WINAPI FN_LookupPrivilegeNameA( LPCSTR lpSystemName, PLUID lpLuid, LPSTR lpName, LPDWORD cchName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeNameA( LPCSTR lpSystemName, PLUID lpLuid, LPSTR lpName, LPDWORD cchName ) +{ + static FN_LookupPrivilegeNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeNameA", &g_Kernel32); + return pfn( lpSystemName, lpLuid, lpName, cchName ); +} + +typedef BOOL WINAPI FN_LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName, LPDWORD cchName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeNameW( LPCWSTR lpSystemName, PLUID lpLuid, LPWSTR lpName, LPDWORD cchName ) +{ + static FN_LookupPrivilegeNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeNameW", &g_Kernel32); + return pfn( lpSystemName, lpLuid, lpName, cchName ); +} + +typedef BOOL WINAPI FN_LookupPrivilegeDisplayNameA( LPCSTR lpSystemName, LPCSTR lpName, LPSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeDisplayNameA( LPCSTR lpSystemName, LPCSTR lpName, LPSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId ) +{ + static FN_LookupPrivilegeDisplayNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeDisplayNameA", &g_Kernel32); + return pfn( lpSystemName, lpName, lpDisplayName, cchDisplayName, lpLanguageId ); +} + +typedef BOOL WINAPI FN_LookupPrivilegeDisplayNameW( LPCWSTR lpSystemName, LPCWSTR lpName, LPWSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LookupPrivilegeDisplayNameW( LPCWSTR lpSystemName, LPCWSTR lpName, LPWSTR lpDisplayName, LPDWORD cchDisplayName, LPDWORD lpLanguageId ) +{ + static FN_LookupPrivilegeDisplayNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LookupPrivilegeDisplayNameW", &g_Kernel32); + return pfn( lpSystemName, lpName, lpDisplayName, cchDisplayName, lpLanguageId ); +} + +typedef BOOL WINAPI FN_AllocateLocallyUniqueId( PLUID Luid ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AllocateLocallyUniqueId( PLUID Luid ) +{ + static FN_AllocateLocallyUniqueId *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AllocateLocallyUniqueId", &g_Kernel32); + return pfn( Luid ); +} + +typedef BOOL WINAPI FN_BuildCommDCBA( LPCSTR lpDef, LPDCB lpDCB ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_BuildCommDCBA( LPCSTR lpDef, LPDCB lpDCB ) +{ + static FN_BuildCommDCBA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BuildCommDCBA", &g_Kernel32); + return pfn( lpDef, lpDCB ); +} + +typedef BOOL WINAPI FN_BuildCommDCBW( LPCWSTR lpDef, LPDCB lpDCB ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_BuildCommDCBW( LPCWSTR lpDef, LPDCB lpDCB ) +{ + static FN_BuildCommDCBW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BuildCommDCBW", &g_Kernel32); + return pfn( lpDef, lpDCB ); +} + +typedef BOOL WINAPI FN_BuildCommDCBAndTimeoutsA( LPCSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_BuildCommDCBAndTimeoutsA( LPCSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts ) +{ + static FN_BuildCommDCBAndTimeoutsA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BuildCommDCBAndTimeoutsA", &g_Kernel32); + return pfn( lpDef, lpDCB, lpCommTimeouts ); +} + +typedef BOOL WINAPI FN_BuildCommDCBAndTimeoutsW( LPCWSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_BuildCommDCBAndTimeoutsW( LPCWSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts ) +{ + static FN_BuildCommDCBAndTimeoutsW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BuildCommDCBAndTimeoutsW", &g_Kernel32); + return pfn( lpDef, lpDCB, lpCommTimeouts ); +} + +typedef BOOL WINAPI FN_CommConfigDialogA( LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CommConfigDialogA( LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC ) +{ + static FN_CommConfigDialogA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CommConfigDialogA", &g_Kernel32); + return pfn( lpszName, hWnd, lpCC ); +} + +typedef BOOL WINAPI FN_CommConfigDialogW( LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CommConfigDialogW( LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC ) +{ + static FN_CommConfigDialogW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CommConfigDialogW", &g_Kernel32); + return pfn( lpszName, hWnd, lpCC ); +} + +typedef BOOL WINAPI FN_GetDefaultCommConfigA( LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDefaultCommConfigA( LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ) +{ + static FN_GetDefaultCommConfigA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDefaultCommConfigA", &g_Kernel32); + return pfn( lpszName, lpCC, lpdwSize ); +} + +typedef BOOL WINAPI FN_GetDefaultCommConfigW( LPCWSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetDefaultCommConfigW( LPCWSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize ) +{ + static FN_GetDefaultCommConfigW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDefaultCommConfigW", &g_Kernel32); + return pfn( lpszName, lpCC, lpdwSize ); +} + +typedef BOOL WINAPI FN_SetDefaultCommConfigA( LPCSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetDefaultCommConfigA( LPCSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize ) +{ + static FN_SetDefaultCommConfigA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetDefaultCommConfigA", &g_Kernel32); + return pfn( lpszName, lpCC, dwSize ); +} + +typedef BOOL WINAPI FN_SetDefaultCommConfigW( LPCWSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetDefaultCommConfigW( LPCWSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize ) +{ + static FN_SetDefaultCommConfigW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetDefaultCommConfigW", &g_Kernel32); + return pfn( lpszName, lpCC, dwSize ); +} + +typedef BOOL WINAPI FN_GetComputerNameA( LPSTR lpBuffer, LPDWORD nSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetComputerNameA( LPSTR lpBuffer, LPDWORD nSize ) +{ + static FN_GetComputerNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetComputerNameA", &g_Kernel32); + return pfn( lpBuffer, nSize ); +} + +typedef BOOL WINAPI FN_GetComputerNameW( LPWSTR lpBuffer, LPDWORD nSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetComputerNameW( LPWSTR lpBuffer, LPDWORD nSize ) +{ + static FN_GetComputerNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetComputerNameW", &g_Kernel32); + return pfn( lpBuffer, nSize ); +} + +typedef BOOL WINAPI FN_SetComputerNameA( LPCSTR lpComputerName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetComputerNameA( LPCSTR lpComputerName ) +{ + static FN_SetComputerNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetComputerNameA", &g_Kernel32); + return pfn( lpComputerName ); +} + +typedef BOOL WINAPI FN_SetComputerNameW( LPCWSTR lpComputerName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetComputerNameW( LPCWSTR lpComputerName ) +{ + static FN_SetComputerNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetComputerNameW", &g_Kernel32); + return pfn( lpComputerName ); +} + +typedef BOOL WINAPI FN_GetComputerNameExA( COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD nSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetComputerNameExA( COMPUTER_NAME_FORMAT NameType, LPSTR lpBuffer, LPDWORD nSize ) +{ + static FN_GetComputerNameExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetComputerNameExA", &g_Kernel32); + return pfn( NameType, lpBuffer, nSize ); +} + +typedef BOOL WINAPI FN_GetComputerNameExW( COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetComputerNameExW( COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize ) +{ + static FN_GetComputerNameExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetComputerNameExW", &g_Kernel32); + return pfn( NameType, lpBuffer, nSize ); +} + +typedef BOOL WINAPI FN_SetComputerNameExA( COMPUTER_NAME_FORMAT NameType, LPCSTR lpBuffer ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetComputerNameExA( COMPUTER_NAME_FORMAT NameType, LPCSTR lpBuffer ) +{ + static FN_SetComputerNameExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetComputerNameExA", &g_Kernel32); + return pfn( NameType, lpBuffer ); +} + +typedef BOOL WINAPI FN_SetComputerNameExW( COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetComputerNameExW( COMPUTER_NAME_FORMAT NameType, LPCWSTR lpBuffer ) +{ + static FN_SetComputerNameExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetComputerNameExW", &g_Kernel32); + return pfn( NameType, lpBuffer ); +} + +typedef BOOL WINAPI FN_DnsHostnameToComputerNameA( LPCSTR Hostname, LPSTR ComputerName, LPDWORD nSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DnsHostnameToComputerNameA( LPCSTR Hostname, LPSTR ComputerName, LPDWORD nSize ) +{ + static FN_DnsHostnameToComputerNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DnsHostnameToComputerNameA", &g_Kernel32); + return pfn( Hostname, ComputerName, nSize ); +} + +typedef BOOL WINAPI FN_DnsHostnameToComputerNameW( LPCWSTR Hostname, LPWSTR ComputerName, LPDWORD nSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DnsHostnameToComputerNameW( LPCWSTR Hostname, LPWSTR ComputerName, LPDWORD nSize ) +{ + static FN_DnsHostnameToComputerNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DnsHostnameToComputerNameW", &g_Kernel32); + return pfn( Hostname, ComputerName, nSize ); +} + +typedef BOOL WINAPI FN_GetUserNameA( LPSTR lpBuffer, LPDWORD pcbBuffer ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetUserNameA( LPSTR lpBuffer, LPDWORD pcbBuffer ) +{ + static FN_GetUserNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetUserNameA", &g_Kernel32); + return pfn( lpBuffer, pcbBuffer ); +} + +typedef BOOL WINAPI FN_GetUserNameW( LPWSTR lpBuffer, LPDWORD pcbBuffer ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetUserNameW( LPWSTR lpBuffer, LPDWORD pcbBuffer ) +{ + static FN_GetUserNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetUserNameW", &g_Kernel32); + return pfn( lpBuffer, pcbBuffer ); +} + +typedef BOOL WINAPI FN_LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ) +{ + static FN_LogonUserA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LogonUserA", &g_Kernel32); + return pfn( lpszUsername, lpszDomain, lpszPassword, dwLogonType, dwLogonProvider, phToken ); +} + +typedef BOOL WINAPI FN_LogonUserW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LogonUserW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ) +{ + static FN_LogonUserW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LogonUserW", &g_Kernel32); + return pfn( lpszUsername, lpszDomain, lpszPassword, dwLogonType, dwLogonProvider, phToken ); +} + +typedef BOOL WINAPI FN_LogonUserExA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID * ppLogonSid, PVOID * ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LogonUserExA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID * ppLogonSid, PVOID * ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits ) +{ + static FN_LogonUserExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LogonUserExA", &g_Kernel32); + return pfn( lpszUsername, lpszDomain, lpszPassword, dwLogonType, dwLogonProvider, phToken, ppLogonSid, ppProfileBuffer, pdwProfileLength, pQuotaLimits ); +} + +typedef BOOL WINAPI FN_LogonUserExW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID * ppLogonSid, PVOID * ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_LogonUserExW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken, PSID * ppLogonSid, PVOID * ppProfileBuffer, LPDWORD pdwProfileLength, PQUOTA_LIMITS pQuotaLimits ) +{ + static FN_LogonUserExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LogonUserExW", &g_Kernel32); + return pfn( lpszUsername, lpszDomain, lpszPassword, dwLogonType, dwLogonProvider, phToken, ppLogonSid, ppProfileBuffer, pdwProfileLength, pQuotaLimits ); +} + +typedef BOOL WINAPI FN_ImpersonateLoggedOnUser( HANDLE hToken ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ImpersonateLoggedOnUser( HANDLE hToken ) +{ + static FN_ImpersonateLoggedOnUser *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ImpersonateLoggedOnUser", &g_Kernel32); + return pfn( hToken ); +} + +typedef BOOL WINAPI FN_CreateProcessAsUserA( HANDLE hToken, LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessAsUserA( HANDLE hToken, LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) +{ + static FN_CreateProcessAsUserA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateProcessAsUserA", &g_Kernel32); + return pfn( hToken, lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); +} + +typedef BOOL WINAPI FN_CreateProcessAsUserW( HANDLE hToken, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessAsUserW( HANDLE hToken, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) +{ + static FN_CreateProcessAsUserW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateProcessAsUserW", &g_Kernel32); + return pfn( hToken, lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); +} + +typedef BOOL WINAPI FN_CreateProcessWithLogonW( LPCWSTR lpUsername, LPCWSTR lpDomain, LPCWSTR lpPassword, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessWithLogonW( LPCWSTR lpUsername, LPCWSTR lpDomain, LPCWSTR lpPassword, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) +{ + static FN_CreateProcessWithLogonW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateProcessWithLogonW", &g_Kernel32); + return pfn( lpUsername, lpDomain, lpPassword, dwLogonFlags, lpApplicationName, lpCommandLine, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); +} + +typedef BOOL WINAPI FN_CreateProcessWithTokenW( HANDLE hToken, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateProcessWithTokenW( HANDLE hToken, DWORD dwLogonFlags, LPCWSTR lpApplicationName, LPWSTR lpCommandLine, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation ) +{ + static FN_CreateProcessWithTokenW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateProcessWithTokenW", &g_Kernel32); + return pfn( hToken, dwLogonFlags, lpApplicationName, lpCommandLine, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation ); +} + +typedef BOOL APIENTRY FN_ImpersonateAnonymousToken( HANDLE ThreadHandle ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_ImpersonateAnonymousToken( HANDLE ThreadHandle ) +{ + static FN_ImpersonateAnonymousToken *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ImpersonateAnonymousToken", &g_Kernel32); + return pfn( ThreadHandle ); +} + +typedef BOOL WINAPI FN_DuplicateTokenEx( HANDLE hExistingToken, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, PHANDLE phNewToken ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DuplicateTokenEx( HANDLE hExistingToken, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, PHANDLE phNewToken ) +{ + static FN_DuplicateTokenEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DuplicateTokenEx", &g_Kernel32); + return pfn( hExistingToken, dwDesiredAccess, lpTokenAttributes, ImpersonationLevel, TokenType, phNewToken ); +} + +typedef BOOL APIENTRY FN_CreateRestrictedToken( HANDLE ExistingTokenHandle, DWORD Flags, DWORD DisableSidCount, PSID_AND_ATTRIBUTES SidsToDisable, DWORD DeletePrivilegeCount, PLUID_AND_ATTRIBUTES PrivilegesToDelete, DWORD RestrictedSidCount, PSID_AND_ATTRIBUTES SidsToRestrict, PHANDLE NewTokenHandle ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_CreateRestrictedToken( HANDLE ExistingTokenHandle, DWORD Flags, DWORD DisableSidCount, PSID_AND_ATTRIBUTES SidsToDisable, DWORD DeletePrivilegeCount, PLUID_AND_ATTRIBUTES PrivilegesToDelete, DWORD RestrictedSidCount, PSID_AND_ATTRIBUTES SidsToRestrict, PHANDLE NewTokenHandle ) +{ + static FN_CreateRestrictedToken *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateRestrictedToken", &g_Kernel32); + return pfn( ExistingTokenHandle, Flags, DisableSidCount, SidsToDisable, DeletePrivilegeCount, PrivilegesToDelete, RestrictedSidCount, SidsToRestrict, NewTokenHandle ); +} + +typedef BOOL WINAPI FN_IsTokenRestricted( HANDLE TokenHandle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsTokenRestricted( HANDLE TokenHandle ) +{ + static FN_IsTokenRestricted *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsTokenRestricted", &g_Kernel32); + return pfn( TokenHandle ); +} + +typedef BOOL WINAPI FN_IsTokenUntrusted( HANDLE TokenHandle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsTokenUntrusted( HANDLE TokenHandle ) +{ + static FN_IsTokenUntrusted *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsTokenUntrusted", &g_Kernel32); + return pfn( TokenHandle ); +} + +typedef BOOL APIENTRY FN_CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_CheckTokenMembership( HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember ) +{ + static FN_CheckTokenMembership *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CheckTokenMembership", &g_Kernel32); + return pfn( TokenHandle, SidToCheck, IsMember ); +} + +typedef BOOL WINAPI FN_RegisterWaitForSingleObject( PHANDLE phNewWaitObject, HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_RegisterWaitForSingleObject( PHANDLE phNewWaitObject, HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags ) +{ + static FN_RegisterWaitForSingleObject *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RegisterWaitForSingleObject", &g_Kernel32); + return pfn( phNewWaitObject, hObject, Callback, Context, dwMilliseconds, dwFlags ); +} + +typedef HANDLE WINAPI FN_RegisterWaitForSingleObjectEx( HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_RegisterWaitForSingleObjectEx( HANDLE hObject, WAITORTIMERCALLBACK Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags ) +{ + static FN_RegisterWaitForSingleObjectEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RegisterWaitForSingleObjectEx", &g_Kernel32); + return pfn( hObject, Callback, Context, dwMilliseconds, dwFlags ); +} + +typedef BOOL WINAPI FN_UnregisterWait( HANDLE WaitHandle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_UnregisterWait( HANDLE WaitHandle ) +{ + static FN_UnregisterWait *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "UnregisterWait", &g_Kernel32); + return pfn( WaitHandle ); +} + +typedef BOOL WINAPI FN_UnregisterWaitEx( HANDLE WaitHandle, HANDLE CompletionEvent ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_UnregisterWaitEx( HANDLE WaitHandle, HANDLE CompletionEvent ) +{ + static FN_UnregisterWaitEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "UnregisterWaitEx", &g_Kernel32); + return pfn( WaitHandle, CompletionEvent ); +} + +typedef BOOL WINAPI FN_QueueUserWorkItem( LPTHREAD_START_ROUTINE Function, PVOID Context, ULONG Flags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueueUserWorkItem( LPTHREAD_START_ROUTINE Function, PVOID Context, ULONG Flags ) +{ + static FN_QueueUserWorkItem *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "QueueUserWorkItem", &g_Kernel32); + return pfn( Function, Context, Flags ); +} + +typedef BOOL WINAPI FN_BindIoCompletionCallback( HANDLE FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function, ULONG Flags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_BindIoCompletionCallback( HANDLE FileHandle, LPOVERLAPPED_COMPLETION_ROUTINE Function, ULONG Flags ) +{ + static FN_BindIoCompletionCallback *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "BindIoCompletionCallback", &g_Kernel32); + return pfn( FileHandle, Function, Flags ); +} + +typedef HANDLE WINAPI FN_CreateTimerQueue( VOID ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateTimerQueue( VOID ) +{ + static FN_CreateTimerQueue *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateTimerQueue", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_CreateTimerQueueTimer( PHANDLE phNewTimer, HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, ULONG Flags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateTimerQueueTimer( PHANDLE phNewTimer, HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, ULONG Flags ) +{ + static FN_CreateTimerQueueTimer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateTimerQueueTimer", &g_Kernel32); + return pfn( phNewTimer, TimerQueue, Callback, Parameter, DueTime, Period, Flags ); +} + +typedef BOOL WINAPI FN_ChangeTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer, ULONG DueTime, ULONG Period ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ChangeTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer, ULONG DueTime, ULONG Period ) +{ + static FN_ChangeTimerQueueTimer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ChangeTimerQueueTimer", &g_Kernel32); + return pfn( TimerQueue, Timer, DueTime, Period ); +} + +typedef BOOL WINAPI FN_DeleteTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer, HANDLE CompletionEvent ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer, HANDLE CompletionEvent ) +{ + static FN_DeleteTimerQueueTimer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteTimerQueueTimer", &g_Kernel32); + return pfn( TimerQueue, Timer, CompletionEvent ); +} + +typedef BOOL WINAPI FN_DeleteTimerQueueEx( HANDLE TimerQueue, HANDLE CompletionEvent ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteTimerQueueEx( HANDLE TimerQueue, HANDLE CompletionEvent ) +{ + static FN_DeleteTimerQueueEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteTimerQueueEx", &g_Kernel32); + return pfn( TimerQueue, CompletionEvent ); +} + +typedef HANDLE WINAPI FN_SetTimerQueueTimer( HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, BOOL PreferIo ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_SetTimerQueueTimer( HANDLE TimerQueue, WAITORTIMERCALLBACK Callback, PVOID Parameter, DWORD DueTime, DWORD Period, BOOL PreferIo ) +{ + static FN_SetTimerQueueTimer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetTimerQueueTimer", &g_Kernel32); + return pfn( TimerQueue, Callback, Parameter, DueTime, Period, PreferIo ); +} + +typedef BOOL WINAPI FN_CancelTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CancelTimerQueueTimer( HANDLE TimerQueue, HANDLE Timer ) +{ + static FN_CancelTimerQueueTimer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CancelTimerQueueTimer", &g_Kernel32); + return pfn( TimerQueue, Timer ); +} + +typedef BOOL WINAPI FN_DeleteTimerQueue( HANDLE TimerQueue ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteTimerQueue( HANDLE TimerQueue ) +{ + static FN_DeleteTimerQueue *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteTimerQueue", &g_Kernel32); + return pfn( TimerQueue ); +} + +typedef BOOL WINAPI FN_GetCurrentHwProfileA( LPHW_PROFILE_INFOA lpHwProfileInfo ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCurrentHwProfileA( LPHW_PROFILE_INFOA lpHwProfileInfo ) +{ + static FN_GetCurrentHwProfileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentHwProfileA", &g_Kernel32); + return pfn( lpHwProfileInfo ); +} + +typedef BOOL WINAPI FN_GetCurrentHwProfileW( LPHW_PROFILE_INFOW lpHwProfileInfo ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCurrentHwProfileW( LPHW_PROFILE_INFOW lpHwProfileInfo ) +{ + static FN_GetCurrentHwProfileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentHwProfileW", &g_Kernel32); + return pfn( lpHwProfileInfo ); +} + +typedef BOOL WINAPI FN_QueryPerformanceCounter( LARGE_INTEGER * lpPerformanceCount ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueryPerformanceCounter( LARGE_INTEGER * lpPerformanceCount ) +{ + static FN_QueryPerformanceCounter *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "QueryPerformanceCounter", &g_Kernel32); + return pfn( lpPerformanceCount ); +} + +typedef BOOL WINAPI FN_QueryPerformanceFrequency( LARGE_INTEGER * lpFrequency ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueryPerformanceFrequency( LARGE_INTEGER * lpFrequency ) +{ + static FN_QueryPerformanceFrequency *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "QueryPerformanceFrequency", &g_Kernel32); + return pfn( lpFrequency ); +} + +typedef BOOL WINAPI FN_GetVersionExA( LPOSVERSIONINFOA lpVersionInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVersionExA( LPOSVERSIONINFOA lpVersionInformation ) +{ + static FN_GetVersionExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVersionExA", &g_Kernel32); + return pfn( lpVersionInformation ); +} + +typedef BOOL WINAPI FN_GetVersionExW( LPOSVERSIONINFOW lpVersionInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVersionExW( LPOSVERSIONINFOW lpVersionInformation ) +{ + static FN_GetVersionExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVersionExW", &g_Kernel32); + return pfn( lpVersionInformation ); +} + +typedef BOOL WINAPI FN_VerifyVersionInfoA( LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_VerifyVersionInfoA( LPOSVERSIONINFOEXA lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask ) +{ + static FN_VerifyVersionInfoA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerifyVersionInfoA", &g_Kernel32); + return pfn( lpVersionInformation, dwTypeMask, dwlConditionMask ); +} + +typedef BOOL WINAPI FN_VerifyVersionInfoW( LPOSVERSIONINFOEXW lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_VerifyVersionInfoW( LPOSVERSIONINFOEXW lpVersionInformation, DWORD dwTypeMask, DWORDLONG dwlConditionMask ) +{ + static FN_VerifyVersionInfoW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerifyVersionInfoW", &g_Kernel32); + return pfn( lpVersionInformation, dwTypeMask, dwlConditionMask ); +} + +typedef BOOL WINAPI FN_GetSystemPowerStatus( LPSYSTEM_POWER_STATUS lpSystemPowerStatus ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetSystemPowerStatus( LPSYSTEM_POWER_STATUS lpSystemPowerStatus ) +{ + static FN_GetSystemPowerStatus *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemPowerStatus", &g_Kernel32); + return pfn( lpSystemPowerStatus ); +} + +typedef BOOL WINAPI FN_SetSystemPowerState( BOOL fSuspend, BOOL fForce ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetSystemPowerState( BOOL fSuspend, BOOL fForce ) +{ + static FN_SetSystemPowerState *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetSystemPowerState", &g_Kernel32); + return pfn( fSuspend, fForce ); +} + +typedef BOOL WINAPI FN_AllocateUserPhysicalPages( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AllocateUserPhysicalPages( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray ) +{ + static FN_AllocateUserPhysicalPages *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AllocateUserPhysicalPages", &g_Kernel32); + return pfn( hProcess, NumberOfPages, PageArray ); +} + +typedef BOOL WINAPI FN_FreeUserPhysicalPages( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeUserPhysicalPages( HANDLE hProcess, PULONG_PTR NumberOfPages, PULONG_PTR PageArray ) +{ + static FN_FreeUserPhysicalPages *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FreeUserPhysicalPages", &g_Kernel32); + return pfn( hProcess, NumberOfPages, PageArray ); +} + +typedef BOOL WINAPI FN_MapUserPhysicalPages( PVOID VirtualAddress, ULONG_PTR NumberOfPages, PULONG_PTR PageArray ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MapUserPhysicalPages( PVOID VirtualAddress, ULONG_PTR NumberOfPages, PULONG_PTR PageArray ) +{ + static FN_MapUserPhysicalPages *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MapUserPhysicalPages", &g_Kernel32); + return pfn( VirtualAddress, NumberOfPages, PageArray ); +} + +typedef BOOL WINAPI FN_MapUserPhysicalPagesScatter( PVOID * VirtualAddresses, ULONG_PTR NumberOfPages, PULONG_PTR PageArray ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_MapUserPhysicalPagesScatter( PVOID * VirtualAddresses, ULONG_PTR NumberOfPages, PULONG_PTR PageArray ) +{ + static FN_MapUserPhysicalPagesScatter *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MapUserPhysicalPagesScatter", &g_Kernel32); + return pfn( VirtualAddresses, NumberOfPages, PageArray ); +} + +typedef HANDLE WINAPI FN_CreateJobObjectA( LPSECURITY_ATTRIBUTES lpJobAttributes, LPCSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateJobObjectA( LPSECURITY_ATTRIBUTES lpJobAttributes, LPCSTR lpName ) +{ + static FN_CreateJobObjectA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateJobObjectA", &g_Kernel32); + return pfn( lpJobAttributes, lpName ); +} + +typedef HANDLE WINAPI FN_CreateJobObjectW( LPSECURITY_ATTRIBUTES lpJobAttributes, LPCWSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateJobObjectW( LPSECURITY_ATTRIBUTES lpJobAttributes, LPCWSTR lpName ) +{ + static FN_CreateJobObjectW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateJobObjectW", &g_Kernel32); + return pfn( lpJobAttributes, lpName ); +} + +typedef HANDLE WINAPI FN_OpenJobObjectA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenJobObjectA( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName ) +{ + static FN_OpenJobObjectA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenJobObjectA", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpName ); +} + +typedef HANDLE WINAPI FN_OpenJobObjectW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_OpenJobObjectW( DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName ) +{ + static FN_OpenJobObjectW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "OpenJobObjectW", &g_Kernel32); + return pfn( dwDesiredAccess, bInheritHandle, lpName ); +} + +typedef BOOL WINAPI FN_AssignProcessToJobObject( HANDLE hJob, HANDLE hProcess ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AssignProcessToJobObject( HANDLE hJob, HANDLE hProcess ) +{ + static FN_AssignProcessToJobObject *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AssignProcessToJobObject", &g_Kernel32); + return pfn( hJob, hProcess ); +} + +typedef BOOL WINAPI FN_TerminateJobObject( HANDLE hJob, UINT uExitCode ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_TerminateJobObject( HANDLE hJob, UINT uExitCode ) +{ + static FN_TerminateJobObject *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "TerminateJobObject", &g_Kernel32); + return pfn( hJob, uExitCode ); +} + +typedef BOOL WINAPI FN_QueryInformationJobObject( HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength, LPDWORD lpReturnLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueryInformationJobObject( HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength, LPDWORD lpReturnLength ) +{ + static FN_QueryInformationJobObject *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "QueryInformationJobObject", &g_Kernel32); + return pfn( hJob, JobObjectInformationClass, lpJobObjectInformation, cbJobObjectInformationLength, lpReturnLength ); +} + +typedef BOOL WINAPI FN_SetInformationJobObject( HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetInformationJobObject( HANDLE hJob, JOBOBJECTINFOCLASS JobObjectInformationClass, LPVOID lpJobObjectInformation, DWORD cbJobObjectInformationLength ) +{ + static FN_SetInformationJobObject *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetInformationJobObject", &g_Kernel32); + return pfn( hJob, JobObjectInformationClass, lpJobObjectInformation, cbJobObjectInformationLength ); +} + +typedef BOOL WINAPI FN_IsProcessInJob( HANDLE ProcessHandle, HANDLE JobHandle, PBOOL Result ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsProcessInJob( HANDLE ProcessHandle, HANDLE JobHandle, PBOOL Result ) +{ + static FN_IsProcessInJob *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsProcessInJob", &g_Kernel32); + return pfn( ProcessHandle, JobHandle, Result ); +} + +typedef BOOL WINAPI FN_CreateJobSet( ULONG NumJob, PJOB_SET_ARRAY UserJobSet, ULONG Flags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_CreateJobSet( ULONG NumJob, PJOB_SET_ARRAY UserJobSet, ULONG Flags ) +{ + static FN_CreateJobSet *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateJobSet", &g_Kernel32); + return pfn( NumJob, UserJobSet, Flags ); +} + +typedef PVOID WINAPI FN_AddVectoredExceptionHandler( ULONG First, PVECTORED_EXCEPTION_HANDLER Handler ); +__declspec(dllexport) PVOID WINAPI kPrf2Wrap_AddVectoredExceptionHandler( ULONG First, PVECTORED_EXCEPTION_HANDLER Handler ) +{ + static FN_AddVectoredExceptionHandler *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddVectoredExceptionHandler", &g_Kernel32); + return pfn( First, Handler ); +} + +typedef ULONG WINAPI FN_RemoveVectoredExceptionHandler( PVOID Handle ); +__declspec(dllexport) ULONG WINAPI kPrf2Wrap_RemoveVectoredExceptionHandler( PVOID Handle ) +{ + static FN_RemoveVectoredExceptionHandler *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RemoveVectoredExceptionHandler", &g_Kernel32); + return pfn( Handle ); +} + +typedef PVOID WINAPI FN_AddVectoredContinueHandler( ULONG First, PVECTORED_EXCEPTION_HANDLER Handler ); +__declspec(dllexport) PVOID WINAPI kPrf2Wrap_AddVectoredContinueHandler( ULONG First, PVECTORED_EXCEPTION_HANDLER Handler ) +{ + static FN_AddVectoredContinueHandler *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddVectoredContinueHandler", &g_Kernel32); + return pfn( First, Handler ); +} + +typedef ULONG WINAPI FN_RemoveVectoredContinueHandler( PVOID Handle ); +__declspec(dllexport) ULONG WINAPI kPrf2Wrap_RemoveVectoredContinueHandler( PVOID Handle ) +{ + static FN_RemoveVectoredContinueHandler *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RemoveVectoredContinueHandler", &g_Kernel32); + return pfn( Handle ); +} + +typedef HANDLE WINAPI FN_FindFirstVolumeA( LPSTR lpszVolumeName, DWORD cchBufferLength ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstVolumeA( LPSTR lpszVolumeName, DWORD cchBufferLength ) +{ + static FN_FindFirstVolumeA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstVolumeA", &g_Kernel32); + return pfn( lpszVolumeName, cchBufferLength ); +} + +typedef HANDLE WINAPI FN_FindFirstVolumeW( LPWSTR lpszVolumeName, DWORD cchBufferLength ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstVolumeW( LPWSTR lpszVolumeName, DWORD cchBufferLength ) +{ + static FN_FindFirstVolumeW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstVolumeW", &g_Kernel32); + return pfn( lpszVolumeName, cchBufferLength ); +} + +typedef BOOL WINAPI FN_FindNextVolumeA( HANDLE hFindVolume, LPSTR lpszVolumeName, DWORD cchBufferLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextVolumeA( HANDLE hFindVolume, LPSTR lpszVolumeName, DWORD cchBufferLength ) +{ + static FN_FindNextVolumeA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindNextVolumeA", &g_Kernel32); + return pfn( hFindVolume, lpszVolumeName, cchBufferLength ); +} + +typedef BOOL WINAPI FN_FindNextVolumeW( HANDLE hFindVolume, LPWSTR lpszVolumeName, DWORD cchBufferLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextVolumeW( HANDLE hFindVolume, LPWSTR lpszVolumeName, DWORD cchBufferLength ) +{ + static FN_FindNextVolumeW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindNextVolumeW", &g_Kernel32); + return pfn( hFindVolume, lpszVolumeName, cchBufferLength ); +} + +typedef BOOL WINAPI FN_FindVolumeClose( HANDLE hFindVolume ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindVolumeClose( HANDLE hFindVolume ) +{ + static FN_FindVolumeClose *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindVolumeClose", &g_Kernel32); + return pfn( hFindVolume ); +} + +typedef HANDLE WINAPI FN_FindFirstVolumeMountPointA( LPCSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstVolumeMountPointA( LPCSTR lpszRootPathName, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ) +{ + static FN_FindFirstVolumeMountPointA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstVolumeMountPointA", &g_Kernel32); + return pfn( lpszRootPathName, lpszVolumeMountPoint, cchBufferLength ); +} + +typedef HANDLE WINAPI FN_FindFirstVolumeMountPointW( LPCWSTR lpszRootPathName, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_FindFirstVolumeMountPointW( LPCWSTR lpszRootPathName, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ) +{ + static FN_FindFirstVolumeMountPointW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindFirstVolumeMountPointW", &g_Kernel32); + return pfn( lpszRootPathName, lpszVolumeMountPoint, cchBufferLength ); +} + +typedef BOOL WINAPI FN_FindNextVolumeMountPointA( HANDLE hFindVolumeMountPoint, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextVolumeMountPointA( HANDLE hFindVolumeMountPoint, LPSTR lpszVolumeMountPoint, DWORD cchBufferLength ) +{ + static FN_FindNextVolumeMountPointA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindNextVolumeMountPointA", &g_Kernel32); + return pfn( hFindVolumeMountPoint, lpszVolumeMountPoint, cchBufferLength ); +} + +typedef BOOL WINAPI FN_FindNextVolumeMountPointW( HANDLE hFindVolumeMountPoint, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindNextVolumeMountPointW( HANDLE hFindVolumeMountPoint, LPWSTR lpszVolumeMountPoint, DWORD cchBufferLength ) +{ + static FN_FindNextVolumeMountPointW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindNextVolumeMountPointW", &g_Kernel32); + return pfn( hFindVolumeMountPoint, lpszVolumeMountPoint, cchBufferLength ); +} + +typedef BOOL WINAPI FN_FindVolumeMountPointClose( HANDLE hFindVolumeMountPoint ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindVolumeMountPointClose( HANDLE hFindVolumeMountPoint ) +{ + static FN_FindVolumeMountPointClose *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindVolumeMountPointClose", &g_Kernel32); + return pfn( hFindVolumeMountPoint ); +} + +typedef BOOL WINAPI FN_SetVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPCSTR lpszVolumeName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPCSTR lpszVolumeName ) +{ + static FN_SetVolumeMountPointA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetVolumeMountPointA", &g_Kernel32); + return pfn( lpszVolumeMountPoint, lpszVolumeName ); +} + +typedef BOOL WINAPI FN_SetVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPCWSTR lpszVolumeName ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPCWSTR lpszVolumeName ) +{ + static FN_SetVolumeMountPointW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetVolumeMountPointW", &g_Kernel32); + return pfn( lpszVolumeMountPoint, lpszVolumeName ); +} + +typedef BOOL WINAPI FN_DeleteVolumeMountPointA( LPCSTR lpszVolumeMountPoint ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteVolumeMountPointA( LPCSTR lpszVolumeMountPoint ) +{ + static FN_DeleteVolumeMountPointA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteVolumeMountPointA", &g_Kernel32); + return pfn( lpszVolumeMountPoint ); +} + +typedef BOOL WINAPI FN_DeleteVolumeMountPointW( LPCWSTR lpszVolumeMountPoint ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeleteVolumeMountPointW( LPCWSTR lpszVolumeMountPoint ) +{ + static FN_DeleteVolumeMountPointW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeleteVolumeMountPointW", &g_Kernel32); + return pfn( lpszVolumeMountPoint ); +} + +typedef BOOL WINAPI FN_GetVolumeNameForVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPSTR lpszVolumeName, DWORD cchBufferLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumeNameForVolumeMountPointA( LPCSTR lpszVolumeMountPoint, LPSTR lpszVolumeName, DWORD cchBufferLength ) +{ + static FN_GetVolumeNameForVolumeMountPointA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVolumeNameForVolumeMountPointA", &g_Kernel32); + return pfn( lpszVolumeMountPoint, lpszVolumeName, cchBufferLength ); +} + +typedef BOOL WINAPI FN_GetVolumeNameForVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPWSTR lpszVolumeName, DWORD cchBufferLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumeNameForVolumeMountPointW( LPCWSTR lpszVolumeMountPoint, LPWSTR lpszVolumeName, DWORD cchBufferLength ) +{ + static FN_GetVolumeNameForVolumeMountPointW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVolumeNameForVolumeMountPointW", &g_Kernel32); + return pfn( lpszVolumeMountPoint, lpszVolumeName, cchBufferLength ); +} + +typedef BOOL WINAPI FN_GetVolumePathNameA( LPCSTR lpszFileName, LPSTR lpszVolumePathName, DWORD cchBufferLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumePathNameA( LPCSTR lpszFileName, LPSTR lpszVolumePathName, DWORD cchBufferLength ) +{ + static FN_GetVolumePathNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVolumePathNameA", &g_Kernel32); + return pfn( lpszFileName, lpszVolumePathName, cchBufferLength ); +} + +typedef BOOL WINAPI FN_GetVolumePathNameW( LPCWSTR lpszFileName, LPWSTR lpszVolumePathName, DWORD cchBufferLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumePathNameW( LPCWSTR lpszFileName, LPWSTR lpszVolumePathName, DWORD cchBufferLength ) +{ + static FN_GetVolumePathNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVolumePathNameW", &g_Kernel32); + return pfn( lpszFileName, lpszVolumePathName, cchBufferLength ); +} + +typedef BOOL WINAPI FN_GetVolumePathNamesForVolumeNameA( LPCSTR lpszVolumeName, LPCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumePathNamesForVolumeNameA( LPCSTR lpszVolumeName, LPCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength ) +{ + static FN_GetVolumePathNamesForVolumeNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVolumePathNamesForVolumeNameA", &g_Kernel32); + return pfn( lpszVolumeName, lpszVolumePathNames, cchBufferLength, lpcchReturnLength ); +} + +typedef BOOL WINAPI FN_GetVolumePathNamesForVolumeNameW( LPCWSTR lpszVolumeName, LPWCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetVolumePathNamesForVolumeNameW( LPCWSTR lpszVolumeName, LPWCH lpszVolumePathNames, DWORD cchBufferLength, PDWORD lpcchReturnLength ) +{ + static FN_GetVolumePathNamesForVolumeNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetVolumePathNamesForVolumeNameW", &g_Kernel32); + return pfn( lpszVolumeName, lpszVolumePathNames, cchBufferLength, lpcchReturnLength ); +} + +typedef HANDLE WINAPI FN_CreateActCtxA( PCACTCTXA pActCtx ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateActCtxA( PCACTCTXA pActCtx ) +{ + static FN_CreateActCtxA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateActCtxA", &g_Kernel32); + return pfn( pActCtx ); +} + +typedef HANDLE WINAPI FN_CreateActCtxW( PCACTCTXW pActCtx ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateActCtxW( PCACTCTXW pActCtx ) +{ + static FN_CreateActCtxW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateActCtxW", &g_Kernel32); + return pfn( pActCtx ); +} + +typedef VOID WINAPI FN_AddRefActCtx( HANDLE hActCtx ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_AddRefActCtx( HANDLE hActCtx ) +{ + static FN_AddRefActCtx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddRefActCtx", &g_Kernel32); + pfn( hActCtx ); +} + +typedef VOID WINAPI FN_ReleaseActCtx( HANDLE hActCtx ); +__declspec(dllexport) VOID WINAPI kPrf2Wrap_ReleaseActCtx( HANDLE hActCtx ) +{ + static FN_ReleaseActCtx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReleaseActCtx", &g_Kernel32); + pfn( hActCtx ); +} + +typedef BOOL WINAPI FN_ZombifyActCtx( HANDLE hActCtx ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ZombifyActCtx( HANDLE hActCtx ) +{ + static FN_ZombifyActCtx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ZombifyActCtx", &g_Kernel32); + return pfn( hActCtx ); +} + +typedef BOOL WINAPI FN_ActivateActCtx( HANDLE hActCtx, ULONG_PTR * lpCookie ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ActivateActCtx( HANDLE hActCtx, ULONG_PTR * lpCookie ) +{ + static FN_ActivateActCtx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ActivateActCtx", &g_Kernel32); + return pfn( hActCtx, lpCookie ); +} + +typedef BOOL WINAPI FN_DeactivateActCtx( DWORD dwFlags, ULONG_PTR ulCookie ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_DeactivateActCtx( DWORD dwFlags, ULONG_PTR ulCookie ) +{ + static FN_DeactivateActCtx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "DeactivateActCtx", &g_Kernel32); + return pfn( dwFlags, ulCookie ); +} + +typedef BOOL WINAPI FN_GetCurrentActCtx( HANDLE * lphActCtx ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCurrentActCtx( HANDLE * lphActCtx ) +{ + static FN_GetCurrentActCtx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentActCtx", &g_Kernel32); + return pfn( lphActCtx ); +} + +typedef BOOL WINAPI FN_FindActCtxSectionStringA( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, LPCSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindActCtxSectionStringA( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, LPCSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ) +{ + static FN_FindActCtxSectionStringA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindActCtxSectionStringA", &g_Kernel32); + return pfn( dwFlags, lpExtensionGuid, ulSectionId, lpStringToFind, ReturnedData ); +} + +typedef BOOL WINAPI FN_FindActCtxSectionStringW( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, LPCWSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindActCtxSectionStringW( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, LPCWSTR lpStringToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ) +{ + static FN_FindActCtxSectionStringW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindActCtxSectionStringW", &g_Kernel32); + return pfn( dwFlags, lpExtensionGuid, ulSectionId, lpStringToFind, ReturnedData ); +} + +typedef BOOL WINAPI FN_FindActCtxSectionGuid( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, const GUID * lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FindActCtxSectionGuid( DWORD dwFlags, const GUID * lpExtensionGuid, ULONG ulSectionId, const GUID * lpGuidToFind, PACTCTX_SECTION_KEYED_DATA ReturnedData ) +{ + static FN_FindActCtxSectionGuid *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FindActCtxSectionGuid", &g_Kernel32); + return pfn( dwFlags, lpExtensionGuid, ulSectionId, lpGuidToFind, ReturnedData ); +} + +typedef BOOL WINAPI FN_QueryActCtxW( DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInstance, ULONG ulInfoClass, PVOID pvBuffer, SIZE_T cbBuffer, SIZE_T * pcbWrittenOrRequired ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_QueryActCtxW( DWORD dwFlags, HANDLE hActCtx, PVOID pvSubInstance, ULONG ulInfoClass, PVOID pvBuffer, SIZE_T cbBuffer, SIZE_T * pcbWrittenOrRequired ) +{ + static FN_QueryActCtxW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "QueryActCtxW", &g_Kernel32); + return pfn( dwFlags, hActCtx, pvSubInstance, ulInfoClass, pvBuffer, cbBuffer, pcbWrittenOrRequired ); +} + +typedef BOOL WINAPI FN_ProcessIdToSessionId( DWORD dwProcessId, DWORD * pSessionId ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ProcessIdToSessionId( DWORD dwProcessId, DWORD * pSessionId ) +{ + static FN_ProcessIdToSessionId *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ProcessIdToSessionId", &g_Kernel32); + return pfn( dwProcessId, pSessionId ); +} + +typedef DWORD WINAPI FN_WTSGetActiveConsoleSessionId( ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_WTSGetActiveConsoleSessionId( ) +{ + static FN_WTSGetActiveConsoleSessionId *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WTSGetActiveConsoleSessionId", &g_Kernel32); + return pfn( ); +} + +typedef BOOL WINAPI FN_IsWow64Process( HANDLE hProcess, PBOOL Wow64Process ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsWow64Process( HANDLE hProcess, PBOOL Wow64Process ) +{ + static FN_IsWow64Process *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsWow64Process", &g_Kernel32); + return pfn( hProcess, Wow64Process ); +} + +typedef BOOL WINAPI FN_GetLogicalProcessorInformation( PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, PDWORD ReturnedLength ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetLogicalProcessorInformation( PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, PDWORD ReturnedLength ) +{ + static FN_GetLogicalProcessorInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLogicalProcessorInformation", &g_Kernel32); + return pfn( Buffer, ReturnedLength ); +} + +typedef BOOL WINAPI FN_GetNumaHighestNodeNumber( PULONG HighestNodeNumber ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumaHighestNodeNumber( PULONG HighestNodeNumber ) +{ + static FN_GetNumaHighestNodeNumber *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNumaHighestNodeNumber", &g_Kernel32); + return pfn( HighestNodeNumber ); +} + +typedef BOOL WINAPI FN_GetNumaProcessorNode( UCHAR Processor, PUCHAR NodeNumber ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumaProcessorNode( UCHAR Processor, PUCHAR NodeNumber ) +{ + static FN_GetNumaProcessorNode *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNumaProcessorNode", &g_Kernel32); + return pfn( Processor, NodeNumber ); +} + +typedef BOOL WINAPI FN_GetNumaNodeProcessorMask( UCHAR Node, PULONGLONG ProcessorMask ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumaNodeProcessorMask( UCHAR Node, PULONGLONG ProcessorMask ) +{ + static FN_GetNumaNodeProcessorMask *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNumaNodeProcessorMask", &g_Kernel32); + return pfn( Node, ProcessorMask ); +} + +typedef BOOL WINAPI FN_GetNumaAvailableMemoryNode( UCHAR Node, PULONGLONG AvailableBytes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumaAvailableMemoryNode( UCHAR Node, PULONGLONG AvailableBytes ) +{ + static FN_GetNumaAvailableMemoryNode *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNumaAvailableMemoryNode", &g_Kernel32); + return pfn( Node, AvailableBytes ); +} + +typedef BOOL WINAPI FN_PeekConsoleInputA( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_PeekConsoleInputA( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ) +{ + static FN_PeekConsoleInputA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "PeekConsoleInputA", &g_Kernel32); + return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead ); +} + +typedef BOOL WINAPI FN_PeekConsoleInputW( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_PeekConsoleInputW( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ) +{ + static FN_PeekConsoleInputW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "PeekConsoleInputW", &g_Kernel32); + return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead ); +} + +typedef BOOL WINAPI FN_ReadConsoleInputA( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleInputA( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ) +{ + static FN_ReadConsoleInputA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadConsoleInputA", &g_Kernel32); + return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead ); +} + +typedef BOOL WINAPI FN_ReadConsoleInputW( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleInputW( IN HANDLE hConsoleInput, OUT PINPUT_RECORD lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsRead ) +{ + static FN_ReadConsoleInputW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadConsoleInputW", &g_Kernel32); + return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead ); +} + +typedef BOOL WINAPI FN_WriteConsoleInputA( IN HANDLE hConsoleInput, IN CONST INPUT_RECORD * lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsWritten ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleInputA( IN HANDLE hConsoleInput, IN CONST INPUT_RECORD * lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsWritten ) +{ + static FN_WriteConsoleInputA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteConsoleInputA", &g_Kernel32); + return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsWritten ); +} + +typedef BOOL WINAPI FN_WriteConsoleInputW( IN HANDLE hConsoleInput, IN CONST INPUT_RECORD * lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsWritten ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleInputW( IN HANDLE hConsoleInput, IN CONST INPUT_RECORD * lpBuffer, IN DWORD nLength, OUT LPDWORD lpNumberOfEventsWritten ) +{ + static FN_WriteConsoleInputW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteConsoleInputW", &g_Kernel32); + return pfn( hConsoleInput, lpBuffer, nLength, lpNumberOfEventsWritten ); +} + +typedef BOOL WINAPI FN_ReadConsoleOutputA( IN HANDLE hConsoleOutput, OUT PCHAR_INFO lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpReadRegion ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleOutputA( IN HANDLE hConsoleOutput, OUT PCHAR_INFO lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpReadRegion ) +{ + static FN_ReadConsoleOutputA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadConsoleOutputA", &g_Kernel32); + return pfn( hConsoleOutput, lpBuffer, dwBufferSize, dwBufferCoord, lpReadRegion ); +} + +typedef BOOL WINAPI FN_ReadConsoleOutputW( IN HANDLE hConsoleOutput, OUT PCHAR_INFO lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpReadRegion ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleOutputW( IN HANDLE hConsoleOutput, OUT PCHAR_INFO lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpReadRegion ) +{ + static FN_ReadConsoleOutputW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadConsoleOutputW", &g_Kernel32); + return pfn( hConsoleOutput, lpBuffer, dwBufferSize, dwBufferCoord, lpReadRegion ); +} + +typedef BOOL WINAPI FN_WriteConsoleOutputA( IN HANDLE hConsoleOutput, IN CONST CHAR_INFO * lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpWriteRegion ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleOutputA( IN HANDLE hConsoleOutput, IN CONST CHAR_INFO * lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpWriteRegion ) +{ + static FN_WriteConsoleOutputA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteConsoleOutputA", &g_Kernel32); + return pfn( hConsoleOutput, lpBuffer, dwBufferSize, dwBufferCoord, lpWriteRegion ); +} + +typedef BOOL WINAPI FN_WriteConsoleOutputW( IN HANDLE hConsoleOutput, IN CONST CHAR_INFO * lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpWriteRegion ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleOutputW( IN HANDLE hConsoleOutput, IN CONST CHAR_INFO * lpBuffer, IN COORD dwBufferSize, IN COORD dwBufferCoord, IN OUT PSMALL_RECT lpWriteRegion ) +{ + static FN_WriteConsoleOutputW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteConsoleOutputW", &g_Kernel32); + return pfn( hConsoleOutput, lpBuffer, dwBufferSize, dwBufferCoord, lpWriteRegion ); +} + +typedef BOOL WINAPI FN_ReadConsoleOutputCharacterA( IN HANDLE hConsoleOutput, OUT LPSTR lpCharacter, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfCharsRead ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleOutputCharacterA( IN HANDLE hConsoleOutput, OUT LPSTR lpCharacter, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfCharsRead ) +{ + static FN_ReadConsoleOutputCharacterA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadConsoleOutputCharacterA", &g_Kernel32); + return pfn( hConsoleOutput, lpCharacter, nLength, dwReadCoord, lpNumberOfCharsRead ); +} + +typedef BOOL WINAPI FN_ReadConsoleOutputCharacterW( IN HANDLE hConsoleOutput, OUT LPWSTR lpCharacter, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfCharsRead ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleOutputCharacterW( IN HANDLE hConsoleOutput, OUT LPWSTR lpCharacter, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfCharsRead ) +{ + static FN_ReadConsoleOutputCharacterW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadConsoleOutputCharacterW", &g_Kernel32); + return pfn( hConsoleOutput, lpCharacter, nLength, dwReadCoord, lpNumberOfCharsRead ); +} + +typedef BOOL WINAPI FN_ReadConsoleOutputAttribute( IN HANDLE hConsoleOutput, OUT LPWORD lpAttribute, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfAttrsRead ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleOutputAttribute( IN HANDLE hConsoleOutput, OUT LPWORD lpAttribute, IN DWORD nLength, IN COORD dwReadCoord, OUT LPDWORD lpNumberOfAttrsRead ) +{ + static FN_ReadConsoleOutputAttribute *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadConsoleOutputAttribute", &g_Kernel32); + return pfn( hConsoleOutput, lpAttribute, nLength, dwReadCoord, lpNumberOfAttrsRead ); +} + +typedef BOOL WINAPI FN_WriteConsoleOutputCharacterA( IN HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleOutputCharacterA( IN HANDLE hConsoleOutput, IN LPCSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ) +{ + static FN_WriteConsoleOutputCharacterA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteConsoleOutputCharacterA", &g_Kernel32); + return pfn( hConsoleOutput, lpCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten ); +} + +typedef BOOL WINAPI FN_WriteConsoleOutputCharacterW( IN HANDLE hConsoleOutput, IN LPCWSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleOutputCharacterW( IN HANDLE hConsoleOutput, IN LPCWSTR lpCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ) +{ + static FN_WriteConsoleOutputCharacterW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteConsoleOutputCharacterW", &g_Kernel32); + return pfn( hConsoleOutput, lpCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten ); +} + +typedef BOOL WINAPI FN_WriteConsoleOutputAttribute( IN HANDLE hConsoleOutput, IN CONST WORD * lpAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleOutputAttribute( IN HANDLE hConsoleOutput, IN CONST WORD * lpAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten ) +{ + static FN_WriteConsoleOutputAttribute *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteConsoleOutputAttribute", &g_Kernel32); + return pfn( hConsoleOutput, lpAttribute, nLength, dwWriteCoord, lpNumberOfAttrsWritten ); +} + +typedef BOOL WINAPI FN_FillConsoleOutputCharacterA( IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FillConsoleOutputCharacterA( IN HANDLE hConsoleOutput, IN CHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ) +{ + static FN_FillConsoleOutputCharacterA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FillConsoleOutputCharacterA", &g_Kernel32); + return pfn( hConsoleOutput, cCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten ); +} + +typedef BOOL WINAPI FN_FillConsoleOutputCharacterW( IN HANDLE hConsoleOutput, IN WCHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FillConsoleOutputCharacterW( IN HANDLE hConsoleOutput, IN WCHAR cCharacter, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfCharsWritten ) +{ + static FN_FillConsoleOutputCharacterW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FillConsoleOutputCharacterW", &g_Kernel32); + return pfn( hConsoleOutput, cCharacter, nLength, dwWriteCoord, lpNumberOfCharsWritten ); +} + +typedef BOOL WINAPI FN_FillConsoleOutputAttribute( IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FillConsoleOutputAttribute( IN HANDLE hConsoleOutput, IN WORD wAttribute, IN DWORD nLength, IN COORD dwWriteCoord, OUT LPDWORD lpNumberOfAttrsWritten ) +{ + static FN_FillConsoleOutputAttribute *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FillConsoleOutputAttribute", &g_Kernel32); + return pfn( hConsoleOutput, wAttribute, nLength, dwWriteCoord, lpNumberOfAttrsWritten ); +} + +typedef BOOL WINAPI FN_GetConsoleMode( IN HANDLE hConsoleHandle, OUT LPDWORD lpMode ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetConsoleMode( IN HANDLE hConsoleHandle, OUT LPDWORD lpMode ) +{ + static FN_GetConsoleMode *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleMode", &g_Kernel32); + return pfn( hConsoleHandle, lpMode ); +} + +typedef BOOL WINAPI FN_GetNumberOfConsoleInputEvents( IN HANDLE hConsoleInput, OUT LPDWORD lpNumberOfEvents ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumberOfConsoleInputEvents( IN HANDLE hConsoleInput, OUT LPDWORD lpNumberOfEvents ) +{ + static FN_GetNumberOfConsoleInputEvents *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNumberOfConsoleInputEvents", &g_Kernel32); + return pfn( hConsoleInput, lpNumberOfEvents ); +} + +typedef BOOL WINAPI FN_GetConsoleScreenBufferInfo( IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetConsoleScreenBufferInfo( IN HANDLE hConsoleOutput, OUT PCONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo ) +{ + static FN_GetConsoleScreenBufferInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleScreenBufferInfo", &g_Kernel32); + return pfn( hConsoleOutput, lpConsoleScreenBufferInfo ); +} + +typedef COORD WINAPI FN_GetLargestConsoleWindowSize( IN HANDLE hConsoleOutput ); +__declspec(dllexport) COORD WINAPI kPrf2Wrap_GetLargestConsoleWindowSize( IN HANDLE hConsoleOutput ) +{ + static FN_GetLargestConsoleWindowSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLargestConsoleWindowSize", &g_Kernel32); + return pfn( hConsoleOutput ); +} + +typedef BOOL WINAPI FN_GetConsoleCursorInfo( IN HANDLE hConsoleOutput, OUT PCONSOLE_CURSOR_INFO lpConsoleCursorInfo ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetConsoleCursorInfo( IN HANDLE hConsoleOutput, OUT PCONSOLE_CURSOR_INFO lpConsoleCursorInfo ) +{ + static FN_GetConsoleCursorInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleCursorInfo", &g_Kernel32); + return pfn( hConsoleOutput, lpConsoleCursorInfo ); +} + +typedef BOOL WINAPI FN_GetCurrentConsoleFont( IN HANDLE hConsoleOutput, IN BOOL bMaximumWindow, OUT PCONSOLE_FONT_INFO lpConsoleCurrentFont ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCurrentConsoleFont( IN HANDLE hConsoleOutput, IN BOOL bMaximumWindow, OUT PCONSOLE_FONT_INFO lpConsoleCurrentFont ) +{ + static FN_GetCurrentConsoleFont *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrentConsoleFont", &g_Kernel32); + return pfn( hConsoleOutput, bMaximumWindow, lpConsoleCurrentFont ); +} + +typedef COORD WINAPI FN_GetConsoleFontSize( IN HANDLE hConsoleOutput, IN DWORD nFont ); +__declspec(dllexport) COORD WINAPI kPrf2Wrap_GetConsoleFontSize( IN HANDLE hConsoleOutput, IN DWORD nFont ) +{ + static FN_GetConsoleFontSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleFontSize", &g_Kernel32); + return pfn( hConsoleOutput, nFont ); +} + +typedef BOOL WINAPI FN_GetConsoleSelectionInfo( OUT PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetConsoleSelectionInfo( OUT PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo ) +{ + static FN_GetConsoleSelectionInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleSelectionInfo", &g_Kernel32); + return pfn( lpConsoleSelectionInfo ); +} + +typedef BOOL WINAPI FN_GetNumberOfConsoleMouseButtons( OUT LPDWORD lpNumberOfMouseButtons ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNumberOfConsoleMouseButtons( OUT LPDWORD lpNumberOfMouseButtons ) +{ + static FN_GetNumberOfConsoleMouseButtons *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNumberOfConsoleMouseButtons", &g_Kernel32); + return pfn( lpNumberOfMouseButtons ); +} + +typedef BOOL WINAPI FN_SetConsoleMode( IN HANDLE hConsoleHandle, IN DWORD dwMode ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleMode( IN HANDLE hConsoleHandle, IN DWORD dwMode ) +{ + static FN_SetConsoleMode *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleMode", &g_Kernel32); + return pfn( hConsoleHandle, dwMode ); +} + +typedef BOOL WINAPI FN_SetConsoleActiveScreenBuffer( IN HANDLE hConsoleOutput ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleActiveScreenBuffer( IN HANDLE hConsoleOutput ) +{ + static FN_SetConsoleActiveScreenBuffer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleActiveScreenBuffer", &g_Kernel32); + return pfn( hConsoleOutput ); +} + +typedef BOOL WINAPI FN_FlushConsoleInputBuffer( IN HANDLE hConsoleInput ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FlushConsoleInputBuffer( IN HANDLE hConsoleInput ) +{ + static FN_FlushConsoleInputBuffer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FlushConsoleInputBuffer", &g_Kernel32); + return pfn( hConsoleInput ); +} + +typedef BOOL WINAPI FN_SetConsoleScreenBufferSize( IN HANDLE hConsoleOutput, IN COORD dwSize ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleScreenBufferSize( IN HANDLE hConsoleOutput, IN COORD dwSize ) +{ + static FN_SetConsoleScreenBufferSize *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleScreenBufferSize", &g_Kernel32); + return pfn( hConsoleOutput, dwSize ); +} + +typedef BOOL WINAPI FN_SetConsoleCursorPosition( IN HANDLE hConsoleOutput, IN COORD dwCursorPosition ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleCursorPosition( IN HANDLE hConsoleOutput, IN COORD dwCursorPosition ) +{ + static FN_SetConsoleCursorPosition *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleCursorPosition", &g_Kernel32); + return pfn( hConsoleOutput, dwCursorPosition ); +} + +typedef BOOL WINAPI FN_SetConsoleCursorInfo( IN HANDLE hConsoleOutput, IN CONST CONSOLE_CURSOR_INFO * lpConsoleCursorInfo ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleCursorInfo( IN HANDLE hConsoleOutput, IN CONST CONSOLE_CURSOR_INFO * lpConsoleCursorInfo ) +{ + static FN_SetConsoleCursorInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleCursorInfo", &g_Kernel32); + return pfn( hConsoleOutput, lpConsoleCursorInfo ); +} + +typedef BOOL WINAPI FN_ScrollConsoleScreenBufferA( IN HANDLE hConsoleOutput, IN CONST SMALL_RECT * lpScrollRectangle, IN CONST SMALL_RECT * lpClipRectangle, IN COORD dwDestinationOrigin, IN CONST CHAR_INFO * lpFill ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ScrollConsoleScreenBufferA( IN HANDLE hConsoleOutput, IN CONST SMALL_RECT * lpScrollRectangle, IN CONST SMALL_RECT * lpClipRectangle, IN COORD dwDestinationOrigin, IN CONST CHAR_INFO * lpFill ) +{ + static FN_ScrollConsoleScreenBufferA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ScrollConsoleScreenBufferA", &g_Kernel32); + return pfn( hConsoleOutput, lpScrollRectangle, lpClipRectangle, dwDestinationOrigin, lpFill ); +} + +typedef BOOL WINAPI FN_ScrollConsoleScreenBufferW( IN HANDLE hConsoleOutput, IN CONST SMALL_RECT * lpScrollRectangle, IN CONST SMALL_RECT * lpClipRectangle, IN COORD dwDestinationOrigin, IN CONST CHAR_INFO * lpFill ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ScrollConsoleScreenBufferW( IN HANDLE hConsoleOutput, IN CONST SMALL_RECT * lpScrollRectangle, IN CONST SMALL_RECT * lpClipRectangle, IN COORD dwDestinationOrigin, IN CONST CHAR_INFO * lpFill ) +{ + static FN_ScrollConsoleScreenBufferW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ScrollConsoleScreenBufferW", &g_Kernel32); + return pfn( hConsoleOutput, lpScrollRectangle, lpClipRectangle, dwDestinationOrigin, lpFill ); +} + +typedef BOOL WINAPI FN_SetConsoleWindowInfo( IN HANDLE hConsoleOutput, IN BOOL bAbsolute, IN CONST SMALL_RECT * lpConsoleWindow ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleWindowInfo( IN HANDLE hConsoleOutput, IN BOOL bAbsolute, IN CONST SMALL_RECT * lpConsoleWindow ) +{ + static FN_SetConsoleWindowInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleWindowInfo", &g_Kernel32); + return pfn( hConsoleOutput, bAbsolute, lpConsoleWindow ); +} + +typedef BOOL WINAPI FN_SetConsoleTextAttribute( IN HANDLE hConsoleOutput, IN WORD wAttributes ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleTextAttribute( IN HANDLE hConsoleOutput, IN WORD wAttributes ) +{ + static FN_SetConsoleTextAttribute *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleTextAttribute", &g_Kernel32); + return pfn( hConsoleOutput, wAttributes ); +} + +typedef BOOL WINAPI FN_SetConsoleCtrlHandler( IN PHANDLER_ROUTINE HandlerRoutine, IN BOOL Add ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleCtrlHandler( IN PHANDLER_ROUTINE HandlerRoutine, IN BOOL Add ) +{ + static FN_SetConsoleCtrlHandler *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleCtrlHandler", &g_Kernel32); + return pfn( HandlerRoutine, Add ); +} + +typedef BOOL WINAPI FN_GenerateConsoleCtrlEvent( IN DWORD dwCtrlEvent, IN DWORD dwProcessGroupId ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GenerateConsoleCtrlEvent( IN DWORD dwCtrlEvent, IN DWORD dwProcessGroupId ) +{ + static FN_GenerateConsoleCtrlEvent *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GenerateConsoleCtrlEvent", &g_Kernel32); + return pfn( dwCtrlEvent, dwProcessGroupId ); +} + +typedef BOOL WINAPI FN_AllocConsole( VOID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AllocConsole( VOID ) +{ + static FN_AllocConsole *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AllocConsole", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_FreeConsole( VOID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_FreeConsole( VOID ) +{ + static FN_FreeConsole *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FreeConsole", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_AttachConsole( IN DWORD dwProcessId ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_AttachConsole( IN DWORD dwProcessId ) +{ + static FN_AttachConsole *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AttachConsole", &g_Kernel32); + return pfn( dwProcessId ); +} + +typedef DWORD WINAPI FN_GetConsoleTitleA( OUT LPSTR lpConsoleTitle, IN DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetConsoleTitleA( OUT LPSTR lpConsoleTitle, IN DWORD nSize ) +{ + static FN_GetConsoleTitleA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleTitleA", &g_Kernel32); + return pfn( lpConsoleTitle, nSize ); +} + +typedef DWORD WINAPI FN_GetConsoleTitleW( OUT LPWSTR lpConsoleTitle, IN DWORD nSize ); +__declspec(dllexport) DWORD WINAPI kPrf2Wrap_GetConsoleTitleW( OUT LPWSTR lpConsoleTitle, IN DWORD nSize ) +{ + static FN_GetConsoleTitleW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleTitleW", &g_Kernel32); + return pfn( lpConsoleTitle, nSize ); +} + +typedef BOOL WINAPI FN_SetConsoleTitleA( IN LPCSTR lpConsoleTitle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleTitleA( IN LPCSTR lpConsoleTitle ) +{ + static FN_SetConsoleTitleA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleTitleA", &g_Kernel32); + return pfn( lpConsoleTitle ); +} + +typedef BOOL WINAPI FN_SetConsoleTitleW( IN LPCWSTR lpConsoleTitle ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleTitleW( IN LPCWSTR lpConsoleTitle ) +{ + static FN_SetConsoleTitleW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleTitleW", &g_Kernel32); + return pfn( lpConsoleTitle ); +} + +typedef BOOL WINAPI FN_ReadConsoleA( IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN LPVOID lpReserved ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleA( IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN LPVOID lpReserved ) +{ + static FN_ReadConsoleA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadConsoleA", &g_Kernel32); + return pfn( hConsoleInput, lpBuffer, nNumberOfCharsToRead, lpNumberOfCharsRead, lpReserved ); +} + +typedef BOOL WINAPI FN_ReadConsoleW( IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN LPVOID lpReserved ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReadConsoleW( IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN LPVOID lpReserved ) +{ + static FN_ReadConsoleW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReadConsoleW", &g_Kernel32); + return pfn( hConsoleInput, lpBuffer, nNumberOfCharsToRead, lpNumberOfCharsRead, lpReserved ); +} + +typedef BOOL WINAPI FN_WriteConsoleA( IN HANDLE hConsoleOutput, IN CONST VOID * lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, IN LPVOID lpReserved ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleA( IN HANDLE hConsoleOutput, IN CONST VOID * lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, IN LPVOID lpReserved ) +{ + static FN_WriteConsoleA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteConsoleA", &g_Kernel32); + return pfn( hConsoleOutput, lpBuffer, nNumberOfCharsToWrite, lpNumberOfCharsWritten, lpReserved ); +} + +typedef BOOL WINAPI FN_WriteConsoleW( IN HANDLE hConsoleOutput, IN CONST VOID * lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, IN LPVOID lpReserved ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_WriteConsoleW( IN HANDLE hConsoleOutput, IN CONST VOID * lpBuffer, IN DWORD nNumberOfCharsToWrite, OUT LPDWORD lpNumberOfCharsWritten, IN LPVOID lpReserved ) +{ + static FN_WriteConsoleW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WriteConsoleW", &g_Kernel32); + return pfn( hConsoleOutput, lpBuffer, nNumberOfCharsToWrite, lpNumberOfCharsWritten, lpReserved ); +} + +typedef HANDLE WINAPI FN_CreateConsoleScreenBuffer( IN DWORD dwDesiredAccess, IN DWORD dwShareMode, IN CONST SECURITY_ATTRIBUTES * lpSecurityAttributes, IN DWORD dwFlags, IN LPVOID lpScreenBufferData ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateConsoleScreenBuffer( IN DWORD dwDesiredAccess, IN DWORD dwShareMode, IN CONST SECURITY_ATTRIBUTES * lpSecurityAttributes, IN DWORD dwFlags, IN LPVOID lpScreenBufferData ) +{ + static FN_CreateConsoleScreenBuffer *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateConsoleScreenBuffer", &g_Kernel32); + return pfn( dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwFlags, lpScreenBufferData ); +} + +typedef UINT WINAPI FN_GetConsoleCP( VOID ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetConsoleCP( VOID ) +{ + static FN_GetConsoleCP *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleCP", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_SetConsoleCP( IN UINT wCodePageID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleCP( IN UINT wCodePageID ) +{ + static FN_SetConsoleCP *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleCP", &g_Kernel32); + return pfn( wCodePageID ); +} + +typedef UINT WINAPI FN_GetConsoleOutputCP( VOID ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetConsoleOutputCP( VOID ) +{ + static FN_GetConsoleOutputCP *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleOutputCP", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_SetConsoleOutputCP( IN UINT wCodePageID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleOutputCP( IN UINT wCodePageID ) +{ + static FN_SetConsoleOutputCP *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleOutputCP", &g_Kernel32); + return pfn( wCodePageID ); +} + +typedef BOOL APIENTRY FN_GetConsoleDisplayMode( OUT LPDWORD lpModeFlags ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_GetConsoleDisplayMode( OUT LPDWORD lpModeFlags ) +{ + static FN_GetConsoleDisplayMode *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleDisplayMode", &g_Kernel32); + return pfn( lpModeFlags ); +} + +typedef HWND APIENTRY FN_GetConsoleWindow( VOID ); +__declspec(dllexport) HWND APIENTRY kPrf2Wrap_GetConsoleWindow( VOID ) +{ + static FN_GetConsoleWindow *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleWindow", &g_Kernel32); + return pfn (); +} + +typedef DWORD APIENTRY FN_GetConsoleProcessList( OUT LPDWORD lpdwProcessList, IN DWORD dwProcessCount ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleProcessList( OUT LPDWORD lpdwProcessList, IN DWORD dwProcessCount ) +{ + static FN_GetConsoleProcessList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleProcessList", &g_Kernel32); + return pfn( lpdwProcessList, dwProcessCount ); +} + +typedef BOOL APIENTRY FN_AddConsoleAliasA( IN LPSTR Source, IN LPSTR Target, IN LPSTR ExeName ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_AddConsoleAliasA( IN LPSTR Source, IN LPSTR Target, IN LPSTR ExeName ) +{ + static FN_AddConsoleAliasA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddConsoleAliasA", &g_Kernel32); + return pfn( Source, Target, ExeName ); +} + +typedef BOOL APIENTRY FN_AddConsoleAliasW( IN LPWSTR Source, IN LPWSTR Target, IN LPWSTR ExeName ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_AddConsoleAliasW( IN LPWSTR Source, IN LPWSTR Target, IN LPWSTR ExeName ) +{ + static FN_AddConsoleAliasW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "AddConsoleAliasW", &g_Kernel32); + return pfn( Source, Target, ExeName ); +} + +typedef DWORD APIENTRY FN_GetConsoleAliasA( IN LPSTR Source, OUT LPSTR TargetBuffer, IN DWORD TargetBufferLength, IN LPSTR ExeName ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasA( IN LPSTR Source, OUT LPSTR TargetBuffer, IN DWORD TargetBufferLength, IN LPSTR ExeName ) +{ + static FN_GetConsoleAliasA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasA", &g_Kernel32); + return pfn( Source, TargetBuffer, TargetBufferLength, ExeName ); +} + +typedef DWORD APIENTRY FN_GetConsoleAliasW( IN LPWSTR Source, OUT LPWSTR TargetBuffer, IN DWORD TargetBufferLength, IN LPWSTR ExeName ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasW( IN LPWSTR Source, OUT LPWSTR TargetBuffer, IN DWORD TargetBufferLength, IN LPWSTR ExeName ) +{ + static FN_GetConsoleAliasW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasW", &g_Kernel32); + return pfn( Source, TargetBuffer, TargetBufferLength, ExeName ); +} + +typedef DWORD APIENTRY FN_GetConsoleAliasesLengthA( IN LPSTR ExeName ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasesLengthA( IN LPSTR ExeName ) +{ + static FN_GetConsoleAliasesLengthA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasesLengthA", &g_Kernel32); + return pfn( ExeName ); +} + +typedef DWORD APIENTRY FN_GetConsoleAliasesLengthW( IN LPWSTR ExeName ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasesLengthW( IN LPWSTR ExeName ) +{ + static FN_GetConsoleAliasesLengthW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasesLengthW", &g_Kernel32); + return pfn( ExeName ); +} + +typedef DWORD APIENTRY FN_GetConsoleAliasExesLengthA( VOID ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasExesLengthA( VOID ) +{ + static FN_GetConsoleAliasExesLengthA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasExesLengthA", &g_Kernel32); + return pfn (); +} + +typedef DWORD APIENTRY FN_GetConsoleAliasExesLengthW( VOID ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasExesLengthW( VOID ) +{ + static FN_GetConsoleAliasExesLengthW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasExesLengthW", &g_Kernel32); + return pfn (); +} + +typedef DWORD APIENTRY FN_GetConsoleAliasesA( OUT LPSTR AliasBuffer, IN DWORD AliasBufferLength, IN LPSTR ExeName ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasesA( OUT LPSTR AliasBuffer, IN DWORD AliasBufferLength, IN LPSTR ExeName ) +{ + static FN_GetConsoleAliasesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasesA", &g_Kernel32); + return pfn( AliasBuffer, AliasBufferLength, ExeName ); +} + +typedef DWORD APIENTRY FN_GetConsoleAliasesW( OUT LPWSTR AliasBuffer, IN DWORD AliasBufferLength, IN LPWSTR ExeName ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasesW( OUT LPWSTR AliasBuffer, IN DWORD AliasBufferLength, IN LPWSTR ExeName ) +{ + static FN_GetConsoleAliasesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasesW", &g_Kernel32); + return pfn( AliasBuffer, AliasBufferLength, ExeName ); +} + +typedef DWORD APIENTRY FN_GetConsoleAliasExesA( OUT LPSTR ExeNameBuffer, IN DWORD ExeNameBufferLength ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasExesA( OUT LPSTR ExeNameBuffer, IN DWORD ExeNameBufferLength ) +{ + static FN_GetConsoleAliasExesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasExesA", &g_Kernel32); + return pfn( ExeNameBuffer, ExeNameBufferLength ); +} + +typedef DWORD APIENTRY FN_GetConsoleAliasExesW( OUT LPWSTR ExeNameBuffer, IN DWORD ExeNameBufferLength ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetConsoleAliasExesW( OUT LPWSTR ExeNameBuffer, IN DWORD ExeNameBufferLength ) +{ + static FN_GetConsoleAliasExesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetConsoleAliasExesW", &g_Kernel32); + return pfn( ExeNameBuffer, ExeNameBufferLength ); +} + +typedef BOOL WINAPI FN_IsValidCodePage( UINT CodePage ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidCodePage( UINT CodePage ) +{ + static FN_IsValidCodePage *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsValidCodePage", &g_Kernel32); + return pfn( CodePage ); +} + +typedef UINT WINAPI FN_GetACP( void ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetACP( void ) +{ + static FN_GetACP *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetACP", &g_Kernel32); + return pfn (); +} + +typedef UINT WINAPI FN_GetOEMCP( void ); +__declspec(dllexport) UINT WINAPI kPrf2Wrap_GetOEMCP( void ) +{ + static FN_GetOEMCP *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetOEMCP", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_GetCPInfo( UINT CodePage, LPCPINFO lpCPInfo ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCPInfo( UINT CodePage, LPCPINFO lpCPInfo ) +{ + static FN_GetCPInfo *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCPInfo", &g_Kernel32); + return pfn( CodePage, lpCPInfo ); +} + +typedef BOOL WINAPI FN_GetCPInfoExA( UINT CodePage, DWORD dwFlags, LPCPINFOEXA lpCPInfoEx ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCPInfoExA( UINT CodePage, DWORD dwFlags, LPCPINFOEXA lpCPInfoEx ) +{ + static FN_GetCPInfoExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCPInfoExA", &g_Kernel32); + return pfn( CodePage, dwFlags, lpCPInfoEx ); +} + +typedef BOOL WINAPI FN_GetCPInfoExW( UINT CodePage, DWORD dwFlags, LPCPINFOEXW lpCPInfoEx ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetCPInfoExW( UINT CodePage, DWORD dwFlags, LPCPINFOEXW lpCPInfoEx ) +{ + static FN_GetCPInfoExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCPInfoExW", &g_Kernel32); + return pfn( CodePage, dwFlags, lpCPInfoEx ); +} + +typedef BOOL WINAPI FN_IsDBCSLeadByte( BYTE TestChar ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsDBCSLeadByte( BYTE TestChar ) +{ + static FN_IsDBCSLeadByte *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsDBCSLeadByte", &g_Kernel32); + return pfn( TestChar ); +} + +typedef BOOL WINAPI FN_IsDBCSLeadByteEx( UINT CodePage, BYTE TestChar ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsDBCSLeadByteEx( UINT CodePage, BYTE TestChar ) +{ + static FN_IsDBCSLeadByteEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsDBCSLeadByteEx", &g_Kernel32); + return pfn( CodePage, TestChar ); +} + +typedef int WINAPI FN_MultiByteToWideChar( UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar ); +__declspec(dllexport) int WINAPI kPrf2Wrap_MultiByteToWideChar( UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, int cbMultiByte, LPWSTR lpWideCharStr, int cchWideChar ) +{ + static FN_MultiByteToWideChar *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "MultiByteToWideChar", &g_Kernel32); + return pfn( CodePage, dwFlags, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar ); +} + +typedef int WINAPI FN_WideCharToMultiByte( UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar ); +__declspec(dllexport) int WINAPI kPrf2Wrap_WideCharToMultiByte( UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar ) +{ + static FN_WideCharToMultiByte *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "WideCharToMultiByte", &g_Kernel32); + return pfn( CodePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar ); +} + +typedef int WINAPI FN_CompareStringA( LCID Locale, DWORD dwCmpFlags, LPCSTR lpString1, int cchCount1, LPCSTR lpString2, int cchCount2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_CompareStringA( LCID Locale, DWORD dwCmpFlags, LPCSTR lpString1, int cchCount1, LPCSTR lpString2, int cchCount2 ) +{ + static FN_CompareStringA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CompareStringA", &g_Kernel32); + return pfn( Locale, dwCmpFlags, lpString1, cchCount1, lpString2, cchCount2 ); +} + +typedef int WINAPI FN_CompareStringW( LCID Locale, DWORD dwCmpFlags, LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, int cchCount2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_CompareStringW( LCID Locale, DWORD dwCmpFlags, LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, int cchCount2 ) +{ + static FN_CompareStringW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CompareStringW", &g_Kernel32); + return pfn( Locale, dwCmpFlags, lpString1, cchCount1, lpString2, cchCount2 ); +} + +typedef int WINAPI FN_LCMapStringA( LCID Locale, DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest ); +__declspec(dllexport) int WINAPI kPrf2Wrap_LCMapStringA( LCID Locale, DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest ) +{ + static FN_LCMapStringA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LCMapStringA", &g_Kernel32); + return pfn( Locale, dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest ); +} + +typedef int WINAPI FN_LCMapStringW( LCID Locale, DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest ); +__declspec(dllexport) int WINAPI kPrf2Wrap_LCMapStringW( LCID Locale, DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest ) +{ + static FN_LCMapStringW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "LCMapStringW", &g_Kernel32); + return pfn( Locale, dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest ); +} + +typedef int WINAPI FN_GetLocaleInfoA( LCID Locale, LCTYPE LCType, LPSTR lpLCData, int cchData ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetLocaleInfoA( LCID Locale, LCTYPE LCType, LPSTR lpLCData, int cchData ) +{ + static FN_GetLocaleInfoA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLocaleInfoA", &g_Kernel32); + return pfn( Locale, LCType, lpLCData, cchData ); +} + +typedef int WINAPI FN_GetLocaleInfoW( LCID Locale, LCTYPE LCType, LPWSTR lpLCData, int cchData ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetLocaleInfoW( LCID Locale, LCTYPE LCType, LPWSTR lpLCData, int cchData ) +{ + static FN_GetLocaleInfoW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetLocaleInfoW", &g_Kernel32); + return pfn( Locale, LCType, lpLCData, cchData ); +} + +typedef BOOL WINAPI FN_SetLocaleInfoA( LCID Locale, LCTYPE LCType, LPCSTR lpLCData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetLocaleInfoA( LCID Locale, LCTYPE LCType, LPCSTR lpLCData ) +{ + static FN_SetLocaleInfoA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetLocaleInfoA", &g_Kernel32); + return pfn( Locale, LCType, lpLCData ); +} + +typedef BOOL WINAPI FN_SetLocaleInfoW( LCID Locale, LCTYPE LCType, LPCWSTR lpLCData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetLocaleInfoW( LCID Locale, LCTYPE LCType, LPCWSTR lpLCData ) +{ + static FN_SetLocaleInfoW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetLocaleInfoW", &g_Kernel32); + return pfn( Locale, LCType, lpLCData ); +} + +typedef int WINAPI FN_GetCalendarInfoA( LCID Locale, CALID Calendar, CALTYPE CalType, LPSTR lpCalData, int cchData, LPDWORD lpValue ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetCalendarInfoA( LCID Locale, CALID Calendar, CALTYPE CalType, LPSTR lpCalData, int cchData, LPDWORD lpValue ) +{ + static FN_GetCalendarInfoA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCalendarInfoA", &g_Kernel32); + return pfn( Locale, Calendar, CalType, lpCalData, cchData, lpValue ); +} + +typedef int WINAPI FN_GetCalendarInfoW( LCID Locale, CALID Calendar, CALTYPE CalType, LPWSTR lpCalData, int cchData, LPDWORD lpValue ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetCalendarInfoW( LCID Locale, CALID Calendar, CALTYPE CalType, LPWSTR lpCalData, int cchData, LPDWORD lpValue ) +{ + static FN_GetCalendarInfoW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCalendarInfoW", &g_Kernel32); + return pfn( Locale, Calendar, CalType, lpCalData, cchData, lpValue ); +} + +typedef BOOL WINAPI FN_SetCalendarInfoA( LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCalendarInfoA( LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData ) +{ + static FN_SetCalendarInfoA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetCalendarInfoA", &g_Kernel32); + return pfn( Locale, Calendar, CalType, lpCalData ); +} + +typedef BOOL WINAPI FN_SetCalendarInfoW( LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetCalendarInfoW( LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData ) +{ + static FN_SetCalendarInfoW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetCalendarInfoW", &g_Kernel32); + return pfn( Locale, Calendar, CalType, lpCalData ); +} + +typedef int WINAPI FN_GetTimeFormatA( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpTime, LPCSTR lpFormat, LPSTR lpTimeStr, int cchTime ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetTimeFormatA( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpTime, LPCSTR lpFormat, LPSTR lpTimeStr, int cchTime ) +{ + static FN_GetTimeFormatA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTimeFormatA", &g_Kernel32); + return pfn( Locale, dwFlags, lpTime, lpFormat, lpTimeStr, cchTime ); +} + +typedef int WINAPI FN_GetTimeFormatW( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, int cchTime ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetTimeFormatW( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpTime, LPCWSTR lpFormat, LPWSTR lpTimeStr, int cchTime ) +{ + static FN_GetTimeFormatW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetTimeFormatW", &g_Kernel32); + return pfn( Locale, dwFlags, lpTime, lpFormat, lpTimeStr, cchTime ); +} + +typedef int WINAPI FN_GetDateFormatA( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpDate, LPCSTR lpFormat, LPSTR lpDateStr, int cchDate ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetDateFormatA( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpDate, LPCSTR lpFormat, LPSTR lpDateStr, int cchDate ) +{ + static FN_GetDateFormatA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDateFormatA", &g_Kernel32); + return pfn( Locale, dwFlags, lpDate, lpFormat, lpDateStr, cchDate ); +} + +typedef int WINAPI FN_GetDateFormatW( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpDate, LPCWSTR lpFormat, LPWSTR lpDateStr, int cchDate ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetDateFormatW( LCID Locale, DWORD dwFlags, CONST SYSTEMTIME * lpDate, LPCWSTR lpFormat, LPWSTR lpDateStr, int cchDate ) +{ + static FN_GetDateFormatW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetDateFormatW", &g_Kernel32); + return pfn( Locale, dwFlags, lpDate, lpFormat, lpDateStr, cchDate ); +} + +typedef int WINAPI FN_GetNumberFormatA( LCID Locale, DWORD dwFlags, LPCSTR lpValue, CONST NUMBERFMTA * lpFormat, LPSTR lpNumberStr, int cchNumber ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetNumberFormatA( LCID Locale, DWORD dwFlags, LPCSTR lpValue, CONST NUMBERFMTA * lpFormat, LPSTR lpNumberStr, int cchNumber ) +{ + static FN_GetNumberFormatA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNumberFormatA", &g_Kernel32); + return pfn( Locale, dwFlags, lpValue, lpFormat, lpNumberStr, cchNumber ); +} + +typedef int WINAPI FN_GetNumberFormatW( LCID Locale, DWORD dwFlags, LPCWSTR lpValue, CONST NUMBERFMTW * lpFormat, LPWSTR lpNumberStr, int cchNumber ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetNumberFormatW( LCID Locale, DWORD dwFlags, LPCWSTR lpValue, CONST NUMBERFMTW * lpFormat, LPWSTR lpNumberStr, int cchNumber ) +{ + static FN_GetNumberFormatW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNumberFormatW", &g_Kernel32); + return pfn( Locale, dwFlags, lpValue, lpFormat, lpNumberStr, cchNumber ); +} + +typedef int WINAPI FN_GetCurrencyFormatA( LCID Locale, DWORD dwFlags, LPCSTR lpValue, CONST CURRENCYFMTA * lpFormat, LPSTR lpCurrencyStr, int cchCurrency ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetCurrencyFormatA( LCID Locale, DWORD dwFlags, LPCSTR lpValue, CONST CURRENCYFMTA * lpFormat, LPSTR lpCurrencyStr, int cchCurrency ) +{ + static FN_GetCurrencyFormatA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrencyFormatA", &g_Kernel32); + return pfn( Locale, dwFlags, lpValue, lpFormat, lpCurrencyStr, cchCurrency ); +} + +typedef int WINAPI FN_GetCurrencyFormatW( LCID Locale, DWORD dwFlags, LPCWSTR lpValue, CONST CURRENCYFMTW * lpFormat, LPWSTR lpCurrencyStr, int cchCurrency ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetCurrencyFormatW( LCID Locale, DWORD dwFlags, LPCWSTR lpValue, CONST CURRENCYFMTW * lpFormat, LPWSTR lpCurrencyStr, int cchCurrency ) +{ + static FN_GetCurrencyFormatW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetCurrencyFormatW", &g_Kernel32); + return pfn( Locale, dwFlags, lpValue, lpFormat, lpCurrencyStr, cchCurrency ); +} + +typedef BOOL WINAPI FN_EnumCalendarInfoA( CALINFO_ENUMPROCA lpCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumCalendarInfoA( CALINFO_ENUMPROCA lpCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType ) +{ + static FN_EnumCalendarInfoA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumCalendarInfoA", &g_Kernel32); + return pfn( lpCalInfoEnumProc, Locale, Calendar, CalType ); +} + +typedef BOOL WINAPI FN_EnumCalendarInfoW( CALINFO_ENUMPROCW lpCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumCalendarInfoW( CALINFO_ENUMPROCW lpCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType ) +{ + static FN_EnumCalendarInfoW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumCalendarInfoW", &g_Kernel32); + return pfn( lpCalInfoEnumProc, Locale, Calendar, CalType ); +} + +typedef BOOL WINAPI FN_EnumCalendarInfoExA( CALINFO_ENUMPROCEXA lpCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumCalendarInfoExA( CALINFO_ENUMPROCEXA lpCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType ) +{ + static FN_EnumCalendarInfoExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumCalendarInfoExA", &g_Kernel32); + return pfn( lpCalInfoEnumProcEx, Locale, Calendar, CalType ); +} + +typedef BOOL WINAPI FN_EnumCalendarInfoExW( CALINFO_ENUMPROCEXW lpCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumCalendarInfoExW( CALINFO_ENUMPROCEXW lpCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType ) +{ + static FN_EnumCalendarInfoExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumCalendarInfoExW", &g_Kernel32); + return pfn( lpCalInfoEnumProcEx, Locale, Calendar, CalType ); +} + +typedef BOOL WINAPI FN_EnumTimeFormatsA( TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumTimeFormatsA( TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags ) +{ + static FN_EnumTimeFormatsA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumTimeFormatsA", &g_Kernel32); + return pfn( lpTimeFmtEnumProc, Locale, dwFlags ); +} + +typedef BOOL WINAPI FN_EnumTimeFormatsW( TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumTimeFormatsW( TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags ) +{ + static FN_EnumTimeFormatsW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumTimeFormatsW", &g_Kernel32); + return pfn( lpTimeFmtEnumProc, Locale, dwFlags ); +} + +typedef BOOL WINAPI FN_EnumDateFormatsA( DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumDateFormatsA( DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags ) +{ + static FN_EnumDateFormatsA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumDateFormatsA", &g_Kernel32); + return pfn( lpDateFmtEnumProc, Locale, dwFlags ); +} + +typedef BOOL WINAPI FN_EnumDateFormatsW( DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumDateFormatsW( DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags ) +{ + static FN_EnumDateFormatsW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumDateFormatsW", &g_Kernel32); + return pfn( lpDateFmtEnumProc, Locale, dwFlags ); +} + +typedef BOOL WINAPI FN_EnumDateFormatsExA( DATEFMT_ENUMPROCEXA lpDateFmtEnumProcEx, LCID Locale, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumDateFormatsExA( DATEFMT_ENUMPROCEXA lpDateFmtEnumProcEx, LCID Locale, DWORD dwFlags ) +{ + static FN_EnumDateFormatsExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumDateFormatsExA", &g_Kernel32); + return pfn( lpDateFmtEnumProcEx, Locale, dwFlags ); +} + +typedef BOOL WINAPI FN_EnumDateFormatsExW( DATEFMT_ENUMPROCEXW lpDateFmtEnumProcEx, LCID Locale, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumDateFormatsExW( DATEFMT_ENUMPROCEXW lpDateFmtEnumProcEx, LCID Locale, DWORD dwFlags ) +{ + static FN_EnumDateFormatsExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumDateFormatsExW", &g_Kernel32); + return pfn( lpDateFmtEnumProcEx, Locale, dwFlags ); +} + +typedef BOOL WINAPI FN_IsValidLanguageGroup( LGRPID LanguageGroup, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidLanguageGroup( LGRPID LanguageGroup, DWORD dwFlags ) +{ + static FN_IsValidLanguageGroup *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsValidLanguageGroup", &g_Kernel32); + return pfn( LanguageGroup, dwFlags ); +} + +typedef BOOL WINAPI FN_GetNLSVersion( NLS_FUNCTION Function, LCID Locale, LPNLSVERSIONINFO lpVersionInformation ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetNLSVersion( NLS_FUNCTION Function, LCID Locale, LPNLSVERSIONINFO lpVersionInformation ) +{ + static FN_GetNLSVersion *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetNLSVersion", &g_Kernel32); + return pfn( Function, Locale, lpVersionInformation ); +} + +typedef BOOL WINAPI FN_IsNLSDefinedString( NLS_FUNCTION Function, DWORD dwFlags, LPNLSVERSIONINFO lpVersionInformation, LPCWSTR lpString, INT cchStr ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsNLSDefinedString( NLS_FUNCTION Function, DWORD dwFlags, LPNLSVERSIONINFO lpVersionInformation, LPCWSTR lpString, INT cchStr ) +{ + static FN_IsNLSDefinedString *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsNLSDefinedString", &g_Kernel32); + return pfn( Function, dwFlags, lpVersionInformation, lpString, cchStr ); +} + +typedef BOOL WINAPI FN_IsValidLocale( LCID Locale, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_IsValidLocale( LCID Locale, DWORD dwFlags ) +{ + static FN_IsValidLocale *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "IsValidLocale", &g_Kernel32); + return pfn( Locale, dwFlags ); +} + +typedef int WINAPI FN_GetGeoInfoA( GEOID Location, GEOTYPE GeoType, LPSTR lpGeoData, int cchData, LANGID LangId ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetGeoInfoA( GEOID Location, GEOTYPE GeoType, LPSTR lpGeoData, int cchData, LANGID LangId ) +{ + static FN_GetGeoInfoA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetGeoInfoA", &g_Kernel32); + return pfn( Location, GeoType, lpGeoData, cchData, LangId ); +} + +typedef int WINAPI FN_GetGeoInfoW( GEOID Location, GEOTYPE GeoType, LPWSTR lpGeoData, int cchData, LANGID LangId ); +__declspec(dllexport) int WINAPI kPrf2Wrap_GetGeoInfoW( GEOID Location, GEOTYPE GeoType, LPWSTR lpGeoData, int cchData, LANGID LangId ) +{ + static FN_GetGeoInfoW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetGeoInfoW", &g_Kernel32); + return pfn( Location, GeoType, lpGeoData, cchData, LangId ); +} + +typedef BOOL WINAPI FN_EnumSystemGeoID( GEOCLASS GeoClass, GEOID ParentGeoId, GEO_ENUMPROC lpGeoEnumProc ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemGeoID( GEOCLASS GeoClass, GEOID ParentGeoId, GEO_ENUMPROC lpGeoEnumProc ) +{ + static FN_EnumSystemGeoID *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumSystemGeoID", &g_Kernel32); + return pfn( GeoClass, ParentGeoId, lpGeoEnumProc ); +} + +typedef GEOID WINAPI FN_GetUserGeoID( GEOCLASS GeoClass ); +__declspec(dllexport) GEOID WINAPI kPrf2Wrap_GetUserGeoID( GEOCLASS GeoClass ) +{ + static FN_GetUserGeoID *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetUserGeoID", &g_Kernel32); + return pfn( GeoClass ); +} + +typedef BOOL WINAPI FN_SetUserGeoID( GEOID GeoId ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetUserGeoID( GEOID GeoId ) +{ + static FN_SetUserGeoID *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetUserGeoID", &g_Kernel32); + return pfn( GeoId ); +} + +typedef LCID WINAPI FN_ConvertDefaultLocale( LCID Locale ); +__declspec(dllexport) LCID WINAPI kPrf2Wrap_ConvertDefaultLocale( LCID Locale ) +{ + static FN_ConvertDefaultLocale *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ConvertDefaultLocale", &g_Kernel32); + return pfn( Locale ); +} + +typedef LCID WINAPI FN_GetThreadLocale( void ); +__declspec(dllexport) LCID WINAPI kPrf2Wrap_GetThreadLocale( void ) +{ + static FN_GetThreadLocale *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetThreadLocale", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_SetThreadLocale( LCID Locale ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetThreadLocale( LCID Locale ) +{ + static FN_SetThreadLocale *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetThreadLocale", &g_Kernel32); + return pfn( Locale ); +} + +typedef LANGID WINAPI FN_GetSystemDefaultUILanguage( void ); +__declspec(dllexport) LANGID WINAPI kPrf2Wrap_GetSystemDefaultUILanguage( void ) +{ + static FN_GetSystemDefaultUILanguage *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemDefaultUILanguage", &g_Kernel32); + return pfn (); +} + +typedef LANGID WINAPI FN_GetUserDefaultUILanguage( void ); +__declspec(dllexport) LANGID WINAPI kPrf2Wrap_GetUserDefaultUILanguage( void ) +{ + static FN_GetUserDefaultUILanguage *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetUserDefaultUILanguage", &g_Kernel32); + return pfn (); +} + +typedef LANGID WINAPI FN_GetSystemDefaultLangID( void ); +__declspec(dllexport) LANGID WINAPI kPrf2Wrap_GetSystemDefaultLangID( void ) +{ + static FN_GetSystemDefaultLangID *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemDefaultLangID", &g_Kernel32); + return pfn (); +} + +typedef LANGID WINAPI FN_GetUserDefaultLangID( void ); +__declspec(dllexport) LANGID WINAPI kPrf2Wrap_GetUserDefaultLangID( void ) +{ + static FN_GetUserDefaultLangID *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetUserDefaultLangID", &g_Kernel32); + return pfn (); +} + +typedef LCID WINAPI FN_GetSystemDefaultLCID( void ); +__declspec(dllexport) LCID WINAPI kPrf2Wrap_GetSystemDefaultLCID( void ) +{ + static FN_GetSystemDefaultLCID *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetSystemDefaultLCID", &g_Kernel32); + return pfn (); +} + +typedef LCID WINAPI FN_GetUserDefaultLCID( void ); +__declspec(dllexport) LCID WINAPI kPrf2Wrap_GetUserDefaultLCID( void ) +{ + static FN_GetUserDefaultLCID *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetUserDefaultLCID", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_GetStringTypeExA( LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetStringTypeExA( LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType ) +{ + static FN_GetStringTypeExA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetStringTypeExA", &g_Kernel32); + return pfn( Locale, dwInfoType, lpSrcStr, cchSrc, lpCharType ); +} + +typedef BOOL WINAPI FN_GetStringTypeExW( LCID Locale, DWORD dwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetStringTypeExW( LCID Locale, DWORD dwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType ) +{ + static FN_GetStringTypeExW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetStringTypeExW", &g_Kernel32); + return pfn( Locale, dwInfoType, lpSrcStr, cchSrc, lpCharType ); +} + +typedef BOOL WINAPI FN_GetStringTypeA( LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetStringTypeA( LCID Locale, DWORD dwInfoType, LPCSTR lpSrcStr, int cchSrc, LPWORD lpCharType ) +{ + static FN_GetStringTypeA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetStringTypeA", &g_Kernel32); + return pfn( Locale, dwInfoType, lpSrcStr, cchSrc, lpCharType ); +} + +typedef BOOL WINAPI FN_GetStringTypeW( DWORD dwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetStringTypeW( DWORD dwInfoType, LPCWSTR lpSrcStr, int cchSrc, LPWORD lpCharType ) +{ + static FN_GetStringTypeW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetStringTypeW", &g_Kernel32); + return pfn( dwInfoType, lpSrcStr, cchSrc, lpCharType ); +} + +typedef int WINAPI FN_FoldStringA( DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest ); +__declspec(dllexport) int WINAPI kPrf2Wrap_FoldStringA( DWORD dwMapFlags, LPCSTR lpSrcStr, int cchSrc, LPSTR lpDestStr, int cchDest ) +{ + static FN_FoldStringA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FoldStringA", &g_Kernel32); + return pfn( dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest ); +} + +typedef int WINAPI FN_FoldStringW( DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest ); +__declspec(dllexport) int WINAPI kPrf2Wrap_FoldStringW( DWORD dwMapFlags, LPCWSTR lpSrcStr, int cchSrc, LPWSTR lpDestStr, int cchDest ) +{ + static FN_FoldStringW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "FoldStringW", &g_Kernel32); + return pfn( dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest ); +} + +typedef BOOL WINAPI FN_EnumSystemLanguageGroupsA( LANGUAGEGROUP_ENUMPROCA lpLanguageGroupEnumProc, DWORD dwFlags, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemLanguageGroupsA( LANGUAGEGROUP_ENUMPROCA lpLanguageGroupEnumProc, DWORD dwFlags, LONG_PTR lParam ) +{ + static FN_EnumSystemLanguageGroupsA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumSystemLanguageGroupsA", &g_Kernel32); + return pfn( lpLanguageGroupEnumProc, dwFlags, lParam ); +} + +typedef BOOL WINAPI FN_EnumSystemLanguageGroupsW( LANGUAGEGROUP_ENUMPROCW lpLanguageGroupEnumProc, DWORD dwFlags, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemLanguageGroupsW( LANGUAGEGROUP_ENUMPROCW lpLanguageGroupEnumProc, DWORD dwFlags, LONG_PTR lParam ) +{ + static FN_EnumSystemLanguageGroupsW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumSystemLanguageGroupsW", &g_Kernel32); + return pfn( lpLanguageGroupEnumProc, dwFlags, lParam ); +} + +typedef BOOL WINAPI FN_EnumLanguageGroupLocalesA( LANGGROUPLOCALE_ENUMPROCA lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, DWORD dwFlags, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumLanguageGroupLocalesA( LANGGROUPLOCALE_ENUMPROCA lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, DWORD dwFlags, LONG_PTR lParam ) +{ + static FN_EnumLanguageGroupLocalesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumLanguageGroupLocalesA", &g_Kernel32); + return pfn( lpLangGroupLocaleEnumProc, LanguageGroup, dwFlags, lParam ); +} + +typedef BOOL WINAPI FN_EnumLanguageGroupLocalesW( LANGGROUPLOCALE_ENUMPROCW lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, DWORD dwFlags, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumLanguageGroupLocalesW( LANGGROUPLOCALE_ENUMPROCW lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, DWORD dwFlags, LONG_PTR lParam ) +{ + static FN_EnumLanguageGroupLocalesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumLanguageGroupLocalesW", &g_Kernel32); + return pfn( lpLangGroupLocaleEnumProc, LanguageGroup, dwFlags, lParam ); +} + +typedef BOOL WINAPI FN_EnumUILanguagesA( UILANGUAGE_ENUMPROCA lpUILanguageEnumProc, DWORD dwFlags, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumUILanguagesA( UILANGUAGE_ENUMPROCA lpUILanguageEnumProc, DWORD dwFlags, LONG_PTR lParam ) +{ + static FN_EnumUILanguagesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumUILanguagesA", &g_Kernel32); + return pfn( lpUILanguageEnumProc, dwFlags, lParam ); +} + +typedef BOOL WINAPI FN_EnumUILanguagesW( UILANGUAGE_ENUMPROCW lpUILanguageEnumProc, DWORD dwFlags, LONG_PTR lParam ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumUILanguagesW( UILANGUAGE_ENUMPROCW lpUILanguageEnumProc, DWORD dwFlags, LONG_PTR lParam ) +{ + static FN_EnumUILanguagesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumUILanguagesW", &g_Kernel32); + return pfn( lpUILanguageEnumProc, dwFlags, lParam ); +} + +typedef BOOL WINAPI FN_EnumSystemLocalesA( LOCALE_ENUMPROCA lpLocaleEnumProc, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemLocalesA( LOCALE_ENUMPROCA lpLocaleEnumProc, DWORD dwFlags ) +{ + static FN_EnumSystemLocalesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumSystemLocalesA", &g_Kernel32); + return pfn( lpLocaleEnumProc, dwFlags ); +} + +typedef BOOL WINAPI FN_EnumSystemLocalesW( LOCALE_ENUMPROCW lpLocaleEnumProc, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemLocalesW( LOCALE_ENUMPROCW lpLocaleEnumProc, DWORD dwFlags ) +{ + static FN_EnumSystemLocalesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumSystemLocalesW", &g_Kernel32); + return pfn( lpLocaleEnumProc, dwFlags ); +} + +typedef BOOL WINAPI FN_EnumSystemCodePagesA( CODEPAGE_ENUMPROCA lpCodePageEnumProc, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemCodePagesA( CODEPAGE_ENUMPROCA lpCodePageEnumProc, DWORD dwFlags ) +{ + static FN_EnumSystemCodePagesA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumSystemCodePagesA", &g_Kernel32); + return pfn( lpCodePageEnumProc, dwFlags ); +} + +typedef BOOL WINAPI FN_EnumSystemCodePagesW( CODEPAGE_ENUMPROCW lpCodePageEnumProc, DWORD dwFlags ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_EnumSystemCodePagesW( CODEPAGE_ENUMPROCW lpCodePageEnumProc, DWORD dwFlags ) +{ + static FN_EnumSystemCodePagesW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "EnumSystemCodePagesW", &g_Kernel32); + return pfn( lpCodePageEnumProc, dwFlags ); +} + +typedef DWORD APIENTRY FN_VerFindFileA( DWORD uFlags, LPSTR szFileName, LPSTR szWinDir, LPSTR szAppDir, LPSTR szCurDir, PUINT lpuCurDirLen, LPSTR szDestDir, PUINT lpuDestDirLen ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerFindFileA( DWORD uFlags, LPSTR szFileName, LPSTR szWinDir, LPSTR szAppDir, LPSTR szCurDir, PUINT lpuCurDirLen, LPSTR szDestDir, PUINT lpuDestDirLen ) +{ + static FN_VerFindFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerFindFileA", &g_Kernel32); + return pfn( uFlags, szFileName, szWinDir, szAppDir, szCurDir, lpuCurDirLen, szDestDir, lpuDestDirLen ); +} + +typedef DWORD APIENTRY FN_VerFindFileW( DWORD uFlags, LPWSTR szFileName, LPWSTR szWinDir, LPWSTR szAppDir, LPWSTR szCurDir, PUINT lpuCurDirLen, LPWSTR szDestDir, PUINT lpuDestDirLen ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerFindFileW( DWORD uFlags, LPWSTR szFileName, LPWSTR szWinDir, LPWSTR szAppDir, LPWSTR szCurDir, PUINT lpuCurDirLen, LPWSTR szDestDir, PUINT lpuDestDirLen ) +{ + static FN_VerFindFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerFindFileW", &g_Kernel32); + return pfn( uFlags, szFileName, szWinDir, szAppDir, szCurDir, lpuCurDirLen, szDestDir, lpuDestDirLen ); +} + +typedef DWORD APIENTRY FN_VerInstallFileA( DWORD uFlags, LPSTR szSrcFileName, LPSTR szDestFileName, LPSTR szSrcDir, LPSTR szDestDir, LPSTR szCurDir, LPSTR szTmpFile, PUINT lpuTmpFileLen ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerInstallFileA( DWORD uFlags, LPSTR szSrcFileName, LPSTR szDestFileName, LPSTR szSrcDir, LPSTR szDestDir, LPSTR szCurDir, LPSTR szTmpFile, PUINT lpuTmpFileLen ) +{ + static FN_VerInstallFileA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerInstallFileA", &g_Kernel32); + return pfn( uFlags, szSrcFileName, szDestFileName, szSrcDir, szDestDir, szCurDir, szTmpFile, lpuTmpFileLen ); +} + +typedef DWORD APIENTRY FN_VerInstallFileW( DWORD uFlags, LPWSTR szSrcFileName, LPWSTR szDestFileName, LPWSTR szSrcDir, LPWSTR szDestDir, LPWSTR szCurDir, LPWSTR szTmpFile, PUINT lpuTmpFileLen ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerInstallFileW( DWORD uFlags, LPWSTR szSrcFileName, LPWSTR szDestFileName, LPWSTR szSrcDir, LPWSTR szDestDir, LPWSTR szCurDir, LPWSTR szTmpFile, PUINT lpuTmpFileLen ) +{ + static FN_VerInstallFileW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerInstallFileW", &g_Kernel32); + return pfn( uFlags, szSrcFileName, szDestFileName, szSrcDir, szDestDir, szCurDir, szTmpFile, lpuTmpFileLen ); +} + +typedef DWORD APIENTRY FN_GetFileVersionInfoSizeA( LPCSTR lptstrFilename, LPDWORD lpdwHandle ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetFileVersionInfoSizeA( LPCSTR lptstrFilename, LPDWORD lpdwHandle ) +{ + static FN_GetFileVersionInfoSizeA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileVersionInfoSizeA", &g_Kernel32); + return pfn( lptstrFilename, lpdwHandle ); +} + +typedef DWORD APIENTRY FN_GetFileVersionInfoSizeW( LPCWSTR lptstrFilename, LPDWORD lpdwHandle ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_GetFileVersionInfoSizeW( LPCWSTR lptstrFilename, LPDWORD lpdwHandle ) +{ + static FN_GetFileVersionInfoSizeW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileVersionInfoSizeW", &g_Kernel32); + return pfn( lptstrFilename, lpdwHandle ); +} + +typedef BOOL APIENTRY FN_GetFileVersionInfoA( LPCSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_GetFileVersionInfoA( LPCSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData ) +{ + static FN_GetFileVersionInfoA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileVersionInfoA", &g_Kernel32); + return pfn( lptstrFilename, dwHandle, dwLen, lpData ); +} + +typedef BOOL APIENTRY FN_GetFileVersionInfoW( LPCWSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_GetFileVersionInfoW( LPCWSTR lptstrFilename, DWORD dwHandle, DWORD dwLen, LPVOID lpData ) +{ + static FN_GetFileVersionInfoW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetFileVersionInfoW", &g_Kernel32); + return pfn( lptstrFilename, dwHandle, dwLen, lpData ); +} + +typedef DWORD APIENTRY FN_VerLanguageNameA( DWORD wLang, LPSTR szLang, DWORD nSize ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerLanguageNameA( DWORD wLang, LPSTR szLang, DWORD nSize ) +{ + static FN_VerLanguageNameA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerLanguageNameA", &g_Kernel32); + return pfn( wLang, szLang, nSize ); +} + +typedef DWORD APIENTRY FN_VerLanguageNameW( DWORD wLang, LPWSTR szLang, DWORD nSize ); +__declspec(dllexport) DWORD APIENTRY kPrf2Wrap_VerLanguageNameW( DWORD wLang, LPWSTR szLang, DWORD nSize ) +{ + static FN_VerLanguageNameW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerLanguageNameW", &g_Kernel32); + return pfn( wLang, szLang, nSize ); +} + +typedef BOOL APIENTRY FN_VerQueryValueA( const LPVOID pBlock, LPSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_VerQueryValueA( const LPVOID pBlock, LPSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ) +{ + static FN_VerQueryValueA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerQueryValueA", &g_Kernel32); + return pfn( pBlock, lpSubBlock, lplpBuffer, puLen ); +} + +typedef BOOL APIENTRY FN_VerQueryValueW( const LPVOID pBlock, LPWSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ); +__declspec(dllexport) BOOL APIENTRY kPrf2Wrap_VerQueryValueW( const LPVOID pBlock, LPWSTR lpSubBlock, LPVOID * lplpBuffer, PUINT puLen ) +{ + static FN_VerQueryValueW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerQueryValueW", &g_Kernel32); + return pfn( pBlock, lpSubBlock, lplpBuffer, puLen ); +} + +typedef VOID __cdecl FN_RtlRestoreContext( IN PCONTEXT ContextRecord, IN struct _EXCEPTION_RECORD * ExceptionRecord ); +__declspec(dllexport) VOID __cdecl kPrf2Wrap_RtlRestoreContext( IN PCONTEXT ContextRecord, IN struct _EXCEPTION_RECORD * ExceptionRecord ) +{ + static FN_RtlRestoreContext *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlRestoreContext", &g_Kernel32); + pfn( ContextRecord, ExceptionRecord ); +} + +typedef BOOLEAN __cdecl FN_RtlAddFunctionTable( IN PRUNTIME_FUNCTION FunctionTable, IN DWORD EntryCount, IN DWORD64 BaseAddress ); +__declspec(dllexport) BOOLEAN __cdecl kPrf2Wrap_RtlAddFunctionTable( IN PRUNTIME_FUNCTION FunctionTable, IN DWORD EntryCount, IN DWORD64 BaseAddress ) +{ + static FN_RtlAddFunctionTable *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlAddFunctionTable", &g_Kernel32); + return pfn( FunctionTable, EntryCount, BaseAddress ); +} + +typedef BOOLEAN __cdecl FN_RtlInstallFunctionTableCallback( IN DWORD64 TableIdentifier, IN DWORD64 BaseAddress, IN DWORD Length, IN PGET_RUNTIME_FUNCTION_CALLBACK Callback, IN PVOID Context, IN PCWSTR OutOfProcessCallbackDll ); +__declspec(dllexport) BOOLEAN __cdecl kPrf2Wrap_RtlInstallFunctionTableCallback( IN DWORD64 TableIdentifier, IN DWORD64 BaseAddress, IN DWORD Length, IN PGET_RUNTIME_FUNCTION_CALLBACK Callback, IN PVOID Context, IN PCWSTR OutOfProcessCallbackDll ) +{ + static FN_RtlInstallFunctionTableCallback *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlInstallFunctionTableCallback", &g_Kernel32); + return pfn( TableIdentifier, BaseAddress, Length, Callback, Context, OutOfProcessCallbackDll ); +} + +typedef BOOLEAN __cdecl FN_RtlDeleteFunctionTable( IN PRUNTIME_FUNCTION FunctionTable ); +__declspec(dllexport) BOOLEAN __cdecl kPrf2Wrap_RtlDeleteFunctionTable( IN PRUNTIME_FUNCTION FunctionTable ) +{ + static FN_RtlDeleteFunctionTable *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlDeleteFunctionTable", &g_Kernel32); + return pfn( FunctionTable ); +} + +typedef VOID NTAPI FN_RtlInitializeSListHead( IN PSLIST_HEADER ListHead ); +__declspec(dllexport) VOID NTAPI kPrf2Wrap_RtlInitializeSListHead( IN PSLIST_HEADER ListHead ) +{ + static FN_RtlInitializeSListHead *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlInitializeSListHead", &g_Kernel32); + pfn( ListHead ); +} + +typedef PSLIST_ENTRY NTAPI FN_RtlFirstEntrySList( IN const SLIST_HEADER * ListHead ); +__declspec(dllexport) PSLIST_ENTRY NTAPI kPrf2Wrap_RtlFirstEntrySList( IN const SLIST_HEADER * ListHead ) +{ + static FN_RtlFirstEntrySList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlFirstEntrySList", &g_Kernel32); + return pfn( ListHead ); +} + +typedef PSLIST_ENTRY NTAPI FN_RtlInterlockedPopEntrySList( IN PSLIST_HEADER ListHead ); +__declspec(dllexport) PSLIST_ENTRY NTAPI kPrf2Wrap_RtlInterlockedPopEntrySList( IN PSLIST_HEADER ListHead ) +{ + static FN_RtlInterlockedPopEntrySList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlInterlockedPopEntrySList", &g_Kernel32); + return pfn( ListHead ); +} + +typedef PSLIST_ENTRY NTAPI FN_RtlInterlockedPushEntrySList( IN PSLIST_HEADER ListHead, IN PSLIST_ENTRY ListEntry ); +__declspec(dllexport) PSLIST_ENTRY NTAPI kPrf2Wrap_RtlInterlockedPushEntrySList( IN PSLIST_HEADER ListHead, IN PSLIST_ENTRY ListEntry ) +{ + static FN_RtlInterlockedPushEntrySList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlInterlockedPushEntrySList", &g_Kernel32); + return pfn( ListHead, ListEntry ); +} + +typedef PSLIST_ENTRY NTAPI FN_RtlInterlockedFlushSList( IN PSLIST_HEADER ListHead ); +__declspec(dllexport) PSLIST_ENTRY NTAPI kPrf2Wrap_RtlInterlockedFlushSList( IN PSLIST_HEADER ListHead ) +{ + static FN_RtlInterlockedFlushSList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlInterlockedFlushSList", &g_Kernel32); + return pfn( ListHead ); +} + +typedef WORD NTAPI FN_RtlQueryDepthSList( IN PSLIST_HEADER ListHead ); +__declspec(dllexport) WORD NTAPI kPrf2Wrap_RtlQueryDepthSList( IN PSLIST_HEADER ListHead ) +{ + static FN_RtlQueryDepthSList *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlQueryDepthSList", &g_Kernel32); + return pfn( ListHead ); +} + +typedef VOID NTAPI FN_RtlCaptureContext( OUT PCONTEXT ContextRecord ); +__declspec(dllexport) VOID NTAPI kPrf2Wrap_RtlCaptureContext( OUT PCONTEXT ContextRecord ) +{ + static FN_RtlCaptureContext *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlCaptureContext", &g_Kernel32); + pfn( ContextRecord ); +} + +typedef SIZE_T NTAPI FN_RtlCompareMemory( const VOID * Source1, const VOID * Source2, SIZE_T Length ); +__declspec(dllexport) SIZE_T NTAPI kPrf2Wrap_RtlCompareMemory( const VOID * Source1, const VOID * Source2, SIZE_T Length ) +{ + static FN_RtlCompareMemory *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlCompareMemory", &g_Kernel32); + return pfn( Source1, Source2, Length ); +} + +typedef ULONGLONG NTAPI FN_VerSetConditionMask( IN ULONGLONG ConditionMask, IN DWORD TypeMask, IN BYTE Condition ); +__declspec(dllexport) ULONGLONG NTAPI kPrf2Wrap_VerSetConditionMask( IN ULONGLONG ConditionMask, IN DWORD TypeMask, IN BYTE Condition ) +{ + static FN_VerSetConditionMask *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "VerSetConditionMask", &g_Kernel32); + return pfn( ConditionMask, TypeMask, Condition ); +} + +typedef DWORD NTAPI FN_RtlSetHeapInformation( IN PVOID HeapHandle, IN HEAP_INFORMATION_CLASS HeapInformationClass, IN PVOID HeapInformation , IN SIZE_T HeapInformationLength ); +__declspec(dllexport) DWORD NTAPI kPrf2Wrap_RtlSetHeapInformation( IN PVOID HeapHandle, IN HEAP_INFORMATION_CLASS HeapInformationClass, IN PVOID HeapInformation , IN SIZE_T HeapInformationLength ) +{ + static FN_RtlSetHeapInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlSetHeapInformation", &g_Kernel32); + return pfn( HeapHandle, HeapInformationClass, HeapInformation , HeapInformationLength ); +} + +typedef DWORD NTAPI FN_RtlQueryHeapInformation( IN PVOID HeapHandle, IN HEAP_INFORMATION_CLASS HeapInformationClass, OUT PVOID HeapInformation , IN SIZE_T HeapInformationLength , OUT PSIZE_T ReturnLength ); +__declspec(dllexport) DWORD NTAPI kPrf2Wrap_RtlQueryHeapInformation( IN PVOID HeapHandle, IN HEAP_INFORMATION_CLASS HeapInformationClass, OUT PVOID HeapInformation , IN SIZE_T HeapInformationLength , OUT PSIZE_T ReturnLength ) +{ + static FN_RtlQueryHeapInformation *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlQueryHeapInformation", &g_Kernel32); + return pfn( HeapHandle, HeapInformationClass, HeapInformation , HeapInformationLength , ReturnLength ); +} + +typedef HANDLE WINAPI FN_CreateToolhelp32Snapshot( DWORD dwFlags, DWORD th32ProcessID ); +__declspec(dllexport) HANDLE WINAPI kPrf2Wrap_CreateToolhelp32Snapshot( DWORD dwFlags, DWORD th32ProcessID ) +{ + static FN_CreateToolhelp32Snapshot *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "CreateToolhelp32Snapshot", &g_Kernel32); + return pfn( dwFlags, th32ProcessID ); +} + +typedef BOOL WINAPI FN_Heap32ListFirst( HANDLE hSnapshot, LPHEAPLIST32 lphl ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Heap32ListFirst( HANDLE hSnapshot, LPHEAPLIST32 lphl ) +{ + static FN_Heap32ListFirst *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Heap32ListFirst", &g_Kernel32); + return pfn( hSnapshot, lphl ); +} + +typedef BOOL WINAPI FN_Heap32ListNext( HANDLE hSnapshot, LPHEAPLIST32 lphl ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Heap32ListNext( HANDLE hSnapshot, LPHEAPLIST32 lphl ) +{ + static FN_Heap32ListNext *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Heap32ListNext", &g_Kernel32); + return pfn( hSnapshot, lphl ); +} + +typedef BOOL WINAPI FN_Heap32First( LPHEAPENTRY32 lphe, DWORD th32ProcessID, ULONG_PTR th32HeapID ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Heap32First( LPHEAPENTRY32 lphe, DWORD th32ProcessID, ULONG_PTR th32HeapID ) +{ + static FN_Heap32First *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Heap32First", &g_Kernel32); + return pfn( lphe, th32ProcessID, th32HeapID ); +} + +typedef BOOL WINAPI FN_Heap32Next( LPHEAPENTRY32 lphe ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Heap32Next( LPHEAPENTRY32 lphe ) +{ + static FN_Heap32Next *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Heap32Next", &g_Kernel32); + return pfn( lphe ); +} + +typedef BOOL WINAPI FN_Toolhelp32ReadProcessMemory( DWORD th32ProcessID, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T cbRead, SIZE_T * lpNumberOfBytesRead ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Toolhelp32ReadProcessMemory( DWORD th32ProcessID, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T cbRead, SIZE_T * lpNumberOfBytesRead ) +{ + static FN_Toolhelp32ReadProcessMemory *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Toolhelp32ReadProcessMemory", &g_Kernel32); + return pfn( th32ProcessID, lpBaseAddress, lpBuffer, cbRead, lpNumberOfBytesRead ); +} + +typedef BOOL WINAPI FN_Process32FirstW( HANDLE hSnapshot, LPPROCESSENTRY32W lppe ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Process32FirstW( HANDLE hSnapshot, LPPROCESSENTRY32W lppe ) +{ + static FN_Process32FirstW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Process32FirstW", &g_Kernel32); + return pfn( hSnapshot, lppe ); +} + +typedef BOOL WINAPI FN_Process32NextW( HANDLE hSnapshot, LPPROCESSENTRY32W lppe ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Process32NextW( HANDLE hSnapshot, LPPROCESSENTRY32W lppe ) +{ + static FN_Process32NextW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Process32NextW", &g_Kernel32); + return pfn( hSnapshot, lppe ); +} + +typedef BOOL WINAPI FN_Process32First( HANDLE hSnapshot, LPPROCESSENTRY32 lppe ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Process32First( HANDLE hSnapshot, LPPROCESSENTRY32 lppe ) +{ + static FN_Process32First *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Process32First", &g_Kernel32); + return pfn( hSnapshot, lppe ); +} + +typedef BOOL WINAPI FN_Process32Next( HANDLE hSnapshot, LPPROCESSENTRY32 lppe ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Process32Next( HANDLE hSnapshot, LPPROCESSENTRY32 lppe ) +{ + static FN_Process32Next *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Process32Next", &g_Kernel32); + return pfn( hSnapshot, lppe ); +} + +typedef BOOL WINAPI FN_Thread32First( HANDLE hSnapshot, LPTHREADENTRY32 lpte ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Thread32First( HANDLE hSnapshot, LPTHREADENTRY32 lpte ) +{ + static FN_Thread32First *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Thread32First", &g_Kernel32); + return pfn( hSnapshot, lpte ); +} + +typedef BOOL WINAPI FN_Thread32Next( HANDLE hSnapshot, LPTHREADENTRY32 lpte ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Thread32Next( HANDLE hSnapshot, LPTHREADENTRY32 lpte ) +{ + static FN_Thread32Next *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Thread32Next", &g_Kernel32); + return pfn( hSnapshot, lpte ); +} + +typedef BOOL WINAPI FN_Module32FirstW( HANDLE hSnapshot, LPMODULEENTRY32W lpme ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Module32FirstW( HANDLE hSnapshot, LPMODULEENTRY32W lpme ) +{ + static FN_Module32FirstW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Module32FirstW", &g_Kernel32); + return pfn( hSnapshot, lpme ); +} + +typedef BOOL WINAPI FN_Module32NextW( HANDLE hSnapshot, LPMODULEENTRY32W lpme ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Module32NextW( HANDLE hSnapshot, LPMODULEENTRY32W lpme ) +{ + static FN_Module32NextW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Module32NextW", &g_Kernel32); + return pfn( hSnapshot, lpme ); +} + +typedef BOOL WINAPI FN_Module32First( HANDLE hSnapshot, LPMODULEENTRY32 lpme ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Module32First( HANDLE hSnapshot, LPMODULEENTRY32 lpme ) +{ + static FN_Module32First *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Module32First", &g_Kernel32); + return pfn( hSnapshot, lpme ); +} + +typedef BOOL WINAPI FN_Module32Next( HANDLE hSnapshot, LPMODULEENTRY32 lpme ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_Module32Next( HANDLE hSnapshot, LPMODULEENTRY32 lpme ) +{ + static FN_Module32Next *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "Module32Next", &g_Kernel32); + return pfn( hSnapshot, lpme ); +} + +typedef BOOL WINAPI FN_ReplaceFile( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_ReplaceFile( LPCSTR lpReplacedFileName, LPCSTR lpReplacementFileName, LPCSTR lpBackupFileName, DWORD dwReplaceFlags, LPVOID lpExclude, LPVOID lpReserved ) +{ + static FN_ReplaceFile *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "ReplaceFile", &g_Kernel32); + return pfn( lpReplacedFileName, lpReplacementFileName, lpBackupFileName, dwReplaceFlags, lpExclude, lpReserved ); +} + +typedef BOOL WINAPI FN_SetConsoleCursor( PVOID pvUnknown1, PVOID pvUnknown2 ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_SetConsoleCursor( PVOID pvUnknown1, PVOID pvUnknown2 ) +{ + static FN_SetConsoleCursor *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "SetConsoleCursor", &g_Kernel32); + return pfn( pvUnknown1, pvUnknown2 ); +} + +typedef LPCH WINAPI FN_GetEnvironmentStringsA( VOID ); +__declspec(dllexport) LPCH WINAPI kPrf2Wrap_GetEnvironmentStringsA( VOID ) +{ + static FN_GetEnvironmentStringsA *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetEnvironmentStringsA", &g_Kernel32); + return pfn (); +} + +typedef BOOL WINAPI FN_GetBinaryType( LPCSTR lpApplicationName, LPDWORD lpBinaryType ); +__declspec(dllexport) BOOL WINAPI kPrf2Wrap_GetBinaryType( LPCSTR lpApplicationName, LPDWORD lpBinaryType ) +{ + static FN_GetBinaryType *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "GetBinaryType", &g_Kernel32); + return pfn( lpApplicationName, lpBinaryType ); +} + +typedef WORD NTAPI FN_RtlCaptureStackBackTrace( DWORD FramesToSkip, DWORD FramesToCapture, PVOID * BackTrace, PDWORD BackTraceHash ); +__declspec(dllexport) WORD NTAPI kPrf2Wrap_RtlCaptureStackBackTrace( DWORD FramesToSkip, DWORD FramesToCapture, PVOID * BackTrace, PDWORD BackTraceHash ) +{ + static FN_RtlCaptureStackBackTrace *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlCaptureStackBackTrace", &g_Kernel32); + return pfn( FramesToSkip, FramesToCapture, BackTrace, BackTraceHash ); +} + +typedef PVOID FN_RtlFillMemory( PVOID pv, int ch, SIZE_T cb ); +__declspec(dllexport) PVOID kPrf2Wrap_RtlFillMemory( PVOID pv, int ch, SIZE_T cb ) +{ + static FN_RtlFillMemory *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlFillMemory", &g_Kernel32); + return pfn( pv, ch, cb ); +} + +typedef PVOID FN_RtlZeroMemory( PVOID pv, SIZE_T cb ); +__declspec(dllexport) PVOID kPrf2Wrap_RtlZeroMemory( PVOID pv, SIZE_T cb ) +{ + static FN_RtlZeroMemory *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlZeroMemory", &g_Kernel32); + return pfn( pv, cb ); +} + +typedef PVOID FN_RtlMoveMemory( PVOID pvDst, PVOID pvSrc, SIZE_T cb ); +__declspec(dllexport) PVOID kPrf2Wrap_RtlMoveMemory( PVOID pvDst, PVOID pvSrc, SIZE_T cb ) +{ + static FN_RtlMoveMemory *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlMoveMemory", &g_Kernel32); + return pfn( pvDst, pvSrc, cb ); +} + +typedef VOID NTAPI FN_RtlUnwind( PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue ); +__declspec(dllexport) VOID NTAPI kPrf2Wrap_RtlUnwind( PVOID TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue ) +{ + static FN_RtlUnwind *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlUnwind", &g_Kernel32); + pfn( TargetFrame, TargetIp, ExceptionRecord, ReturnValue ); +} + +typedef VOID NTAPI FN_RtlUnwindEx( FRAME_POINTERS TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable ); +__declspec(dllexport) VOID NTAPI kPrf2Wrap_RtlUnwindEx( FRAME_POINTERS TargetFrame, PVOID TargetIp, PEXCEPTION_RECORD ExceptionRecord, PVOID ReturnValue, PCONTEXT ContextRecord, PUNWIND_HISTORY_TABLE HistoryTable ) +{ + static FN_RtlUnwindEx *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlUnwindEx", &g_Kernel32); + pfn( TargetFrame, TargetIp, ExceptionRecord, ReturnValue, ContextRecord, HistoryTable ); +} + +typedef ULONGLONG WINAPI FN_RtlVirtualUnwind( ULONG HandlerType, ULONGLONG ImageBase, ULONGLONG ControlPC, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT ContextRecord, PBOOLEAN InFunction, PFRAME_POINTERS EstablisherFrame, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers ); +__declspec(dllexport) ULONGLONG WINAPI kPrf2Wrap_RtlVirtualUnwind( ULONG HandlerType, ULONGLONG ImageBase, ULONGLONG ControlPC, PRUNTIME_FUNCTION FunctionEntry, PCONTEXT ContextRecord, PBOOLEAN InFunction, PFRAME_POINTERS EstablisherFrame, PKNONVOLATILE_CONTEXT_POINTERS ContextPointers ) +{ + static FN_RtlVirtualUnwind *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlVirtualUnwind", &g_Kernel32); + return pfn( HandlerType, ImageBase, ControlPC, FunctionEntry, ContextRecord, InFunction, EstablisherFrame, ContextPointers ); +} + +typedef PVOID WINAPI FN_RtlPcToFileHeader( PVOID PcValue, PVOID * BaseOfImage ); +__declspec(dllexport) PVOID WINAPI kPrf2Wrap_RtlPcToFileHeader( PVOID PcValue, PVOID * BaseOfImage ) +{ + static FN_RtlPcToFileHeader *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlPcToFileHeader", &g_Kernel32); + return pfn( PcValue, BaseOfImage ); +} + +typedef PVOID WINAPI FN_RtlLookupFunctionEntry( ULONGLONG ControlPC, PULONGLONG ImageBase, PULONGLONG TargetGp ); +__declspec(dllexport) PVOID WINAPI kPrf2Wrap_RtlLookupFunctionEntry( ULONGLONG ControlPC, PULONGLONG ImageBase, PULONGLONG TargetGp ) +{ + static FN_RtlLookupFunctionEntry *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlLookupFunctionEntry", &g_Kernel32); + return pfn( ControlPC, ImageBase, TargetGp ); +} + +typedef void WINAPI FN_RtlRaiseException(PEXCEPTION_RECORD pXcpRec); +__declspec(dllexport) void WINAPI kPrf2Wrap_RtlRaiseException(PEXCEPTION_RECORD pXcpRec) +{ + static FN_RtlRaiseException *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "RtlRaiseException", &g_Kernel32); + pfn( pXcpRec); +} + +typedef int WINAPI FN_uaw_lstrcmpW( LPCUWSTR lpString1, LPCUWSTR lpString2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_uaw_lstrcmpW( LPCUWSTR lpString1, LPCUWSTR lpString2 ) +{ + static FN_uaw_lstrcmpW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "uaw_lstrcmpW", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef int WINAPI FN_uaw_lstrcmpiW( LPCUWSTR lpString1, LPCUWSTR lpString2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_uaw_lstrcmpiW( LPCUWSTR lpString1, LPCUWSTR lpString2 ) +{ + static FN_uaw_lstrcmpiW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "uaw_lstrcmpiW", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef int WINAPI FN_uaw_lstrlenW( LPCUWSTR lpString ); +__declspec(dllexport) int WINAPI kPrf2Wrap_uaw_lstrlenW( LPCUWSTR lpString ) +{ + static FN_uaw_lstrlenW *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "uaw_lstrlenW", &g_Kernel32); + return pfn( lpString ); +} + +typedef LPUWSTR WINAPI FN_uaw_wcschr( LPCUWSTR lpString, WCHAR wc ); +__declspec(dllexport) LPUWSTR WINAPI kPrf2Wrap_uaw_wcschr( LPCUWSTR lpString, WCHAR wc ) +{ + static FN_uaw_wcschr *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "uaw_wcschr", &g_Kernel32); + return pfn( lpString, wc ); +} + +typedef LPUWSTR WINAPI FN_uaw_wcscpy( LPUWSTR lpDst, LPCUWSTR lpSrc ); +__declspec(dllexport) LPUWSTR WINAPI kPrf2Wrap_uaw_wcscpy( LPUWSTR lpDst, LPCUWSTR lpSrc ) +{ + static FN_uaw_wcscpy *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "uaw_wcscpy", &g_Kernel32); + return pfn( lpDst, lpSrc ); +} + +typedef int WINAPI FN_uaw_wcsicmp( LPCUWSTR lp1, LPCUWSTR lp2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_uaw_wcsicmp( LPCUWSTR lp1, LPCUWSTR lp2 ) +{ + static FN_uaw_wcsicmp *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "uaw_wcsicmp", &g_Kernel32); + return pfn( lp1, lp2 ); +} + +typedef SIZE_T WINAPI FN_uaw_wcslen( LPCUWSTR lp1 ); +__declspec(dllexport) SIZE_T WINAPI kPrf2Wrap_uaw_wcslen( LPCUWSTR lp1 ) +{ + static FN_uaw_wcslen *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "uaw_wcslen", &g_Kernel32); + return pfn( lp1 ); +} + +typedef LPUWSTR WINAPI FN_uaw_wcsrchr( LPCUWSTR lpString, WCHAR wc ); +__declspec(dllexport) LPUWSTR WINAPI kPrf2Wrap_uaw_wcsrchr( LPCUWSTR lpString, WCHAR wc ) +{ + static FN_uaw_wcsrchr *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "uaw_wcsrchr", &g_Kernel32); + return pfn( lpString, wc ); +} + +typedef LPSTR WINAPI FN_lstrcat( LPSTR lpString1, LPCSTR lpString2 ); +__declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcat( LPSTR lpString1, LPCSTR lpString2 ) +{ + static FN_lstrcat *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcat", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef int WINAPI FN_lstrcmp( LPCSTR lpString1, LPCSTR lpString2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmp( LPCSTR lpString1, LPCSTR lpString2 ) +{ + static FN_lstrcmp *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcmp", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef int WINAPI FN_lstrcmpi( LPCSTR lpString1, LPCSTR lpString2 ); +__declspec(dllexport) int WINAPI kPrf2Wrap_lstrcmpi( LPCSTR lpString1, LPCSTR lpString2 ) +{ + static FN_lstrcmpi *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcmpi", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef LPSTR WINAPI FN_lstrcpy( LPSTR lpString1, LPCSTR lpString2 ); +__declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcpy( LPSTR lpString1, LPCSTR lpString2 ) +{ + static FN_lstrcpy *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcpy", &g_Kernel32); + return pfn( lpString1, lpString2 ); +} + +typedef LPSTR WINAPI FN_lstrcpyn( LPSTR lpString1, LPCSTR lpString2, int iMaxLength ); +__declspec(dllexport) LPSTR WINAPI kPrf2Wrap_lstrcpyn( LPSTR lpString1, LPCSTR lpString2, int iMaxLength ) +{ + static FN_lstrcpyn *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrcpyn", &g_Kernel32); + return pfn( lpString1, lpString2, iMaxLength ); +} + +typedef int WINAPI FN_lstrlen( LPCSTR lpString ); +__declspec(dllexport) int WINAPI kPrf2Wrap_lstrlen( LPCSTR lpString ) +{ + static FN_lstrlen *pfn = 0; + if (!pfn) + kPrf2WrapResolve((void **)&pfn, "lstrlen", &g_Kernel32); + return pfn( lpString ); +} + diff --git a/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappers.c b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappers.c new file mode 100644 index 0000000..ecb31f0 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappers.c @@ -0,0 +1,123 @@ +/* $Id: kPrf2WinApiWrappers.c 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * Wrappers for a number of common Windows APIs. + */ + +/* + * Copyright (c) 2008 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#define _ADVAPI32_ +#define _KERNEL32_ +#define _WIN32_WINNT 0x0600 +#define UNICODE +#include <Windows.h> +#include <TLHelp32.h> +#include <k/kDefs.h> +#include "kPrf2WinApiWrapperHlp.h" + +#if K_ARCH == K_ARCH_X86_32 +typedef PVOID PRUNTIME_FUNCTION; +typedef FARPROC PGET_RUNTIME_FUNCTION_CALLBACK; +#endif + +/* RtlUnwindEx is used by msvcrt on amd64, but winnt.h only defines it for IA64... */ +typedef struct _FRAME_POINTERS { + ULONGLONG MemoryStackFp; + ULONGLONG BackingStoreFp; +} FRAME_POINTERS, *PFRAME_POINTERS; +typedef PVOID PUNWIND_HISTORY_TABLE; +typedef PVOID PKNONVOLATILE_CONTEXT_POINTERS; + + +/******************************************************************************* +* Global Variables * +*******************************************************************************/ +KPRF2WRAPDLL g_Kernel32 = +{ + INVALID_HANDLE_VALUE, "KERNEL32" +}; + + +/* + * Include the generated code. + */ +#include "kPrf2WinApiWrappers-kernel32.h" + +/* TODO (amd64): + +AddLocalAlternateComputerNameA +AddLocalAlternateComputerNameW +EnumerateLocalComputerNamesA +EnumerateLocalComputerNamesW +RemoveLocalAlternateComputerNameA +RemoveLocalAlternateComputerNameW + +RtlLookupFunctionEntry +RtlPcToFileHeader +RtlRaiseException +RtlVirtualUnwind + +SetConsoleCursor +SetLocalPrimaryComputerNameA +SetLocalPrimaryComputerNameW +__C_specific_handler +__misaligned_access +_local_unwind + +*/ + + +/** + * The DLL Main for the Windows API wrapper DLL. + * + * @returns Success indicator. + * @param hInstDll The instance handle of the DLL. (i.e. the module handle) + * @param fdwReason The reason why we're here. This is a 'flag' for reasons of + * tradition, it's really a kind of enum. + * @param pReserved Reserved / undocumented something. + */ +BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, PVOID pReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + break; + + case DLL_PROCESS_DETACH: + break; + + case DLL_THREAD_ATTACH: + break; + + case DLL_THREAD_DETACH: + break; + } + + return TRUE; +} + diff --git a/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappersImp-amd64.def b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappersImp-amd64.def new file mode 100644 index 0000000..48e4198 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappersImp-amd64.def @@ -0,0 +1,854 @@ +LIBRARY kPrf2WinApiWrappers +EXPORTS + ActivateActCtx=kPrf2Wrap_ActivateActCtx + AddAtomA=kPrf2Wrap_AddAtomA + AddAtomW=kPrf2Wrap_AddAtomW + AddConsoleAliasA=kPrf2Wrap_AddConsoleAliasA + AddConsoleAliasW=kPrf2Wrap_AddConsoleAliasW + AddRefActCtx=kPrf2Wrap_AddRefActCtx + AddVectoredContinueHandler=kPrf2Wrap_AddVectoredContinueHandler + AddVectoredExceptionHandler=kPrf2Wrap_AddVectoredExceptionHandler + AllocConsole=kPrf2Wrap_AllocConsole + AllocateUserPhysicalPages=kPrf2Wrap_AllocateUserPhysicalPages + AreFileApisANSI=kPrf2Wrap_AreFileApisANSI + AssignProcessToJobObject=kPrf2Wrap_AssignProcessToJobObject + AttachConsole=kPrf2Wrap_AttachConsole + BackupRead=kPrf2Wrap_BackupRead + BackupSeek=kPrf2Wrap_BackupSeek + BackupWrite=kPrf2Wrap_BackupWrite + Beep=kPrf2Wrap_Beep + BeginUpdateResourceA=kPrf2Wrap_BeginUpdateResourceA + BeginUpdateResourceW=kPrf2Wrap_BeginUpdateResourceW + BindIoCompletionCallback=kPrf2Wrap_BindIoCompletionCallback + BuildCommDCBA=kPrf2Wrap_BuildCommDCBA + BuildCommDCBAndTimeoutsA=kPrf2Wrap_BuildCommDCBAndTimeoutsA + BuildCommDCBAndTimeoutsW=kPrf2Wrap_BuildCommDCBAndTimeoutsW + BuildCommDCBW=kPrf2Wrap_BuildCommDCBW + CallNamedPipeA=kPrf2Wrap_CallNamedPipeA + CallNamedPipeW=kPrf2Wrap_CallNamedPipeW + CancelDeviceWakeupRequest=kPrf2Wrap_CancelDeviceWakeupRequest + CancelIo=kPrf2Wrap_CancelIo + CancelTimerQueueTimer=kPrf2Wrap_CancelTimerQueueTimer + CancelWaitableTimer=kPrf2Wrap_CancelWaitableTimer + ChangeTimerQueueTimer=kPrf2Wrap_ChangeTimerQueueTimer + CheckNameLegalDOS8Dot3A=kPrf2Wrap_CheckNameLegalDOS8Dot3A + CheckNameLegalDOS8Dot3W=kPrf2Wrap_CheckNameLegalDOS8Dot3W + CheckRemoteDebuggerPresent=kPrf2Wrap_CheckRemoteDebuggerPresent + ClearCommBreak=kPrf2Wrap_ClearCommBreak + ClearCommError=kPrf2Wrap_ClearCommError + CloseHandle=kPrf2Wrap_CloseHandle + CommConfigDialogA=kPrf2Wrap_CommConfigDialogA + CommConfigDialogW=kPrf2Wrap_CommConfigDialogW + CompareFileTime=kPrf2Wrap_CompareFileTime + CompareStringA=kPrf2Wrap_CompareStringA + CompareStringW=kPrf2Wrap_CompareStringW + ConnectNamedPipe=kPrf2Wrap_ConnectNamedPipe + ContinueDebugEvent=kPrf2Wrap_ContinueDebugEvent + ConvertDefaultLocale=kPrf2Wrap_ConvertDefaultLocale + ConvertFiberToThread=kPrf2Wrap_ConvertFiberToThread + ConvertThreadToFiber=kPrf2Wrap_ConvertThreadToFiber + ConvertThreadToFiberEx=kPrf2Wrap_ConvertThreadToFiberEx + CopyFileA=kPrf2Wrap_CopyFileA + CopyFileExA=kPrf2Wrap_CopyFileExA + CopyFileExW=kPrf2Wrap_CopyFileExW + CopyFileW=kPrf2Wrap_CopyFileW + CreateActCtxA=kPrf2Wrap_CreateActCtxA + CreateActCtxW=kPrf2Wrap_CreateActCtxW + CreateConsoleScreenBuffer=kPrf2Wrap_CreateConsoleScreenBuffer + CreateDirectoryA=kPrf2Wrap_CreateDirectoryA + CreateDirectoryExA=kPrf2Wrap_CreateDirectoryExA + CreateDirectoryExW=kPrf2Wrap_CreateDirectoryExW + CreateDirectoryW=kPrf2Wrap_CreateDirectoryW + CreateEventA=kPrf2Wrap_CreateEventA + CreateEventW=kPrf2Wrap_CreateEventW + CreateFiber=kPrf2Wrap_CreateFiber + CreateFiberEx=kPrf2Wrap_CreateFiberEx + CreateFileA=kPrf2Wrap_CreateFileA + CreateFileMappingA=kPrf2Wrap_CreateFileMappingA + CreateFileMappingW=kPrf2Wrap_CreateFileMappingW + CreateFileW=kPrf2Wrap_CreateFileW + CreateHardLinkA=kPrf2Wrap_CreateHardLinkA + CreateHardLinkW=kPrf2Wrap_CreateHardLinkW + CreateIoCompletionPort=kPrf2Wrap_CreateIoCompletionPort + CreateJobObjectA=kPrf2Wrap_CreateJobObjectA + CreateJobObjectW=kPrf2Wrap_CreateJobObjectW + CreateJobSet=kPrf2Wrap_CreateJobSet + CreateMailslotA=kPrf2Wrap_CreateMailslotA + CreateMailslotW=kPrf2Wrap_CreateMailslotW + CreateMemoryResourceNotification=kPrf2Wrap_CreateMemoryResourceNotification + CreateMutexA=kPrf2Wrap_CreateMutexA + CreateMutexW=kPrf2Wrap_CreateMutexW + CreateNamedPipeA=kPrf2Wrap_CreateNamedPipeA + CreateNamedPipeW=kPrf2Wrap_CreateNamedPipeW + CreatePipe=kPrf2Wrap_CreatePipe + CreateProcessA=kPrf2Wrap_CreateProcessA + CreateProcessW=kPrf2Wrap_CreateProcessW + CreateRemoteThread=kPrf2Wrap_CreateRemoteThread + CreateSemaphoreA=kPrf2Wrap_CreateSemaphoreA + CreateSemaphoreW=kPrf2Wrap_CreateSemaphoreW + CreateTapePartition=kPrf2Wrap_CreateTapePartition + CreateThread=kPrf2Wrap_CreateThread + CreateTimerQueue=kPrf2Wrap_CreateTimerQueue + CreateTimerQueueTimer=kPrf2Wrap_CreateTimerQueueTimer + CreateToolhelp32Snapshot=kPrf2Wrap_CreateToolhelp32Snapshot + CreateWaitableTimerA=kPrf2Wrap_CreateWaitableTimerA + CreateWaitableTimerW=kPrf2Wrap_CreateWaitableTimerW + DeactivateActCtx=kPrf2Wrap_DeactivateActCtx + DebugActiveProcess=kPrf2Wrap_DebugActiveProcess + DebugActiveProcessStop=kPrf2Wrap_DebugActiveProcessStop + DebugBreak=kPrf2Wrap_DebugBreak + DebugBreakProcess=kPrf2Wrap_DebugBreakProcess + DebugSetProcessKillOnExit=kPrf2Wrap_DebugSetProcessKillOnExit + DecodePointer=kPrf2Wrap_DecodePointer + DecodeSystemPointer=kPrf2Wrap_DecodeSystemPointer + DefineDosDeviceA=kPrf2Wrap_DefineDosDeviceA + DefineDosDeviceW=kPrf2Wrap_DefineDosDeviceW + DeleteAtom=kPrf2Wrap_DeleteAtom + DeleteCriticalSection=kPrf2Wrap_DeleteCriticalSection + DeleteFiber=kPrf2Wrap_DeleteFiber + DeleteFileA=kPrf2Wrap_DeleteFileA + DeleteFileW=kPrf2Wrap_DeleteFileW + DeleteTimerQueue=kPrf2Wrap_DeleteTimerQueue + DeleteTimerQueueEx=kPrf2Wrap_DeleteTimerQueueEx + DeleteTimerQueueTimer=kPrf2Wrap_DeleteTimerQueueTimer + DeleteVolumeMountPointA=kPrf2Wrap_DeleteVolumeMountPointA + DeleteVolumeMountPointW=kPrf2Wrap_DeleteVolumeMountPointW + DeviceIoControl=kPrf2Wrap_DeviceIoControl + DisableThreadLibraryCalls=kPrf2Wrap_DisableThreadLibraryCalls + DisconnectNamedPipe=kPrf2Wrap_DisconnectNamedPipe + DnsHostnameToComputerNameA=kPrf2Wrap_DnsHostnameToComputerNameA + DnsHostnameToComputerNameW=kPrf2Wrap_DnsHostnameToComputerNameW + DosDateTimeToFileTime=kPrf2Wrap_DosDateTimeToFileTime + DuplicateHandle=kPrf2Wrap_DuplicateHandle + EncodePointer=kPrf2Wrap_EncodePointer + EncodeSystemPointer=kPrf2Wrap_EncodeSystemPointer + EndUpdateResourceA=kPrf2Wrap_EndUpdateResourceA + EndUpdateResourceW=kPrf2Wrap_EndUpdateResourceW + EnterCriticalSection=kPrf2Wrap_EnterCriticalSection + EnumCalendarInfoA=kPrf2Wrap_EnumCalendarInfoA + EnumCalendarInfoExA=kPrf2Wrap_EnumCalendarInfoExA + EnumCalendarInfoExW=kPrf2Wrap_EnumCalendarInfoExW + EnumCalendarInfoW=kPrf2Wrap_EnumCalendarInfoW + EnumDateFormatsA=kPrf2Wrap_EnumDateFormatsA + EnumDateFormatsExA=kPrf2Wrap_EnumDateFormatsExA + EnumDateFormatsExW=kPrf2Wrap_EnumDateFormatsExW + EnumDateFormatsW=kPrf2Wrap_EnumDateFormatsW + EnumLanguageGroupLocalesA=kPrf2Wrap_EnumLanguageGroupLocalesA + EnumLanguageGroupLocalesW=kPrf2Wrap_EnumLanguageGroupLocalesW + EnumResourceLanguagesA=kPrf2Wrap_EnumResourceLanguagesA + EnumResourceLanguagesW=kPrf2Wrap_EnumResourceLanguagesW + EnumResourceNamesA=kPrf2Wrap_EnumResourceNamesA + EnumResourceNamesW=kPrf2Wrap_EnumResourceNamesW + EnumResourceTypesA=kPrf2Wrap_EnumResourceTypesA + EnumResourceTypesW=kPrf2Wrap_EnumResourceTypesW + EnumSystemCodePagesA=kPrf2Wrap_EnumSystemCodePagesA + EnumSystemCodePagesW=kPrf2Wrap_EnumSystemCodePagesW + EnumSystemFirmwareTables=kPrf2Wrap_EnumSystemFirmwareTables + EnumSystemGeoID=kPrf2Wrap_EnumSystemGeoID + EnumSystemLanguageGroupsA=kPrf2Wrap_EnumSystemLanguageGroupsA + EnumSystemLanguageGroupsW=kPrf2Wrap_EnumSystemLanguageGroupsW + EnumSystemLocalesA=kPrf2Wrap_EnumSystemLocalesA + EnumSystemLocalesW=kPrf2Wrap_EnumSystemLocalesW + EnumTimeFormatsA=kPrf2Wrap_EnumTimeFormatsA + EnumTimeFormatsW=kPrf2Wrap_EnumTimeFormatsW + EnumUILanguagesA=kPrf2Wrap_EnumUILanguagesA + EnumUILanguagesW=kPrf2Wrap_EnumUILanguagesW + EraseTape=kPrf2Wrap_EraseTape + EscapeCommFunction=kPrf2Wrap_EscapeCommFunction + ExitProcess=kPrf2Wrap_ExitProcess + ExitThread=kPrf2Wrap_ExitThread + ExpandEnvironmentStringsA=kPrf2Wrap_ExpandEnvironmentStringsA + ExpandEnvironmentStringsW=kPrf2Wrap_ExpandEnvironmentStringsW + FatalAppExitA=kPrf2Wrap_FatalAppExitA + FatalAppExitW=kPrf2Wrap_FatalAppExitW + FatalExit=kPrf2Wrap_FatalExit + FileTimeToDosDateTime=kPrf2Wrap_FileTimeToDosDateTime + FileTimeToLocalFileTime=kPrf2Wrap_FileTimeToLocalFileTime + FileTimeToSystemTime=kPrf2Wrap_FileTimeToSystemTime + FillConsoleOutputAttribute=kPrf2Wrap_FillConsoleOutputAttribute + FillConsoleOutputCharacterA=kPrf2Wrap_FillConsoleOutputCharacterA + FillConsoleOutputCharacterW=kPrf2Wrap_FillConsoleOutputCharacterW + FindActCtxSectionGuid=kPrf2Wrap_FindActCtxSectionGuid + FindActCtxSectionStringA=kPrf2Wrap_FindActCtxSectionStringA + FindActCtxSectionStringW=kPrf2Wrap_FindActCtxSectionStringW + FindAtomA=kPrf2Wrap_FindAtomA + FindAtomW=kPrf2Wrap_FindAtomW + FindClose=kPrf2Wrap_FindClose + FindCloseChangeNotification=kPrf2Wrap_FindCloseChangeNotification + FindFirstChangeNotificationA=kPrf2Wrap_FindFirstChangeNotificationA + FindFirstChangeNotificationW=kPrf2Wrap_FindFirstChangeNotificationW + FindFirstFileA=kPrf2Wrap_FindFirstFileA + FindFirstFileExA=kPrf2Wrap_FindFirstFileExA + FindFirstFileExW=kPrf2Wrap_FindFirstFileExW + FindFirstFileW=kPrf2Wrap_FindFirstFileW + FindFirstStreamW=kPrf2Wrap_FindFirstStreamW + FindFirstVolumeA=kPrf2Wrap_FindFirstVolumeA + FindFirstVolumeMountPointA=kPrf2Wrap_FindFirstVolumeMountPointA + FindFirstVolumeMountPointW=kPrf2Wrap_FindFirstVolumeMountPointW + FindFirstVolumeW=kPrf2Wrap_FindFirstVolumeW + FindNextChangeNotification=kPrf2Wrap_FindNextChangeNotification + FindNextFileA=kPrf2Wrap_FindNextFileA + FindNextFileW=kPrf2Wrap_FindNextFileW + FindNextStreamW=kPrf2Wrap_FindNextStreamW + FindNextVolumeA=kPrf2Wrap_FindNextVolumeA + FindNextVolumeMountPointA=kPrf2Wrap_FindNextVolumeMountPointA + FindNextVolumeMountPointW=kPrf2Wrap_FindNextVolumeMountPointW + FindNextVolumeW=kPrf2Wrap_FindNextVolumeW + FindResourceA=kPrf2Wrap_FindResourceA + FindResourceExA=kPrf2Wrap_FindResourceExA + FindResourceExW=kPrf2Wrap_FindResourceExW + FindResourceW=kPrf2Wrap_FindResourceW + FindVolumeClose=kPrf2Wrap_FindVolumeClose + FindVolumeMountPointClose=kPrf2Wrap_FindVolumeMountPointClose + FlsAlloc=kPrf2Wrap_FlsAlloc + FlsFree=kPrf2Wrap_FlsFree + FlsGetValue=kPrf2Wrap_FlsGetValue + FlsSetValue=kPrf2Wrap_FlsSetValue + FlushConsoleInputBuffer=kPrf2Wrap_FlushConsoleInputBuffer + FlushFileBuffers=kPrf2Wrap_FlushFileBuffers + FlushInstructionCache=kPrf2Wrap_FlushInstructionCache + FlushViewOfFile=kPrf2Wrap_FlushViewOfFile + FoldStringA=kPrf2Wrap_FoldStringA + FoldStringW=kPrf2Wrap_FoldStringW + FormatMessageA=kPrf2Wrap_FormatMessageA + FormatMessageW=kPrf2Wrap_FormatMessageW + FreeConsole=kPrf2Wrap_FreeConsole + FreeEnvironmentStringsA=kPrf2Wrap_FreeEnvironmentStringsA + FreeEnvironmentStringsW=kPrf2Wrap_FreeEnvironmentStringsW + FreeLibrary=kPrf2Wrap_FreeLibrary + FreeLibraryAndExitThread=kPrf2Wrap_FreeLibraryAndExitThread + FreeResource=kPrf2Wrap_FreeResource + FreeUserPhysicalPages=kPrf2Wrap_FreeUserPhysicalPages + GenerateConsoleCtrlEvent=kPrf2Wrap_GenerateConsoleCtrlEvent + GetACP=kPrf2Wrap_GetACP + GetAtomNameA=kPrf2Wrap_GetAtomNameA + GetAtomNameW=kPrf2Wrap_GetAtomNameW + GetBinaryType=kPrf2Wrap_GetBinaryType + GetBinaryTypeA=kPrf2Wrap_GetBinaryTypeA + GetBinaryTypeW=kPrf2Wrap_GetBinaryTypeW + GetCPInfo=kPrf2Wrap_GetCPInfo + GetCPInfoExA=kPrf2Wrap_GetCPInfoExA + GetCPInfoExW=kPrf2Wrap_GetCPInfoExW + GetCalendarInfoA=kPrf2Wrap_GetCalendarInfoA + GetCalendarInfoW=kPrf2Wrap_GetCalendarInfoW + GetCommConfig=kPrf2Wrap_GetCommConfig + GetCommMask=kPrf2Wrap_GetCommMask + GetCommModemStatus=kPrf2Wrap_GetCommModemStatus + GetCommProperties=kPrf2Wrap_GetCommProperties + GetCommState=kPrf2Wrap_GetCommState + GetCommTimeouts=kPrf2Wrap_GetCommTimeouts + GetCommandLineA=kPrf2Wrap_GetCommandLineA + GetCommandLineW=kPrf2Wrap_GetCommandLineW + GetCompressedFileSizeA=kPrf2Wrap_GetCompressedFileSizeA + GetCompressedFileSizeW=kPrf2Wrap_GetCompressedFileSizeW + GetComputerNameA=kPrf2Wrap_GetComputerNameA + GetComputerNameExA=kPrf2Wrap_GetComputerNameExA + GetComputerNameExW=kPrf2Wrap_GetComputerNameExW + GetComputerNameW=kPrf2Wrap_GetComputerNameW + GetConsoleAliasA=kPrf2Wrap_GetConsoleAliasA + GetConsoleAliasExesA=kPrf2Wrap_GetConsoleAliasExesA + GetConsoleAliasExesLengthA=kPrf2Wrap_GetConsoleAliasExesLengthA + GetConsoleAliasExesLengthW=kPrf2Wrap_GetConsoleAliasExesLengthW + GetConsoleAliasExesW=kPrf2Wrap_GetConsoleAliasExesW + GetConsoleAliasW=kPrf2Wrap_GetConsoleAliasW + GetConsoleAliasesA=kPrf2Wrap_GetConsoleAliasesA + GetConsoleAliasesLengthA=kPrf2Wrap_GetConsoleAliasesLengthA + GetConsoleAliasesLengthW=kPrf2Wrap_GetConsoleAliasesLengthW + GetConsoleAliasesW=kPrf2Wrap_GetConsoleAliasesW + GetConsoleCP=kPrf2Wrap_GetConsoleCP + GetConsoleCursorInfo=kPrf2Wrap_GetConsoleCursorInfo + GetConsoleDisplayMode=kPrf2Wrap_GetConsoleDisplayMode + GetConsoleFontSize=kPrf2Wrap_GetConsoleFontSize + GetConsoleMode=kPrf2Wrap_GetConsoleMode + GetConsoleOutputCP=kPrf2Wrap_GetConsoleOutputCP + GetConsoleProcessList=kPrf2Wrap_GetConsoleProcessList + GetConsoleScreenBufferInfo=kPrf2Wrap_GetConsoleScreenBufferInfo + GetConsoleSelectionInfo=kPrf2Wrap_GetConsoleSelectionInfo + GetConsoleTitleA=kPrf2Wrap_GetConsoleTitleA + GetConsoleTitleW=kPrf2Wrap_GetConsoleTitleW + GetConsoleWindow=kPrf2Wrap_GetConsoleWindow + GetCurrencyFormatA=kPrf2Wrap_GetCurrencyFormatA + GetCurrencyFormatW=kPrf2Wrap_GetCurrencyFormatW + GetCurrentActCtx=kPrf2Wrap_GetCurrentActCtx + GetCurrentConsoleFont=kPrf2Wrap_GetCurrentConsoleFont + GetCurrentDirectoryA=kPrf2Wrap_GetCurrentDirectoryA + GetCurrentDirectoryW=kPrf2Wrap_GetCurrentDirectoryW + GetCurrentProcess=kPrf2Wrap_GetCurrentProcess + GetCurrentProcessId=kPrf2Wrap_GetCurrentProcessId + GetCurrentProcessorNumber=kPrf2Wrap_GetCurrentProcessorNumber + GetCurrentThread=kPrf2Wrap_GetCurrentThread + GetCurrentThreadId=kPrf2Wrap_GetCurrentThreadId + GetDateFormatA=kPrf2Wrap_GetDateFormatA + GetDateFormatW=kPrf2Wrap_GetDateFormatW + GetDefaultCommConfigA=kPrf2Wrap_GetDefaultCommConfigA + GetDefaultCommConfigW=kPrf2Wrap_GetDefaultCommConfigW + GetDevicePowerState=kPrf2Wrap_GetDevicePowerState + GetDiskFreeSpaceA=kPrf2Wrap_GetDiskFreeSpaceA + GetDiskFreeSpaceExA=kPrf2Wrap_GetDiskFreeSpaceExA + GetDiskFreeSpaceExW=kPrf2Wrap_GetDiskFreeSpaceExW + GetDiskFreeSpaceW=kPrf2Wrap_GetDiskFreeSpaceW + GetDllDirectoryA=kPrf2Wrap_GetDllDirectoryA + GetDllDirectoryW=kPrf2Wrap_GetDllDirectoryW + GetDriveTypeA=kPrf2Wrap_GetDriveTypeA + GetDriveTypeW=kPrf2Wrap_GetDriveTypeW + GetEnvironmentStrings=kPrf2Wrap_GetEnvironmentStrings + GetEnvironmentStringsA=kPrf2Wrap_GetEnvironmentStringsA + GetEnvironmentStringsW=kPrf2Wrap_GetEnvironmentStringsW + GetEnvironmentVariableA=kPrf2Wrap_GetEnvironmentVariableA + GetEnvironmentVariableW=kPrf2Wrap_GetEnvironmentVariableW + GetExitCodeProcess=kPrf2Wrap_GetExitCodeProcess + GetExitCodeThread=kPrf2Wrap_GetExitCodeThread + GetFileAttributesA=kPrf2Wrap_GetFileAttributesA + GetFileAttributesExA=kPrf2Wrap_GetFileAttributesExA + GetFileAttributesExW=kPrf2Wrap_GetFileAttributesExW + GetFileAttributesW=kPrf2Wrap_GetFileAttributesW + GetFileInformationByHandle=kPrf2Wrap_GetFileInformationByHandle + GetFileSize=kPrf2Wrap_GetFileSize + GetFileSizeEx=kPrf2Wrap_GetFileSizeEx + GetFileTime=kPrf2Wrap_GetFileTime + GetFileType=kPrf2Wrap_GetFileType + GetFirmwareEnvironmentVariableA=kPrf2Wrap_GetFirmwareEnvironmentVariableA + GetFirmwareEnvironmentVariableW=kPrf2Wrap_GetFirmwareEnvironmentVariableW + GetFullPathNameA=kPrf2Wrap_GetFullPathNameA + GetFullPathNameW=kPrf2Wrap_GetFullPathNameW + GetGeoInfoA=kPrf2Wrap_GetGeoInfoA + GetGeoInfoW=kPrf2Wrap_GetGeoInfoW + GetHandleInformation=kPrf2Wrap_GetHandleInformation + GetLargePageMinimum=kPrf2Wrap_GetLargePageMinimum + GetLargestConsoleWindowSize=kPrf2Wrap_GetLargestConsoleWindowSize + GetLastError=kPrf2Wrap_GetLastError + GetLocalTime=kPrf2Wrap_GetLocalTime + GetLocaleInfoA=kPrf2Wrap_GetLocaleInfoA + GetLocaleInfoW=kPrf2Wrap_GetLocaleInfoW + GetLogicalDriveStringsA=kPrf2Wrap_GetLogicalDriveStringsA + GetLogicalDriveStringsW=kPrf2Wrap_GetLogicalDriveStringsW + GetLogicalDrives=kPrf2Wrap_GetLogicalDrives + GetLogicalProcessorInformation=kPrf2Wrap_GetLogicalProcessorInformation + GetLongPathNameA=kPrf2Wrap_GetLongPathNameA + GetLongPathNameW=kPrf2Wrap_GetLongPathNameW + GetMailslotInfo=kPrf2Wrap_GetMailslotInfo + GetModuleFileNameA=kPrf2Wrap_GetModuleFileNameA + GetModuleFileNameW=kPrf2Wrap_GetModuleFileNameW + GetModuleHandleA=kPrf2Wrap_GetModuleHandleA + GetModuleHandleExA=kPrf2Wrap_GetModuleHandleExA + GetModuleHandleExW=kPrf2Wrap_GetModuleHandleExW + GetModuleHandleW=kPrf2Wrap_GetModuleHandleW + GetNLSVersion=kPrf2Wrap_GetNLSVersion + GetNamedPipeHandleStateA=kPrf2Wrap_GetNamedPipeHandleStateA + GetNamedPipeHandleStateW=kPrf2Wrap_GetNamedPipeHandleStateW + GetNamedPipeInfo=kPrf2Wrap_GetNamedPipeInfo + GetNativeSystemInfo=kPrf2Wrap_GetNativeSystemInfo + GetNumaAvailableMemoryNode=kPrf2Wrap_GetNumaAvailableMemoryNode + GetNumaHighestNodeNumber=kPrf2Wrap_GetNumaHighestNodeNumber + GetNumaNodeProcessorMask=kPrf2Wrap_GetNumaNodeProcessorMask + GetNumaProcessorNode=kPrf2Wrap_GetNumaProcessorNode + GetNumberFormatA=kPrf2Wrap_GetNumberFormatA + GetNumberFormatW=kPrf2Wrap_GetNumberFormatW + GetNumberOfConsoleInputEvents=kPrf2Wrap_GetNumberOfConsoleInputEvents + GetNumberOfConsoleMouseButtons=kPrf2Wrap_GetNumberOfConsoleMouseButtons + GetOEMCP=kPrf2Wrap_GetOEMCP + GetOverlappedResult=kPrf2Wrap_GetOverlappedResult + GetPriorityClass=kPrf2Wrap_GetPriorityClass + GetPrivateProfileIntA=kPrf2Wrap_GetPrivateProfileIntA + GetPrivateProfileIntW=kPrf2Wrap_GetPrivateProfileIntW + GetPrivateProfileSectionA=kPrf2Wrap_GetPrivateProfileSectionA + GetPrivateProfileSectionNamesA=kPrf2Wrap_GetPrivateProfileSectionNamesA + GetPrivateProfileSectionNamesW=kPrf2Wrap_GetPrivateProfileSectionNamesW + GetPrivateProfileSectionW=kPrf2Wrap_GetPrivateProfileSectionW + GetPrivateProfileStringA=kPrf2Wrap_GetPrivateProfileStringA + GetPrivateProfileStringW=kPrf2Wrap_GetPrivateProfileStringW + GetPrivateProfileStructA=kPrf2Wrap_GetPrivateProfileStructA + GetPrivateProfileStructW=kPrf2Wrap_GetPrivateProfileStructW + GetProcAddress=kPrf2Wrap_GetProcAddress + GetProcessAffinityMask=kPrf2Wrap_GetProcessAffinityMask + GetProcessHandleCount=kPrf2Wrap_GetProcessHandleCount + GetProcessHeap=kPrf2Wrap_GetProcessHeap + GetProcessHeaps=kPrf2Wrap_GetProcessHeaps + GetProcessId=kPrf2Wrap_GetProcessId + GetProcessIdOfThread=kPrf2Wrap_GetProcessIdOfThread + GetProcessIoCounters=kPrf2Wrap_GetProcessIoCounters + GetProcessPriorityBoost=kPrf2Wrap_GetProcessPriorityBoost + GetProcessShutdownParameters=kPrf2Wrap_GetProcessShutdownParameters + GetProcessTimes=kPrf2Wrap_GetProcessTimes + GetProcessVersion=kPrf2Wrap_GetProcessVersion + GetProcessWorkingSetSize=kPrf2Wrap_GetProcessWorkingSetSize + GetProcessWorkingSetSizeEx=kPrf2Wrap_GetProcessWorkingSetSizeEx + GetProfileIntA=kPrf2Wrap_GetProfileIntA + GetProfileIntW=kPrf2Wrap_GetProfileIntW + GetProfileSectionA=kPrf2Wrap_GetProfileSectionA + GetProfileSectionW=kPrf2Wrap_GetProfileSectionW + GetProfileStringA=kPrf2Wrap_GetProfileStringA + GetProfileStringW=kPrf2Wrap_GetProfileStringW + GetQueuedCompletionStatus=kPrf2Wrap_GetQueuedCompletionStatus + GetShortPathNameA=kPrf2Wrap_GetShortPathNameA + GetShortPathNameW=kPrf2Wrap_GetShortPathNameW + GetStartupInfoA=kPrf2Wrap_GetStartupInfoA + GetStartupInfoW=kPrf2Wrap_GetStartupInfoW + GetStdHandle=kPrf2Wrap_GetStdHandle + GetStringTypeA=kPrf2Wrap_GetStringTypeA + GetStringTypeExA=kPrf2Wrap_GetStringTypeExA + GetStringTypeExW=kPrf2Wrap_GetStringTypeExW + GetStringTypeW=kPrf2Wrap_GetStringTypeW + GetSystemDefaultLCID=kPrf2Wrap_GetSystemDefaultLCID + GetSystemDefaultLangID=kPrf2Wrap_GetSystemDefaultLangID + GetSystemDefaultUILanguage=kPrf2Wrap_GetSystemDefaultUILanguage + GetSystemDirectoryA=kPrf2Wrap_GetSystemDirectoryA + GetSystemDirectoryW=kPrf2Wrap_GetSystemDirectoryW + GetSystemFileCacheSize=kPrf2Wrap_GetSystemFileCacheSize + GetSystemFirmwareTable=kPrf2Wrap_GetSystemFirmwareTable + GetSystemInfo=kPrf2Wrap_GetSystemInfo + GetSystemPowerStatus=kPrf2Wrap_GetSystemPowerStatus + GetSystemRegistryQuota=kPrf2Wrap_GetSystemRegistryQuota + GetSystemTime=kPrf2Wrap_GetSystemTime + GetSystemTimeAdjustment=kPrf2Wrap_GetSystemTimeAdjustment + GetSystemTimeAsFileTime=kPrf2Wrap_GetSystemTimeAsFileTime + GetSystemTimes=kPrf2Wrap_GetSystemTimes + GetSystemWindowsDirectoryA=kPrf2Wrap_GetSystemWindowsDirectoryA + GetSystemWindowsDirectoryW=kPrf2Wrap_GetSystemWindowsDirectoryW + GetSystemWow64DirectoryA=kPrf2Wrap_GetSystemWow64DirectoryA + GetSystemWow64DirectoryW=kPrf2Wrap_GetSystemWow64DirectoryW + GetTapeParameters=kPrf2Wrap_GetTapeParameters + GetTapePosition=kPrf2Wrap_GetTapePosition + GetTapeStatus=kPrf2Wrap_GetTapeStatus + GetTempFileNameA=kPrf2Wrap_GetTempFileNameA + GetTempFileNameW=kPrf2Wrap_GetTempFileNameW + GetTempPathA=kPrf2Wrap_GetTempPathA + GetTempPathW=kPrf2Wrap_GetTempPathW + GetThreadContext=kPrf2Wrap_GetThreadContext + GetThreadIOPendingFlag=kPrf2Wrap_GetThreadIOPendingFlag + GetThreadId=kPrf2Wrap_GetThreadId + GetThreadLocale=kPrf2Wrap_GetThreadLocale + GetThreadPriority=kPrf2Wrap_GetThreadPriority + GetThreadPriorityBoost=kPrf2Wrap_GetThreadPriorityBoost + GetThreadSelectorEntry=kPrf2Wrap_GetThreadSelectorEntry + GetThreadTimes=kPrf2Wrap_GetThreadTimes + GetTickCount=kPrf2Wrap_GetTickCount + GetTimeFormatA=kPrf2Wrap_GetTimeFormatA + GetTimeFormatW=kPrf2Wrap_GetTimeFormatW + GetTimeZoneInformation=kPrf2Wrap_GetTimeZoneInformation + GetUserDefaultLCID=kPrf2Wrap_GetUserDefaultLCID + GetUserDefaultLangID=kPrf2Wrap_GetUserDefaultLangID + GetUserDefaultUILanguage=kPrf2Wrap_GetUserDefaultUILanguage + GetUserGeoID=kPrf2Wrap_GetUserGeoID + GetVersion=kPrf2Wrap_GetVersion + GetVersionExA=kPrf2Wrap_GetVersionExA + GetVersionExW=kPrf2Wrap_GetVersionExW + GetVolumeInformationA=kPrf2Wrap_GetVolumeInformationA + GetVolumeInformationW=kPrf2Wrap_GetVolumeInformationW + GetVolumeNameForVolumeMountPointA=kPrf2Wrap_GetVolumeNameForVolumeMountPointA + GetVolumeNameForVolumeMountPointW=kPrf2Wrap_GetVolumeNameForVolumeMountPointW + GetVolumePathNameA=kPrf2Wrap_GetVolumePathNameA + GetVolumePathNameW=kPrf2Wrap_GetVolumePathNameW + GetVolumePathNamesForVolumeNameA=kPrf2Wrap_GetVolumePathNamesForVolumeNameA + GetVolumePathNamesForVolumeNameW=kPrf2Wrap_GetVolumePathNamesForVolumeNameW + GetWindowsDirectoryA=kPrf2Wrap_GetWindowsDirectoryA + GetWindowsDirectoryW=kPrf2Wrap_GetWindowsDirectoryW + GetWriteWatch=kPrf2Wrap_GetWriteWatch + GlobalAddAtomA=kPrf2Wrap_GlobalAddAtomA + GlobalAddAtomW=kPrf2Wrap_GlobalAddAtomW + GlobalAlloc=kPrf2Wrap_GlobalAlloc + GlobalCompact=kPrf2Wrap_GlobalCompact + GlobalDeleteAtom=kPrf2Wrap_GlobalDeleteAtom + GlobalFindAtomA=kPrf2Wrap_GlobalFindAtomA + GlobalFindAtomW=kPrf2Wrap_GlobalFindAtomW + GlobalFix=kPrf2Wrap_GlobalFix + GlobalFlags=kPrf2Wrap_GlobalFlags + GlobalFree=kPrf2Wrap_GlobalFree + GlobalGetAtomNameA=kPrf2Wrap_GlobalGetAtomNameA + GlobalGetAtomNameW=kPrf2Wrap_GlobalGetAtomNameW + GlobalHandle=kPrf2Wrap_GlobalHandle + GlobalLock=kPrf2Wrap_GlobalLock + GlobalMemoryStatus=kPrf2Wrap_GlobalMemoryStatus + GlobalMemoryStatusEx=kPrf2Wrap_GlobalMemoryStatusEx + GlobalReAlloc=kPrf2Wrap_GlobalReAlloc + GlobalSize=kPrf2Wrap_GlobalSize + GlobalUnWire=kPrf2Wrap_GlobalUnWire + GlobalUnfix=kPrf2Wrap_GlobalUnfix + GlobalUnlock=kPrf2Wrap_GlobalUnlock + GlobalWire=kPrf2Wrap_GlobalWire + Heap32First=kPrf2Wrap_Heap32First + Heap32ListFirst=kPrf2Wrap_Heap32ListFirst + Heap32ListNext=kPrf2Wrap_Heap32ListNext + Heap32Next=kPrf2Wrap_Heap32Next + HeapAlloc=kPrf2Wrap_HeapAlloc + HeapCompact=kPrf2Wrap_HeapCompact + HeapCreate=kPrf2Wrap_HeapCreate + HeapDestroy=kPrf2Wrap_HeapDestroy + HeapFree=kPrf2Wrap_HeapFree + HeapLock=kPrf2Wrap_HeapLock + HeapQueryInformation=kPrf2Wrap_HeapQueryInformation + HeapReAlloc=kPrf2Wrap_HeapReAlloc + HeapSetInformation=kPrf2Wrap_HeapSetInformation + HeapSize=kPrf2Wrap_HeapSize + HeapUnlock=kPrf2Wrap_HeapUnlock + HeapValidate=kPrf2Wrap_HeapValidate + HeapWalk=kPrf2Wrap_HeapWalk + InitAtomTable=kPrf2Wrap_InitAtomTable + InitializeCriticalSection=kPrf2Wrap_InitializeCriticalSection + InitializeCriticalSectionAndSpinCount=kPrf2Wrap_InitializeCriticalSectionAndSpinCount + InitializeSListHead=kPrf2Wrap_InitializeSListHead + InterlockedFlushSList=kPrf2Wrap_InterlockedFlushSList + InterlockedPopEntrySList=kPrf2Wrap_InterlockedPopEntrySList + InterlockedPushEntrySList=kPrf2Wrap_InterlockedPushEntrySList + IsBadCodePtr=kPrf2Wrap_IsBadCodePtr + IsBadHugeReadPtr=kPrf2Wrap_IsBadHugeReadPtr + IsBadHugeWritePtr=kPrf2Wrap_IsBadHugeWritePtr + IsBadReadPtr=kPrf2Wrap_IsBadReadPtr + IsBadStringPtrA=kPrf2Wrap_IsBadStringPtrA + IsBadStringPtrW=kPrf2Wrap_IsBadStringPtrW + IsBadWritePtr=kPrf2Wrap_IsBadWritePtr + IsDBCSLeadByte=kPrf2Wrap_IsDBCSLeadByte + IsDBCSLeadByteEx=kPrf2Wrap_IsDBCSLeadByteEx + IsDebuggerPresent=kPrf2Wrap_IsDebuggerPresent + IsNLSDefinedString=kPrf2Wrap_IsNLSDefinedString + IsProcessInJob=kPrf2Wrap_IsProcessInJob + IsProcessorFeaturePresent=kPrf2Wrap_IsProcessorFeaturePresent + IsSystemResumeAutomatic=kPrf2Wrap_IsSystemResumeAutomatic + IsValidCodePage=kPrf2Wrap_IsValidCodePage + IsValidLanguageGroup=kPrf2Wrap_IsValidLanguageGroup + IsValidLocale=kPrf2Wrap_IsValidLocale + IsWow64Process=kPrf2Wrap_IsWow64Process + LCMapStringA=kPrf2Wrap_LCMapStringA + LCMapStringW=kPrf2Wrap_LCMapStringW + LeaveCriticalSection=kPrf2Wrap_LeaveCriticalSection + LoadLibraryA=kPrf2Wrap_LoadLibraryA + LoadLibraryExA=kPrf2Wrap_LoadLibraryExA + LoadLibraryExW=kPrf2Wrap_LoadLibraryExW + LoadLibraryW=kPrf2Wrap_LoadLibraryW + LoadModule=kPrf2Wrap_LoadModule + LoadResource=kPrf2Wrap_LoadResource + LocalAlloc=kPrf2Wrap_LocalAlloc + LocalCompact=kPrf2Wrap_LocalCompact + LocalFileTimeToFileTime=kPrf2Wrap_LocalFileTimeToFileTime + LocalFlags=kPrf2Wrap_LocalFlags + LocalFree=kPrf2Wrap_LocalFree + LocalHandle=kPrf2Wrap_LocalHandle + LocalLock=kPrf2Wrap_LocalLock + LocalReAlloc=kPrf2Wrap_LocalReAlloc + LocalShrink=kPrf2Wrap_LocalShrink + LocalSize=kPrf2Wrap_LocalSize + LocalUnlock=kPrf2Wrap_LocalUnlock + LockFile=kPrf2Wrap_LockFile + LockFileEx=kPrf2Wrap_LockFileEx + LockResource=kPrf2Wrap_LockResource + MapUserPhysicalPages=kPrf2Wrap_MapUserPhysicalPages + MapUserPhysicalPagesScatter=kPrf2Wrap_MapUserPhysicalPagesScatter + MapViewOfFile=kPrf2Wrap_MapViewOfFile + MapViewOfFileEx=kPrf2Wrap_MapViewOfFileEx + Module32First=kPrf2Wrap_Module32First + Module32FirstW=kPrf2Wrap_Module32FirstW + Module32Next=kPrf2Wrap_Module32Next + Module32NextW=kPrf2Wrap_Module32NextW + MoveFileA=kPrf2Wrap_MoveFileA + MoveFileExA=kPrf2Wrap_MoveFileExA + MoveFileExW=kPrf2Wrap_MoveFileExW + MoveFileW=kPrf2Wrap_MoveFileW + MoveFileWithProgressA=kPrf2Wrap_MoveFileWithProgressA + MoveFileWithProgressW=kPrf2Wrap_MoveFileWithProgressW + MulDiv=kPrf2Wrap_MulDiv + MultiByteToWideChar=kPrf2Wrap_MultiByteToWideChar + NeedCurrentDirectoryForExePathA=kPrf2Wrap_NeedCurrentDirectoryForExePathA + NeedCurrentDirectoryForExePathW=kPrf2Wrap_NeedCurrentDirectoryForExePathW + OpenEventA=kPrf2Wrap_OpenEventA + OpenEventW=kPrf2Wrap_OpenEventW + OpenFile=kPrf2Wrap_OpenFile + OpenFileMappingA=kPrf2Wrap_OpenFileMappingA + OpenFileMappingW=kPrf2Wrap_OpenFileMappingW + OpenJobObjectA=kPrf2Wrap_OpenJobObjectA + OpenJobObjectW=kPrf2Wrap_OpenJobObjectW + OpenMutexA=kPrf2Wrap_OpenMutexA + OpenMutexW=kPrf2Wrap_OpenMutexW + OpenProcess=kPrf2Wrap_OpenProcess + OpenSemaphoreA=kPrf2Wrap_OpenSemaphoreA + OpenSemaphoreW=kPrf2Wrap_OpenSemaphoreW + OpenThread=kPrf2Wrap_OpenThread + OpenWaitableTimerA=kPrf2Wrap_OpenWaitableTimerA + OpenWaitableTimerW=kPrf2Wrap_OpenWaitableTimerW + OutputDebugStringA=kPrf2Wrap_OutputDebugStringA + OutputDebugStringW=kPrf2Wrap_OutputDebugStringW + PeekConsoleInputA=kPrf2Wrap_PeekConsoleInputA + PeekConsoleInputW=kPrf2Wrap_PeekConsoleInputW + PeekNamedPipe=kPrf2Wrap_PeekNamedPipe + PostQueuedCompletionStatus=kPrf2Wrap_PostQueuedCompletionStatus + PrepareTape=kPrf2Wrap_PrepareTape + Process32First=kPrf2Wrap_Process32First + Process32FirstW=kPrf2Wrap_Process32FirstW + Process32Next=kPrf2Wrap_Process32Next + Process32NextW=kPrf2Wrap_Process32NextW + ProcessIdToSessionId=kPrf2Wrap_ProcessIdToSessionId + PulseEvent=kPrf2Wrap_PulseEvent + PurgeComm=kPrf2Wrap_PurgeComm + QueryActCtxW=kPrf2Wrap_QueryActCtxW + QueryDepthSList=kPrf2Wrap_QueryDepthSList + QueryDosDeviceA=kPrf2Wrap_QueryDosDeviceA + QueryDosDeviceW=kPrf2Wrap_QueryDosDeviceW + QueryInformationJobObject=kPrf2Wrap_QueryInformationJobObject + QueryMemoryResourceNotification=kPrf2Wrap_QueryMemoryResourceNotification + QueryPerformanceCounter=kPrf2Wrap_QueryPerformanceCounter + QueryPerformanceFrequency=kPrf2Wrap_QueryPerformanceFrequency + QueueUserAPC=kPrf2Wrap_QueueUserAPC + QueueUserWorkItem=kPrf2Wrap_QueueUserWorkItem + RaiseException=kPrf2Wrap_RaiseException + ReOpenFile=kPrf2Wrap_ReOpenFile + ReadConsoleA=kPrf2Wrap_ReadConsoleA + ReadConsoleInputA=kPrf2Wrap_ReadConsoleInputA + ReadConsoleInputW=kPrf2Wrap_ReadConsoleInputW + ReadConsoleOutputA=kPrf2Wrap_ReadConsoleOutputA + ReadConsoleOutputAttribute=kPrf2Wrap_ReadConsoleOutputAttribute + ReadConsoleOutputCharacterA=kPrf2Wrap_ReadConsoleOutputCharacterA + ReadConsoleOutputCharacterW=kPrf2Wrap_ReadConsoleOutputCharacterW + ReadConsoleOutputW=kPrf2Wrap_ReadConsoleOutputW + ReadConsoleW=kPrf2Wrap_ReadConsoleW + ReadDirectoryChangesW=kPrf2Wrap_ReadDirectoryChangesW + ReadFile=kPrf2Wrap_ReadFile + ReadFileEx=kPrf2Wrap_ReadFileEx + ReadFileScatter=kPrf2Wrap_ReadFileScatter + ReadProcessMemory=kPrf2Wrap_ReadProcessMemory + RegisterWaitForSingleObject=kPrf2Wrap_RegisterWaitForSingleObject + RegisterWaitForSingleObjectEx=kPrf2Wrap_RegisterWaitForSingleObjectEx + ReleaseActCtx=kPrf2Wrap_ReleaseActCtx + ReleaseMutex=kPrf2Wrap_ReleaseMutex + ReleaseSemaphore=kPrf2Wrap_ReleaseSemaphore + RemoveDirectoryA=kPrf2Wrap_RemoveDirectoryA + RemoveDirectoryW=kPrf2Wrap_RemoveDirectoryW + RemoveVectoredContinueHandler=kPrf2Wrap_RemoveVectoredContinueHandler + RemoveVectoredExceptionHandler=kPrf2Wrap_RemoveVectoredExceptionHandler + ReplaceFile=kPrf2Wrap_ReplaceFile + ReplaceFileA=kPrf2Wrap_ReplaceFileA + ReplaceFileW=kPrf2Wrap_ReplaceFileW + RequestDeviceWakeup=kPrf2Wrap_RequestDeviceWakeup + RequestWakeupLatency=kPrf2Wrap_RequestWakeupLatency + ResetEvent=kPrf2Wrap_ResetEvent + ResetWriteWatch=kPrf2Wrap_ResetWriteWatch + RestoreLastError=kPrf2Wrap_RestoreLastError + ResumeThread=kPrf2Wrap_ResumeThread + RtlAddFunctionTable=kPrf2Wrap_RtlAddFunctionTable + RtlCaptureContext=kPrf2Wrap_RtlCaptureContext + RtlCaptureStackBackTrace=kPrf2Wrap_RtlCaptureStackBackTrace + RtlCompareMemory=kPrf2Wrap_RtlCompareMemory + RtlDeleteFunctionTable=kPrf2Wrap_RtlDeleteFunctionTable + RtlFillMemory=kPrf2Wrap_RtlFillMemory + RtlInstallFunctionTableCallback=kPrf2Wrap_RtlInstallFunctionTableCallback + RtlLookupFunctionEntry=kPrf2Wrap_RtlLookupFunctionEntry + RtlMoveMemory=kPrf2Wrap_RtlMoveMemory + RtlPcToFileHeader=kPrf2Wrap_RtlPcToFileHeader + RtlRaiseException=kPrf2Wrap_RtlRaiseException + RtlRestoreContext=kPrf2Wrap_RtlRestoreContext + RtlUnwind=kPrf2Wrap_RtlUnwind + RtlUnwindEx=kPrf2Wrap_RtlUnwindEx + RtlVirtualUnwind=kPrf2Wrap_RtlVirtualUnwind + RtlZeroMemory=kPrf2Wrap_RtlZeroMemory + ScrollConsoleScreenBufferA=kPrf2Wrap_ScrollConsoleScreenBufferA + ScrollConsoleScreenBufferW=kPrf2Wrap_ScrollConsoleScreenBufferW + SearchPathA=kPrf2Wrap_SearchPathA + SearchPathW=kPrf2Wrap_SearchPathW + SetCalendarInfoA=kPrf2Wrap_SetCalendarInfoA + SetCalendarInfoW=kPrf2Wrap_SetCalendarInfoW + SetCommBreak=kPrf2Wrap_SetCommBreak + SetCommConfig=kPrf2Wrap_SetCommConfig + SetCommMask=kPrf2Wrap_SetCommMask + SetCommState=kPrf2Wrap_SetCommState + SetCommTimeouts=kPrf2Wrap_SetCommTimeouts + SetComputerNameA=kPrf2Wrap_SetComputerNameA + SetComputerNameExA=kPrf2Wrap_SetComputerNameExA + SetComputerNameExW=kPrf2Wrap_SetComputerNameExW + SetComputerNameW=kPrf2Wrap_SetComputerNameW + SetConsoleActiveScreenBuffer=kPrf2Wrap_SetConsoleActiveScreenBuffer + SetConsoleCP=kPrf2Wrap_SetConsoleCP + SetConsoleCtrlHandler=kPrf2Wrap_SetConsoleCtrlHandler + SetConsoleCursor=kPrf2Wrap_SetConsoleCursor + SetConsoleCursorInfo=kPrf2Wrap_SetConsoleCursorInfo + SetConsoleCursorPosition=kPrf2Wrap_SetConsoleCursorPosition + SetConsoleMode=kPrf2Wrap_SetConsoleMode + SetConsoleOutputCP=kPrf2Wrap_SetConsoleOutputCP + SetConsoleScreenBufferSize=kPrf2Wrap_SetConsoleScreenBufferSize + SetConsoleTextAttribute=kPrf2Wrap_SetConsoleTextAttribute + SetConsoleTitleA=kPrf2Wrap_SetConsoleTitleA + SetConsoleTitleW=kPrf2Wrap_SetConsoleTitleW + SetConsoleWindowInfo=kPrf2Wrap_SetConsoleWindowInfo + SetCriticalSectionSpinCount=kPrf2Wrap_SetCriticalSectionSpinCount + SetCurrentDirectoryA=kPrf2Wrap_SetCurrentDirectoryA + SetCurrentDirectoryW=kPrf2Wrap_SetCurrentDirectoryW + SetDefaultCommConfigA=kPrf2Wrap_SetDefaultCommConfigA + SetDefaultCommConfigW=kPrf2Wrap_SetDefaultCommConfigW + SetDllDirectoryA=kPrf2Wrap_SetDllDirectoryA + SetDllDirectoryW=kPrf2Wrap_SetDllDirectoryW + SetEndOfFile=kPrf2Wrap_SetEndOfFile + SetEnvironmentStringsA=kPrf2Wrap_SetEnvironmentStringsA + SetEnvironmentStringsW=kPrf2Wrap_SetEnvironmentStringsW + SetEnvironmentVariableA=kPrf2Wrap_SetEnvironmentVariableA + SetEnvironmentVariableW=kPrf2Wrap_SetEnvironmentVariableW + SetErrorMode=kPrf2Wrap_SetErrorMode + SetEvent=kPrf2Wrap_SetEvent + SetFileApisToANSI=kPrf2Wrap_SetFileApisToANSI + SetFileApisToOEM=kPrf2Wrap_SetFileApisToOEM + SetFileAttributesA=kPrf2Wrap_SetFileAttributesA + SetFileAttributesW=kPrf2Wrap_SetFileAttributesW + SetFilePointer=kPrf2Wrap_SetFilePointer + SetFilePointerEx=kPrf2Wrap_SetFilePointerEx + SetFileShortNameA=kPrf2Wrap_SetFileShortNameA + SetFileShortNameW=kPrf2Wrap_SetFileShortNameW + SetFileTime=kPrf2Wrap_SetFileTime + SetFileValidData=kPrf2Wrap_SetFileValidData + SetFirmwareEnvironmentVariableA=kPrf2Wrap_SetFirmwareEnvironmentVariableA + SetFirmwareEnvironmentVariableW=kPrf2Wrap_SetFirmwareEnvironmentVariableW + SetHandleCount=kPrf2Wrap_SetHandleCount + SetHandleInformation=kPrf2Wrap_SetHandleInformation + SetInformationJobObject=kPrf2Wrap_SetInformationJobObject + SetLastError=kPrf2Wrap_SetLastError + SetLocalTime=kPrf2Wrap_SetLocalTime + SetLocaleInfoA=kPrf2Wrap_SetLocaleInfoA + SetLocaleInfoW=kPrf2Wrap_SetLocaleInfoW + SetMailslotInfo=kPrf2Wrap_SetMailslotInfo + SetMessageWaitingIndicator=kPrf2Wrap_SetMessageWaitingIndicator + SetNamedPipeHandleState=kPrf2Wrap_SetNamedPipeHandleState + SetPriorityClass=kPrf2Wrap_SetPriorityClass + SetProcessAffinityMask=kPrf2Wrap_SetProcessAffinityMask + SetProcessPriorityBoost=kPrf2Wrap_SetProcessPriorityBoost + SetProcessShutdownParameters=kPrf2Wrap_SetProcessShutdownParameters + SetProcessWorkingSetSize=kPrf2Wrap_SetProcessWorkingSetSize + SetProcessWorkingSetSizeEx=kPrf2Wrap_SetProcessWorkingSetSizeEx + SetStdHandle=kPrf2Wrap_SetStdHandle + SetSystemFileCacheSize=kPrf2Wrap_SetSystemFileCacheSize + SetSystemPowerState=kPrf2Wrap_SetSystemPowerState + SetSystemTime=kPrf2Wrap_SetSystemTime + SetSystemTimeAdjustment=kPrf2Wrap_SetSystemTimeAdjustment + SetTapeParameters=kPrf2Wrap_SetTapeParameters + SetTapePosition=kPrf2Wrap_SetTapePosition + SetThreadAffinityMask=kPrf2Wrap_SetThreadAffinityMask + SetThreadContext=kPrf2Wrap_SetThreadContext + SetThreadExecutionState=kPrf2Wrap_SetThreadExecutionState + SetThreadIdealProcessor=kPrf2Wrap_SetThreadIdealProcessor + SetThreadLocale=kPrf2Wrap_SetThreadLocale + SetThreadPriority=kPrf2Wrap_SetThreadPriority + SetThreadPriorityBoost=kPrf2Wrap_SetThreadPriorityBoost + SetThreadStackGuarantee=kPrf2Wrap_SetThreadStackGuarantee + SetTimeZoneInformation=kPrf2Wrap_SetTimeZoneInformation + SetTimerQueueTimer=kPrf2Wrap_SetTimerQueueTimer + SetUnhandledExceptionFilter=kPrf2Wrap_SetUnhandledExceptionFilter + SetUserGeoID=kPrf2Wrap_SetUserGeoID + SetVolumeLabelA=kPrf2Wrap_SetVolumeLabelA + SetVolumeLabelW=kPrf2Wrap_SetVolumeLabelW + SetVolumeMountPointA=kPrf2Wrap_SetVolumeMountPointA + SetVolumeMountPointW=kPrf2Wrap_SetVolumeMountPointW + SetWaitableTimer=kPrf2Wrap_SetWaitableTimer + SetupComm=kPrf2Wrap_SetupComm + SignalObjectAndWait=kPrf2Wrap_SignalObjectAndWait + SizeofResource=kPrf2Wrap_SizeofResource + Sleep=kPrf2Wrap_Sleep + SleepEx=kPrf2Wrap_SleepEx + SuspendThread=kPrf2Wrap_SuspendThread + SwitchToFiber=kPrf2Wrap_SwitchToFiber + SwitchToThread=kPrf2Wrap_SwitchToThread + SystemTimeToFileTime=kPrf2Wrap_SystemTimeToFileTime + SystemTimeToTzSpecificLocalTime=kPrf2Wrap_SystemTimeToTzSpecificLocalTime + TerminateJobObject=kPrf2Wrap_TerminateJobObject + TerminateProcess=kPrf2Wrap_TerminateProcess + TerminateThread=kPrf2Wrap_TerminateThread + Thread32First=kPrf2Wrap_Thread32First + Thread32Next=kPrf2Wrap_Thread32Next + TlsAlloc=kPrf2Wrap_TlsAlloc + TlsFree=kPrf2Wrap_TlsFree + TlsGetValue=kPrf2Wrap_TlsGetValue + TlsSetValue=kPrf2Wrap_TlsSetValue + Toolhelp32ReadProcessMemory=kPrf2Wrap_Toolhelp32ReadProcessMemory + TransactNamedPipe=kPrf2Wrap_TransactNamedPipe + TransmitCommChar=kPrf2Wrap_TransmitCommChar + TryEnterCriticalSection=kPrf2Wrap_TryEnterCriticalSection + TzSpecificLocalTimeToSystemTime=kPrf2Wrap_TzSpecificLocalTimeToSystemTime + UnhandledExceptionFilter=kPrf2Wrap_UnhandledExceptionFilter + UnlockFile=kPrf2Wrap_UnlockFile + UnlockFileEx=kPrf2Wrap_UnlockFileEx + UnmapViewOfFile=kPrf2Wrap_UnmapViewOfFile + UnregisterWait=kPrf2Wrap_UnregisterWait + UnregisterWaitEx=kPrf2Wrap_UnregisterWaitEx + UpdateResourceA=kPrf2Wrap_UpdateResourceA + UpdateResourceW=kPrf2Wrap_UpdateResourceW + VerLanguageNameA=kPrf2Wrap_VerLanguageNameA + VerLanguageNameW=kPrf2Wrap_VerLanguageNameW + VerSetConditionMask=kPrf2Wrap_VerSetConditionMask + VerifyVersionInfoA=kPrf2Wrap_VerifyVersionInfoA + VerifyVersionInfoW=kPrf2Wrap_VerifyVersionInfoW + VirtualAlloc=kPrf2Wrap_VirtualAlloc + VirtualAllocEx=kPrf2Wrap_VirtualAllocEx + VirtualFree=kPrf2Wrap_VirtualFree + VirtualFreeEx=kPrf2Wrap_VirtualFreeEx + VirtualLock=kPrf2Wrap_VirtualLock + VirtualProtect=kPrf2Wrap_VirtualProtect + VirtualProtectEx=kPrf2Wrap_VirtualProtectEx + VirtualQuery=kPrf2Wrap_VirtualQuery + VirtualQueryEx=kPrf2Wrap_VirtualQueryEx + VirtualUnlock=kPrf2Wrap_VirtualUnlock + WTSGetActiveConsoleSessionId=kPrf2Wrap_WTSGetActiveConsoleSessionId + WaitCommEvent=kPrf2Wrap_WaitCommEvent + WaitForDebugEvent=kPrf2Wrap_WaitForDebugEvent + WaitForMultipleObjects=kPrf2Wrap_WaitForMultipleObjects + WaitForMultipleObjectsEx=kPrf2Wrap_WaitForMultipleObjectsEx + WaitForSingleObject=kPrf2Wrap_WaitForSingleObject + WaitForSingleObjectEx=kPrf2Wrap_WaitForSingleObjectEx + WaitNamedPipeA=kPrf2Wrap_WaitNamedPipeA + WaitNamedPipeW=kPrf2Wrap_WaitNamedPipeW + WideCharToMultiByte=kPrf2Wrap_WideCharToMultiByte + WinExec=kPrf2Wrap_WinExec + Wow64DisableWow64FsRedirection=kPrf2Wrap_Wow64DisableWow64FsRedirection + Wow64EnableWow64FsRedirection=kPrf2Wrap_Wow64EnableWow64FsRedirection + Wow64RevertWow64FsRedirection=kPrf2Wrap_Wow64RevertWow64FsRedirection + WriteConsoleA=kPrf2Wrap_WriteConsoleA + WriteConsoleInputA=kPrf2Wrap_WriteConsoleInputA + WriteConsoleInputW=kPrf2Wrap_WriteConsoleInputW + WriteConsoleOutputA=kPrf2Wrap_WriteConsoleOutputA + WriteConsoleOutputAttribute=kPrf2Wrap_WriteConsoleOutputAttribute + WriteConsoleOutputCharacterA=kPrf2Wrap_WriteConsoleOutputCharacterA + WriteConsoleOutputCharacterW=kPrf2Wrap_WriteConsoleOutputCharacterW + WriteConsoleOutputW=kPrf2Wrap_WriteConsoleOutputW + WriteConsoleW=kPrf2Wrap_WriteConsoleW + WriteFile=kPrf2Wrap_WriteFile + WriteFileEx=kPrf2Wrap_WriteFileEx + WriteFileGather=kPrf2Wrap_WriteFileGather + WritePrivateProfileSectionA=kPrf2Wrap_WritePrivateProfileSectionA + WritePrivateProfileSectionW=kPrf2Wrap_WritePrivateProfileSectionW + WritePrivateProfileStringA=kPrf2Wrap_WritePrivateProfileStringA + WritePrivateProfileStringW=kPrf2Wrap_WritePrivateProfileStringW + WritePrivateProfileStructA=kPrf2Wrap_WritePrivateProfileStructA + WritePrivateProfileStructW=kPrf2Wrap_WritePrivateProfileStructW + WriteProcessMemory=kPrf2Wrap_WriteProcessMemory + WriteProfileSectionA=kPrf2Wrap_WriteProfileSectionA + WriteProfileSectionW=kPrf2Wrap_WriteProfileSectionW + WriteProfileStringA=kPrf2Wrap_WriteProfileStringA + WriteProfileStringW=kPrf2Wrap_WriteProfileStringW + WriteTapemark=kPrf2Wrap_WriteTapemark + ZombifyActCtx=kPrf2Wrap_ZombifyActCtx + _hread=kPrf2Wrap__hread + _hwrite=kPrf2Wrap__hwrite + _lclose=kPrf2Wrap__lclose + _lcreat=kPrf2Wrap__lcreat + _llseek=kPrf2Wrap__llseek + _lopen=kPrf2Wrap__lopen + _lread=kPrf2Wrap__lread + _lwrite=kPrf2Wrap__lwrite + lstrcat=kPrf2Wrap_lstrcat + lstrcatA=kPrf2Wrap_lstrcatA + lstrcatW=kPrf2Wrap_lstrcatW + lstrcmp=kPrf2Wrap_lstrcmp + lstrcmpA=kPrf2Wrap_lstrcmpA + lstrcmpW=kPrf2Wrap_lstrcmpW + lstrcmpi=kPrf2Wrap_lstrcmpi + lstrcmpiA=kPrf2Wrap_lstrcmpiA + lstrcmpiW=kPrf2Wrap_lstrcmpiW + lstrcpy=kPrf2Wrap_lstrcpy + lstrcpyA=kPrf2Wrap_lstrcpyA + lstrcpyW=kPrf2Wrap_lstrcpyW + lstrcpyn=kPrf2Wrap_lstrcpyn + lstrcpynA=kPrf2Wrap_lstrcpynA + lstrcpynW=kPrf2Wrap_lstrcpynW + lstrlen=kPrf2Wrap_lstrlen + lstrlenA=kPrf2Wrap_lstrlenA + lstrlenW=kPrf2Wrap_lstrlenW + uaw_lstrcmpW=kPrf2Wrap_uaw_lstrcmpW + uaw_lstrcmpiW=kPrf2Wrap_uaw_lstrcmpiW + uaw_lstrlenW=kPrf2Wrap_uaw_lstrlenW + uaw_wcschr=kPrf2Wrap_uaw_wcschr + uaw_wcscpy=kPrf2Wrap_uaw_wcscpy + uaw_wcsicmp=kPrf2Wrap_uaw_wcsicmp + uaw_wcslen=kPrf2Wrap_uaw_wcslen + uaw_wcsrchr=kPrf2Wrap_uaw_wcsrchr diff --git a/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappersImp-x86.def b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappersImp-x86.def new file mode 100644 index 0000000..c1ddf85 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrf2WinApiWrappersImp-x86.def @@ -0,0 +1,1682 @@ +LIBRARY kPrf2WinApiWrappers +EXPORTS +_ActivateActCtx@8 +_ActivateActCtx@8 +_AddAtomA@4 +_AddAtomA@4 +_AddAtomW@4 +_AddAtomW@4 +_AddConsoleAliasA@12 +_AddConsoleAliasA@12 +_AddConsoleAliasW@12 +_AddConsoleAliasW@12 +_AddRefActCtx@4 +_AddRefActCtx@4 +_AddVectoredContinueHandler@8 +_AddVectoredContinueHandler@8 +_AddVectoredExceptionHandler@8 +_AddVectoredExceptionHandler@8 +_AllocConsole@0 +_AllocConsole@0 +_AllocateUserPhysicalPages@12 +_AllocateUserPhysicalPages@12 +_AreFileApisANSI@0 +_AreFileApisANSI@0 +_AssignProcessToJobObject@8 +_AssignProcessToJobObject@8 +_AttachConsole@4 +_AttachConsole@4 +_BackupRead@28 +_BackupRead@28 +_BackupSeek@24 +_BackupSeek@24 +_BackupWrite@28 +_BackupWrite@28 +_Beep@8 +_Beep@8 +_BeginUpdateResourceA@8 +_BeginUpdateResourceA@8 +_BeginUpdateResourceW@8 +_BeginUpdateResourceW@8 +_BindIoCompletionCallback@12 +_BindIoCompletionCallback@12 +_BuildCommDCBA@8 +_BuildCommDCBA@8 +_BuildCommDCBAndTimeoutsA@12 +_BuildCommDCBAndTimeoutsA@12 +_BuildCommDCBAndTimeoutsW@12 +_BuildCommDCBAndTimeoutsW@12 +_BuildCommDCBW@8 +_BuildCommDCBW@8 +_CallNamedPipeA@28 +_CallNamedPipeA@28 +_CallNamedPipeW@28 +_CallNamedPipeW@28 +_CancelDeviceWakeupRequest@4 +_CancelDeviceWakeupRequest@4 +_CancelIo@4 +_CancelIo@4 +_CancelTimerQueueTimer@8 +_CancelTimerQueueTimer@8 +_CancelWaitableTimer@4 +_CancelWaitableTimer@4 +_ChangeTimerQueueTimer@16 +_ChangeTimerQueueTimer@16 +_CheckNameLegalDOS8Dot3A@20 +_CheckNameLegalDOS8Dot3A@20 +_CheckNameLegalDOS8Dot3W@20 +_CheckNameLegalDOS8Dot3W@20 +_CheckRemoteDebuggerPresent@8 +_CheckRemoteDebuggerPresent@8 +_ClearCommBreak@4 +_ClearCommBreak@4 +_ClearCommError@12 +_ClearCommError@12 +_CloseHandle@4 +_CloseHandle@4 +_CommConfigDialogA@12 +_CommConfigDialogA@12 +_CommConfigDialogW@12 +_CommConfigDialogW@12 +_CompareFileTime@8 +_CompareFileTime@8 +_CompareStringA@24 +_CompareStringA@24 +_CompareStringW@24 +_CompareStringW@24 +_ConnectNamedPipe@8 +_ConnectNamedPipe@8 +_ContinueDebugEvent@12 +_ContinueDebugEvent@12 +_ConvertDefaultLocale@4 +_ConvertDefaultLocale@4 +_ConvertFiberToThread@0 +_ConvertFiberToThread@0 +_ConvertThreadToFiber@4 +_ConvertThreadToFiber@4 +_ConvertThreadToFiberEx@8 +_ConvertThreadToFiberEx@8 +_CopyFileA@12 +_CopyFileA@12 +_CopyFileExA@24 +_CopyFileExA@24 +_CopyFileExW@24 +_CopyFileExW@24 +_CopyFileW@12 +_CopyFileW@12 +_CreateActCtxA@4 +_CreateActCtxA@4 +_CreateActCtxW@4 +_CreateActCtxW@4 +_CreateConsoleScreenBuffer@20 +_CreateConsoleScreenBuffer@20 +_CreateDirectoryA@8 +_CreateDirectoryA@8 +_CreateDirectoryExA@12 +_CreateDirectoryExA@12 +_CreateDirectoryExW@12 +_CreateDirectoryExW@12 +_CreateDirectoryW@8 +_CreateDirectoryW@8 +_CreateEventA@16 +_CreateEventA@16 +_CreateEventW@16 +_CreateEventW@16 +_CreateFiber@12 +_CreateFiber@12 +_CreateFiberEx@20 +_CreateFiberEx@20 +_CreateFileA@28 +_CreateFileA@28 +_CreateFileMappingA@24 +_CreateFileMappingA@24 +_CreateFileMappingW@24 +_CreateFileMappingW@24 +_CreateFileW@28 +_CreateFileW@28 +_CreateHardLinkA@12 +_CreateHardLinkA@12 +_CreateHardLinkW@12 +_CreateHardLinkW@12 +_CreateIoCompletionPort@16 +_CreateIoCompletionPort@16 +_CreateJobObjectA@8 +_CreateJobObjectA@8 +_CreateJobObjectW@8 +_CreateJobObjectW@8 +_CreateJobSet@12 +_CreateJobSet@12 +_CreateMailslotA@16 +_CreateMailslotA@16 +_CreateMailslotW@16 +_CreateMailslotW@16 +_CreateMemoryResourceNotification@4 +_CreateMemoryResourceNotification@4 +_CreateMutexA@12 +_CreateMutexA@12 +_CreateMutexW@12 +_CreateMutexW@12 +_CreateNamedPipeA@32 +_CreateNamedPipeA@32 +_CreateNamedPipeW@32 +_CreateNamedPipeW@32 +_CreatePipe@16 +_CreatePipe@16 +_CreateProcessA@40 +_CreateProcessA@40 +_CreateProcessW@40 +_CreateProcessW@40 +_CreateRemoteThread@28 +_CreateRemoteThread@28 +_CreateSemaphoreA@16 +_CreateSemaphoreA@16 +_CreateSemaphoreW@16 +_CreateSemaphoreW@16 +_CreateTapePartition@16 +_CreateTapePartition@16 +_CreateThread@24 +_CreateThread@24 +_CreateTimerQueue@0 +_CreateTimerQueue@0 +_CreateTimerQueueTimer@28 +_CreateTimerQueueTimer@28 +_CreateToolhelp32Snapshot@8 +_CreateToolhelp32Snapshot@8 +_CreateWaitableTimerA@12 +_CreateWaitableTimerA@12 +_CreateWaitableTimerW@12 +_CreateWaitableTimerW@12 +_DeactivateActCtx@8 +_DeactivateActCtx@8 +_DebugActiveProcess@4 +_DebugActiveProcess@4 +_DebugActiveProcessStop@4 +_DebugActiveProcessStop@4 +_DebugBreak@0 +_DebugBreak@0 +_DebugBreakProcess@4 +_DebugBreakProcess@4 +_DebugSetProcessKillOnExit@4 +_DebugSetProcessKillOnExit@4 +_DecodePointer@4 +_DecodePointer@4 +_DecodeSystemPointer@4 +_DecodeSystemPointer@4 +_DefineDosDeviceA@12 +_DefineDosDeviceA@12 +_DefineDosDeviceW@12 +_DefineDosDeviceW@12 +_DeleteAtom@4 +_DeleteAtom@4 +_DeleteCriticalSection@4 +_DeleteCriticalSection@4 +_DeleteFiber@4 +_DeleteFiber@4 +_DeleteFileA@4 +_DeleteFileA@4 +_DeleteFileW@4 +_DeleteFileW@4 +_DeleteTimerQueue@4 +_DeleteTimerQueue@4 +_DeleteTimerQueueEx@8 +_DeleteTimerQueueEx@8 +_DeleteTimerQueueTimer@12 +_DeleteTimerQueueTimer@12 +_DeleteVolumeMountPointA@4 +_DeleteVolumeMountPointA@4 +_DeleteVolumeMountPointW@4 +_DeleteVolumeMountPointW@4 +_DeviceIoControl@32 +_DeviceIoControl@32 +_DisableThreadLibraryCalls@4 +_DisableThreadLibraryCalls@4 +_DisconnectNamedPipe@4 +_DisconnectNamedPipe@4 +_DnsHostnameToComputerNameA@12 +_DnsHostnameToComputerNameA@12 +_DnsHostnameToComputerNameW@12 +_DnsHostnameToComputerNameW@12 +_DosDateTimeToFileTime@12 +_DosDateTimeToFileTime@12 +_DuplicateHandle@28 +_DuplicateHandle@28 +_EncodePointer@4 +_EncodePointer@4 +_EncodeSystemPointer@4 +_EncodeSystemPointer@4 +_EndUpdateResourceA@8 +_EndUpdateResourceA@8 +_EndUpdateResourceW@8 +_EndUpdateResourceW@8 +_EnterCriticalSection@4 +_EnterCriticalSection@4 +_EnumCalendarInfoA@16 +_EnumCalendarInfoA@16 +_EnumCalendarInfoExA@16 +_EnumCalendarInfoExA@16 +_EnumCalendarInfoExW@16 +_EnumCalendarInfoExW@16 +_EnumCalendarInfoW@16 +_EnumCalendarInfoW@16 +_EnumDateFormatsA@12 +_EnumDateFormatsA@12 +_EnumDateFormatsExA@12 +_EnumDateFormatsExA@12 +_EnumDateFormatsExW@12 +_EnumDateFormatsExW@12 +_EnumDateFormatsW@12 +_EnumDateFormatsW@12 +_EnumLanguageGroupLocalesA@16 +_EnumLanguageGroupLocalesA@16 +_EnumLanguageGroupLocalesW@16 +_EnumLanguageGroupLocalesW@16 +_EnumResourceLanguagesA@20 +_EnumResourceLanguagesA@20 +_EnumResourceLanguagesW@20 +_EnumResourceLanguagesW@20 +_EnumResourceNamesA@16 +_EnumResourceNamesA@16 +_EnumResourceNamesW@16 +_EnumResourceNamesW@16 +_EnumResourceTypesA@12 +_EnumResourceTypesA@12 +_EnumResourceTypesW@12 +_EnumResourceTypesW@12 +_EnumSystemCodePagesA@8 +_EnumSystemCodePagesA@8 +_EnumSystemCodePagesW@8 +_EnumSystemCodePagesW@8 +_EnumSystemFirmwareTables@12 +_EnumSystemFirmwareTables@12 +_EnumSystemGeoID@12 +_EnumSystemGeoID@12 +_EnumSystemLanguageGroupsA@12 +_EnumSystemLanguageGroupsA@12 +_EnumSystemLanguageGroupsW@12 +_EnumSystemLanguageGroupsW@12 +_EnumSystemLocalesA@8 +_EnumSystemLocalesA@8 +_EnumSystemLocalesW@8 +_EnumSystemLocalesW@8 +_EnumTimeFormatsA@12 +_EnumTimeFormatsA@12 +_EnumTimeFormatsW@12 +_EnumTimeFormatsW@12 +_EnumUILanguagesA@12 +_EnumUILanguagesA@12 +_EnumUILanguagesW@12 +_EnumUILanguagesW@12 +_EraseTape@12 +_EraseTape@12 +_EscapeCommFunction@8 +_EscapeCommFunction@8 +_ExitProcess@4 +_ExitProcess@4 +_ExitThread@4 +_ExitThread@4 +_ExpandEnvironmentStringsA@12 +_ExpandEnvironmentStringsA@12 +_ExpandEnvironmentStringsW@12 +_ExpandEnvironmentStringsW@12 +_FatalAppExitA@8 +_FatalAppExitA@8 +_FatalAppExitW@8 +_FatalAppExitW@8 +_FatalExit@4 +_FatalExit@4 +_FileTimeToDosDateTime@12 +_FileTimeToDosDateTime@12 +_FileTimeToLocalFileTime@8 +_FileTimeToLocalFileTime@8 +_FileTimeToSystemTime@8 +_FileTimeToSystemTime@8 +_FillConsoleOutputAttribute@20 +_FillConsoleOutputAttribute@20 +_FillConsoleOutputCharacterA@20 +_FillConsoleOutputCharacterA@20 +_FillConsoleOutputCharacterW@20 +_FillConsoleOutputCharacterW@20 +_FindActCtxSectionGuid@20 +_FindActCtxSectionGuid@20 +_FindActCtxSectionStringA@20 +_FindActCtxSectionStringA@20 +_FindActCtxSectionStringW@20 +_FindActCtxSectionStringW@20 +_FindAtomA@4 +_FindAtomA@4 +_FindAtomW@4 +_FindAtomW@4 +_FindClose@4 +_FindClose@4 +_FindCloseChangeNotification@4 +_FindCloseChangeNotification@4 +_FindFirstChangeNotificationA@12 +_FindFirstChangeNotificationA@12 +_FindFirstChangeNotificationW@12 +_FindFirstChangeNotificationW@12 +_FindFirstFileA@8 +_FindFirstFileA@8 +_FindFirstFileExA@24 +_FindFirstFileExA@24 +_FindFirstFileExW@24 +_FindFirstFileExW@24 +_FindFirstFileW@8 +_FindFirstFileW@8 +_FindFirstStreamW@16 +_FindFirstStreamW@16 +_FindFirstVolumeA@8 +_FindFirstVolumeA@8 +_FindFirstVolumeMountPointA@12 +_FindFirstVolumeMountPointA@12 +_FindFirstVolumeMountPointW@12 +_FindFirstVolumeMountPointW@12 +_FindFirstVolumeW@8 +_FindFirstVolumeW@8 +_FindNextChangeNotification@4 +_FindNextChangeNotification@4 +_FindNextFileA@8 +_FindNextFileA@8 +_FindNextFileW@8 +_FindNextFileW@8 +_FindNextStreamW@8 +_FindNextStreamW@8 +_FindNextVolumeA@12 +_FindNextVolumeA@12 +_FindNextVolumeMountPointA@12 +_FindNextVolumeMountPointA@12 +_FindNextVolumeMountPointW@12 +_FindNextVolumeMountPointW@12 +_FindNextVolumeW@12 +_FindNextVolumeW@12 +_FindResourceA@12 +_FindResourceA@12 +_FindResourceExA@16 +_FindResourceExA@16 +_FindResourceExW@16 +_FindResourceExW@16 +_FindResourceW@12 +_FindResourceW@12 +_FindVolumeClose@4 +_FindVolumeClose@4 +_FindVolumeMountPointClose@4 +_FindVolumeMountPointClose@4 +_FlsAlloc@4 +_FlsAlloc@4 +_FlsFree@4 +_FlsFree@4 +_FlsGetValue@4 +_FlsGetValue@4 +_FlsSetValue@8 +_FlsSetValue@8 +_FlushConsoleInputBuffer@4 +_FlushConsoleInputBuffer@4 +_FlushFileBuffers@4 +_FlushFileBuffers@4 +_FlushInstructionCache@12 +_FlushInstructionCache@12 +_FlushViewOfFile@8 +_FlushViewOfFile@8 +_FoldStringA@20 +_FoldStringA@20 +_FoldStringW@20 +_FoldStringW@20 +_FormatMessageA@28 +_FormatMessageA@28 +_FormatMessageW@28 +_FormatMessageW@28 +_FreeConsole@0 +_FreeConsole@0 +_FreeEnvironmentStringsA@4 +_FreeEnvironmentStringsA@4 +_FreeEnvironmentStringsW@4 +_FreeEnvironmentStringsW@4 +_FreeLibrary@4 +_FreeLibrary@4 +_FreeLibraryAndExitThread@8 +_FreeLibraryAndExitThread@8 +_FreeResource@4 +_FreeResource@4 +_FreeUserPhysicalPages@12 +_FreeUserPhysicalPages@12 +_GenerateConsoleCtrlEvent@8 +_GenerateConsoleCtrlEvent@8 +_GetACP@0 +_GetACP@0 +_GetAtomNameA@12 +_GetAtomNameA@12 +_GetAtomNameW@12 +_GetAtomNameW@12 +_GetBinaryType@8 +_GetBinaryType@8 +_GetBinaryTypeA@8 +_GetBinaryTypeA@8 +_GetBinaryTypeW@8 +_GetBinaryTypeW@8 +_GetCPInfo@8 +_GetCPInfo@8 +_GetCPInfoExA@12 +_GetCPInfoExA@12 +_GetCPInfoExW@12 +_GetCPInfoExW@12 +_GetCalendarInfoA@24 +_GetCalendarInfoA@24 +_GetCalendarInfoW@24 +_GetCalendarInfoW@24 +_GetCommConfig@12 +_GetCommConfig@12 +_GetCommMask@8 +_GetCommMask@8 +_GetCommModemStatus@8 +_GetCommModemStatus@8 +_GetCommProperties@8 +_GetCommProperties@8 +_GetCommState@8 +_GetCommState@8 +_GetCommTimeouts@8 +_GetCommTimeouts@8 +_GetCommandLineA@0 +_GetCommandLineA@0 +_GetCommandLineW@0 +_GetCommandLineW@0 +_GetCompressedFileSizeA@8 +_GetCompressedFileSizeA@8 +_GetCompressedFileSizeW@8 +_GetCompressedFileSizeW@8 +_GetComputerNameA@8 +_GetComputerNameA@8 +_GetComputerNameExA@12 +_GetComputerNameExA@12 +_GetComputerNameExW@12 +_GetComputerNameExW@12 +_GetComputerNameW@8 +_GetComputerNameW@8 +_GetConsoleAliasA@16 +_GetConsoleAliasA@16 +_GetConsoleAliasExesA@8 +_GetConsoleAliasExesA@8 +_GetConsoleAliasExesLengthA@0 +_GetConsoleAliasExesLengthA@0 +_GetConsoleAliasExesLengthW@0 +_GetConsoleAliasExesLengthW@0 +_GetConsoleAliasExesW@8 +_GetConsoleAliasExesW@8 +_GetConsoleAliasW@16 +_GetConsoleAliasW@16 +_GetConsoleAliasesA@12 +_GetConsoleAliasesA@12 +_GetConsoleAliasesLengthA@4 +_GetConsoleAliasesLengthA@4 +_GetConsoleAliasesLengthW@4 +_GetConsoleAliasesLengthW@4 +_GetConsoleAliasesW@12 +_GetConsoleAliasesW@12 +_GetConsoleCP@0 +_GetConsoleCP@0 +_GetConsoleCursorInfo@8 +_GetConsoleCursorInfo@8 +_GetConsoleDisplayMode@4 +_GetConsoleDisplayMode@4 +_GetConsoleFontSize@8 +_GetConsoleFontSize@8 +_GetConsoleMode@8 +_GetConsoleMode@8 +_GetConsoleOutputCP@0 +_GetConsoleOutputCP@0 +_GetConsoleProcessList@8 +_GetConsoleProcessList@8 +_GetConsoleScreenBufferInfo@8 +_GetConsoleScreenBufferInfo@8 +_GetConsoleSelectionInfo@4 +_GetConsoleSelectionInfo@4 +_GetConsoleTitleA@8 +_GetConsoleTitleA@8 +_GetConsoleTitleW@8 +_GetConsoleTitleW@8 +_GetConsoleWindow@0 +_GetConsoleWindow@0 +_GetCurrencyFormatA@24 +_GetCurrencyFormatA@24 +_GetCurrencyFormatW@24 +_GetCurrencyFormatW@24 +_GetCurrentActCtx@4 +_GetCurrentActCtx@4 +_GetCurrentConsoleFont@12 +_GetCurrentConsoleFont@12 +_GetCurrentDirectoryA@8 +_GetCurrentDirectoryA@8 +_GetCurrentDirectoryW@8 +_GetCurrentDirectoryW@8 +_GetCurrentProcess@0 +_GetCurrentProcess@0 +_GetCurrentProcessId@0 +_GetCurrentProcessId@0 +_GetCurrentProcessorNumber@0 +_GetCurrentProcessorNumber@0 +_GetCurrentThread@0 +_GetCurrentThread@0 +_GetCurrentThreadId@0 +_GetCurrentThreadId@0 +_GetDateFormatA@24 +_GetDateFormatA@24 +_GetDateFormatW@24 +_GetDateFormatW@24 +_GetDefaultCommConfigA@12 +_GetDefaultCommConfigA@12 +_GetDefaultCommConfigW@12 +_GetDefaultCommConfigW@12 +_GetDevicePowerState@8 +_GetDevicePowerState@8 +_GetDiskFreeSpaceA@20 +_GetDiskFreeSpaceA@20 +_GetDiskFreeSpaceExA@16 +_GetDiskFreeSpaceExA@16 +_GetDiskFreeSpaceExW@16 +_GetDiskFreeSpaceExW@16 +_GetDiskFreeSpaceW@20 +_GetDiskFreeSpaceW@20 +_GetDllDirectoryA@8 +_GetDllDirectoryA@8 +_GetDllDirectoryW@8 +_GetDllDirectoryW@8 +_GetDriveTypeA@4 +_GetDriveTypeA@4 +_GetDriveTypeW@4 +_GetDriveTypeW@4 +_GetEnvironmentStrings@0 +_GetEnvironmentStrings@0 +_GetEnvironmentStringsA@0 +_GetEnvironmentStringsA@0 +_GetEnvironmentStringsW@0 +_GetEnvironmentStringsW@0 +_GetEnvironmentVariableA@12 +_GetEnvironmentVariableA@12 +_GetEnvironmentVariableW@12 +_GetEnvironmentVariableW@12 +_GetExitCodeProcess@8 +_GetExitCodeProcess@8 +_GetExitCodeThread@8 +_GetExitCodeThread@8 +_GetFileAttributesA@4 +_GetFileAttributesA@4 +_GetFileAttributesExA@12 +_GetFileAttributesExA@12 +_GetFileAttributesExW@12 +_GetFileAttributesExW@12 +_GetFileAttributesW@4 +_GetFileAttributesW@4 +_GetFileInformationByHandle@8 +_GetFileInformationByHandle@8 +_GetFileSize@8 +_GetFileSize@8 +_GetFileSizeEx@8 +_GetFileSizeEx@8 +_GetFileTime@16 +_GetFileTime@16 +_GetFileType@4 +_GetFileType@4 +_GetFirmwareEnvironmentVariableA@16 +_GetFirmwareEnvironmentVariableA@16 +_GetFirmwareEnvironmentVariableW@16 +_GetFirmwareEnvironmentVariableW@16 +_GetFullPathNameA@16 +_GetFullPathNameA@16 +_GetFullPathNameW@16 +_GetFullPathNameW@16 +_GetGeoInfoA@20 +_GetGeoInfoA@20 +_GetGeoInfoW@20 +_GetGeoInfoW@20 +_GetHandleInformation@8 +_GetHandleInformation@8 +_GetLargePageMinimum@0 +_GetLargePageMinimum@0 +_GetLargestConsoleWindowSize@4 +_GetLargestConsoleWindowSize@4 +_GetLastError@0 +_GetLastError@0 +_GetLocalTime@4 +_GetLocalTime@4 +_GetLocaleInfoA@16 +_GetLocaleInfoA@16 +_GetLocaleInfoW@16 +_GetLocaleInfoW@16 +_GetLogicalDriveStringsA@8 +_GetLogicalDriveStringsA@8 +_GetLogicalDriveStringsW@8 +_GetLogicalDriveStringsW@8 +_GetLogicalDrives@0 +_GetLogicalDrives@0 +_GetLogicalProcessorInformation@8 +_GetLogicalProcessorInformation@8 +_GetLongPathNameA@12 +_GetLongPathNameA@12 +_GetLongPathNameW@12 +_GetLongPathNameW@12 +_GetMailslotInfo@20 +_GetMailslotInfo@20 +_GetModuleFileNameA@12 +_GetModuleFileNameA@12 +_GetModuleFileNameW@12 +_GetModuleFileNameW@12 +_GetModuleHandleA@4 +_GetModuleHandleA@4 +_GetModuleHandleExA@12 +_GetModuleHandleExA@12 +_GetModuleHandleExW@12 +_GetModuleHandleExW@12 +_GetModuleHandleW@4 +_GetModuleHandleW@4 +_GetNLSVersion@12 +_GetNLSVersion@12 +_GetNamedPipeHandleStateA@28 +_GetNamedPipeHandleStateA@28 +_GetNamedPipeHandleStateW@28 +_GetNamedPipeHandleStateW@28 +_GetNamedPipeInfo@20 +_GetNamedPipeInfo@20 +_GetNativeSystemInfo@4 +_GetNativeSystemInfo@4 +_GetNumaAvailableMemoryNode@8 +_GetNumaAvailableMemoryNode@8 +_GetNumaHighestNodeNumber@4 +_GetNumaHighestNodeNumber@4 +_GetNumaNodeProcessorMask@8 +_GetNumaNodeProcessorMask@8 +_GetNumaProcessorNode@8 +_GetNumaProcessorNode@8 +_GetNumberFormatA@24 +_GetNumberFormatA@24 +_GetNumberFormatW@24 +_GetNumberFormatW@24 +_GetNumberOfConsoleInputEvents@8 +_GetNumberOfConsoleInputEvents@8 +_GetNumberOfConsoleMouseButtons@4 +_GetNumberOfConsoleMouseButtons@4 +_GetOEMCP@0 +_GetOEMCP@0 +_GetOverlappedResult@16 +_GetOverlappedResult@16 +_GetPriorityClass@4 +_GetPriorityClass@4 +_GetPrivateProfileIntA@16 +_GetPrivateProfileIntA@16 +_GetPrivateProfileIntW@16 +_GetPrivateProfileIntW@16 +_GetPrivateProfileSectionA@16 +_GetPrivateProfileSectionA@16 +_GetPrivateProfileSectionNamesA@12 +_GetPrivateProfileSectionNamesA@12 +_GetPrivateProfileSectionNamesW@12 +_GetPrivateProfileSectionNamesW@12 +_GetPrivateProfileSectionW@16 +_GetPrivateProfileSectionW@16 +_GetPrivateProfileStringA@24 +_GetPrivateProfileStringA@24 +_GetPrivateProfileStringW@24 +_GetPrivateProfileStringW@24 +_GetPrivateProfileStructA@20 +_GetPrivateProfileStructA@20 +_GetPrivateProfileStructW@20 +_GetPrivateProfileStructW@20 +_GetProcAddress@8 +_GetProcAddress@8 +_GetProcessAffinityMask@12 +_GetProcessAffinityMask@12 +_GetProcessHandleCount@8 +_GetProcessHandleCount@8 +_GetProcessHeap@0 +_GetProcessHeap@0 +_GetProcessHeaps@8 +_GetProcessHeaps@8 +_GetProcessId@4 +_GetProcessId@4 +_GetProcessIdOfThread@4 +_GetProcessIdOfThread@4 +_GetProcessIoCounters@8 +_GetProcessIoCounters@8 +_GetProcessPriorityBoost@8 +_GetProcessPriorityBoost@8 +_GetProcessShutdownParameters@8 +_GetProcessShutdownParameters@8 +_GetProcessTimes@20 +_GetProcessTimes@20 +_GetProcessVersion@4 +_GetProcessVersion@4 +_GetProcessWorkingSetSize@12 +_GetProcessWorkingSetSize@12 +_GetProcessWorkingSetSizeEx@16 +_GetProcessWorkingSetSizeEx@16 +_GetProfileIntA@12 +_GetProfileIntA@12 +_GetProfileIntW@12 +_GetProfileIntW@12 +_GetProfileSectionA@12 +_GetProfileSectionA@12 +_GetProfileSectionW@12 +_GetProfileSectionW@12 +_GetProfileStringA@20 +_GetProfileStringA@20 +_GetProfileStringW@20 +_GetProfileStringW@20 +_GetQueuedCompletionStatus@20 +_GetQueuedCompletionStatus@20 +_GetShortPathNameA@12 +_GetShortPathNameA@12 +_GetShortPathNameW@12 +_GetShortPathNameW@12 +_GetStartupInfoA@4 +_GetStartupInfoA@4 +_GetStartupInfoW@4 +_GetStartupInfoW@4 +_GetStdHandle@4 +_GetStdHandle@4 +_GetStringTypeA@20 +_GetStringTypeA@20 +_GetStringTypeExA@20 +_GetStringTypeExA@20 +_GetStringTypeExW@20 +_GetStringTypeExW@20 +_GetStringTypeW@16 +_GetStringTypeW@16 +_GetSystemDefaultLCID@0 +_GetSystemDefaultLCID@0 +_GetSystemDefaultLangID@0 +_GetSystemDefaultLangID@0 +_GetSystemDefaultUILanguage@0 +_GetSystemDefaultUILanguage@0 +_GetSystemDirectoryA@8 +_GetSystemDirectoryA@8 +_GetSystemDirectoryW@8 +_GetSystemDirectoryW@8 +_GetSystemFileCacheSize@12 +_GetSystemFileCacheSize@12 +_GetSystemFirmwareTable@16 +_GetSystemFirmwareTable@16 +_GetSystemInfo@4 +_GetSystemInfo@4 +_GetSystemPowerStatus@4 +_GetSystemPowerStatus@4 +_GetSystemRegistryQuota@8 +_GetSystemRegistryQuota@8 +_GetSystemTime@4 +_GetSystemTime@4 +_GetSystemTimeAdjustment@12 +_GetSystemTimeAdjustment@12 +_GetSystemTimeAsFileTime@4 +_GetSystemTimeAsFileTime@4 +_GetSystemTimes@12 +_GetSystemTimes@12 +_GetSystemWindowsDirectoryA@8 +_GetSystemWindowsDirectoryA@8 +_GetSystemWindowsDirectoryW@8 +_GetSystemWindowsDirectoryW@8 +_GetSystemWow64DirectoryA@8 +_GetSystemWow64DirectoryA@8 +_GetSystemWow64DirectoryW@8 +_GetSystemWow64DirectoryW@8 +_GetTapeParameters@16 +_GetTapeParameters@16 +_GetTapePosition@20 +_GetTapePosition@20 +_GetTapeStatus@4 +_GetTapeStatus@4 +_GetTempFileNameA@16 +_GetTempFileNameA@16 +_GetTempFileNameW@16 +_GetTempFileNameW@16 +_GetTempPathA@8 +_GetTempPathA@8 +_GetTempPathW@8 +_GetTempPathW@8 +_GetThreadContext@8 +_GetThreadContext@8 +_GetThreadIOPendingFlag@8 +_GetThreadIOPendingFlag@8 +_GetThreadId@4 +_GetThreadId@4 +_GetThreadLocale@0 +_GetThreadLocale@0 +_GetThreadPriority@4 +_GetThreadPriority@4 +_GetThreadPriorityBoost@8 +_GetThreadPriorityBoost@8 +_GetThreadSelectorEntry@12 +_GetThreadSelectorEntry@12 +_GetThreadTimes@20 +_GetThreadTimes@20 +_GetTickCount@0 +_GetTickCount@0 +_GetTimeFormatA@24 +_GetTimeFormatA@24 +_GetTimeFormatW@24 +_GetTimeFormatW@24 +_GetTimeZoneInformation@4 +_GetTimeZoneInformation@4 +_GetUserDefaultLCID@0 +_GetUserDefaultLCID@0 +_GetUserDefaultLangID@0 +_GetUserDefaultLangID@0 +_GetUserDefaultUILanguage@0 +_GetUserDefaultUILanguage@0 +_GetUserGeoID@4 +_GetUserGeoID@4 +_GetVersion@0 +_GetVersion@0 +_GetVersionExA@4 +_GetVersionExA@4 +_GetVersionExW@4 +_GetVersionExW@4 +_GetVolumeInformationA@32 +_GetVolumeInformationA@32 +_GetVolumeInformationW@32 +_GetVolumeInformationW@32 +_GetVolumeNameForVolumeMountPointA@12 +_GetVolumeNameForVolumeMountPointA@12 +_GetVolumeNameForVolumeMountPointW@12 +_GetVolumeNameForVolumeMountPointW@12 +_GetVolumePathNameA@12 +_GetVolumePathNameA@12 +_GetVolumePathNameW@12 +_GetVolumePathNameW@12 +_GetVolumePathNamesForVolumeNameA@16 +_GetVolumePathNamesForVolumeNameA@16 +_GetVolumePathNamesForVolumeNameW@16 +_GetVolumePathNamesForVolumeNameW@16 +_GetWindowsDirectoryA@8 +_GetWindowsDirectoryA@8 +_GetWindowsDirectoryW@8 +_GetWindowsDirectoryW@8 +_GetWriteWatch@24 +_GetWriteWatch@24 +_GlobalAddAtomA@4 +_GlobalAddAtomA@4 +_GlobalAddAtomW@4 +_GlobalAddAtomW@4 +_GlobalAlloc@8 +_GlobalAlloc@8 +_GlobalCompact@4 +_GlobalCompact@4 +_GlobalDeleteAtom@4 +_GlobalDeleteAtom@4 +_GlobalFindAtomA@4 +_GlobalFindAtomA@4 +_GlobalFindAtomW@4 +_GlobalFindAtomW@4 +_GlobalFix@4 +_GlobalFix@4 +_GlobalFlags@4 +_GlobalFlags@4 +_GlobalFree@4 +_GlobalFree@4 +_GlobalGetAtomNameA@12 +_GlobalGetAtomNameA@12 +_GlobalGetAtomNameW@12 +_GlobalGetAtomNameW@12 +_GlobalHandle@4 +_GlobalHandle@4 +_GlobalLock@4 +_GlobalLock@4 +_GlobalMemoryStatus@4 +_GlobalMemoryStatus@4 +_GlobalMemoryStatusEx@4 +_GlobalMemoryStatusEx@4 +_GlobalReAlloc@12 +_GlobalReAlloc@12 +_GlobalSize@4 +_GlobalSize@4 +_GlobalUnWire@4 +_GlobalUnWire@4 +_GlobalUnfix@4 +_GlobalUnfix@4 +_GlobalUnlock@4 +_GlobalUnlock@4 +_GlobalWire@4 +_GlobalWire@4 +_Heap32First@12 +_Heap32First@12 +_Heap32ListFirst@8 +_Heap32ListFirst@8 +_Heap32ListNext@8 +_Heap32ListNext@8 +_Heap32Next@4 +_Heap32Next@4 +_HeapAlloc@12 +_HeapAlloc@12 +_HeapCompact@8 +_HeapCompact@8 +_HeapCreate@12 +_HeapCreate@12 +_HeapDestroy@4 +_HeapDestroy@4 +_HeapFree@12 +_HeapFree@12 +_HeapLock@4 +_HeapLock@4 +_HeapQueryInformation@20 +_HeapQueryInformation@20 +_HeapReAlloc@16 +_HeapReAlloc@16 +_HeapSetInformation@16 +_HeapSetInformation@16 +_HeapSize@12 +_HeapSize@12 +_HeapUnlock@4 +_HeapUnlock@4 +_HeapValidate@12 +_HeapValidate@12 +_HeapWalk@8 +_HeapWalk@8 +_InitAtomTable@4 +_InitAtomTable@4 +_InitializeCriticalSection@4 +_InitializeCriticalSection@4 +_InitializeCriticalSectionAndSpinCount@8 +_InitializeCriticalSectionAndSpinCount@8 +_InitializeSListHead@4 +_InitializeSListHead@4 +_InterlockedCompareExchange64@20 +_InterlockedCompareExchange64@20 +_InterlockedCompareExchange@12 +_InterlockedCompareExchange@12 +_InterlockedDecrement@4 +_InterlockedDecrement@4 +_InterlockedExchange@8 +_InterlockedExchange@8 +_InterlockedExchangeAdd@8 +_InterlockedExchangeAdd@8 +_InterlockedFlushSList@4 +_InterlockedFlushSList@4 +_InterlockedIncrement@4 +_InterlockedIncrement@4 +_InterlockedPopEntrySList@4 +_InterlockedPopEntrySList@4 +_InterlockedPushEntrySList@8 +_InterlockedPushEntrySList@8 +_IsBadCodePtr@4 +_IsBadCodePtr@4 +_IsBadHugeReadPtr@8 +_IsBadHugeReadPtr@8 +_IsBadHugeWritePtr@8 +_IsBadHugeWritePtr@8 +_IsBadReadPtr@8 +_IsBadReadPtr@8 +_IsBadStringPtrA@8 +_IsBadStringPtrA@8 +_IsBadStringPtrW@8 +_IsBadStringPtrW@8 +_IsBadWritePtr@8 +_IsBadWritePtr@8 +_IsDBCSLeadByte@4 +_IsDBCSLeadByte@4 +_IsDBCSLeadByteEx@8 +_IsDBCSLeadByteEx@8 +_IsDebuggerPresent@0 +_IsDebuggerPresent@0 +_IsNLSDefinedString@20 +_IsNLSDefinedString@20 +_IsProcessInJob@12 +_IsProcessInJob@12 +_IsProcessorFeaturePresent@4 +_IsProcessorFeaturePresent@4 +_IsSystemResumeAutomatic@0 +_IsSystemResumeAutomatic@0 +_IsValidCodePage@4 +_IsValidCodePage@4 +_IsValidLanguageGroup@8 +_IsValidLanguageGroup@8 +_IsValidLocale@8 +_IsValidLocale@8 +_IsWow64Process@8 +_IsWow64Process@8 +_LCMapStringA@24 +_LCMapStringA@24 +_LCMapStringW@24 +_LCMapStringW@24 +_LeaveCriticalSection@4 +_LeaveCriticalSection@4 +_LoadLibraryA@4 +_LoadLibraryA@4 +_LoadLibraryExA@12 +_LoadLibraryExA@12 +_LoadLibraryExW@12 +_LoadLibraryExW@12 +_LoadLibraryW@4 +_LoadLibraryW@4 +_LoadModule@8 +_LoadModule@8 +_LoadResource@8 +_LoadResource@8 +_LocalAlloc@8 +_LocalAlloc@8 +_LocalCompact@4 +_LocalCompact@4 +_LocalFileTimeToFileTime@8 +_LocalFileTimeToFileTime@8 +_LocalFlags@4 +_LocalFlags@4 +_LocalFree@4 +_LocalFree@4 +_LocalHandle@4 +_LocalHandle@4 +_LocalLock@4 +_LocalLock@4 +_LocalReAlloc@12 +_LocalReAlloc@12 +_LocalShrink@8 +_LocalShrink@8 +_LocalSize@4 +_LocalSize@4 +_LocalUnlock@4 +_LocalUnlock@4 +_LockFile@20 +_LockFile@20 +_LockFileEx@24 +_LockFileEx@24 +_LockResource@4 +_LockResource@4 +_MapUserPhysicalPages@12 +_MapUserPhysicalPages@12 +_MapUserPhysicalPagesScatter@12 +_MapUserPhysicalPagesScatter@12 +_MapViewOfFile@20 +_MapViewOfFile@20 +_MapViewOfFileEx@24 +_MapViewOfFileEx@24 +_Module32First@8 +_Module32First@8 +_Module32FirstW@8 +_Module32FirstW@8 +_Module32Next@8 +_Module32Next@8 +_Module32NextW@8 +_Module32NextW@8 +_MoveFileA@8 +_MoveFileA@8 +_MoveFileExA@12 +_MoveFileExA@12 +_MoveFileExW@12 +_MoveFileExW@12 +_MoveFileW@8 +_MoveFileW@8 +_MoveFileWithProgressA@20 +_MoveFileWithProgressA@20 +_MoveFileWithProgressW@20 +_MoveFileWithProgressW@20 +_MulDiv@12 +_MulDiv@12 +_MultiByteToWideChar@24 +_MultiByteToWideChar@24 +_NeedCurrentDirectoryForExePathA@4 +_NeedCurrentDirectoryForExePathA@4 +_NeedCurrentDirectoryForExePathW@4 +_NeedCurrentDirectoryForExePathW@4 +_OpenEventA@12 +_OpenEventA@12 +_OpenEventW@12 +_OpenEventW@12 +_OpenFile@12 +_OpenFile@12 +_OpenFileMappingA@12 +_OpenFileMappingA@12 +_OpenFileMappingW@12 +_OpenFileMappingW@12 +_OpenJobObjectA@12 +_OpenJobObjectA@12 +_OpenJobObjectW@12 +_OpenJobObjectW@12 +_OpenMutexA@12 +_OpenMutexA@12 +_OpenMutexW@12 +_OpenMutexW@12 +_OpenProcess@12 +_OpenProcess@12 +_OpenSemaphoreA@12 +_OpenSemaphoreA@12 +_OpenSemaphoreW@12 +_OpenSemaphoreW@12 +_OpenThread@12 +_OpenThread@12 +_OpenWaitableTimerA@12 +_OpenWaitableTimerA@12 +_OpenWaitableTimerW@12 +_OpenWaitableTimerW@12 +_OutputDebugStringA@4 +_OutputDebugStringA@4 +_OutputDebugStringW@4 +_OutputDebugStringW@4 +_PeekConsoleInputA@16 +_PeekConsoleInputA@16 +_PeekConsoleInputW@16 +_PeekConsoleInputW@16 +_PeekNamedPipe@24 +_PeekNamedPipe@24 +_PostQueuedCompletionStatus@16 +_PostQueuedCompletionStatus@16 +_PrepareTape@12 +_PrepareTape@12 +_Process32First@8 +_Process32First@8 +_Process32FirstW@8 +_Process32FirstW@8 +_Process32Next@8 +_Process32Next@8 +_Process32NextW@8 +_Process32NextW@8 +_ProcessIdToSessionId@8 +_ProcessIdToSessionId@8 +_PulseEvent@4 +_PulseEvent@4 +_PurgeComm@8 +_PurgeComm@8 +_QueryActCtxW@28 +_QueryActCtxW@28 +_QueryDepthSList@4 +_QueryDepthSList@4 +_QueryDosDeviceA@12 +_QueryDosDeviceA@12 +_QueryDosDeviceW@12 +_QueryDosDeviceW@12 +_QueryInformationJobObject@20 +_QueryInformationJobObject@20 +_QueryMemoryResourceNotification@8 +_QueryMemoryResourceNotification@8 +_QueryPerformanceCounter@4 +_QueryPerformanceCounter@4 +_QueryPerformanceFrequency@4 +_QueryPerformanceFrequency@4 +_QueueUserAPC@12 +_QueueUserAPC@12 +_QueueUserWorkItem@12 +_QueueUserWorkItem@12 +_RaiseException@16 +_RaiseException@16 +_ReOpenFile@16 +_ReOpenFile@16 +_ReadConsoleA@20 +_ReadConsoleA@20 +_ReadConsoleInputA@16 +_ReadConsoleInputA@16 +_ReadConsoleInputW@16 +_ReadConsoleInputW@16 +_ReadConsoleOutputA@20 +_ReadConsoleOutputA@20 +_ReadConsoleOutputAttribute@20 +_ReadConsoleOutputAttribute@20 +_ReadConsoleOutputCharacterA@20 +_ReadConsoleOutputCharacterA@20 +_ReadConsoleOutputCharacterW@20 +_ReadConsoleOutputCharacterW@20 +_ReadConsoleOutputW@20 +_ReadConsoleOutputW@20 +_ReadConsoleW@20 +_ReadConsoleW@20 +_ReadDirectoryChangesW@32 +_ReadDirectoryChangesW@32 +_ReadFile@20 +_ReadFile@20 +_ReadFileEx@20 +_ReadFileEx@20 +_ReadFileScatter@20 +_ReadFileScatter@20 +_ReadProcessMemory@20 +_ReadProcessMemory@20 +_RegisterWaitForSingleObject@24 +_RegisterWaitForSingleObject@24 +_RegisterWaitForSingleObjectEx@20 +_RegisterWaitForSingleObjectEx@20 +_ReleaseActCtx@4 +_ReleaseActCtx@4 +_ReleaseMutex@4 +_ReleaseMutex@4 +_ReleaseSemaphore@12 +_ReleaseSemaphore@12 +_RemoveDirectoryA@4 +_RemoveDirectoryA@4 +_RemoveDirectoryW@4 +_RemoveDirectoryW@4 +_RemoveVectoredContinueHandler@4 +_RemoveVectoredContinueHandler@4 +_RemoveVectoredExceptionHandler@4 +_RemoveVectoredExceptionHandler@4 +_ReplaceFile@24 +_ReplaceFile@24 +_ReplaceFileA@24 +_ReplaceFileA@24 +_ReplaceFileW@24 +_ReplaceFileW@24 +_RequestDeviceWakeup@4 +_RequestDeviceWakeup@4 +_RequestWakeupLatency@4 +_RequestWakeupLatency@4 +_ResetEvent@4 +_ResetEvent@4 +_ResetWriteWatch@8 +_ResetWriteWatch@8 +_RestoreLastError@4 +_RestoreLastError@4 +_ResumeThread@4 +_ResumeThread@4 +_RtlCaptureContext@4 +_RtlCaptureContext@4 +_RtlCaptureStackBackTrace@16 +_RtlCaptureStackBackTrace@16 +_RtlFillMemory@12 +_RtlFillMemory@12 +_RtlMoveMemory@12 +_RtlMoveMemory@12 +_RtlUnwind@16 +_RtlUnwind@16 +_RtlZeroMemory@8 +_RtlZeroMemory@8 +_ScrollConsoleScreenBufferA@20 +_ScrollConsoleScreenBufferA@20 +_ScrollConsoleScreenBufferW@20 +_ScrollConsoleScreenBufferW@20 +_SearchPathA@24 +_SearchPathA@24 +_SearchPathW@24 +_SearchPathW@24 +_SetCalendarInfoA@16 +_SetCalendarInfoA@16 +_SetCalendarInfoW@16 +_SetCalendarInfoW@16 +_SetCommBreak@4 +_SetCommBreak@4 +_SetCommConfig@12 +_SetCommConfig@12 +_SetCommMask@8 +_SetCommMask@8 +_SetCommState@8 +_SetCommState@8 +_SetCommTimeouts@8 +_SetCommTimeouts@8 +_SetComputerNameA@4 +_SetComputerNameA@4 +_SetComputerNameExA@8 +_SetComputerNameExA@8 +_SetComputerNameExW@8 +_SetComputerNameExW@8 +_SetComputerNameW@4 +_SetComputerNameW@4 +_SetConsoleActiveScreenBuffer@4 +_SetConsoleActiveScreenBuffer@4 +_SetConsoleCP@4 +_SetConsoleCP@4 +_SetConsoleCtrlHandler@8 +_SetConsoleCtrlHandler@8 +_SetConsoleCursor@8 +_SetConsoleCursor@8 +_SetConsoleCursorInfo@8 +_SetConsoleCursorInfo@8 +_SetConsoleCursorPosition@8 +_SetConsoleCursorPosition@8 +_SetConsoleMode@8 +_SetConsoleMode@8 +_SetConsoleOutputCP@4 +_SetConsoleOutputCP@4 +_SetConsoleScreenBufferSize@8 +_SetConsoleScreenBufferSize@8 +_SetConsoleTextAttribute@8 +_SetConsoleTextAttribute@8 +_SetConsoleTitleA@4 +_SetConsoleTitleA@4 +_SetConsoleTitleW@4 +_SetConsoleTitleW@4 +_SetConsoleWindowInfo@12 +_SetConsoleWindowInfo@12 +_SetCriticalSectionSpinCount@8 +_SetCriticalSectionSpinCount@8 +_SetCurrentDirectoryA@4 +_SetCurrentDirectoryA@4 +_SetCurrentDirectoryW@4 +_SetCurrentDirectoryW@4 +_SetDefaultCommConfigA@12 +_SetDefaultCommConfigA@12 +_SetDefaultCommConfigW@12 +_SetDefaultCommConfigW@12 +_SetDllDirectoryA@4 +_SetDllDirectoryA@4 +_SetDllDirectoryW@4 +_SetDllDirectoryW@4 +_SetEndOfFile@4 +_SetEndOfFile@4 +_SetEnvironmentStringsA@4 +_SetEnvironmentStringsA@4 +_SetEnvironmentStringsW@4 +_SetEnvironmentStringsW@4 +_SetEnvironmentVariableA@8 +_SetEnvironmentVariableA@8 +_SetEnvironmentVariableW@8 +_SetEnvironmentVariableW@8 +_SetErrorMode@4 +_SetErrorMode@4 +_SetEvent@4 +_SetEvent@4 +_SetFileApisToANSI@0 +_SetFileApisToANSI@0 +_SetFileApisToOEM@0 +_SetFileApisToOEM@0 +_SetFileAttributesA@8 +_SetFileAttributesA@8 +_SetFileAttributesW@8 +_SetFileAttributesW@8 +_SetFilePointer@16 +_SetFilePointer@16 +_SetFilePointerEx@20 +_SetFilePointerEx@20 +_SetFileShortNameA@8 +_SetFileShortNameA@8 +_SetFileShortNameW@8 +_SetFileShortNameW@8 +_SetFileTime@16 +_SetFileTime@16 +_SetFileValidData@12 +_SetFileValidData@12 +_SetFirmwareEnvironmentVariableA@16 +_SetFirmwareEnvironmentVariableA@16 +_SetFirmwareEnvironmentVariableW@16 +_SetFirmwareEnvironmentVariableW@16 +_SetHandleCount@4 +_SetHandleCount@4 +_SetHandleInformation@12 +_SetHandleInformation@12 +_SetInformationJobObject@16 +_SetInformationJobObject@16 +_SetLastError@4 +_SetLastError@4 +_SetLocalTime@4 +_SetLocalTime@4 +_SetLocaleInfoA@12 +_SetLocaleInfoA@12 +_SetLocaleInfoW@12 +_SetLocaleInfoW@12 +_SetMailslotInfo@8 +_SetMailslotInfo@8 +_SetMessageWaitingIndicator@8 +_SetMessageWaitingIndicator@8 +_SetNamedPipeHandleState@16 +_SetNamedPipeHandleState@16 +_SetPriorityClass@8 +_SetPriorityClass@8 +_SetProcessAffinityMask@8 +_SetProcessAffinityMask@8 +_SetProcessPriorityBoost@8 +_SetProcessPriorityBoost@8 +_SetProcessShutdownParameters@8 +_SetProcessShutdownParameters@8 +_SetProcessWorkingSetSize@12 +_SetProcessWorkingSetSize@12 +_SetProcessWorkingSetSizeEx@16 +_SetProcessWorkingSetSizeEx@16 +_SetStdHandle@8 +_SetStdHandle@8 +_SetSystemFileCacheSize@12 +_SetSystemFileCacheSize@12 +_SetSystemPowerState@8 +_SetSystemPowerState@8 +_SetSystemTime@4 +_SetSystemTime@4 +_SetSystemTimeAdjustment@8 +_SetSystemTimeAdjustment@8 +_SetTapeParameters@12 +_SetTapeParameters@12 +_SetTapePosition@24 +_SetTapePosition@24 +_SetThreadAffinityMask@8 +_SetThreadAffinityMask@8 +_SetThreadContext@8 +_SetThreadContext@8 +_SetThreadExecutionState@4 +_SetThreadExecutionState@4 +_SetThreadIdealProcessor@8 +_SetThreadIdealProcessor@8 +_SetThreadLocale@4 +_SetThreadLocale@4 +_SetThreadPriority@8 +_SetThreadPriority@8 +_SetThreadPriorityBoost@8 +_SetThreadPriorityBoost@8 +_SetThreadStackGuarantee@4 +_SetThreadStackGuarantee@4 +_SetTimeZoneInformation@4 +_SetTimeZoneInformation@4 +_SetTimerQueueTimer@24 +_SetTimerQueueTimer@24 +_SetUnhandledExceptionFilter@4 +_SetUnhandledExceptionFilter@4 +_SetUserGeoID@4 +_SetUserGeoID@4 +_SetVolumeLabelA@8 +_SetVolumeLabelA@8 +_SetVolumeLabelW@8 +_SetVolumeLabelW@8 +_SetVolumeMountPointA@8 +_SetVolumeMountPointA@8 +_SetVolumeMountPointW@8 +_SetVolumeMountPointW@8 +_SetWaitableTimer@24 +_SetWaitableTimer@24 +_SetupComm@12 +_SetupComm@12 +_SignalObjectAndWait@16 +_SignalObjectAndWait@16 +_SizeofResource@8 +_SizeofResource@8 +_Sleep@4 +_Sleep@4 +_SleepEx@8 +_SleepEx@8 +_SuspendThread@4 +_SuspendThread@4 +_SwitchToFiber@4 +_SwitchToFiber@4 +_SwitchToThread@0 +_SwitchToThread@0 +_SystemTimeToFileTime@8 +_SystemTimeToFileTime@8 +_SystemTimeToTzSpecificLocalTime@12 +_SystemTimeToTzSpecificLocalTime@12 +_TerminateJobObject@8 +_TerminateJobObject@8 +_TerminateProcess@8 +_TerminateProcess@8 +_TerminateThread@8 +_TerminateThread@8 +_Thread32First@8 +_Thread32First@8 +_Thread32Next@8 +_Thread32Next@8 +_TlsAlloc@0 +_TlsAlloc@0 +_TlsFree@4 +_TlsFree@4 +_TlsGetValue@4 +_TlsGetValue@4 +_TlsSetValue@8 +_TlsSetValue@8 +_Toolhelp32ReadProcessMemory@20 +_Toolhelp32ReadProcessMemory@20 +_TransactNamedPipe@28 +_TransactNamedPipe@28 +_TransmitCommChar@8 +_TransmitCommChar@8 +_TryEnterCriticalSection@4 +_TryEnterCriticalSection@4 +_TzSpecificLocalTimeToSystemTime@12 +_TzSpecificLocalTimeToSystemTime@12 +_UnhandledExceptionFilter@4 +_UnhandledExceptionFilter@4 +_UnlockFile@20 +_UnlockFile@20 +_UnlockFileEx@20 +_UnlockFileEx@20 +_UnmapViewOfFile@4 +_UnmapViewOfFile@4 +_UnregisterWait@4 +_UnregisterWait@4 +_UnregisterWaitEx@8 +_UnregisterWaitEx@8 +_UpdateResourceA@24 +_UpdateResourceA@24 +_UpdateResourceW@24 +_UpdateResourceW@24 +_VerLanguageNameA@12 +_VerLanguageNameA@12 +_VerLanguageNameW@12 +_VerLanguageNameW@12 +_VerSetConditionMask@16 +_VerSetConditionMask@16 +_VerifyVersionInfoA@16 +_VerifyVersionInfoA@16 +_VerifyVersionInfoW@16 +_VerifyVersionInfoW@16 +_VirtualAlloc@16 +_VirtualAlloc@16 +_VirtualAllocEx@20 +_VirtualAllocEx@20 +_VirtualFree@12 +_VirtualFree@12 +_VirtualFreeEx@16 +_VirtualFreeEx@16 +_VirtualLock@8 +_VirtualLock@8 +_VirtualProtect@16 +_VirtualProtect@16 +_VirtualProtectEx@20 +_VirtualProtectEx@20 +_VirtualQuery@12 +_VirtualQuery@12 +_VirtualQueryEx@16 +_VirtualQueryEx@16 +_VirtualUnlock@8 +_VirtualUnlock@8 +_WTSGetActiveConsoleSessionId@0 +_WTSGetActiveConsoleSessionId@0 +_WaitCommEvent@12 +_WaitCommEvent@12 +_WaitForDebugEvent@8 +_WaitForDebugEvent@8 +_WaitForMultipleObjects@16 +_WaitForMultipleObjects@16 +_WaitForMultipleObjectsEx@20 +_WaitForMultipleObjectsEx@20 +_WaitForSingleObject@8 +_WaitForSingleObject@8 +_WaitForSingleObjectEx@12 +_WaitForSingleObjectEx@12 +_WaitNamedPipeA@8 +_WaitNamedPipeA@8 +_WaitNamedPipeW@8 +_WaitNamedPipeW@8 +_WideCharToMultiByte@32 +_WideCharToMultiByte@32 +_WinExec@8 +_WinExec@8 +_Wow64DisableWow64FsRedirection@4 +_Wow64DisableWow64FsRedirection@4 +_Wow64EnableWow64FsRedirection@4 +_Wow64EnableWow64FsRedirection@4 +_Wow64RevertWow64FsRedirection@4 +_Wow64RevertWow64FsRedirection@4 +_WriteConsoleA@20 +_WriteConsoleA@20 +_WriteConsoleInputA@16 +_WriteConsoleInputA@16 +_WriteConsoleInputW@16 +_WriteConsoleInputW@16 +_WriteConsoleOutputA@20 +_WriteConsoleOutputA@20 +_WriteConsoleOutputAttribute@20 +_WriteConsoleOutputAttribute@20 +_WriteConsoleOutputCharacterA@20 +_WriteConsoleOutputCharacterA@20 +_WriteConsoleOutputCharacterW@20 +_WriteConsoleOutputCharacterW@20 +_WriteConsoleOutputW@20 +_WriteConsoleOutputW@20 +_WriteConsoleW@20 +_WriteConsoleW@20 +_WriteFile@20 +_WriteFile@20 +_WriteFileEx@20 +_WriteFileEx@20 +_WriteFileGather@20 +_WriteFileGather@20 +_WritePrivateProfileSectionA@12 +_WritePrivateProfileSectionA@12 +_WritePrivateProfileSectionW@12 +_WritePrivateProfileSectionW@12 +_WritePrivateProfileStringA@16 +_WritePrivateProfileStringA@16 +_WritePrivateProfileStringW@16 +_WritePrivateProfileStringW@16 +_WritePrivateProfileStructA@20 +_WritePrivateProfileStructA@20 +_WritePrivateProfileStructW@20 +_WritePrivateProfileStructW@20 +_WriteProcessMemory@20 +_WriteProcessMemory@20 +_WriteProfileSectionA@8 +_WriteProfileSectionA@8 +_WriteProfileSectionW@8 +_WriteProfileSectionW@8 +_WriteProfileStringA@12 +_WriteProfileStringA@12 +_WriteProfileStringW@12 +_WriteProfileStringW@12 +_WriteTapemark@16 +_WriteTapemark@16 +_ZombifyActCtx@4 +_ZombifyActCtx@4 +__hread@12 +__hread@12 +__hwrite@12 +__hwrite@12 +__lclose@4 +__lclose@4 +__lcreat@8 +__lcreat@8 +__llseek@12 +__llseek@12 +__lopen@8 +__lopen@8 +__lread@12 +__lread@12 +__lwrite@12 +__lwrite@12 +_lstrcat@8 +_lstrcat@8 +_lstrcatA@8 +_lstrcatA@8 +_lstrcatW@8 +_lstrcatW@8 +_lstrcmp@8 +_lstrcmp@8 +_lstrcmpA@8 +_lstrcmpA@8 +_lstrcmpW@8 +_lstrcmpW@8 +_lstrcmpi@8 +_lstrcmpi@8 +_lstrcmpiA@8 +_lstrcmpiA@8 +_lstrcmpiW@8 +_lstrcmpiW@8 +_lstrcpy@8 +_lstrcpy@8 +_lstrcpyA@8 +_lstrcpyA@8 +_lstrcpyW@8 +_lstrcpyW@8 +_lstrcpyn@12 +_lstrcpyn@12 +_lstrcpynA@12 +_lstrcpynA@12 +_lstrcpynW@12 +_lstrcpynW@12 +_lstrlen@4 +_lstrlen@4 +_lstrlenA@4 +_lstrlenA@4 +_lstrlenW@4 +_lstrlenW@4 diff --git a/src/lib/kStuff/kProfiler2/kPrfReader.h b/src/lib/kStuff/kProfiler2/kPrfReader.h new file mode 100644 index 0000000..0cb1683 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kPrfReader.h @@ -0,0 +1,45 @@ +
+
+#include <string>
+
+typedef
+
+/**
+ * Debug info cache.
+ *
+ * An objects of this class acts a frontend to the low-level
+ * debug info readers.
+ */
+class kPrfDebugInfoCache
+{
+public:
+ kPrfDebugInfoCache(unsigned cMaxModules = ~0U);
+ ~kPrfDebugInfoCache();
+
+ /** Resolves a symbol in a specific module. */
+ int findSymbol();
+ int findLine();
+};
+
+/**
+ * Internal class which does the reader job behind the API / commandline tool.
+ */
+class kPrfReader
+{
+public:
+ kPrfReader(const char *pszDataSetPath);
+ ~kPrfReader();
+
+ /** Analyses the data set. */
+ int analyse(int fSomeOptionsIHaventFiguredOutYet);
+
+ /** Writes the analysis report as HTML. */
+ int reportAsHtml(FILE *pOut);
+
+ /** Dumps the data set in a raw fashion to the specified file stream. */
+ int dump(FILE *pOut);
+
+protected:
+ /** Pointer to the debug info cache object. */
+ kPrfDebugInfoCache *pDbgCache;
+};
diff --git a/src/lib/kStuff/kProfiler2/kProfileR3.cpp b/src/lib/kStuff/kProfiler2/kProfileR3.cpp new file mode 100644 index 0000000..9e19ee6 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kProfileR3.cpp @@ -0,0 +1,1666 @@ +/* $Id: kProfileR3.cpp 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - The Ring-3 Implementation. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/******************************************************************************* +* Header Files * +*******************************************************************************/ +#include <k/kDefs.h> +#if K_OS == K_OS_WINDOWS +# include <windows.h> +# include <psapi.h> +# include <malloc.h> +# if _MSC_VER >= 1400 +# include <intrin.h> +# define HAVE_INTRIN +# endif + +#elif K_OS == K_OS_LINUX || K_OS == K_OS_FREEBSD +# define KPRF_USE_PTHREAD +# include <pthread.h> +# include <stdint.h> +# define KPRF_USE_MMAN +# include <sys/mman.h> +# include <sys/fcntl.h> +# include <unistd.h> +# include <stdlib.h> +# ifndef O_BINARY +# define O_BINARY 0 +# endif + +#elif K_OS == K_OS_OS2 +# define INCL_BASE +# include <os2.h> +# include <stdint.h> +# include <sys/fmutex.h> + +#else +# error "not ported to this OS..." +#endif + +#include <k/kDefs.h> +#include <k/kTypes.h> + +/* + * Instantiate the header. + */ +#define KPRF_NAME(Suffix) KPrf##Suffix +#define KPRF_TYPE(Prefix,Suffix) Prefix##KPRF##Suffix +#if K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 +# define KPRF_DECL_FUNC(type, name) extern "C" __declspec(dllexport) type __cdecl KPRF_NAME(name) +#else +# define KPRF_DECL_FUNC(type, name) extern "C" type KPRF_NAME(name) +#endif +#if 1 +# ifdef __GNUC__ +# define KPRF_ASSERT(expr) do { if (!(expr)) { __asm__ __volatile__("int3\n\tnop\n\t");} } while (0) +# else +# define KPRF_ASSERT(expr) do { if (!(expr)) { __debugbreak(); } } while (0) +# endif +#else +# define KPRF_ASSERT(expr) do { } while (0) +#endif + +#include "prfcore.h.h" + + + +/******************************************************************************* +* Structures and Typedefs * +*******************************************************************************/ +/** Mutex lock type. */ +#if defined(KPRF_USE_PTHREAD) +typedef pthread_mutex_t KPRF_TYPE(,MUTEX); +#elif K_OS == K_OS_WINDOWS +typedef CRITICAL_SECTION KPRF_TYPE(,MUTEX); +#elif K_OS == K_OS_OS2 +typedef struct _fmutex KPRF_TYPE(,MUTEX); +#endif +/** Pointer to a mutex lock. */ +typedef KPRF_TYPE(,MUTEX) *KPRF_TYPE(P,MUTEX); + + +#if defined(KPRF_USE_PTHREAD) +/** Read/Write lock type. */ +typedef pthread_rwlock_t KPRF_TYPE(,RWLOCK); +#elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 +/** Read/Write lock state. */ +typedef enum KPRF_TYPE(,RWLOCKSTATE) +{ + RWLOCK_STATE_UNINITIALIZED = 0, + RWLOCK_STATE_SHARED, + RWLOCK_STATE_LOCKING, + RWLOCK_STATE_EXCLUSIVE, + RWLOCK_STATE_32BIT_HACK = 0x7fffffff +} KPRF_TYPE(,RWLOCKSTATE); +/** Update the state. */ +#define KPRF_RWLOCK_SETSTATE(pRWLock, enmNewState) \ + kPrfAtomicSet32((volatile KU32 *)&(pRWLock)->enmState, (KU32)(enmNewState)) + +/** Read/Write lock type. */ +typedef struct KPRF_TYPE(,RWLOCK) +{ + /** This mutex serialize the access and updating of the members + * of this structure. */ + KPRF_TYPE(,MUTEX) Mutex; + /** The current number of readers. */ + KU32 cReaders; + /** The number of readers waiting. */ + KU32 cReadersWaiting; + /** The current number of waiting writers. */ + KU32 cWritersWaiting; +# if K_OS == K_OS_WINDOWS + /** The handle of the event object on which the waiting readers block. (manual reset). */ + HANDLE hevReaders; + /** The handle of the event object on which the waiting writers block. (manual reset). */ + HANDLE hevWriters; +# elif K_OS == K_OS_OS2 + /** The handle of the event semaphore on which the waiting readers block. */ + HEV hevReaders; + /** The handle of the event semaphore on which the waiting writers block. */ + HEV hevWriters; +# endif + /** The current state of the read-write lock. */ + KPRF_TYPE(,RWLOCKSTATE) enmState; +} KPRF_TYPE(,RWLOCK); +#endif +/** Pointer to a Read/Write lock. */ +typedef KPRF_TYPE(,RWLOCK) *KPRF_TYPE(P,RWLOCK); + + + +/******************************************************************************* +* Global Variables * +*******************************************************************************/ +/** The TLS index / key. */ +#if K_OS == K_OS_WINDOWS +static DWORD g_dwThreadTLS = TLS_OUT_OF_INDEXES; + +#elif defined(KPRF_USE_PTHREAD) +static pthread_key_t g_ThreadKey = (pthread_key_t)-1; + +#elif K_OS == K_OS_OS2 +static KPRF_TYPE(P,THREAD) *g_ppThread = NULL; + +#else +# error "Not ported to your OS - or you're missing the OS define(s)." +#endif + +/** Pointer to the profiler header. */ +static KPRF_TYPE(P,HDR) g_pHdr = NULL; +#define KPRF_GET_HDR() g_pHdr + +/** Whether the profiler is enabled or not. */ +static bool g_fEnabled = false; +#define KPRF_IS_ACTIVE() g_fEnabled + + +/** The mutex protecting the threads in g_pHdr. */ +static KPRF_TYPE(,MUTEX) g_ThreadsMutex; + +/** The mutex protecting the module segments in g_pHdr. */ +static KPRF_TYPE(,MUTEX) g_ModSegsMutex; + +/** The read-write lock protecting the functions in g_pHdr. */ +static KPRF_TYPE(,RWLOCK) g_FunctionsRWLock; + + + +/******************************************************************************* +* Internal Functions * +*******************************************************************************/ +static KPRF_TYPE(P,THREAD) kPrfGetThreadAutoReg(void); +#ifdef KPRF_USE_PTHREAD +static void kPrfPThreadKeyDtor(void *pvThread); +#endif + + +/** + * Gets the pointer to the profiler data for the current thread. + * + * This implementation automatically adds unknown threads. + * + * @returns Pointer to the profiler thread data. + * @returns NULL if we're out of thread space. + */ +static inline KPRF_TYPE(P,THREAD) kPrfGetThread(void) +{ + KPRF_TYPE(P,THREAD) pThread; + +/* Win32/64 */ +#if K_OS == K_OS_WINDOWS + pThread = (KPRF_TYPE(P,THREAD))TlsGetValue(g_dwThreadTLS); + +/* Posix Threads */ +#elif defined(KPRF_USE_PTHREAD) + pThread = (KPRF_TYPE(P,THREAD))pthread_getspecific(g_ThreadKey); + +#elif K_OS == K_OS_OS2 + pThread = *g_ppThread; + +#else +# error not implemented +#endif + if (!pThread) + pThread = kPrfGetThreadAutoReg(); + return pThread; +} +#define KPRF_GET_THREAD() kPrfGetThread() + + +/** + * The the ID of the current thread. + * + * @returns The thread id. + */ +static inline KUPTR kPrfGetThreadId(void) +{ +/* Win32/64 */ +#if K_OS == K_OS_WINDOWS + KUPTR ThreadId = (KUPTR)GetCurrentThreadId(); + +/* Posix Threads */ +#elif defined(KPRF_USE_PTHREAD) + KUPTR ThreadId = (KUPTR)pthread_self(); + +#elif K_OS == K_OS_OS2 + PTIB pTib; + PPIB pPib; + DosGetInfoBlocks(&pTib, &pPib); + ThreadId = pTib->tib_ptib2->tib2_ultid; + +#else +# error not implemented +#endif + + return ThreadId; +} +#define KPRF_GET_THREADID() kPrfGetThreadId() + + +/** + * The the ID of the current process. + * + * @returns The process id. + */ +static inline KUPTR kPrfGetProcessId(void) +{ +/* Win32/64 */ +#if K_OS == K_OS_WINDOWS + KUPTR ThreadId = (KUPTR)GetProcessId(GetCurrentProcess()); + +#elif K_OS == K_OS_OS2 + PTIB pTib; + PPIB pPib; + DosGetInfoBlocks(&pTib, &pPib); + ThreadId = pPib->pib_pid; + +#else + KUPTR ThreadId = (KUPTR)getpid(); +#endif + + return ThreadId; +} +#define KPRF_GET_PROCESSID() kPrfGetProcessId() + + +/** + * Sets the pointer to the profiler data for the current thread. + * + * We require fast access to the profiler thread data, so we store + * it in a TLS (thread local storage) item/key where the implementation + * allows that. + * + * @param pThread The pointer to the profiler thread data for the current thread. + */ +static inline void kPrfSetThread(KPRF_TYPE(P,THREAD) pThread) +{ +/* Win32/64 */ +#if K_OS == K_OS_WINDOWS + BOOL fRc = TlsSetValue(g_dwThreadTLS, pThread); + +/* Posix Threads */ +#elif defined(KPRF_USE_PTHREAD) + int rc = pthread_setspecific(g_ThreadKey, pThread); + +#elif K_OS == K_OS_OS2 + *g_ppThread = pThread; + +#else +# error not implemented +#endif +} +#define KPRF_SET_THREAD(pThread) kPrfSetThread(pThread) + + +/** + * Get the now timestamp. + * This must correspond to what the assembly code are doing. + */ +static inline KU64 kPrfNow(void) +{ +#if defined(HAVE_INTRIN) + return __rdtsc(); +# else + union + { + KU64 u64; + struct + { + KU32 u32Lo; + KU32 u32Hi; + } s; + } u; +# if defined(__GNUC__) + __asm__ __volatile__ ("rdtsc\n\t" : "=a" (u.s.u32Lo), "=d" (u.s.u32Hi)); +# else + __asm + { + rdtsc + mov [u.s.u32Lo], eax + mov [u.s.u32Hi], edx + } + +# endif + return u.u64; +#endif +} +#define KPRF_NOW() kPrfNow() + + +/** + * Atomically set a 32-bit value. + */ +static inline void kPrfAtomicSet32(volatile KU32 *pu32, const KU32 u32) +{ +#if defined(HAVE_INTRIN) + _InterlockedExchange((long volatile *)pu32, (const long)u32); + +#elif defined(__GNUC__) + __asm__ __volatile__("xchgl %0, %1\n\t" + : "=m" (*pu32) + : "r" (u32)); + +#elif _MSC_VER + __asm + { + mov edx, [pu32] + mov eax, [u32] + xchg [edx], eax + } + +#else + *pu32 = u32; +#endif +} +#define KPRF_ATOMIC_SET32(a,b) kPrfAtomicSet32(a, b) + + + +/** + * Atomically set a 64-bit value. + */ +static inline void kPrfAtomicSet64(volatile KU64 *pu64, KU64 u64) +{ +#if defined(HAVE_INTRIN) && KPRF_BITS == 64 + _InterlockedExchange64((KI64 *)pu64, (const KI64)u64); + +#elif defined(__GNUC__) && KPRF_BITS == 64 + __asm__ __volatile__("xchgq %0, %1\n\t" + : "=m" (*pu64) + : "r" (u64)); + +#elif defined(__GNUC__) && KPRF_BITS == 32 + __asm__ __volatile__("1:\n\t" + "lock; cmpxchg8b %1\n\t" + "jnz 1b\n\t" + : "=A" (u64), + "=m" (*pu64) + : "0" (*pu64), + "b" ( (KU32)u64 ), + "c" ( (KU32)(u64 >> 32) )); + +#elif _MSC_VER + __asm + { + mov ebx, dword ptr [u64] + mov ecx, dword ptr [u64 + 4] + mov esi, pu64 + mov eax, dword ptr [esi] + mov edx, dword ptr [esi + 4] + retry: + lock cmpxchg8b [esi] + jnz retry + } +#else + *pu64 = u64; +#endif +} +#define KPRF_ATOMIC_SET64(a,b) kPrfAtomicSet64(a, b) + + +/** + * Atomically add a 32-bit integer to another. + */ +static inline void kPrfAtomicAdd32(volatile KU32 *pu32, const KU32 u32) +{ +#if defined(HAVE_INTRIN) + _InterlockedExchangeAdd((volatile long *)pu32, (const long)u32); + +#elif defined(__GNUC__) + __asm__ __volatile__("lock; addl %0, %1\n\t" + : "=m" (*pu32) + : "r" (u32)); + +#elif _MSC_VER + __asm + { + mov edx, [pu32] + mov eax, dword ptr [u32] + lock add [edx], eax + } + +#else + *pu32 += u32; +#endif +} +#define KPRF_ATOMIC_ADD32(a,b) kPrfAtomicAdd32(a, b) +#define KPRF_ATOMIC_INC32(a) kPrfAtomicAdd32(a, 1); +#define KPRF_ATOMIC_DEC32(a) kPrfAtomicAdd32(a, (KU32)-1); + + +/** + * Atomically add a 64-bit integer to another. + * Atomically isn't quite required, just a non-corruptive manner, assuming all updates are adds. + */ +static inline void kPrfAtomicAdd64(volatile KU64 *pu64, const KU64 u64) +{ +#if defined(HAVE_INTRIN) && KPRF_BITS == 64 + _InterlockedExchangeAdd64((volatile KI64 *)pu64, (const KI64)u64); + +#elif defined(__GNUC__) && KPRF_BITS == 64 + __asm__ __volatile__("lock; addq %0, %1\n\t" + : "=m" (*pu64) + : "r" (u64)); + +#elif defined(__GNUC__) && KPRF_BITS == 32 + __asm__ __volatile__("lock; addl %0, %2\n\t" + "lock; adcl %1, %3\n\t" + : "=m" (*(volatile KU32 *)pu64), + "=m" (*((volatile KU32 *)pu64 + 1)) + : "r" ((KU32)u64), + "r" ((KU32)(u64 >> 32))); + +#elif _MSC_VER + __asm + { + mov edx, [pu64] + mov eax, dword ptr [u64] + mov ecx, dword ptr [u64 + 4] + lock add [edx], eax + lock adc [edx + 4], ecx + } + +#else + *pu64 += u64; +#endif +} +#define KPRF_ATOMIC_ADD64(a,b) kPrfAtomicAdd64(a, b) +#define KPRF_ATOMIC_INC64(a) kPrfAtomicAdd64(a, 1); + + +/** + * Initializes a mutex. + * + * @returns 0 on success. + * @returns -1 on failure. + * @param pMutex The mutex to init. + */ +static int kPrfMutexInit(KPRF_TYPE(P,MUTEX) pMutex) +{ +#if defined(KPRF_USE_PTHREAD) + if (!pthread_mutex_init(pMutex, NULL)); + return 0; + return -1; + +#elif K_OS == K_OS_WINDOWS + InitializeCriticalSection(pMutex); + return 0; + +#elif K_OS == K_OS_OS2 + if (!_fmutex_create(pMutex, 0)) + return 0; + return -1; +#endif +} + +/** + * Deletes a mutex. + * + * @param pMutex The mutex to delete. + */ +static void kPrfMutexDelete(KPRF_TYPE(P,MUTEX) pMutex) +{ +#if defined(KPRF_USE_PTHREAD) + pthread_mutex_destroy(pMutex); + +#elif K_OS == K_OS_WINDOWS + DeleteCriticalSection(pMutex); + +#elif K_OS == K_OS_OS2 + _fmutex_close(pMutex); +#endif +} + +/** + * Locks a mutex. + * @param pMutex The mutex lock. + */ +static inline void kPrfMutexAcquire(KPRF_TYPE(P,MUTEX) pMutex) +{ +#if K_OS == K_OS_WINDOWS + EnterCriticalSection(pMutex); + +#elif defined(KPRF_USE_PTHREAD) + pthread_mutex_lock(pMutex); + +#elif K_OS == K_OS_OS2 + fmutex_request(pMutex); +#endif +} + + +/** + * Unlocks a mutex. + * @param pMutex The mutex lock. + */ +static inline void kPrfMutexRelease(KPRF_TYPE(P,MUTEX) pMutex) +{ +#if K_OS == K_OS_WINDOWS + LeaveCriticalSection(pMutex); + +#elif defined(KPRF_USE_PTHREAD) + pthread_mutex_lock(pMutex); + +#elif K_OS == K_OS_OS2 + fmutex_request(pMutex); +#endif +} + + +#define KPRF_THREADS_LOCK() kPrfMutexAcquire(&g_ThreadsMutex) +#define KPRF_THREADS_UNLOCK() kPrfMutexRelease(&g_ThreadsMutex) + +#define KPRF_MODSEGS_LOCK() kPrfMutexAcquire(&g_ModSegsMutex) +#define KPRF_MODSEGS_UNLOCK() kPrfMutexRelease(&g_ModSegsMutex) + + +/** + * Initializes a read-write lock. + * + * @returns 0 on success. + * @returns -1 on failure. + * @param pRWLock The read-write lock to initialize. + */ +static inline int kPrfRWLockInit(KPRF_TYPE(P,RWLOCK) pRWLock) +{ +#if defined(KPRF_USE_PTHREAD) + if (!pthread_rwlock_init(pRWLock, NULL)) + return 0; + return -1; + +#elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 + if (kPrfMutexInit(&pRWLock->Mutex)) + return -1; + pRWLock->cReaders = 0; + pRWLock->cReadersWaiting = 0; + pRWLock->cWritersWaiting = 0; + pRWLock->enmState = RWLOCK_STATE_SHARED; +# if K_OS == K_OS_WINDOWS + pRWLock->hevReaders = CreateEvent(NULL, TRUE, TRUE, NULL); + pRWLock->hevWriters = CreateEvent(NULL, FALSE, FALSE, NULL); + if ( pRWLock->hevReaders != INVALID_HANDLE_VALUE + && pRWLock->hevWriters != INVALID_HANDLE_VALUE) + return 0; + CloseHandle(pRWLock->hevReaders); + CloseHandle(pRWLock->hevWriters); + +# elif K_OS == K_OS_OS2 + APIRET rc = DosCreateEventSem(NULL, &pRWLock->hevReaders, 0, TRUE); + if (!rc) + { + rc = DosCreateEventSem(NULL, &pRWLock->hevWriters, 0, TRUE); + if (!rc) + return 0; + pRWLock->hevWriters = NULLHANDLE; + DosCloseEventSem(pRWLock->hevReaders); + } + pRWLock->hevReaders = NULLHANDLE; +# endif + + pRWLock->enmState = RWLOCK_STATE_UNINITIALIZED; + kPrfMutexDelete(&pRWLock->Mutex); + return -1; +#endif +} + + +/** + * Deleters a read-write lock. + * + * @param pRWLock The read-write lock to delete. + */ +static inline void kPrfRWLockDelete(KPRF_TYPE(P,RWLOCK) pRWLock) +{ +#if defined(KPRF_USE_PTHREAD) + pthread_rwlock_destroy(pRWLock); + +#elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 + if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) + return; + + pRWLock->enmState = RWLOCK_STATE_UNINITIALIZED; + kPrfMutexDelete(&pRWLock->Mutex); + pRWLock->cReaders = 0; + pRWLock->cReadersWaiting = 0; + pRWLock->cWritersWaiting = 0; +# if K_OS == K_OS_WINDOWS + CloseHandle(pRWLock->hevReaders); + pRWLock->hevReaders = INVALID_HANDLE_VALUE; + CloseHandle(pRWLock->hevWriters); + pRWLock->hevWriters = INVALID_HANDLE_VALUE; + +# elif K_OS == K_OS_OS2 + DosCloseEventSem(pRWLock->hevReaders); + pRWLock->hevReaders = NULLHANDLE; + DosCloseEventSem(pRWLock->hevWriters); + pRWLock->hevWriters = NULLHANDLE; +# endif +#endif +} + + +/** + * Acquires read access to the read-write lock. + * @param pRWLock The read-write lock. + */ +static inline void kPrfRWLockAcquireRead(KPRF_TYPE(P,RWLOCK) pRWLock) +{ +#if defined(KPRF_USE_PTHREAD) + pthread_rwlock_rdlock(pRWLock); + +#elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 + if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) + return; + + kPrfMutexAcquire(&pRWLock->Mutex); + if (pRWLock->enmState == RWLOCK_STATE_SHARED) + { + KPRF_ATOMIC_INC32(&pRWLock->cReaders); + kPrfMutexRelease(&pRWLock->Mutex); + return; + } + + for (;;) + { + /* have to wait */ + KPRF_ATOMIC_INC32(&pRWLock->cReadersWaiting); +# if K_OS == K_OS_WINDOWS + HANDLE hev = pRWLock->hevReaders; + ResetEvent(hev); + +# elif K_OS == K_OS_OS2 + HEV hev = pRWLock->hevReaders; + ULONG cIgnored; + DosResetEventSem(hev, &cIgnored); + +# endif + kPrfMutexRelease(&pRWLock->Mutex); + +# if K_OS == K_OS_WINDOWS + switch (WaitForSingleObject(hev, INFINITE)) + { + case WAIT_IO_COMPLETION: + case WAIT_TIMEOUT: + case WAIT_OBJECT_0: + break; + case WAIT_ABANDONED: + default: + return; + } + +# elif K_OS == K_OS_OS2 + switch (DosWaitEventSem(hev, SEM_INDEFINITE_WAIT)) + { + case NO_ERROR: + case ERROR_SEM_TIMEOUT: + case ERROR_TIMEOUT: + case ERROR_INTERRUPT: + break; + default: + return; + } +# endif + + kPrfMutexAcquire(&pRWLock->Mutex); + if (pRWLock->enmState == RWLOCK_STATE_SHARED) + { + KPRF_ATOMIC_INC32(&pRWLock->cReaders); + KPRF_ATOMIC_DEC32(&pRWLock->cReadersWaiting); + kPrfMutexRelease(&pRWLock->Mutex); + return; + } + } +#endif +} + + +/** + * Releases read access to the read-write lock. + * @param pRWLock The read-write lock. + */ +static inline void kPrfRWLockReleaseRead(KPRF_TYPE(P,RWLOCK) pRWLock) +{ +#if defined(KPRF_USE_PTHREAD) + pthread_rwlock_unlock(pRWLock); + +#elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 + if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) + return; + + /* + * If we're still in the shared state, or if there + * are more readers out there, or if there are no + * waiting writers, all we have to do is decrement an leave. + * + * That's the most frequent, thing and should be fast. + */ + kPrfMutexAcquire(&pRWLock->Mutex); + KPRF_ATOMIC_DEC32(&pRWLock->cReaders); + if ( pRWLock->enmState == RWLOCK_STATE_SHARED + || pRWLock->cReaders + || !pRWLock->cWritersWaiting) + { + kPrfMutexRelease(&pRWLock->Mutex); + return; + } + + /* + * Wake up one (or more on OS/2) waiting writers. + */ +# if K_OS == K_OS_WINDOWS + SetEvent(pRWLock->hevWriters); +# elif K_OS == K_OS_OS2 + DosPostEvent(pRWLock->hevwriters); +# endif + kPrfMutexRelease(&pRWLock->Mutex); + +#endif +} + + +/** + * Acquires write access to the read-write lock. + * @param pRWLock The read-write lock. + */ +static inline void kPrfRWLockAcquireWrite(KPRF_TYPE(P,RWLOCK) pRWLock) +{ +#if defined(KPRF_USE_PTHREAD) + pthread_rwlock_wrlock(pRWLock); + +#elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 + if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) + return; + + kPrfMutexAcquire(&pRWLock->Mutex); + if ( !pRWLock->cReaders + && ( pRWLock->enmState == RWLOCK_STATE_SHARED + || pRWLock->enmState == RWLOCK_STATE_LOCKING) + ) + { + KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_EXCLUSIVE); + kPrfMutexRelease(&pRWLock->Mutex); + return; + } + + /* + * We'll have to wait. + */ + if (pRWLock->enmState == RWLOCK_STATE_SHARED) + KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_LOCKING); + KPRF_ATOMIC_INC32(&pRWLock->cWritersWaiting); + for (;;) + { +# if K_OS == K_OS_WINDOWS + HANDLE hev = pRWLock->hevWriters; +# elif K_OS == K_OS_OS2 + HEV hev = pRWLock->hevWriters; +# endif + kPrfMutexRelease(&pRWLock->Mutex); +# if K_OS == K_OS_WINDOWS + switch (WaitForSingleObject(hev, INFINITE)) + { + case WAIT_IO_COMPLETION: + case WAIT_TIMEOUT: + case WAIT_OBJECT_0: + break; + case WAIT_ABANDONED: + default: + KPRF_ATOMIC_DEC32(&pRWLock->cWritersWaiting); + return; + } + +# elif K_OS == K_OS_OS2 + switch (DosWaitEventSem(hev, SEM_INDEFINITE_WAIT)) + { + case NO_ERROR: + case ERROR_SEM_TIMEOUT: + case ERROR_TIMEOUT: + case ERROR_INTERRUPT: + break; + default: + KPRF_ATOMIC_DEC32(&pRWLock->cWritersWaiting); + return; + } + ULONG cIgnored; + DosResetEventSem(hev, &cIgnored); +# endif + + /* + * Try acquire the lock. + */ + kPrfMutexAcquire(&pRWLock->Mutex); + if ( !pRWLock->cReaders + && ( pRWLock->enmState == RWLOCK_STATE_SHARED + || pRWLock->enmState == RWLOCK_STATE_LOCKING) + ) + { + KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_EXCLUSIVE); + KPRF_ATOMIC_DEC32(&pRWLock->cWritersWaiting); + kPrfMutexRelease(&pRWLock->Mutex); + return; + } + } +#endif +} + + +/** + * Releases write access to the read-write lock. + * @param pRWLock The read-write lock. + */ +static inline void kPrfRWLockReleaseWrite(KPRF_TYPE(P,RWLOCK) pRWLock) +{ +#if defined(KPRF_USE_PTHREAD) + pthread_rwlock_unlock(pRWLock); + +#elif K_OS == K_OS_WINDOWS || K_OS == K_OS_OS2 + if (pRWLock->enmState == RWLOCK_STATE_UNINITIALIZED) + return; + + /* + * The common thing is that there are noone waiting. + * But, before that usual paranoia. + */ + kPrfMutexAcquire(&pRWLock->Mutex); + if (pRWLock->enmState != RWLOCK_STATE_EXCLUSIVE) + { + kPrfMutexRelease(&pRWLock->Mutex); + return; + } + if ( !pRWLock->cReadersWaiting + && !pRWLock->cWritersWaiting) + { + KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_SHARED); + kPrfMutexRelease(&pRWLock->Mutex); + return; + } + + /* + * Someone is waiting, wake them up as we change the state. + */ +# if K_OS == K_OS_WINDOWS + HANDLE hev = INVALID_HANDLE_VALUE; +# elif K_OS == K_OS_OS2 + HEV hev = NULLHANDLE; +# endif + + if (pRWLock->cWritersWaiting) + { + KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_LOCKING); + hev = pRWLock->hevWriters; + } + else + { + KPRF_RWLOCK_SETSTATE(pRWLock, RWLOCK_STATE_SHARED); + hev = pRWLock->hevReaders; + } +# if K_OS == K_OS_WINDOWS + SetEvent(hev); +# elif K_OS == K_OS_OS2 + DosPostEvent(pRWLock->hevwriters); +# endif + kPrfMutexRelease(&pRWLock->Mutex); + +#endif +} + +#define KPRF_FUNCS_WRITE_LOCK() kPrfRWLockAcquireWrite(&g_FunctionsRWLock) +#define KPRF_FUNCS_WRITE_UNLOCK() kPrfRWLockReleaseWrite(&g_FunctionsRWLock) +#define KPRF_FUNCS_READ_LOCK() kPrfRWLockAcquireRead(&g_FunctionsRWLock) +#define KPRF_FUNCS_READ_UNLOCK() kPrfRWLockReleaseRead(&g_FunctionsRWLock) + + + + +/** + * Finds the module segment which the address belongs to. + * + */ +static int kPrfGetModSeg(KPRF_TYPE(,UPTR) uAddress, char *pszPath, KU32 cchPath, KU32 *piSegment, + KPRF_TYPE(P,UPTR) puBasePtr, KPRF_TYPE(P,UPTR) pcbSegmentMinusOne) +{ +#if K_OS == K_OS_WINDOWS + /* + * Enumerate the module handles. + */ + HANDLE hProcess = GetCurrentProcess(); + DWORD cbNeeded = 0; + HMODULE hModIgnored; + if ( !EnumProcessModules(hProcess, &hModIgnored, sizeof(hModIgnored), &cbNeeded) + && GetLastError() != ERROR_BUFFER_OVERFLOW) /** figure out what this actually returns */ + cbNeeded = 256 * sizeof(HMODULE); + + cbNeeded += sizeof(HMODULE) * 32; + HMODULE *pahModules = (HMODULE *)alloca(cbNeeded); + if (EnumProcessModules(hProcess, pahModules, cbNeeded, &cbNeeded)) + { + const unsigned cModules = cbNeeded / sizeof(HMODULE); + for (unsigned i = 0; i < cModules; i++) + { + __try + { + const KUPTR uImageBase = (KUPTR)pahModules[i]; + union + { + KU8 *pu8; + PIMAGE_DOS_HEADER pDos; + PIMAGE_NT_HEADERS pNt; + PIMAGE_NT_HEADERS32 pNt32; + PIMAGE_NT_HEADERS64 pNt64; + KUPTR u; + } u; + u.u = uImageBase; + + /* reject modules higher than the address. */ + if (uAddress < u.u) + continue; + + /* Skip past the MZ header */ + if (u.pDos->e_magic == IMAGE_DOS_SIGNATURE) + u.pu8 += u.pDos->e_lfanew; + + /* Ignore anything which isn't an NT header. */ + if (u.pNt->Signature != IMAGE_NT_SIGNATURE) + continue; + + /* Extract necessary info from the optional header (comes in 32-bit and 64-bit variations, we simplify a bit). */ + KU32 cbImage; + PIMAGE_SECTION_HEADER paSHs; + if (u.pNt->FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER32)) + { + paSHs = (PIMAGE_SECTION_HEADER)(u.pNt32 + 1); + cbImage = u.pNt32->OptionalHeader.SizeOfImage; + } + else if (u.pNt->FileHeader.SizeOfOptionalHeader == sizeof(IMAGE_OPTIONAL_HEADER64)) + { + paSHs = (PIMAGE_SECTION_HEADER)(u.pNt64 + 1); + cbImage = u.pNt64->OptionalHeader.SizeOfImage; + } + else + continue; + + /* Is our address within the image size */ + KUPTR uRVA = uAddress - (KUPTR)pahModules[i]; + if (uRVA >= cbImage) + continue; + + /* + * Iterate the section headers and figure which section we're in. + * (segment == section + 1) + */ + const KU32 cSHs = u.pNt->FileHeader.NumberOfSections; + if (uRVA < paSHs[0].VirtualAddress) + { + /* the implicit header section */ + *puBasePtr = uImageBase; + *pcbSegmentMinusOne = paSHs[0].VirtualAddress - 1; + *piSegment = 0; + } + else + { + KU32 iSH = 0; + for (;;) + { + if (iSH >= cSHs) + { + /* this shouldn't happen, but in case it does simply deal with it. */ + *puBasePtr = paSHs[iSH - 1].VirtualAddress + paSHs[iSH - 1].Misc.VirtualSize + uImageBase; + *pcbSegmentMinusOne = cbImage - *puBasePtr; + *piSegment = iSH + 1; + break; + } + if (uRVA - paSHs[iSH].VirtualAddress < paSHs[iSH].Misc.VirtualSize) + { + *puBasePtr = paSHs[iSH].VirtualAddress + uImageBase; + *pcbSegmentMinusOne = paSHs[iSH].Misc.VirtualSize; + *piSegment = iSH + 1; + break; + } + iSH++; + } + } + + /* + * Finally, get the module name. + * There are multiple ways, try them all before giving up. + */ + if ( !GetModuleFileNameEx(hProcess, pahModules[i], pszPath, cchPath) + && !GetModuleFileName(pahModules[i], pszPath, cchPath) + && !GetMappedFileName(hProcess, (PVOID)uAddress, pszPath, cchPath) + && !GetModuleBaseName(hProcess, pahModules[i], pszPath, cchPath)) + *pszPath = '\0'; + return 0; + } + __except (EXCEPTION_EXECUTE_HANDLER) + { + } + } + } + +#elif K_OS == K_OS_OS2 + /* + * Just ask the loader. + */ + ULONG offObj = 0; + ULONG iObj = 0; + HMODULE hmod = NULLHANDLE; + APIRET rc = DosQueryModFromEIP(&hmod, &iObj, cchPath, pszPath, &offObj, uAddress); + if (!rc) + { + *piSegment = iObj; + *puBasePtr = uAddress - offObj; + *pcbSegmentMinusOne = KPRF_ALIGN(offObj, 0x1000) - 1; /* minimum size */ + + /* + * Query the page attributes starting at the current page. The query will not enter + * into the next object since PAG_BASE is requested. + */ + ULONG cb = ~0UL; + ULONG fFlags = ~0UL; + uAddress &= ~(KUPTR)0xfff; + rc = DosQueryMem((PVOID)(uAddress, &cb, &fFlags); + if (!rc) + { + *pcbSegmentMinusOne = (offObj & ~(KUPTR)0xfff) + KPRF_ALIGN(cb, 0x1000) - 1; + if ((fFlags & PAG_BASE) && cb <= 0x1000) /* don't quite remember if PAG_BASE returns one page or not */ + { + cb = ~0UL; + fFlags = ~0UL; + rc = DosQueryMem((PVOID)(uAddress + 0x1000), &cb, &fFlags); + if (!rc & !(fFlags & (PAG_BASE | PAG_FREE))) + *pcbSegmentMinusOne += KPRF_ALIGN(cb, 0x1000); + } + } + return 0; + } + +#endif + /* The common fallback */ + *pszPath = '\0'; + *piSegment = 0; + *puBasePtr = 0; + *pcbSegmentMinusOne = ~(KPRF_TYPE(,UPTR))0; + return -1; +} +#define KPRF_GET_MODSEG(uAddress, pszPath, cchPath, piSegment, puBasePtr, pcbSegmentMinusOne) \ + kPrfGetModSeg(uAddress, pszPath, cchPath, piSegment, puBasePtr, pcbSegmentMinusOne) + + + + +/* + * Instantiate the implementation + */ +#include "prfcorepre.cpp.h" + +#include "prfcoremodseg.cpp.h" +#include "prfcorefunction.cpp.h" +#include "prfcore.cpp.h" +#include "prfcoreinit.cpp.h" +#include "prfcoreterm.cpp.h" + +#include "prfcorepost.cpp.h" + + + + + +/** + * Registers an unknown thread. + * + * @returns Pointer to the registered thread. + */ +static KPRF_TYPE(P,THREAD) kPrfGetThreadAutoReg(void) +{ + KUPTR uStackBasePtr; + +#if 0 + /** @todo I'm sure Win32 has a way of obtaining the top and bottom of the stack, OS/2 did... + * Some limit stuff in posix / ansi also comes to mind... */ + +#elif K_OS == K_OS_OS2 + PTIB pTib; + PPIB pPib; + DosGetInfoBlocks(&pTib, &pPib); /* never fails except if you give it bad input, thus 'Get' not 'Query'. */ + /* I never recall which of these is the right one... */ + uStackBasePtr = (KUPTR)pTib->tib_pstack < (KUPTR)pTib->tib_pstack_limit + ? (KUPTR)pTib->tib_pstack + : (KUPTR)pTib->tib_pstack_limit; + +#else + /* the default is top of the current stack page (assuming a page to be 4KB) */ + uStackBasePtr = (KUPTR)&uStackBasePtr; + uStackBasePtr = (uStackBasePtr + 0xfff) & ~(KUPTR)0xfff; +#endif + + return KPRF_NAME(RegisterThread)(uStackBasePtr, ""); +} + + +/** + * Get a env.var. variable. + * + * @returns pszValue. + * @param pszVar The variable name. + * @param pszValue Where to store the value. + * @param cchValue The size of the value buffer. + * @param pszDefault The default value. + */ +static char *kPrfGetEnvString(const char *pszVar, char *pszValue, KU32 cchValue, const char *pszDefault) +{ +#if K_OS == K_OS_WINDOWS + if (GetEnvironmentVariable(pszVar, pszValue, cchValue)) + return pszValue; + +#elif K_OS == K_OS_OS2 + PSZ pszValue; + if ( !DosScanEnv((PCSZ)pszVar, &pszValue) + && !*pszValue) + pszDefault = pszValue; + +#else + const char *pszTmp = getenv(pszVar); + if (pszTmp) + pszDefault = pszTmp; + +#endif + + /* + * Copy the result into the buffer. + */ + char *psz = pszValue; + while (*pszDefault && cchValue-- > 1) + *psz++ = *pszDefault++; + *psz = '\0'; + + return pszValue; +} + + +/** + * The the value of an env.var. + * + * @returns The value of the env.var. + * @returns The default if the value was not found. + * @param pszVar The variable name. + * @param uDefault The default value. + */ +static KU32 kPrfGetEnvValue(const char *pszVar, KU32 uDefault) +{ +#if K_OS == K_OS_WINDOWS + char szBuf[128]; + const char *pszValue = szBuf; + if (!GetEnvironmentVariable(pszVar, szBuf, sizeof(szBuf))) + pszValue = NULL; + +#elif K_OS == K_OS_OS2 + PSZ pszValue; + if (DosScanEnv((PCSZ)pszVar, &pszValue)) + pszValue = NULL; + +#else + const char *pszValue = getenv(pszVar); + +#endif + + /* + * Discard the obvious stuff. + */ + if (!pszValue) + return uDefault; + while (*pszValue == ' ' || *pszValue == '\t') + pszValue++; + if (!*pszValue) + return uDefault; + + /* + * Interpret the value. + */ + unsigned uBase = 10; + KU32 uValue = 0; + const char *psz = pszValue; + + /* prefix - only hex */ + if (*psz == '0' && (psz[1] == 'x' || psz[1] == 'X')) + { + uBase = 16; + psz += 2; + } + + /* read the value */ + while (*psz) + { + unsigned char ch = (unsigned char)*psz; + if (ch >= '0' && ch <= '9') + ch -= '0'; + else if ( uBase > 10 + && ch >= 'a' && ch <= 'f') + ch -= 'a' + 10; + else if ( uBase > 10 + && ch >= 'a' && ch <= 'F') + ch -= 'a' + 10; + else + break; + uValue *= uBase; + uValue += ch; + psz++; + } + + /* postfixes */ + switch (*psz) + { + case 'm': + case 'M': + uValue *= 1024*1024; + break; + + case 'k': + case 'K': + uValue *= 1024; + break; + } + + /* + * If the value is still 0, we return the default. + */ + return uValue ? uValue : uDefault; +} + + +/** + * Allocates memory. + * + * @returns Pointer to the allocated memory. + * @returns NULL on failure. + * @param cb The amount of memory (in bytes) to allocate. + */ +static void *kPrfAllocMem(KU32 cb) +{ +#if K_OS == K_OS_WINDOWS + void *pv = VirtualAlloc(NULL, cb, MEM_COMMIT, PAGE_EXECUTE_READWRITE); + +#elif defined(KPRF_USE_MMAN) + void *pv = mmap(NULL, cb, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + +#elif K_OS == K_OS_OS2 + void *pv; +# ifdef INCL_DOSEXAPIS + if (DosAllocMemEx(&pv, cb, PAG_READ | PAG_WRITE | PAG_EXECUTE | PAG_COMMIT | OBJ_FORK))s +# else + if (DosAllocMem(&pv, cb, PAG_READ | PAG_WRITE | PAG_EXECUTE | PAG_COMMIT)) +# endif + pvBuf = NULL; + +#else +# error not implemented +#endif + return pv; +} + + +/** + * Frees memory. + * + * @param pv The memory to free. + */ +static void kPrfFreeMem(void *pv) +{ +#if K_OS == K_OS_WINDOWS + VirtualFree(pv, 0, MEM_RELEASE); + +#elif defined(KPRF_USE_MMAN) + munmap(pv, 0); /** @todo check if 0 is allowed here.. */ + +#elif K_OS == K_OS_OS2 +# ifdef INCL_DOSEXAPIS + DosFreeMemEx(&pv); +# else + DosFreeMem(&pv); +# endif + +#else +# error not implemented +#endif +} + + +/** + * Writes a data buffer to a new file. + * + * Any existing file will be overwritten. + * + * + * @returns 0 on success. + * @returns -1 on failure. + * + * @param pszName The name of the file. + * @param pvData The data to write. + * @param cbData The amount of data to write. + */ +static int kPrfWriteFile(const char *pszName, const void *pvData, KU32 cbData) +{ +#if K_OS == K_OS_WINDOWS + int rc = -1; + HANDLE hFile = CreateFile(pszName,GENERIC_WRITE, FILE_SHARE_READ, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, INVALID_HANDLE_VALUE); + if (hFile != INVALID_HANDLE_VALUE) + { + DWORD dwWritten; + if ( WriteFile(hFile, pvData, cbData, &dwWritten, NULL) + && dwWritten == cbData) + rc = 0; + CloseHandle(hFile); + } + return rc; + +#elif K_OS == K_OS_OS2 + HFILE hFile; + ULONG ulAction = 0; + APIRET rc = DosOpen(pszName, &hFile, &ulAction, cbData, FILE_NORMAL, + OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW, + OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE | OPEN_FLAGS_NOINHERIT | OPEN_FLAGS_SEQUENTIAL, + NULL); + if (!rc) + { + ULONG cbWritten; + rc = DosWrite(hFile, pvData, cbData, &cbWritten); + if (!rc && cbWritten != cbData) + rc = -1; + DosClose(hFile); + } + return rc ? -1 : 0; + +#else + int rc = -1; + int fd = open(pszName, O_WRONLY | O_CREAT | O_BINARY | O_TRUNC, 0666); + if (fd >= 0) + { + if (write(fd, pvData, cbData) == cbData) + rc = 0; + close(fd); + } + return rc; + +#endif +} + + + +/** + * Initializes and start the profiling. + * + * This should typically be called from some kind of module init + * function, so we can start profiling upon/before entering main(). + * + * @returns 0 on success + * @returns -1 on failure. + * + */ +int kPrfInitialize(void) +{ + /* + * Only initialize once. + */ + if (KPRF_GET_HDR()) + return 0; + + /* + * Initial suggestions. + */ + KU32 cbModSegs = kPrfGetEnvValue("KPRF2_CBMODSEGS", 128*1024); + KU32 cFunctions = kPrfGetEnvValue("KPRF2_CFUNCTIONS", 8192); + KU32 cThreads = kPrfGetEnvValue("KPRF2_CTHREADS", 256); + KU32 cStacks = kPrfGetEnvValue("KPRF2_CSTACKS", 48); + KU32 cFrames = kPrfGetEnvValue("KPRF2_CFRAMES", 448); + KU32 fAffinity = kPrfGetEnvValue("KPRF2_AFFINITY", 0); + + KU32 cb = KPRF_NAME(CalcSize)(cFunctions, cbModSegs, cThreads, cStacks, cFrames); + + /* + * Allocate and initialize the data set. + */ + void *pvBuf = kPrfAllocMem(cb); + if (!pvBuf) + return -1; + + KPRF_TYPE(P,HDR) pHdr = KPRF_NAME(Init)(pvBuf, cb, cFunctions, cbModSegs, cThreads, cStacks, cFrames); + if (pHdr) + { + /* + * Initialize semaphores. + */ + if (!kPrfMutexInit(&g_ThreadsMutex)) + { + if (!kPrfMutexInit(&g_ModSegsMutex)) + { + if (!kPrfRWLockInit(&g_FunctionsRWLock)) + { + /* + * Allocate the TLS entry. + */ +#if K_OS == K_OS_WINDOWS + g_dwThreadTLS = TlsAlloc(); + if (g_dwThreadTLS != TLS_OUT_OF_INDEXES) + +#elif defined(KPRF_USE_PTHREAD) + int rc = pthread_key_create(&g_ThreadKey, kPrfPThreadKeyDtor); + if (!rc) + +#elif K_OS == K_OS_OS2 + int rc = DosAllocThreadLocalMemory(sizeof(void *), (PULONG*)&g_ppThread); /** @todo check if this is a count or a size. */ + if (!rc) + +#endif + { + /* + * Apply the affinity mask, if specified. + */ + if (fAffinity) + { +#if K_OS == K_OS_WINDOWS + SetProcessAffinityMask(GetCurrentProcess(), fAffinity); +#endif + } + + g_pHdr = pHdr; + g_fEnabled = true; + return 0; + } + kPrfRWLockDelete(&g_FunctionsRWLock); + } + kPrfMutexDelete(&g_ModSegsMutex); + } + kPrfMutexDelete(&g_ThreadsMutex); + } + } + kPrfFreeMem(pvBuf); + return -1; +} + + +/** + * Stops, dumps, and terminates the profiling. + * + * This should typically be called from some kind of module destruction + * function, so we can profile parts of the termination sequence too. + * + * @returns 0 on success + * @returns -1 on failure. + * + */ +int kPrfTerminate(void) +{ + /* + * Stop the profiling. + * As a safety precaution, sleep a little bit to allow threads + * still at large inside profiler code some time to get out. + */ + g_fEnabled = false; + KPRF_TYPE(P,HDR) pHdr = g_pHdr; + g_pHdr = NULL; + if (!pHdr) + return -1; + +#if K_OS == K_OS_WINDOWS + Sleep(10); +#elif K_OS == K_OS_OS2 + DosSleep(10); +#else + usleep(10000); +#endif + + /* + * Unwind all active threads and so forth. + */ + KPRF_NAME(TerminateAll)(pHdr); + + /* + * Use the stack space to fill in process details. + */ +#if K_OS == K_OS_WINDOWS + /* all is one single string */ + const char *pszCommandLine = GetCommandLine(); + if (pszCommandLine) + KPRF_NAME(SetCommandLine)(pHdr, 1, &pszCommandLine); + +#elif K_OS == K_OS_OS2 || K_OS == K_OS_OS2 + PTIB pTib; + PPIB pPib; + DosGetInfoBlocks(&pTib, &pPib); + if (pPib->pib_pchcmd) + { + /* Tradition say that the commandline is made up of two zero terminate strings + * - first the executable name, then the arguments. Similar to what unix does, + * only completely mocked up because of the CMD.EXE tradition. + */ + const char *apszArgs[2]; + apszArgs[0] = pPib->pib_pchcmd; + apszArgs[1] = pPib->pib_pchcmd; + while (apszArgs[1][0]) + apszArgs[1]++; + apszArgs[1]++; + KPRF_NAME(SetCommandLine)(pHdr, 2, apszArgs); + } + +#else + /* linux can read /proc/self/something I guess. Don't know about the rest... */ + +#endif + + /* + * Write the file to disk. + */ + char szName[260 + 16]; + kPrfGetEnvString("KPRF2_FILE", szName, sizeof(szName) - 16, "kPrf2-"); + + /* append the process id */ + KUPTR pid = kPrfGetProcessId(); + char *psz = szName; + while (*psz) + psz++; + + static char s_szDigits[0x11] = "0123456789abcdef"; + KU32 uShift = KPRF_BITS - 4; + while ( uShift > 0 + && !(pid & (0xf << uShift))) + uShift -= 4; + *psz++ = s_szDigits[(pid >> uShift) & 0xf]; + while (uShift > 0) + { + uShift -= 4; + *psz++ = s_szDigits[(pid >> uShift) & 0xf]; + } + + /* .kPrf2 */ + *psz++ = '.'; + *psz++ = 'k'; + *psz++ = 'P'; + *psz++ = 'r'; + *psz++ = 'f'; + *psz++ = '2'; + *psz++ = '\0'; + + /* write the file. */ + int rc = kPrfWriteFile(szName, pHdr, pHdr->cb); + + /* + * Free resources. + */ + kPrfFreeMem(pHdr); +#if K_OS == K_OS_WINDOWS + TlsFree(g_dwThreadTLS); + g_dwThreadTLS = TLS_OUT_OF_INDEXES; + +#elif defined(KPRF_USE_PTHREAD) + pthread_key_delete(g_ThreadKey); + g_ThreadKey = (pthread_key_t)-1; + +#elif K_OS == K_OS_OS2 + DosFreeThreadLocalMemory((PULONG)g_ppThread); + g_ppThread = NULL; + +#else +# error "port me!" +#endif + + kPrfMutexDelete(&g_ThreadsMutex); + kPrfMutexDelete(&g_ModSegsMutex); + kPrfRWLockDelete(&g_FunctionsRWLock); + + return rc; +} + + +/** + * Terminate the current thread. + */ +void kPrfTerminateThread(void) +{ + KPRF_NAME(DeregisterThread)(); +} + + +#ifdef KPRF_USE_PTHREAD +/** + * TLS destructor. + */ +static void kPrfPThreadKeyDtor(void *pvThread) +{ + KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); + if (pHdr) + { + KPRF_TYPE(P,THREAD) pThread = (KPRF_TYPE(P,THREAD))pvThread; + pthread_setspecific(g_ThreadKey, pvThread); + KPRF_NAME(TerminateThread)(pHdr, pThread, KPRF_NOW()); + pthread_setspecific(g_ThreadKey, NULL); + } +} +#endif + diff --git a/src/lib/kStuff/kProfiler2/kProfileR3.h b/src/lib/kStuff/kProfiler2/kProfileR3.h new file mode 100644 index 0000000..87938c9 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/kProfileR3.h @@ -0,0 +1,39 @@ +/* $Id: kProfileR3.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - Internal header, Ring-3. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef ___kProfileR3_h___ +#define ___kProfileR3_h___ + +int kPrfInitialize(void); +int kPrfTerminate(void); +void kPrfTerminateThread(void); + +#endif + diff --git a/src/lib/kStuff/kProfiler2/prfamd64msc.asm b/src/lib/kStuff/kProfiler2/prfamd64msc.asm new file mode 100644 index 0000000..87079e2 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfamd64msc.asm @@ -0,0 +1,474 @@ +; $Id: prfamd64msc.asm 29 2009-07-01 20:30:29Z bird $; +;; @file +; kProfiler Mark 2 - Microsoft C/C++ Compiler Interaction, AMD64. +; + +; +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +; +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: +; +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. +; + +[section .data] +; +g_fCalibrated: + dd 0 +g_OverheadAdj: + dd 0 + +[section .text] + +extern KPRF_ENTER +extern KPRF_LEAVE + +global _penter +global _pexit + +;ifdef UNDEFINED +global common_return_path +global common_overhead +global common_no_overhead +global calibrate +global calib_inner_update_minimum +global calib_inner_next +global calib_outer_dec +global calib_outer_inc +global calib_done +global calib_nullproc +;endif + + +;; +; On x86 the call to this function has been observed to be put before +; creating the stack frame, as the very first instruction in the function. +; +; Thus the stack layout is as follows: +; 24 return address of the calling function. +; 20 our return address - the address of the calling function + 5. +; 1c eax +; 18 edx +; 14 eflags +; 10 ecx +; c tsc high - param 3 +; 8 tsc low +; 4 frame pointer - param 2 +; 0 function ptr - param 1 +; +; +align 16 +_penter: + ; save volatile register and get the time stamp. + push rax + push rdx + rdtsc + pushfq + push rcx + push r8 + push r9 + push r10 + push r11 + sub rsp, 28h ; rsp is unaligned at this point (8 pushes). + ; reserve 20h for spill, and 8 bytes for ts. + + ; setting up the enter call frame + mov r8d, edx + shl r8, 32 + or r8, rax ; param 3 - the timestamp + mov [rsp + 20h], r8 ; save the tsc for later use. + lea rdx, [rsp + 8*8 + 28h] ; Param 2 - default frame pointer + mov rcx, [rdx] ; Param 1 - The function address + + ; MSC seems to put the _penter both before and after the typical sub rsp, xxh + ; statement as if it cannot quite make up its mind. We'll try adjust for this + ; to make the unwinding a bit more accurate wrt to longjmp/throw. But since + ; there are also an uneven amount of push/pop around the _penter/_pexit we + ; can never really make a perfect job of it. sigh. + cmp word [rcx - 5 - 4], 08348h ; sub rsp, imm8 + jne .not_byte_sub + cmp byte [rcx - 5 - 2], 0ech + jne .not_byte_sub + movzx eax, byte [rcx - 5 - 1] ; imm8 + add rdx, rax + jmp .call_prf_enter +.not_byte_sub: + cmp word [rcx - 5 - 7], 08148h ; sub rsp, imm32 + jne .not_dword_sub + cmp byte [rcx - 5 - 5], 0ech + jne .not_dword_sub + mov eax, [rcx - 5 - 4] ; imm32 + add rdx, rax +; jmp .call_prf_enter +.not_dword_sub: +.call_prf_enter: + call KPRF_ENTER + jmp common_return_path + + +;; +; On x86 the call to this function has been observed to be put right before +; return instruction. This fact matters since since we have to calc the same +; stack address as in _penter. +; +; Thus the stack layout is as follows: +; 24 return address of the calling function. +; 20 our return address - the address of the calling function + 5. +; 1c eax +; 18 edx +; 14 eflags +; 10 ecx +; c tsc high - param 3 +; 8 tsc low +; 4 frame pointer - param 2 +; 0 function ptr - param 1 +; +; +align 16 +_pexit: + ; save volatile register and get the time stamp. + push rax + push rdx + rdtsc + pushfq + push rcx + push r8 + push r9 + push r10 + push r11 + sub rsp, 28h ; rsp is unaligned at this point (8 pushes). + ; reserve 20h for spill, and 8 bytes for ts. + + ; setting up the enter call frame + mov r8d, edx + shl r8, 32 + or r8, rax ; param 3 - the timestamp + mov [rsp + 20h], r8 ; save the tsc for later use. + lea rdx, [rsp + 8*8 + 28h] ; Param 2 - frame pointer. + mov rcx, [rdx] ; Param 1 - The function address + + ; MSC some times put the _pexit before the add rsp, xxh. To try match up with + ; any adjustments made in _penter, we'll try detect this. + cmp word [rcx], 08348h ; add rsp, imm8 + jne .not_byte_sub + cmp byte [rcx + 2], 0c4h + jne .not_byte_sub + movzx eax, byte [rcx + 3] ; imm8 + add rdx, rax + jmp .call_prf_leave +.not_byte_sub: + cmp word [rcx], 08148h ; add rsp, imm32 + jne .not_dword_sub + cmp byte [rcx + 2], 0c4h + jne .not_dword_sub + mov eax, [rcx + 3] ; imm32 + add rdx, rax +; jmp .call_prf_leave +.not_dword_sub: +.call_prf_leave: + call KPRF_LEAVE + jmp common_return_path + + +;; +; This is the common return path for both the enter and exit hooks. +; It's kept common because we can then use the same overhead adjustment +; and save some calibration efforts. It also saves space :-) +align 16 +common_return_path: + ; Update overhead + test rax, rax + jz common_no_overhead + cmp byte [g_fCalibrated wrt rip], 0 + jnz common_overhead + call calibrate +common_overhead: + mov rcx, rax ; rcx <- pointer to overhead counter. + mov eax, [g_OverheadAdj wrt rip]; apply the adjustment before reading tsc + sub [rsp + 20h], rax + + rdtsc + shl rdx, 32 + or rdx, rax ; rdx = 64-bit timestamp + sub rdx, [rsp + 20h] ; rdx = elapsed + lock add [rcx], rdx ; update counter. +common_no_overhead: + + ; restore volatile registers. + add rsp, 28h + pop r11 + pop r10 + pop r9 + pop r8 + pop rcx + popfq + pop rdx + pop rax + ret + +;; +; Data rsi points to while we're calibrating. +struc CALIBDATA + .Overhead resq 1 + .Profiled resq 1 + .EnterTS resq 1 + .Min resq 1 +endstruc + + + +align 16 +;; +; Do necessary calibrations. +; +calibrate: + ; prolog - save everything + push rbp + pushfq + push rax ; pushaq + push rbx + push rcx + push rdx + push rdi + push rsi + push r8 + push r9 + push r10 + push r11 + push r12 + push r13 + push r14 + push r15 + mov rbp, rsp + + sub rsp, CALIBDATA_size + mov rsi, rsp ; rsi points to the CALIBDATA + + and rsp, -16 + + ; + ; Indicate that we have finished calibrating. + ; + mov eax, 1 + xchg dword [g_fCalibrated wrt rip], eax + + ; + ; The outer loop - find the right adjustment. + ; + mov ebx, 200h ; loop counter. +calib_outer_loop: + + ; + ; The inner loop - calls the function number of times to establish a + ; good minimum value + ; + mov ecx, 200h + mov dword [rsi + CALIBDATA.Min], 0ffffffffh + mov dword [rsi + CALIBDATA.Min + 4], 07fffffffh +calib_inner_loop: + + ; zero the overhead and profiled times. + xor eax, eax + mov [rsi + CALIBDATA.Overhead], rax + mov [rsi + CALIBDATA.Profiled], rax + call calib_nullproc + + ; subtract the overhead + mov rax, [rsi + CALIBDATA.Profiled] + sub rax, [rsi + CALIBDATA.Overhead] + + ; update the minimum value. + bt rax, 63 + jc near calib_outer_dec ; if negative, just simplify and shortcut + cmp rax, [rsi + CALIBDATA.Min] + jge calib_inner_next +calib_inner_update_minimum: + mov [rsi + CALIBDATA.Min], rax +calib_inner_next: + loop calib_inner_loop + + ; Is the minimum value acceptable? + test dword [rsi + CALIBDATA.Min + 4], 80000000h + jnz calib_outer_dec ; simplify if negative. + cmp dword [rsi + CALIBDATA.Min + 4], 0 + jnz calib_outer_inc ; this shouldn't be possible + cmp dword [rsi + CALIBDATA.Min], 1fh + jbe calib_outer_dec ; too low - 2 ticks per pair is the minimum! + ;cmp dword [rsi + CALIBDATA.Min], 30h + ;jbe calib_done ; this is fine! + cmp dword [rsi + CALIBDATA.Min], 70h ; - a bit weird... + jbe calib_outer_next ; do the full 200h*200h iteration +calib_outer_inc: + inc dword [g_OverheadAdj wrt rip] + jmp calib_outer_next +calib_outer_dec: + cmp dword [g_OverheadAdj wrt rip], 1 + je calib_done + dec dword [g_OverheadAdj wrt rip] +calib_outer_next: + dec ebx + jnz calib_outer_loop +calib_done: + + ; epilog - restore it all. + mov rsp, rbp + pop r15 + pop r14 + pop r13 + pop r12 + pop r11 + pop r10 + pop r9 + pop r8 + pop rsi + pop rdi + pop rdx + pop rcx + pop rbx + pop rax + popfq + pop rbp + ret + + + + +;; +; The calibration _penter - this must be identical to the real thing except for the KPRF call. +align 16 +calib_penter: + ; This part must be identical past the rdtsc. + push rax + push rdx + rdtsc + pushfq + push rcx + push r8 + push r9 + push r10 + push r11 + sub rsp, 28h ; rsp is unaligned at this point (8 pushes). + ; reserve 20h for spill, and 8 bytes for ts. + + ; store the entry / stack frame. + mov r8d, edx + shl r8, 32 + or r8, rax + mov [rsp + 20h], r8 + + mov [rsi + CALIBDATA.EnterTS], r8 + + lea rax, [rsi + CALIBDATA.Overhead] + jmp common_overhead + + +;; +; The calibration _pexit - this must be identical to the real thing except for the KPRF call. +align 16 +calib_pexit: + ; This part must be identical past the rdtsc. + push rax + push rdx + rdtsc + pushfq + push rcx + push r8 + push r9 + push r10 + push r11 + sub rsp, 28h ; rsp is unaligned at this point (8 pushes). + ; reserve 20h for spill, and 8 bytes for ts. + + ; store the entry / stack frame. + mov r8d, edx + shl r8, 32 + or r8, rax + mov [rsp + 20h], r8 + + sub r8, [rsi + CALIBDATA.EnterTS] + add [rsi + CALIBDATA.Profiled], r8 + + lea rax, [rsi + CALIBDATA.EnterTS] + jmp common_overhead + + +;; +; The 'function' we're profiling. +; The general idea is that each pair should take something like 2-10 ticks. +; +; (Btw. If we don't use multiple pairs here, we end up with the wrong result.) +align 16 +calib_nullproc: + call calib_penter ;0 + call calib_pexit + + call calib_penter ;1 + call calib_pexit + + call calib_penter ;2 + call calib_pexit + + call calib_penter ;3 + call calib_pexit + + call calib_penter ;4 + call calib_pexit + + call calib_penter ;5 + call calib_pexit + + call calib_penter ;6 + call calib_pexit + + call calib_penter ;7 + call calib_pexit + + call calib_penter ;8 + call calib_pexit + + call calib_penter ;9 + call calib_pexit + + call calib_penter ;a + call calib_pexit + + call calib_penter ;b + call calib_pexit + + call calib_penter ;c + call calib_pexit + + call calib_penter ;d + call calib_pexit + + call calib_penter ;e + call calib_pexit + + call calib_penter ;f + call calib_pexit + ret + + +; +; Dummy stack check function. +; +global __chkstk +__chkstk: + ret diff --git a/src/lib/kStuff/kProfiler2/prfcore.cpp.h b/src/lib/kStuff/kProfiler2/prfcore.cpp.h new file mode 100644 index 0000000..ac19eb7 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfcore.cpp.h @@ -0,0 +1,657 @@ +/* $Id: prfcore.cpp.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - Core Code Template. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Gets a function, create a new one if necessary. + */ +static KPRF_TYPE(P,FUNC) KPRF_NAME(GetFunction)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(,UPTR) uPC) +{ + /* + * Perform a binary search of the function lookup table. + */ + KPRF_TYPE(P,FUNC) paFunctions = KPRF_OFF2PTR(P,FUNC, pHdr->offFunctions, pHdr); + + KPRF_FUNCS_READ_LOCK(); + KI32 iStart = 0; + KI32 iLast = pHdr->cFunctions - 1; + KI32 i = iLast / 2; + for (;;) + { + KU32 iFunction = pHdr->aiFunctions[i]; + KPRF_TYPE(,IPTR) iDiff = uPC - paFunctions[iFunction].uEntryPtr; + if (!iDiff) + { + KPRF_FUNCS_READ_UNLOCK(); + return &paFunctions[iFunction]; + } + if (iLast == iStart) + break; + if (iDiff < 0) + iLast = i - 1; + else + iStart = i + 1; + if (iLast < iStart) + break; + i = iStart + (iLast - iStart) / 2; + } + KPRF_FUNCS_READ_UNLOCK(); + + /* + * It wasn't found, try add it. + */ + if (pHdr->cFunctions < pHdr->cMaxFunctions) + return KPRF_NAME(NewFunction)(pHdr, uPC); + return NULL; +} + + +/** + * Unwind one frame. + */ +static KU64* KPRF_NAME(UnwindOne)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(P,STACK) pStack, KPRF_TYPE(,UPTR) uPC, KU64 TS) +{ + /* + * Pop off the frame and update the frame below / thread. + */ + KPRF_TYPE(P,FRAME) pFrame = &pStack->aFrames[--pStack->cFrames]; + KU64 *pCurOverheadTicks; + if (pStack->cFrames) + { + KPRF_TYPE(P,FRAME) pTopFrame = pFrame - 1; + pTopFrame->OverheadTicks += pFrame->OverheadTicks + pFrame->CurOverheadTicks; + pTopFrame->SleepTicks += pFrame->SleepTicks; + pTopFrame->OnTopOfStackStart = TS; + pTopFrame->CurOverheadTicks = 0; + + pCurOverheadTicks = &pTopFrame->CurOverheadTicks; + } + else + { + KPRF_TYPE(P,THREAD) pThread = KPRF_OFF2PTR(P,THREAD, pStack->offThread, pHdr); + pThread->ProfiledTicks += TS - pFrame->OnStackStart - pFrame->CurOverheadTicks - pFrame->OverheadTicks - pFrame->SleepTicks; + pThread->OverheadTicks += pFrame->OverheadTicks + pFrame->CurOverheadTicks; + pThread->SleepTicks += pFrame->SleepTicks; + + pCurOverheadTicks = &pThread->OverheadTicks; + } + + /* + * Update the function (if any). + */ + if (pFrame->offFunction) + { + KPRF_TYPE(P,FUNC) pFunc = KPRF_OFF2PTR(P,FUNC, pFrame->offFunction, pHdr); + + /* Time on stack */ + KU64 Ticks = TS - pFrame->OnStackStart; + Ticks -= pFrame->OverheadTicks + pFrame->CurOverheadTicks + pFrame->SleepTicks; +/** @todo adjust overhead */ +KPRF_ASSERT(!(Ticks >> 63)); + if (pFunc->OnStack.MinTicks > Ticks) + KPRF_ATOMIC_SET64(&pFunc->OnStack.MinTicks, Ticks); + if (pFunc->OnStack.MaxTicks < Ticks) + KPRF_ATOMIC_SET64(&pFunc->OnStack.MaxTicks, Ticks); + KPRF_ATOMIC_ADD64(&pFunc->OnStack.SumTicks, Ticks); + + /* Time on top of stack */ + Ticks = TS - pFrame->OnTopOfStackStart; + Ticks -= pFrame->CurOverheadTicks; + Ticks += pFrame->OnTopOfStackTicks; +/** @todo adjust overhead */ +KPRF_ASSERT(!(Ticks >> 63)); + if (pFunc->OnTopOfStack.MinTicks > Ticks) + KPRF_ATOMIC_SET64(&pFunc->OnTopOfStack.MinTicks, Ticks); + if (pFunc->OnTopOfStack.MaxTicks < Ticks) + KPRF_ATOMIC_SET64(&pFunc->OnTopOfStack.MaxTicks, Ticks); + KPRF_ATOMIC_ADD64(&pFunc->OnTopOfStack.SumTicks, Ticks); + + /* calls */ + if (pFrame->cCalls) + KPRF_ATOMIC_ADD64(&pFunc->cCalls, pFrame->cCalls); + } + + return pCurOverheadTicks; +} + + +/** + * Unwinds the stack. + * + * On MSC+AMD64 we have to be very very careful here, because the uFramePtr cannot be trusted. + */ +static KU64* KPRF_NAME(UnwindInt)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(P,STACK) pStack, KPRF_TYPE(,UPTR) uPC, KPRF_TYPE(,UPTR) uFramePtr, KU64 TS) +{ + /** @todo need to deal with alternative stacks! */ + + /* + * Pop the stack until we're down below the current frame (uFramePtr). + */ + KI32 iFrame = pStack->cFrames - 1; + KPRF_TYPE(P,FRAME) pFrame = &pStack->aFrames[iFrame]; + + /* the most frequent case first. */ +#if K_OS == K_OS_WINDOWS && K_ARCH == K_ARCH_AMD64 + if ( uFramePtr == pFrame->uFramePtr + || ( pFrame->uFramePtr < uFramePtr + && iFrame > 0 + && pFrame[-1].uFramePtr > uFramePtr)) + return KPRF_NAME(UnwindOne)(pHdr, pStack, uPC, TS); +#else + if (uFramePtr == pFrame->uFramePtr) + return KPRF_NAME(UnwindOne)(pHdr, pStack, uPC, TS); +#endif + + /* none? */ + if (pFrame->uFramePtr > uFramePtr) + return &pFrame->CurOverheadTicks; + + /* one or more, possibly all */ + KU64 *pCurOverheadTicks = KPRF_NAME(UnwindOne)(pHdr, pStack, uPC, TS); + pFrame--; + if ( iFrame > 0 +#if K_OS == K_OS_WINDOWS && K_ARCH == K_ARCH_AMD64 + && pFrame->uFramePtr <= uFramePtr + && pFrame[-1].uFramePtr > uFramePtr) +#else + && pFrame->uFramePtr <= uFramePtr) +#endif + { + KPRF_TYPE(P,THREAD) pThread = KPRF_OFF2PTR(P,THREAD, pStack->offThread, pHdr); + pThread->cUnwinds++; /* (This is the reason for what looks like a bad loop unrolling.) */ + + pCurOverheadTicks = KPRF_NAME(UnwindOne)(pHdr, pStack, uPC, TS); + iFrame -= 2; + pFrame--; +#if K_OS == K_OS_WINDOWS && K_ARCH == K_ARCH_AMD64 + while ( iFrame > 0 + && pFrame->uFramePtr <= uFramePtr + && pFrame[-1].uFramePtr > uFramePtr) +#else + while ( iFrame >= 0 + && pFrame->uFramePtr <= uFramePtr) +#endif + { + pCurOverheadTicks = KPRF_NAME(UnwindOne)(pHdr, pStack, uPC, TS); + iFrame--; + pFrame--; + } + } + + return pCurOverheadTicks; +} + + + +/** + * Enter function. + * + * @returns Where to account overhead. + * @returns NULL if profiling is inactive. + * + * @param uPC The program counter register. (not relative) + * @param uFramePtr The stack frame address. This must match the one passed to kPrfLeave. (not relative) + * @param TS The timestamp when we entered into the profiler. + * This must not be modified touched! + * + * @internal ? + */ +KPRF_DECL_FUNC(KU64 *, Enter)(KPRF_TYPE(,UPTR) uPC, KPRF_TYPE(,UPTR) uFramePtr, const KU64 TS) +{ + /* + * Is profiling active ? + */ + if (!KPRF_IS_ACTIVE()) + return NULL; + + /* + * Get the header and adjust input addresses. + */ + KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); + if (!pHdr) + return NULL; + const KPRF_TYPE(,UPTR) uBasePtr = pHdr->uBasePtr; + if (uBasePtr) + { + uFramePtr -= uBasePtr; + uPC -= uBasePtr; + } + + /* + * Get the current thread. Reject unknown, inactive (in whatever way), + * and thread which has performed a stack switch. + */ + KPRF_TYPE(P,THREAD) pThread = KPRF_GET_THREAD(); + if (!pThread) + return NULL; + KPRF_TYPE(,THREADSTATE) enmThreadState = pThread->enmState; + if ( enmThreadState != KPRF_TYPE(,THREADSTATE_ACTIVE) + && enmThreadState != KPRF_TYPE(,THREADSTATE_OVERFLOWED) + ) + return NULL; + if (pThread->uStackBasePtr < uFramePtr) /* ASSUMES stack direction */ + { + pThread->cStackSwitchRejects++; + return NULL; + } + pThread->enmState = KPRF_TYPE(,THREADSTATE_SUSPENDED); + + + /* + * Update the thread statistics. + */ + pThread->cCalls++; + KPRF_TYPE(,UPTR) cbStack = pThread->uStackBasePtr - uFramePtr; /* ASSUMES stack direction */ + if (pThread->cbMaxStack < cbStack) + pThread->cbMaxStack = cbStack; + + /* + * Check if an longjmp or throw has taken place. + * This check will not work if a stack switch has taken place (can fix that later). + */ + KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pThread->offStack, pHdr); + KU32 iFrame = pStack->cFrames; + KPRF_TYPE(P,FRAME) pFrame = &pStack->aFrames[iFrame]; + if ( iFrame +#if K_OS == K_OS_WINDOWS && K_ARCH == K_ARCH_AMD64 + && 0) /* don't bother her yet because of _penter/_pexit frame problems. */ +#else + && pThread->uStackBasePtr >= uFramePtr /* ASSUMES stack direction */ + && pFrame[-1].uFramePtr + (KPRF_BITS - 8) / 8 < uFramePtr) /* ASSUMES stack direction */ +#endif + { + KPRF_NAME(UnwindInt)(pHdr, pStack, uPC, uFramePtr, TS); + iFrame = pStack->cFrames; + } + + /* + * Allocate a new stack frame. + */ + if (iFrame >= pHdr->cMaxStackFrames) + { + /* overflow */ + pThread->enmState = KPRF_TYPE(,THREADSTATE_OVERFLOWED); + pThread->cOverflows += enmThreadState != KPRF_TYPE(,THREADSTATE_OVERFLOWED); + return &pStack->aFrames[iFrame - 1].CurOverheadTicks; + } + pStack->cFrames++; + + /* + * Update the old top frame if any. + */ + if (iFrame) + { + KPRF_TYPE(P,FRAME) pOldFrame = pFrame - 1; + pOldFrame->OnTopOfStackTicks += TS - pOldFrame->OnTopOfStackStart; + pOldFrame->cCalls++; + } + + /* + * Fill in the new frame. + */ + pFrame->CurOverheadTicks = 0; + pFrame->OverheadTicks = 0; + pFrame->SleepTicks = 0; + pFrame->OnStackStart = TS; + pFrame->OnTopOfStackStart = TS; + pFrame->OnTopOfStackTicks = 0; + pFrame->cCalls = 0; + pFrame->uFramePtr = uFramePtr; + + /* + * Find the relevant function. + */ + KPRF_TYPE(P,FUNC) pFunc = KPRF_NAME(GetFunction)(pHdr, uPC); + if (pFunc) + { + pFrame->offFunction = KPRF_PTR2OFF(pFunc, pHdr); + pFunc->cOnStack++; + } + else + pFrame->offFunction = 0; + + /* + * Nearly done, We only have to reactivate the thread and account overhead. + * The latter is delegated to the caller. + */ + pThread->enmState = KPRF_TYPE(,THREADSTATE_ACTIVE); + return &pFrame->CurOverheadTicks; +} + + +/** + * Leave function. + * + * @returns Where to account overhead. + * @returns NULL if profiling is inactive. + * + * @param uPC The program counter register. + * @param uFramePtr The stack frame address. This must match the one passed to kPrfEnter. + * @param TS The timestamp when we entered into the profiler. + * This must not be modified because the caller could be using it! + * @internal + */ +KPRF_DECL_FUNC(KU64 *, Leave)(KPRF_TYPE(,UPTR) uPC, KPRF_TYPE(,UPTR) uFramePtr, const KU64 TS) +{ + /* + * Is profiling active ? + */ + if (!KPRF_IS_ACTIVE()) + return NULL; + + /* + * Get the header and adjust input addresses. + */ + KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); + if (!pHdr) + return NULL; + const KPRF_TYPE(,UPTR) uBasePtr = pHdr->uBasePtr; + if (uBasePtr) + { + uFramePtr -= uBasePtr; + uPC -= uBasePtr; + } + + /* + * Get the current thread and suspend profiling of the thread until we leave this function. + * Also reject threads which aren't active in some way. + */ + KPRF_TYPE(P,THREAD) pThread = KPRF_GET_THREAD(); + if (!pThread) + return NULL; + KPRF_TYPE(,THREADSTATE) enmThreadState = pThread->enmState; + if ( enmThreadState != KPRF_TYPE(,THREADSTATE_ACTIVE) + && enmThreadState != KPRF_TYPE(,THREADSTATE_OVERFLOWED) + ) + return NULL; + KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pThread->offStack, pHdr); + if (!pStack->cFrames) + return NULL; + pThread->enmState = KPRF_TYPE(,THREADSTATE_SUSPENDED); + + /* + * Unwind the stack down to and including the entry indicated by uFramePtr. + * Leave it to the caller to update the overhead. + */ + KU64 *pCurOverheadTicks = KPRF_NAME(UnwindInt)(pHdr, pStack, uPC, uFramePtr, TS); + + pThread->enmState = enmThreadState; + return pCurOverheadTicks; +} + + +/** + * Register the current thread. + * + * A thread can only be profiled if it has been registered by a call to this function. + * + * @param uPC The program counter register. + * @param uStackBasePtr The base of the stack. + */ +KPRF_DECL_FUNC(KPRF_TYPE(P,THREAD), RegisterThread)(KPRF_TYPE(,UPTR) uStackBasePtr, const char *pszName) +{ + /* + * Get the header and adjust input address. + * (It doesn't matter whether we're active or not.) + */ + KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); + if (!pHdr) + return NULL; + const KPRF_TYPE(,UPTR) uBasePtr = pHdr->uBasePtr; + if (uBasePtr) + uStackBasePtr -= uBasePtr; + + + /* + * Allocate a thread and a stack. + */ + KPRF_THREADS_LOCK(); + if (pHdr->cThreads < pHdr->cMaxThreads) + { + KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pHdr->offStacks, pHdr); + KU32 cLeft = pHdr->cMaxStacks; + do + { + if (!pStack->offThread) + { + /* init the stack. */ + pStack->cFrames = 0; + pStack->offThread = pHdr->offThreads + pHdr->cbThread * pHdr->cThreads++; + pHdr->cStacks++; + + /* init the thread */ + KPRF_TYPE(P,THREAD) pThread = KPRF_OFF2PTR(P,THREAD, pStack->offThread, pHdr); + pThread->ThreadId = KPRF_GET_THREADID(); + unsigned i = 0; + if (pszName) + while (i < sizeof(pThread->szName) - 1 && *pszName) + pThread->szName[i++] = *pszName++; + while (i < sizeof(pThread->szName)) + pThread->szName[i++] = '\0'; + pThread->enmState = KPRF_TYPE(,THREADSTATE_SUSPENDED); + pThread->Reserved0 = KPRF_TYPE(,THREADSTATE_TERMINATED); + pThread->uStackBasePtr = uStackBasePtr; + pThread->cbMaxStack = 0; + pThread->cCalls = 0; + pThread->cOverflows = 0; + pThread->cStackSwitchRejects = 0; + pThread->cUnwinds = 0; + pThread->ProfiledTicks = 0; + pThread->OverheadTicks = 0; + pThread->SleepTicks = 0; + pThread->offStack = KPRF_PTR2OFF(pStack, pHdr); + + + /* set the thread and make it active. */ + KPRF_THREADS_UNLOCK(); + KPRF_SET_THREAD(pThread); + pThread->enmState = KPRF_TYPE(,THREADSTATE_ACTIVE); + return pThread; + } + + /* next */ + pStack = KPRF_TYPE(P,STACK)(((KPRF_TYPE(,UPTR))pStack + pHdr->cbStack)); + } while (--cLeft > 0); + } + + KPRF_THREADS_UNLOCK(); + return NULL; +} + + +/** + * Terminates a thread. + * + * To terminate the current thread use DeregisterThread(), because that + * cleans up the TLS entry too. + * + * @param pHdr The profiler data set header. + * @param pThread The thread to terminate. + * @param TS The timestamp to use when terminating the thread. + */ +KPRF_DECL_FUNC(void, TerminateThread)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(P,THREAD) pThread, KU64 TS) +{ + if (pThread->enmState == KPRF_TYPE(,THREADSTATE_TERMINATED)) + return; + pThread->enmState = KPRF_TYPE(,THREADSTATE_TERMINATED); + + /* + * Unwind the entire stack. + */ + if (pThread->offStack) + { + KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pThread->offStack, pHdr); + for (KU32 cFrames = pStack->cFrames; cFrames > 0; cFrames--) + KPRF_NAME(UnwindOne)(pHdr, pStack, 0, TS); + + /* + * Free the stack. + */ + pThread->offStack = 0; + KPRF_THREADS_LOCK(); + pStack->offThread = 0; + pHdr->cStacks--; + KPRF_THREADS_UNLOCK(); + } +} + + +/** + * Deregister (terminate) the current thread. + */ +KPRF_DECL_FUNC(void, DeregisterThread)(void) +{ + KU64 TS = KPRF_NOW(); + + /* + * Get the header, then get the thread and mark it terminated. + * (It doesn't matter whether we're active or not.) + */ + KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); + if (!pHdr) + return; + + KPRF_TYPE(P,THREAD) pThread = KPRF_GET_THREAD(); + KPRF_SET_THREAD(NULL); + if (!pThread) + return; + KPRF_NAME(TerminateThread)(pHdr, pThread, TS); +} + + +/** + * Resumes / restarts a thread. + * + * @param fReset If set the stack is reset. + */ +KPRF_DECL_FUNC(void, ResumeThread)(int fReset) +{ + KU64 TS = KPRF_NOW(); + + /* + * Get the header, then get the thread and mark it terminated. + * (It doesn't matter whether we're active or not.) + */ + KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); + if (!pHdr) + return; + + KPRF_TYPE(P,THREAD) pThread = KPRF_GET_THREAD(); + if (!pThread) + return; + if (pThread->enmState != KPRF_TYPE(,THREADSTATE_SUSPENDED)) + return; + + /* + * Reset (unwind) the stack? + */ + KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pThread->offStack, pHdr); + if (fReset) + { + KU32 cFrames = pStack->cFrames; + while (cFrames-- > 0) + KPRF_NAME(UnwindOne)(pHdr, pStack, 0, TS); + } + /* + * If we've got any thing on the stack, we'll have to stop the sleeping period. + */ + else if (pStack->cFrames > 0) + { + KPRF_TYPE(P,FRAME) pFrame = &pStack->aFrames[pStack->cFrames - 1]; + + /* update the sleeping time and set the start of the new top-of-stack period. */ + pFrame->SleepTicks += TS - pFrame->OnTopOfStackStart; + pFrame->OnTopOfStackStart = TS; + } + /** @todo we're not accounting overhead here! */ + + /* + * We're done, switch the thread to active state. + */ + pThread->enmState = KPRF_TYPE(,THREADSTATE_ACTIVE); +} + + +/** + * Suspend / completes a thread. + * + * The thread will be in a suspend state where the time will be accounted for as sleeping. + * + * @param fUnwind If set the stack is unwound and the thread statistics updated. + */ +KPRF_DECL_FUNC(void, SuspendThread)(int fUnwind) +{ + KU64 TS = KPRF_NOW(); + + /* + * Get the header, then get the thread and mark it terminated. + * (It doesn't matter whether we're active or not.) + */ + KPRF_TYPE(P,HDR) pHdr = KPRF_GET_HDR(); + if (!pHdr) + return; + + KPRF_TYPE(P,THREAD) pThread = KPRF_GET_THREAD(); + if (!pThread) + return; + if ( pThread->enmState != KPRF_TYPE(,THREADSTATE_ACTIVE) + && pThread->enmState != KPRF_TYPE(,THREADSTATE_OVERFLOWED) + && (pThread->enmState != KPRF_TYPE(,THREADSTATE_SUSPENDED) || fUnwind)) + return; + + pThread->enmState = KPRF_TYPE(,THREADSTATE_SUSPENDED); + + /* + * Unwind the stack? + */ + KPRF_TYPE(P,STACK) pStack = KPRF_OFF2PTR(P,STACK, pThread->offStack, pHdr); + if (fUnwind) + { + KU32 cFrames = pStack->cFrames; + while (cFrames-- > 0) + KPRF_NAME(UnwindOne)(pHdr, pStack, 0, TS); + } + /* + * If we've got any thing on the stack, we'll have to record the sleeping period + * of the thread. If not we'll ignore it (for now at least). + */ + else if (pStack->cFrames > 0) + { + KPRF_TYPE(P,FRAME) pFrame = &pStack->aFrames[pStack->cFrames - 1]; + + /* update the top of stack time and set the start of the sleep period. */ + pFrame->OnTopOfStackTicks += TS - pFrame->OnTopOfStackStart; + pFrame->OnTopOfStackStart = TS; + } + + /** @todo we're not accounting overhead here! */ +} + + diff --git a/src/lib/kStuff/kProfiler2/prfcore.h.h b/src/lib/kStuff/kProfiler2/prfcore.h.h new file mode 100644 index 0000000..d4413d1 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfcore.h.h @@ -0,0 +1,381 @@ +/* $Id: prfcore.h.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - Core Header Template. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** @def KPRF_NAME + * Mixed case name macro. + */ +#ifndef KPRF_NAME +# define KPRF_NAME(Name) Name +#endif + +/** @def KPRF_TYPE + * Upper case type name macro. + */ +#ifndef KPRF_TYPE +# define KPRF_TYPE(Prefix,Name) Prefix##Name +#endif + +/** @type KPRF_DECL_FUNC + * The calling convention used. + */ +#ifndef KPRF_DECL_FUNC +# define KPRF_DECL_FUNC(type, name) type name +#endif + +/** @def KPRF_BITS + * The bitsize of the format. + */ +#ifndef KPRF_BITS +# define KPRF_BITS 32 +#endif + +/** @type UPTR + * The basic unsigned interger pointer type. + */ +/** @type IPTR + * The basic signed interger pointer type. + */ +#if KPRF_BITS == 16 +typedef KU16 KPRF_TYPE(,UPTR); +typedef KI16 KPRF_TYPE(,IPTR); +#elif KPRF_BITS == 32 +typedef KU32 KPRF_TYPE(,UPTR); +typedef KI32 KPRF_TYPE(,IPTR); +#elif KPRF_BITS == 64 +typedef KU64 KPRF_TYPE(,UPTR); +typedef KI64 KPRF_TYPE(,IPTR); +#else +# error "KPRF_BITS has an invalid value. Supported values are 16, 32 and 64." +#endif +/** @type KPRF_TYPE(P,UPTR) + * Pointer to the basic pointer type. + */ +typedef KPRF_TYPE(,UPTR) *KPRF_TYPE(P,UPTR); + + +/** + * Various constants. + */ +enum KPRF_TYPE(,CONSTANTS) +{ + /** Magic for the profiler header. (Unix Epoc) */ + KPRF_TYPE(,HDR_MAGIC) = 0x19700101 +}; + + +/** + * The profile data header. + */ +typedef struct KPRF_TYPE(,HDR) +{ + /** [0] The magic number for file data. (KPRF_TYPE(,HDR_MAGIC)) */ + KU32 u32Magic; + /** [4] KPRF_BITS. */ + KU32 cFormatBits; + /** [8] The base address which all pointers should be relative to. */ + KPRF_TYPE(,UPTR) uBasePtr; +#if KPRF_BITS <= 16 + /** [a] Reserved. */ + KU16 u16Reserved; +#endif +#if KPRF_BITS <= 32 + /** [c] Reserved. */ + KU32 u32Reserved; +#endif + /** [10] The size of this data set. */ + KU32 cb; + /** [10] The allocated data set size. */ + KU32 cbAllocated; + + /** [18] The max number of functions the function table can hold. */ + KU32 cMaxFunctions; + /** [1c] The current number of functions in the function table. */ + KU32 cFunctions; + /** [20] The offset of the function table (relative to this header). */ + KU32 offFunctions; + /** [24] The size of a function entry. */ + KU32 cbFunction; + + /** [28] The max number of bytes the module segments can occupy. */ + KU32 cbMaxModSegs; + /** [2c] The current size of the module segment records. */ + KU32 cbModSegs; + /** [30] The offset of the module segment records (relative to this header). */ + KU32 offModSegs; + + /** [34] The max number of threads the thread table can contain. */ + KU32 cMaxThreads; + /** [38] The current number of threads in the thread table. */ + KU32 cThreads; + /** [3c] The offset of the thread table (relative to this header). */ + KU32 offThreads; + /** [40] The size of a thread entry. */ + KU32 cbThread; + + /** [44] The max number of stacks the stack table can contain. */ + KU32 cMaxStacks; + /** [48] The max number of stacks. + * Unlike the other members, the stacks can be reused. It follows that + * this count doesn't specify the number of used slots from the start. */ + KU32 cStacks; + /** [4c] The offset of the thread table (relative to this header). + * This is usually 0 in a stored data set. */ + KU32 offStacks; + /** [50] The size of a stack. */ + KU32 cbStack; + /** [54] The maxium stack depth. */ + KU32 cMaxStackFrames; + + /** [58] The process commandline. + * Might not always apply is will be 0 in those cases. This is normally written + * where the stacks used to be. + */ + KU32 offCommandLine; + /** [5c] The length of the command line. (excludes the terminator). */ + KU32 cchCommandLine; + + /** [60] The function lookup table (it contains indexes). + * This is sorted by address so that a binary search can be performed. + * Access to this table is managed externally, but generally a read/write lock is employed. */ + KU32 aiFunctions[1]; +} KPRF_TYPE(,HDR); +/** Pointer to a profiler data header. */ +typedef KPRF_TYPE(,HDR) *KPRF_TYPE(P,HDR); +/** Pointer to a const profiler data header. */ +typedef const KPRF_TYPE(,HDR) *KPRF_TYPE(PC,HDR); + + +/** + * Time statistics. + */ +typedef struct KPRF_TYPE(,TIMESTAT) /** @todo bad names and descriptions! */ +{ + /** The minimum period */ + KU64 volatile MinTicks; + /** The maximum period */ + KU64 volatile MaxTicks; + /** The sum of all periods. */ + KU64 volatile SumTicks; +} KPRF_TYPE(,TIMESTAT); +/** Pointer to time statistics. */ +typedef KPRF_TYPE(,TIMESTAT) *KPRF_TYPE(P,TIMESTAT); +/** Pointer to const time statistics. */ +typedef const KPRF_TYPE(,TIMESTAT) *KPRF_TYPE(PC,TIMESTAT); + + +/** + * A Module Segment. + */ +typedef struct KPRF_TYPE(,MODSEG) +{ + /** The address of the segment. (relative address) */ + KPRF_TYPE(,UPTR) uBasePtr; + /** The size of the segment minus one (so the entire address space can be covered). */ + KPRF_TYPE(,UPTR) cbSegmentMinusOne; + /** The segment number. (0 based) */ + KU32 iSegment; + /** Flag indicating whether this segment is loaded or not. + * (A 16-bit value was choosen out of convenience, all that's stored is 0 or 1 anyway.) */ + KU16 fLoaded; + /** The length of the path. + * This is used to calculate the length of the record: offsetof(MODSEG, szPath) + cchPath + 1 */ + KU16 cchPath; + /** The module name. */ + char szPath[1]; +} KPRF_TYPE(,MODSEG); +/** Pointer to a module segment. */ +typedef KPRF_TYPE(,MODSEG) *KPRF_TYPE(P,MODSEG); +/** Pointer to a const module segment. */ +typedef const KPRF_TYPE(,MODSEG) *KPRF_TYPE(PC,MODSEG); + + +/** + * The profiler data for a function. + */ +typedef struct KPRF_TYPE(,FUNC) +{ + /** The entry address of the function. (relative address) + * This is the return address of the entry hook (_mcount, _penter, _ProfileHook32, ...). */ + KPRF_TYPE(,UPTR) uEntryPtr; + /** Offset (relative to the profiler header) of the module segment to which this function belongs. */ + KU32 offModSeg; + + /** The number times on the stack. */ + KU64 volatile cOnStack; + /** The number of calls made from this function. */ + KU64 volatile cCalls; + + /** Time on stack. */ + KPRF_TYPE(,TIMESTAT) OnStack; + /** Time on top of the stack, i.e. executing. */ + KPRF_TYPE(,TIMESTAT) OnTopOfStack; + + /** @todo recursion */ + +} KPRF_TYPE(,FUNC); +/** Pointer to the profiler data for a function. */ +typedef KPRF_TYPE(,FUNC) *KPRF_TYPE(P,FUNC); +/** Pointer to the const profiler data for a function. */ +typedef const KPRF_TYPE(,FUNC) *KPRF_TYPE(PC,FUNC); + + +/** + * Stack frame. + */ +typedef struct KPRF_TYPE(,FRAME) +{ + /** The accumulated overhead. + * Over head is accumulated by the parent frame when a child is poped off the stack. */ + KU64 OverheadTicks; + /** The current (top of stack) overhead. */ + KU64 CurOverheadTicks; + /** The accumulated sleep ticks. + * It's possible to notify the profiler that the thread is being put into a wait/sleep/yield + * state. The time spent sleeping is transfered to the parent frame when poping of a child one. */ + KU64 SleepTicks; + /** The start of the on-stack period. */ + KU64 OnStackStart; + /** The accumulated time on top (excludes overhead (sleep doesn't apply here obviously)). */ + KU64 OnTopOfStackTicks; + /** The start of the current on-top-of-stack period. + * This is also to mark the start of a sleeping period, the ResumeThread function will always + * treat it as the start of the suspend period. */ + KU64 OnTopOfStackStart; + /** The number of calls made from this stack frame. */ + KU64 cCalls; + /** Stack address of this frame. + * This is used to detect throw and longjmp, and is also used to deal with overflow. (relative address) */ + KPRF_TYPE(,UPTR) uFramePtr; + /** Offset (relative to the profiler header) to the function record. + * This is 0 if we're out of function space. */ + KU32 offFunction; +} KPRF_TYPE(,FRAME); +/** Pointer to a stack frame. */ +typedef KPRF_TYPE(,FRAME) *KPRF_TYPE(P,FRAME); +/** Pointer to a const stack frame. */ +typedef const KPRF_TYPE(,FRAME) *KPRF_TYPE(PC,FRAME); + + +/** + * Stack. + */ +typedef struct KPRF_TYPE(,STACK) +{ + /** The offset (relative to the profiler header) of the thread owning the stack. + * This is zero if not in use, and non-zero if in use. */ + KU32 offThread; + /** The number of active stack frames. */ + KU32 cFrames; + /** The stack frames. + * The actual size of this array is specified in the header. */ + KPRF_TYPE(,FRAME) aFrames[1]; +} KPRF_TYPE(,STACK); +/** Pointer to a stack. */ +typedef KPRF_TYPE(,STACK) *KPRF_TYPE(P,STACK); +/** Pointer to a const stack. */ +typedef const KPRF_TYPE(,STACK) *KPRF_TYPE(PC,STACK); + + +/** + * The thread state. + */ +typedef enum KPRF_TYPE(,THREADSTATE) +{ + /** The thread hasn't been used yet. */ + KPRF_TYPE(,THREADSTATE_UNUSED) = 0, + /** The thread is activly being profiled. + * A thread is added in the suspended state and then activated when + * starting to execute the first function. + */ + KPRF_TYPE(,THREADSTATE_ACTIVE), + /** The thread is currently suspended from profiling. + * Upon entering profiler code the thread is suspended, it's reactivated + * upon normal return. + */ + KPRF_TYPE(,THREADSTATE_SUSPENDED), + /** The thread is currently suspended due of stack overflow. + * When we overflow the stack frame array, the thread enter the overflow state. In this + * state nothing is profiled but we keep looking for the exit of the top frame. */ + KPRF_TYPE(,THREADSTATE_OVERFLOWED), + /** The thread is terminated. + * When we received a thread termination notification the thread is unwinded, statistics + * updated and the state changed to terminated. A terminated thread cannot be revivied. */ + KPRF_TYPE(,THREADSTATE_TERMINATED), + + /** Ensure 32-bit size. */ + KPRF_TYPE(,THREADSTATE_32BIT_HACK) = 0x7fffffff +} KPRF_TYPE(,THREADSTATE); + + +/** + * Thread statistics and stack. + */ +typedef struct KPRF_TYPE(,THREAD) +{ + /** The native thread id. */ + KU64 ThreadId; + /** The thread name. (optional) */ + char szName[32]; + /** The thread current thread state. */ + KPRF_TYPE(,THREADSTATE) enmState; + /** Alignment. */ + KPRF_TYPE(,THREADSTATE) Reserved0; + /** The base pointer of the thread stack. (relative address) */ + KPRF_TYPE(,UPTR) uStackBasePtr; + /** The maximum depth of the thread stack (bytes). */ + KPRF_TYPE(,UPTR) cbMaxStack; + /** The number of calls done by this thread. */ + KU64 cCalls; + /** The number of times the stack overflowed. */ + KU64 cOverflows; + /** The number of times stack entries has been rejected because of a stack switch. */ + KU64 cStackSwitchRejects; + /** The number of times the stack has been unwinded more than one frame. */ + KU64 cUnwinds; + + /** The profiled ticks. (This does not include sleep or overhead ticks.) + * This is the accumulated on-stack values for the final stack frames. */ + KU64 ProfiledTicks; + /** The accumulated overhead of this thread. */ + KU64 OverheadTicks; + /** The accumulated sleep ticks for this thread. + * See KPRF_TYPE(,FRAME)::SleepTicks for details. */ + KU64 SleepTicks; + + /** The offset of the stack. */ + KU32 offStack; +} KPRF_TYPE(,THREAD); +/** Pointer to a thread. */ +typedef KPRF_TYPE(,THREAD) *KPRF_TYPE(P,THREAD); +/** Pointer to a const thread. */ +typedef const KPRF_TYPE(,THREAD) *KPRF_TYPE(PC,THREAD); + + diff --git a/src/lib/kStuff/kProfiler2/prfcorefunction.cpp.h b/src/lib/kStuff/kProfiler2/prfcorefunction.cpp.h new file mode 100644 index 0000000..686b452 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfcorefunction.cpp.h @@ -0,0 +1,127 @@ +/* $Id: prfcorefunction.cpp.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - Core NewFunction Code Template. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Creates a new function. + * + * @returns Pointer to the new function. + * @returns NULL if we're out of space. + */ +static KPRF_TYPE(P,FUNC) KPRF_NAME(NewFunction)(KPRF_TYPE(P,HDR) pHdr,KPRF_TYPE(,UPTR) uPC) +{ + /* + * First find the position of the function (it might actually have been inserted by someone else by now too). + */ + KPRF_FUNCS_WRITE_LOCK(); + + KPRF_TYPE(P,FUNC) paFunctions = KPRF_OFF2PTR(P,FUNC, pHdr->offFunctions, pHdr); + KI32 iStart = 0; + KI32 iLast = pHdr->cFunctions - 1; + KI32 i = iLast / 2; + for (;;) + { + KU32 iFunction = pHdr->aiFunctions[i]; + KPRF_TYPE(,IPTR) iDiff = uPC - paFunctions[iFunction].uEntryPtr; + if (!iDiff) + { + KPRF_FUNCS_WRITE_UNLOCK(); + return &paFunctions[iFunction]; + } + if (iLast == iStart) + break; + if (iDiff < 0) + iLast = i - 1; + else + iStart = i + 1; + if (iLast < iStart) + break; + i = iStart + (iLast - iStart) / 2; + } + + /* + * Adjust the index so we're exactly in the right spot. + * (I've too much of a headache to figure out if the above loop leaves us where we should be.) + */ + const KI32 iNew = pHdr->cFunctions; + if (paFunctions[pHdr->aiFunctions[i]].uEntryPtr > uPC) + { + while ( i > 0 + && paFunctions[pHdr->aiFunctions[i - 1]].uEntryPtr > uPC) + i--; + } + else + { + while ( i < iNew + && paFunctions[pHdr->aiFunctions[i]].uEntryPtr < uPC) + i++; + } + + /* + * Ensure that there still is space for the function. + */ + if (iNew >= (KI32)pHdr->cMaxFunctions) + { + KPRF_FUNCS_WRITE_UNLOCK(); + return NULL; + } + pHdr->cFunctions++; + KPRF_TYPE(P,FUNC) pNew = &paFunctions[iNew]; + + /* init the new function entry */ + pNew->uEntryPtr = uPC; + pNew->offModSeg = 0; + pNew->cOnStack = 0; + pNew->cCalls = 0; + pNew->OnStack.MinTicks = ~(KU64)0; + pNew->OnStack.MaxTicks = 0; + pNew->OnStack.SumTicks = 0; + pNew->OnTopOfStack.MinTicks = ~(KU64)0; + pNew->OnTopOfStack.MaxTicks = 0; + pNew->OnTopOfStack.SumTicks = 0; + + /* shift the function index array and insert the new one. */ + KI32 j = iNew; + while (j > i) + { + pHdr->aiFunctions[j] = pHdr->aiFunctions[j - 1]; + j--; + } + pHdr->aiFunctions[i] = iNew; + KPRF_FUNCS_WRITE_UNLOCK(); + + /* + * Record the module segment (i.e. add it if it's new). + */ + pNew->offModSeg = KPRF_NAME(RecordModSeg)(pHdr, uPC); + + return pNew; +} + diff --git a/src/lib/kStuff/kProfiler2/prfcoreinit.cpp.h b/src/lib/kStuff/kProfiler2/prfcoreinit.cpp.h new file mode 100644 index 0000000..5a94f46 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfcoreinit.cpp.h @@ -0,0 +1,191 @@ +/* $Id: prfcoreinit.cpp.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - Core Initialization Code Template. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Calculates the size of the profiler data set. + * + * @returns The size of the data set in bytes. + * + * @param cMaxFunctions The max number of functions. + * @param cbMaxModSeg The max bytes for module segments. + * @param cMaxThreads The max number of threads. + * @param cMaxStacks The max number of stacks. (should be less or equal to the max number of threads) + * @param cMaxStackFrames The max number of frames on each of the stacks. + * + * @remark This function does not input checks, it only aligns it. The caller is + * responsible for the input to make some sense. + */ +KPRF_DECL_FUNC(KU32, CalcSize)(KU32 cMaxFunctions, KU32 cbMaxModSegs, KU32 cMaxThreads, KU32 cMaxStacks, KU32 cMaxStackFrames) +{ + /* + * Normalize input. + */ + KPRF_SETMIN_ALIGN(cMaxFunctions, 16, 16); + KPRF_SETMIN_ALIGN(cbMaxModSegs, KPRF_SIZEOF(MODSEG), 32); + KPRF_SETMIN_ALIGN(cMaxThreads, 1, 1); + KPRF_SETMIN_ALIGN(cMaxStacks, 1, 1); + KPRF_SETMIN_ALIGN(cMaxStackFrames, 32, 32); + + /* + * Calc the size from the input. + * We do not take overflows into account, stupid user means stupid result. + */ + KU32 cb = KPRF_OFFSETOF(HDR, aiFunctions[cMaxFunctions]); + KU32 cbTotal = KPRF_ALIGN(cb, 32); + + cb = cMaxFunctions * KPRF_SIZEOF(FUNC); + cbTotal += KPRF_ALIGN(cb, 32); + + cbTotal += cbMaxModSegs; + + cb = cMaxThreads * KPRF_SIZEOF(THREAD); + cbTotal += KPRF_ALIGN(cb, 32); + + cb = cMaxStacks * KPRF_SIZEOF(STACK); + cbTotal += KPRF_ALIGN(cb, 32); + + cb = cMaxStackFrames * cMaxStacks * KPRF_SIZEOF(FRAME); + cbTotal += KPRF_ALIGN(cb, 32); + + return cbTotal; +} + + +/** + * Initializes the profiler data set. + * + * @returns Pointer to the initialized profiler header on success. + * @returns NULL if the input doesn't add up. + * + * @param pvData Where to initialize the profiler data set. + * @param cbData The size of the available data. + * @param cMaxFunctions The max number of functions. + * @param cbMaxModSeg The max bytes for module segments. + * @param cMaxThreads The max number of threads. + * @param cMaxStacks The max number of stacks. (should be less or equal to the max number of threads) + * @param cMaxStackFrames The max number of frames on each of the stacks. + * + */ +KPRF_DECL_FUNC(KPRF_TYPE(P,HDR), Init)(void *pvData, KU32 cbData, KU32 cMaxFunctions, KU32 cbMaxModSegs, + KU32 cMaxThreads, KU32 cMaxStacks, KU32 cMaxStackFrames) +{ + /* + * Normalize the input. + */ + if (!pvData) + return NULL; + KPRF_SETMIN_ALIGN(cMaxFunctions, 16, 16); + KPRF_SETMIN_ALIGN(cbMaxModSegs, KPRF_SIZEOF(MODSEG), 32); + KPRF_SETMIN_ALIGN(cMaxThreads, 1, 1); + KPRF_SETMIN_ALIGN(cMaxStacks, 1, 1); + KPRF_SETMIN_ALIGN(cMaxStackFrames, 32, 32); + + /* + * The header. + */ + KU32 off = 0; + KU32 cb = KPRF_OFFSETOF(HDR, aiFunctions[cMaxFunctions]); + cb = KPRF_ALIGN(cb, 32); + if (cbData < off + cb || off > off + cb) + return NULL; + KPRF_TYPE(P,HDR) pHdr = (KPRF_TYPE(P,HDR))pvData; + + /* the core header */ + pHdr->u32Magic = 0; /* Set at the very end */ + pHdr->cFormatBits = KPRF_BITS; + pHdr->uBasePtr = 0; /* Can be set afterwards using SetBasePtr. */ +#if KPRF_BITS <= 16 + pHdr->u16Reserved = 0; +#endif +#if KPRF_BITS <= 32 + pHdr->u32Reserved = 0; +#endif + pHdr->cb = cbData; + pHdr->cbAllocated = cbData; + + /* functions */ + off += cb; + cb = cMaxFunctions * KPRF_SIZEOF(FUNC); + cb = KPRF_ALIGN(cb, 32); + if (cbData < off + cb || off > off + cb) + return NULL; + pHdr->cMaxFunctions = cMaxFunctions; + pHdr->cFunctions = 0; + pHdr->offFunctions = off; + pHdr->cbFunction = KPRF_SIZEOF(FUNC); + + /* modsegs */ + off += cb; + cb = KPRF_ALIGN(cbMaxModSegs, 32); + if (cbData < off + cb || off > off + cb) + return NULL; + pHdr->cbMaxModSegs = cbMaxModSegs; + pHdr->cbModSegs = 0; + pHdr->offModSegs = off; + + /* threads */ + off += cb; + cb = cMaxThreads * KPRF_SIZEOF(THREAD); + cb = KPRF_ALIGN(cb, 32); + if (cbData < off + cb || off > off + cb) + return NULL; + pHdr->cMaxThreads = cMaxThreads; + pHdr->cThreads = 0; + pHdr->offThreads = off; + pHdr->cbThread = KPRF_SIZEOF(THREAD); + + /* stacks */ + off += cb; + cb = cMaxStacks * KPRF_OFFSETOF(STACK, aFrames[cMaxStackFrames]); + cb = KPRF_ALIGN(cb, 32); + if (cbData < off + cb || off > off + cb) + return NULL; + pHdr->cMaxStacks = cMaxStacks; + pHdr->cStacks = 0; + pHdr->offStacks = off; + pHdr->cbStack = KPRF_OFFSETOF(STACK, aFrames[cMaxStackFrames]); + pHdr->cMaxStackFrames = cMaxStackFrames; + + /* commandline */ + pHdr->offCommandLine = 0; + pHdr->cchCommandLine = 0; + + /* the final size */ + pHdr->cb = off + cb; + + + /* + * Done. + */ + pHdr->u32Magic = KPRF_TYPE(,HDR_MAGIC); + return pHdr; +} + diff --git a/src/lib/kStuff/kProfiler2/prfcoremodseg.cpp.h b/src/lib/kStuff/kProfiler2/prfcoremodseg.cpp.h new file mode 100644 index 0000000..32c6e24 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfcoremodseg.cpp.h @@ -0,0 +1,197 @@ +/* $Id: prfcoremodseg.cpp.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - Core Module Segment Code Template. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Adds a module segment. + * + * @returns Offset to the module if existing or successfully added + * @returns 0 if not found. + * + * @param pHdr The profiler header. + * @param pModSeg Pointer to the module segment to insert (it's copied of course). + * @param off The offset into the modseg area which has been searched. + * (This is relative to the first moddule segment record (at pHdr->offModSegs).) + */ +static KU32 KPRF_NAME(InsertModSeg)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(PC,MODSEG) pModSeg, KU32 off) +{ + /* + * Lookup the module segment, inserting it if not found (and there is room). + */ + for (;;) + { + if (off >= pHdr->cbModSegs) + { + /* + * It was the end, let's try insert it. + * + * This is where we lock the modseg stuff. The deal is that we + * serialize the actual inserting without blocking lookups. This + * means that we may end up with potential racing inserts, but + * unless there is a large amount of modules being profiled that's + * probably not going to be much of a problem. Anyway if we race, + * we'll simply have to search the new additions before we add our + * own stuff. + */ + KPRF_MODSEGS_LOCK(); + if (off >= pHdr->cbModSegs) + { + KU32 cbModSeg = KPRF_OFFSETOF(MODSEG, szPath[pModSeg->cchPath + 1]); + cbModSeg = KPRF_ALIGN(cbModSeg, KPRF_SIZEOF(UPTR)); + if (off + cbModSeg <= pHdr->cbMaxModSegs) + { + KPRF_TYPE(P,MODSEG) pNew = KPRF_OFF2PTR(P,MODSEG, off + pHdr->offModSegs, pHdr); + pNew->uBasePtr = pModSeg->uBasePtr; + pNew->cbSegmentMinusOne = pModSeg->cbSegmentMinusOne; + pNew->iSegment = pModSeg->iSegment; + pNew->fLoaded = pModSeg->fLoaded; + pNew->cchPath = pModSeg->cchPath; + + KI32 iPath = pModSeg->cchPath; + do pNew->szPath[iPath] = pModSeg->szPath[iPath]; + while (--iPath >= 0); + + /* commit it */ + KPRF_ATOMIC_SET32(&pHdr->cbModSegs, off + cbModSeg); + off += pHdr->offModSegs; + } + else + off = 0; + KPRF_MODSEGS_UNLOCK(); + return off; + } + KPRF_MODSEGS_UNLOCK(); + /* someone raced us, check the new entries. */ + } + + /* + * Match? + */ + KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(P,MODSEG, off + pHdr->offModSegs, pHdr); + if ( pCur->uBasePtr == pModSeg->uBasePtr + && pCur->fLoaded == pModSeg->fLoaded + && pCur->cchPath == pModSeg->cchPath + && pCur->iSegment == pModSeg->iSegment + && pCur->cbSegmentMinusOne == pModSeg->cbSegmentMinusOne + ) + { + KI32 iPath = pModSeg->cchPath; + for (;;) + { + if (!iPath--) + return off + pHdr->offModSegs; + if (pModSeg->szPath[iPath] != pCur->szPath[iPath]) + break; + } + /* didn't match, continue searching */ + } + KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]); + off += KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR)); + } +} + + +/** + * Queries data for and inserts a new module segment. + * + * + * @returns Offset to the module if existing or successfully added + * @returns 0 if not found. + * + * @param pHdr The profiler header. + * @param uPC Address within the module. + * @param off The offset into the modseg area which has been searched. + * (This is relative to the first moddule segment record (at pHdr->offModSegs).) + */ +static KU32 KPRF_NAME(NewModSeg)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(,UPTR) uPC, KU32 off) +{ + /* + * Query the module name and object of the function. + */ +#pragma pack(1) + struct + { + KPRF_TYPE(,MODSEG) ModSeg; + char szMorePath[260]; + } s; +#pragma pack() + if (KPRF_GET_MODSEG(uPC + pHdr->uBasePtr, s.ModSeg.szPath, sizeof(s.ModSeg.szPath) + sizeof(s.szMorePath), + &s.ModSeg.iSegment, &s.ModSeg.uBasePtr, &s.ModSeg.cbSegmentMinusOne)) + return 0; + s.ModSeg.uBasePtr -= pHdr->uBasePtr; + s.ModSeg.fLoaded = 1; + s.ModSeg.cchPath = 0; + while (s.ModSeg.szPath[s.ModSeg.cchPath]) + s.ModSeg.cchPath++; + + return KPRF_NAME(InsertModSeg)(pHdr, &s.ModSeg, off); +} + + +/** + * Record a module segment. + * + * This is an internal worker for recording a module segment when adding + * a new function. + * + * @returns Offset to the module if existing or successfully added + * @returns 0 if not found. + * + * @param pHdr The profiler header. + * @param uPC Address within the module. + */ +static KU32 KPRF_NAME(RecordModSeg)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(,UPTR) uPC) +{ + /* + * Lookup the module segment, inserting it if not found (and there is room). + */ + KU32 off = 0; + KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(P,MODSEG, pHdr->offModSegs, pHdr); + const KU32 cbModSegs = pHdr->cbModSegs; + for (;;) + { + /* done and not found? */ + if (off >= cbModSegs) + return KPRF_NAME(NewModSeg)(pHdr, uPC, off); + + /* + * Match? + */ + if ( pCur->fLoaded + && uPC - pCur->uBasePtr <= pCur->cbSegmentMinusOne) + return off + pHdr->offModSegs; + + KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]); + cbCur = KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR)); + off += cbCur; + pCur = (KPRF_TYPE(PC,MODSEG))((KU8 *)pCur + cbCur); + } +} + diff --git a/src/lib/kStuff/kProfiler2/prfcorepost.cpp.h b/src/lib/kStuff/kProfiler2/prfcorepost.cpp.h new file mode 100644 index 0000000..84ea2b0 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfcorepost.cpp.h @@ -0,0 +1,41 @@ +/* $Id: prfcorepost.cpp.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - Core Post-Code Template. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * Clean up all our defines. + */ +#undef KPRF_OFFSETOF +#undef KPRF_ALIGN +#undef KPRF_SETMIN_ALIGN +#undef KPRF_PTR2OFF +#undef KPRF_OFF2PTREx +#undef KPRF_OFF2PTR + diff --git a/src/lib/kStuff/kProfiler2/prfcorepre.cpp.h b/src/lib/kStuff/kProfiler2/prfcorepre.cpp.h new file mode 100644 index 0000000..50f6b6a --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfcorepre.cpp.h @@ -0,0 +1,202 @@ +/* $Id: prfcorepre.cpp.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - Core Pre-Code Template. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** @def KPRF_OFF2PTR + * Internal helper for converting a offset to a pointer. + * @internal + */ +#define KPRF_OFF2PTR(TypePrefix, TypeName, off, pHdr) \ + ( (KPRF_TYPE(TypePrefix, TypeName)) ((off) + (KPRF_TYPE(,UPTR))pHdr) ) + +/** @def KPRF_PTR2OFF + * Internal helper for converting a pointer to a offset. + * @internal + */ +#define KPRF_PTR2OFF(ptr, pHdr) \ + ( (KPRF_TYPE(,UPTR))(ptr) - (KPRF_TYPE(,UPTR))(pHdr) ) + +/** @def KPRF_ALIGN + * The usual align macro. + * @internal + */ +#define KPRF_ALIGN(n, align) ( ((n) + ( (align) - 1)) & ~((align) - 1) ) + +/** @def KPRF_SETMIN_ALIGN + * Ensures a minimum and aligned value. + * @internal + */ +#define KPRF_SETMIN_ALIGN(n, min, align) \ + do { \ + if ((n) < (min)) \ + (n) = (min); \ + else { \ + const KU32 u32 = ((n) + ( (align) - 1)) & ~((align) - 1); \ + if (u32 >= (n)) \ + (n) = u32; \ + } \ + } while (0) + +/** @def KPRF_OFFSETOF + * My usual extended OFFSETOF macro, except this returns KU32 and mangles the type name. + * @internal + */ +#define KPRF_OFFSETOF(kPrfType, Member) ( (KU32)(KUPTR)&((KPRF_TYPE(P,kPrfType))0)->Member ) + +/** @def PRF_SIZEOF + * Size of a kPrf type. + * @internal + */ +#define KPRF_SIZEOF(kPrfType) sizeof(KPRF_TYPE(,kPrfType)) + + +/** @def KPRF_NOW + * Gets the current timestamp. + */ +#ifndef KPRF_NOW +# error "KPRF_NOW isn't defined!" +#endif + +/** @def KRPF_IS_ACTIVE + * Checks if profiling is activated or not. + * The idea is to use some global variable for disabling and enabling + * profiling in order to deal with init/term issues. + */ +#ifndef KPRF_IS_ACTIVE +# define KPRF_IS_ACTIVE() 1 +#endif + +/** @def KPRF_GET_HDR + * Gets the pointer to the profiler data header. + */ +#ifndef KPRF_GET_HDR +# error "KPRF_GET_HDR isn't defined!" +#endif + +/** @def KPRF_GET_THREADID + * Gets native thread id. This must be unique. + */ +#ifndef KPRF_GET_THREADID +# error "KPRF_GET_THREADID isn't defined!" +#endif + +/** @def KPRF_SET_THREAD + * Sets the pointer to the current thread so we can get to it + * without doing a linear search by thread id. + */ +#ifndef KPRF_SET_THREAD +# error "KPRF_SET_THREAD isn't defined!" +#endif + +/** @def KPRF_GET_THREAD + * Gets the pointer to the current thread as set by KPRF_SET_THREAD. + */ +#ifndef KPRF_GET_THREAD +# error "KPRF_GET_THREAD isn't defined!" +#endif + +/** @def KPRF_MODSEGS_LOCK + * Lock the module segment for updating. + */ +#ifndef KPRF_MODSEGS_LOCK +# define KPRF_MODSEGS_LOCK() do { } while (0) +#endif + +/** @def KPRF_MODSEGS_UNLOCK + * Unlock the module segments. + */ +#ifndef KPRF_MODSEGS_UNLOCK +# define KPRF_MODSEGS_UNLOCK() do { } while (0) +#endif + +/** @def KPRF_THREADS_LOCK + * Lock the threads for updating. + */ +#ifndef KPRF_THREADS_LOCK +# define KPRF_THREADS_LOCK() do { } while (0) +#endif + +/** @def KPRF_THREADS_UNLOCK + * Unlock the threads. + */ +#ifndef KPRF_THREADS_UNLOCK +# define KPRF_THREADS_UNLOCK() do { } while (0) +#endif + +/** @def KPRF_FUNCS_READ_LOCK + * Lock the functions for reading. + */ +#ifndef KPRF_FUNCS_READ_LOCK +# define KPRF_FUNCS_READ_LOCK() do { } while (0) +#endif + +/** @def KPRF_FUNCS_READ_UNLOCK + * Releases a read lock on the functions. + */ +#ifndef KPRF_FUNCS_READ_UNLOCK +# define KPRF_FUNCS_READ_UNLOCK() do { } while (0) +#endif + +/** @def KPRF_FUNCS_WRITE_LOCK + * Lock the functions for updating. + */ +#ifndef KPRF_FUNCS_WRITE_LOCK +# define KPRF_FUNCS_WRITE_LOCK() do { } while (0) +#endif + +/** @def KPRF_FUNCS_WRITE_UNLOCK + * Releases a write lock on the functions. + */ +#ifndef KPRF_FUNCS_WRITE_UNLOCK +# define KPRF_FUNCS_WRITE_UNLOCK() do { } while (0) +#endif + + +/** @def KPRF_ATOMIC_SET32 + * Atomically set a 32-bit value. + */ +#ifndef KPRF_ATOMIC_SET32 +# define KPRF_ATOMIC_SET32(pu32, u32) do { *(pu32) = (u32); } while (0) +#endif + +/** @def KPRF_ATOMIC_SET64 + * Atomically (well, in a safe way) adds to a 64-bit value. + */ +#ifndef KPRF_ATOMIC_ADD64 +# define KPRF_ATOMIC_ADD64(pu64, u64) do { *(pu64) += (u64); } while (0) +#endif + +/** @def KPRF_ATOMIC_SET64 + * Atomically (well, in a safe way) increments a 64-bit value. + */ +#ifndef KPRF_ATOMIC_INC64 +# define KPRF_ATOMIC_INC64(pu64) KPRF_ATOMIC_ADD64(pu64, 1) +#endif + diff --git a/src/lib/kStuff/kProfiler2/prfcorereloc.cpp.h b/src/lib/kStuff/kProfiler2/prfcorereloc.cpp.h new file mode 100644 index 0000000..c7fc667 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfcorereloc.cpp.h @@ -0,0 +1,47 @@ +/* $Id: prfcorereloc.cpp.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - Core SetBasePtr Code Template. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Set (or modify) the base pointer for the profiler. + * + * The purpose of the base pointer is to allow profiling of relocatable code. Set the + * base pointer right after initializing the data set, and update it when relocating + * the code (both by calling this function), and Bob's your uncle! :-) + * + * @param pHdr The header returned from the initializer. + * @param uBasePtr The new base pointer value. + */ +KPRF_DECL_FUNC(void, SetBasePtr)(KPRF_TYPE(P,HDR) pHdr, KPRF_TYPE(,UPTR) uBasePtr) +{ + pHdr->uBasePtr = uBasePtr; +} + + diff --git a/src/lib/kStuff/kProfiler2/prfcoreterm.cpp.h b/src/lib/kStuff/kProfiler2/prfcoreterm.cpp.h new file mode 100644 index 0000000..561fcdf --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfcoreterm.cpp.h @@ -0,0 +1,142 @@ +/* $Id: prfcoreterm.cpp.h 29 2009-07-01 20:30:29Z bird $ */ +/** @file + * kProfiler Mark 2 - Core Termination Code Template. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Unwinds and terminates all the threads, and frees the stack space. + * + * @returns The new data set size. (pHdr->cb) + * @param pHdr The profiler data set header. + */ +KPRF_DECL_FUNC(KU32, TerminateAll)(KPRF_TYPE(P,HDR) pHdr) +{ + KU64 TS = KPRF_NOW(); + if (!pHdr) + return 0; + + /* + * Iterate the threads and terminate all which are non-terminated. + */ + KPRF_TYPE(P,THREAD) paThread = KPRF_OFF2PTR(P,THREAD, pHdr->offThreads, pHdr); + for (KU32 i = 0; i < pHdr->cThreads; i++) + { + KPRF_TYPE(P,THREAD) pCur = &paThread[i]; + switch (pCur->enmState) + { + /* these states needs no work. */ + case KPRF_TYPE(,THREADSTATE_TERMINATED): + case KPRF_TYPE(,THREADSTATE_UNUSED): + default: + break; + + /* these are active and requires unwinding.*/ + case KPRF_TYPE(,THREADSTATE_ACTIVE): + case KPRF_TYPE(,THREADSTATE_SUSPENDED): + case KPRF_TYPE(,THREADSTATE_OVERFLOWED): + KPRF_NAME(TerminateThread)(pHdr, pCur, TS); + break; + } + } + + + /* + * Free the stacks. + */ + if (pHdr->offStacks) + { + /* only if the stack is at the end of the data set. */ + const KU32 cbStacks = KPRF_ALIGN(pHdr->cMaxStacks * pHdr->cbStack, 32); + if (pHdr->offStacks + cbStacks == pHdr->cb) + pHdr->cb -= cbStacks; + pHdr->offStacks = 0; + } + + return pHdr->cb; +} + + +/** + * Sets the commandline. + * + * This is typically done after TerminateAll, when the stacks has + * been freed up and there is plenty free space. + * + * @returns The new data set size. (pHdr->cb) + * @param pHdr The profiler data set header. + * @param cArgs The number of arguments in the array. + * @param papszArgs Pointer to an array of arguments. + */ +KPRF_DECL_FUNC(KU32, SetCommandLine)(KPRF_TYPE(P,HDR) pHdr, unsigned cArgs, const char * const *papszArgs) +{ + if (!pHdr) + return 0; + + /* + * Any space at all? + */ + if (pHdr->cb + 16 > pHdr->cbAllocated) /* 16 bytes min */ + return pHdr->cb; + + /* + * Encode untill we run out of space. + */ + pHdr->offCommandLine = pHdr->cb; + char *psz = (char *)pHdr + pHdr->cb; + char *pszMax = (char *)pHdr + pHdr->cbAllocated - 1; + for (unsigned i = 0; i < cArgs && psz + 7 < pszMax; i++) + { + if (i > 0) + *psz++ = ' '; + *psz++ = '\''; + const char *pszArg = papszArgs[i]; + while (psz < pszMax) + { + char ch = *pszArg++; + if (!ch) + break; + if (ch == '\'') + { + if (psz + 1 >= pszMax) + break; + *psz++ = '\\'; + } + *psz++ = ch; + } + if (psz < pszMax) + *psz++ = '\''; + } + *psz++ = '\0'; + pHdr->cb = psz - (char *)pHdr; + pHdr->cchCommandLine = pHdr->cb - pHdr->offCommandLine - 1; + + return pHdr->cb; +} + + diff --git a/src/lib/kStuff/kProfiler2/prfreader.cpp.h b/src/lib/kStuff/kProfiler2/prfreader.cpp.h new file mode 100644 index 0000000..412e289 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfreader.cpp.h @@ -0,0 +1,1602 @@ +/* $Id: prfreader.cpp.h 77 2016-06-22 17:03:55Z bird $ */ +/** @file + * kProfiler Mark 2 - Reader Code Template. + */ + +/* + * Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Validates the non-header parts of a data-set. + * + * @returns true if valid. + * @returns false if invalid. (written description to pOut) + * + * @param pHdr Pointer to the data set. + * @param cb The size of the data set. + * @param pOut Where to write error messages. + */ +static bool KPRF_NAME(IsValid)(KPRF_TYPE(PC,HDR) pHdr, KU32 cb, FILE *pOut) +{ + KPRF_TYPE(,UPTR) uMaxPtr = ~(KPRF_TYPE(,UPTR))0 - pHdr->uBasePtr; + + /* + * Iterate the module segments. + */ + KU32 off = pHdr->offModSegs; + while (off < pHdr->offModSegs + pHdr->cbModSegs) + { + KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(PC,MODSEG, off, pHdr); + KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]); + cbCur = KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR)); + if (cbCur + off > pHdr->offModSegs + pHdr->cbModSegs) + { + fprintf(pOut, "The module segment record at 0x%x is too long!\n", off); + return false; + } + if (pCur->uBasePtr > uMaxPtr) + fprintf(pOut, "warning: The module segment record at 0x%x has a too high base address.\n", off); + + if (strlen(pCur->szPath) != pCur->cchPath) + { + fprintf(pOut, "The module segment record at 0x%x has an invalid path length 0x%x it the actual length is 0x%x\n", + off, pCur->cchPath, strlen(pCur->szPath)); + return false; + } + + /* next */ + off += cbCur; + } + + + /* + * Iterate the functions. + */ + KPRF_TYPE(PC,FUNC) paFuncs = KPRF_OFF2PTR(PC,FUNC, pHdr->offFunctions, pHdr); + for (KU32 i = 0; i < pHdr->cFunctions; i++) + { + KPRF_TYPE(PC,FUNC) pCur = &paFuncs[i]; + if (pCur->uEntryPtr > uMaxPtr) + fprintf(pOut, "warning: Function 0x%x has a too high base address.\n", i); + if (pCur->offModSeg) + { + if ( pCur->offModSeg < pHdr->offModSegs + || pCur->offModSeg >= pHdr->offModSegs + pHdr->cbModSegs + || pCur->offModSeg != KPRF_ALIGN(pCur->offModSeg, sizeof(pCur->uEntryPtr)) + ) + { + fprintf(pOut, "Function 0x%x has an invalid offModSeg value (0x%x).\n", i, pCur->offModSeg); + return false; + } + /** @todo more validation here.. */ + } + } + + + /* + * Validate the threads. + */ + KPRF_TYPE(PC,THREAD) paThreads = KPRF_OFF2PTR(PC,THREAD, pHdr->offThreads, pHdr); + for (KU32 i = 0; i < pHdr->cThreads; i++) + { + KPRF_TYPE(PC,THREAD) pCur = &paThreads[i]; + if (pCur->uStackBasePtr > uMaxPtr) + fprintf(pOut, "warning: Thread 0x%x has a too high base address.\n", i); + switch (pCur->enmState) + { + case KPRF_TYPE(,THREADSTATE_ACTIVE): + case KPRF_TYPE(,THREADSTATE_SUSPENDED): + case KPRF_TYPE(,THREADSTATE_OVERFLOWED): + case KPRF_TYPE(,THREADSTATE_TERMINATED): + break; + default: + fprintf(pOut, "Thread 0x%x has an invalid state value (0x%x).\n", i, pCur->enmState); + return false; + } + } + + + return true; +} + + +/** + * Dumps a file of a particular format. + * + * @returns 0 on success. (you might want to check the pOut state) + * @returns -1 on failure. + * + * @param pHdr Pointer to the data set. + * @param pOut The output file. This is opened for text writing. + * @param pReader The reader object. + */ +static int KPRF_NAME(Dump)(KPRF_TYPE(PC,HDR) pHdr, FILE *pOut) +{ + /* + * Any commandline? + */ + if (pHdr->offCommandLine) + fprintf(pOut, + "Commandline: %s (%d bytes)\n", + (char *)KPRF_OFF2PTR(PC,MODSEG, pHdr->offCommandLine, pHdr), /* stupid, stupid, type hacking. */ + pHdr->cchCommandLine); + + /* + * Dump the module segments. + */ + fprintf(pOut, + "Module Segments: off=0x%x 0x%x/0x%x (bytes)\n" + "----------------\n", + pHdr->offModSegs, pHdr->cbModSegs, pHdr->cbMaxModSegs); + KU32 off = pHdr->offModSegs; + while (off < pHdr->offModSegs + pHdr->cbModSegs) + { + KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(PC,MODSEG, off, pHdr); + KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]); + cbCur = KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR)); + + fprintf(pOut, + "0x%04x: iSegment=0x%08x uBasePtr=%" KPRF_FMT_UPTR " szPath='%s' (%d bytes)\n", + off, pCur->iSegment, pCur->uBasePtr, pCur->szPath, pCur->cchPath); + + /* next */ + off += cbCur; + } + fprintf(pOut, "\n"); + + /* + * Dump the functions. + */ + fprintf(pOut, + "Functions: off=0x%x 0x%x/0x%x\n" + "----------\n", + pHdr->offFunctions, pHdr->cFunctions, pHdr->cMaxFunctions); + KPRF_TYPE(PC,FUNC) paFuncs = KPRF_OFF2PTR(PC,FUNC, pHdr->offFunctions, pHdr); + for (KU32 i = 0; i < pHdr->cFunctions; i++) + { + KPRF_TYPE(PC,FUNC) pCur = &paFuncs[i]; + fprintf(pOut, "0x%04x: uEntryPtr=%" KPRF_FMT_UPTR " cOnStack=0x%" KPRF_FMT_X64 " cCalls=0x%" KPRF_FMT_X64 "\n" + " OnStack={0x%" KPRF_FMT_X64 ", 0x%" KPRF_FMT_X64 ", 0x%" KPRF_FMT_X64 "}\n" + " OnTopOfStack={0x%" KPRF_FMT_X64 ", 0x%" KPRF_FMT_X64 ", 0x%" KPRF_FMT_X64 "}\n", + i, pCur->uEntryPtr, pCur->cOnStack, pCur->cCalls, + pCur->OnStack.MinTicks, pCur->OnStack.MaxTicks, pCur->OnStack.SumTicks, + pCur->OnTopOfStack.MinTicks, pCur->OnTopOfStack.MaxTicks, pCur->OnTopOfStack.SumTicks); + if (pCur->offModSeg) + { + KPRF_TYPE(PC,MODSEG) pModSeg = KPRF_OFF2PTR(PC,MODSEG, pCur->offModSeg, pHdr); + fprintf(pOut, " offModSeg=0x%08x iSegment=0x%02x uBasePtr=%" KPRF_FMT_UPTR " szPath='%s' (%d bytes)\n", + pCur->offModSeg, pModSeg->iSegment, pModSeg->uBasePtr, pModSeg->szPath, pModSeg->cchPath); + +#if 1 + PKDBGMOD pMod; + int rc = kDbgModuleOpen(&pMod, pModSeg->szPath, NULL /* pLdrMod */); + if (!rc) + { + KDBGSYMBOL Sym; + rc = kDbgModuleQuerySymbol(pMod, pModSeg->iSegment, pCur->uEntryPtr - pModSeg->uBasePtr, &Sym); + if (!rc) + { + fprintf(pOut, " %s\n", Sym.szName); + } + kDbgModuleClose(pMod); + } +#endif + + } + } + fprintf(pOut, "\n"); + + /* + * Dump the threads. + */ + fprintf(pOut, + "Threads: off=0x%x 0x%x/0x%x (Stacks=0x%x/0x%x cMaxStackFrames=0x%x)\n" + "--------\n", + pHdr->offThreads, pHdr->cThreads, pHdr->cMaxThreads, pHdr->cStacks, pHdr->cMaxStacks, pHdr->cMaxStackFrames); + KPRF_TYPE(PC,THREAD) paThreads = KPRF_OFF2PTR(PC,THREAD, pHdr->offThreads, pHdr); + for (KU32 i = 0; i < pHdr->cThreads; i++) + { + KPRF_TYPE(PC,THREAD) pCur = &paThreads[i]; + fprintf(pOut, + "0x%02x: ThreadId=0x%08" KPRF_FMT_X64 " enmState=%d szName='%s'\n" + " uStackBasePtr=%" KPRF_FMT_UPTR " cbMaxStack=%" KPRF_FMT_UPTR "\n" + " cCalls=0x%" KPRF_FMT_X64 " cOverflows=0x%" KPRF_FMT_X64 " cStackSwitchRejects=0x%" KPRF_FMT_X64 "\n" + " cUnwinds=0x%" KPRF_FMT_X64 " ProfiledTicks=0x%" KPRF_FMT_X64 " OverheadTicks=0x%" KPRF_FMT_X64 "\n", + i, pCur->ThreadId, pCur->enmState, pCur->szName, + pCur->uStackBasePtr, pCur->cbMaxStack, + pCur->cCalls, pCur->cOverflows, pCur->cStackSwitchRejects, + pCur->cUnwinds, pCur->ProfiledTicks, pCur->OverheadTicks); + } + + return 0; +} + + +/** Pointer to a report module. + * @internal */ +typedef struct KPRF_TYPE(,REPORTMOD) *KPRF_TYPE(P,REPORTMOD); +/** Pointer to a report module segment. + * @internal */ +typedef struct KPRF_TYPE(,REPORTMODSEG) *KPRF_TYPE(P,REPORTMODSEG); + + +/** + * A report module segment. + * + * @internal + */ +typedef struct KPRF_TYPE(,REPORTMODSEG) +{ + /** AVL node core. The key is the data set offset of the module segment record. */ + KDBGADDR offSegment; + struct KPRF_TYPE(,REPORTMODSEG) *mpLeft; /**< AVL left branch. */ + struct KPRF_TYPE(,REPORTMODSEG) *mpRight; /**< AVL rigth branch. */ + /** Pointer to the next segment for the module. */ + KPRF_TYPE(P,REPORTMODSEG) pNext; + /** Pointer to the module segment data in the data set. */ + KPRF_TYPE(PC,MODSEG) pModSeg; + /** Pointer to the module this segment belongs to. */ + KPRF_TYPE(P,REPORTMOD) pMod; + /** The time this segment has spent on the stack.. */ + KU64 OnStackTicks; + /** The time this segment has spent on the top of the stack.. */ + KU64 OnTopOfStackTicks; + /** The number of profiled functions from this segment. */ + KU32 cFunctions; + KU8 mHeight; /**< AVL Subtree height. */ +} KPRF_TYPE(,REPORTMODSEG), *KPRF_TYPE(P,REPORTMODSEG); + + +/** + * A report module segment. + * + * @internal + */ +typedef struct KPRF_TYPE(,REPORTMOD) +{ + /** The module number. */ + KU32 iMod; + /** Pointer to the next module in the list. */ + KPRF_TYPE(P,REPORTMOD) pNext; + /** Pointer to the list of segments belonging to this module. */ + KPRF_TYPE(P,REPORTMODSEG) pFirstSeg; + /** The debug module handle. */ + PKDBGMOD pDbgMod; + /** The time this segment has spent on the stack.. */ + KU64 OnStackTicks; + /** The time this segment has spent on the top of the stack.. */ + KU64 OnTopOfStackTicks; + /** The number of profiled functions from this segment. */ + KU32 cFunctions; +} KPRF_TYPE(,REPORTMOD), *KPRF_TYPE(P,REPORTMOD); + + +/** + * A report function. + * + * @internal + */ +typedef struct KPRF_TYPE(,REPORTFUNC) +{ + /** Pointer to the function data in the data set. */ + KPRF_TYPE(PC,FUNC) pFunc; + /** Pointer to the module segment this function belongs to. (can be NULL) */ + KPRF_TYPE(P,REPORTMODSEG) pModSeg; + /** Pointer to the function symbol. */ + PKDBGSYMBOL pSym; + /** Pointer to the function line number. */ + PKDBGLINE pLine; +} KPRF_TYPE(,REPORTFUNC), *KPRF_TYPE(P,REPORTFUNC); + + +/** + * Compares two REPROTFUNC records to determin which has the higher on-stack time. + */ +static int KPRF_NAME(FuncCompareOnStack)(const void *pv1, const void *pv2) +{ + KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; + KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; + if (p1->OnStack.SumTicks > p2->OnStack.SumTicks) + return -1; + if (p1->OnStack.SumTicks < p2->OnStack.SumTicks) + return 1; + if (p1->OnStack.MaxTicks > p2->OnStack.MaxTicks) + return -1; + if (p1->OnStack.MaxTicks < p2->OnStack.MaxTicks) + return 1; + if (p1->OnStack.MinTicks > p2->OnStack.MinTicks) + return -1; + if (p1->OnStack.MinTicks < p2->OnStack.MinTicks) + return 1; + if (p1 < p2) + return -1; + return 1; +} + + +/** + * Compares two REPROTFUNC records to determin which has the higher on-stack average time. + */ +static int KPRF_NAME(FuncCompareOnStackAvg)(const void *pv1, const void *pv2) +{ + KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; + KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; + if (p1->OnStack.SumTicks / p1->cOnStack > p2->OnStack.SumTicks / p2->cOnStack) + return -1; + if (p1->OnStack.SumTicks / p1->cOnStack < p2->OnStack.SumTicks / p2->cOnStack) + return 1; + return KPRF_NAME(FuncCompareOnStack)(pv1, pv2); +} + + +/** + * Compares two REPROTFUNC records to determin which has the higher on-stack min time. + */ +static int KPRF_NAME(FuncCompareOnStackMin)(const void *pv1, const void *pv2) +{ + KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; + KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; + if (p1->OnStack.MinTicks > p2->OnStack.MinTicks) + return -1; + if (p1->OnStack.MinTicks < p2->OnStack.MinTicks) + return 1; + return KPRF_NAME(FuncCompareOnStack)(pv1, pv2); +} + + +/** + * Compares two REPROTFUNC records to determin which has the higher on-stack max time. + */ +static int KPRF_NAME(FuncCompareOnStackMax)(const void *pv1, const void *pv2) +{ + KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; + KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; + if (p1->OnStack.MaxTicks > p2->OnStack.MaxTicks) + return -1; + if (p1->OnStack.MaxTicks < p2->OnStack.MaxTicks) + return 1; + return KPRF_NAME(FuncCompareOnStack)(pv1, pv2); +} + + +/** + * Compares two REPROTFUNC records to determin which has the higher on-stack time. + */ +static int KPRF_NAME(FuncCompareOnTopOfStack)(const void *pv1, const void *pv2) +{ + KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; + KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; + if (p1->OnTopOfStack.SumTicks > p2->OnTopOfStack.SumTicks) + return -1; + if (p1->OnTopOfStack.SumTicks < p2->OnTopOfStack.SumTicks) + return 1; + if (p1->OnTopOfStack.MaxTicks > p2->OnTopOfStack.MaxTicks) + return -1; + if (p1->OnTopOfStack.MaxTicks < p2->OnTopOfStack.MaxTicks) + return 1; + if (p1->OnTopOfStack.MinTicks > p2->OnTopOfStack.MinTicks) + return -1; + if (p1->OnTopOfStack.MinTicks < p2->OnTopOfStack.MinTicks) + return 1; + if (p1 < p2) + return -1; + return 1; +} + + +/** + * Compares two REPROTFUNC records to determin which has the higher on-stack average time. + */ +static int KPRF_NAME(FuncCompareOnTopOfStackAvg)(const void *pv1, const void *pv2) +{ + KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; + KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; + if (p1->OnTopOfStack.SumTicks / p1->cOnStack > p2->OnTopOfStack.SumTicks / p2->cOnStack) + return -1; + if (p1->OnTopOfStack.SumTicks / p1->cOnStack < p2->OnTopOfStack.SumTicks / p2->cOnStack) + return 1; + return KPRF_NAME(FuncCompareOnTopOfStack)(pv1, pv2); +} + + +/** + * Compares two REPROTFUNC records to determin which has the higher on-stack min time. + */ +static int KPRF_NAME(FuncCompareOnTopOfStackMin)(const void *pv1, const void *pv2) +{ + KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; + KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; + if (p1->OnTopOfStack.MinTicks > p2->OnTopOfStack.MinTicks) + return -1; + if (p1->OnTopOfStack.MinTicks < p2->OnTopOfStack.MinTicks) + return 1; + return KPRF_NAME(FuncCompareOnTopOfStack)(pv1, pv2); +} + + +/** + * Compares two REPROTFUNC records to determin which has the higher on-stack min time. + */ +static int KPRF_NAME(FuncCompareOnTopOfStackMax)(const void *pv1, const void *pv2) +{ + KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; + KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; + if (p1->OnTopOfStack.MaxTicks > p2->OnTopOfStack.MaxTicks) + return -1; + if (p1->OnTopOfStack.MaxTicks < p2->OnTopOfStack.MaxTicks) + return 1; + return KPRF_NAME(FuncCompareOnTopOfStack)(pv1, pv2); +} + + +/** + * Compares two REPROTFUNC records to determin which has the higher call to count. + */ +static int KPRF_NAME(FuncCompareCallsTo)(const void *pv1, const void *pv2) +{ + KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; + KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; + if (p1->cOnStack > p2->cOnStack) + return -1; + if (p1->cOnStack < p2->cOnStack) + return 1; + return KPRF_NAME(FuncCompareOnStack)(pv1, pv2); +} + + +/** + * Compares two REPROTFUNC records to determin which has the higher call from count. + */ +static int KPRF_NAME(FuncCompareCallsFrom)(const void *pv1, const void *pv2) +{ + KPRF_TYPE(PC,FUNC) p1 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv1)->pFunc; + KPRF_TYPE(PC,FUNC) p2 = (*(KPRF_TYPE(P,REPORTFUNC) *)pv2)->pFunc; + if (p1->cCalls > p2->cCalls) + return -1; + if (p1->cCalls < p2->cCalls) + return 1; + return KPRF_NAME(FuncCompareOnTopOfStack)(pv1, pv2); +} + + +/** + * A report thread. + * + * @internal + */ +typedef struct KPRF_TYPE(,REPORTTHREAD) +{ + /** Pointer to the thread data in the data set. */ + KPRF_TYPE(PC,THREAD) pThread; +} KPRF_TYPE(,REPORTTHREAD), *KPRF_TYPE(P,REPORTTHREAD); + + +/** + * Data-set analysis report. + * + * This is an internal structure to store temporary data between the + * analysis stage and the priting state. + * + * @internal + */ +typedef struct KPRF_TYPE(,REPORT) +{ + /** Pointer to the data set. */ + KPRF_TYPE(PC,HDR) pHdr; + + /** @name Data-set item wrappers. + * @{ */ + /** Pointer to the array of threads. */ + KPRF_TYPE(P,REPORTTHREAD) paThreads; + /** Pointer to the array of functions. */ + KPRF_TYPE(P,REPORTFUNC) paFunctions; + /** Pointer to the head of the module list. */ + KPRF_TYPE(P,REPORTMOD) pFirstMod; + /** The number of modules in the list. */ + KU32 cMods; + /** The module segment tree. (Only kAvl cares about this.) */ + KPRF_TYPE(P,REPORTMODSEG) pModSegTree; + /** The number of module segments in the tree. */ + KU32 cModSegs; + /** @} */ + + /** @name Sorting. + * @{ */ + /** Pointer to the array of threads. */ + KPRF_TYPE(P,REPORTTHREAD) *papSortedThreads; + /** Pointer to the array of functions. */ + KPRF_TYPE(P,REPORTFUNC) *papSortedFunctions; + /** @} */ + + /** @name Accumulated Thread Data. + * @{ */ + /** Sum of the profiled ticks. */ + KU64 ProfiledTicks; + /** Sum of the overhead ticks. */ + KU64 OverheadTicks; + /** Sum of the sleep ticks. */ + KU64 SleepTicks; + /** Sum of calls performed. */ + KU64 cCalls; + /** @} */ + +} KPRF_TYPE(,REPORT), *KPRF_TYPE(P,REPORT), **KPRF_TYPE(PP,REPORT); + + +/* Instantiate the AVL tree code. */ +#define KAVL_CHECK_FOR_EQUAL_INSERT +#define KAVL_MAX_STACK 32 +#define KAVL_STD_KEY_COMP +#define mKey offSegment +#define KAVLKEY KDBGADDR +#define KAVLNODE KPRF_TYPE(,REPORTMODSEG) +#define mpRoot pModSegTree +#define KAVLROOT KPRF_TYPE(,REPORT) +#define KAVL_FN(name) KPRF_NAME(ReportTree ## name) +#define KAVL_TYPE(prefix,name) KPRF_TYPE(prefix, REPORTMODESEG ## name) +#define KAVL_INT(name) KPRF_NAME(REPORTMODESEGINT ## name) +#define KAVL_DECL(type) K_DECL_INLINE(type) +#include <k/kAvlTmpl/kAvlBase.h> +#include <k/kAvlTmpl/kAvlDestroy.h> +#include <k/kAvlTmpl/kAvlGet.h> +#include <k/kAvlTmpl/kAvlUndef.h> + + +/** + * Allocates and initializes a report. + * + * @returns Pointer to the report on success. + * @returns NULL on failure. + */ +static KPRF_TYPE(P,REPORT) KPRF_NAME(NewReport)(KPRF_TYPE(PC,HDR) pHdr) +{ + /* + * Allocate memory for the report. + * Everything but the mods and modsegs is allocated in the same block as the report. + */ + KSIZE cb = KPRF_ALIGN(KPRF_SIZEOF(REPORT), 32); + KUPTR offThreads = cb; + cb += KPRF_ALIGN(KPRF_SIZEOF(REPORTTHREAD) * pHdr->cThreads, 32); + KUPTR offFunctions = cb; + cb += KPRF_ALIGN(KPRF_SIZEOF(REPORTFUNC) * pHdr->cFunctions, 32); + KUPTR offSortedThreads = cb; + cb += KPRF_ALIGN(sizeof(KPRF_TYPE(P,REPORTTHREAD)) * pHdr->cThreads, 32); + KUPTR offSortedFunctions = cb; + cb += KPRF_ALIGN(sizeof(KPRF_TYPE(P,REPORTFUNC)) * pHdr->cFunctions, 32); + KPRF_TYPE(P,REPORT) pReport = (KPRF_TYPE(P,REPORT))malloc(cb); + if (!pReport) + return NULL; + + /* + * Initialize it. + */ + pReport->pHdr = pHdr; + pReport->paThreads = (KPRF_TYPE(P,REPORTTHREAD))((KU8 *)pReport + offThreads); + pReport->paFunctions = (KPRF_TYPE(P,REPORTFUNC))((KU8 *)pReport + offFunctions); + pReport->pFirstMod = NULL; + pReport->cMods = 0; + KPRF_NAME(ReportTreeInit)(pReport); + pReport->cModSegs = 0; + pReport->papSortedThreads = (KPRF_TYPE(P,REPORTTHREAD) *)((KU8 *)pReport + offSortedThreads); + pReport->papSortedFunctions = (KPRF_TYPE(P,REPORTFUNC) *)((KU8 *)pReport + offSortedFunctions); + pReport->ProfiledTicks = 0; + pReport->OverheadTicks = 0; + pReport->SleepTicks = 0; + pReport->cCalls = 0; + + return pReport; +} + + +/** + * AVL callback for deleting a module segment node. + * + * @returns 0 + * @param pCore The tree node to delete. + * @param pvParam User parameter, ignored. + */ +static int KPRF_NAME(DeleteModSeg)(KPRF_TYPE(P,REPORTMODSEG) pCore, void *pvParam) +{ + free(pCore); + return 0; +} + + +/** + * Releases all the resources held be a report. + * + * @param pReport The report to delete. + */ +static void KPRF_NAME(DeleteReport)(KPRF_TYPE(P,REPORT) pReport) +{ + /* + * The list and AVL. + */ + while (pReport->pFirstMod) + { + KPRF_TYPE(P,REPORTMOD) pFree = pReport->pFirstMod; + pReport->pFirstMod = pFree->pNext; + kDbgModuleClose(pFree->pDbgMod); + free(pFree); + } + + KPRF_NAME(ReportTreeDestroy)(pReport, KPRF_NAME(DeleteModSeg), NULL); + + /* + * The function debug info. + */ + KU32 i = pReport->pHdr->cFunctions; + while (i-- > 0) + { + kDbgSymbolFree(pReport->paFunctions[i].pSym); + kDbgLineFree(pReport->paFunctions[i].pLine); + } + + /* + * The report it self. + */ + pReport->pHdr = NULL; + free(pReport); +} + + +/** + * Builds the module segment tree and the list of modules. + * + * @returns 0 on success. + * @returns -1 on failure. + * @param pReport The report to work on. + */ +static int KPRF_NAME(AnalyzeModSegs)(KPRF_TYPE(P,REPORT) pReport) +{ + const KU32 offEnd = pReport->pHdr->offModSegs + pReport->pHdr->cbModSegs; + KU32 off = pReport->pHdr->offModSegs; + while (off < offEnd) + { + KPRF_TYPE(PC,MODSEG) pCur = KPRF_OFF2PTR(PC,MODSEG, off, pReport->pHdr); + KU32 cbCur = KPRF_OFFSETOF(MODSEG, szPath[pCur->cchPath + 1]); + cbCur = KPRF_ALIGN(cbCur, KPRF_SIZEOF(UPTR)); + + /* + * Create a new modseg record. + */ + KPRF_TYPE(P,REPORTMODSEG) pSeg = (KPRF_TYPE(P,REPORTMODSEG))malloc(sizeof(*pSeg)); + if (!pSeg) + return -1; + + pSeg->offSegment = off; + pSeg->pModSeg = pCur; + pSeg->pMod = NULL; /* below */ + pSeg->OnStackTicks = 0; + pSeg->OnTopOfStackTicks = 0; + pSeg->cFunctions = 0; + + if (!KPRF_NAME(ReportTreeInsert)(pReport, pSeg)) + { + free(pSeg); + return -1; + } + pReport->cModSegs++; + + /* + * Search for the module record. + */ + KPRF_TYPE(P,REPORTMOD) pMod = pReport->pFirstMod; + while ( pMod + && ( pMod->pFirstSeg->pModSeg->cchPath != pCur->cchPath + || memcmp(pMod->pFirstSeg->pModSeg->szPath, pCur->szPath, pCur->cchPath))) + pMod = pMod->pNext; + if (pMod) + { + /** @todo sort segments */ + pSeg->pMod = pMod; + pSeg->pNext = pMod->pFirstSeg; + pMod->pFirstSeg = pSeg; + } + else + { + KPRF_TYPE(P,REPORTMOD) pMod = (KPRF_TYPE(P,REPORTMOD))malloc(sizeof(*pMod) + pCur->cchPath); + if (!pMod) + return -1; + pSeg->pMod = pMod; + pSeg->pNext = NULL; + pMod->iMod = pReport->cMods++; + pMod->pNext = pReport->pFirstMod; + pReport->pFirstMod = pMod; + pMod->pFirstSeg = pSeg; + pMod->pDbgMod = NULL; + pMod->OnStackTicks = 0; + pMod->OnTopOfStackTicks = 0; + pMod->cFunctions = 0; + + int rc = kDbgModuleOpen(&pMod->pDbgMod, pSeg->pModSeg->szPath, NULL /* kLdrMod */); + if (rc) + pMod->pDbgMod = NULL; + } + + /* next */ + off += cbCur; + } + + return 0; +} + + +/** + * Initializes the function arrays. + * + * @returns 0 on success. + * @returns -1 on failure. + * @param pReport The report to work on. + */ +static int KPRF_NAME(AnalyseFunctions)(KPRF_TYPE(P,REPORT) pReport) +{ + KU32 iFunc = pReport->pHdr->cFunctions; + KPRF_TYPE(PC,FUNC) pFunc = KPRF_OFF2PTR(PC,FUNC, pReport->pHdr->offFunctions + iFunc * sizeof(*pFunc), pReport->pHdr); + KPRF_TYPE(P,REPORTFUNC) pReportFunc = &pReport->paFunctions[iFunc]; + while (iFunc-- > 0) + { + pFunc--; + pReportFunc--; + + pReport->papSortedFunctions[iFunc] = pReportFunc; + pReportFunc->pFunc = pFunc; + pReportFunc->pModSeg = KPRF_NAME(ReportTreeGet)(pReport, pFunc->offModSeg); + pReportFunc->pSym = NULL; + pReportFunc->pLine = NULL; + if (pReportFunc->pModSeg) + { + /* Collect module segment and module statistics. */ + KPRF_TYPE(P,REPORTMODSEG) pModSeg = pReportFunc->pModSeg; + pModSeg->cFunctions++; + pModSeg->OnStackTicks += pFunc->OnStack.SumTicks; + pModSeg->OnTopOfStackTicks += pFunc->OnTopOfStack.SumTicks; + + KPRF_TYPE(P,REPORTMOD) pMod = pModSeg->pMod; + pMod->cFunctions++; + pMod->OnStackTicks += pFunc->OnStack.SumTicks; + pMod->OnTopOfStackTicks += pFunc->OnTopOfStack.SumTicks; + + /* Get debug info. */ + KDBGADDR offSegment = pFunc->uEntryPtr - pModSeg->pModSeg->uBasePtr; + int rc = kDbgModuleQuerySymbolA(pMod->pDbgMod, pModSeg->pModSeg->iSegment, offSegment, &pReportFunc->pSym); + /** @todo check displacement! */ + if (rc) + pReportFunc->pSym = NULL; + rc = kDbgModuleQueryLineA(pMod->pDbgMod, pModSeg->pModSeg->iSegment, offSegment, &pReportFunc->pLine); + if (rc) + pReportFunc->pLine = NULL; + } + } + return 0; +} + + +/** + * Initializes the thread arrays. + * + * @returns 0 on success. + * @returns -1 on failure. + * @param pReport The report to work on. + */ +static int KPRF_NAME(AnalyseThreads)(KPRF_TYPE(P,REPORT) pReport) +{ + KU32 iThread = pReport->pHdr->cThreads; + KPRF_TYPE(PC,THREAD) pThread = KPRF_OFF2PTR(PC,THREAD, pReport->pHdr->offThreads + iThread * sizeof(*pThread), pReport->pHdr); + KPRF_TYPE(P,REPORTTHREAD) pReportThread = &pReport->paThreads[iThread]; + while (iThread-- > 0) + { + pThread--; + pReportThread--; + + pReport->papSortedThreads[iThread] = pReportThread; + pReportThread->pThread = pThread; + + /* collect statistics */ + pReport->ProfiledTicks += pThread->ProfiledTicks; + pReport->OverheadTicks += pThread->OverheadTicks; + pReport->SleepTicks += pThread->SleepTicks; + pReport->cCalls += pThread->cCalls; + + } + return 0; +} + + +/** + * Analyses the data set, producing a report. + * + * @returns 0 on success. + * @returns -1 on failure. + * + * @param pHdr The data set. + * @param ppReport Where to store the report. + */ +static int KPRF_NAME(Analyse)(KPRF_TYPE(PC,HDR) pHdr, KPRF_TYPE(PP,REPORT) ppReport) +{ + *ppReport = NULL; + + /* allocate it */ + KPRF_TYPE(P,REPORT) pReport = KPRF_NAME(NewReport)(pHdr); + if (!pReport) + return -1; + + /* read module segments */ + int rc = KPRF_NAME(AnalyzeModSegs)(pReport); + if (!rc) + { + /* read functions. */ + rc = KPRF_NAME(AnalyseFunctions)(pReport); + if (!rc) + { + /* read threads */ + rc = KPRF_NAME(AnalyseThreads)(pReport); + if (!rc) + { + *ppReport = pReport; + return 0; + } + } + } + + KPRF_NAME(DeleteReport)(pReport); + return rc; +} + + +/** + * Writes row with 32-bit value. + * @internal + */ +static void KPRF_NAME(HtmlWriteRowU32X32)(FILE *pOut, const char *pszName, KU32 u32, const char *pszUnit) +{ + fprintf(pOut, + " <tr>\n" + " <th>%s</th>\n" + " <td colspan=\"6\">%u (0x%x)%s%s</td>\n" + " </tr>\n", + pszName, + u32, u32, pszUnit ? " " : "", pszUnit ? pszUnit : ""); +} + + +/** + * Writes row with 32-bit value. + * @internal + */ +static void KPRF_NAME(HtmlWriteRowU32)(FILE *pOut, const char *pszName, KU32 u32, const char *pszUnit) +{ + fprintf(pOut, + " <tr>\n" + " <th>%s</th>\n" + " <td colspan=\"6\">%u%s%s</td>\n" + " </tr>\n", + pszName, + u32, pszUnit ? " " : "", pszUnit ? pszUnit : ""); +} + + +/** + * Writes row with 64-bit value. + * @internal + */ +static void KPRF_NAME(HtmlWriteRowU64)(FILE *pOut, const char *pszName, KU64 u64, const char *pszUnit) +{ + fprintf(pOut, + " <tr>\n" + " <th>%s</th>\n" + " <td colspan=\"6\">% " KPRF_FMT_U64 " (0x%" KPRF_FMT_X64 ")%s%s</td>\n" + " </tr>\n", + pszName, + u64, u64, pszUnit ? " " : "", pszUnit ? pszUnit : ""); +} + + +/** + * Writes row with 64-bit hex value. + * @internal + */ +static void KPRF_NAME(HtmlWriteRowX64)(FILE *pOut, const char *pszName, KU64 u64, const char *pszUnit) +{ + fprintf(pOut, + " <tr>\n" + " <th>%s</th>\n" + " <td colspan=\"6\">0x%" KPRF_FMT_X64 "%s%s</td>\n" + " </tr>\n", + pszName, + u64, pszUnit ? " " : "", pszUnit ? pszUnit : ""); +} + + +/** + * Writes a ticks. + */ +static void KPRF_NAME(HtmlWriteParts)(FILE *pOut, KU64 cTicks, KU64 cTotalTicks) +{ + /** U+2030 PER MILLE SIGN */ + static const KU8 s_szPerMilleSignUtf8[4] = { 0xe2, 0x80, 0xb0, 0}; + + if (cTicks * 100 / cTotalTicks) + { + KU32 u = (KU32)((cTicks * 1000) / cTotalTicks); + fprintf(pOut, "%u.%01u%%", u / 10, u %10); + } + else //if (cTicks * 100000 / cTotalTicks) + { + KU32 u = (KU32)((cTicks * 100000) / cTotalTicks); + fprintf(pOut, "%u.%02u%s", u / 100, u % 100, s_szPerMilleSignUtf8); + } + /* + else if (cTicks * 1000000 / cTotalTicks) + fprintf(pOut, "%u ppm", (unsigned)((cTicks * 1000000) / cTotalTicks)); + else + fprintf(pOut, "%u ppb", (unsigned)((cTicks * 1000000000) / cTotalTicks)); + */ +} + + +/** + * Writes a ticks. + */ +static void KPRF_NAME(HtmlWriteTicks)(FILE *pOut, KU64 cTicks, KU64 cTotalTicks) +{ + fprintf(pOut, "%" KPRF_FMT_U64 "", cTicks); + if (cTotalTicks) + { + fprintf(pOut, "</td><td class=\"PartsRow\">"); + KPRF_NAME(HtmlWriteParts)(pOut, cTicks, cTotalTicks); + } +} + + +/** + * Writes row with ticks value. + * + * @param pOut Where to write. + * @aaran pszName The row name. + * @param cTicks The tick count. + * @param cTotalTicks If non-zero, this is used for cTicks / cTotalTicks. + * @internal + */ +static void KPRF_NAME(HtmlWriteRowTicks)(FILE *pOut, const char *pszName, KU64 cTicks, KU64 cTotalTicks) +{ + fprintf(pOut, + " <tr>\n" + " <th class=\"TicksRow\">%s</th>\n" + " <td class=\"TicksRow\">", + pszName); + KPRF_NAME(HtmlWriteTicks)(pOut, cTicks, cTotalTicks); + fprintf(pOut, + "</td><td colspan=\"%d\"/>\n" + " </tr>\n", + cTotalTicks ? 4 : 5); +} + + +/** + * Writes row with a time stat value. + * + * @param pOut Where to write. + * @aaran pszName The row name. + * @param cTicks The tick count. + * @param cTotalTicks If non-zero, this is used for cTicks / cTotalTicks. + * @internal + */ +static void KPRF_NAME(HtmlWriteRowTimeStat)(FILE *pOut, const char *pszName, KPRF_TYPE(PC,TIMESTAT) pTimeStat, KU64 cTotalTicks) +{ + fprintf(pOut, + " <tr>\n" + " <th class=\"TicksRow\">%s</th>\n" + " <td class=\"TicksRow\">", + pszName); + KPRF_NAME(HtmlWriteTicks)(pOut, pTimeStat->SumTicks, cTotalTicks); + fprintf(pOut, "</td>\n" + " <td class=\"MinMaxTicksRow\">"); + KPRF_NAME(HtmlWriteTicks)(pOut, pTimeStat->MinTicks, cTotalTicks); + fprintf(pOut, "</td>\n" + " <td class=\"MinMaxTicksRow\">"); + KPRF_NAME(HtmlWriteTicks)(pOut, pTimeStat->MaxTicks, cTotalTicks); + fprintf(pOut, "</td>\n" + " </tr>\n"); +} + + +/** + * Writes row with calls value. + * + * @param pOut Where to write. + * @aaran pszName The row name. + * @param cCalls The call count. + * @param cTotalCalls This is used for cCalls / cTotalCalls. + * @internal + */ +static void KPRF_NAME(HtmlWriteRowCalls)(FILE *pOut, const char *pszName, KU64 cCalls, KU64 cTotalCalls) +{ + fprintf(pOut, + " <tr>\n" + " <th class=\"CallsRow\">%s</th>\n" + " <td class=\"CallsRow\">%" KPRF_FMT_U64"</td><td class=\"PartsRow\">", + pszName, cCalls); + KPRF_NAME(HtmlWriteParts)(pOut, cCalls, cTotalCalls); + fprintf(pOut, "</td><td colspan=4></td>" + " </tr>\n"); +} + + +/** + * Writes row with pointer value. + * @internal + */ +static void KPRF_NAME(HtmlWriteRowUPTR)(FILE *pOut, const char *pszName, KPRF_TYPE(,UPTR) uPtr, const char *pszUnit) +{ + fprintf(pOut, + " <tr>\n" + " <th>%s</th>\n" + " <td colspan=\"6\">%" KPRF_FMT_UPTR "%s%s</td>\n" + " </tr>\n", + pszName, + uPtr, pszUnit ? " " : "", pszUnit ? pszUnit : ""); +} + + +/** + * Writes row with string value. + * @internal + */ +static void KPRF_NAME(HtmlWriteRowString)(FILE *pOut, const char *pszName, const char *pszClass, const char *pszFormat, ...) +{ + fprintf(pOut, + " <tr>\n" + " <th>%s</th>\n" + " <td%s%s%s colspan=\"6\">", + pszName, + pszClass ? " class=\"" : "", pszClass ? pszClass : "", pszClass ? "\"" : ""); + va_list va; + va_start(va, pszFormat); + vfprintf(pOut, pszFormat, va); + va_end(va); + fprintf(pOut, "</td>\n" + " </tr>\n"); +} + + +/** + * The first column + */ +typedef enum KPRF_TYPE(,FIRSTCOLUMN) +{ + KPRF_TYPE(,FIRSTCOLUMN_ON_STACK) = 0, + KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK), + KPRF_TYPE(,FIRSTCOLUMN_CALLS_TO), + KPRF_TYPE(,FIRSTCOLUMN_CALLS_FROM), + KPRF_TYPE(,FIRSTCOLUMN_MAX) +} KPRF_TYPE(,FIRSTCOLUMN); + + +/** + * Prints the table with the sorted functions. + * The tricky bit is that the sorted column should be to the left of the function name. + */ +static void KPRF_NAME(HtmlWriteSortedFunctions)(KPRF_TYPE(P,REPORT) pReport, FILE *pOut, const char *pszName, + const char *pszTitle, KPRF_TYPE(,FIRSTCOLUMN) enmFirst) +{ + fprintf(pOut, + "<h2><a name=\"%s\">%s</a></h2>\n" + "\n", + pszName, pszTitle); + + fprintf(pOut, + "<table class=\"FunctionsSorted\">\n" + " <tr>\n" + " <th/>\n"); + static const char *s_pszHeaders[KPRF_TYPE(,FIRSTCOLUMN_MAX) * 2] = + { + " <th colspan=8><a href=\"#Functions-TimeOnStack\">Time On Stack</a> (ticks)</th>\n", + " <th colspan=2><a href=\"#Functions-TimeOnStack\">Sum</a></th>\n" + " <th colspan=2><a href=\"#Functions-TimeOnStack-Min\">Min</a></th>\n" + " <th colspan=2><a href=\"#Functions-TimeOnStack-Avg\">Average</a></th>\n" + " <th colspan=2><a href=\"#Functions-TimeOnStack-Max\">Max</a></th>\n", + + " <th colspan=8><a href=\"#Functions-TimeOnTopOfStack\">Time On To Top</a> (ticks)</th>\n", + " <th colspan=2><a href=\"#Functions-TimeOnTopOfStack\">Sum</a></th>\n" + " <th colspan=2><a href=\"#Functions-TimeOnTopOfStack-Min\">Min</a></th>\n" + " <th colspan=2><a href=\"#Functions-TimeOnTopOfStack-Avg\">Average</a></th>\n" + " <th colspan=2><a href=\"#Functions-TimeOnTopOfStack-Max\">Max</a></th>\n", + + " <th colspan=2><a href=\"#Functions-CallsTo\">Calls To</a></th>\n", + " <th/><th/>\n", + + " <th colspan=2><a href=\"#Functions-CallsFrom\">Calls From</a></th>\n", + " <th/><th/>\n", + }; + + fprintf(pOut, "%s", s_pszHeaders[enmFirst * 2]); + fprintf(pOut, " <th>Function</th>\n"); + for (unsigned i = (enmFirst + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX); i != enmFirst; i = (i + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX)) + fprintf(pOut, "%s", s_pszHeaders[i * 2]); + fprintf(pOut, + " </tr>\n" + " <tr>\n" + " <th/>\n"); + fprintf(pOut, "%s", s_pszHeaders[enmFirst * 2 + 1]); + fprintf(pOut, " <th/>\n"); + for (unsigned i = (enmFirst + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX); i != enmFirst; i = (i + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX)) + fprintf(pOut, "%s", s_pszHeaders[i * 2 + 1]); + fprintf(pOut, + " </tr>\n"); + + for (KU32 iFunc = 0; iFunc < pReport->pHdr->cFunctions; iFunc++) + { + KPRF_TYPE(P,REPORTFUNC) pReportFunc = pReport->papSortedFunctions[iFunc]; + KPRF_TYPE(PC,FUNC) pFunc = pReportFunc->pFunc; + fprintf(pOut, + " <tr>\n" + " <td>%u</td>\n", + iFunc); + + unsigned i = enmFirst; + do + { + switch (i) + { + case KPRF_TYPE(,FIRSTCOLUMN_ON_STACK): + fprintf(pOut, + " <td class=\"Ticks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", + pFunc->OnStack.SumTicks); + KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.SumTicks, pReport->ProfiledTicks); + fprintf(pOut, "</td>\n" + " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", + pFunc->OnStack.MinTicks); + KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.MinTicks, pReport->ProfiledTicks); + fprintf(pOut, "</td>\n" + " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", + pFunc->OnStack.SumTicks / pFunc->cOnStack); + KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.MinTicks, pReport->ProfiledTicks); + fprintf(pOut, "</td>\n" + " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", + pFunc->OnStack.MaxTicks); + KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.MaxTicks, pReport->ProfiledTicks); + fprintf(pOut, "</td>\n"); + break; + + case KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK): + fprintf(pOut, + " <td class=\"Ticks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", + pFunc->OnTopOfStack.SumTicks); + KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.SumTicks, pReport->ProfiledTicks); + fprintf(pOut, "</td>\n" + " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", + pFunc->OnTopOfStack.MinTicks); + KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.MinTicks, pReport->ProfiledTicks); + fprintf(pOut, "</td>\n" + " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", + pFunc->OnTopOfStack.SumTicks / pFunc->cOnStack); + KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.MinTicks, pReport->ProfiledTicks); + fprintf(pOut, "</td>\n" + " <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">", + pFunc->OnTopOfStack.MaxTicks); + KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.MaxTicks, pReport->ProfiledTicks); + fprintf(pOut, "</td>\n"); + break; + + case KPRF_TYPE(,FIRSTCOLUMN_CALLS_TO): + fprintf(pOut, + " <td class=\"Calls\">%" KPRF_FMT_U64 "</td><td Class=\"Parts\">", + pFunc->cOnStack); + KPRF_NAME(HtmlWriteParts)(pOut, pFunc->cOnStack, pReport->cCalls); + fprintf(pOut, "</td>\n"); + break; + + case KPRF_TYPE(,FIRSTCOLUMN_CALLS_FROM): + fprintf(pOut, + " <td class=\"Calls\">%" KPRF_FMT_U64 "</td><td Class=\"Parts\">", + pFunc->cCalls); + KPRF_NAME(HtmlWriteParts)(pOut, pFunc->cCalls, pReport->cCalls); + fprintf(pOut, "</td>\n"); + break; + + default: + break; + } + + /* inject the function column */ + if (i == enmFirst) + { + fprintf(pOut, + " <td><a href=\"#Func-%u\">", + (unsigned)(uintptr_t)(pReportFunc - pReport->paFunctions)); + if (pReportFunc->pSym) + fprintf(pOut, "%s</a></td>\n", pReportFunc->pSym->szName); + else + fprintf(pOut, "%" KPRF_FMT_UPTR "</a></td>\n", pFunc->uEntryPtr); + } + + /* next */ + i = (i + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX); + } while (i != enmFirst); + + fprintf(pOut, + " </tr>\n"); + } + fprintf(pOut, + "</table>\n" + "\n"); + +} + + +/** + * Writes an HTML report. + * + * @returns 0 on success. + * @returns -1 on failure. + * @param pReport The report to put into HTML. + * @param pOut The file stream to write the HTML to. + */ +static int KPRF_NAME(WriteHtmlReport)(KPRF_TYPE(P,REPORT) pReport, FILE *pOut) +{ + KPRF_TYPE(PC,HDR) pHdr = pReport->pHdr; + + /* + * Write the standard html. + */ + fprintf(pOut, + "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" + "<html>\n" + "<head>\n" + " <meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\">\n" + " <title>kProfiler 2 - %s</title>\n" + "</head>\n" + "<style>\n" + "table\n" + "{\n" +// " width: 90%%;\n" + " background: #999999;\n" +// " margin-top: .6em;\n" +// " margin-bottom: .3em;\n" + "}\n" + "th\n" + "{\n" + " padding: 1px 4px;\n" + " background: #cccccc;\n" +// " text-align: left;\n" + " font-size: 90%%;\n" + //" width: 30%%;\n" + "}\n" + "td\n" + "{\n" + " padding: 1px 4px;\n" + " background: #ffffff;\n" + " font-size: 90%%;\n" + "}\n" + "td.Ticks\n" + "{\n" + " text-align: right;\n" + "}\n" + "td.TicksRow\n" + "{\n" + " text-align: right;\n" + "}\n" + "td.MinMaxTicks\n" + "{\n" + " text-align: right;\n" + "}\n" + "td.MinMaxTicksRow\n" + "{\n" + " text-align: right;\n" + "}\n" + "td.Parts\n" + "{\n" + " text-align: right;\n" + "}\n" + "td.PartsRow\n" + "{\n" + " text-align: left;\n" + "}\n" + "td.Calls\n" + "{\n" + " text-align: right;\n" + "}\n" + "td.CallsRow\n" + "{\n" + " text-align: right;\n" + "}\n" + "td.BlankRow\n" + "{\n" + " background: #e0e0e0;\n" + "}\n" + "td.Name\n" + "{\n" + " font-weight: bold;\n" + "}\n" + "table.Summary th\n" + "{\n" + " width:200px;\n" + "}\n" + "table.Thread\n" + "{\n" + " min-width:60%%\n" + "}\n" + "table.Thread th\n" + "{\n" + " width:200px;\n" + "}\n" + "table.Functions\n" + "{\n" + " width:60%%;\n" + "}\n" + "table.Functions th\n" + "{\n" + " width:200px;\n" + "}\n" + "table.Modules\n" + "{\n" + " width:60%%;\n" + "}\n" + "table.Modules th\n" + "{\n" + " width:200px;\n" + "}\n" + "table.FunctionsSorted\n" + "{\n" + "}\n" + "</style>\n" + "<body topmargin=\"0\">\n" + , + pHdr->offCommandLine + ? (const char *)KPRF_OFF2PTR(P,FUNC, pHdr->offCommandLine, pHdr) + : "" + ); + + /* + * Table of contents. + */ + fprintf(pOut, + "<h2>Table of Contents</h2>\n" + "\n" + "<ul>\n" + " <li><a href=\"#Summary\" >1.0 Summary</a></li>\n" + " <li><a href=\"#Functions\">2.0 Functions</a></li>\n" + " <ul>\n" + " <li><a href=\"#Functions-TimeOnStack\" >2.1 Time On Stack</a></li>\n" + " <ul>\n" + " <li><a href=\"#Functions-TimeOnStack-Avg\" >2.2.1 Time On Stack - Average</a></li>\n" + " <li><a href=\"#Functions-TimeOnStack-Min\" >2.2.1 Time On Stack - Min</a></li>\n" + " <li><a href=\"#Functions-TimeOnStack-Max\" >2.2.2 Time On Stack - Max</a></li>\n" + " </ul>\n" + " <li><a href=\"#Functions-TimeOnTopOfStack\">2.3 Time On Top Of Stack</a></li>\n" + " <ul>\n" + " <li><a href=\"#Functions-TimeOnTopOfStack-Avg\">2.3.1 Time On Top Of Stack - Average</a></li>\n" + " <li><a href=\"#Functions-TimeOnTopOfStack-Min\">2.3.2 Time On Top Of Stack - Min</a></li>\n" + " <li><a href=\"#Functions-TimeOnTopOfStack-Max\">2.3.3 Time On Top Of Stack - Max</a></li>\n" + " </ul>\n" + " <li><a href=\"#Functions-CallsTo\" >2.3 Calls To</a></li>\n" + " <li><a href=\"#Functions-CallsFrom\" >2.4 Calls From</a></li>\n" + " <li><a href=\"#Function-Details\" >2.5 Function Details</a></li>\n" + " </ul>\n" + " <li><a href=\"#Threads\" >3.0 Threads</a></li>\n" + " <li><a href=\"#Modules\" >4.0 Modules</a></li>\n" + "</ul>\n" + "\n" + "\n"); + + /* + * Summary. + */ + fprintf(pOut, + "<h2><a name=\"Summary\">1.0 Summary</a></h2>\n" + "\n" + "<p>\n" + "<table class=\"Summary\">\n"); + if (pHdr->offCommandLine) + KPRF_NAME(HtmlWriteRowString)(pOut, "Command Line", NULL, "%s", (const char *)KPRF_OFF2PTR(P,FUNC, pHdr->offCommandLine, pHdr)); + KPRF_NAME(HtmlWriteRowU32X32)(pOut, "Threads", pHdr->cThreads, NULL); + KPRF_NAME(HtmlWriteRowU32X32)(pOut, "Modules", pReport->cMods, NULL); + KPRF_NAME(HtmlWriteRowU32X32)(pOut, "Functions", pHdr->cFunctions, NULL); + KPRF_NAME(HtmlWriteRowTicks)(pOut, "Profiled", pReport->ProfiledTicks, pReport->ProfiledTicks); + KPRF_NAME(HtmlWriteRowTicks)(pOut, "Sleep", pReport->SleepTicks, pReport->ProfiledTicks); + KPRF_NAME(HtmlWriteRowTicks)(pOut, "Overhead", pReport->OverheadTicks, pReport->ProfiledTicks + pReport->OverheadTicks); + KPRF_NAME(HtmlWriteRowCalls)(pOut, "Recorded Calls", pReport->cCalls, pReport->cCalls); + fprintf(pOut, "<tr><td class=\"BlankRow\" colspan=7> </td></tr>\n"); + KPRF_NAME(HtmlWriteRowString)(pOut, "kProfiler Version ", NULL, "Mark 2 Alpha 1"); + KPRF_NAME(HtmlWriteRowString)(pOut, "kProfiler Build Time ", NULL, __DATE__ " " __TIME__); + fprintf(pOut, + "</table>\n" + "</p>\n" + "\n" + "\n"); + + /* + * Functions. + */ + fprintf(pOut, + "<h2><a name=\"Functions\">2.0 Functions</a></h2>\n" + "\n"); + + qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnStack)); + KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnStack", "2.1 Time On Stack", KPRF_TYPE(,FIRSTCOLUMN_ON_STACK)); + qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnStackAvg)); + KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnStack-Avg", "2.2.1 Time On Stack - Average", KPRF_TYPE(,FIRSTCOLUMN_ON_STACK)); + qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnStackMin)); + KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnStack-Min", "2.2.2 Time On Stack - Min", KPRF_TYPE(,FIRSTCOLUMN_ON_STACK)); + qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnStackMax)); + KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnStack-Max", "2.2.3 Time On Stack - Max", KPRF_TYPE(,FIRSTCOLUMN_ON_STACK)); + + qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnTopOfStack)); + KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnTopOfStack", "2.2 Time On Top Of Stack", KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK)); + qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnTopOfStackAvg)); + KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnTopOfStack-Avg","2.2.1 Time On Top Of Stack - Average", KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK)); + qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnTopOfStackMin)); + KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnTopOfStack-Min","2.2.2 Time On Top Of Stack - Min", KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK)); + qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareOnTopOfStackMax)); + KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-TimeOnTopOfStack-Max","2.2.3 Time On Top Of Stack - Max", KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK)); + + qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareCallsTo)); + KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-CallsTo", "2.4 Calls To", KPRF_TYPE(,FIRSTCOLUMN_CALLS_TO)); + + qsort(&pReport->papSortedFunctions[0], pHdr->cFunctions, sizeof(pReport->papSortedFunctions[0]), KPRF_NAME(FuncCompareCallsFrom)); + KPRF_NAME(HtmlWriteSortedFunctions)(pReport, pOut, "Functions-CallsFrom", "2.5 Calls From", KPRF_TYPE(,FIRSTCOLUMN_CALLS_FROM)); + + fprintf(pOut, + "<h2><a name=\"Function-Details\">2.5 Function Details</a></h2>\n" + "\n" + "<p>\n" + "<table class=\"Functions\">\n"); + for (KU32 iFunc = 0; iFunc < pHdr->cFunctions; iFunc++) + { + KPRF_TYPE(P,REPORTFUNC) pReportFunc = &pReport->paFunctions[iFunc]; + KPRF_TYPE(PC,FUNC) pFunc = pReportFunc->pFunc; + + fprintf(pOut, + "<tr><td class=\"BlankRow\" colspan=7><a name=\"Func-%u\"> </a></td></tr>\n", + iFunc); + KPRF_NAME(HtmlWriteRowU32)(pOut, "Function No.", iFunc, NULL); + if (pReportFunc->pSym) + KPRF_NAME(HtmlWriteRowString)(pOut, "Name", "Name", "%s", pReportFunc->pSym->szName); + if (pReportFunc->pLine) + KPRF_NAME(HtmlWriteRowString)(pOut, "Location", NULL, "<a href=\"file:///%s\">%s</a> Line #%d", + pReportFunc->pLine->szFile, pReportFunc->pLine->szFile, pReportFunc->pLine->iLine); + if (pReportFunc->pModSeg) + { + KPRF_NAME(HtmlWriteRowString)(pOut, "Module", NULL, "<a href=\"#Mod-%u\">%s</a>", + pReportFunc->pModSeg->pMod->iMod, pReportFunc->pModSeg->pModSeg->szPath); + KPRF_NAME(HtmlWriteRowString)(pOut, "Segment:Offset", NULL, "%x:%" KPRF_FMT_UPTR, + pReportFunc->pModSeg->pModSeg->iSegment, + pFunc->uEntryPtr - pReportFunc->pModSeg->pModSeg->uBasePtr); + } + KPRF_NAME(HtmlWriteRowUPTR)(pOut, "Address", pFunc->uEntryPtr, NULL); + + KPRF_NAME(HtmlWriteRowTimeStat)(pOut, "On Stack", &pFunc->OnStack, pReport->ProfiledTicks); + KPRF_NAME(HtmlWriteRowTimeStat)(pOut, "On Top Of Stack", &pFunc->OnTopOfStack, pReport->ProfiledTicks); + KPRF_NAME(HtmlWriteRowCalls)(pOut, "Calls To", pFunc->cOnStack, pReport->cCalls); + KPRF_NAME(HtmlWriteRowCalls)(pOut, "Calls From", pFunc->cCalls, pReport->cCalls); + + fprintf(pOut, + "\n"); + } + fprintf(pOut, + "</table>\n" + "</p>\n" + "\n"); + + /* + * Threads. + */ + fprintf(pOut, + "<h2><a name=\"Threads\">3.0 Threads</a></h2>\n" + "\n" + "<p>\n" + "<table class=\"Threads\">\n"); + + for (KU32 iThread = 0; iThread < pHdr->cThreads; iThread++) + { + KPRF_TYPE(PC,THREAD) pThread = pReport->paThreads[iThread].pThread; + + fprintf(pOut, + "<tr><td class=\"BlankRow\" colspan=7><a name=\"Thread-%u\"> </a></td></tr>\n", + iThread); + KPRF_NAME(HtmlWriteRowU32)(pOut, "Thread No.", iThread, NULL); + KPRF_NAME(HtmlWriteRowX64)(pOut, "Thread Id", pThread->ThreadId, NULL); + if (pThread->szName[0]) + KPRF_NAME(HtmlWriteRowString)(pOut, "Name", "Name", "%s", pThread->szName); + KPRF_NAME(HtmlWriteRowUPTR)(pOut, "Stack Base Address", pThread->uStackBasePtr, NULL); + KPRF_NAME(HtmlWriteRowUPTR)(pOut, "Max Stack Depth", pThread->cbMaxStack, "bytes"); + //KPRF_NAME(HtmlWriteRowUPTR)(pOut, "Max Stack Depth", pThread->cMaxFrames, "frames"); /** @todo max stack frames! */ + KPRF_NAME(HtmlWriteRowTicks)(pOut, "Profiled", pThread->ProfiledTicks, pReport->ProfiledTicks); + KPRF_NAME(HtmlWriteRowTicks)(pOut, "Sleep", pThread->SleepTicks, pReport->ProfiledTicks); + KPRF_NAME(HtmlWriteRowTicks)(pOut, "Overhead", pThread->OverheadTicks, pReport->ProfiledTicks + pReport->OverheadTicks); + KPRF_NAME(HtmlWriteRowCalls)(pOut, "Recorded Calls", pThread->cCalls, pReport->cCalls); + KPRF_NAME(HtmlWriteRowU64)(pOut, "Unwinds", pThread->cUnwinds, NULL); + KPRF_NAME(HtmlWriteRowU64)(pOut, "Profiler Stack Overflows", pThread->cOverflows, NULL); + KPRF_NAME(HtmlWriteRowU64)(pOut, "Profiler Stack Switch Rejects", pThread->cStackSwitchRejects, NULL); + + fprintf(pOut, + "\n"); + } + fprintf(pOut, + "</table>\n" + "</p>\n" + "\n"); + + + /* + * Modules. + */ + fprintf(pOut, + "<h2><a name=\"Modules\">4.0 Modules</a></h2>\n" + "\n" + "<p>\n" + "<table class=\"Modules\">\n"); + + KPRF_TYPE(P,REPORTMOD) pMod = pReport->pFirstMod; + KU32 iMod = 0; + while (pMod) + { + fprintf(pOut, + "<a name=\"Mod-%u\">\n" + "<tr><td class=\"BlankRow\" colspan=7><a name=\"Module-%u\"> </a></td></tr>\n", + iMod, iMod); + KPRF_NAME(HtmlWriteRowU32)(pOut, "Module No.", iMod, NULL); + KPRF_NAME(HtmlWriteRowString)(pOut, "Name", "Name", "%s", pMod->pFirstSeg->pModSeg->szPath); + + for (KPRF_TYPE(P,REPORTMODSEG) pSeg = pMod->pFirstSeg; pSeg; pSeg = pSeg->pNext) + { + char szName[64]; + sprintf(szName, "Segment No.%u - Base", pSeg->pModSeg->iSegment); + KPRF_NAME(HtmlWriteRowUPTR)(pOut, szName, pSeg->pModSeg->uBasePtr, NULL); + sprintf(szName, "Segment No.%u - Size", pSeg->pModSeg->iSegment); + KPRF_NAME(HtmlWriteRowUPTR)(pOut, szName, + pSeg->pModSeg->cbSegmentMinusOne + 1 > pSeg->pModSeg->cbSegmentMinusOne + ? pSeg->pModSeg->cbSegmentMinusOne + 1 + : pSeg->pModSeg->cbSegmentMinusOne, + NULL); + } + + KPRF_NAME(HtmlWriteRowTicks)(pOut, "On Stack", pMod->OnStackTicks, pReport->ProfiledTicks); + KPRF_NAME(HtmlWriteRowTicks)(pOut, "On Top Of Stack", pMod->OnTopOfStackTicks, pReport->ProfiledTicks); + KPRF_NAME(HtmlWriteRowU32)(pOut, "Functions", pMod->cFunctions, NULL); + + fprintf(pOut, + "\n"); + + /* next */ + iMod++; + pMod = pMod->pNext; + } + fprintf(pOut, + "</table>\n" + "</p>\n" + "\n"); + + + /* + * The End. + */ + fprintf(pOut, + "</body>\n" + "</html>\n"); + return 0; +} diff --git a/src/lib/kStuff/kProfiler2/prfx86msc.asm b/src/lib/kStuff/kProfiler2/prfx86msc.asm new file mode 100644 index 0000000..c733958 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/prfx86msc.asm @@ -0,0 +1,393 @@ +; $Id: prfx86msc.asm 29 2009-07-01 20:30:29Z bird $ +;; @file +; kProfiler Mark 2 - Microsoft C/C++ Compiler Interaction, x86. +; + +; +; Copyright (c) 2006-2007 Knut St. Osmundsen <bird-kStuff-spamix@anduin.net> +; +; Permission is hereby granted, free of charge, to any person +; obtaining a copy of this software and associated documentation +; files (the "Software"), to deal in the Software without +; restriction, including without limitation the rights to use, +; copy, modify, merge, publish, distribute, sublicense, and/or sell +; copies of the Software, and to permit persons to whom the +; Software is furnished to do so, subject to the following +; conditions: +; +; The above copyright notice and this permission notice shall be +; included in all copies or substantial portions of the Software. +; +; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +; HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +; OTHER DEALINGS IN THE SOFTWARE. +; + +[section .data] +; +g_fCalibrated: + dd 0 +g_OverheadAdj: + dd 0 + +[section .text] + +extern KPRF_ENTER +extern KPRF_LEAVE + +global __penter +global __pexit + +;ifdef UNDEFINED +global common_return_path +global common_overhead +global common_no_overhead +global calibrate +global calib_inner_update_minimum +global calib_inner_next +global calib_outer_dec +global calib_outer_inc +global calib_done +global calib_nullproc +;endif + + +;; +; On x86 the call to this function has been observed to be put before +; creating the stack frame, as the very first instruction in the function. +; +; Thus the stack layout is as follows: +; 24 return address of the calling function. +; 20 our return address - the address of the calling function + 5. +; 1c eax +; 18 edx +; 14 eflags +; 10 ecx +; c tsc high - param 3 +; 8 tsc low +; 4 frame pointer - param 2 +; 0 function ptr - param 1 +; +; +align 16 +__penter: + ; save volatile register and get the time stamp. + push eax + push edx + rdtsc + pushfd + push ecx + + ; setting up the enter call frame (cdecl). + sub esp, 4 + 4 + 8 + mov [esp + 0ch], edx ; Param 3 - the timestamp + mov [esp + 08h], eax + lea edx, [esp + 24h] ; Param 2 - frame pointer (pointer to the return address of the function calling us) + mov [esp + 04h], edx + mov eax, [esp + 20h] ; Param 1 - The function address + sub eax, 5 ; call instruction + mov [esp], eax + + call KPRF_ENTER + jmp common_return_path + + +;; +; On x86 the call to this function has been observed to be put right before +; return instruction. This fact matters since since we have to calc the same +; stack address as in _penter. +; +; Thus the stack layout is as follows: +; 24 return address of the calling function. +; 20 our return address - the address of the calling function + 5. +; 1c eax +; 18 edx +; 14 eflags +; 10 ecx +; c tsc high - param 3 +; 8 tsc low +; 4 frame pointer - param 2 +; 0 function ptr - param 1 +; +; +align 16 +__pexit: + ; save volatile register and get the time stamp. + push eax + push edx + rdtsc + pushfd + push ecx + + ; setting up the leave call frame (cdecl). + sub esp, 4 + 4 + 8 + mov [esp + 0ch], edx ; Param 3 - the timestamp + mov [esp + 08h], eax + lea edx, [esp + 24h] ; Param 2 - frame pointer (pointer to the return address of the function calling us) + mov [esp + 04h], edx + mov eax, [esp + 20h] ; Param 1 - Some address in the function. + sub eax, 5 ; call instruction + mov [esp], eax + + call KPRF_LEAVE + jmp common_return_path + + +;; +; This is the common return path for both the enter and exit hooks. +; It's kept common because we can then use the same overhead adjustment +; and save some calibration efforts. It also saves space :-) +align 16 +common_return_path: + ; Update overhead + test eax, eax + jz common_no_overhead + cmp byte [g_fCalibrated], 0 + jnz common_overhead + call calibrate +common_overhead: + mov ecx, eax ; ecx <- pointer to overhead counter. + mov eax, [g_OverheadAdj] ; apply the adjustment before reading tsc + sub [esp + 08h], eax + sbb dword [esp + 0ch], 0 + + rdtsc + sub eax, [esp + 08h] + sbb edx, [esp + 0ch] + add [ecx], eax + adc [ecx + 4], edx +common_no_overhead: + add esp, 4 + 4 + 8 + + ; restore volatile registers. + pop ecx + popfd + pop edx + pop eax + ret + +;; +; Data esi points to while we're calibrating. +struc CALIBDATA + .OverheadLo resd 1 + .OverheadHi resd 1 + .ProfiledLo resd 1 + .ProfiledHi resd 1 + .EnterTSLo resd 1 + .EnterTSHi resd 1 + .MinLo resd 1 + .MinHi resd 1 +endstruc + + + +align 16 +;; +; Do necessary calibrations. +; +calibrate: + ; prolog + push ebp + mov ebp, esp + pushfd + pushad + sub esp, CALIBDATA_size + mov esi, esp ; esi points to the CALIBDATA + + ; + ; Indicate that we have finished calibrating. + ; + mov eax, 1 + xchg dword [g_fCalibrated], eax + + ; + ; The outer loop - find the right adjustment. + ; + mov ebx, 200h ; loop counter. +calib_outer_loop: + + ; + ; The inner loop - calls the function number of times to establish a + ; good minimum value + ; + mov ecx, 200h + mov dword [esi + CALIBDATA.MinLo], 0ffffffffh + mov dword [esi + CALIBDATA.MinHi], 07fffffffh +calib_inner_loop: + + ; zero the overhead and profiled times. + xor eax, eax + mov [esi + CALIBDATA.OverheadLo], eax + mov [esi + CALIBDATA.OverheadHi], eax + mov [esi + CALIBDATA.ProfiledLo], eax + mov [esi + CALIBDATA.ProfiledHi], eax + call calib_nullproc + + ; subtract the overhead + mov eax, [esi + CALIBDATA.ProfiledLo] + mov edx, [esi + CALIBDATA.ProfiledHi] + sub eax, [esi + CALIBDATA.OverheadLo] + sbb edx, [esi + CALIBDATA.OverheadHi] + + ; update the minimum value. + test edx, 080000000h + jnz near calib_outer_dec ; if negative, just simplify and shortcut + cmp edx, [esi + CALIBDATA.MinHi] + jg calib_inner_next + jl calib_inner_update_minimum + cmp eax, [esi + CALIBDATA.MinLo] + jge calib_inner_next +calib_inner_update_minimum: + mov [esi + CALIBDATA.MinLo], eax + mov [esi + CALIBDATA.MinHi], edx +calib_inner_next: + loop calib_inner_loop + + ; Is the minimum value acceptable? + test dword [esi + CALIBDATA.MinHi], 80000000h + jnz calib_outer_dec ; simplify if negative. + cmp dword [esi + CALIBDATA.MinHi], 0 + jnz calib_outer_inc ; this shouldn't be possible + cmp dword [esi + CALIBDATA.MinLo], 1fh + jbe calib_outer_dec ; too low - 2 ticks per pair is the minimum! + cmp dword [esi + CALIBDATA.MinLo], 30h + jbe calib_done ; this is fine! +calib_outer_inc: + inc dword [g_OverheadAdj] + jmp calib_outer_next +calib_outer_dec: + cmp dword [g_OverheadAdj], 1 + je calib_done + dec dword [g_OverheadAdj] +calib_outer_next: + dec ebx + jnz calib_outer_loop +calib_done: + + ; epilog + add esp, CALIBDATA_size + popad + popfd + leave + ret + + + + +;; +; The calibration __penter - this must be identical to the real thing except for the KPRF call. +align 16 +calib_penter: + ; This part must be identical + push eax + push edx + rdtsc + pushfd + push ecx + + ; store the entry + mov [esi + CALIBDATA.EnterTSLo], eax + mov [esi + CALIBDATA.EnterTSHi], edx + + ; create the call frame + push edx + push eax + push 0 + push 0 + + lea eax, [esi + CALIBDATA.OverheadLo] + jmp common_overhead + + +;; +; The calibration __pexit - this must be identical to the real thing except for the KPRF call. +align 16 +calib_pexit: + ; This part must be identical + push eax + push edx + rdtsc + pushfd + push ecx + + ; update the time + push eax + push edx + sub eax, [esi + CALIBDATA.EnterTSLo] + sbb edx, [esi + CALIBDATA.EnterTSHi] + add [esi + CALIBDATA.ProfiledLo], eax + adc [esi + CALIBDATA.ProfiledHi], edx + pop edx + pop eax + + ; create the call frame + push edx + push eax + push 0 + push 0 + + lea eax, [esi + CALIBDATA.EnterTSLo] + jmp common_overhead + + +;; +; The 'function' we're profiling. +; The general idea is that each pair should take something like 2-10 ticks. +; +; (Btw. If we don't use multiple pairs here, we end up with the wrong result.) +align 16 +calib_nullproc: + call calib_penter ;0 + call calib_pexit + + call calib_penter ;1 + call calib_pexit + + call calib_penter ;2 + call calib_pexit + + call calib_penter ;3 + call calib_pexit + + call calib_penter ;4 + call calib_pexit + + call calib_penter ;5 + call calib_pexit + + call calib_penter ;6 + call calib_pexit + + call calib_penter ;7 + call calib_pexit + + call calib_penter ;8 + call calib_pexit + + call calib_penter ;9 + call calib_pexit + + call calib_penter ;a + call calib_pexit + + call calib_penter ;b + call calib_pexit + + call calib_penter ;c + call calib_pexit + + call calib_penter ;d + call calib_pexit + + call calib_penter ;e + call calib_pexit + + call calib_penter ;f + call calib_pexit + ret + diff --git a/src/lib/kStuff/kProfiler2/tst.c b/src/lib/kStuff/kProfiler2/tst.c new file mode 100644 index 0000000..f56204c --- /dev/null +++ b/src/lib/kStuff/kProfiler2/tst.c @@ -0,0 +1,48 @@ +#include <stdio.h>
+
+#ifdef _MSC_VER
+void __cdecl _penter(void);
+void __cdecl _pexit(void);
+__declspec(naked) int naked(void)
+{
+ __asm
+ {
+ call _penter
+ call _pexit
+ xor eax, eax
+ ret
+ }
+}
+
+#endif
+
+int bar(void)
+{
+ unsigned i;
+ for (i = 0; i < 1000; i += 7)
+ i += i & 1;
+ return i;
+}
+
+int foo(void)
+{
+ unsigned i, rc = 0;
+ for (i = 0; i < 1000; i++)
+ rc += bar();
+#ifdef _MSC_VER
+ for (; i < 2000; i++)
+ rc += naked();
+#endif
+ return i;
+}
+
+int main()
+{
+ int rc;
+ printf("hello");
+ fflush(stdout);
+ rc = foo();
+ printf("world\n");
+ return rc;
+}
+
diff --git a/src/lib/kStuff/kProfiler2/tstlongjmp.c b/src/lib/kStuff/kProfiler2/tstlongjmp.c new file mode 100644 index 0000000..d6e2b49 --- /dev/null +++ b/src/lib/kStuff/kProfiler2/tstlongjmp.c @@ -0,0 +1,62 @@ +
+#include <setjmp.h>
+#include <time.h>
+
+/* just try trick the compiler into not optimizing stuff by
+ making it "uncertain" which path to take. */
+int always_true(void)
+{
+ time_t t = time(NULL);
+ if (t == time(NULL))
+ return 1;
+ if (t != time(NULL))
+ return 1;
+ if (t == time(NULL))
+ return 1;
+ if (t != time(NULL))
+ return 1;
+ return 0;
+}
+
+jmp_buf g_JmpBuf;
+
+int onelevel(void)
+{
+ if (always_true())
+ longjmp(g_JmpBuf, 1);
+ return 0;
+}
+
+
+int twolevels_inner(void)
+{
+ if (always_true())
+ longjmp(g_JmpBuf, 1);
+ return 0;
+}
+
+int twolevels_outer(void)
+{
+ int rc;
+ always_true();
+ rc = twolevels_inner();
+ always_true();
+ return rc;
+}
+
+
+int main()
+{
+ int rc = 1;
+
+ /* first */
+ if (!setjmp(g_JmpBuf))
+ rc = onelevel();
+
+ /* second */
+ if (!setjmp(g_JmpBuf))
+ rc = twolevels_outer();
+
+ return rc != 1;
+}
+
|