commit 28c76838c9ac8519ddbcc82b820f5c60c4533361 Author: computergang Date: Fri Apr 10 15:39:36 2026 +0200 reupload this diff --git a/ARM/Release/advapi.obj b/ARM/Release/advapi.obj new file mode 100644 index 0000000..ed2ad51 Binary files /dev/null and b/ARM/Release/advapi.obj differ diff --git a/ARM/Release/combase.obj b/ARM/Release/combase.obj new file mode 100644 index 0000000..f668fcc Binary files /dev/null and b/ARM/Release/combase.obj differ diff --git a/ARM/Release/condvar.obj b/ARM/Release/condvar.obj new file mode 100644 index 0000000..940b26b Binary files /dev/null and b/ARM/Release/condvar.obj differ diff --git a/ARM/Release/dbg.obj b/ARM/Release/dbg.obj new file mode 100644 index 0000000..8beda55 Binary files /dev/null and b/ARM/Release/dbg.obj differ diff --git a/ARM/Release/dllmain.obj b/ARM/Release/dllmain.obj new file mode 100644 index 0000000..3191b16 Binary files /dev/null and b/ARM/Release/dllmain.obj differ diff --git a/ARM/Release/dwmapi.obj b/ARM/Release/dwmapi.obj new file mode 100644 index 0000000..c2de6cc Binary files /dev/null and b/ARM/Release/dwmapi.obj differ diff --git a/ARM/Release/dwrite.obj b/ARM/Release/dwrite.obj new file mode 100644 index 0000000..1825d34 Binary files /dev/null and b/ARM/Release/dwrite.obj differ diff --git a/ARM/Release/dxgi.obj b/ARM/Release/dxgi.obj new file mode 100644 index 0000000..0740627 Binary files /dev/null and b/ARM/Release/dxgi.obj differ diff --git a/ARM/Release/evt_log.obj b/ARM/Release/evt_log.obj new file mode 100644 index 0000000..15bbfee Binary files /dev/null and b/ARM/Release/evt_log.obj differ diff --git a/ARM/Release/exports.obj b/ARM/Release/exports.obj new file mode 100644 index 0000000..1ba12b9 Binary files /dev/null and b/ARM/Release/exports.obj differ diff --git a/ARM/Release/fiber.obj b/ARM/Release/fiber.obj new file mode 100644 index 0000000..d857951 Binary files /dev/null and b/ARM/Release/fiber.obj differ diff --git a/ARM/Release/file.obj b/ARM/Release/file.obj new file mode 100644 index 0000000..1cde90d Binary files /dev/null and b/ARM/Release/file.obj differ diff --git a/ARM/Release/initonce.obj b/ARM/Release/initonce.obj new file mode 100644 index 0000000..e29b81d Binary files /dev/null and b/ARM/Release/initonce.obj differ diff --git a/ARM/Release/ip.obj b/ARM/Release/ip.obj new file mode 100644 index 0000000..e66c712 Binary files /dev/null and b/ARM/Release/ip.obj differ diff --git a/ARM/Release/locale.obj b/ARM/Release/locale.obj new file mode 100644 index 0000000..627c34d Binary files /dev/null and b/ARM/Release/locale.obj differ diff --git a/ARM/Release/misc.obj b/ARM/Release/misc.obj new file mode 100644 index 0000000..8ce5efa Binary files /dev/null and b/ARM/Release/misc.obj differ diff --git a/ARM/Release/module.obj b/ARM/Release/module.obj new file mode 100644 index 0000000..7e81a4a Binary files /dev/null and b/ARM/Release/module.obj differ diff --git a/ARM/Release/ole32.obj b/ARM/Release/ole32.obj new file mode 100644 index 0000000..bd42c68 Binary files /dev/null and b/ARM/Release/ole32.obj differ diff --git a/ARM/Release/power.obj b/ARM/Release/power.obj new file mode 100644 index 0000000..59ca94d Binary files /dev/null and b/ARM/Release/power.obj differ diff --git a/ARM/Release/processor.obj b/ARM/Release/processor.obj new file mode 100644 index 0000000..0fc1a46 Binary files /dev/null and b/ARM/Release/processor.obj differ diff --git a/ARM/Release/procthread.obj b/ARM/Release/procthread.obj new file mode 100644 index 0000000..55e21e8 Binary files /dev/null and b/ARM/Release/procthread.obj differ diff --git a/ARM/Release/product.obj b/ARM/Release/product.obj new file mode 100644 index 0000000..86c41be Binary files /dev/null and b/ARM/Release/product.obj differ diff --git a/ARM/Release/progwrp.log b/ARM/Release/progwrp.log new file mode 100644 index 0000000..4b6dae9 --- /dev/null +++ b/ARM/Release/progwrp.log @@ -0,0 +1 @@ +ARM\Release\advapi.obj : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'ARM' diff --git a/ARM/Release/progwrp.tlog/CL.command.1.tlog b/ARM/Release/progwrp.tlog/CL.command.1.tlog new file mode 100644 index 0000000..94d4191 Binary files /dev/null and b/ARM/Release/progwrp.tlog/CL.command.1.tlog differ diff --git a/ARM/Release/progwrp.tlog/CL.read.1.tlog b/ARM/Release/progwrp.tlog/CL.read.1.tlog new file mode 100644 index 0000000..e139f67 Binary files /dev/null and b/ARM/Release/progwrp.tlog/CL.read.1.tlog differ diff --git a/ARM/Release/progwrp.tlog/CL.write.1.tlog b/ARM/Release/progwrp.tlog/CL.write.1.tlog new file mode 100644 index 0000000..6beb62d Binary files /dev/null and b/ARM/Release/progwrp.tlog/CL.write.1.tlog differ diff --git a/ARM/Release/progwrp.tlog/link.command.1.tlog b/ARM/Release/progwrp.tlog/link.command.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/ARM/Release/progwrp.tlog/link.command.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/ARM/Release/progwrp.tlog/link.read.1.tlog b/ARM/Release/progwrp.tlog/link.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/ARM/Release/progwrp.tlog/link.read.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/ARM/Release/progwrp.tlog/link.write.1.tlog b/ARM/Release/progwrp.tlog/link.write.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/ARM/Release/progwrp.tlog/link.write.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/ARM/Release/progwrp.tlog/progwrp.lastbuildstate b/ARM/Release/progwrp.tlog/progwrp.lastbuildstate new file mode 100644 index 0000000..ff7ac2c --- /dev/null +++ b/ARM/Release/progwrp.tlog/progwrp.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.41.33923:TargetPlatformVersion=10.0.22621.0: +Release|ARM|C:\Users\win32\Documents\progwrp\| diff --git a/ARM/Release/progwrp.tlog/rc.command.1.tlog b/ARM/Release/progwrp.tlog/rc.command.1.tlog new file mode 100644 index 0000000..fbaa043 Binary files /dev/null and b/ARM/Release/progwrp.tlog/rc.command.1.tlog differ diff --git a/ARM/Release/progwrp.tlog/rc.read.1.tlog b/ARM/Release/progwrp.tlog/rc.read.1.tlog new file mode 100644 index 0000000..5fa3d4b Binary files /dev/null and b/ARM/Release/progwrp.tlog/rc.read.1.tlog differ diff --git a/ARM/Release/progwrp.tlog/rc.write.1.tlog b/ARM/Release/progwrp.tlog/rc.write.1.tlog new file mode 100644 index 0000000..262feac Binary files /dev/null and b/ARM/Release/progwrp.tlog/rc.write.1.tlog differ diff --git a/ARM/Release/progwrp.tlog/unsuccessfulbuild b/ARM/Release/progwrp.tlog/unsuccessfulbuild new file mode 100644 index 0000000..e69de29 diff --git a/ARM/Release/psapi.obj b/ARM/Release/psapi.obj new file mode 100644 index 0000000..46c3840 Binary files /dev/null and b/ARM/Release/psapi.obj differ diff --git a/ARM/Release/ptr.obj b/ARM/Release/ptr.obj new file mode 100644 index 0000000..2f4a258 Binary files /dev/null and b/ARM/Release/ptr.obj differ diff --git a/ARM/Release/registry.obj b/ARM/Release/registry.obj new file mode 100644 index 0000000..ca3b0c2 Binary files /dev/null and b/ARM/Release/registry.obj differ diff --git a/ARM/Release/rsrc.res b/ARM/Release/rsrc.res new file mode 100644 index 0000000..87a39e6 Binary files /dev/null and b/ARM/Release/rsrc.res differ diff --git a/ARM/Release/setupapi.obj b/ARM/Release/setupapi.obj new file mode 100644 index 0000000..469c718 Binary files /dev/null and b/ARM/Release/setupapi.obj differ diff --git a/ARM/Release/shell.obj b/ARM/Release/shell.obj new file mode 100644 index 0000000..86e40e7 Binary files /dev/null and b/ARM/Release/shell.obj differ diff --git a/ARM/Release/srw.obj b/ARM/Release/srw.obj new file mode 100644 index 0000000..18f9bc8 Binary files /dev/null and b/ARM/Release/srw.obj differ diff --git a/ARM/Release/synch.obj b/ARM/Release/synch.obj new file mode 100644 index 0000000..b5f79e6 Binary files /dev/null and b/ARM/Release/synch.obj differ diff --git a/ARM/Release/tls.obj b/ARM/Release/tls.obj new file mode 100644 index 0000000..50c2813 Binary files /dev/null and b/ARM/Release/tls.obj differ diff --git a/ARM/Release/user.obj b/ARM/Release/user.obj new file mode 100644 index 0000000..24995e6 Binary files /dev/null and b/ARM/Release/user.obj differ diff --git a/ARM/Release/wer.obj b/ARM/Release/wer.obj new file mode 100644 index 0000000..6eea65f Binary files /dev/null and b/ARM/Release/wer.obj differ diff --git a/ReadMe.md b/ReadMe.md new file mode 100644 index 0000000..b4d99b3 --- /dev/null +++ b/ReadMe.md @@ -0,0 +1,44 @@ + +Win32 chose to close source this project for his own benefit, that is NOT cool, so I decided to open it. ProgWRP should not be closed source, it started as oss, and it should that way. This is an older version of it, but it's still progwrp regardless. Fuck you win32 + +======================================================================== + DYNAMIC LINK LIBRARY : progwrp Project Overview +======================================================================== + +AppWizard has created this progwrp DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your progwrp application. + + +progwrp.vcproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +progwrp.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named progwrp.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/Release/BuildLog.htm b/Release/BuildLog.htm new file mode 100644 index 0000000..a74c458 Binary files /dev/null and b/Release/BuildLog.htm differ diff --git a/Release/RCa77612 b/Release/RCa77612 new file mode 100644 index 0000000..b390552 Binary files /dev/null and b/Release/RCa77612 differ diff --git a/Release/advapi.obj b/Release/advapi.obj new file mode 100644 index 0000000..d86ac46 Binary files /dev/null and b/Release/advapi.obj differ diff --git a/Release/combase.obj b/Release/combase.obj new file mode 100644 index 0000000..9b4b704 Binary files /dev/null and b/Release/combase.obj differ diff --git a/Release/condvar.obj b/Release/condvar.obj new file mode 100644 index 0000000..5ec9a67 Binary files /dev/null and b/Release/condvar.obj differ diff --git a/Release/dbg.obj b/Release/dbg.obj new file mode 100644 index 0000000..4b83dab Binary files /dev/null and b/Release/dbg.obj differ diff --git a/Release/dllmain.obj b/Release/dllmain.obj new file mode 100644 index 0000000..2be3fc2 Binary files /dev/null and b/Release/dllmain.obj differ diff --git a/Release/dwmapi.obj b/Release/dwmapi.obj new file mode 100644 index 0000000..490d365 Binary files /dev/null and b/Release/dwmapi.obj differ diff --git a/Release/dwrite.obj b/Release/dwrite.obj new file mode 100644 index 0000000..1f1c96f Binary files /dev/null and b/Release/dwrite.obj differ diff --git a/Release/dxgi.obj b/Release/dxgi.obj new file mode 100644 index 0000000..33e8552 Binary files /dev/null and b/Release/dxgi.obj differ diff --git a/Release/evt_log.obj b/Release/evt_log.obj new file mode 100644 index 0000000..356ce3c Binary files /dev/null and b/Release/evt_log.obj differ diff --git a/Release/exports.obj b/Release/exports.obj new file mode 100644 index 0000000..c62ce0c Binary files /dev/null and b/Release/exports.obj differ diff --git a/Release/fiber.obj b/Release/fiber.obj new file mode 100644 index 0000000..795e78a Binary files /dev/null and b/Release/fiber.obj differ diff --git a/Release/file.obj b/Release/file.obj new file mode 100644 index 0000000..0de6cd9 Binary files /dev/null and b/Release/file.obj differ diff --git a/Release/initonce.obj b/Release/initonce.obj new file mode 100644 index 0000000..5375b91 Binary files /dev/null and b/Release/initonce.obj differ diff --git a/Release/ip.obj b/Release/ip.obj new file mode 100644 index 0000000..0a8b2a1 Binary files /dev/null and b/Release/ip.obj differ diff --git a/Release/locale.obj b/Release/locale.obj new file mode 100644 index 0000000..12defb4 Binary files /dev/null and b/Release/locale.obj differ diff --git a/Release/misc.obj b/Release/misc.obj new file mode 100644 index 0000000..351effa Binary files /dev/null and b/Release/misc.obj differ diff --git a/Release/module.obj b/Release/module.obj new file mode 100644 index 0000000..c80a9ea Binary files /dev/null and b/Release/module.obj differ diff --git a/Release/ole32.obj b/Release/ole32.obj new file mode 100644 index 0000000..6c8c387 Binary files /dev/null and b/Release/ole32.obj differ diff --git a/Release/power.obj b/Release/power.obj new file mode 100644 index 0000000..29293a5 Binary files /dev/null and b/Release/power.obj differ diff --git a/Release/processor.obj b/Release/processor.obj new file mode 100644 index 0000000..f303055 Binary files /dev/null and b/Release/processor.obj differ diff --git a/Release/procthread.obj b/Release/procthread.obj new file mode 100644 index 0000000..b1b0120 Binary files /dev/null and b/Release/procthread.obj differ diff --git a/Release/product.obj b/Release/product.obj new file mode 100644 index 0000000..f94ff3d Binary files /dev/null and b/Release/product.obj differ diff --git a/Release/progwrp.Build.CppClean.log b/Release/progwrp.Build.CppClean.log new file mode 100644 index 0000000..c42b0f8 --- /dev/null +++ b/Release/progwrp.Build.CppClean.log @@ -0,0 +1,51 @@ +c:\users\win32\documents\progwrp\progwrp\progwrp.pdb +c:\users\win32\documents\progwrp\progwrp\release\ptr.obj +c:\users\win32\documents\progwrp\progwrp\release\psapi.obj +c:\users\win32\documents\progwrp\progwrp\release\product.obj +c:\users\win32\documents\progwrp\progwrp\release\procthread.obj +c:\users\win32\documents\progwrp\progwrp\release\processor.obj +c:\users\win32\documents\progwrp\progwrp\release\power.obj +c:\users\win32\documents\progwrp\progwrp\release\ole32.obj +c:\users\win32\documents\progwrp\progwrp\release\module.obj +c:\users\win32\documents\progwrp\progwrp\release\misc.obj +c:\users\win32\documents\progwrp\progwrp\release\locale.obj +c:\users\win32\documents\progwrp\progwrp\release\ip.obj +c:\users\win32\documents\progwrp\progwrp\release\initonce.obj +c:\users\win32\documents\progwrp\progwrp\release\file.obj +c:\users\win32\documents\progwrp\progwrp\release\fiber.obj +c:\users\win32\documents\progwrp\progwrp\release\evt_log.obj +c:\users\win32\documents\progwrp\progwrp\release\dxgi.obj +c:\users\win32\documents\progwrp\progwrp\release\dwmapi.obj +c:\users\win32\documents\progwrp\progwrp\release\dbg.obj +c:\users\win32\documents\progwrp\progwrp\release\condvar.obj +c:\users\win32\documents\progwrp\progwrp\release\advapi.obj +c:\users\win32\documents\progwrp\progwrp\release\wer.obj +c:\users\win32\documents\progwrp\progwrp\release\user.obj +c:\users\win32\documents\progwrp\progwrp\release\tls.obj +c:\users\win32\documents\progwrp\progwrp\release\synch.obj +c:\users\win32\documents\progwrp\progwrp\release\srw.obj +c:\users\win32\documents\progwrp\progwrp\release\shell.obj +c:\users\win32\documents\progwrp\progwrp\release\setupapi.obj +c:\users\win32\documents\progwrp\progwrp\release\registry.obj +c:\users\win32\documents\progwrp\progwrp\release\combase.obj +c:\users\win32\documents\progwrp\progwrp\release\exports.obj +c:\users\win32\documents\progwrp\progwrp\release\dllmain.obj +c:\users\win32\documents\progwrp\progwrp\release\rsrc.res +c:\users\win32\documents\progwrp\release\progwrp.lib +c:\users\win32\documents\progwrp\release\progwrp.exp +c:\users\win32\documents\progwrp\progwrp\release\vc90.idb +c:\users\win32\documents\progwrp\progwrp\release\vc90.pdb +c:\users\win32\documents\progwrp\release\progwrp.pdb +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\cl.command.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\cl.items.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\cl.read.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\cl.write.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\link-cvtres.read.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\link-cvtres.write.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\link.command.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\link.read.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\link.secondary.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\link.write.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\rc.command.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\rc.read.1.tlog +c:\users\win32\documents\progwrp\progwrp\release\progwrp.tlog\rc.write.1.tlog diff --git a/Release/progwrp.dll.recipe b/Release/progwrp.dll.recipe new file mode 100644 index 0000000..29ccbe2 --- /dev/null +++ b/Release/progwrp.dll.recipe @@ -0,0 +1,11 @@ + + + + + K:\progwrp\Release\progwrp.dll + + + + + + \ No newline at end of file diff --git a/Release/progwrp.log b/Release/progwrp.log new file mode 100644 index 0000000..ca60ee7 --- /dev/null +++ b/Release/progwrp.log @@ -0,0 +1,18 @@ + initonce.c +K:\progwrp\progwrp\initonce.c(43,17): warning C4047: 'function': 'volatile LONG *' differs in levels of indirection from 'PVOID *' +K:\progwrp\progwrp\initonce.c(43,17): warning C4024: '_InterlockedOr': different types for formal and actual parameter 1 +K:\progwrp\progwrp\initonce.c(52,18): warning C4047: 'function': 'volatile LONG *' differs in levels of indirection from 'PVOID *' +K:\progwrp\progwrp\initonce.c(52,18): warning C4024: '_InterlockedOr': different types for formal and actual parameter 1 +K:\progwrp\progwrp\initonce.c(59,14): warning C4047: '=': 'LPVOID' differs in levels of indirection from 'unsigned long' +K:\progwrp\progwrp\initonce.c(86,13): warning C4047: '=': 'LPVOID' differs in levels of indirection from 'unsigned long' +K:\progwrp\progwrp\initonce.c(101,18): warning C4047: 'function': 'volatile LONG *' differs in levels of indirection from 'PVOID *' +K:\progwrp\progwrp\initonce.c(101,18): warning C4024: '_InterlockedOr': different types for formal and actual parameter 1 +K:\progwrp\progwrp\initonce.c(133,16): warning C4047: 'function': 'volatile LONG *' differs in levels of indirection from 'PVOID *' +K:\progwrp\progwrp\initonce.c(133,16): warning C4024: '_InterlockedOr': different types for formal and actual parameter 1 +K:\progwrp\progwrp\initonce.c(137,17): warning C4047: 'function': 'volatile LONG *' differs in levels of indirection from 'PVOID *' +K:\progwrp\progwrp\initonce.c(137,17): warning C4024: '_InterlockedOr': different types for formal and actual parameter 1 +K:\progwrp\progwrp\initonce.c(137,35): warning C4047: 'function': 'LONG' differs in levels of indirection from 'LPVOID' +K:\progwrp\progwrp\initonce.c(137,35): warning C4024: '_InterlockedOr': different types for formal and actual parameter 2 + Creating library K:\progwrp\Release\progwrp.lib and object K:\progwrp\Release\progwrp.exp + LINK : /LTCG specified but no code generation required; remove /LTCG from the link command line to improve linker performance + progwrp.vcxproj -> K:\progwrp\Release\progwrp.dll diff --git a/Release/progwrp.tlog/CL.command.1.tlog b/Release/progwrp.tlog/CL.command.1.tlog new file mode 100644 index 0000000..e8687f4 Binary files /dev/null and b/Release/progwrp.tlog/CL.command.1.tlog differ diff --git a/Release/progwrp.tlog/CL.read.1.tlog b/Release/progwrp.tlog/CL.read.1.tlog new file mode 100644 index 0000000..21f3b7a Binary files /dev/null and b/Release/progwrp.tlog/CL.read.1.tlog differ diff --git a/Release/progwrp.tlog/CL.write.1.tlog b/Release/progwrp.tlog/CL.write.1.tlog new file mode 100644 index 0000000..654cf2e Binary files /dev/null and b/Release/progwrp.tlog/CL.write.1.tlog differ diff --git a/Release/progwrp.tlog/Cl.items.tlog b/Release/progwrp.tlog/Cl.items.tlog new file mode 100644 index 0000000..f39a981 --- /dev/null +++ b/Release/progwrp.tlog/Cl.items.tlog @@ -0,0 +1,32 @@ +K:\progwrp\progwrp\advapi.c;K:\progwrp\progwrp\Release\advapi.obj +K:\progwrp\progwrp\combase.c;K:\progwrp\progwrp\Release\combase.obj +K:\progwrp\progwrp\condvar.c;K:\progwrp\progwrp\Release\condvar.obj +K:\progwrp\progwrp\dbg.c;K:\progwrp\progwrp\Release\dbg.obj +K:\progwrp\progwrp\dllmain.c;K:\progwrp\progwrp\Release\dllmain.obj +K:\progwrp\progwrp\dwmapi.c;K:\progwrp\progwrp\Release\dwmapi.obj +K:\progwrp\progwrp\dwrite.c;K:\progwrp\progwrp\Release\dwrite.obj +K:\progwrp\progwrp\dxgi.c;K:\progwrp\progwrp\Release\dxgi.obj +K:\progwrp\progwrp\evt_log.c;K:\progwrp\progwrp\Release\evt_log.obj +K:\progwrp\progwrp\exports.c;K:\progwrp\progwrp\Release\exports.obj +K:\progwrp\progwrp\fiber.c;K:\progwrp\progwrp\Release\fiber.obj +K:\progwrp\progwrp\file.c;K:\progwrp\progwrp\Release\file.obj +K:\progwrp\progwrp\initonce.c;K:\progwrp\progwrp\Release\initonce.obj +K:\progwrp\progwrp\ip.c;K:\progwrp\progwrp\Release\ip.obj +K:\progwrp\progwrp\locale.c;K:\progwrp\progwrp\Release\locale.obj +K:\progwrp\progwrp\misc.c;K:\progwrp\progwrp\Release\misc.obj +K:\progwrp\progwrp\module.c;K:\progwrp\progwrp\Release\module.obj +K:\progwrp\progwrp\ole32.c;K:\progwrp\progwrp\Release\ole32.obj +K:\progwrp\progwrp\power.c;K:\progwrp\progwrp\Release\power.obj +K:\progwrp\progwrp\processor.c;K:\progwrp\progwrp\Release\processor.obj +K:\progwrp\progwrp\procthread.c;K:\progwrp\progwrp\Release\procthread.obj +K:\progwrp\progwrp\product.c;K:\progwrp\progwrp\Release\product.obj +K:\progwrp\progwrp\psapi.c;K:\progwrp\progwrp\Release\psapi.obj +K:\progwrp\progwrp\ptr.c;K:\progwrp\progwrp\Release\ptr.obj +K:\progwrp\progwrp\registry.c;K:\progwrp\progwrp\Release\registry.obj +K:\progwrp\progwrp\setupapi.c;K:\progwrp\progwrp\Release\setupapi.obj +K:\progwrp\progwrp\shell.c;K:\progwrp\progwrp\Release\shell.obj +K:\progwrp\progwrp\srw.c;K:\progwrp\progwrp\Release\srw.obj +K:\progwrp\progwrp\synch.c;K:\progwrp\progwrp\Release\synch.obj +K:\progwrp\progwrp\tls.c;K:\progwrp\progwrp\Release\tls.obj +K:\progwrp\progwrp\user.c;K:\progwrp\progwrp\Release\user.obj +K:\progwrp\progwrp\wer.c;K:\progwrp\progwrp\Release\wer.obj diff --git a/Release/progwrp.tlog/link.command.1.tlog b/Release/progwrp.tlog/link.command.1.tlog new file mode 100644 index 0000000..ce4a1e9 Binary files /dev/null and b/Release/progwrp.tlog/link.command.1.tlog differ diff --git a/Release/progwrp.tlog/link.read.1.tlog b/Release/progwrp.tlog/link.read.1.tlog new file mode 100644 index 0000000..3bfb596 Binary files /dev/null and b/Release/progwrp.tlog/link.read.1.tlog differ diff --git a/Release/progwrp.tlog/link.secondary.1.tlog b/Release/progwrp.tlog/link.secondary.1.tlog new file mode 100644 index 0000000..9c26fd8 --- /dev/null +++ b/Release/progwrp.tlog/link.secondary.1.tlog @@ -0,0 +1,3 @@ +^C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\ADVAPI.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\COMBASE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\CONDVAR.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\DBG.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\DLLMAIN.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\DWMAPI.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\DWRITE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\DXGI.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\EVT_LOG.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\EXPORTS.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\FIBER.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\FILE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\INITONCE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\IP.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\LOCALE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\MISC.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\MODULE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\OLE32.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\POWER.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\PROCESSOR.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\PROCTHREAD.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\PRODUCT.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\PSAPI.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\PTR.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\REGISTRY.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\RSRC.RES|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\SETUPAPI.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\SHELL.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\SRW.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\SYNCH.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\TLS.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\USER.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\RELEASE\WER.OBJ +C:\Users\win32\Documents\progwrp\Release\progwrp.lib +C:\Users\win32\Documents\progwrp\Release\progwrp.EXP diff --git a/Release/progwrp.tlog/link.write.1.tlog b/Release/progwrp.tlog/link.write.1.tlog new file mode 100644 index 0000000..2772227 Binary files /dev/null and b/Release/progwrp.tlog/link.write.1.tlog differ diff --git a/Release/progwrp.tlog/link.write.2u.tlog b/Release/progwrp.tlog/link.write.2u.tlog new file mode 100644 index 0000000..e473dfb Binary files /dev/null and b/Release/progwrp.tlog/link.write.2u.tlog differ diff --git a/Release/progwrp.tlog/progwrp.lastbuildstate b/Release/progwrp.tlog/progwrp.lastbuildstate new file mode 100644 index 0000000..a634ef2 --- /dev/null +++ b/Release/progwrp.tlog/progwrp.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.37.32822:TargetPlatformVersion=10.0.22621.0: +Release|Win32|K:\progwrp\| diff --git a/Release/progwrp.tlog/rc.command.1.tlog b/Release/progwrp.tlog/rc.command.1.tlog new file mode 100644 index 0000000..7ca3b0e Binary files /dev/null and b/Release/progwrp.tlog/rc.command.1.tlog differ diff --git a/Release/progwrp.tlog/rc.read.1.tlog b/Release/progwrp.tlog/rc.read.1.tlog new file mode 100644 index 0000000..ddfba18 Binary files /dev/null and b/Release/progwrp.tlog/rc.read.1.tlog differ diff --git a/Release/progwrp.tlog/rc.write.1.tlog b/Release/progwrp.tlog/rc.write.1.tlog new file mode 100644 index 0000000..57a116a Binary files /dev/null and b/Release/progwrp.tlog/rc.write.1.tlog differ diff --git a/Release/progwrp.vcxproj.FileListAbsolute.txt b/Release/progwrp.vcxproj.FileListAbsolute.txt new file mode 100644 index 0000000..e69de29 diff --git a/Release/psapi.obj b/Release/psapi.obj new file mode 100644 index 0000000..a1b9d12 Binary files /dev/null and b/Release/psapi.obj differ diff --git a/Release/ptr.obj b/Release/ptr.obj new file mode 100644 index 0000000..fdd47a5 Binary files /dev/null and b/Release/ptr.obj differ diff --git a/Release/registry.obj b/Release/registry.obj new file mode 100644 index 0000000..643db4a Binary files /dev/null and b/Release/registry.obj differ diff --git a/Release/rsrc.res b/Release/rsrc.res new file mode 100644 index 0000000..f5170eb Binary files /dev/null and b/Release/rsrc.res differ diff --git a/Release/setupapi.obj b/Release/setupapi.obj new file mode 100644 index 0000000..da24600 Binary files /dev/null and b/Release/setupapi.obj differ diff --git a/Release/shell.obj b/Release/shell.obj new file mode 100644 index 0000000..948a0f9 Binary files /dev/null and b/Release/shell.obj differ diff --git a/Release/srw.obj b/Release/srw.obj new file mode 100644 index 0000000..1f61cbc Binary files /dev/null and b/Release/srw.obj differ diff --git a/Release/synch.obj b/Release/synch.obj new file mode 100644 index 0000000..565ba36 Binary files /dev/null and b/Release/synch.obj differ diff --git a/Release/tls.obj b/Release/tls.obj new file mode 100644 index 0000000..a00491a Binary files /dev/null and b/Release/tls.obj differ diff --git a/Release/user.obj b/Release/user.obj new file mode 100644 index 0000000..23bb6d0 Binary files /dev/null and b/Release/user.obj differ diff --git a/Release/wer.obj b/Release/wer.obj new file mode 100644 index 0000000..157db0e Binary files /dev/null and b/Release/wer.obj differ diff --git a/Yes b/Yes new file mode 100644 index 0000000..e72e2e5 Binary files /dev/null and b/Yes differ diff --git a/advapi.c b/advapi.c new file mode 100644 index 0000000..52fac34 --- /dev/null +++ b/advapi.c @@ -0,0 +1,96 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +BOOL WINAPI Implementation_AddMandatoryAce( + PACL pAcl, + DWORD dwAceRevision, + DWORD AceFlags, + DWORD MandatoryPolicy, + PSID pLabelSid +) +{ + return FALSE; +} + +ULONG WINAPI Implementation_EventRegister( + LPCGUID ProviderId, + PENABLECALLBACK EnableCallback, + PVOID CallbackContext, + PREGHANDLE RegHandle +) +{ + return ERROR_INVALID_PARAMETER; +} + +ULONG WINAPI Implementation_EventSetInformation( + REGHANDLE RegHandle, + EVENT_INFO_CLASS InformationClass, + PVOID EventInformation, + ULONG InformationLength +) +{ + return ERROR_INVALID_PARAMETER; +} + +ULONG WINAPI Implementation_EventUnregister( + REGHANDLE RegHandle +) +{ + return 0; +} + +ULONG WINAPI Implementation_EventWrite( + REGHANDLE RegHandle, + PCEVENT_DESCRIPTOR EventDescriptor, + ULONG UserDataCount, + PEVENT_DATA_DESCRIPTOR UserData +) +{ + return 0; +} + +ULONG WINAPI Implementation_EventWriteTransfer( + REGHANDLE RegHandle, + PCEVENT_DESCRIPTOR EventDescriptor, + LPCGUID ActivityId, + LPCGUID RelatedActivityId, + ULONG UserDataCount, + PEVENT_DATA_DESCRIPTOR UserData +) +{ + return 0; +} + +BOOLEAN WINAPI Implementation_SystemFunction036( + PVOID RandomBuffer, + ULONG RandomBufferLength +) +{ + LARGE_INTEGER qpc; + int i; + PBYTE Test; + + if(!RandomBuffer) + return FALSE; + + Test = RandomBuffer; + + QueryPerformanceCounter(&qpc); + + for(i = 0; i < RandomBufferLength; i++) + { + if(i % 4 == 0) + Test[i] = LOBYTE(GetTickCount() ^ qpc.LowPart); + if(i % 4 == 2) + Test[i] = HIBYTE(LOWORD(GetTickCount())); + if(i % 4 == 3) + Test[i] = HIBYTE(GetTickCount()); + QueryPerformanceCounter(&qpc); + if(i % 4 == 1) + Test[i] = HIBYTE(LOWORD(qpc.LowPart)) >> i; + } + + return TRUE; + +} \ No newline at end of file diff --git a/com_lite.h b/com_lite.h new file mode 100644 index 0000000..e043817 --- /dev/null +++ b/com_lite.h @@ -0,0 +1,267 @@ + +typedef struct { + ULONG_PTR pfnQueryInterface; + ULONG_PTR pfnAddRef; + ULONG_PTR pfnRelease; +}IUnknownLite, *pIUnknownLite; + +typedef struct { + IUnknownLite IUnknown; + ULONG_PTR pfnGetSystemFontCollection; + ULONG_PTR pfnCreateCustomFontCollection; + ULONG_PTR pfnRegisterFontCollectionLoader; + ULONG_PTR pfnUnregisterFontCollectionLoader; + ULONG_PTR pfnCreateFontFileReference; + ULONG_PTR pfnCreateCustomFontFileReference; + ULONG_PTR pfnCreateFontFace; + ULONG_PTR pfnCreateRenderingParams; + ULONG_PTR pfnCreateMonitorRenderingParams; + ULONG_PTR pfnCreateCustomRenderingParams; + ULONG_PTR pfnRegisterFontFileLoader; + ULONG_PTR pfnUnregisterFontFileLoader; + ULONG_PTR pfnCreateTextFormat; + ULONG_PTR pfnCreateTypography; + ULONG_PTR pfnGetGdiInterop; + ULONG_PTR pfnCreateTextLayout; + ULONG_PTR pfnCreateGdiCompatibleTextLayout; + ULONG_PTR pfnCreateEllipsisTrimmingSign; + ULONG_PTR pfnCreateTextAnalyzer; + ULONG_PTR pfnCreateNumberSubstitution; + ULONG_PTR pfnCreateGlyphRunAnalysis; +}IDWriteFactoryLiteTbl, *pIDWriteFactoryLiteTbl; + +typedef struct { + IUnknownLite IUnknown; + ULONG_PTR pfnGetFontFamilyCount; + ULONG_PTR pfnGetFontFamily; + ULONG_PTR pfnFindFamilyName; + ULONG_PTR pfnGetFontFromFontFace; +}IDWriteFontCollectionLiteTbl, * pIDWriteFontCollectionLiteTbl; + +typedef struct { + pIDWriteFontCollectionLiteTbl Vtbl; + ULONG RefCount; +}IDWriteFontCollectionLite, * pIDWriteFontCollectionLite; + +typedef struct { + IUnknownLite IUnknown; + ULONG_PTR pfnGetAlphaTextureBounds; + ULONG_PTR pfnGetAlphaBlendParams; + ULONG_PTR pfnCreateAlphaTexture; +}IDWriteGlyphRunAnalysisLiteTbl, * pIDWriteGlyphRunAnalysisLiteTbl; + +typedef struct { + pIDWriteGlyphRunAnalysisLiteTbl Vtbl; + ULONG RefCount; +}IDWriteGlyphRunAnalysisLite, * pIDWriteGlyphRunAnalysisLite; + +typedef struct { + IUnknownLite IUnknown; + ULONG_PTR pfnSetTextAlignment; + ULONG_PTR pfnSetParagraphAlignment; + ULONG_PTR pfnSetWordWrapping; + ULONG_PTR pfnSetReadingDirection; + ULONG_PTR pfnSetFlowDirection; + ULONG_PTR pfnSetIncrementalTabStop; + ULONG_PTR pfnSetTrimming; + ULONG_PTR pfnSetLineSpacing; + ULONG_PTR pfnGetTextAlignment; + ULONG_PTR pfnGetParagraphAlignment; + ULONG_PTR pfnGetWordWrapping; + ULONG_PTR pfnGetReadingDirection; + ULONG_PTR pfnGetFlowDirection; + ULONG_PTR pfnGetIncrementalTabStop; + ULONG_PTR pfnGetTrimming; + ULONG_PTR pfnGetLineSpacing; + ULONG_PTR pfnGetFontCollection; + ULONG_PTR pfnGetFontFamilyNameLength; + ULONG_PTR pfnGetFontFamilyName; + ULONG_PTR pfnGetFontWeight; + ULONG_PTR pfnGetFontStyle; + ULONG_PTR pfnGetFontStretch; + ULONG_PTR pfnGetFontSize; + ULONG_PTR pfnGetLocaleNameLength; + ULONG_PTR pfnGetLocaleName; +}IDWriteTextFormatLiteTbl, * pIDWriteTextFormatLiteTbl; + +typedef struct { + pIDWriteTextFormatLiteTbl Vtbl; + ULONG RefCount; +}IDWriteTextFormatLite, * pIDWriteTextFormatLite; + +typedef struct { + IDWriteTextFormatLiteTbl IDWriteTextFormat; + ULONG_PTR pfnSetMaxWidth; + ULONG_PTR pfnSetMaxHeight; + ULONG_PTR pfnSetFontCollection; + ULONG_PTR pfnSetFontFamilyName; + ULONG_PTR pfnSetFontWeight; // 0x100 + ULONG_PTR pfnSetFontStyle; + ULONG_PTR pfnSetFontStretch; + ULONG_PTR pfnSetFontSize; + ULONG_PTR pfnSetUnderline; + ULONG_PTR pfnSetStrikethrough; + ULONG_PTR pfnSetDrawingEffect; + ULONG_PTR pfnSetInlineObject; + ULONG_PTR pfnSetTypography; + ULONG_PTR pfnSetLocaleName; + ULONG_PTR pfnGetMaxWidth; + ULONG_PTR pfnGetMaxHeight; + ULONG_PTR pfnGetFontCollection; + ULONG_PTR pfnGetFontFamilyNameLength; + ULONG_PTR pfnGetFontFamilyName; + ULONG_PTR pfnGetFontWeight; + ULONG_PTR pfnGetFontStyle; + ULONG_PTR pfnGetFontStretch; + ULONG_PTR pfnGetFontSize; + ULONG_PTR pfnGetUnderline; + ULONG_PTR pfnGetStrikethrough; + ULONG_PTR pfnGetDrawingEffect; + ULONG_PTR pfnGetInlineObject; + ULONG_PTR pfnGetTypography; + ULONG_PTR pfnGetLocaleNameLength; + ULONG_PTR pfnGetLocaleName; + ULONG_PTR pfnDraw; + ULONG_PTR pfnGetLineMetrics; + ULONG_PTR pfnGetMetrics; + ULONG_PTR pfnGetOverhangMetrics; + ULONG_PTR pfnGetClusterMetrics; + ULONG_PTR pfnDetermineMinWidth; + ULONG_PTR pfnHitTestPoint; + ULONG_PTR pfnHitTestTextPosition; + ULONG_PTR pfnHitTestTextRange; +}IDWriteTextLayoutLiteTbl, * pIDWriteTextLayoutLiteTbl; + +typedef struct { + pIDWriteTextLayoutLiteTbl Vtbl; + ULONG RefCount; +}IDWriteTextLayoutLite, * pIDWriteTextLayoutLite; + +typedef struct { + IUnknownLite IUnknown; + ULONG_PTR pfnGetFontCollection; // tentative + ULONG_PTR pfnGetFontCount; + ULONG_PTR pfnGetFont; +}IDWriteFontListLiteTbl, * pIDWriteFontListLiteTbl; + +typedef struct { + pIDWriteFontListLiteTbl Vtbl; +}IDWriteFontListLite, * pIDWriteFontListLite; + +typedef struct { + IDWriteFontListLiteTbl IDWriteFontList; + ULONG_PTR pfnGetFamilyNames; // tentative + ULONG_PTR pfnGetFirstMatchingFont; + ULONG_PTR pfnGetMatchingFonts; +}IDWriteFontFamilyLiteTbl, * pIDWriteFontFamilyLiteTbl; + +typedef struct { + pIDWriteFontFamilyLiteTbl Vtbl; + ULONG RefCount; + PCWSTR FontFamilyStr; +}IDWriteFontFamilyLite, * pIDWriteFontFamilyLite; + +typedef struct { + IUnknownLite IUnknown; + ULONG_PTR pfnCreateFontFace; + ULONG_PTR pfnGetFaceNames; + ULONG_PTR pfnGetFontFamily; + ULONG_PTR pfnGetInformationalStrings; + ULONG_PTR pfnIsSymbolFont; + ULONG_PTR pfnGetMetrics; + ULONG_PTR pfnGetGlyphCount; // offset 0x48 + ULONG_PTR pfnGetDesignGlyphMetrics; + ULONG_PTR pfnGetGlyphIndices; + ULONG_PTR pfnTryGetFontTable; + ULONG_PTR pfnReleaseFontTable; + ULONG_PTR pfnGetMetrics2; + ULONG_PTR pfnGetPanose; + ULONG_PTR pfnGetUnicodeRanges; + ULONG_PTR pfnIsMonospacedFont; + ULONG_PTR pfnIsColorFont; + ULONG_PTR pfnCreateFontFace3; + ULONG_PTR pfnEquals; + ULONG_PTR pfnGetFontFaceReference; + ULONG_PTR pfnGetLocality; +}IDWriteFontFaceLiteTbl, * pIDWriteFontFaceLiteTbl; + +typedef struct { + pIDWriteFontFaceLiteTbl Vtbl; + ULONG RefCount; + LOGFONTW lf; + TEXTMETRICW tm; +}IDWriteFontFaceLite, * pIDWriteFontFaceLite; + +typedef struct { + IUnknownLite IUnknown; + ULONG_PTR pfnIsSymbolFont; + ULONG_PTR pfnGetWeight; + ULONG_PTR pfnGetStretch; + ULONG_PTR pfnGetStyle; + ULONG_PTR pfnGetMetrics; + ULONG_PTR pfnGetFontFamily; + ULONG_PTR pfnGetInformationalStrings; + ULONG_PTR pfnGetSimulations; + ULONG_PTR pfnGetFaceNames; + ULONG_PTR pfnHasCharacter; + ULONG_PTR pfnCreateFontFace; + ULONG_PTR pfnGetMetrics2; + ULONG_PTR pfnGetPanose; + ULONG_PTR pfnGetUnicodeRanges; + ULONG_PTR pfnIsMonospacedFont; + ULONG_PTR pfnIsColorFont; + ULONG_PTR pfnCreateFontFace3; + ULONG_PTR pfnEquals; + ULONG_PTR pfnGetFontFaceReference; + ULONG_PTR pfnGetLocality; +}IDWriteFontLiteTbl, * pIDWriteFontLiteTbl; + +typedef struct { + pIDWriteFontLiteTbl Vtbl; + ULONG RefCount; + LOGFONTW lf; + TEXTMETRICW tm; +}IDWriteFontLite, * pIDWriteFontLite; + +typedef struct { + pIDWriteFactoryLiteTbl Vtbl; + ULONG RefCount; +}IDWriteFactoryLite, *pIDWriteFactoryLite; + +typedef struct { + IUnknownLite IUnknown; + ULONG_PTR pfnSetPrivateData; + ULONG_PTR pfnSetPrivateDataInterface; + ULONG_PTR pfnGetPrivateData; + ULONG_PTR pfnGetParent; +}IDXGIObjectLite, *pIDXGIObjectLite; + +typedef struct { + IDXGIObjectLite IDXGIObject; + ULONG_PTR pfnEnumAdapters; + ULONG_PTR pfnCreateSoftwareAdapater; + ULONG_PTR pfnCreateSwapChain; + ULONG_PTR pfnGetWindowAssociation; + ULONG_PTR pfnMakeWindowAssociation; +}IDXGIFactoryLite, *pIDXGIFactoryLite; + +typedef struct{ + IDXGIFactoryLite IDXGIFactory; + ULONG_PTR EnumAdapters1; + ULONG_PTR IsCurrent; +}IDXGIFactory1LiteTbl, *pIDXGIFactory1LiteTbl; + +typedef struct { + pIDXGIFactory1LiteTbl Vtbl; +}IDXGIFactory1Lite, *pIDXGIFactory1Lite; + +typedef struct { + IDXGIObjectLite IDXGIObject; + ULONG_PTR pfnEnumOutputs; + ULONG_PTR pfnGetDesc; + ULONG_PTR pfnCheckInterfaceSupport; +}IDXGIAdapterLiteTbl, *pIDXGIAdapterLiteTbl; + +typedef struct { + pIDXGIAdapterLiteTbl Vtbl; +}IDXGIAdapterLite, *pIDXGIAdapterLite; \ No newline at end of file diff --git a/combase.c b/combase.c new file mode 100644 index 0000000..97b694e --- /dev/null +++ b/combase.c @@ -0,0 +1,75 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +HRESULT WINAPI Implementation_WindowsCreateString( + PCNZWCH sourceString, + UINT32 length, + HSTRING* string +) +{ + PUNICODE_STRING pStr; + + if (!string && length != 0) + return E_POINTER; + + if (!string) + return E_INVALIDARG; + + pStr = (PUNICODE_STRING) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(UNICODE_STRING)); + if (!pStr) + return E_OUTOFMEMORY; + RtlInitUnicodeString(pStr, sourceString); + + *string = pStr; + + return S_OK; +} + +HRESULT WINAPI Implementation_WindowsDeleteString( + HSTRING string +) +{ + if (!string) + return E_INVALIDARG; + + HeapFree(GetProcessHeap(), HEAP_ZERO_MEMORY, string); + + + return S_OK; +} + +PCWSTR WINAPI Implementation_WindowsGetStringRawBuffer( + HSTRING string, + UINT32* length +) +{ + return NULL; +} + +HRESULT WINAPI Implementation_RoGetActivationFactory( + HSTRING activatableClassId, + REFIID iid, + void** factory +) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI Implementation_RoActivateInstance( + HSTRING activatableClassId, + PVOID** instance +) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI Implementation_WindowsCreateStringReference( + PCWSTR sourceString, + UINT32 length, + HSTRING_HEADER* hstringHeader, + HSTRING* string +) +{ + return E_NOTIMPL; +} \ No newline at end of file diff --git a/condvar.c b/condvar.c new file mode 100644 index 0000000..70724a4 --- /dev/null +++ b/condvar.c @@ -0,0 +1,280 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +#define SEMAPHORE_BIT (1 << 31) + +typedef struct +{ + PULONG CondVarBitMasks; + ULONG NumberBitMasks; +}COND_VAR_BASE, * PCOND_VAR_BASE; + + +NTSYSAPI PVOID RtlAllocateHeap( + PVOID HeapHandle, + ULONG Flags, + SIZE_T Size +); + +NTSYSAPI VOID RtlFreeHeap( + PVOID HeapHandle, + ULONG Flags, + PVOID BaseAddress +); + +#define RtlMoveMemory RtlMoveMemory + +VOID NTAPI RtlMoveMemory( + PVOID Destination, + PVOID Source, + SIZE_T Length +); + +/* + A condition variable is a synchronization object which allows many + threads to synchronize on one variable, in a pseudo-queue. + + I determined that the condition variable could consist of an expandable array of bit masks. + One bit mask has two bits per thread; one to indicate that the section of the bit mask is in use + and another to indicate that the bit mask has been signalled. +*/ + +typedef struct { + HANDLE SingleWakeEvent; + HANDLE AllWakeEvent; + HANDLE AccessSemaphore; + ULONG WaiterCount; +}CONDITION_VARIABLE_INT, * PCONDITION_VARIABLE_INT; + +BOOL WINAPI Implementation_SleepConditionVariableSRW( + PCONDITION_VARIABLE ConditionVariable, + PSRWLOCK SRWLock, + DWORD dwMilliseconds, + ULONG Flags +) +{ + int i; + DWORD dwWaitStatus; + DWORD dwCondVarIdx; + PTEB_CUSTOM Teb; + PCONDITION_VARIABLE_INT pCondVar; + + if (!(!SRWLock && Flags == 2)) { + + if (!ConditionVariable || !SRWLock || Flags & ~(CONDITION_VARIABLE_LOCKMODE_SHARED)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + } + + Teb = (PTEB_CUSTOM)NtCurrentTeb(); + + if (!ConditionVariable->Ptr) + { + pCondVar = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CONDITION_VARIABLE_INT)); + if (!pCondVar) + return FALSE; +#ifdef _M_X64 + if (InterlockedCompareExchange64(ConditionVariable, pCondVar, 0)) +#else + if (InterlockedCompareExchange(ConditionVariable, pCondVar, 0)) +#endif + HeapFree(GetProcessHeap(), 0, pCondVar); + else + { + pCondVar->WaiterCount = 0; + pCondVar->AccessSemaphore = CreateSemaphoreA(NULL, 1, 1, NULL); + pCondVar->AllWakeEvent = CreateEventA(NULL, TRUE, FALSE, NULL); + pCondVar->SingleWakeEvent = CreateEventA(NULL, FALSE, FALSE, NULL); + } + } + + pCondVar = ConditionVariable->Ptr; + + WaitForSingleObject(pCondVar->AccessSemaphore, INFINITE); + + InterlockedIncrement(&pCondVar->WaiterCount); + + ReleaseSemaphore(pCondVar->AccessSemaphore, 1, NULL); + + if (Flags & CONDITION_VARIABLE_LOCKMODE_SHARED) + Implementation_ReleaseSRWLockShared(SRWLock); + else + Implementation_ReleaseSRWLockExclusive(SRWLock); + + + HANDLE MultipleHandles[2] = { pCondVar->AllWakeEvent, pCondVar->SingleWakeEvent }; + dwWaitStatus = WaitForMultipleObjects(2, MultipleHandles, FALSE, dwMilliseconds); + + if (!InterlockedDecrement(&pCondVar->WaiterCount)) { + ResetEvent(pCondVar->AllWakeEvent); + ResetEvent(pCondVar->SingleWakeEvent); + ReleaseSemaphore(pCondVar->AccessSemaphore, 1, NULL); + } + else if (dwWaitStatus == WAIT_OBJECT_0 + 1) + { + ReleaseSemaphore(pCondVar->AccessSemaphore, 1, NULL); + } + + + if (Flags & CONDITION_VARIABLE_LOCKMODE_SHARED) + Implementation_AcquireSRWLockShared(SRWLock); + else + Implementation_AcquireSRWLockExclusive(SRWLock); + + if (dwWaitStatus != WAIT_OBJECT_0 && + dwWaitStatus != WAIT_OBJECT_0 + 1) + { + SetLastError(ERROR_TIMEOUT); + return FALSE; + } + else + return TRUE; +} + +BOOL WINAPI Implementation_SleepConditionVariableCS( + PCONDITION_VARIABLE ConditionVariable, + PCRITICAL_SECTION CriticalSection, + DWORD dwMilliseconds +) +{ + int i; + DWORD dwWaitStatus; + DWORD dwCondVarIdx; + PTEB_CUSTOM Teb; + PCONDITION_VARIABLE_INT pCondVar; + + if (!ConditionVariable || !CriticalSection) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + + if (!ConditionVariable->Ptr) + { + pCondVar = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CONDITION_VARIABLE_INT)); + +#ifdef _M_X64 + if (InterlockedCompareExchange64(ConditionVariable, pCondVar, 0)) +#else + if (InterlockedCompareExchange(ConditionVariable, pCondVar, 0)) +#endif + HeapFree(GetProcessHeap(), 0, pCondVar); + else + { + pCondVar->WaiterCount = 0; + pCondVar->AccessSemaphore = CreateSemaphoreA(NULL, 1, 1, NULL); + pCondVar->AllWakeEvent = CreateEventA(NULL, TRUE, FALSE, NULL); + pCondVar->SingleWakeEvent = CreateEventA(NULL, FALSE, FALSE, NULL); + } + } + + pCondVar = ConditionVariable->Ptr; + + WaitForSingleObject(pCondVar->AccessSemaphore, INFINITE); + + InterlockedIncrement(&pCondVar->WaiterCount); + + ReleaseSemaphore(pCondVar->AccessSemaphore, 1, NULL); + + LeaveCriticalSection(CriticalSection); + HANDLE MultipleHandles[2] = { pCondVar->AllWakeEvent, pCondVar->SingleWakeEvent }; + dwWaitStatus = WaitForMultipleObjects(2, MultipleHandles, FALSE, dwMilliseconds); + + if (!InterlockedDecrement(&pCondVar->WaiterCount)) { + ResetEvent(pCondVar->AllWakeEvent); + ResetEvent(pCondVar->SingleWakeEvent); + ReleaseSemaphore(pCondVar->AccessSemaphore, 1, NULL); + } + else if (dwWaitStatus == WAIT_OBJECT_0 + 1) + { + ReleaseSemaphore(pCondVar->AccessSemaphore, 1, NULL); + } + + EnterCriticalSection(CriticalSection); + SetLastError(dwWaitStatus); + if (dwWaitStatus != WAIT_OBJECT_0 && + dwWaitStatus != WAIT_OBJECT_0 + 1) + { + SetLastError(ERROR_TIMEOUT); + return FALSE; + } + else + return TRUE; +} + +void WINAPI Implementation_InitializeConditionVariable( + PCONDITION_VARIABLE ConditionVariable +) +{ + ConditionVariable->Ptr = 0; +} + +typedef struct _THREAD_BASIC_INFORMATION { + NTSTATUS ExitStatus; + PVOID TebBaseAddress; + CLIENT_ID ClientId; + KAFFINITY AffinityMask; + KPRIORITY Priority; + KPRIORITY BasePriority; +} THREAD_BASIC_INFORMATION, * PTHREAD_BASIC_INFORMATION; + +typedef struct _OBJECT_BASIC_INFORMATION { + ULONG Attributes; + ACCESS_MASK GrantedAccess; + ULONG HandleCount; + ULONG PointerCount; + ULONG PagedPoolCharge; + ULONG NonPagedPoolCharge; + ULONG Reserved[3]; + ULONG NameInfoSize; + ULONG TypeInfoSize; + ULONG SecurityDescriptorSize; + LARGE_INTEGER CreationTime; +} OBJECT_BASIC_INFORMATION, * POBJECT_BASIC_INFORMATION; + + +void WINAPI Implementation_WakeConditionVariable( + PCONDITION_VARIABLE ConditionVariable +) +{ + if (ConditionVariable) + { + PCONDITION_VARIABLE_INT pCondVar = ConditionVariable->Ptr; + if (ConditionVariable->Ptr) { + WaitForSingleObject(pCondVar->AccessSemaphore, INFINITE); + if (!pCondVar->WaiterCount) { + ReleaseSemaphore(pCondVar->AccessSemaphore, 1, NULL); + } + else { + SetEvent(pCondVar->SingleWakeEvent); + } + } + } +} + + + +void WINAPI Implementation_WakeAllConditionVariable( + PCONDITION_VARIABLE ConditionVariable +) +{ + if (ConditionVariable) + { + PCONDITION_VARIABLE_INT pCondVar = ConditionVariable->Ptr; + if (ConditionVariable->Ptr) { + WaitForSingleObject(pCondVar->AccessSemaphore, INFINITE); + if (!pCondVar->WaiterCount) { + ReleaseSemaphore(pCondVar->AccessSemaphore, 1, NULL); + } + else { + SetEvent(pCondVar->AllWakeEvent); + } + } + } + +} \ No newline at end of file diff --git a/dbg.c b/dbg.c new file mode 100644 index 0000000..1188d68 --- /dev/null +++ b/dbg.c @@ -0,0 +1,31 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include + +BOOL WINAPI Implementation_SymGetSearchPathW( + HANDLE hProcess, + PWSTR SearchPath, + DWORD SearchPathLength +) +{ + return FALSE; +} + +BOOL WINAPI Implementation_SymSetSearchPathW( + HANDLE hProcess, + PCWSTR SearchPath +) +{ + return FALSE; +} + +BOOL WINAPI Implementation_SymFromAddr( + HANDLE hProcess, + DWORD64 Address, + PDWORD64 Displacement, + PSYMBOL_INFO Symbol +) +{ + return FALSE; +} \ No newline at end of file diff --git a/dllmain.c b/dllmain.c new file mode 100644 index 0000000..f8b318f --- /dev/null +++ b/dllmain.c @@ -0,0 +1,780 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +volatile BOOLEAN g_InitCompleted = FALSE; + +HANDLE hProcessClose; + +#define LoadFuncPfn(x, y) pfnFunc = NULL; RtlInitAnsiString(&ansi_str, #y); LdrGetProcedureAddress(x, &ansi_str, 0, &pfnFunc); \ + if (pfnFunc) { g_pfn_##y = pfnFunc;} else { g_pfn_##y = (pfnFunc_generic)Implementation_##y;} + +#define LoadFuncPfnLite(x, y) RtlInitAnsiString(&ansi_str, #y); LdrGetProcedureAddress(x, &ansi_str, 0, &pfnFunc); g_pfn_##y = pfnFunc; + +// This macro above covers the cases where functions are "completely" missing. But what about when functions are "partially" missing? +// (i.e. missing flags, etc.) +// In the context of this DLL, we may have three different states: fully-functional function, partially-implemented function and +// completely-missing function. We don't know at the init process if flags are missing or not. So if the function is partially implemented, +// we can try calling the original function, test for an invalid parameter error, and then try the "missing bit". +// The option to completely replace functions should also be available. + +void InitPtrs_kernel32() +{ + UNICODE_STRING kernel32s; + HMODULE kernel32 = NULL; + RtlInitUnicodeString(&kernel32s, L"kernel32.dll"); + if(!LdrLoadDll(NULL, 0, &kernel32s, &kernel32)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(kernel32, GetMaximumProcessorCount); + LoadFuncPfn(kernel32, GetMaximumProcessorGroupCount); + LoadFuncPfn(kernel32, GetLogicalProcessorInformationEx); + LoadFuncPfn(kernel32, GetThreadGroupAffinity); + LoadFuncPfn(kernel32, GetCurrentProcessorNumber); + + LoadFuncPfn(kernel32, PowerCreateRequest); + LoadFuncPfn(kernel32, PowerSetRequest); + LoadFuncPfn(kernel32, PowerClearRequest); + + LoadFuncPfn(kernel32, ResolveLocaleName); + LoadFuncPfn(kernel32, EnumSystemLocalesEx); + LoadFuncPfn(kernel32, GetCurrencyFormatEx); + LoadFuncPfn(kernel32, GetDateFormatEx); + LoadFuncPfn(kernel32, GetDynamicTimeZoneInformation); + LoadFuncPfn(kernel32, GetLocaleInfoEx); + LoadFuncPfn(kernel32, GetNumberFormatEx); + LoadFuncPfn(kernel32, GetTimeFormatEx); + LoadFuncPfn(kernel32, GetUserDefaultLocaleName); + LoadFuncPfn(kernel32, LCIDToLocaleName); + LoadFuncPfn(kernel32, LocaleNameToLCID); + + LoadFuncPfn(kernel32, TryAcquireSRWLockExclusive); // These functions can be loaded independently of the "real" + LoadFuncPfn(kernel32, TryAcquireSRWLockShared); // SRW lock functions because they are compatible + LoadFuncPfn(kernel32, AcquireSRWLockExclusive); + if(g_pfn_AcquireSRWLockExclusive != (pfnFunc_generic)Implementation_AcquireSRWLockExclusive && + g_pfn_TryAcquireSRWLockExclusive == (pfnFunc_generic)Implementation_TryAcquireSRWLockExclusive) + // If the real AcquireSRWLockExclusive is available but not TryAcquireSRWLockExclusive, + // load the "Vista" versions of the try acquire SRW lock functions + { + g_pfn_TryAcquireSRWLockExclusive = (pfnFunc_generic)Implementation_TryAcquireSRWLockExclusive_Vista; + g_pfn_TryAcquireSRWLockShared = (pfnFunc_generic)Implementation_TryAcquireSRWLockShared_Vista; + g_pfn_GetLogicalProcessorInformationEx = (pfnFunc_generic)Implementation_GetLogicalProcessorInformationEx; + } + LoadFuncPfn(kernel32, AcquireSRWLockShared); + LoadFuncPfn(kernel32, ReleaseSRWLockExclusive); + LoadFuncPfn(kernel32, ReleaseSRWLockShared); + LoadFuncPfn(kernel32, InitializeSRWLock); + LoadFuncPfn(kernel32, SleepConditionVariableSRW); + LoadFuncPfn(kernel32, SleepConditionVariableCS); + LoadFuncPfn(kernel32, WakeConditionVariable); + LoadFuncPfn(kernel32, WakeAllConditionVariable); + LoadFuncPfn(kernel32, InitializeConditionVariable); + LoadFuncPfn(kernel32, InitOnceExecuteOnce); + LoadFuncPfn(kernel32, InitOnceBeginInitialize); + LoadFuncPfn(kernel32, InitOnceComplete); + LoadFuncPfn(kernel32, InitOnceInitialize); + LoadFuncPfn(kernel32, CreateWaitableTimerExW); + LoadFuncPfn(kernel32, InitializeCriticalSectionEx); + + LoadFuncPfn(kernel32, DecodePointer); + LoadFuncPfn(kernel32, EncodePointer); + + LoadFuncPfn(kernel32, WerRegisterRuntimeExceptionModule); + + LoadFuncPfn(kernel32, CreateRemoteThreadEx); + + g_pfn_FindFirstFileExW = (pfnFunc_generic)Implementation_FindFirstFileExW; + + LoadFuncPfn(kernel32, CancelIoEx); + LoadFuncPfn(kernel32, GetFinalPathNameByHandleW); + LoadFuncPfn(kernel32, SetFileInformationByHandle); + + LoadFuncPfn(kernel32, DeleteProcThreadAttributeList); + LoadFuncPfn(kernel32, UpdateProcThreadAttribute); + LoadFuncPfn(kernel32, InitializeProcThreadAttributeList); + LoadFuncPfn(kernel32, QueryFullProcessImageNameA); + LoadFuncPfn(kernel32, QueryFullProcessImageNameW); + LoadFuncPfn(kernel32, QueryProcessCycleTime); + LoadFuncPfn(kernel32, QueryThreadCycleTime); + LoadFuncPfn(kernel32, GetProductInfo); + LoadFuncPfn(kernel32, GetThreadId); + + LoadFuncPfn(kernel32, GetNamedPipeClientProcessId); + LoadFuncPfn(kernel32, GetNamedPipeServerProcessId); + + LoadFuncPfn(kernel32, GetThreadPreferredUILanguages); + LoadFuncPfn(kernel32, GetFileInformationByHandleEx); + LoadFuncPfn(kernel32, Wow64GetThreadContext); + + LoadFuncPfn(kernel32, FlsAlloc); + LoadFuncPfn(kernel32, FlsFree); + //LoadFuncPfn(kernel32, FlsGetValue); + g_pfn_FlsGetValue = (pfnFunc_generic)Implementation_FlsGetValue; + LoadFuncPfn(kernel32, FlsSetValue); + LoadFuncPfn(kernel32, IsThreadAFiber); + LoadFuncPfn(kernel32, ConvertThreadToFiberEx); + + LoadFuncPfn(kernel32, GetProcessId); + + LoadFuncPfn(kernel32, AddVectoredExceptionHandler); + LoadFuncPfn(kernel32, RemoveVectoredExceptionHandler); + + LoadFuncPfn(kernel32, AttachConsole); + LoadFuncPfn(kernel32, WTSGetActiveConsoleSessionId); + LoadFuncPfn(kernel32, CheckRemoteDebuggerPresent); + LoadFuncPfn(kernel32, CreateMemoryResourceNotification); + LoadFuncPfn(kernel32, GetGeoInfoW); + LoadFuncPfn(kernel32, GetLogicalProcessorInformation); + LoadFuncPfn(kernel32, GetModuleHandleExA); + LoadFuncPfn(kernel32, GetModuleHandleExW); + LoadFuncPfn(kernel32, GetNativeSystemInfo); + LoadFuncPfn(kernel32, GetProcessHandleCount); + LoadFuncPfn(kernel32, GetUserGeoID); + LoadFuncPfn(kernel32, GetVolumePathNamesForVolumeNameW); + LoadFuncPfn(kernel32, InitializeSListHead); + LoadFuncPfn(kernel32, InterlockedFlushSList); + LoadFuncPfn(kernel32, InterlockedPushEntrySList); + LoadFuncPfn(kernel32, IsProcessInJob); + LoadFuncPfn(kernel32, IsWow64Process); + LoadFuncPfn(kernel32, SetDllDirectoryW); + LoadFuncPfn(kernel32, TzSpecificLocalTimeToSystemTime); + LoadFuncPfn(kernel32, ConvertFiberToThread); + LoadFuncPfn(kernel32, PrefetchVirtualMemory); + LoadFuncPfn(kernel32, GetFirmwareType); + LoadFuncPfn(kernel32, GetPackagePathByFullName); + LoadFuncPfn(kernel32, GetPackagesByPackageFamily); + LoadFuncPfn(kernel32, LCMapStringEx); + LoadFuncPfn(kernel32, DuplicateHandle); + + if(LOBYTE(GetVersion()) > 5 || LOBYTE(GetVersion() == 5) && LOBYTE(GetVersion() >> 8) >= 2) + { + pfnFunc = NULL; RtlInitAnsiString(&ansi_str, "CreateFiberEx"); LdrGetProcedureAddress(kernel32, &ansi_str, 0, &pfnFunc); + g_pfn_CreateFiberEx = pfnFunc; + pfnFunc = NULL; RtlInitAnsiString(&ansi_str, "SwitchToFiber"); LdrGetProcedureAddress(kernel32, &ansi_str, 0, &pfnFunc); + g_pfn_SwitchToFiber = pfnFunc; + } + else + { + g_pfn_CreateFiberEx = (pfnFunc_generic)Implementation_CreateFiberEx; + // g_pfn_SwitchToFiber = (pfnFunc_generic)Implementation_SwitchToFiber; + pfnFunc = NULL; RtlInitAnsiString(&ansi_str, "SwitchToFiber"); LdrGetProcedureAddress(kernel32, &ansi_str, 0, &pfnFunc); + g_pfn_SwitchToFiber = pfnFunc; + } + LoadFuncPfn(kernel32, SetProcessDEPPolicy); + LoadFuncPfn(kernel32, InterlockedPopEntrySList); + LoadFuncPfn(kernel32, HeapSetInformation); + g_pfn_GetProcAddress = (pfnFunc_generic)Implementation_GetProcAddress; + g_pfn_LoadLibraryW = (pfnFunc_generic)Implementation_LoadLibraryW; + g_pfn_LoadLibraryA = (pfnFunc_generic)Implementation_LoadLibraryA; + g_pfn_LoadLibraryExW = (pfnFunc_generic)Implementation_LoadLibraryExW; + g_pfn_LoadLibraryExA = (pfnFunc_generic)Implementation_LoadLibraryExA; + if (LOBYTE(GetVersion()) < 6) + { + g_pfn_DuplicateHandle = (pfnFunc_generic)Implementation_DuplicateHandle; + } + LoadFuncPfn(kernel32, DiscardVirtualMemory); + } + + return; +} + +void InitPtrs_shell32() +{ + UNICODE_STRING shell32s; + HMODULE shell32 = NULL; + RtlInitUnicodeString(&shell32s, L"shell32.dll"); + if(!LdrLoadDll(NULL, 0, &shell32s, &shell32)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(shell32, SHGetPropertyStoreForWindow); + LoadFuncPfn(shell32, SHGetKnownFolderPath); + LoadFuncPfn(shell32, SHQueryUserNotificationState); + } + + return; +} + +void InitPtrs_ntdll() +{ + UNICODE_STRING ntdlls; + HMODULE ntdll = NULL; + RtlInitUnicodeString(&ntdlls, L"ntdll.dll"); + if(!LdrLoadDll(NULL, 0, &ntdlls, &ntdll)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(ntdll, NtOpenKeyEx); + LoadFuncPfn(ntdll, RtlGetLastNtStatus); + RtlInitAnsiString(&ansi_str, "wcsstr"); + pfnFunc = NULL; + LdrGetProcedureAddress(ntdll, &ansi_str, 0, &pfnFunc); + g_wcsstr = pfnFunc; + RtlInitAnsiString(&ansi_str, "strstr"); + pfnFunc = NULL; + LdrGetProcedureAddress(ntdll, &ansi_str, 0, &pfnFunc); + g_strstr = pfnFunc; + } + return; +} + +void InitPtrs_psapi() +{ + UNICODE_STRING psapis; + HMODULE psapi = NULL; + RtlInitUnicodeString(&psapis, L"psapi.dll"); + if(!LdrLoadDll(NULL, 0, &psapis, &psapi)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(psapi, GetModuleInformation); + LoadFuncPfn(psapi, GetProcessMemoryInfo); + LoadFuncPfn(psapi, QueryWorkingSetEx); + LoadFuncPfn(psapi, GetPerformanceInfo); + } +} + +void InitPtrs_user32() +{ + UNICODE_STRING user32s; + HMODULE user32 = NULL; + UNICODE_STRING shcores; + HMODULE shcore = NULL; + RtlInitUnicodeString(&user32s, L"user32.dll"); + RtlInitUnicodeString(&shcores, L"SHCore.dll"); + LdrLoadDll(NULL, 0, &shcores, &shcore); + if(!LdrLoadDll(NULL, 0, &user32s, &user32)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(user32, RegisterTouchWindow); + LoadFuncPfn(user32, GetDisplayConfigBufferSizes); + LoadFuncPfn(user32, CloseTouchInputHandle); + LoadFuncPfn(user32, GetGestureInfo); + LoadFuncPfn(user32, DisplayConfigGetDeviceInfo); + LoadFuncPfn(user32, DisplayConfigSetDeviceInfo); + LoadFuncPfn(user32, QueryDisplayConfig); + LoadFuncPfn(user32, SetProcessDPIAware); + LoadFuncPfn(user32, RegisterPowerSettingNotification); + LoadFuncPfn(user32, UnregisterPowerSettingNotification); + LoadFuncPfn(shcore, GetDpiForMonitor); + LoadFuncPfn(user32, GetLayeredWindowAttributes); + LoadFuncPfn(user32, GetRawInputDeviceInfoW); + LoadFuncPfn(user32, PrintWindow); + LoadFuncPfn(user32, DefRawInputProc); + LoadFuncPfn(user32, GetRawInputDeviceList); + LoadFuncPfn(user32, RegisterRawInputDevices); + LoadFuncPfn(user32, UnhookWindowsHookEx); + LoadFuncPfn(user32, RegisterPointerDeviceNotifications); + LoadFuncPfn(user32, GetPointerDevices); + LoadFuncPfn(user32, GetPointerDevice); + + g_pfn_SystemParametersInfoW = (pfnFunc_generic)Implementation_SystemParametersInfoW; + //g_pfn_RegisterClassExW = (pfnFunc_generic)Implementation_RegisterClassExW; + } + + return; +} + +void InitPtrs_dbghelp() +{ + UNICODE_STRING dbghelps; + HMODULE dbghelp = NULL; + RtlInitUnicodeString(&dbghelps, L"dbghelp.dll"); + if(!LdrLoadDll(NULL, 0, &dbghelps, &dbghelp)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(dbghelp, SymGetSearchPathW); + LoadFuncPfn(dbghelp, SymSetSearchPathW); + } + + return; +} + +void InitPtrs_ws2_32() +{ + UNICODE_STRING ws2_32s; + HMODULE ws2_32 = NULL; + RtlInitUnicodeString(&ws2_32s, L"ws2_32.dll"); + if(!LdrLoadDll(NULL, 0, &ws2_32s, &ws2_32)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(ws2_32, inet_ntop); + LoadFuncPfn(ws2_32, freeaddrinfo); + LoadFuncPfn(ws2_32, getaddrinfo); + } + + return; +} + +void InitPtrs_iphlpapi() +{ + UNICODE_STRING iphlpapis; + HMODULE iphlpapi = NULL; + RtlInitUnicodeString(&iphlpapis, L"iphlpapi.dll"); + if(!LdrLoadDll(NULL, 0, &iphlpapis, &iphlpapi)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(iphlpapi, FreeMibTable); + LoadFuncPfn(iphlpapi, GetIfTable2); + LoadFuncPfn(iphlpapi, CancelIPChangeNotify); + LoadFuncPfn(iphlpapi, GetAdaptersAddresses); + } + + return; +} + +void InitPtrs_advapi32() +{ + UNICODE_STRING advapi32s; + HMODULE advapi32 = NULL; + RtlInitUnicodeString(&advapi32s, L"advapi32.dll"); + if(!LdrLoadDll(NULL, 0, &advapi32s, &advapi32)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(advapi32, AddMandatoryAce); + LoadFuncPfn(advapi32, EventRegister); + LoadFuncPfn(advapi32, EventSetInformation); + LoadFuncPfn(advapi32, EventUnregister); + LoadFuncPfn(advapi32, EventWrite); + LoadFuncPfn(advapi32, EventWriteTransfer); + LoadFuncPfn(advapi32, RegDeleteKeyExW); + LoadFuncPfn(advapi32, RegGetValueW); + LoadFuncPfn(advapi32, SystemFunction036); + } + + return; +} + +void InitPtrs_wevtapi() +{ + UNICODE_STRING wevtapis; + HMODULE wevtapi = NULL; + RtlInitUnicodeString(&wevtapis, L"wevtapi.dll"); + // This is slightly different; the DLL was not always in Windows, so we won't verify that it exists. + LdrLoadDll(NULL, 0, &wevtapis, &wevtapi); + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(wevtapi, EvtQuery); + LoadFuncPfn(wevtapi, EvtCreateRenderContext); + LoadFuncPfn(wevtapi, EvtNext); + LoadFuncPfn(wevtapi, EvtRender); + LoadFuncPfn(wevtapi, EvtClose); + + return; +} + +void InitPtrs_dwmapi() +{ + UNICODE_STRING dwmapis; + HMODULE dwmapi = NULL; + RtlInitUnicodeString(&dwmapis, L"dwmapi.dll"); + LdrLoadDll(NULL, 0, &dwmapis, &dwmapi); + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(dwmapi, DwmSetWindowAttribute); + LoadFuncPfn(dwmapi, DwmGetWindowAttribute); + LoadFuncPfn(dwmapi, DwmGetCompositionTimingInfo); + LoadFuncPfn(dwmapi, DwmExtendFrameIntoClientArea); + LoadFuncPfn(dwmapi, DwmDefWindowProc); + + return; +} + +void InitPtrs_setupapi() +{ + UNICODE_STRING setupapis; + HMODULE setupapi = NULL; + RtlInitUnicodeString(&setupapis, L"setupapi.dll"); + if(!LdrLoadDll(NULL, 0, &setupapis, &setupapi)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(setupapi, SetupDiGetDevicePropertyW); + } + + return; +} + +void InitPtrs_dxgi() +{ + UNICODE_STRING dxgis; + HMODULE dxgi = NULL; + RtlInitUnicodeString(&dxgis, L"dxgi.dll"); + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LdrLoadDll(NULL, 0, &dxgis, &dxgi); + + LoadFuncPfn(dxgi, CreateDXGIFactory); + LoadFuncPfn(dxgi, CreateDXGIFactory1); + + return; +} + +void InitPtrs_usp10() +{ + UNICODE_STRING usp10s; + HMODULE usp10 = NULL; + RtlInitUnicodeString(&usp10s, L"usp10.dll"); + if(!LdrLoadDll(NULL, 0, &usp10s, &usp10)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(usp10, ScriptItemize); + } + + return; +} + +void InitPtrs_pdh() +{ + UNICODE_STRING pdhs; + HMODULE pdh = NULL; + RtlInitUnicodeString(&pdhs, L"pdh.dll"); + if(!LdrLoadDll(NULL, 0, &pdhs, &pdh)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(pdh, PdhAddEnglishCounterW); + } + + return; +} + +void InitPtrs_powrprof() +{ + UNICODE_STRING powrprofs; + HMODULE powrprof = NULL; + RtlInitUnicodeString(&powrprofs, L"powrprof.dll"); + if(!LdrLoadDll(NULL, 0, &powrprofs, &powrprof)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(powrprof, PowerDeterminePlatformRole); + } + + return; +} + +void InitPtrs_wtsapi32() +{ + UNICODE_STRING wtsapi32s; + HMODULE wtsapi32 = NULL; + RtlInitUnicodeString(&wtsapi32s, L"wtsapi32.dll"); + if(!LdrLoadDll(NULL, 0, &wtsapi32s, &wtsapi32)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(wtsapi32, WTSRegisterSessionNotification); + LoadFuncPfn(wtsapi32, WTSUnRegisterSessionNotification); + } + + return; +} + +void InitPtrs_crypt32() +{ + UNICODE_STRING crypt32s; + HMODULE crypt32 = NULL; + RtlInitUnicodeString(&crypt32s, L"crypt32.dll"); + if (!LdrLoadDll(NULL, 0, &crypt32s, &crypt32)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(crypt32, CryptProtectMemory); + LoadFuncPfn(crypt32, CryptUnprotectMemory); + } + + return; +} + + +void InitPtrs_bcryptprimitives() +{ + UNICODE_STRING bcryptprimitivess; + HMODULE bcryptprimitives = NULL; + RtlInitUnicodeString(&bcryptprimitivess, L"bcryptprimitives.dll"); +// if(!LdrLoadDll(NULL, 0, &bcryptprimitivess, &bcryptprimitives)) +// { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + g_pfn_ProcessPrng = g_pfn_SystemFunction036; +// } + + return; +} + +void InitPtrs_uxtheme() +{ + UNICODE_STRING uxthemes; + HMODULE uxtheme = NULL; + RtlInitUnicodeString(&uxthemes, L"uxtheme.dll"); + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LdrLoadDll(NULL, 0, &uxthemes, &uxtheme); + + LoadFuncPfn(uxtheme, CloseThemeData); + LoadFuncPfn(uxtheme, OpenThemeData); + LoadFuncPfn(uxtheme, GetThemePartSize); + LoadFuncPfn(uxtheme, DrawThemeBackground); + LoadFuncPfn(uxtheme, GetThemeBackgroundContentRect); + + return; +} + +void InitPtrs_ole32() +{ + UNICODE_STRING ole32s; + HMODULE ole32 = NULL; + RtlInitUnicodeString(&ole32s, L"ole32.dll"); + if(!LdrLoadDll(NULL, 0, &ole32s, &ole32)) + { + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(ole32, CoRegisterInitializeSpy); + LoadFuncPfn(ole32, CoRevokeInitializeSpy); + } + + return; +} + +void InitPtrs_combase() +{ + UNICODE_STRING combases; + HMODULE combase = NULL; + RtlInitUnicodeString(&combases, L"combase.dll"); + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LdrLoadDll(NULL, 0, &combases, &combase); + + LoadFuncPfn(combase, WindowsCreateString); + LoadFuncPfn(combase, WindowsGetStringRawBuffer); + LoadFuncPfn(combase, WindowsDeleteString); + LoadFuncPfn(combase, RoGetActivationFactory); + LoadFuncPfn(combase, RoActivateInstance); + LoadFuncPfn(combase, WindowsCreateStringReference); + + return; +} + +void InitPtrs_dwrite() +{ + UNICODE_STRING dwrites; + HMODULE dwrite = NULL; + RtlInitUnicodeString(&dwrites, L"dwrite.dll"); + + ANSI_STRING ansi_str; + PVOID pfnFunc = NULL; + + LoadFuncPfn(dwrite, DWriteCreateFactory); + + return; +} + +typedef enum _SEMAPHORE_INFORMATION_CLASS { + SemaphoreBasicInformation +} SEMAPHORE_INFORMATION_CLASS, *PSEMAPHORE_INFORMATION_CLASS; + +typedef struct _SEMAPHORE_BASIC_INFORMATION { + ULONG CurrentCount; + ULONG MaximumCount; +} SEMAPHORE_BASIC_INFORMATION, *PSEMAPHORE_BASIC_INFORMATION; + +NTSYSAPI +NTSTATUS +NTAPI +NtQuerySemaphore( + HANDLE SemaphoreHandle, + SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass, + PVOID SemaphoreInformation, + ULONG SemaphoreInformationLength, + PULONG ReturnLength); + +typedef struct _OBJECT_BASIC_INFORMATION { + ULONG Attributes; + ACCESS_MASK GrantedAccess; + ULONG HandleCount; + ULONG PointerCount; + ULONG PagedPoolCharge; + ULONG NonPagedPoolCharge; + ULONG Reserved [3]; + ULONG NameInfoSize; + ULONG TypeInfoSize; + ULONG SecurityDescriptorSize; + LARGE_INTEGER CreationTime; +} OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION; + + +typedef struct _THREAD_BASIC_INFORMATION { + NTSTATUS ExitStatus; + PVOID TebBaseAddress; + CLIENT_ID ClientId; + KAFFINITY AffinityMask; + KPRIORITY Priority; + KPRIORITY BasePriority; +} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION; + +ULONG g_CoreTlsEntries = 0; + +ULONG GetCoreTlsEntriesCount() +{ + return g_CoreTlsEntries; +} + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + WCHAR AppDataDir [MAX_PATH]; + WCHAR AppDataDir_Exist [MAX_PATH]; + DWORD tid; + PTEB_CUSTOM Teb; + PLDR_DATA_TABLE_ENTRY DataTableEntry, DataTableEntryInit; + LONG i; + PULONG_PTR ThreadLocalStoragePointer; + + Teb = (PTEB_CUSTOM)NtCurrentTeb(); + + if(!InterlockedCompareExchange(&g_InitCompleted, 1, 0)) + { + // g_hFile = CreateFileA( + // "tls_log.txt", // File path + // GENERIC_WRITE, // Desired access + // 0, // Share mode + // NULL, // Security attributes + // CREATE_ALWAYS, // Creation disposition + // FILE_ATTRIBUTE_NORMAL, // Flags and attributes + // NULL // Template file handle + // ); + + if (Teb->ThreadLocalStoragePointer) + { + ThreadLocalStoragePointer = (PULONG_PTR)Teb->ThreadLocalStoragePointer; + + while (*ThreadLocalStoragePointer > 0 && !(*ThreadLocalStoragePointer % 4)) + // Make sure only valid pointers are counted, and not padding that can also bookend the list of pointers + { + ++g_CoreTlsEntries; + ++ThreadLocalStoragePointer; + } + } + InitializeCriticalSection(&SrwSharedCs); + InitializeCriticalSection(&SrwSharedCs2); + MutexInitOnce = CreateMutexW(NULL, FALSE, NULL); + g_SRWEvent = CreateEventW(NULL, TRUE, FALSE, NULL); + g_hkProgwrp = 0; + + InitPtrs_kernel32(); + + InitPtrs_shell32(); + + InitPtrs_ntdll(); + + InitPtrs_user32(); + + InitPtrs_psapi(); + + InitPtrs_dbghelp(); + + InitPtrs_ws2_32(); + + InitPtrs_iphlpapi(); + + InitPtrs_advapi32(); + + InitPtrs_wevtapi(); + + InitPtrs_dwmapi(); + + InitPtrs_setupapi(); + + InitPtrs_dxgi(); + + InitPtrs_usp10(); + + InitPtrs_pdh(); + + InitPtrs_wtsapi32(); + + InitPtrs_powrprof(); + + InitPtrs_bcryptprimitives(); + + InitPtrs_uxtheme(); + + InitPtrs_ole32(); + + InitPtrs_combase(); + + InitPtrs_dwrite(); + + InitPtrs_crypt32(); + + GetEnvironmentVariableW(L"LOCALAPPDATA", AppDataDir_Exist, MAX_PATH); + + if(GetLastError() == ERROR_ENVVAR_NOT_FOUND) + { + SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, 0, AppDataDir); + SetEnvironmentVariableW(L"LOCALAPPDATA", AppDataDir); + } + + MutexRegistry = CreateMutexA(NULL, TRUE, NULL); + + TIMECAPS tc; + + if (LOBYTE(GetVersion()) < 6) { + timeGetDevCaps(&tc, sizeof(TIMECAPS)); + + timeBeginPeriod(tc.wPeriodMin); + } + + } + + + + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + for (i = 0; i < TlsBasesCount; i++) + { + TLSInit_DllMain_ThreadAttach_Internal(TlsBases[i], NULL); + } + if (!Teb->SystemReserved1[0x34]) + Teb->SystemReserved1[0x34] = CreateEventA(NULL, FALSE, FALSE, NULL); + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/dwmapi.c b/dwmapi.c new file mode 100644 index 0000000..48467c3 --- /dev/null +++ b/dwmapi.c @@ -0,0 +1,50 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +HRESULT WINAPI Implementation_DwmSetWindowAttribute( + HWND hwnd, + DWORD dwAttribute, + LPCVOID pvAttribute, + DWORD cbAttribute +) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI Implementation_DwmGetWindowAttribute( + HWND hwnd, + DWORD dwAttribute, + LPCVOID pvAttribute, + DWORD cbAttribute +) +{ + return E_NOTIMPL; +} + +BOOL WINAPI Implementation_DwmDefWindowProc( + HWND hWnd, + UINT msg, + WPARAM wParam, + LPARAM lParam, + LRESULT *plResult +) +{ + return FALSE; +} + +HRESULT WINAPI Implementation_DwmExtendFrameIntoClientArea( + HWND hWnd, + const MARGINS *pMarInset +) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI Implementation_DwmGetCompositionTimingInfo( + HWND hwnd, + DWM_TIMING_INFO *pTimingInfo +) +{ + return E_NOTIMPL; +} \ No newline at end of file diff --git a/dwrite.c b/dwrite.c new file mode 100644 index 0000000..a60f5ca --- /dev/null +++ b/dwrite.c @@ -0,0 +1,915 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include "com_lite.h" +#include + +int _fltused = 0; + +BOOL WINAPI IIDCMP(REFIID x, REFIID y) +{ + int i; + if ((x->Data1 == y->Data1) && (x->Data2 == y->Data2) && (x->Data3 == y->Data3)) + { + for (i = 0; i < 8; i++) + if (x->Data4[i] != y->Data4[i]) + return FALSE; + return TRUE; + } + else + return FALSE; +} + +ULONG WINAPI AddRef_DW(pIDWriteFontLite this) +{ + return InterlockedIncrement(&this->RefCount); +} + +ULONG WINAPI Release_DW(pIDWriteFontLite this) +{ + ULONG Result = InterlockedDecrement(&this->RefCount); + + if (!Result) + { + HeapFree(GetProcessHeap(), 0, this->Vtbl); + HeapFree(GetProcessHeap(), 0, this); + } + + return Result; +} + +ULONG WINAPI GetSimulations(pIDWriteFontLite this) +{ + return 0; +} + +HRESULT WINAPI DWrite_QueryInterface( + ULONG_PTR this, + REFIID riid, + void** ppvObject +) +{ + IID IDWriteFactory = { 0xb859ee5a, 0xd838,0x4b5b, 0xa2, 0xe8, 0x1a, 0xdc, 0x7d, 0x93, 0xdb, 0x48 }; + IID IDWriteFactory1 = { 0x30572f99, 0xdac6, 0x41db, 0xa1, 0x6e, 0x48, 0x63, 0x07, 0xe6, 0x06a }; + if (!ppvObject) + return E_POINTER; + if (IIDCMP(riid, &IDWriteFactory)) + { + *ppvObject = this; + return S_OK; + } + + return E_FAIL; +} + +HRESULT WINAPI TryGetFontTable( + pIDWriteFontFaceLite this, + UINT32 openTypeTableTag, + const void** tableData, + UINT32* tableSize, + void** tableContext, + BOOL* exists +) +{ + HDC hdc; + HFONT hf, hfo; + if (!tableData || !tableSize || !tableContext || !exists) + return E_INVALIDARG; + + hdc = CreateCompatibleDC(NULL); + hf = CreateFontIndirectW(&this->lf); + hfo = SelectObject(hdc, hf); + if (GetFontData(hdc, openTypeTableTag, 0, *tableData, *tableSize) == GDI_ERROR) + *exists = FALSE; + else + *exists = TRUE; + SelectObject(hdc, hfo); + DeleteObject(hf); + DeleteDC(hdc); + return S_OK; +} + +HRESULT WINAPI ReleaseFontTable( + pIDWriteFontFaceLite this, + void* tableContext +) +{ + return S_OK; +} + +UINT16 WINAPI GetGlyphCount( + pIDWriteFontFaceLite this +) +{ + HDC hdc; + HFONT hf, hfo; + GLYPHSET gs; + hdc = CreateCompatibleDC(NULL); + hf = CreateFontIndirectW(&this->lf); + hfo = SelectObject(hdc, hf); + GetFontUnicodeRanges(hdc, &gs); + SelectObject(hdc, hfo); + DeleteObject(hf); + DeleteDC(hdc); + return gs.cGlyphsSupported; +} + +typedef struct _DWRITE_FONT_METRICS { + UINT16 designUnitsPerEm; + UINT16 ascent; + UINT16 descent; + INT16 lineGap; + UINT16 capHeight; + UINT16 xHeight; + INT16 underlinePosition; + UINT16 underlineThickness; + INT16 strikethroughPosition; + UINT16 strikethroughThickness; +} DWRITE_FONT_METRICS, *PDWRITE_FONT_METRICS; + +typedef struct _DWRITE_GLYPH_METRICS { + INT32 leftSideBearing; + UINT32 advanceWidth; + INT32 rightSideBearing; + INT32 topSideBearing; + UINT32 advanceHeight; + INT32 bottomSideBearing; + INT32 verticalOriginY; +}DWRITE_GLYPH_METRICS, *PDWRITE_GLYPH_METRICS; + +VOID WINAPI GetMetrics( + pIDWriteFontFaceLite this, + DWRITE_FONT_METRICS* fontFaceMetrics +) +{ + fontFaceMetrics->designUnitsPerEm = 1; + fontFaceMetrics->ascent = this->tm.tmAscent; + fontFaceMetrics->descent = this->tm.tmDescent; +} + +HRESULT WINAPI GetDesignGlyphMetrics( + pIDWriteFontFaceLite this, + UINT16 const* glyphIndices, + UINT32 glyphCount, + DWRITE_GLYPH_METRICS* glyphMetrics, + BOOL isSideways +) +{ + return S_OK; +} + +HRESULT WINAPI GetGlyphIndices_DW( + pIDWriteFontFaceLite this, + UINT32 const* codePoints, + UINT32 codePointCount, + UINT16* glyphIndices +) +{ + HDC hdc; + HFONT hf, hfo; + GLYPHSET gs; + DWORD result; + hdc = CreateCompatibleDC(NULL); + hf = CreateFontIndirectW(&this->lf); + hfo = SelectObject(hdc, hf); + result = GetGlyphIndicesW(hdc, codePoints, codePointCount, glyphIndices, 0); + SelectObject(hdc, hfo); + DeleteObject(hf); + DeleteDC(hdc); + + if (result == GDI_ERROR) + return E_FAIL; + + return S_OK; +} + +HRESULT WINAPI CreateFontFace( + pIDWriteFontLite this, + pIDWriteFontFaceLite* fontFace +) +{ + pIDWriteFontFaceLite NewFontCol; + *fontFace = (pIDWriteFontFaceLite)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFontFaceLite)); + NewFontCol = *fontFace; + NewFontCol->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFontFaceLiteTbl)); + if (!NewFontCol->Vtbl) + { + return E_FAIL; + } + NewFontCol->lf = this->lf; + NewFontCol->tm = this->tm; + NewFontCol->Vtbl->IUnknown.pfnQueryInterface = DWrite_QueryInterface; + NewFontCol->Vtbl->IUnknown.pfnAddRef = AddRef_DW; + AddRef_DW(NewFontCol); + NewFontCol->Vtbl->IUnknown.pfnRelease = Release_DW; + NewFontCol->Vtbl->pfnGetGlyphCount = GetGlyphCount; + NewFontCol->Vtbl->pfnTryGetFontTable = TryGetFontTable; + NewFontCol->Vtbl->pfnReleaseFontTable = ReleaseFontTable; + NewFontCol->Vtbl->pfnGetMetrics = GetMetrics; + NewFontCol->Vtbl->pfnGetGlyphIndices = GetGlyphIndices_DW; + NewFontCol->Vtbl->pfnGetDesignGlyphMetrics = GetDesignGlyphMetrics; + return S_OK; +} + + +typedef struct +{ + PCWSTR familyName; + UINT32* index; +} ENUMFAMILYNAME, * PENUMFAMILYNAME; + +int CALLBACK EnumFamilyName( + const LOGFONTW* lpelfe, + const TEXTMETRICW* lpntme, + DWORD FontType, + PENUMFAMILYNAME lParam +) +{ + int i = 0; + while (lParam->familyName[i] != L'\0') + { + if (lpelfe->lfFaceName[i] == L'\0' || + lpelfe->lfFaceName[i] != lParam->familyName[i]) + return 1; + ++i; + } + + if ((lParam->familyName[i] == L'\0') && lpelfe->lfFaceName[i] != L'\0') + return 1; + + ++*lParam->index; + + return 0; +} + +typedef struct +{ + UINT32 currentindex; + UINT32 finalindex; + PCWSTR finalstr; +} ENUMFAMILYIDX, * PENUMFAMILYIDX; + +int CALLBACK EnumFamilyIdx( + const LOGFONTW* lpelfe, + const TEXTMETRICW* lpntme, + DWORD FontType, + PENUMFAMILYIDX lParam +) +{ + if (lParam->currentindex == lParam->finalindex) + { + lParam->finalstr = (PCWSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 32 * sizeof(WCHAR)); + StringCchCopyW(lParam->finalstr, 32, lpelfe->lfFaceName); + return 0; + } + + ++lParam->currentindex; + return 1; +} + +HRESULT WINAPI FindFamilyName( + ULONG_PTR this, + PCWSTR familyName, + UINT32* index, + BOOL* exists +) +{ + HDC hdc; + LOGFONTW lf; + ENUMFAMILYNAME pfname; + + if (!familyName || !index || !exists) + return E_INVALIDARG; + + pfname.familyName = familyName; + pfname.index = index; + + *pfname.index = 0; + + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfFaceName[0] = L'\0'; + lf.lfPitchAndFamily = 0; + + hdc = CreateCompatibleDC(NULL); + + if (EnumFontFamiliesExW(hdc, &lf, EnumFamilyName, &pfname, 0) != 0) + { + *exists = FALSE; + *index = UINT_MAX; + } + else + *exists = TRUE; + + DeleteDC(hdc); + + return S_OK; +} + +typedef struct +{ + LOGFONTW lf; + TEXTMETRICW tm; + DWORD FontType; + ULONG weight; + ULONG stretch; + ULONG style; +} FONTDATA, *PFONTDATA; + +ULONG WINAPI GetStretch(ULONG_PTR this) +{ + return 5; +} + +ULONG WINAPI GetStyle(pIDWriteFontLite this) +{ + if (this->lf.lfItalic) + return 2; + + return 0; +} + +ULONG WINAPI GetWeight(pIDWriteFontLite this) +{ + return this->lf.lfWeight; +} + +typedef struct +{ + LOGFONTW lf; + TEXTMETRICW tm; + DWORD FontType; + UINT32 currentindex; + UINT32 finalindex; +} ENUMFONTLISTIDX, * PENUMFONTLISTIDX; + +int CALLBACK EnumFontListIdx( + const LOGFONTW* lpelfe, + const TEXTMETRICW* lpntme, + DWORD FontType, + PENUMFONTLISTIDX lParam +) +{ + if (lParam->currentindex == lParam->finalindex) + { + memcpy(&lParam->lf, lpelfe, sizeof(LOGFONTW)); + memcpy(&lParam->tm, lpntme, sizeof(TEXTMETRICW)); + lParam->FontType = FontType; + return 0; + } + + ++lParam->currentindex; + return 1; +} + +int CALLBACK EnumFamilyFontMatch( + const LOGFONTW* lpelfe, + const TEXTMETRICW* lpntme, + DWORD FontType, + PFONTDATA lParam +) +/* + Here is how we will determine the best-matching font, options ranking from best to worst: + -all three attributes matching + -two attributes matching + -one attribute matching + -first font enumerated + + As a better font is found, the option will be revised. +*/ +{ + if (lParam->lf.lfFaceName == L'\0') + { + memcpy(&lParam->lf, lpelfe, sizeof(LOGFONTW)); + memcpy(&lParam->tm, lpntme, sizeof(TEXTMETRICW)); + lParam->FontType = FontType; + } + + if (lParam->weight == lpelfe->lfWeight) + return 0; + + return 1; +} + +HRESULT WINAPI GetFont( + pIDWriteFontListLite this, + UINT32 index, + pIDWriteFontLite* matchingFont +) +// At the end of the IDWriteFontFamily interface, I have added a pointer to a string containing the "font family" name. +// It will be used to iterate through all the fonts to find the one best suited to create a DWriteFont object. +{ + pIDWriteFontLite NewFontCol; + HDC hdc; + LOGFONTW lf; + FONTDATA fd; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfFaceName[0] = L'\0'; + lf.lfPitchAndFamily = 0; + + hdc = CreateCompatibleDC(NULL); + + EnumFontFamiliesExW(hdc, &lf, EnumFontListIdx, &fd, 0); + + DeleteDC(hdc); + + *matchingFont = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFontLite)); + NewFontCol = *matchingFont; + NewFontCol->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFontLiteTbl)); + if (!NewFontCol->Vtbl) + { + return E_FAIL; + } + NewFontCol->lf = fd.lf; + NewFontCol->tm = fd.tm; + NewFontCol->Vtbl->IUnknown.pfnQueryInterface = DWrite_QueryInterface; + NewFontCol->Vtbl->IUnknown.pfnAddRef = AddRef_DW; + AddRef_DW(NewFontCol); + NewFontCol->Vtbl->IUnknown.pfnRelease = Release_DW; + NewFontCol->Vtbl->pfnGetSimulations = GetSimulations; + NewFontCol->Vtbl->pfnCreateFontFace = CreateFontFace; + NewFontCol->Vtbl->pfnGetStyle = GetStyle; + NewFontCol->Vtbl->pfnGetWeight = GetWeight; + NewFontCol->Vtbl->pfnGetStretch = GetStretch; + return S_OK; +} + +HRESULT WINAPI GetFirstMatchingFont( + pIDWriteFontFamilyLite this, + ULONG weight, + ULONG stretch, + ULONG style, + pIDWriteFontLite* matchingFont +) +// At the end of the IDWriteFontFamily interface, I have added a pointer to a string containing the "font family" name. +// It will be used to iterate through all the fonts to find the one best suited to create a DWriteFont object. +{ + pIDWriteFontLite NewFontCol; + HDC hdc; + LOGFONTW lf; + FONTDATA fd; + lf.lfCharSet = DEFAULT_CHARSET; + StringCchCopyW(&lf.lfFaceName, 32, this->FontFamilyStr); + lf.lfPitchAndFamily = 0; + + hdc = CreateCompatibleDC(NULL); + + EnumFontFamiliesExW(hdc, &lf, EnumFamilyFontMatch, &fd, 0); + + DeleteDC(hdc); + + *matchingFont = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFontLite)); + NewFontCol = *matchingFont; + NewFontCol->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFontLiteTbl)); + if (!NewFontCol->Vtbl) + { + return E_FAIL; + } + NewFontCol->lf = fd.lf; + NewFontCol->tm = fd.tm; + NewFontCol->Vtbl->IUnknown.pfnQueryInterface = DWrite_QueryInterface; + NewFontCol->Vtbl->IUnknown.pfnAddRef = AddRef_DW; + AddRef_DW(NewFontCol); + NewFontCol->Vtbl->IUnknown.pfnRelease = Release_DW; + NewFontCol->Vtbl->pfnGetSimulations = GetSimulations; + NewFontCol->Vtbl->pfnCreateFontFace = CreateFontFace; + NewFontCol->Vtbl->pfnGetStyle = GetStyle; + NewFontCol->Vtbl->pfnGetWeight = GetWeight; + NewFontCol->Vtbl->pfnGetStretch = GetStretch; + return S_OK; +} + +UINT32 WINAPI GetFontCount( + pIDWriteFontListLite this +) +{ + return 1; +} + +HRESULT WINAPI GetFontFamily( + ULONG_PTR this, + UINT32 index, + pIDWriteFontFamilyLite* fontFamily +) +{ + HDC hdc; + LOGFONTW lf; + ENUMFAMILYIDX pfi; + int result; + pfi.currentindex = 0; + pfi.finalindex = index; + lf.lfCharSet = DEFAULT_CHARSET; + lf.lfFaceName[0] = L'\0'; + lf.lfPitchAndFamily = 0; + + hdc = CreateCompatibleDC(NULL); + + result = EnumFontFamiliesExW(hdc, &lf, EnumFamilyIdx, &pfi, 0); + + DeleteDC(hdc); + + if (result) + return E_FAIL; + pIDWriteFontFamilyLite NewFontFam; + *fontFamily = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFontFamilyLite)); + NewFontFam = *fontFamily; + NewFontFam->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFontFamilyLiteTbl)); + if (!NewFontFam->Vtbl) + { + return E_FAIL; + } + NewFontFam->Vtbl->IDWriteFontList.IUnknown.pfnQueryInterface = DWrite_QueryInterface; + NewFontFam->Vtbl->IDWriteFontList.IUnknown.pfnAddRef = AddRef_DW; + AddRef_DW(NewFontFam); + NewFontFam->Vtbl->IDWriteFontList.IUnknown.pfnRelease = Release_DW; + NewFontFam->Vtbl->pfnGetFirstMatchingFont = GetFirstMatchingFont; + NewFontFam->Vtbl->IDWriteFontList.pfnGetFont = GetFont; + NewFontFam->Vtbl->IDWriteFontList.pfnGetFontCount = GetFontCount; + NewFontFam->FontFamilyStr = pfi.finalstr; + return S_OK; +} + +UINT32 WINAPI GetFontFamilyCount(pIDWriteFontCollectionLite this) +{ + return 1; +} + +HRESULT WINAPI GetSystemFontCollection( + pIDWriteFactoryLite this, + pIDWriteFontCollectionLite* fontCollection, + BOOL checkForUpdates +) +{ + pIDWriteFontCollectionLite NewFontCol; + *fontCollection = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFontCollectionLite)); + NewFontCol = *fontCollection; + NewFontCol->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFontCollectionLiteTbl)); + if (!NewFontCol->Vtbl) + { + return E_FAIL; + } + NewFontCol->Vtbl->IUnknown.pfnQueryInterface = DWrite_QueryInterface; + NewFontCol->Vtbl->IUnknown.pfnAddRef = AddRef_DW; + AddRef_DW(NewFontCol); + NewFontCol->Vtbl->IUnknown.pfnRelease = Release_DW; + NewFontCol->Vtbl->pfnGetFontFamily = GetFontFamily; + NewFontCol->Vtbl->pfnFindFamilyName = FindFamilyName; + NewFontCol->Vtbl->pfnGetFontFamilyCount = GetFontFamilyCount; + return S_OK; +} + +/// +/// Optional adjustment to a glyph's position. A glyph offset changes the position of a glyph without affecting +/// the pen position. Offsets are in logical, pre-transform units. +/// +typedef struct DWRITE_GLYPH_OFFSET +{ + /// + /// Offset in the advance direction of the run. A positive advance offset moves the glyph to the right + /// (in pre-transform coordinates) if the run is left-to-right or to the left if the run is right-to-left. + /// + FLOAT advanceOffset; + + /// + /// Offset in the ascent direction, i.e., the direction ascenders point. A positive ascender offset moves + /// the glyph up (in pre-transform coordinates). + /// + FLOAT ascenderOffset; +}DWRITE_GLYPH_OFFSET; + +typedef struct DWRITE_GLYPH_RUN +{ + /// + /// The physical font face to draw with. + /// + pIDWriteFontFaceLite fontFace; + + /// + /// Logical size of the font in DIPs, not points (equals 1/96 inch). + /// + FLOAT fontEmSize; + + /// + /// The number of glyphs. + /// + UINT32 glyphCount; + + /// + /// The indices to render. + /// + _Field_size_(glyphCount) UINT16 const* glyphIndices; + + /// + /// Glyph advance widths. + /// + _Field_size_opt_(glyphCount) FLOAT const* glyphAdvances; + + /// + /// Glyph offsets. + /// + _Field_size_opt_(glyphCount) DWRITE_GLYPH_OFFSET const* glyphOffsets; + + /// + /// If true, specifies that glyphs are rotated 90 degrees to the left and + /// vertical metrics are used. Vertical writing is achieved by specifying + /// isSideways = true and rotating the entire run 90 degrees to the right + /// via a rotate transform. + /// + BOOL isSideways; + + /// + /// The implicit resolved bidi level of the run. Odd levels indicate + /// right-to-left languages like Hebrew and Arabic, while even levels + /// indicate left-to-right languages like English and Japanese (when + /// written horizontally). For right-to-left languages, the text origin + /// is on the right, and text should be drawn to the left. + /// + UINT32 bidiLevel; +}DWRITE_GLYPH_RUN; + +/// +/// The DWRITE_MATRIX structure specifies the graphics transform to be applied +/// to rendered glyphs. +/// +typedef struct DWRITE_MATRIX +{ + /// + /// Horizontal scaling / cosine of rotation + /// + FLOAT m11; + + /// + /// Vertical shear / sine of rotation + /// + FLOAT m12; + + /// + /// Horizontal shear / negative sine of rotation + /// + FLOAT m21; + + /// + /// Vertical scaling / cosine of rotation + /// + FLOAT m22; + + /// + /// Horizontal shift (always orthogonal regardless of rotation) + /// + FLOAT dx; + + /// + /// Vertical shift (always orthogonal regardless of rotation) + /// + FLOAT dy; +}DWRITE_MATRIX; + +/// +/// Represents a method of rendering glyphs. +/// +typedef enum DWRITE_RENDERING_MODE +{ + /// + /// Specifies that the rendering mode is determined automatically based on the font and size. + /// + DWRITE_RENDERING_MODE_DEFAULT, + + /// + /// Specifies that no antialiasing is performed. Each pixel is either set to the foreground + /// color of the text or retains the color of the background. + /// + DWRITE_RENDERING_MODE_ALIASED, + + /// + /// Specifies that antialiasing is performed in the horizontal direction and the appearance + /// of glyphs is layout-compatible with GDI using CLEARTYPE_QUALITY. Use DWRITE_MEASURING_MODE_GDI_CLASSIC + /// to get glyph advances. The antialiasing may be either ClearType or grayscale depending on + /// the text antialiasing mode. + /// + DWRITE_RENDERING_MODE_GDI_CLASSIC, + + /// + /// Specifies that antialiasing is performed in the horizontal direction and the appearance + /// of glyphs is layout-compatible with GDI using CLEARTYPE_NATURAL_QUALITY. Glyph advances + /// are close to the font design advances, but are still rounded to whole pixels. Use + /// DWRITE_MEASURING_MODE_GDI_NATURAL to get glyph advances. The antialiasing may be either + /// ClearType or grayscale depending on the text antialiasing mode. + /// + DWRITE_RENDERING_MODE_GDI_NATURAL, + + /// + /// Specifies that antialiasing is performed in the horizontal direction. This rendering + /// mode allows glyphs to be positioned with subpixel precision and is therefore suitable + /// for natural (i.e., resolution-independent) layout. The antialiasing may be either + /// ClearType or grayscale depending on the text antialiasing mode. + /// + DWRITE_RENDERING_MODE_NATURAL, + + /// + /// Similar to natural mode except that antialiasing is performed in both the horizontal + /// and vertical directions. This is typically used at larger sizes to make curves and + /// diagonal lines look smoother. The antialiasing may be either ClearType or grayscale + /// depending on the text antialiasing mode. + /// + DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC, + + /// + /// Specifies that rendering should bypass the rasterizer and use the outlines directly. + /// This is typically used at very large sizes. + /// + DWRITE_RENDERING_MODE_OUTLINE, + + // The following names are obsolete, but are kept as aliases to avoid breaking existing code. + // Each of these rendering modes may result in either ClearType or grayscale antialiasing + // depending on the DWRITE_TEXT_ANTIALIASING_MODE. + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC = DWRITE_RENDERING_MODE_GDI_CLASSIC, + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL = DWRITE_RENDERING_MODE_GDI_NATURAL, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL = DWRITE_RENDERING_MODE_NATURAL, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC = DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC +}DWRITE_RENDERING_MODE, *PDWRITE_RENDERING_MODE; + +#define DWRITE_MEASURING_MODE ULONG +#define DWRITE_TEXTURE_TYPE ULONG +#define DWRITE_FONT_WEIGHT ULONG +#define DWRITE_FONT_STYLE ULONG +#define DWRITE_FONT_STRETCH ULONG + +HRESULT WINAPI GetAlphaBlendParams( + pIDWriteGlyphRunAnalysisLite this, + PVOID renderingParams, + FLOAT* blendGamma, + FLOAT* blendEnhancedContrast, + FLOAT* blendClearTypeLevel +) +{ + *blendGamma = 3.0f; + *blendEnhancedContrast = 2.0f; + //*blendClearTypeLevel = 0.0; + return S_OK; +} + +HRESULT WINAPI GetAlphaTextureBounds( + pIDWriteGlyphRunAnalysisLite this, + DWRITE_TEXTURE_TYPE textureType, + RECT* textureBounds +) +{ + textureBounds->bottom = 2.0; + textureBounds->right = 2.0; + return S_OK; +} + +HRESULT WINAPI Draw( + pIDWriteTextLayoutLite this, + void* clientDrawingContext, + void* renderer, + FLOAT originX, + FLOAT originY +) +{ + return S_OK; +} + +HRESULT WINAPI SetFontCollection( + pIDWriteTextLayoutLite this, + pIDWriteFontCollectionLite fontCollection, + ULONG textRange +) +{ + return S_OK; +} + +HRESULT WINAPI CreateTextFormat( + pIDWriteFactoryLite this, + WCHAR const* fontFamilyName, + IDWriteFontCollectionLite* fontCollection, + DWRITE_FONT_WEIGHT fontWeight, + DWRITE_FONT_STYLE fontStyle, + DWRITE_FONT_STRETCH fontStretch, + FLOAT fontSize, + WCHAR const* localeName, + pIDWriteTextFormatLite* textFormat +) +{ + pIDWriteTextFormatLite NewFontCol; + *textFormat = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteTextFormatLite)); + NewFontCol = *textFormat; + NewFontCol->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteTextFormatLiteTbl)); + if (!NewFontCol->Vtbl) + { + return E_FAIL; + } + NewFontCol->Vtbl->IUnknown.pfnQueryInterface = DWrite_QueryInterface; + NewFontCol->Vtbl->IUnknown.pfnAddRef = AddRef_DW; + AddRef_DW(NewFontCol); + NewFontCol->Vtbl->IUnknown.pfnRelease = Release_DW; + return S_OK; +} + +HRESULT WINAPI CreateTextLayout( + pIDWriteFactoryLite this, + WCHAR const* string, + UINT32 stringLength, + IDWriteTextFormatLite* textFormat, + FLOAT maxWidth, + FLOAT maxHeight, + pIDWriteTextLayoutLite* textLayout +) +{ + pIDWriteTextLayoutLite NewFontCol; + *textLayout = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteTextLayoutLite)); + NewFontCol = *textLayout; + NewFontCol->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteTextLayoutLiteTbl)); + if (!NewFontCol->Vtbl) + { + return E_FAIL; + } + NewFontCol->Vtbl->IDWriteTextFormat.IUnknown.pfnQueryInterface = DWrite_QueryInterface; + NewFontCol->Vtbl->IDWriteTextFormat.IUnknown.pfnAddRef = AddRef_DW; + AddRef_DW(NewFontCol); + NewFontCol->Vtbl->IDWriteTextFormat.IUnknown.pfnRelease = Release_DW; + NewFontCol->Vtbl->pfnDraw = Draw; + NewFontCol->Vtbl->pfnSetFontCollection = SetFontCollection; + return S_OK; +} + +HRESULT WINAPI CreateGlyphRunAnalysis( + pIDWriteFactoryLite this, + DWRITE_GLYPH_RUN const* glyphRun, + FLOAT pixelsPerDip, + DWRITE_MATRIX const* transform, + DWRITE_RENDERING_MODE renderingMode, + DWRITE_MEASURING_MODE measuringMode, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + pIDWriteGlyphRunAnalysisLite* glyphRunAnalysis +) +{ + pIDWriteGlyphRunAnalysisLite NewFontCol; + *glyphRunAnalysis = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteGlyphRunAnalysisLite)); + NewFontCol = *glyphRunAnalysis; + NewFontCol->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteGlyphRunAnalysisLiteTbl)); + if (!NewFontCol->Vtbl) + { + return E_FAIL; + } + NewFontCol->Vtbl->IUnknown.pfnQueryInterface = DWrite_QueryInterface; + NewFontCol->Vtbl->IUnknown.pfnAddRef = AddRef_DW; + AddRef_DW(NewFontCol); + NewFontCol->Vtbl->IUnknown.pfnRelease = Release_DW; + NewFontCol->Vtbl->pfnGetAlphaBlendParams = GetAlphaBlendParams; + NewFontCol->Vtbl->pfnGetAlphaTextureBounds = GetAlphaTextureBounds; + return S_OK; +} + +HRESULT RegisterFontCollectionLoader( + pIDWriteFactoryLite this, + PVOID fontCollectionLoader +) +{ + return S_OK; +} + +HRESULT RegisterFontFileLoader( + pIDWriteFactoryLite this, + PVOID fontFileLoader +) +{ + return S_OK; +} + +HRESULT WINAPI Implementation_DWriteCreateFactory( + ULONG factoryType, + REFIID iid, + IUnknown** factory +) +{ + pIDWriteFactoryLite IDWriteFactoryLite; + IID IDWriteFactory = { 0xb859ee5a, 0xd838,0x4b5b, 0xa2, 0xe8, 0x1a, 0xdc, 0x7d, 0x93, 0xdb, 0x48 }; + IID IDWriteFactory1 = { 0x30572f99, 0xdac6, 0x41db, 0xa1, 0x6e, 0x48, 0x63, 0x07, 0xe6, 0x06a }; + if (IIDCMP(iid, &IDWriteFactory)) + { + *factory = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFactoryLite)); + IDWriteFactoryLite = *factory; + IDWriteFactoryLite->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDWriteFactoryLiteTbl)); + if (!IDWriteFactoryLite->Vtbl) + { + return E_FAIL; + } + IDWriteFactoryLite->Vtbl->IUnknown.pfnQueryInterface = DWrite_QueryInterface; + IDWriteFactoryLite->Vtbl->IUnknown.pfnAddRef = AddRef_DW; + AddRef_DW(IDWriteFactoryLite); + IDWriteFactoryLite->Vtbl->IUnknown.pfnRelease = Release_DW; + IDWriteFactoryLite->Vtbl->pfnGetSystemFontCollection = GetSystemFontCollection; + IDWriteFactoryLite->Vtbl->pfnCreateGlyphRunAnalysis = CreateGlyphRunAnalysis; + IDWriteFactoryLite->Vtbl->pfnCreateTextLayout = CreateTextLayout; + IDWriteFactoryLite->Vtbl->pfnCreateTextFormat = CreateTextFormat; + IDWriteFactoryLite->Vtbl->pfnRegisterFontCollectionLoader = RegisterFontCollectionLoader; + IDWriteFactoryLite->Vtbl->pfnRegisterFontFileLoader = RegisterFontFileLoader; + return S_OK; + } + if (IIDCMP(iid, &IDWriteFactory1)) + { + return S_OK; + } + return E_NOTIMPL; +} \ No newline at end of file diff --git a/dxgi.c b/dxgi.c new file mode 100644 index 0000000..f00f1dd --- /dev/null +++ b/dxgi.c @@ -0,0 +1,147 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include "com_lite.h" +#include "strsafe.h" +#include +#include + +LPDIRECT3D9 g_pD3D = NULL; + +typedef IDirect3D9*( WINAPI* d3d9create) (UINT); + +HRESULT WINAPI CheckInterfaceSupport( + void* this, + REFGUID InterfaceName, + LARGE_INTEGER *pUMDVersion +) +{ + if(pUMDVersion) + pUMDVersion->QuadPart = 0; + return DXGI_ERROR_UNSUPPORTED; +} + +HRESULT WINAPI GetDesc( + void* this, + DXGI_ADAPTER_DESC *pDesc +) +{ + if(!pDesc) + return E_INVALIDARG; + + StringCchCopyW(pDesc->Description, 128, L"Software Adapter"); + + pDesc->VendorId = 0; + pDesc->DeviceId = 0; + pDesc->SubSysId = 0; + pDesc->Revision = 0; + pDesc->DedicatedVideoMemory = 4; + pDesc->DedicatedSystemMemory = 8; + pDesc->SharedSystemMemory = 1; + pDesc->AdapterLuid.LowPart = 3453; + + return S_OK; +} + +HRESULT WINAPI EnumAdapters1( + void* this, + UINT Adapter, + void **ppAdapter + ) +{ + return E_FAIL; +} + +ULONG WINAPI Release(void* this) +{ + return 1; +} + +HRESULT WINAPI EnumAdapters( + void* this, + UINT Adapter, + void **ppAdapter + ) +{ + UINT AdapterCount; + pIDXGIAdapterLite pDXGIAdapter; + if(!ppAdapter) + return DXGI_ERROR_INVALID_CALL; + if(g_pD3D) + AdapterCount = IDirect3D9_GetAdapterCount(g_pD3D); + else + return E_FAIL; + if(AdapterCount - 1 < Adapter) + return DXGI_ERROR_NOT_FOUND; + else + { + *ppAdapter = pDXGIAdapter; + pDXGIAdapter->Vtbl = NULL; + pDXGIAdapter->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDXGIAdapterLiteTbl)); + if(!pDXGIAdapter->Vtbl) + { + return E_FAIL; + } + pDXGIAdapter->Vtbl->IDXGIObject.IUnknown.pfnQueryInterface = pDXGIAdapter->Vtbl; + pDXGIAdapter->Vtbl->IDXGIObject.IUnknown.pfnRelease = Release; + pDXGIAdapter->Vtbl->pfnGetDesc = GetDesc; + pDXGIAdapter->Vtbl->pfnCheckInterfaceSupport = CheckInterfaceSupport; + return S_OK; + } +} + +HRESULT WINAPI Implementation_CreateDXGIFactory( + REFIID riid, + void **ppFactory +) +{ + return E_FAIL; +} + +BOOL RefIdCmp(IID riid0, IID riid1) +{ + if(riid0.Data1 == riid1.Data1 && + riid0.Data2 == riid1.Data2 && + riid0.Data3 == riid1.Data3 && + riid0.Data4 == riid1.Data4) + return TRUE; + + return FALSE; +} + + +HRESULT WINAPI Implementation_CreateDXGIFactory1( + REFIID riid, + void **ppFactory +) +{ + d3d9create pfnDirect3DCreate9; + pIDXGIFactory1Lite pDXGIFactory1; + IID iid_DXGIFactory1 = {0x770AAE78, 0xF26F, 0x4DBA, 0xA8, 0x29, 0x25, 0x3C, 0x83, 0xD1, 0xB3, 0x87}; + + if(RefIdCmp(*riid, iid_DXGIFactory1)) + { + pfnDirect3DCreate9 = (d3d9create)Implementation_GetProcAddress(LoadLibraryA("d3d9.dll"), "Direct3DCreate9"); + + if(!pfnDirect3DCreate9) + return E_FAIL; + + g_pD3D = pfnDirect3DCreate9(D3D_SDK_VERSION); + pDXGIFactory1->Vtbl = NULL; + *ppFactory = pDXGIFactory1; + pDXGIFactory1->Vtbl = (void*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDXGIFactory1LiteTbl)); + if(!pDXGIFactory1->Vtbl) + { + return E_FAIL; + } + + pDXGIFactory1->Vtbl->IDXGIFactory.IDXGIObject.IUnknown.pfnQueryInterface = pDXGIFactory1->Vtbl; + pDXGIFactory1->Vtbl->IDXGIFactory.pfnEnumAdapters = EnumAdapters; + pDXGIFactory1->Vtbl->EnumAdapters1 = EnumAdapters1; + pDXGIFactory1->Vtbl->IDXGIFactory.IDXGIObject.IUnknown.pfnRelease = Release; + + return S_OK; + } + + return DXGI_ERROR_NOT_FOUND; +} \ No newline at end of file diff --git a/evt_log.c b/evt_log.c new file mode 100644 index 0000000..04f21c1 --- /dev/null +++ b/evt_log.c @@ -0,0 +1,54 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +EVT_HANDLE WINAPI Implementation_EvtQuery( + EVT_HANDLE Session, + LPCWSTR Path, + LPCWSTR Query, + DWORD Flags +) +{ + return NULL; +} + +BOOL WINAPI Implementation_EvtRender( + EVT_HANDLE Context, + EVT_HANDLE Fragment, + DWORD Flags, + DWORD BufferSize, + PVOID Buffer, + PDWORD BufferUsed, + PDWORD PropertyCount +) +{ + return NULL; +} + +EVT_HANDLE WINAPI Implementation_EvtCreateRenderContext( + DWORD ValuePathsCount, + LPCWSTR *ValuePaths, + DWORD Flags +) +{ + return NULL; +} + +BOOL WINAPI Implementation_EvtNext( + EVT_HANDLE ResultSet, + DWORD EventsSize, + PEVT_HANDLE Events, + DWORD Timeout, + DWORD Flags, + PDWORD Returned +) +{ + return FALSE; +} + +BOOL WINAPI Implementation_EvtClose( + EVT_HANDLE Object +) +{ + return TRUE; +} \ No newline at end of file diff --git a/export.h b/export.h new file mode 100644 index 0000000..84f3ec4 --- /dev/null +++ b/export.h @@ -0,0 +1,397 @@ +#pragma once + +typedef int (*pfnFunc_generic)(); + +pfnFunc_generic g_pfn_InitializeSRWLock; + +pfnFunc_generic g_pfn_TryAcquireSRWLockExclusive; + +pfnFunc_generic g_pfn_TryAcquireSRWLockShared; + +pfnFunc_generic g_pfn_AcquireSRWLockExclusive; + +pfnFunc_generic g_pfn_AcquireSRWLockShared; + +pfnFunc_generic g_pfn_ReleaseSRWLockExclusive; + +pfnFunc_generic g_pfn_ReleaseSRWLockShared; + +pfnFunc_generic g_pfn_DecodePointer; + +pfnFunc_generic g_pfn_EncodePointer; + +pfnFunc_generic g_pfn_GetMaximumProcessorCount; + +pfnFunc_generic g_pfn_GetMaximumProcessorGroupCount; + +pfnFunc_generic g_pfn_GetLogicalProcessorInformationEx; + +pfnFunc_generic g_pfn_GetThreadGroupAffinity; + +pfnFunc_generic g_pfn_PowerCreateRequest; + +pfnFunc_generic g_pfn_PowerSetRequest; + +pfnFunc_generic g_pfn_PowerClearRequest; + +pfnFunc_generic g_pfn_ResolveLocaleName; + +pfnFunc_generic g_pfn_WerRegisterRuntimeExceptionModule; + +pfnFunc_generic g_pfn_NtOpenKeyEx; + +pfnFunc_generic g_pfn_SHGetPropertyStoreForWindow; + +pfnFunc_generic g_pfn_RegisterTouchWindow; + +pfnFunc_generic g_pfn_GetTouchInputInfo; + +pfnFunc_generic g_pfn_QueryDisplayConfig; + +pfnFunc_generic g_pfn_DisplayConfigGetDeviceInfo; + +pfnFunc_generic g_pfn_DisplayConfigSetDeviceInfo; + +pfnFunc_generic g_pfn_GetDisplayConfigBufferSizes; + +pfnFunc_generic g_pfn_CloseTouchInputHandle; + +pfnFunc_generic g_pfn_CloseGestureInfoHandle; + +pfnFunc_generic g_pfn_GetGestureInfo; + +pfnFunc_generic g_pfn_SetGestureConfig; + +pfnFunc_generic g_pfn_UnregisterTouchWindow; + +pfnFunc_generic g_pfn_IsTouchWindow; + +pfnFunc_generic g_pfn_CreateRemoteThreadEx; + +pfnFunc_generic g_pfn_GetModuleInformation; + +pfnFunc_generic g_pfn_GetProcessMemoryInfo; + +pfnFunc_generic g_pfn_FindFirstFileExW; + +pfnFunc_generic g_pfn_SleepConditionVariableSRW; + +pfnFunc_generic g_pfn_EnumSystemLocalesEx; + +pfnFunc_generic g_pfn_GetCurrencyFormatEx; + +pfnFunc_generic g_pfn_GetDateFormatEx; + +pfnFunc_generic g_pfn_GetDynamicTimeZoneInformation; + +pfnFunc_generic g_pfn_GetTimeFormatEx; + +pfnFunc_generic g_pfn_GetLocaleInfoEx; + +pfnFunc_generic g_pfn_GetNumberFormatEx; + +pfnFunc_generic g_pfn_GetUserDefaultLocaleName; + +pfnFunc_generic g_pfn_LCIDToLocaleName; + +pfnFunc_generic g_pfn_LocaleNameToLCID; + +pfnFunc_generic g_pfn_SleepConditionVariableCS; + +pfnFunc_generic g_pfn_WakeConditionVariable; + +pfnFunc_generic g_pfn_WakeAllConditionVariable; + +pfnFunc_generic g_pfn_InitializeConditionVariable; + +pfnFunc_generic g_pfn_InitOnceBeginInitialize; + +pfnFunc_generic g_pfn_InitOnceExecuteOnce; + +pfnFunc_generic g_pfn_InitOnceComplete; + +pfnFunc_generic g_pfn_InitOnceInitialize; + +pfnFunc_generic g_pfn_CreateWaitableTimerExW; + +pfnFunc_generic g_pfn_InitializeCriticalSectionEx; + +pfnFunc_generic g_pfn_CancelIoEx; + +pfnFunc_generic g_pfn_GetFinalPathNameByHandleW; + +pfnFunc_generic g_pfn_SetFileInformationByHandle; + +pfnFunc_generic g_pfn_InitializeProcThreadAttributeList; + +pfnFunc_generic g_pfn_UpdateProcThreadAttribute; + +pfnFunc_generic g_pfn_DeleteProcThreadAttributeList; + +pfnFunc_generic g_pfn_QueryFullProcessImageNameA; + +pfnFunc_generic g_pfn_QueryFullProcessImageNameW; + +pfnFunc_generic g_pfn_QueryThreadCycleTime; + +pfnFunc_generic g_pfn_QueryProcessCycleTime; + +pfnFunc_generic g_pfn_GetProductInfo; + +pfnFunc_generic g_pfn_QueryProcessCycleTime; + +pfnFunc_generic g_pfn_GetProductInfo; + +pfnFunc_generic g_pfn_GetNamedPipeServerProcessId; + +pfnFunc_generic g_pfn_GetNamedPipeClientProcessId; + +pfnFunc_generic g_pfn_SymGetSearchPathW; + +pfnFunc_generic g_pfn_SymSetSearchPathW; + +pfnFunc_generic g_pfn_inet_ntop; + +pfnFunc_generic g_pfn_GetIfTable2; + +pfnFunc_generic g_pfn_FreeMibTable; + +pfnFunc_generic g_pfn_GetThreadPreferredUILanguages; + +pfnFunc_generic g_pfn_GetFileInformationByHandleEx; + +pfnFunc_generic g_pfn_Wow64GetThreadContext; + +pfnFunc_generic g_pfn_AddMandatoryAce; + +pfnFunc_generic g_pfn_EventRegister; + +pfnFunc_generic g_pfn_EventSetInformation; + +pfnFunc_generic g_pfn_EventWrite; + +pfnFunc_generic g_pfn_EventWriteTransfer; + +pfnFunc_generic g_pfn_EventUnregister; + +pfnFunc_generic g_pfn_RegisterPowerSettingNotification; + +pfnFunc_generic g_pfn_UnregisterPowerSettingNotification; + +pfnFunc_generic g_pfn_SetProcessDPIAware; + +pfnFunc_generic g_pfn_EvtRender; + +pfnFunc_generic g_pfn_EvtNext; + +pfnFunc_generic g_pfn_EvtQuery; + +pfnFunc_generic g_pfn_EvtCreateRenderContext; + +pfnFunc_generic g_pfn_EvtClose; + +pfnFunc_generic g_pfn_SHGetKnownFolderPath; + +pfnFunc_generic g_pfn_DwmSetWindowAttribute; + +pfnFunc_generic g_pfn_DwmGetWindowAttribute; + +pfnFunc_generic g_pfn_DwmDefWindowProc; + +pfnFunc_generic g_pfn_DwmExtendFrameIntoClientArea; + +pfnFunc_generic g_pfn_DwmGetCompositionTimingInfo; + +pfnFunc_generic g_pfn_SetupDiGetDevicePropertyW; + +pfnFunc_generic g_pfn_CreateDXGIFactory; + +pfnFunc_generic g_pfn_CreateDXGIFactory1; + +pfnFunc_generic g_pfn_ScriptItemize; + +pfnFunc_generic g_pfn_SystemParametersInfoW; + +pfnFunc_generic g_pfn_SHQueryUserNotificationState; + +pfnFunc_generic g_pfn_IsThreadAFiber; + +pfnFunc_generic g_pfn_FlsAlloc; + +pfnFunc_generic g_pfn_FlsGetValue; + +pfnFunc_generic g_pfn_FlsSetValue; + +pfnFunc_generic g_pfn_FlsFree; + +pfnFunc_generic g_pfn_ConvertThreadToFiberEx; + +pfnFunc_generic g_pfn_GetThreadId; + +pfnFunc_generic g_pfn_GetCurrentProcessorNumber; + +pfnFunc_generic g_pfn_CreateFiberEx; + +pfnFunc_generic g_pfn_SwitchToFiber; + +pfnFunc_generic g_pfn_SetProcessDEPPolicy; + +pfnFunc_generic g_pfn_RegDeleteKeyExW; + +pfnFunc_generic g_pfn_RegGetValueW; + +pfnFunc_generic g_pfn_QueryWorkingSetEx; + +pfnFunc_generic g_pfn_PdhAddEnglishCounterW; + +pfnFunc_generic g_pfn_GetProcessId; + +pfnFunc_generic g_pfn_GetVolumePathNamesForVolumeNameW; + +pfnFunc_generic g_pfn_freeaddrinfo; + +pfnFunc_generic g_pfn_getaddrinfo; + +pfnFunc_generic g_pfn_CancelIPChangeNotify; + +pfnFunc_generic g_pfn_GetAdaptersAddresses; + +pfnFunc_generic g_pfn_GetGeoInfoW; + +pfnFunc_generic g_pfn_GetUserGeoID; + +pfnFunc_generic g_pfn_TzSpecificLocalTimeToSystemTime; + +pfnFunc_generic g_pfn_AddVectoredExceptionHandler; + +pfnFunc_generic g_pfn_RemoveVectoredExceptionHandler; + +pfnFunc_generic g_pfn_AttachConsole; + +pfnFunc_generic g_pfn_CheckRemoteDebuggerPresent; + +pfnFunc_generic g_pfn_CreateMemoryResourceNotification; + +pfnFunc_generic g_pfn_GetNativeSystemInfo; + +pfnFunc_generic g_pfn_InitializeSListHead; + +pfnFunc_generic g_pfn_InterlockedPushEntrySList; + +pfnFunc_generic g_pfn_InterlockedFlushSList; + +pfnFunc_generic g_pfn_WTSGetActiveConsoleSessionId; + +pfnFunc_generic g_pfn_RtlGetLastNtStatus; + +pfnFunc_generic g_pfn_GetModuleHandleExA; + +pfnFunc_generic g_pfn_GetModuleHandleExW; + +pfnFunc_generic g_pfn_SetDllDirectoryW; + +pfnFunc_generic g_pfn_GetLogicalProcessorInformation; + +pfnFunc_generic g_pfn_GetProcessHandleCount; + +pfnFunc_generic g_pfn_IsProcessInJob; + +pfnFunc_generic g_pfn_IsWow64Process; + +pfnFunc_generic g_pfn_ConvertFiberToThread; + +pfnFunc_generic g_pfn_SystemFunction036; + +pfnFunc_generic g_pfn_GetPerformanceInfo; + +pfnFunc_generic g_pfn_WTSRegisterSessionNotification; + +pfnFunc_generic g_pfn_WTSUnRegisterSessionNotification; + +pfnFunc_generic g_pfn_PowerDeterminePlatformRole; + +pfnFunc_generic g_pfn_InterlockedPopEntrySList; + +pfnFunc_generic g_pfn_GetProcAddress; + +pfnFunc_generic g_pfn_LoadLibraryW; + +pfnFunc_generic g_pfn_ProcessPrng; + +pfnFunc_generic g_pfn_GetDpiForMonitor; + +pfnFunc_generic g_pfn_GetLayeredWindowAttributes; + +pfnFunc_generic g_pfn_PrintWindow; + +pfnFunc_generic g_pfn_DefRawInputProc; + +pfnFunc_generic g_pfn_GetRawInputData; + +pfnFunc_generic g_pfn_GetRawInputDeviceInfoW; + +pfnFunc_generic g_pfn_GetRawInputDeviceList; + +pfnFunc_generic g_pfn_RegisterRawInputDevices; + +pfnFunc_generic g_pfn_OpenThemeData; + +pfnFunc_generic g_pfn_CloseThemeData; + +pfnFunc_generic g_pfn_DrawThemeBackground; + +pfnFunc_generic g_pfn_GetThemeBackgroundContentRect; + +pfnFunc_generic g_pfn_GetThemePartSize; + +pfnFunc_generic g_pfn_CoRegisterInitializeSpy; + +pfnFunc_generic g_pfn_CoRevokeInitializeSpy; + +pfnFunc_generic g_pfn_HeapSetInformation; + +pfnFunc_generic g_pfn_WindowsCreateString; + +pfnFunc_generic g_pfn_WindowsGetStringRawBuffer; + +pfnFunc_generic g_pfn_WindowsDeleteString; + +pfnFunc_generic g_pfn_RoGetActivationFactory; + +pfnFunc_generic g_pfn_RoActivateInstance; + +pfnFunc_generic g_pfn_PrefetchVirtualMemory; + +pfnFunc_generic g_pfn_GetFirmwareType; + +pfnFunc_generic g_pfn_WindowsCreateStringReference; + +pfnFunc_generic g_pfn_LoadLibraryA; + +pfnFunc_generic g_pfn_LoadLibraryExA; + +pfnFunc_generic g_pfn_LoadLibraryExW; + +pfnFunc_generic g_pfn_DWriteCreateFactory; + +pfnFunc_generic g_pfn_CryptProtectMemory; + +pfnFunc_generic g_pfn_CryptUnprotectMemory; + +pfnFunc_generic g_pfn_GetPackagePathByFullName; + +pfnFunc_generic g_pfn_GetPackagesByPackageFamily; + +pfnFunc_generic g_pfn_LCMapStringEx; + +pfnFunc_generic g_pfn_UnhookWindowsHookEx; + +pfnFunc_generic g_pfn_DuplicateHandle; + +pfnFunc_generic g_pfn_RegisterPointerDeviceNotifications; + +pfnFunc_generic g_pfn_GetPointerDevices; + +pfnFunc_generic g_pfn_GetPointerDevice; + +pfnFunc_generic g_pfn_DiscardVirtualMemory; \ No newline at end of file diff --git a/exports.c b/exports.c new file mode 100644 index 0000000..d2c5d39 --- /dev/null +++ b/exports.c @@ -0,0 +1,1386 @@ + +#include "export.h" + +#ifdef _M_X64 +#define EXPORT64 __declspec(dllexport) +#else +#define EXPORT64 +#endif + +#ifdef _M_IX86 +#define EXPORT32 comment +#else +#pragma warning( disable : 4081 ) +#define EXPORT32 // +#endif + +// Only built-in types are used as this +// source file is purposely isolated from the common headers to avoid conflicts + +EXPORT64 void TryAcquireSRWLockExclusive(void* SRWLock) +{ + g_pfn_TryAcquireSRWLockExclusive(); +} + +#pragma EXPORT32(linker, "/export:TryAcquireSRWLockExclusive@4=TryAcquireSRWLockExclusive") + +EXPORT64 void TryAcquireSRWLockShared(void* SRWLock) +{ + g_pfn_TryAcquireSRWLockShared(); +} + +#pragma EXPORT32(linker, "/export:TryAcquireSRWLockShared@4=TryAcquireSRWLockShared") + +EXPORT64 void AcquireSRWLockExclusive(void* SRWLock) +{ + g_pfn_AcquireSRWLockExclusive(); +} + +#pragma EXPORT32(linker, "/export:AcquireSRWLockExclusive@4=AcquireSRWLockExclusive") + +EXPORT64 void AcquireSRWLockShared(void* SRWLock) +{ + g_pfn_AcquireSRWLockShared(); +} + +#pragma EXPORT32(linker, "/export:AcquireSRWLockShared@4=AcquireSRWLockShared") + +EXPORT64 void ReleaseSRWLockExclusive(void* SRWLock) +{ + g_pfn_ReleaseSRWLockExclusive(); +} + +#pragma EXPORT32(linker, "/export:ReleaseSRWLockExclusive@4=ReleaseSRWLockExclusive") + +EXPORT64 void ReleaseSRWLockShared(void* SRWLock) +{ + g_pfn_ReleaseSRWLockShared(); +} + +#pragma EXPORT32(linker, "/export:ReleaseSRWLockShared@4=ReleaseSRWLockShared") + +EXPORT64 void InitializeSRWLock(void* SRWLock) +{ + g_pfn_InitializeSRWLock(); +} + +#pragma EXPORT32(linker, "/export:InitializeSRWLock@4=InitializeSRWLock") + +EXPORT64 void DecodePointer(void* Ptr) +{ + g_pfn_DecodePointer(); +} + +#pragma EXPORT32(linker, "/export:DecodePointer@4=DecodePointer") + +EXPORT64 void EncodePointer(void* Ptr) +{ + g_pfn_EncodePointer(); +} + +#pragma EXPORT32(linker, "/export:EncodePointer@4=EncodePointer") + +EXPORT64 void GetMaximumProcessorCount(void *v1) +{ + g_pfn_GetMaximumProcessorCount(); +} + +#pragma EXPORT32(linker, "/export:GetMaximumProcessorCount@4=GetMaximumProcessorCount") + +EXPORT64 void GetMaximumProcessorGroupCount() +{ + g_pfn_GetMaximumProcessorGroupCount(); +} + +#pragma EXPORT32(linker, "/export:GetMaximumProcessorGroupCount@0=GetMaximumProcessorGroupCount") + +EXPORT64 void GetLogicalProcessorInformationEx(void* v1, void* v2, void* v3) +{ + g_pfn_GetLogicalProcessorInformationEx(); +} + +#pragma EXPORT32(linker, "/export:GetLogicalProcessorInformationEx@12=GetLogicalProcessorInformationEx") + +EXPORT64 void GetThreadGroupAffinity(void* v1, void* v2) +{ + g_pfn_GetThreadGroupAffinity(); +} + +#pragma EXPORT32(linker, "/export:GetThreadGroupAffinity@8=GetThreadGroupAffinity") + +EXPORT64 void PowerCreateRequest(void* v1) +{ + g_pfn_PowerCreateRequest(); +} + +#pragma EXPORT32(linker, "/export:PowerCreateRequest@4=PowerCreateRequest") + +EXPORT64 void PowerSetRequest(void* v1, void* v2) +{ + g_pfn_PowerSetRequest(); +} + +#pragma EXPORT32(linker, "/export:PowerSetRequest@8=PowerSetRequest") + +EXPORT64 void PowerClearRequest(void* v1, void* v2) +{ + g_pfn_PowerClearRequest(); +} + +#pragma EXPORT32(linker, "/export:PowerClearRequest@8=PowerClearRequest") + +EXPORT64 void ResolveLocaleName(void* v1, void* v2, void* v3) +{ + g_pfn_ResolveLocaleName(); +} + +#pragma EXPORT32(linker, "/export:ResolveLocaleName@12=ResolveLocaleName") + +EXPORT64 void NtOpenKeyEx(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_NtOpenKeyEx(); +} + +#pragma EXPORT32(linker, "/export:NtOpenKeyEx@16=NtOpenKeyEx") + +EXPORT64 void WerRegisterRuntimeExceptionModule(void* v1, void* v2) +{ + g_pfn_WerRegisterRuntimeExceptionModule(); +} + +#pragma EXPORT32(linker, "/export:WerRegisterRuntimeExceptionModule@8=WerRegisterRuntimeExceptionModule") + +EXPORT64 void SHGetPropertyStoreForWindow(void* v1, void* v2, void* v3) +{ + g_pfn_SHGetPropertyStoreForWindow(); +} + +#pragma EXPORT32(linker, "/export:SHGetPropertyStoreForWindow@12=SHGetPropertyStoreForWindow") + +EXPORT64 void RegisterTouchWindow(void* v1, void* v2) +{ + g_pfn_RegisterTouchWindow(); +} + +#pragma EXPORT32(linker, "/export:RegisterTouchWindow@8=RegisterTouchWindow") + +EXPORT64 void GetTouchInputInfo() +{ + g_pfn_GetTouchInputInfo(); +} + +#pragma EXPORT32(linker, "/export:GetTouchInputInfo@0=GetTouchInputInfo") + +EXPORT64 void QueryDisplayConfig(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6) +{ + g_pfn_QueryDisplayConfig(); +} + +#pragma EXPORT32(linker, "/export:QueryDisplayConfig@24=QueryDisplayConfig") + +EXPORT64 void DisplayConfigGetDeviceInfo(void* v1) +{ + g_pfn_DisplayConfigGetDeviceInfo(); +} + +#pragma EXPORT32(linker, "/export:DisplayConfigGetDeviceInfo@4=DisplayConfigGetDeviceInfo") + +EXPORT64 void DisplayConfigSetDeviceInfo(void* v1) +{ + g_pfn_DisplayConfigSetDeviceInfo(); +} + +#pragma EXPORT32(linker, "/export:DisplayConfigSetDeviceInfo@4=DisplayConfigSetDeviceInfo") + +EXPORT64 void GetDisplayConfigBufferSizes(void* v1, void* v2, void* v3) +{ + g_pfn_GetDisplayConfigBufferSizes(); +} + +#pragma EXPORT32(linker, "/export:GetDisplayConfigBufferSizes@12=GetDisplayConfigBufferSizes") + +EXPORT64 void CloseTouchInputHandle(void* v1) +{ + g_pfn_CloseTouchInputHandle(); +} + +#pragma EXPORT32(linker, "/export:CloseTouchInputHandle@4=CloseTouchInputHandle") + +EXPORT64 void CloseGestureInfoHandle() +{ + g_pfn_CloseGestureInfoHandle(); +} + +#pragma EXPORT32(linker, "/export:CloseGestureInfoHandle@0=CloseGestureInfoHandle") + +EXPORT64 void GetGestureInfo() +{ + g_pfn_GetGestureInfo(); +} + +#pragma EXPORT32(linker, "/export:GetGestureInfo@0=GetGestureInfo") + +EXPORT64 void SetGestureConfig() +{ + g_pfn_SetGestureConfig(); +} + +#pragma EXPORT32(linker, "/export:SetGestureConfig@0=SetGestureConfig") + +EXPORT64 void UnregisterTouchWindow() +{ + g_pfn_UnregisterTouchWindow(); +} + +#pragma EXPORT32(linker, "/export:UnregisterTouchWindow@0=UnregisterTouchWindow") + +EXPORT64 void IsTouchWindow() +{ + g_pfn_IsTouchWindow(); +} + +#pragma EXPORT32(linker, "/export:IsTouchWindow@0=IsTouchWindow") + +EXPORT64 void CreateRemoteThreadEx(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6, void* v7, void* v8) +{ + g_pfn_CreateRemoteThreadEx(); +} + +#pragma EXPORT32(linker, "/export:CreateRemoteThreadEx@32=CreateRemoteThreadEx") + +EXPORT64 void GetModuleInformation(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_GetModuleInformation(); +} + +#pragma EXPORT32(linker, "/export:GetModuleInformation@16=GetModuleInformation") + +EXPORT64 void GetProcessMemoryInfo(void* v1, void* v2, void* v3) +{ + g_pfn_GetProcessMemoryInfo(); +} + +#pragma EXPORT32(linker, "/export:GetProcessMemoryInfo@12=GetProcessMemoryInfo") + +EXPORT64 void FindFirstFileExW(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6) +{ + g_pfn_FindFirstFileExW(); +} + +#pragma EXPORT32(linker, "/export:FindFirstFileExW@24=FindFirstFileExW") + +EXPORT64 void SleepConditionVariableSRW(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_SleepConditionVariableSRW(); +} + +#pragma EXPORT32(linker, "/export:SleepConditionVariableSRW@16=SleepConditionVariableSRW") + +EXPORT64 void InitializeConditionVariable(void* v1) +{ + g_pfn_InitializeConditionVariable(); +} + +#pragma EXPORT32(linker, "/export:InitializeConditionVariable@4=InitializeConditionVariable") + +EXPORT64 void WakeConditionVariable(void* v1) +{ + g_pfn_WakeConditionVariable(); +} + +#pragma EXPORT32(linker, "/export:WakeConditionVariable@4=WakeConditionVariable") + +EXPORT64 void WakeAllConditionVariable(void* v1) +{ + g_pfn_WakeAllConditionVariable(); +} + +#pragma EXPORT32(linker, "/export:WakeAllConditionVariable@4=WakeAllConditionVariable") + +EXPORT64 void EnumSystemLocalesEx(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_EnumSystemLocalesEx(); +} + +#pragma EXPORT32(linker, "/export:EnumSystemLocalesEx@16=EnumSystemLocalesEx") + +EXPORT64 void GetCurrencyFormatEx(void* v1, void* v2, void* v3, void* v4, void* v5, void* v6) +{ + g_pfn_GetCurrencyFormatEx(); +} + +#pragma EXPORT32(linker, "/export:GetCurrencyFormatEx@24=GetCurrencyFormatEx") + +EXPORT64 void GetDateFormatEx(void* v1, void* v2, void* v3, void* v4, void* v5, void* v6, void* v7) +{ + g_pfn_GetDateFormatEx(); +} + +#pragma EXPORT32(linker, "/export:GetDateFormatEx@28=GetDateFormatEx") + +EXPORT64 void GetDynamicTimeZoneInformation(void* v1) +{ + g_pfn_GetDynamicTimeZoneInformation(); +} + +#pragma EXPORT32(linker, "/export:GetDynamicTimeZoneInformation@4=GetDynamicTimeZoneInformation") + +EXPORT64 void GetTimeFormatEx(void* v1, void* v2, void* v3, void* v4, void* v5, void* v6) +{ + g_pfn_GetTimeFormatEx(); +} + +#pragma EXPORT32(linker, "/export:GetTimeFormatEx@24=GetTimeFormatEx") + +EXPORT64 void GetLocaleInfoEx(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_GetLocaleInfoEx(); +} + +#pragma EXPORT32(linker, "/export:GetLocaleInfoEx@16=GetLocaleInfoEx") + +EXPORT64 void GetNumberFormatEx(void* v1, void* v2, void* v3, void* v4, void* v5, void* v6) +{ + g_pfn_GetNumberFormatEx(); +} + +#pragma EXPORT32(linker, "/export:GetNumberFormatEx@24=GetNumberFormatEx") + +EXPORT64 void GetUserDefaultLocaleName(void* v1, void* v2) +{ + g_pfn_GetUserDefaultLocaleName(); +} + +#pragma EXPORT32(linker, "/export:GetUserDefaultLocaleName@8=GetUserDefaultLocaleName") + +EXPORT64 void LCIDToLocaleName(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_LCIDToLocaleName(); +} + +#pragma EXPORT32(linker, "/export:LCIDToLocaleName@16=LCIDToLocaleName") + +EXPORT64 void LocaleNameToLCID(void* v1, void* v2) +{ + g_pfn_LocaleNameToLCID(); +} + +#pragma EXPORT32(linker, "/export:LocaleNameToLCID@8=LocaleNameToLCID") + +EXPORT64 void GetThreadPreferredUILanguages(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_GetThreadPreferredUILanguages(); +} + +#pragma EXPORT32(linker, "/export:GetThreadPreferredUILanguages@16=GetThreadPreferredUILanguages") + +EXPORT64 void SleepConditionVariableCS(void* v1, void* v2, void* v3) +{ + g_pfn_SleepConditionVariableCS(); +} + +#pragma EXPORT32(linker, "/export:SleepConditionVariableCS@12=SleepConditionVariableCS") + +EXPORT64 void InitOnceBeginInitialize(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_InitOnceBeginInitialize(); +} + +#pragma EXPORT32(linker, "/export:InitOnceBeginInitialize@16=InitOnceBeginInitialize") + +EXPORT64 void InitOnceExecuteOnce(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_InitOnceExecuteOnce(); +} + +#pragma EXPORT32(linker, "/export:InitOnceExecuteOnce@16=InitOnceExecuteOnce") + +EXPORT64 void InitOnceComplete(void* v1, void* v2, void* v3) +{ + g_pfn_InitOnceComplete(); +} + +#pragma EXPORT32(linker, "/export:InitOnceComplete@12=InitOnceComplete") + +EXPORT64 void InitOnceInitialize(void* v1) +{ + g_pfn_InitOnceInitialize(); +} + +#pragma EXPORT32(linker, "/export:InitOnceInitialize@4=InitOnceInitialize") + +EXPORT64 void CreateWaitableTimerExW(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_CreateWaitableTimerExW(); +} + +#pragma EXPORT32(linker, "/export:CreateWaitableTimerExW@16=CreateWaitableTimerExW") + +EXPORT64 void InitializeCriticalSectionEx(void* v1, void* v2, void* v3) +{ + g_pfn_InitializeCriticalSectionEx(); +} + +#pragma EXPORT32(linker, "/export:InitializeCriticalSectionEx@12=InitializeCriticalSectionEx") + +EXPORT64 void CancelIoEx(void* v1, void* v2) +{ + g_pfn_CancelIoEx(); +} + +#pragma EXPORT32(linker, "/export:CancelIoEx@8=CancelIoEx") + +EXPORT64 void GetFinalPathNameByHandleW(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_GetFinalPathNameByHandleW(); +} + +#pragma EXPORT32(linker, "/export:GetFinalPathNameByHandleW@16=GetFinalPathNameByHandleW") + +EXPORT64 void SetFileInformationByHandle(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_SetFileInformationByHandle(); +} + +#pragma EXPORT32(linker, "/export:SetFileInformationByHandle@16=SetFileInformationByHandle") + +EXPORT64 void GetFileInformationByHandleEx(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_GetFileInformationByHandleEx(); +} + +#pragma EXPORT32(linker, "/export:GetFileInformationByHandleEx@16=GetFileInformationByHandleEx") + +EXPORT64 void DeleteProcThreadAttributeList(void* v1) +{ + g_pfn_DeleteProcThreadAttributeList(); +} + +#pragma EXPORT32(linker, "/export:DeleteProcThreadAttributeList@4=DeleteProcThreadAttributeList") + +EXPORT64 void InitializeProcThreadAttributeList(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_InitializeProcThreadAttributeList(); +} + +#pragma EXPORT32(linker, "/export:InitializeProcThreadAttributeList@16=InitializeProcThreadAttributeList") + +EXPORT64 void UpdateProcThreadAttribute(void* v1, void* v2, void* v3, void* v4, void* v5, void* v6, void* v7) +{ + g_pfn_UpdateProcThreadAttribute(); +} + +#pragma EXPORT32(linker, "/export:UpdateProcThreadAttribute@28=UpdateProcThreadAttribute") + +EXPORT64 void QueryFullProcessImageNameA(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_QueryFullProcessImageNameA(); +} + +#pragma EXPORT32(linker, "/export:QueryFullProcessImageNameA@16=QueryFullProcessImageNameA") + +EXPORT64 void QueryFullProcessImageNameW(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_QueryFullProcessImageNameW(); +} + +#pragma EXPORT32(linker, "/export:QueryFullProcessImageNameW@16=QueryFullProcessImageNameW") + +EXPORT64 void QueryThreadCycleTime(void* v1, void* v2) +{ + g_pfn_QueryThreadCycleTime(); +} + +#pragma EXPORT32(linker, "/export:QueryThreadCycleTime@8=QueryThreadCycleTime") + +EXPORT64 void QueryProcessCycleTime(void* v1, void* v2) +{ + g_pfn_QueryProcessCycleTime(); +} + +#pragma EXPORT32(linker, "/export:QueryProcessCycleTime@8=QueryProcessCycleTime") + +EXPORT64 void GetProductInfo(void* v1, void* v2, void* v3, void* v4, void* v5) +{ + g_pfn_GetProductInfo(); +} + +#pragma EXPORT32(linker, "/export:GetProductInfo@20=GetProductInfo") + +EXPORT64 void GetNamedPipeServerProcessId(void* v1, void* v2) +{ + g_pfn_GetNamedPipeServerProcessId(); +} + +#pragma EXPORT32(linker, "/export:GetNamedPipeServerProcessId@8=GetNamedPipeServerProcessId") + +EXPORT64 void GetNamedPipeClientProcessId(void* v1, void* v2) +{ + g_pfn_GetNamedPipeClientProcessId(); +} + +#pragma EXPORT32(linker, "/export:GetNamedPipeClientProcessId@8=GetNamedPipeClientProcessId") + +EXPORT64 void SymGetSearchPathW(void* v1, void* v2, void* v3) +{ + g_pfn_SymGetSearchPathW(); +} + +#pragma EXPORT32(linker, "/export:SymGetSearchPathW@12=SymGetSearchPathW") + +EXPORT64 void SymSetSearchPathW(void* v1, void* v2) +{ + g_pfn_SymSetSearchPathW(); +} + +#pragma EXPORT32(linker, "/export:SymSetSearchPathW@8=SymSetSearchPathW") + +EXPORT64 void inet_ntop(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_inet_ntop(); +} + +#pragma EXPORT32(linker, "/export:inet_ntop@16=inet_ntop") + +EXPORT64 void GetIfTable2(void* v1) +{ + g_pfn_GetIfTable2(); +} + +#pragma EXPORT32(linker, "/export:GetIfTable2@4=GetIfTable2") + + +EXPORT64 void FreeMibTable(void* v1) +{ + g_pfn_FreeMibTable(); +} + +#pragma EXPORT32(linker, "/export:FreeMibTable@4=FreeMibTable") + +EXPORT64 void Wow64GetThreadContext(void* v1, void* v2) +{ + g_pfn_Wow64GetThreadContext(); +} + +#pragma EXPORT32(linker, "/export:Wow64GetThreadContext@8=Wow64GetThreadContext") + +EXPORT64 void AddMandatoryAce(void* v1, void* v2, void* v3, void* v4, void* v5) +{ + g_pfn_AddMandatoryAce(); +} + +#pragma EXPORT32(linker, "/export:AddMandatoryAce@20=AddMandatoryAce") + +EXPORT64 void EventRegister(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_EventRegister(); +} + +#pragma EXPORT32(linker, "/export:EventRegister@16=EventRegister") + +EXPORT64 void EventSetInformation(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_EventSetInformation(); +} + +#pragma EXPORT32(linker, "/export:EventSetInformation@16=EventSetInformation") + +EXPORT64 void EventWrite(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_EventWrite(); +} + +#pragma EXPORT32(linker, "/export:EventWrite@16=EventWrite") + +EXPORT64 void EventWriteTransfer(void* v1, void* v2, void* v3, void* v4, void* v5, void* v6) +{ + g_pfn_EventWriteTransfer(); +} + +#pragma EXPORT32(linker, "/export:EventWriteTransfer@24=EventWriteTransfer") + +EXPORT64 void EventUnregister(void* v1) +{ + g_pfn_EventUnregister(); +} + +#pragma EXPORT32(linker, "/export:EventUnregister@4=EventUnregister") + +EXPORT64 void RegisterPowerSettingNotification(void* v1, void* v2, void* v3) +{ + g_pfn_RegisterPowerSettingNotification(); +} + +#pragma EXPORT32(linker, "/export:RegisterPowerSettingNotification@12=RegisterPowerSettingNotification") + +EXPORT64 void UnregisterPowerSettingNotification(void* v1) +{ + g_pfn_UnregisterPowerSettingNotification(); +} + +#pragma EXPORT32(linker, "/export:UnregisterPowerSettingNotification@4=UnregisterPowerSettingNotification") + +EXPORT64 void SetProcessDPIAware() +{ + g_pfn_SetProcessDPIAware(); +} + +#pragma EXPORT32(linker, "/export:SetProcessDPIAware@0=SetProcessDPIAware") + +EXPORT64 void EvtRender(void* v1, void* v2, void* v3, void* v4, void* v5, void* v6, void* v7) +{ + g_pfn_EvtRender(); +} + +#pragma EXPORT32(linker, "/export:EvtRender@28=EvtRender") + +EXPORT64 void EvtNext(void* v1, void* v2, void* v3, void* v4, void* v5, void* v6) +{ + g_pfn_EvtNext(); +} + +#pragma EXPORT32(linker, "/export:EvtNext@24=EvtNext") + +EXPORT64 void EvtQuery(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_EvtQuery(); +} + +#pragma EXPORT32(linker, "/export:EvtQuery@16=EvtQuery") + +EXPORT64 void EvtCreateRenderContext(void* v1, void* v2, void* v3) +{ + g_pfn_EvtCreateRenderContext(); +} + +#pragma EXPORT32(linker, "/export:EvtCreateRenderContext@12=EvtCreateRenderContext") + +EXPORT64 void EvtClose(void* v1) +{ + g_pfn_EvtClose(); +} + +#pragma EXPORT32(linker, "/export:EvtClose@4=EvtClose") + +EXPORT64 void SHGetKnownFolderPath(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_SHGetKnownFolderPath(); +} + +#pragma EXPORT32(linker, "/export:SHGetKnownFolderPath@16=SHGetKnownFolderPath") + +EXPORT64 void DwmSetWindowAttribute(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_DwmSetWindowAttribute(); +} + +#pragma EXPORT32(linker, "/export:DwmSetWindowAttribute@16=DwmSetWindowAttribute") + +EXPORT64 void DwmGetWindowAttribute(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_DwmGetWindowAttribute(); +} + +#pragma EXPORT32(linker, "/export:DwmGetWindowAttribute@16=DwmGetWindowAttribute") + +EXPORT64 void DwmDefWindowProc(void* v1, void* v2, void* v3, void* v4, void* v5) +{ + g_pfn_DwmDefWindowProc(); +} + +#pragma EXPORT32(linker, "/export:DwmDefWindowProc@20=DwmDefWindowProc") + +EXPORT64 void DwmExtendFrameIntoClientArea(void* v1, void* v2) +{ + g_pfn_DwmExtendFrameIntoClientArea(); +} + +#pragma EXPORT32(linker, "/export:DwmExtendFrameIntoClientArea@8=DwmExtendFrameIntoClientArea") + +EXPORT64 void DwmGetCompositionTimingInfo(void* v1, void* v2) +{ + g_pfn_DwmGetCompositionTimingInfo(); +} + +#pragma EXPORT32(linker, "/export:DwmGetCompositionTimingInfo@8=DwmGetCompositionTimingInfo") + +EXPORT64 void SetupDiGetDevicePropertyW(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6, void* v7, void* v8) +{ + g_pfn_SetupDiGetDevicePropertyW(); +} + +#pragma EXPORT32(linker, "/export:SetupDiGetDevicePropertyW@32=SetupDiGetDevicePropertyW") + +EXPORT64 void CreateDXGIFactory(void* v1, void* v2) +{ + g_pfn_CreateDXGIFactory(); +} + +#pragma EXPORT32(linker, "/export:CreateDXGIFactory@8=CreateDXGIFactory") + +EXPORT64 void CreateDXGIFactory1(void* v1, void* v2) +{ + g_pfn_CreateDXGIFactory1(); +} + +#pragma EXPORT32(linker, "/export:CreateDXGIFactory1@8=CreateDXGIFactory1") + +EXPORT64 void ScriptItemize(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6, void* v7) +{ + g_pfn_ScriptItemize(); +} + +#pragma EXPORT32(linker, "/export:ScriptItemize@28=ScriptItemize") + +EXPORT64 void SystemParametersInfoW(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_SystemParametersInfoW(); +} + +#pragma EXPORT32(linker, "/export:SystemParametersInfoW@16=SystemParametersInfoW") + +EXPORT64 void SHQueryUserNotificationState(void* v1) +{ + g_pfn_SHQueryUserNotificationState(); +} + +#pragma EXPORT32(linker, "/export:SHQueryUserNotificationState@4=SHQueryUserNotificationState") + +EXPORT64 void IsThreadAFiber() +{ + g_pfn_IsThreadAFiber(); +} + +#pragma EXPORT32(linker, "/export:IsThreadAFiber@0=IsThreadAFiber") + +EXPORT64 void FlsAlloc(void* v1) +{ + g_pfn_FlsAlloc(); +} + +#pragma EXPORT32(linker, "/export:FlsAlloc@4=FlsAlloc") + +EXPORT64 void FlsFree(void* v1) +{ + g_pfn_FlsFree(); +} + +#pragma EXPORT32(linker, "/export:FlsFree@4=FlsFree") + +EXPORT64 void FlsGetValue(void* v1) +{ + g_pfn_FlsGetValue(); +} + +#pragma EXPORT32(linker, "/export:FlsGetValue@4=FlsGetValue") + +EXPORT64 void FlsSetValue(void* v1, void* v2) +{ + g_pfn_FlsSetValue(); +} + +#pragma EXPORT32(linker, "/export:FlsSetValue@8=FlsSetValue") + +EXPORT64 void ConvertThreadToFiberEx(void* v1, void* v2) +{ + g_pfn_ConvertThreadToFiberEx(); +} + +#pragma EXPORT32(linker, "/export:ConvertThreadToFiberEx@8=ConvertThreadToFiberEx") + +EXPORT64 void GetCurrentProcessorNumber() +{ + g_pfn_GetCurrentProcessorNumber(); +} + +#pragma EXPORT32(linker, "/export:GetCurrentProcessorNumber@0=GetCurrentProcessorNumber") + +EXPORT64 void GetThreadId(void* v1) +{ + g_pfn_GetThreadId(); +} + +#pragma EXPORT32(linker, "/export:GetThreadId@4=GetThreadId") + +EXPORT64 void CreateFiberEx(void* v1, void* v2, void* v3, void* v4, void* v5) +{ + g_pfn_CreateFiberEx(); +} + +#pragma EXPORT32(linker, "/export:CreateFiberEx@20=CreateFiberEx") + +EXPORT64 void SwitchToFiber(void* v1) +{ + g_pfn_SwitchToFiber(); +} + +#pragma EXPORT32(linker, "/export:SwitchToFiber@4=SwitchToFiber") + +EXPORT64 void SetProcessDEPPolicy(void* v1) +{ + g_pfn_SetProcessDEPPolicy(); +} + +#pragma EXPORT32(linker, "/export:SetProcessDEPPolicy@4=SetProcessDEPPolicy") + +EXPORT64 void RegGetValueW(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6, void* v7) +{ + g_pfn_RegGetValueW(); +} + +#pragma EXPORT32(linker, "/export:RegGetValueW@28=RegGetValueW") + +EXPORT64 void RegDeleteKeyExW(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_RegDeleteKeyExW(); +} + +#pragma EXPORT32(linker, "/export:RegDeleteKeyExW@16=RegDeleteKeyExW") + +EXPORT64 void QueryWorkingSetEx(void* v1, void* v2, void* v3) +{ + g_pfn_QueryWorkingSetEx(); +} + +#pragma EXPORT32(linker, "/export:QueryWorkingSetEx@12=QueryWorkingSetEx") + +_declspec(dllexport) void PdhAddEnglishCounterW(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_PdhAddEnglishCounterW(); +} + +#pragma EXPORT32(linker, "/export:PdhAddEnglishCounterW@16=PdhAddEnglishCounterW") + +EXPORT64 void GetProcessId(void* v1) +{ + g_pfn_GetProcessId(); +} + +#pragma EXPORT32(linker, "/export:GetProcessId@4=GetProcessId") + +EXPORT64 void GetVolumePathNamesForVolumeNameW(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_GetVolumePathNamesForVolumeNameW(); +} + +#pragma EXPORT32(linker, "/export:GetVolumePathNamesForVolumeNameW@16=GetVolumePathNamesForVolumeNameW") + +EXPORT64 void freeaddrinfo(void* v1) +{ + g_pfn_freeaddrinfo(); +} + +#pragma EXPORT32(linker, "/export:freeaddrinfo@4=freeaddrinfo") + +EXPORT64 void getaddrinfo(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_getaddrinfo(); +} + +#pragma EXPORT32(linker, "/export:getaddrinfo@16=getaddrinfo") + +EXPORT64 void CancelIPChangeNotify(void* v1) +{ + g_pfn_CancelIPChangeNotify(); +} + +#pragma EXPORT32(linker, "/export:CancelIPChangeNotify@4=CancelIPChangeNotify") + +EXPORT64 void GetAdaptersAddresses(void* v1, void* v2, void* v3, void* v4, void* v5) +{ + g_pfn_GetAdaptersAddresses(); +} + +#pragma EXPORT32(linker, "/export:GetAdaptersAddresses@20=GetAdaptersAddresses") + +EXPORT64 void GetGeoInfoW(void* v1, void* v2, void* v3, void* v4, void* v5) +{ + g_pfn_GetGeoInfoW(); +} + +#pragma EXPORT32(linker, "/export:GetGeoInfoW@20=GetGeoInfoW") + +EXPORT64 void GetUserGeoID(void* v1) +{ + g_pfn_GetUserGeoID(); +} + +#pragma EXPORT32(linker, "/export:GetUserGeoID@4=GetUserGeoID") + +EXPORT64 void TzSpecificLocalTimeToSystemTime(void* v1, void* v2, void* v3) +{ + g_pfn_TzSpecificLocalTimeToSystemTime(); +} + +#pragma EXPORT32(linker, "/export:TzSpecificLocalTimeToSystemTime@12=TzSpecificLocalTimeToSystemTime") + +EXPORT64 void AddVectoredExceptionHandler(void* v1, void* v2) +{ + g_pfn_AddVectoredExceptionHandler(); +} + +#pragma EXPORT32(linker, "/export:AddVectoredExceptionHandler@8=AddVectoredExceptionHandler") + +EXPORT64 void RemoveVectoredExceptionHandler(void* v1) +{ + g_pfn_RemoveVectoredExceptionHandler(); +} + +#pragma EXPORT32(linker, "/export:RemoveVectoredExceptionHandler@4=RemoveVectoredExceptionHandler") + +EXPORT64 void AttachConsole(void* v1) +{ + g_pfn_AttachConsole(); +} + +#pragma EXPORT32(linker, "/export:AttachConsole@4=AttachConsole") + +EXPORT64 void CheckRemoteDebuggerPresent(void* v1, void* v2) +{ + g_pfn_CheckRemoteDebuggerPresent(); +} + +#pragma EXPORT32(linker, "/export:CheckRemoteDebuggerPresent@8=CheckRemoteDebuggerPresent") + +EXPORT64 void CreateMemoryResourceNotification(void* v1) +{ + g_pfn_CreateMemoryResourceNotification(); +} + +#pragma EXPORT32(linker, "/export:CreateMemoryResourceNotification@4=CreateMemoryResourceNotification") + +EXPORT64 void GetNativeSystemInfo(void* v1) +{ + g_pfn_GetNativeSystemInfo(); +} + +#pragma EXPORT32(linker, "/export:GetNativeSystemInfo@4=GetNativeSystemInfo") + +EXPORT64 void InitializeSListHead(void* v1) +{ + g_pfn_InitializeSListHead(); +} + +#pragma EXPORT32(linker, "/export:InitializeSListHead@4=InitializeSListHead") + +EXPORT64 void InterlockedPushEntrySList(void* v1, void* v2) +{ + g_pfn_InterlockedPushEntrySList(); +} + +#pragma EXPORT32(linker, "/export:InterlockedPushEntrySList@8=InterlockedPushEntrySList") + +EXPORT64 void InterlockedFlushSList(void* v1) +{ + g_pfn_InterlockedFlushSList(); +} + +#pragma EXPORT32(linker, "/export:InterlockedFlushSList@4=InterlockedFlushSList") + +EXPORT64 void WTSGetActiveConsoleSessionId() +{ + g_pfn_WTSGetActiveConsoleSessionId(); +} + +#pragma EXPORT32(linker, "/export:WTSGetActiveConsoleSessionId@0=WTSGetActiveConsoleSessionId") + +EXPORT64 void RtlGetLastNtStatus() +{ + g_pfn_RtlGetLastNtStatus(); +} + +#pragma EXPORT32(linker, "/export:RtlGetLastNtStatus@0=RtlGetLastNtStatus") + +EXPORT64 void GetModuleHandleExA(void* v1, void* v2, void* v3) +{ + g_pfn_GetModuleHandleExA(); +} + +#pragma EXPORT32(linker, "/export:GetModuleHandleExA@12=GetModuleHandleExA") + +EXPORT64 void GetModuleHandleExW(void* v1, void* v2, void* v3) +{ + g_pfn_GetModuleHandleExW(); +} + +#pragma EXPORT32(linker, "/export:GetModuleHandleExW@12=GetModuleHandleExW") + +EXPORT64 void SetDllDirectoryW(void* v1) +{ + g_pfn_SetDllDirectoryW(); +} + +#pragma EXPORT32(linker, "/export:SetDllDirectoryW@4=SetDllDirectoryW") + +EXPORT64 void GetLogicalProcessorInformation(void* v1, void* v2) +{ + g_pfn_GetLogicalProcessorInformation(); +} + +#pragma EXPORT32(linker, "/export:GetLogicalProcessorInformation@8=GetLogicalProcessorInformation") + +EXPORT64 void GetProcessHandleCount(void* v1, void* v2) +{ + g_pfn_GetProcessHandleCount(); +} + +#pragma EXPORT32(linker, "/export:GetProcessHandleCount@8=GetProcessHandleCount") + +EXPORT64 void IsProcessInJob(void* v1, void* v2, void* v3) +{ + g_pfn_IsProcessInJob(); +} + +#pragma EXPORT32(linker, "/export:IsProcessInJob@12=IsProcessInJob") + +EXPORT64 void IsWow64Process(void* v1, void* v2) +{ + g_pfn_IsWow64Process(); +} + +#pragma EXPORT32(linker, "/export:IsWow64Process@8=IsWow64Process") + +EXPORT64 void ConvertFiberToThread() +{ + g_pfn_ConvertFiberToThread(); +} + +#pragma EXPORT32(linker, "/export:ConvertFiberToThread@0=ConvertFiberToThread") + +EXPORT64 void SystemFunction036(void* v1, void* v2) +{ + g_pfn_SystemFunction036(); +} + +#pragma EXPORT32(linker, "/export:SystemFunction036@8=SystemFunction036") + +EXPORT64 void GetPerformanceInfo(void* v1, void* v2) +{ + g_pfn_GetPerformanceInfo(); +} + +#pragma EXPORT32(linker, "/export:GetPerformanceInfo@8=GetPerformanceInfo") + +EXPORT64 void WTSRegisterSessionNotification(void* v1, void* v2) +{ + g_pfn_WTSRegisterSessionNotification(); +} + +#pragma EXPORT32(linker, "/export:WTSRegisterSessionNotification@8=WTSRegisterSessionNotification") + +EXPORT64 void WTSUnRegisterSessionNotification(void* v1) +{ + g_pfn_WTSUnRegisterSessionNotification(); +} + +#pragma EXPORT32(linker, "/export:WTSUnRegisterSessionNotification@4=WTSUnRegisterSessionNotification") + +EXPORT64 void PowerDeterminePlatformRole() +{ + g_pfn_PowerDeterminePlatformRole(); +} + +#pragma EXPORT32(linker, "/export:PowerDeterminePlatformRole@0=PowerDeterminePlatformRole") + +EXPORT64 void InterlockedPopEntrySList(void* v1) +{ + g_pfn_InterlockedPopEntrySList(); +} + +#pragma EXPORT32(linker, "/export:InterlockedPopEntrySList@4=InterlockedPopEntrySList") + +EXPORT64 void GetProcAddress(void* v1, void* v2) +{ + g_pfn_GetProcAddress(); +} + +#pragma EXPORT32(linker, "/export:GetProcAddress@8=GetProcAddress") + +EXPORT64 void LoadLibraryW(void* v1) +{ + g_pfn_LoadLibraryW(); +} + +#pragma EXPORT32(linker, "/export:LoadLibraryW@4=LoadLibraryW") + +EXPORT64 void ProcessPrng(void* v1, void* v2) +{ + g_pfn_ProcessPrng(); +} + +#pragma EXPORT32(linker, "/export:ProcessPrng@8=ProcessPrng") + +EXPORT64 void GetDpiForMonitor(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_GetDpiForMonitor(); +} + +#pragma EXPORT32(linker, "/export:GetDpiForMonitor@16=GetDpiForMonitor") + +EXPORT64 void GetLayeredWindowAttributes(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_GetLayeredWindowAttributes(); +} + +#pragma EXPORT32(linker, "/export:GetLayeredWindowAttributes@16=GetLayeredWindowAttributes") + +EXPORT64 void GetRawInputDeviceInfoW(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_GetRawInputDeviceInfoW(); +} + +#pragma EXPORT32(linker, "/export:GetRawInputDeviceInfoW@16=GetRawInputDeviceInfoW") + +EXPORT64 void PrintWindow(void* v1, void* v2, void* v3) +{ + g_pfn_PrintWindow(); +} + +#pragma EXPORT32(linker, "/export:PrintWindow@12=PrintWindow") + +EXPORT64 void DefRawInputProc(void* v1, void* v2, void* v3) +{ + g_pfn_DefRawInputProc(); +} + +#pragma EXPORT32(linker, "/export:DefRawInputProc@12=DefRawInputProc") + +EXPORT64 void GetRawInputDeviceList(void* v1, void* v2, void* v3) +{ + g_pfn_GetRawInputDeviceList(); +} + +#pragma EXPORT32(linker, "/export:GetRawInputDeviceList@12=GetRawInputDeviceList") + +EXPORT64 void RegisterRawInputDevices(void* v1, void* v2, void* v3) +{ + g_pfn_RegisterRawInputDevices(); +} + +#pragma EXPORT32(linker, "/export:RegisterRawInputDevices@12=RegisterRawInputDevices") + +EXPORT64 void CloseThemeData(void* v1) +{ + g_pfn_CloseThemeData(); +} + +#pragma EXPORT32(linker, "/export:CloseThemeData@4=CloseThemeData") + +EXPORT64 void OpenThemeData(void* v1, void* v2) +{ + g_pfn_OpenThemeData(); +} + +#pragma EXPORT32(linker, "/export:OpenThemeData@8=OpenThemeData") + +EXPORT64 void GetThemePartSize(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6, void* v7) +{ + g_pfn_GetThemePartSize(); +} + +#pragma EXPORT32(linker, "/export:GetThemePartSize@28=GetThemePartSize") + +EXPORT64 void DrawThemeBackground(void* v1, void* v2, void* v3, void* v4, void* v5, void* v6) +{ + g_pfn_DrawThemeBackground(); +} + +#pragma EXPORT32(linker, "/export:DrawThemeBackground@24=DrawThemeBackground") + +EXPORT64 void GetThemeBackgroundContentRect(void* v1, void* v2, void* v3, void* v4, void* v5, void* v6) +{ + g_pfn_GetThemeBackgroundContentRect(); +} + +#pragma EXPORT32(linker, "/export:GetThemeBackgroundContentRect@24=GetThemeBackgroundContentRect") + +EXPORT64 void CoRevokeInitializeSpy(void* v1) +{ + g_pfn_CoRevokeInitializeSpy(); +} + +#pragma EXPORT32(linker, "/export:CoRevokeInitializeSpy@4=CoRevokeInitializeSpy") + +EXPORT64 void CoRegisterInitializeSpy(void* v1, void* v2) +{ + g_pfn_CoRegisterInitializeSpy(); +} + +#pragma EXPORT32(linker, "/export:CoRegisterInitializeSpy@8=CoRegisterInitializeSpy") + +EXPORT64 void HeapSetInformation(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_HeapSetInformation(); +} + +#pragma EXPORT32(linker, "/export:HeapSetInformation@16=HeapSetInformation") + +EXPORT64 void WindowsCreateString(void* v1, void* v2, void* v3) +{ + g_pfn_WindowsCreateString(); +} + +#pragma EXPORT32(linker, "/export:WindowsCreateString@12=WindowsCreateString") + +EXPORT64 void RoGetActivationFactory(void* v1, void* v2, void* v3) +{ + g_pfn_RoGetActivationFactory(); +} + +#pragma EXPORT32(linker, "/export:RoGetActivationFactory@12=RoGetActivationFactory") + +EXPORT64 void WindowsGetStringRawBuffer(void* v1, void* v2) +{ + g_pfn_WindowsGetStringRawBuffer(); +} + +#pragma EXPORT32(linker, "/export:WindowsGetStringRawBuffer@8=WindowsGetStringRawBuffer") + +EXPORT64 void RoActivateInstance(void* v1, void* v2) +{ + g_pfn_RoActivateInstance(); +} + +#pragma EXPORT32(linker, "/export:RoActivateInstance@8=RoActivateInstance") + +EXPORT64 void WindowsDeleteString(void* v1) +{ + g_pfn_WindowsDeleteString(); +} + +#pragma EXPORT32(linker, "/export:WindowsDeleteString@4=WindowsDeleteString") + +EXPORT64 void WindowsCreateStringReference(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_WindowsCreateStringReference(); +} + +#pragma EXPORT32(linker, "/export:WindowsCreateStringReference@16=WindowsCreateStringReference") + +EXPORT64 void PrefetchVirtualMemory(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_PrefetchVirtualMemory(); +} + +#pragma EXPORT32(linker, "/export:PrefetchVirtualMemory@16=PrefetchVirtualMemory") + +EXPORT64 void GetFirmwareType(void* v1) +{ + g_pfn_GetFirmwareType(); +} + +#pragma EXPORT32(linker, "/export:GetFirmwareType@4=GetFirmwareType") + +EXPORT64 void LoadLibraryA(void* v1) +{ + g_pfn_LoadLibraryA(); +} + +#pragma EXPORT32(linker, "/export:LoadLibraryA@4=LoadLibraryA") + +EXPORT64 void LoadLibraryExA(void* v1, void* v2, void* v3) +{ + g_pfn_LoadLibraryExA(); +} + +#pragma EXPORT32(linker, "/export:LoadLibraryExA@12=LoadLibraryExA") + +EXPORT64 void LoadLibraryExW(void* v1, void* v2, void* v3) +{ + g_pfn_LoadLibraryExW(); +} + +#pragma EXPORT32(linker, "/export:LoadLibraryExW@12=LoadLibraryExW") + +EXPORT64 void DWriteCreateFactory(void* v1, void* v2, void* v3) +{ + g_pfn_DWriteCreateFactory(); +} + +#pragma EXPORT32(linker, "/export:DWriteCreateFactory@12=DWriteCreateFactory") + +EXPORT64 void CryptProtectMemory(void* v1, void* v2, void* v3) +{ + g_pfn_CryptProtectMemory(); +} + +#pragma EXPORT32(linker, "/export:CryptProtectMemory@12=CryptProtectMemory") + +EXPORT64 void CryptUnprotectMemory(void* v1, void* v2, void* v3) +{ + g_pfn_CryptUnprotectMemory(); +} + +#pragma EXPORT32(linker, "/export:CryptUnprotectMemory@12=CryptUnprotectMemory") + +EXPORT64 void GetPackagePathByFullName(void* v1, void* v2, void* v3) +{ + g_pfn_GetPackagePathByFullName(); +} + +#pragma EXPORT32(linker, "/export:GetPackagePathByFullName@12=GetPackagePathByFullName") + +EXPORT64 void GetPackagesByPackageFamily(void* v1, void* v2, void* v3, void* v4, void* v5) +{ + g_pfn_GetPackagesByPackageFamily(); +} + +#pragma EXPORT32(linker, "/export:GetPackagesByPackageFamily@20=GetPackagesByPackageFamily") + +EXPORT64 void LCMapStringEx(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6, void* v7, void* v8, void* v9) +{ + g_pfn_LCMapStringEx(); +} + +#pragma EXPORT32(linker, "/export:LCMapStringEx@36=LCMapStringEx") + +EXPORT64 void UnhookWindowsHookEx(void* v1) +{ + g_pfn_UnhookWindowsHookEx(); +} + +#pragma EXPORT32(linker, "/export:UnhookWindowsHookEx@4=UnhookWindowsHookEx") + +EXPORT64 void DuplicateHandle(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6, void* v7) +{ + g_pfn_DuplicateHandle(); +} + +#pragma EXPORT32(linker, "/export:DuplicateHandle@28=DuplicateHandle") + +EXPORT64 void RegisterPointerDeviceNotifications(void* v1, void* v2) +{ + g_pfn_RegisterPointerDeviceNotifications(); +} + +#pragma EXPORT32(linker, "/export:RegisterPointerDeviceNotifications@8=RegisterPointerDeviceNotifications") + +EXPORT64 void GetPointerDevices(void* v1, void* v2) +{ + g_pfn_GetPointerDevices(); +} + +#pragma EXPORT32(linker, "/export:GetPointerDevices@8=GetPointerDevices") + +EXPORT64 void GetPointerDevice(void* v1, void* v2) +{ + g_pfn_GetPointerDevice(); +} + +#pragma EXPORT32(linker, "/export:GetPointerDevice@8=GetPointerDevice") + +EXPORT64 void DiscardVirtualMemory(void* v1, void* v2) +{ + g_pfn_DiscardVirtualMemory(); +} + +#pragma EXPORT32(linker, "/export:DiscardVirtualMemory@8=DiscardVirtualMemory") \ No newline at end of file diff --git a/exports.c.bak b/exports.c.bak new file mode 100644 index 0000000..4123da2 --- /dev/null +++ b/exports.c.bak @@ -0,0 +1,283 @@ + +#include "export.h" + +// Parameters are there to ensure proper linking on x86. Only built-in types are used as this +// source file is purposely isolated from the common headers to avoid conflicts + +__declspec(dllexport) void __stdcall TryAcquireSRWLockExclusive(void* SRWLock) +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_TryAcquireSRWLockExclusive + } +#else + g_pfn_TryAcquireSRWLockExclusive(); +#endif +} + +__declspec(dllexport) void __stdcall TryAcquireSRWLockShared(void* SRWLock) +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_TryAcquireSRWLockShared + } +#else + g_pfn_TryAcquireSRWLockShared(); +#endif +} + +__declspec(dllexport) void __stdcall AcquireSRWLockExclusive(void* SRWLock) +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_AcquireSRWLockExclusive + } +#else + g_pfn_AcquireSRWLockExclusive(); +#endif +} + +__declspec(dllexport) void __stdcall AcquireSRWLockShared(void* SRWLock) +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_AcquireSRWLockShared + } +#else + g_pfn_AcquireSRWLockShared(); +#endif +} + +__declspec(dllexport) void __stdcall ReleaseSRWLockExclusive(void* SRWLock) +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_ReleaseSRWLockExclusive + } +#else + g_pfn_ReleaseSRWLockExclusive(); +#endif +} + + +__declspec(dllexport) void __stdcall ReleaseSRWLockShared(void* SRWLock) +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_ReleaseSRWLockShared + } +#else + g_pfn_ReleaseSRWLockShared(); +#endif +} + +__declspec(dllexport) void __stdcall InitializeSRWLock(void* SRWLock) +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_InitializeSRWLock + } +#else + g_pfn_InitializeSRWLock(); +#endif +} + + +__declspec(dllexport) void __stdcall DecodePointer(void* Ptr) +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_DecodePointer + } +#else + g_pfn_DecodePointer(); +#endif +} + +__declspec(dllexport) void __stdcall EncodePointer(void* Ptr) +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_DecodePointer + } +#else + g_pfn_DecodePointer(); +#endif +} + +__declspec(dllexport) void __stdcall GetMaximumProcessorCount() +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_GetMaximumProcessorCount + } +#else + g_pfn_GetMaximumProcessorCount(); +#endif +} + +__declspec(dllexport) void __stdcall GetMaximumProcessorGroupCount() +{ +#ifdef _M_IX86 + _asm + { + pop ebp + jmp g_pfn_GetMaximumProcessorGroupCount + } +#else + g_pfn_GetMaximumProcessorGroupCount(); +#endif +} + +__declspec(dllexport) void __stdcall GetLogicalProcessorInformationEx(void* v1, void* v2, void* v3) +{ + g_pfn_GetLogicalProcessorInformationEx(); +} + +__declspec(dllexport) void __stdcall GetThreadGroupAffinity(void* v1, void* v2) +{ + g_pfn_GetThreadGroupAffinity(); +} + +__declspec(dllexport) void __stdcall PowerCreateRequest(void* v1, void* v2) +{ + g_pfn_PowerCreateRequest(); +} + +__declspec(dllexport) void __stdcall PowerSetRequest(void* v1) +{ + g_pfn_PowerSetRequest(); +} + +__declspec(dllexport) void __stdcall PowerClearRequest(void* v1, void* v2) +{ + g_pfn_PowerClearRequest(); +} + +__declspec(dllexport) void __stdcall ResolveLocaleName(void* v1, void* v2, void* v3) +{ + g_pfn_ResolveLocaleName(); +} + +__declspec(dllexport) void __stdcall NtOpenKeyEx(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_NtOpenKeyEx(); +} + +__declspec(dllexport) void __stdcall WerRegisterRuntimeExceptionModule(void* v1, void* v2) +{ + g_pfn_WerRegisterRuntimeExceptionModule(); +} + +__declspec(dllexport) void __stdcall SHGetPropertyStoreForWindow(void* v1, void* v2, void* v3) +{ + g_pfn_SHGetPropertyStoreForWindow(); +} + +__declspec(dllexport) void __stdcall RegisterTouchWindow(void* v1, void* v2) +{ + g_pfn_RegisterTouchWindow(); +} + +__declspec(dllexport) void __stdcall GetTouchInputInfo() +{ + g_pfn_GetTouchInputInfo(); +} + +__declspec(dllexport) void __stdcall QueryDisplayConfig(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6) +{ + g_pfn_QueryDisplayConfig(); +} + +__declspec(dllexport) void __stdcall DisplayConfigGetDeviceInfo(void* v1) +{ + g_pfn_DisplayConfigGetDeviceInfo(); +} + +__declspec(dllexport) void __stdcall DisplayConfigSetDeviceInfo(void* v1) +{ + g_pfn_DisplayConfigSetDeviceInfo(); +} + +__declspec(dllexport) void __stdcall GetDisplayConfigBufferSizes(void* v1, void* v2, void* v3) +{ + g_pfn_GetDisplayConfigBufferSizes(); +} + +__declspec(dllexport) void __stdcall CloseTouchInputHandle(void* v1) +{ + g_pfn_CloseTouchInputHandle(); +} + +__declspec(dllexport) void __stdcall CloseGestureInfoHandle() +{ + g_pfn_CloseGestureInfoHandle(); +} + +__declspec(dllexport) void __stdcall GetGestureInfo() +{ + g_pfn_GetGestureInfo(); +} + +__declspec(dllexport) void __stdcall SetGestureConfig() +{ + g_pfn_SetGestureConfig(); +} + +__declspec(dllexport) void __stdcall UnregisterTouchWindow() +{ + g_pfn_UnregisterTouchWindow(); +} + +__declspec(dllexport) void __stdcall IsTouchWindow() +{ + g_pfn_IsTouchWindow(); +} + +__declspec(dllexport) void __stdcall CreateRemoteThreadEx(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6, void* v7, void* v8) +{ + g_pfn_CreateRemoteThreadEx(); +} + +__declspec(dllexport) void __stdcall GetModuleInformation(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_GetModuleInformation(); +} + +__declspec(dllexport) void __stdcall GetProcessMemoryInfo(void* v1, void* v2, void* v3) +{ + g_pfn_GetProcessMemoryInfo(); +} + +__declspec(dllexport) void __stdcall FindFirstFileExW(void* v1, void* v2, void* v3, void* v4, + void* v5, void* v6) +{ + g_pfn_FindFirstFileExW(); +} + +__declspec(dllexport) void __stdcall SleepConditionVariableSRW(void* v1, void* v2, void* v3, void* v4) +{ + g_pfn_SleepConditionVariableSRW(); +} \ No newline at end of file diff --git a/fiber.c b/fiber.c new file mode 100644 index 0000000..1c427d3 --- /dev/null +++ b/fiber.c @@ -0,0 +1,198 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +BOOL WINAPI Implementation_IsThreadAFiber() +// Vista uses a TEB flag to determine whether a thread is a fiber. +// XP puts the flag in a different area, and 2000 has none. +// But there is the TIB's FiberData member, which also has a "version" number assigned to it. +// On XP and Vista it is assigned 0x1E00. Anything greather than that is assumed to be fiber data. +{ + PTEB_CUSTOM Teb; + + Teb = (PTEB_CUSTOM)NtCurrentTeb(); + + if((ULONG_PTR)Teb->FiberData <= 0x1E00) + return FALSE; + + return TRUE; +} + +DWORD WINAPI Implementation_FlsAlloc( + PFLS_CALLBACK_FUNCTION lpCallback +) +{ + return TlsAlloc(); +} + +BOOL WINAPI Implementation_FlsFree( + DWORD dwFlsIndex +) +{ + return TlsFree(dwFlsIndex); +} + +typedef PVOID(WINAPI* pfnFlsGetValue)(DWORD); +BOOLEAN IsNt6Level = FALSE; +pfnFlsGetValue pFlsGetVal = NULL; +PVOID Test = NULL; + +PVOID WINAPI Implementation_FlsGetValue( + DWORD dwFlsIndex +) +{ + PTEB_CUSTOM Teb; + int i; + PLDR_DATA_TABLE_ENTRY DataTableEntry, DataTableEntryInit; + ANSI_STRING Fls; + if (!Test) + { + RtlInitAnsiString(&Fls, "FlsGetValue"); + + LdrGetProcedureAddress(GetModuleHandleA("kernel32.dll"), &Fls, 0, &pFlsGetVal); + RtlInitAnsiString(&Fls, "WerpInitiateRemoteRecovery"); + LdrGetProcedureAddress(GetModuleHandleA("kernel32.dll"), &Fls, 0, &Test); + if (!Test) { + for (i = 0; i < TlsBasesCount; i++) + { + TLSInit_DllMain_ThreadAttach_Internal(TlsBases[i], NULL); + } + } + } + if (pFlsGetVal) + return pFlsGetVal(dwFlsIndex); + return TlsGetValue(dwFlsIndex); +} + +BOOL WINAPI Implementation_FlsSetValue( + DWORD dwFlsIndex, + PVOID lpFlsData +) +{ + return TlsSetValue(dwFlsIndex, lpFlsData); +} + +typedef struct +{ + LPVOID lpParameter; + PVOID Reserved [4]; + CONTEXT Ctx; +}FIBER, *PFIBER; + +LPVOID WINAPI Implementation_ConvertThreadToFiberEx( + LPVOID lpParameter, + DWORD dwFlags +) +{ + PFIBER Result = (PFIBER) ConvertThreadToFiber(lpParameter); + + if(Result && dwFlags & FIBER_FLAG_FLOAT_SWITCH) + { + Result->Ctx.ContextFlags |= CONTEXT_FLOATING_POINT | CONTEXT_CONTROL | CONTEXT_SEGMENTS | CONTEXT_INTEGER; + } + + return (LPVOID) Result; +} + +LPVOID WINAPI Implementation_CreateFiberEx( + SIZE_T dwStackCommitSize, + SIZE_T dwStackReserveSize, + DWORD dwFlags, + LPFIBER_START_ROUTINE lpStartAddress, + LPVOID lpParameter +) +{ + PFIBER Result; + typedef LPVOID (WINAPI* pfnCreateFiberEx)(SIZE_T, SIZE_T, DWORD, LPFIBER_START_ROUTINE, LPVOID); + + pfnCreateFiberEx pCreateFib = (pfnCreateFiberEx)Implementation_GetProcAddress(GetModuleHandleA("kernel32.dll"), "CreateFiberEx"); + + if(g_pfn_ConvertThreadToFiberEx == (pfnFunc_generic)Implementation_ConvertThreadToFiberEx) + { + Result = (PFIBER) pCreateFib(dwStackCommitSize, dwStackReserveSize, 0, lpStartAddress, lpParameter); + + if(Result && dwFlags & FIBER_FLAG_FLOAT_SWITCH) + { + Result->Ctx.ContextFlags |= CONTEXT_FLOATING_POINT | CONTEXT_CONTROL | CONTEXT_SEGMENTS | CONTEXT_INTEGER; + } + } + else + Result = (PFIBER) pCreateFib(dwStackCommitSize, dwStackReserveSize, dwFlags, lpStartAddress, lpParameter); + + return (LPVOID) Result; +} + +void WINAPI Implementation_SwitchToFiber(LPVOID lpFiber) +{ + + /* +#ifdef _M_IX86 + __asm + { + mov edx, fs:0x18 ; NtCurrentTeb() + mov eax, [edx+0x10] ; FiberData + mov [eax+0xB8], ebx + mov [eax+0xB0], edi + mov [eax+0xB4], esi + mov [eax+0xC8], ebp + cmp dword ptr [eax+0x14], 0x1000F ; Result->Ctx.ContextFlags & CONTEXT_FLOATING_POINT | CONTEXT_CONTROL | CONTEXT_SEGMENTS | CONTEXT_INTEGER + jnz SkipFloatingPoint + fstsw word ptr [eax+0x34] + fnstcw word ptr [eax+0x30] + cmp byte ptr ds:0x7FFE027A, 1 ; PF_XMMI_INSTRUCTIONS_AVAILABLE check, available since Windows 2000 + jnz SkipFloatingPoint + nop ; stmxcsr dword ptr [eax+0x28] +SkipFloatingPoint: + mov [eax+0xD8], esp + mov ecx, [edx] + mov ebx, [edx+8] + mov [eax+4], ecx + mov [eax+0xC], ebx + mov ecx, [esp+4] ; lpFiber + mov [edx+0x10], ecx + mov esi, [ecx+4] + mov ebx, [ecx+8] + mov [edx], esi + mov [edx+4], ebx + mov esi, [ecx+0xC] + mov ebx, [ecx+0x10] + mov [edx+8], esi + mov [edx+0xE0C], ebx + cmp dword ptr [ecx+0x14], 1000Fh + jnz SkipFloatingPoint2 + mov ebx, [eax+0x34] + cmp bx, [ecx+0x34] + jnz loc_7DD8105B + mov ebx, [eax+0x30] + cmp bx, [ecx+0x30] + jz loc_7DD81064 +loc_7DD8105B: + mov word ptr [ecx+0x38], 0xFFFF + fldenv byte ptr [ecx+0x30] +loc_7DD81064: + cmp byte ptr ds:0x7FFE027A, 1 + jnz SkipFloatingPoint2 + nop ; ldmxcsr dword ptr [ecx+0x28] +SkipFloatingPoint2: + mov edi, [ecx+0xB0] + mov esi, [ecx+0xB4] + mov ebp, [ecx+0xC8] + mov ebx, [ecx+0xB8] + mov esp, [ecx+0xD8] + } +#endif + */ +} + +BOOL WINAPI Implementation_ConvertFiberToThread() +{ + PTEB_CUSTOM Teb = (PTEB_CUSTOM)NtCurrentTeb(); + + if((ULONG_PTR)Teb->FiberData <= 0x1E00) + return FALSE; + else + Teb->FiberData = 0x1E00; + + return TRUE; + +} \ No newline at end of file diff --git a/file.c b/file.c new file mode 100644 index 0000000..6114ad6 --- /dev/null +++ b/file.c @@ -0,0 +1,395 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include + +typedef enum { + FileDirectoryInfo = 1, + FileFullDirectoryInformation, // 2 + FileBothDirectoryInformation, // 3 + FileBasicInformation, // 4 + FileStandardInformation, // 5 + FileInternalInformation, // 6 + FileEaInformation, // 7 + FileAccessInformation, // 8 + FileNameInformation, // 9 + FileRenameInformation, // 10 + FileLinkInformation, // 11 + FileNamesInformation, // 12 + FileDispositionInformation, // 13 + FilePositionInformation, // 14 + FileFullEaInformation, // 15 + FileModeInformation, // 16 + FileAlignmentInformation, // 17 + FileAllInformation, // 18 + FileAllocationInformation, // 19 + FileEndOfFileInformation, // 20 + FileAlternateNameInformation, // 21 + FileStreamInformation, // 22 + FilePipeInformation, // 23 + FilePipeLocalInformation, // 24 + FilePipeRemoteInformation, // 25 + FileMailslotQueryInformation, // 26 + FileMailslotSetInformation, // 27 + FileCompressionInformation, // 28 + FileObjectIdInformation, // 29 + FileCompletionInformation, // 30 + FileMoveClusterInformation, // 31 + FileQuotaInformation, // 32 + FileReparsePointInformation, // 33 + FileNetworkOpenInformation, // 34 + FileAttributeTagInformation, // 35 + FileTrackingInformation, // 36 + FileIdBothDirectoryInformation, // 37 + FileIdFullDirectoryInformation, // 38 + FileValidDataLengthInformation, // 39 + FileShortNameInformation, // 40 + FileIoCompletionNotificationInformation, // 41 + FileIoStatusBlockRangeInformation, // 42 + FileIoPriorityHintInformation, // 43 + FileSfioReserveInformation, // 44 + FileSfioVolumeInformation, // 45 + FileHardLinkInformation, // 46 + FileProcessIdsUsingFileInformation, // 47 + FileNormalizedNameInformation, // 48 + FileNetworkPhysicalNameInformation, // 49 + FileIdGlobalTxDirectoryInformation, // 50 + FileIsRemoteDeviceInformation, // 51 + FileUnusedInformation, // 52 + FileNumaNodeInformation, // 53 + FileStandardLinkInformation, // 54 + FileRemoteProtocolInformation, // 55 + + // + // These are special versions of these operations (defined earlier) + // which can be used by kernel mode drivers only to bypass security + // access checks for Rename and HardLink operations. These operations + // are only recognized by the IOManager, a file system should never + // receive these. + // + + FileRenameInformationBypassAccessCheck, // 56 + FileLinkInformationBypassAccessCheck, // 57 + + // + // End of special information classes reserved for IOManager. + // + + FileVolumeNameInformation, // 58 + FileIdInformation, // 59 + FileIdExtdDirectoryInformation, // 60 + FileReplaceCompletionInformation, // 61 + FileHardLinkFullIdInformation, // 62 + FileIdExtdBothDirectoryInformation, // 63 + FileDispositionInformationEx, // 64 + FileRenameInformationEx, // 65 + FileRenameInformationExBypassAccessCheck, // 66 + FileDesiredStorageClassInformation, // 67 + FileStatInformation, // 68 + FileMemoryPartitionInformation, // 69 + FileStatLxInformation, // 70 + FileCaseSensitiveInformation, // 71 + FileLinkInformationEx, // 72 + FileLinkInformationExBypassAccessCheck, // 73 + FileStorageReserveIdInformation, // 74 + FileCaseSensitiveInformationForceAccessCheck, // 75 + FileKnownFolderInformation, // 76 + + FileMaximumInformation +} FILEINFOCLASS, *PFILEINFOCLASS; + +#define ObjectNameInformation 1 + +typedef struct _OBJECT_NAME_INFORMATION { + UNICODE_STRING Name; + WCHAR NameBuffer[1]; +} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION; + +typedef struct _FILE_NAME_INFORMATION { + ULONG FileNameLength; + WCHAR FileName[1]; +} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION; + +NTSTATUS +NTAPI +NtQueryInformationFile ( + _In_ HANDLE FileHandle, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _Out_writes_bytes_(Length) PVOID FileInformation, + _In_ ULONG Length, + _In_ FILEINFOCLASS FileInformationClass + ); + +typedef enum _FSINFOCLASS { + FileFsVolumeInformation, + FileFsLabelInformation, + FileFsSizeInformation, + FileFsDeviceInformation, + FileFsAttributeInformation, + FileFsControlInformation, + FileFsFullSizeInformation, + FileFsObjectIdInformation, + FileFsDriverPathInformation, + FileFsVolumeFlagsInformation, + FileFsSectorSizeInformation, + FileFsDataCopyInformation, + FileFsMetadataSizeInformation, + FileFsFullSizeInformationEx, + FileFsGuidInformation, + FileFsMaximumInformation +} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; + +NTSTATUS NTAPI NtQueryVolumeInformationFile( + _In_ HANDLE FileHandle, + _Out_ PIO_STATUS_BLOCK IoStatusBlock, + _Out_ PVOID FsInformation, + _In_ ULONG Length, + _In_ FS_INFORMATION_CLASS FsInformationClass +); + +HANDLE WINAPI Implementation_FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, + FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags) +{ + + if(dwAdditionalFlags & FIND_FIRST_EX_LARGE_FETCH) + dwAdditionalFlags &= ~FIND_FIRST_EX_LARGE_FETCH; + + typedef HANDLE (WINAPI* pfnFindFirstFileExW)(LPCWSTR, FINDEX_INFO_LEVELS, LPVOID, FINDEX_SEARCH_OPS, LPVOID, DWORD); + pfnFindFirstFileExW pFFFEXW = (pfnFindFirstFileExW)Implementation_GetProcAddress(GetModuleHandleA("kernel32.dll"), "FindFirstFileExW"); + return pFFFEXW(lpFileName, FindExInfoStandard, lpFindFileData, fSearchOp, lpSearchFilter, dwAdditionalFlags); +} + +BOOL WINAPI Implementation_GetFileInformationByHandleEx( + HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS FileInformationClass, + LPVOID lpFileInformation, + DWORD dwBufferSize +) +/* + Seems like a wrapper around NtQueryInformationFile, but with the + file information classes shifted around a little bit. + A switch statement will take care of that. +*/ +{ + IO_STATUS_BLOCK isb; + NTSTATUS Status; + + switch(FileInformationClass) + { + case FileBasicInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileBasicInformation); + break; + case FileStandardInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileStandardInformation); + break; + case FileNameInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileNameInformation); + break; + case FileRenameInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileRenameInformation); + break; + case FileDispositionInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileDispositionInformation); + break; + case FileAllocationInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileAllocationInformation); + break; + case FileEndOfFileInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileEndOfFileInformation); + break; + case FileStreamInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileStreamInformation); + break; + case FileCompressionInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileCompressionInformation); + break; + case FileAttributeTagInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileAttributeTagInformation); + break; + case FileIdBothDirectoryInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileIdBothDirectoryInformation); + break; + case FileIdBothDirectoryRestartInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileIdFullDirectoryInformation); // ?? + break; + case FileIoPriorityHintInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileIoPriorityHintInformation); + break; + case FileRemoteProtocolInfo: + Status = NtQueryInformationFile(hFile, &isb, lpFileInformation, dwBufferSize, FileRemoteProtocolInformation); + break; + default: // All other classes are not known to work on XP or below + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if(Status == 0x0) + return TRUE; + else + { + BaseSetLastNTError(Status); + return FALSE; + } +} + +BOOL WINAPI Implementation_CancelIoEx(HANDLE hFile, LPOVERLAPPED lpOverlapped) +{ + return CancelIo(hFile); +} + +DWORD WINAPI Implementation_GetFinalPathNameByHandleW( + HANDLE hFile, + LPWSTR lpszFilePath, + DWORD cchFilePath, + DWORD dwFlags +) +/* + NtQueryInformationFile returns the path without the volume name. + NtQueryObject returns the path with the NT volume name. + The DOS volume name can be retrieved using QueryDosDeviceW to compare with the NtQueryObject value. +*/ +{ + IO_STATUS_BLOCK isb; + PFILE_NAME_INFORMATION fni; + NTSTATUS Status; + ULONG BufferSize, NtNameLen, VolumeNameLen, NoVolNameLen; + WCHAR DosDriveLetter [3] = L"A:"; + WCHAR Path [MAX_PATH]; + PWSTR VolumeName; + HANDLE hMap; + PVOID Mem; + + if(dwFlags & ~(VOLUME_NAME_NONE | VOLUME_NAME_NT | FILE_NAME_OPENED)) // todo: add VOLUME_NAME_GUID support + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + BufferSize = sizeof(FILE_NAME_INFORMATION); + fni = (PFILE_NAME_INFORMATION)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, BufferSize); + while(1) + { + Status = NtQueryInformationFile(hFile, &isb, (PVOID)fni, BufferSize, FileNameInformation); + if(Status == 0) + break; + else if(Status == 0x80000005) + BufferSize += 8; + else + { + HeapFree(GetProcessHeap(), 0, fni); + BaseSetLastNTError(Status); + return 0; + } + + HeapFree(GetProcessHeap(), 0, fni); + fni = (PFILE_NAME_INFORMATION)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, BufferSize); + } + + NoVolNameLen = fni->FileNameLength; + + if(dwFlags & VOLUME_NAME_NONE) + { + if(cchFilePath >= fni->FileNameLength) + StringCchCopyW(lpszFilePath, cchFilePath, fni->FileName); + HeapFree(GetProcessHeap(), 0, fni); + return NoVolNameLen; + } + + hMap = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 1, NULL); + + if(hMap) + { + Mem = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 1); + + if(Mem) + { + NtNameLen = GetMappedFileNameW(GetCurrentProcess(), Mem, Path, MAX_PATH); + } + else + { + CloseHandle(hMap); + return 0; + } + CloseHandle(hMap); + } + else + { + return 0; + } +/* + BufferSize = sizeof(OBJECT_NAME_INFORMATION); + oni = (POBJECT_NAME_INFORMATION)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, BufferSize); + while(1) + { + Status = NtQueryObject(hFile, ObjectNameInformation, oni, BufferSize, NULL); + if(Status == 0) + break; + else if(Status == 0x80000005) + BufferSize += 8; + else + { + HeapFree(GetProcessHeap(), 0, oni); + BaseSetLastNTError(Status); + return 0; + } + + HeapFree(GetProcessHeap(), 0, oni); + oni = (POBJECT_NAME_INFORMATION)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, BufferSize); + } + */ + if(dwFlags & VOLUME_NAME_NT) + { + if(cchFilePath >= NtNameLen) + StringCchCopyW(lpszFilePath, cchFilePath, Path); + return NtNameLen; + } + + VolumeName = (PWSTR)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, BufferSize); + + while(DosDriveLetter[0] <= L"Z") + { + VolumeNameLen = QueryDosDeviceW(DosDriveLetter, VolumeName, BufferSize / sizeof(WCHAR)); + + if(LimitedStrCmp(0, VolumeNameLen, Path, VolumeName)) + break; + + if(DosDriveLetter[0] == L"Z") + { + SetLastError(ERROR_PATH_NOT_FOUND); + return 0; + } + + ++DosDriveLetter[0]; + } + + StringCchCopyW(lpszFilePath, cchFilePath, L"\?\\"); + StringCchCatW(lpszFilePath, cchFilePath, DosDriveLetter); + StringCchCatW(lpszFilePath, cchFilePath, L"\\"); + StringCchCatW(lpszFilePath, cchFilePath, fni->FileName); + + HeapFree(GetProcessHeap(), 0, VolumeName); + HeapFree(GetProcessHeap(), 0, fni); + + return NoVolNameLen + 8; +} + + +BOOL WINAPI Implementation_SetFileInformationByHandle( + HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS FileInformationClass, + LPVOID lpFileInformation, + DWORD dwBufferSize +) +{ + return FALSE; +} + +BOOL Implementation_GetVolumePathNamesForVolumeNameW( + LPCWSTR lpszVolumeName, + LPWCH lpszVolumePathNames, + DWORD cchBufferLength, + PDWORD lpcchReturnLength +) +{ + return FALSE; +} \ No newline at end of file diff --git a/implementations.h b/implementations.h new file mode 100644 index 0000000..e3d86ff --- /dev/null +++ b/implementations.h @@ -0,0 +1,1061 @@ +#pragma once +#include "progwrp.h" + +BOOLEAN WINAPI Implementation_TryAcquireSRWLockExclusive(PSRWLOCK SRWLock); +BOOLEAN WINAPI Implementation_TryAcquireSRWLockShared(PSRWLOCK SRWLock); +VOID WINAPI Implementation_AcquireSRWLockExclusive(PSRWLOCK SRWLock); +VOID WINAPI Implementation_AcquireSRWLockShared(PSRWLOCK SRWLock); +VOID WINAPI Implementation_ReleaseSRWLockExclusive(PSRWLOCK SRWLock); +VOID WINAPI Implementation_ReleaseSRWLockShared(PSRWLOCK SRWLock); + +PVOID WINAPI Implementation_DecodePointer(PVOID Ptr); +PVOID WINAPI Implementation_EncodePointer(PVOID Ptr); + +WORD WINAPI Implementation_GetMaximumProcessorCount(); +WORD WINAPI Implementation_GetMaximumProcessorGroupCount(); +BOOL WINAPI Implementation_GetLogicalProcessorInformationEx( + LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType, + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer, + PDWORD ReturnedLength +); +BOOL WINAPI Implementation_GetThreadGroupAffinity( + HANDLE hThread, + PGROUP_AFFINITY GroupAffinity +); + +BOOL WINAPI Implementation_PowerClearRequest( + HANDLE PowerRequest, + POWER_REQUEST_TYPE RequestType +); +HANDLE WINAPI Implementation_PowerCreateRequest( + PREASON_CONTEXT Context +); +BOOL WINAPI Implementation_PowerSetRequest( + HANDLE PowerRequest, + POWER_REQUEST_TYPE RequestType +); + +int WINAPI Implementation_ResolveLocaleName( + LPCWSTR lpNameToResolve, + LPWSTR lpLocaleName, + int cchLocaleName +); + +HRESULT WINAPI Implementation_WerRegisterRuntimeExceptionModule( + PCWSTR pwszOutOfProcessCallbackDll, + PVOID pContext +); + +NTSTATUS NTAPI Implementation_NtOpenKeyEx( + PHANDLE KeyHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + ULONG OpenOptions +); + +HRESULT WINAPI Implementation_SHGetPropertyStoreForWindow( + HWND hwnd, + REFIID riid, + void **ppv +); + +HMODULE WINAPI Implementation_LoadLibraryA( + LPCSTR lpLibFileName +); + +HMODULE WINAPI Implementation_LoadLibraryW( + LPCWSTR lpLibFileName +); + +HMODULE WINAPI Implementation_LoadLibraryExA( + LPCSTR lpLibFileName, + HANDLE hFile, + DWORD dwFlags +); + +HMODULE WINAPI Implementation_LoadLibraryExW( + LPCWSTR lpLibFileName, + HANDLE hFile, + DWORD dwFlags +); + +BOOL WINAPI Implementation_RegisterTouchWindow( + HWND hwnd, + ULONG ulFlags +); + +LONG WINAPI Implementation_GetDisplayConfigBufferSizes( + UINT32 flags, + UINT32 *numPathArrayElements, + UINT32 *numModeInfoArrayElements +); + +BOOL WINAPI Implementation_CloseTouchInputHandle( + HTOUCHINPUT hTouchInput +); + +BOOL WINAPI Implementation_GetGestureInfo( + HGESTUREINFO hGestureInfo, + PGESTUREINFO pGestureInfo +); + +LONG WINAPI Implementation_DisplayConfigGetDeviceInfo( + DISPLAYCONFIG_DEVICE_INFO_HEADER *requestPacket +); + +LONG WINAPI Implementation_DisplayConfigSetDeviceInfo( + DISPLAYCONFIG_DEVICE_INFO_HEADER *setPacket +); + +LONG WINAPI Implementation_QueryDisplayConfig( + UINT32 flags, + UINT32 *numPathArrayElements, + DISPLAYCONFIG_PATH_INFO *pathArray, + UINT32 *numModeInfoArrayElements, + DISPLAYCONFIG_MODE_INFO *modeInfoArray, + DISPLAYCONFIG_TOPOLOGY_ID *currentTopologyId +); + +HANDLE WINAPI Implementation_CreateRemoteThreadEx( + HANDLE hProcess, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + SIZE_T dwStackSize, + LPTHREAD_START_ROUTINE lpStartAddress, + LPVOID lpParameter, + DWORD dwCreationFlags, + LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, + LPDWORD lpThreadId +); + +BOOL WINAPI Implementation_GetProcessMemoryInfo( + HANDLE Process, + PPROCESS_MEMORY_COUNTERS ppsmemCounters, + DWORD cb +); + +BOOL WINAPI Implementation_GetModuleInformation( + HANDLE hProcess, + HMODULE hModule, + LPMODULEINFO lpmodinfo, + DWORD cb +); + +void WINAPI Implementation_InitializeSRWLock( + PSRWLOCK SRWLock +); + +HANDLE WINAPI Implementation_FindFirstFileExW(LPCWSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevelId, LPVOID lpFindFileData, + FINDEX_SEARCH_OPS fSearchOp, LPVOID lpSearchFilter, DWORD dwAdditionalFlags); + +BOOL WINAPI Implementation_SleepConditionVariableSRW( + PCONDITION_VARIABLE ConditionVariable, + PSRWLOCK SRWLock, + DWORD dwMilliseconds, + ULONG Flags +); + +BOOL WINAPI Implementation_SleepConditionVariableCS( + PCONDITION_VARIABLE ConditionVariable, + PCRITICAL_SECTION CriticalSection, + DWORD dwMilliseconds +); + +void WINAPI Implementation_InitializeConditionVariable( + PCONDITION_VARIABLE ConditionVariable +); + +void WINAPI Implementation_WakeConditionVariable( + PCONDITION_VARIABLE ConditionVariable +); + +void WINAPI Implementation_WakeAllConditionVariable( + PCONDITION_VARIABLE ConditionVariable +); + +BOOL WINAPI Implementation_EnumSystemLocalesEx( + LOCALE_ENUMPROCEX lpLocaleEnumProcEx, + DWORD dwFlags, + LPARAM lParam, + LPVOID lpReserved +); + +int WINAPI Implementation_GetCurrencyFormatEx( + LPCWSTR lpLocaleName, + DWORD dwFlags, + LPCWSTR lpValue, + const CURRENCYFMTW *lpFormat, + LPWSTR lpCurrencyStr, + int cchCurrency +); + +int WINAPI Implementation_GetDateFormatEx( + LPCWSTR lpLocaleName, + DWORD dwFlags, + const SYSTEMTIME *lpDate, + LPCWSTR lpFormat, + LPWSTR lpDateStr, + int cchDate, + LPCWSTR lpCalendar +); + +DWORD WINAPI Implementation_GetDynamicTimeZoneInformation( + PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation +); + +int WINAPI Implementation_GetTimeFormatEx( + LPCWSTR lpLocaleName, + DWORD dwFlags, + const SYSTEMTIME *lpTime, + LPCWSTR lpFormat, + LPWSTR lpTimeStr, + int cchTime +); + +int WINAPI Implementation_GetLocaleInfoEx( + LPCWSTR lpLocaleName, + LCTYPE LCType, + LPWSTR lpLCData, + int cchData +); + +int WINAPI Implementation_GetNumberFormatEx( + LPCWSTR lpLocaleName, + DWORD dwFlags, + LPCWSTR lpValue, + const NUMBERFMTW *lpFormat, + LPWSTR lpNumberStr, + int cchNumber +); + +int WINAPI Implementation_GetUserDefaultLocaleName( + LPWSTR lpLocaleName, + int cchLocaleName +); + +int WINAPI Implementation_LCIDToLocaleName( + LCID Locale, + LPWSTR lpName, + int cchName, + DWORD dwFlags +); + +LCID WINAPI Implementation_LocaleNameToLCID( + LPCWSTR lpName, + DWORD dwFlags +); + +BOOL WINAPI Implementation_GetThreadPreferredUILanguages( + DWORD dwFlags, + PULONG pulNumLanguages, + PZZWSTR pwszLanguagesBuffer, + PULONG pcchLanguagesBuffer +); + +BOOL WINAPI Implementation_SleepConditionVariableCS( + PCONDITION_VARIABLE ConditionVariable, + PCRITICAL_SECTION CriticalSection, + DWORD dwMilliseconds +); + +BOOL WINAPI Implementation_InitOnceBeginInitialize( + LPINIT_ONCE lpInitOnce, + DWORD dwFlags, + PBOOL fPending, + LPVOID *lpContext +); + +BOOL WINAPI Implementation_InitOnceExecuteOnce( + PINIT_ONCE InitOnce, + PINIT_ONCE_FN InitFn, + PVOID Parameter, + LPVOID *Context +); + +BOOL WINAPI Implementation_InitOnceComplete( + LPINIT_ONCE lpInitOnce, + DWORD dwFlags, + LPVOID lpContext +); + +void WINAPI Implementation_InitOnceInitialize( + PINIT_ONCE InitOnce +); + +BOOL WINAPI Implementation_InitializeCriticalSectionEx( + LPCRITICAL_SECTION lpCriticalSection, + DWORD dwSpinCount, + DWORD Flags +); + +HANDLE WINAPI Implementation_CreateWaitableTimerExW( + LPSECURITY_ATTRIBUTES lpTimerAttributes, + LPCWSTR lpTimerName, + DWORD dwFlags, + DWORD dwDesiredAccess +); + +BOOL WINAPI Implementation_CancelIoEx(HANDLE hFile, LPOVERLAPPED lpOverlapped); + +DWORD WINAPI Implementation_GetFinalPathNameByHandleW( + HANDLE hFile, + LPWSTR lpszFilePath, + DWORD cchFilePath, + DWORD dwFlags +); + +BOOL WINAPI Implementation_SetFileInformationByHandle( + HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS FileInformationClass, + LPVOID lpFileInformation, + DWORD dwBufferSize +); + +BOOL WINAPI Implementation_GetFileInformationByHandleEx( + HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS FileInformationClass, + LPVOID lpFileInformation, + DWORD dwBufferSize +); + +BOOL WINAPI Implementation_InitializeProcThreadAttributeList( + LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, + DWORD dwAttributeCount, + DWORD dwFlags, + PSIZE_T lpSize +); + +BOOL WINAPI Implementation_UpdateProcThreadAttribute( + LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, + DWORD dwFlags, + DWORD_PTR Attribute, + PVOID lpValue, + SIZE_T cbSize, + PVOID lpPreviousValue, + PSIZE_T lpReturnSize +); + +void WINAPI Implementation_DeleteProcThreadAttributeList( + LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList +); + +BOOL WINAPI Implementation_QueryFullProcessImageNameW( + HANDLE hProcess, + DWORD dwFlags, + LPWSTR lpExeName, + PDWORD lpdwSize +); + +BOOL WINAPI Implementation_QueryFullProcessImageNameA( + HANDLE hProcess, + DWORD dwFlags, + LPSTR lpExeName, + PDWORD lpdwSize +); + +BOOL WINAPI Implementation_QueryThreadCycleTime( + HANDLE ThreadHandle, + PULONG64 CycleTime +); + +BOOL WINAPI Implementation_QueryProcessCycleTime( + HANDLE ProcessHandle, + PULONG64 CycleTime +); + +BOOL WINAPI Implementation_GetProductInfo( + DWORD dwOSMajorVersion, + DWORD dwOSMinorVersion, + DWORD dwSpMajorVersion, + DWORD dwSpMinorVersion, + PDWORD pdwReturnedProductType +); + +BOOL WINAPI Implementation_GetNamedPipeServerProcessId( + HANDLE Pipe, + PULONG ServerProcessId +); + +BOOL WINAPI Implementation_GetNamedPipeClientProcessId( + HANDLE Pipe, + PULONG ClientProcessId +); + +BOOL WINAPI Implementation_SymGetSearchPathW( + HANDLE hProcess, + PWSTR SearchPath, + DWORD SearchPathLength +); + +BOOL WINAPI Implementation_SymSetSearchPathW( + HANDLE hProcess, + PCWSTR SearchPath +); + +PCSTR WINAPI Implementation_inet_ntop( + INT Family, + const VOID *pAddr, + PSTR pStringBuf, + size_t StringBufSize +); + +_NETIOAPI_SUCCESS_ NETIOAPI_API_ Implementation_GetIfTable2( + PVOID Table +); + +VOID NETIOAPI_API_ Implementation_FreeMibTable( + PVOID Memory +); + +BOOL WINAPI Implementation_Wow64GetThreadContext( + HANDLE hThread, + PWOW64_CONTEXT lpContext +); + +BOOL WINAPI Implementation_AddMandatoryAce( + PACL pAcl, + DWORD dwAceRevision, + DWORD AceFlags, + DWORD MandatoryPolicy, + PSID pLabelSid +); + +ULONG WINAPI Implementation_EventRegister( + LPCGUID ProviderId, + PENABLECALLBACK EnableCallback, + PVOID CallbackContext, + PREGHANDLE RegHandle +); + +ULONG WINAPI Implementation_EventSetInformation( + REGHANDLE RegHandle, + EVENT_INFO_CLASS InformationClass, + PVOID EventInformation, + ULONG InformationLength +); + +ULONG WINAPI Implementation_EventUnregister( + REGHANDLE RegHandle +); + +ULONG WINAPI Implementation_EventWrite( + REGHANDLE RegHandle, + PCEVENT_DESCRIPTOR EventDescriptor, + ULONG UserDataCount, + PEVENT_DATA_DESCRIPTOR UserData +); + +ULONG WINAPI Implementation_EventWriteTransfer( + REGHANDLE RegHandle, + PCEVENT_DESCRIPTOR EventDescriptor, + LPCGUID ActivityId, + LPCGUID RelatedActivityId, + ULONG UserDataCount, + PEVENT_DATA_DESCRIPTOR UserData +); + +HPOWERNOTIFY WINAPI Implementation_RegisterPowerSettingNotification( + HANDLE hRecipient, + LPCGUID PowerSettingGuid, + DWORD Flags +); + +BOOL WINAPI Implementation_UnregisterPowerSettingNotification( + HPOWERNOTIFY Handle +); + +BOOL WINAPI Implementation_SetProcessDPIAware(); + +EVT_HANDLE WINAPI Implementation_EvtQuery( + EVT_HANDLE Session, + LPCWSTR Path, + LPCWSTR Query, + DWORD Flags +); + +BOOL WINAPI Implementation_EvtRender( + EVT_HANDLE Context, + EVT_HANDLE Fragment, + DWORD Flags, + DWORD BufferSize, + PVOID Buffer, + PDWORD BufferUsed, + PDWORD PropertyCount +); + +EVT_HANDLE WINAPI Implementation_EvtCreateRenderContext( + DWORD ValuePathsCount, + LPCWSTR *ValuePaths, + DWORD Flags +); + +BOOL WINAPI Implementation_EvtNext( + EVT_HANDLE ResultSet, + DWORD EventsSize, + PEVT_HANDLE Events, + DWORD Timeout, + DWORD Flags, + PDWORD Returned +); + +BOOL WINAPI Implementation_EvtClose( + EVT_HANDLE Object +); + +HRESULT WINAPI Implementation_SHGetKnownFolderPath( + REFKNOWNFOLDERID rfid, + DWORD dwFlags, + HANDLE hToken, + PWSTR *ppszPath +); + +HRESULT WINAPI Implementation_DwmSetWindowAttribute( + HWND hwnd, + DWORD dwAttribute, + LPCVOID pvAttribute, + DWORD cbAttribute +); + +HRESULT WINAPI Implementation_DwmGetWindowAttribute( + HWND hwnd, + DWORD dwAttribute, + LPCVOID pvAttribute, + DWORD cbAttribute +); + +BOOL WINAPI Implementation_DwmDefWindowProc( + HWND hWnd, + UINT msg, + WPARAM wParam, + LPARAM lParam, + LRESULT *plResult +); + +HRESULT WINAPI Implementation_DwmExtendFrameIntoClientArea( + HWND hWnd, + const MARGINS *pMarInset +); + +HRESULT WINAPI Implementation_DwmGetCompositionTimingInfo( + HWND hwnd, + DWM_TIMING_INFO *pTimingInfo +); + +BOOL WINAPI Implementation_SetupDiGetDevicePropertyW( + HDEVINFO DeviceInfoSet, + PSP_DEVINFO_DATA DeviceInfoData, + const DEVPROPKEY *PropertyKey, + DEVPROPTYPE *PropertyType, + PBYTE PropertyBuffer, + DWORD PropertyBufferSize, + PDWORD RequiredSize, + DWORD Flags +); + +HRESULT WINAPI Implementation_CreateDXGIFactory( + REFIID riid, + void **ppFactory +); + +HRESULT WINAPI Implementation_CreateDXGIFactory1( + REFIID riid, + void **ppFactory +); + +HRESULT WINAPI Implementation_ScriptItemize( + const WCHAR *pwcInChars, + int cInChars, + int cMaxItems, + const SCRIPT_CONTROL *psControl, + const SCRIPT_STATE *psState, + SCRIPT_ITEM *pItems, + int *pcItems +); + +BOOL WINAPI Implementation_SystemParametersInfoW( + UINT uiAction, + UINT uiParam, + PVOID pvParam, + UINT fWinIni +); + +HRESULT WINAPI Implementation_SHQueryUserNotificationState( + QUERY_USER_NOTIFICATION_STATE *pquns +); + +BOOL WINAPI Implementation_IsThreadAFiber(); + +DWORD WINAPI Implementation_FlsAlloc( + PFLS_CALLBACK_FUNCTION lpCallback +); + +BOOL WINAPI Implementation_FlsFree( + DWORD dwFlsIndex +); + +PVOID WINAPI Implementation_FlsGetValue( + DWORD dwFlsIndex +); + +BOOL WINAPI Implementation_FlsSetValue( + DWORD dwFlsIndex, + PVOID lpFlsData +); + +LPVOID WINAPI Implementation_ConvertThreadToFiberEx( + LPVOID lpParameter, + DWORD dwFlags +); + +DWORD WINAPI Implementation_GetThreadId( + HANDLE Thread +); + +DWORD WINAPI Implementation_GetCurrentProcessorNumber(); + +LPVOID WINAPI Implementation_CreateFiberEx( + SIZE_T dwStackCommitSize, + SIZE_T dwStackReserveSize, + DWORD dwFlags, + LPFIBER_START_ROUTINE lpStartAddress, + LPVOID lpParameter +); + +void WINAPI Implementation_SwitchToFiber( + LPVOID lpFiber +); + +BOOLEAN WINAPI Implementation_TryAcquireSRWLockExclusive_Vista(PSRWLOCK SRWLock); + +BOOLEAN WINAPI Implementation_TryAcquireSRWLockShared_Vista(PSRWLOCK SRWLock); + +BOOL WINAPI Implementation_SetProcessDEPPolicy(DWORD dwFlags); + +BOOL WINAPI Implementation_QueryWorkingSetEx( + HANDLE hProcess, + PVOID pv, + DWORD cb +); + +LSTATUS WINAPI Implementation_RegDeleteKeyExW( + HKEY hKey, + LPCWSTR lpSubKey, + REGSAM samDesired, + DWORD Reserved +); + +LSTATUS WINAPI Implementation_RegGetValueW( + HKEY hkey, + LPCWSTR lpSubKey, + LPCWSTR lpValue, + DWORD dwFlags, + LPDWORD pdwType, + PVOID pvData, + LPDWORD pcbData +); + +PDH_FUNCTION Implementation_PdhAddEnglishCounterW( + PDH_HQUERY hQuery, + LPCWSTR szFullCounterPath, + DWORD_PTR dwUserData, + PDH_HCOUNTER *phCounter +); + +DWORD WINAPI Implementation_GetProcessId( + HANDLE Process +); + +BOOL Implementation_GetVolumePathNamesForVolumeNameW( + LPCWSTR lpszVolumeName, + LPWCH lpszVolumePathNames, + DWORD cchBufferLength, + PDWORD lpcchReturnLength +); + +VOID WINAPI Implementation_freeaddrinfo( + void * pAddrInfo +); + +INT WINAPI Implementation_getaddrinfo( + PCSTR pNodeName, + PCSTR pServiceName, + const void *pHints, + void *ppResult +); + +BOOL WINAPI Implementation_CancelIPChangeNotify( + LPOVERLAPPED notifyOverlapped +); + +ULONG WINAPI Implementation_GetAdaptersAddresses( + ULONG Family, + ULONG Flags, + PVOID Reserved, + PVOID AdapterAddresses, + PULONG SizePointer +); + +int WINAPI Implementation_GetGeoInfoW( + GEOID Location, + GEOTYPE GeoType, + LPWSTR lpGeoData, + int cchData, + LANGID LangId +); + +GEOID WINAPI Implementation_GetUserGeoID( + GEOCLASS GeoClass +); + +BOOL WINAPI Implementation_TzSpecificLocalTimeToSystemTime( + const TIME_ZONE_INFORMATION *lpTimeZoneInformation, + const SYSTEMTIME *lpLocalTime, + LPSYSTEMTIME lpUniversalTime +); + +PVOID WINAPI Implementation_AddVectoredExceptionHandler( + ULONG First, + PVECTORED_EXCEPTION_HANDLER Handler +); + +ULONG WINAPI Implementation_RemoveVectoredExceptionHandler( + PVOID Handle +); + +BOOL WINAPI Implementation_AttachConsole( + DWORD dwProcessId +); + +BOOL WINAPI Implementation_CheckRemoteDebuggerPresent( + HANDLE hProcess, + PBOOL pbDebuggerPresent +); + +HANDLE WINAPI Implementation_CreateMemoryResourceNotification( + MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType +); + +void WINAPI Implementation_GetNativeSystemInfo( + LPSYSTEM_INFO lpSystemInfo +); + +void WINAPI Implementation_InitializeSListHead( + PSLIST_HEADER ListHead +); + +PSLIST_ENTRY WINAPI Implementation_InterlockedPushEntrySList( + PSLIST_HEADER ListHead, + __drv_aliasesMem PSLIST_ENTRY ListEntry +); + +PSLIST_ENTRY WINAPI Implementation_InterlockedFlushSList( + PSLIST_HEADER ListHead +); + +DWORD WINAPI Implementation_WTSGetActiveConsoleSessionId(); + +NTSTATUS WINAPI Implementation_RtlGetLastNtStatus(); + +BOOL WINAPI Implementation_GetModuleHandleExA( + DWORD dwFlags, + LPCSTR lpModuleName, + HMODULE *phModule +); + +BOOL WINAPI Implementation_GetModuleHandleExW( + DWORD dwFlags, + LPCWSTR lpModuleName, + HMODULE *phModule +); + +BOOL WINAPI Implementation_SetDllDirectoryW( + LPCWSTR lpPathName +); + +BOOL WINAPI Implementation_GetLogicalProcessorInformation( + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, + PDWORD ReturnedLength +); + +BOOL WINAPI Implementation_GetProcessHandleCount( + HANDLE hProcess, + PDWORD pdwHandleCount +); + +BOOL WINAPI Implementation_IsProcessInJob( + HANDLE ProcessHandle, + HANDLE JobHandle, + PBOOL Result +); + +BOOL WINAPI Implementation_IsWow64Process( + HANDLE hProcess, + PBOOL Wow64Process +); + +BOOL WINAPI Implementation_ConvertFiberToThread(); + +BOOLEAN WINAPI Implementation_SystemFunction036( + PVOID RandomBuffer, + ULONG RandomBufferLength +); + +BOOL WINAPI Implementation_GetPerformanceInfo( + PPERFORMANCE_INFORMATION pPerformanceInformation, + DWORD cb +); + +BOOL WINAPI Implementation_WTSRegisterSessionNotification( + HWND hWnd, + DWORD dwFlags +); + +BOOL WINAPI Implementation_WTSUnRegisterSessionNotification( + HWND hWnd +); + +POWER_PLATFORM_ROLE WINAPI Implementation_PowerDeterminePlatformRole(); + +PSLIST_ENTRY WINAPI Implementation_InterlockedPopEntrySList( + PSLIST_HEADER ListHead +); + +FARPROC WINAPI Implementation_GetProcAddress( + HMODULE hModule, + LPCSTR lpProcName +); + +HMODULE WINAPI Implementation_LoadLibraryW( + PCWSTR lpLibFileName +); + +HRESULT WINAPI Implementation_GetDpiForMonitor( + HMONITOR hmonitor, + MONITOR_DPI_TYPE dpiType, + UINT *dpiX, + UINT *dpiY +); + +BOOL WINAPI Implementation_GetLayeredWindowAttributes( + HWND hwnd, + COLORREF *pcrKey, + BYTE *pbAlpha, + DWORD *pdwFlags +); + +BOOL WINAPI Implementation_PrintWindow( + HWND hwnd, + HDC hdcBlt, + UINT nFlags +); + +LRESULT WINAPI Implementation_DefRawInputProc( + PRAWINPUT *paRawInput, + INT nInput, + UINT cbSizeHeader +); + +UINT WINAPI Implementation_GetRawInputData( + HRAWINPUT hRawInput, + UINT uiCommand, + LPVOID pData, + PUINT pcbSize, + UINT cbSizeHeader +); + +UINT WINAPI Implementation_GetRawInputDeviceInfoW( + HANDLE hDevice, + UINT uiCommand, + LPVOID pData, + PUINT pcbSize +); + +UINT WINAPI Implementation_GetRawInputDeviceList( + PRAWINPUTDEVICELIST pRawInputDeviceList, + PUINT puiNumDevices, + UINT cbSize +); + +BOOL WINAPI Implementation_RegisterRawInputDevices( + PCRAWINPUTDEVICE pRawInputDevices, + UINT uiNumDevices, + UINT cbSize +); + +HTHEME WINAPI Implementation_OpenThemeData( + HWND hwnd, + LPCWSTR pszClassList +); + +HRESULT WINAPI Implementation_CloseThemeData( + HTHEME hTheme +); + +HRESULT WINAPI Implementation_DrawThemeBackground( + HTHEME hTheme, + HDC hdc, + int iPartId, + int iStateId, + LPCRECT pRect, + LPCRECT pClipRect +); + +HRESULT WINAPI Implementation_GetThemeBackgroundContentRect( + HTHEME hTheme, + HDC hdc, + int iPartId, + int iStateId, + LPCRECT pBoundingRect, + LPRECT pContentRect +); + +HRESULT WINAPI Implementation_GetThemePartSize( + HTHEME hTheme, + HDC hdc, + int iPartId, + int iStateId, + LPCRECT prc, + ULONG eSize, + SIZE *psz +); + +HRESULT WINAPI Implementation_CoRegisterInitializeSpy( + IInitializeSpy *pSpy, + ULARGE_INTEGER *puliCookie +); + +HRESULT WINAPI Implementation_CoRevokeInitializeSpy( + ULARGE_INTEGER uliCookie +); + +BOOL WINAPI Implementation_HeapSetInformation( + HANDLE HeapHandle, + HEAP_INFORMATION_CLASS HeapInformationClass, + PVOID HeapInformation, + SIZE_T HeapInformationLength +); + +#define HSTRING ULONG_PTR + +HRESULT WINAPI Implementation_WindowsCreateString( + PCNZWCH sourceString, + UINT32 length, + HSTRING* string +); + +HRESULT WINAPI Implementation_WindowsDeleteString( + HSTRING string +); + +PCWSTR WINAPI Implementation_WindowsGetStringRawBuffer( + HSTRING string, + UINT32* length +); + +HRESULT WINAPI Implementation_RoGetActivationFactory( + HSTRING activatableClassId, + REFIID iid, + void** factory +); + +HRESULT WINAPI Implementation_RoActivateInstance( + HSTRING activatableClassId, + PVOID** instance +); + +BOOL WINAPI Implementation_PrefetchVirtualMemory( + HANDLE hProcess, + ULONG_PTR NumberOfEntries, + PWIN32_MEMORY_RANGE_ENTRY VirtualAddresses, + ULONG Flags +); + +BOOL WINAPI Implementation_GetFirmwareType( + PFIRMWARE_TYPE FirmwareType +); + +#define HSTRING_HEADER VOID + +HRESULT WINAPI Implementation_WindowsCreateStringReference( + PCWSTR sourceString, + UINT32 length, + HSTRING_HEADER* hstringHeader, + HSTRING* string +); + +HRESULT WINAPI Implementation_DWriteCreateFactory( + ULONG factoryType, + REFIID iid, + IUnknown** factory +); + +BOOL WINAPI Implementation_CryptProtectMemory( + LPVOID pDataIn, + DWORD cbDataIn, + DWORD dwFlags +); + +BOOL WINAPI Implementation_CryptUnprotectMemory( + LPVOID pDataIn, + DWORD cbDataIn, + DWORD dwFlags +); + +LONG WINAPI Implementation_GetPackagePathByFullName( + PCWSTR packageFullName, + UINT32* pathLength, + PWSTR path +); + +LONG WINAPI Implementation_GetPackagesByPackageFamily( + PCWSTR packageFamilyName, + UINT32* count, + PWSTR* packageFullNames, + UINT32* bufferLength, + WCHAR* buffer +); + +int WINAPI Implementation_LCMapStringEx( + LPCWSTR lpLocaleName, + DWORD dwMapFlags, + LPCWSTR lpSrcStr, + int cchSrc, + LPWSTR lpDestStr, + int cchDest, + LPNLSVERSIONINFO lpVersionInformation, + LPVOID lpReserved, + LPARAM sortHandle +); + +BOOL WINAPI Implementation_UnhookWindowsHookEx( + HHOOK hhk +); + +BOOL WINAPI Implementation_DuplicateHandle( + HANDLE hSourceProcessHandle, + HANDLE hSourceHandle, + HANDLE hTargetProcessHandle, + LPHANDLE lpTargetHandle, + DWORD dwDesiredAccess, + BOOL bInheritHandle, + DWORD dwOptions +); + +BOOL WINAPI Implementation_RegisterPointerDeviceNotifications( + HWND window, + BOOL notifyRange +); + +BOOL WINAPI Implementation_GetPointerDevices( + UINT32* deviceCount, + POINTER_DEVICE_INFO* pointerDevices +); + +BOOL WINAPI Implementation_GetPointerDevice( + HANDLE device, + POINTER_DEVICE_INFO* pointerDevice +); + +DWORD WINAPI Implementation_DiscardVirtualMemory( + PVOID VirtualAddress, + SIZE_T Size +); \ No newline at end of file diff --git a/initonce.c b/initonce.c new file mode 100644 index 0000000..bc73f80 --- /dev/null +++ b/initonce.c @@ -0,0 +1,148 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +/* + The InitOnce structure can be simplified. + + We have 2 bits to play around with (the rest will hold the value of lpContext). + + Bit 0 - indicates initialization is complete + Bit 1 - indicates that initialization is asynchronous + + There is also a mutex and a critical section in use. It would be better if they were local to the + InitOnce object, but this seems to work very well. As long as the VLC InitOnce-related crashes + in Supermium cease, it is good. +*/ + +#define INIT_COMPLETE 0x1 +#define INIT_ASYNC 0x2 + +BOOL WINAPI Implementation_InitOnceBeginInitialize( + LPINIT_ONCE lpInitOnce, + DWORD dwFlags, + PBOOL fPending, + LPVOID *lpContext +) +/* + This function does not have an associated callback function, + but it can be used with the INIT_ONCE object to initialize based on the object itself. +*/ +{ + if(dwFlags & ~(INIT_ONCE_CHECK_ONLY | INIT_ONCE_ASYNC) || + !lpInitOnce || !fPending) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if(((ULONG_PTR)lpInitOnce->Ptr & INIT_ASYNC) && !(dwFlags & INIT_ONCE_ASYNC)) + return FALSE; + + if(dwFlags & INIT_ONCE_ASYNC) + InterlockedOr(&lpInitOnce->Ptr, INIT_ASYNC); + + if((ULONG_PTR)lpInitOnce->Ptr & INIT_COMPLETE) + { + *fPending = FALSE; + } + else + { + if(!(dwFlags & INIT_ONCE_CHECK_ONLY)) + InterlockedOr(&lpInitOnce->Ptr, INIT_COMPLETE); + *fPending = TRUE; + return TRUE; + } + + if(lpContext && ((ULONG_PTR)lpInitOnce->Ptr & INIT_COMPLETE)) + { + *lpContext = (ULONG_PTR)lpInitOnce->Ptr - ((ULONG_PTR)lpInitOnce->Ptr % 4); + } + + return TRUE; +} + +BOOL WINAPI Implementation_InitOnceExecuteOnce( + PINIT_ONCE InitOnce, + PINIT_ONCE_FN InitFn, + PVOID Parameter, + LPVOID *Context +) +{ + BOOL Result = FALSE; + + if(InitFn && !InitOnce) + return InitFn(InitOnce, Parameter, Context); + + if(!InitOnce || !InitFn) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if((ULONG_PTR)InitOnce->Ptr & INIT_COMPLETE) + { + if(Context) + *Context = (ULONG_PTR)InitOnce->Ptr - ((ULONG_PTR)InitOnce->Ptr % 4); + + return TRUE; + } + else + { + EnterCriticalSection(&SrwSharedCs); + if(((ULONG_PTR)InitOnce->Ptr & INIT_COMPLETE) || Result) + goto Result; + Result = InitFn(InitOnce, Parameter, Context); + +Result: + if(Result) + { + (ULONG_PTR)InitOnce->Ptr = (ULONG_PTR)Context | ((ULONG_PTR)InitOnce->Ptr & 0x3); + InterlockedOr(&InitOnce->Ptr, INIT_COMPLETE); + LeaveCriticalSection(&SrwSharedCs); + return Result; + } + else + { + LeaveCriticalSection(&SrwSharedCs); + if ((ULONG_PTR)InitOnce->Ptr & INIT_COMPLETE) + return TRUE; + return Result; + } + } +} + +BOOL WINAPI Implementation_InitOnceComplete( + LPINIT_ONCE lpInitOnce, + DWORD dwFlags, + LPVOID lpContext +) +{ + if(!lpInitOnce || dwFlags & ~(INIT_ONCE_INIT_FAILED | INIT_ONCE_ASYNC)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if(dwFlags & INIT_ONCE_INIT_FAILED) + { + (ULONG_PTR)lpInitOnce->Ptr = 0; + return TRUE; + } + + InterlockedOr(&lpInitOnce->Ptr, INIT_COMPLETE); + + if(lpContext) + { + InterlockedOr(&lpInitOnce->Ptr, lpContext); + } + + return TRUE; +} + +void WINAPI Implementation_InitOnceInitialize( + PINIT_ONCE InitOnce +) +{ + InitOnce->Ptr = 0; +} \ No newline at end of file diff --git a/ip.c b/ip.c new file mode 100644 index 0000000..c06a39f --- /dev/null +++ b/ip.c @@ -0,0 +1,309 @@ +//#include "progwrp.h" +#include "export.h" +//#include "implementations.h" +//#define NTDDI_VERSION NTDDI_WIN2K +#include +#include +#include + +void* calloc( + size_t number, + size_t size +) +{ + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, number * size); +} + +void free( + void* memblock +) +{ + HeapFree(GetProcessHeap(), 0, memblock); +} + +errno_t strcpy_s(char * _Destination, rsize_t SizeInBytes, const char* _Source) +{ + ULONG i; + if(!_Destination || !_Source) + return EINVAL; + + if(!SizeInBytes) + return ERANGE; + + for(i = 0; i < SizeInBytes; i++) + { + _Destination[i] = _Source[i]; + + if(_Source[i] == '\0') + return 0; + } + + return ERANGE; + +} + +errno_t strncpy_s(char * _Destination, rsize_t SizeInBytes, const char* _Source, rsize_t count) +{ + return StringCchCopyNA(_Destination, SizeInBytes, _Source, count); +} + +unsigned int strtoul(const char* str, char** endPtr, int radix) +{ + return 1; +} + +PCSTR WINAPI Implementation_inet_ntop( + INT Family, + const VOID *pAddr, + PSTR pStringBuf, + size_t StringBufSize + ) +{ + return NULL;// inet_ntop(Family, pAddr, pStringBuf, StringBufSize); +} + +NTSTATUS WINAPI Implementation_GetIfTable2( + PVOID Table +) +{ + return 0xC00000BB; +} + +VOID WINAPI Implementation_FreeMibTable( + PVOID Memory +) +{ + ; +} + +VOID WINAPI Implementation_freeaddrinfo( + void * pAddrInfo +) +{ +#ifdef _M_IX86 + WspiapiLegacyFreeAddrInfo(pAddrInfo); +#endif +} + +INT WINAPI Implementation_getaddrinfo( + PCSTR pNodeName, + PCSTR pServiceName, + const struct addrinfo *pHints, + struct addrinfo **ppResult +) +{ +#ifdef _M_IX86 + int iError = 0; + int iFlags = 0; + int iFamily = PF_UNSPEC; + int iSocketType = 0; + int iProtocol = 0; + WORD wPort = 0; + DWORD dwAddress = 0; + + struct servent *ptService = NULL; + char *pc = NULL; + BOOL bClone = FALSE; + WORD wTcpPort = 0; + WORD wUdpPort = 0; + + + // initialize ppResult with default return value. + *ppResult = NULL; + + + //////////////////////////////////////// + // validate arguments... + // + + // both the node name and the service name can't be NULL. + if ((!pNodeName) && (!pServiceName)) + return EAI_NONAME; + + // validate hints. + if (pHints) + { + // all members other than ai_flags, ai_family, ai_socktype + // and ai_protocol must be zero or a null pointer. + if ((pHints->ai_addrlen != 0) || + (pHints->ai_canonname != NULL) || + (pHints->ai_addr != NULL) || + (pHints->ai_next != NULL)) + { + return EAI_FAIL; + } + + // the spec has the "bad flags" error code, so presumably we + // should check something here. insisting that there aren't + // any unspecified flags set would break forward compatibility, + // however. so we just check for non-sensical combinations. + // + // we cannot come up with a canonical name given a null node name. + iFlags = pHints->ai_flags; + if ((iFlags & AI_CANONNAME) && !pNodeName) + return EAI_BADFLAGS; + + // we only support a limited number of protocol families. + iFamily = pHints->ai_family; + if ((iFamily != PF_UNSPEC) && (iFamily != PF_INET)) + return EAI_FAMILY; + + // we only support only these socket types. + iSocketType = pHints->ai_socktype; + if ((iSocketType != 0) && + (iSocketType != SOCK_STREAM) && + (iSocketType != SOCK_DGRAM) && + (iSocketType != SOCK_RAW)) + return EAI_SOCKTYPE; + + // REVIEW: What if ai_socktype and ai_protocol are at odds? + iProtocol = pHints->ai_protocol; + } + + + //////////////////////////////////////// + // do service lookup... + + if (pServiceName) + { + wPort = (WORD) strtoul(pServiceName, &pc, 10); + if (*pc == '\0') // numeric port string + { + wPort = wTcpPort = wUdpPort = htons(wPort); + if (iSocketType == 0) + { + bClone = TRUE; + iSocketType = SOCK_STREAM; + } + } + else // non numeric port string + { + if ((iSocketType == 0) || (iSocketType == SOCK_DGRAM)) + { + ptService = getservbyname(pServiceName, "udp"); + if (ptService) + wPort = wUdpPort = ptService->s_port; + } + + if ((iSocketType == 0) || (iSocketType == SOCK_STREAM)) + { + ptService = getservbyname(pServiceName, "tcp"); + if (ptService) + wPort = wTcpPort = ptService->s_port; + } + + // assumes 0 is an invalid service port... + if (wPort == 0) // no service exists + return (iSocketType ? EAI_SERVICE : EAI_NONAME); + + if (iSocketType == 0) + { + // if both tcp and udp, process tcp now & clone udp later. + iSocketType = (wTcpPort) ? SOCK_STREAM : SOCK_DGRAM; + bClone = (wTcpPort && wUdpPort); + } + } + } + + + + //////////////////////////////////////// + // do node name lookup... + + // if we weren't given a node name, + // return the wildcard or loopback address (depending on AI_PASSIVE). + // + // if we have a numeric host address string, + // return the binary address. + ///* + if ((!pNodeName) || (WspiapiParseV4Address(pNodeName, &dwAddress))) + { + if (!pNodeName) + { + dwAddress = htonl((iFlags & AI_PASSIVE) + ? INADDR_ANY + : INADDR_LOOPBACK); + } + // create an addrinfo structure... + *ppResult = + WspiapiNewAddrInfo(iSocketType, iProtocol, wPort, dwAddress); + if (!(*ppResult)) + iError = EAI_MEMORY; + + if (!iError && pNodeName) + { + // implementation specific behavior: set AI_NUMERICHOST + // to indicate that we got a numeric host address string. + (*ppResult)->ai_flags |= AI_NUMERICHOST; + + // return the numeric address string as the canonical name + if (iFlags & AI_CANONNAME) + { + (*ppResult)->ai_canonname = +#pragma warning(suppress: 4996) + WspiapiStrdup(inet_ntoa(*((struct in_addr *) &dwAddress))); + if (!(*ppResult)->ai_canonname) + iError = EAI_MEMORY; + } + } + } + + + // if we do not have a numeric host address string and + // AI_NUMERICHOST flag is set, return an error! + else if (iFlags & AI_NUMERICHOST) + { + iError = EAI_NONAME; + } + + + // since we have a non-numeric node name, + // we have to do a regular node name lookup. + else + { + iError = WspiapiLookupNode(pNodeName, + iSocketType, + iProtocol, + wPort, + (iFlags & AI_CANONNAME), + ppResult); + } + + if (!iError && bClone) + { + iError = WspiapiClone(wUdpPort, *ppResult); + } + + if (iError) + { + WspiapiLegacyFreeAddrInfo(*ppResult); + *ppResult = NULL; + } + + return (iError); +#endif +} + +BOOL WINAPI Implementation_CancelIPChangeNotify( + LPOVERLAPPED notifyOverlapped +) +{ + return FALSE; +} + +ULONG WINAPI Implementation_GetAdaptersAddresses( + ULONG Family, + ULONG Flags, + PVOID Reserved, + PVOID AdapterAddresses, + PULONG SizePointer +) +{ + if(Family == AF_UNSPEC || Family == AF_INET) + // First seek out IPv4 adapters. + { + + } + + return ERROR_NO_DATA; +} \ No newline at end of file diff --git a/locale.c b/locale.c new file mode 100644 index 0000000..1ccfd0a --- /dev/null +++ b/locale.c @@ -0,0 +1,472 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include "strsafe.h" +#include "locale.h" + +BOOL WINAPI LimitedStrCmp(int StartIdx, int EndIdx, PCWSTR Str0, PCWSTR Str1) +{ + int i; + + for(i = 0; i < EndIdx - StartIdx; i++) + { + if(Str0[i + StartIdx] != Str1[i]) + return FALSE; + + if(Str1[i] == '\0' && i < ((EndIdx - StartIdx) - 1)) + return FALSE; + } + + return TRUE; +} + +int WINAPI Implementation_LCIDToLocaleName( + LCID Locale, + LPWSTR lpName, + int cchName, + DWORD dwFlags) +/* + The process of the non-neutral locales will be a little more complex. + There are some that aren't even associated to a neutral locale. +*/ +{ + int RequiredSize = 0; + size_t Length; + + if(!lpName && !cchName) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + if(dwFlags & ~(LOCALE_ALLOW_NEUTRAL_NAMES)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + if(Locale == LOCALE_INVARIANT || (Locale % 0x400) > LOCALE_NEUTRAL_LIMIT) + { + Locale = 0x409; + } + + if(Locale == LOCALE_SYSTEM_DEFAULT) + { + Locale = GetSystemDefaultLCID(); + } + + if(Locale == LOCALE_USER_DEFAULT) + { + Locale = GetUserDefaultLCID(); + } + + if ((Locale < LOCALE_NEUTRAL_LIMIT) && (dwFlags & LOCALE_ALLOW_NEUTRAL_NAMES)) + { + while(NeutralLangIdTbl[Locale][RequiredSize] != L'\0') + { + ++RequiredSize; + } + + ++RequiredSize; + + if(cchName && (cchName < RequiredSize)) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + if(cchName && lpName) + StringCchCopyW(lpName, cchName, NeutralLangIdTbl[Locale]); + + return RequiredSize; + } + else + { + while(NeutralLangIdTbl[Locale % 0x400][RequiredSize] != L'\0') + { + ++RequiredSize; + } + + ++RequiredSize; + ++RequiredSize; + + if(StringCchLengthW(LocaleIdentifierTbl[Locale % 0x400][(Locale / 0x400) - 1], STRSAFE_MAX_CCH, &Length) == STRSAFE_E_INVALID_PARAMETER) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + RequiredSize += Length; + + if(cchName && (cchName < RequiredSize)) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + if(cchName && lpName) + { + StringCchCopyW(lpName, cchName, NeutralLangIdTbl[Locale % 0x400]); + StringCchCatW(lpName, cchName, L"-"); + StringCchCatW(lpName, cchName, LocaleIdentifierTbl[Locale % 0x400][(Locale / 0x400) - 1]); + } + + return RequiredSize; + } + // First handle the special locale cases that aren't linked to a neutral locale, + // then handle locales linked to a neutral locale. + // Each LCID pertaining to a particular locale has an offset of 0x400 from the neutral locale. + // e.g. en is 0x9, en-US is 0x409, en-GB is 0x809... ending with 0x3009 for en-ZW (Zimbabwe). + // So all we need to do is build a table for each locale, and derive an index from (LCID / 0x400 - 1) to get the full locale name. +} + +LCID WINAPI Implementation_LocaleNameToLCID( + LPCWSTR lpName, + DWORD dwFlags +) +/* + First checks the neutral portion of the locale, which is either two or three characters long. + If it matches an entry in the table, (and it is not a neutral locale outright), then compare + locations. +*/ +{ + int NeutralLocaleLen = 0, NeutralLocaleIdx, FullLocaleIdx = 0, LocaleLen; + if(dwFlags & ~(LOCALE_ALLOW_NEUTRAL_NAMES) || !lpName) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } +/* + if(lpName == LOCALE_NAME_SYSTEM_DEFAULT) + { + return GetSystemDefaultLCID(); + } +*/ + if(lpName[0] == L' ' && lpName[1] == L'\0') + { + return 0x409; + } + + if(lpName == LOCALE_NAME_USER_DEFAULT) + { + return GetUserDefaultLCID(); + } + + while(lpName[NeutralLocaleLen] != L'-') + { + ++NeutralLocaleLen; + + if(lpName[NeutralLocaleLen] == L'\0') + { + if(dwFlags & LOCALE_ALLOW_NEUTRAL_NAMES) + break; + else + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + } + } + + for(NeutralLocaleIdx = 0; NeutralLocaleIdx < LOCALE_NEUTRAL_LIMIT; NeutralLocaleIdx++) + { + if(LimitedStrCmp(0, NeutralLocaleLen, lpName, NeutralLangIdTbl[NeutralLocaleIdx])) + break; + } + + if(NeutralLocaleIdx == LOCALE_NEUTRAL_LIMIT) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + else if(dwFlags & LOCALE_ALLOW_NEUTRAL_NAMES) + return NeutralLocaleIdx - 1; + + LocaleLen = NeutralLocaleLen + 1; + + while(lpName[LocaleLen] != L'\0') + { + ++LocaleLen; + } + + while(LocaleIdentifierTbl[NeutralLocaleIdx - 1][FullLocaleIdx][0] != L'\0') + { + if(LimitedStrCmp(NeutralLocaleLen + 1, LocaleLen, lpName, LocaleIdentifierTbl[NeutralLocaleIdx - 1][FullLocaleIdx])) + { + return ((FullLocaleIdx + 1) * 0x400) + (NeutralLocaleIdx - 1); + } + + ++FullLocaleIdx; + } + + SetLastError(ERROR_INVALID_PARAMETER); + return 0; +} + +int WINAPI Implementation_ResolveLocaleName( + LPCWSTR lpNameToResolve, + LPWSTR lpLocaleName, + int cchLocaleName +) +/* + This will be part and parcel of my new locale API. + + The real implementation of this function was criticized for poor + results at first, so I'll outline what one can expect. + + If lpNameToResolve's language label does not match any known neutral locale, + return the user locale. + + If lpNameToResolve's language label matches a neutral locale, but there is + no other matching information, return the user locale if it has the same neutral + locale or return the "base locale" for the neutral locale (i.e. en-US for "en-RU" + or "en-BLAHBLAHBLAH"). + + If there is a valid region identifier at the end of lpNameToResolve (between the last + '-' and null character), in addition to a neutral locale that also has a valid entry + for the region, return the "lan-reg" form. +*/ +{ + if(lpLocaleName && lpNameToResolve) + { + StringCchCopyW(lpLocaleName, cchLocaleName, lpNameToResolve); + return cchLocaleName; + } + return 0; +} + +BOOL WINAPI Implementation_EnumSystemLocalesEx( + LOCALE_ENUMPROCEX lpLocaleEnumProcEx, + DWORD dwFlags, + LPARAM lParam, + LPVOID lpReserved +) +{ + return FALSE; +} + +int WINAPI Implementation_GetCurrencyFormatEx( + LPCWSTR lpLocaleName, + DWORD dwFlags, + LPCWSTR lpValue, + const CURRENCYFMTW *lpFormat, + LPWSTR lpCurrencyStr, + int cchCurrency +) +{ + return GetCurrencyFormatW(Implementation_LocaleNameToLCID(lpLocaleName, 0), dwFlags, lpValue, lpFormat, lpCurrencyStr, cchCurrency); +} + +int WINAPI Implementation_GetDateFormatEx( + LPCWSTR lpLocaleName, + DWORD dwFlags, + const SYSTEMTIME *lpDate, + LPCWSTR lpFormat, + LPWSTR lpDateStr, + int cchDate, + LPCWSTR lpCalendar +) +{ + return GetDateFormatW(Implementation_LocaleNameToLCID(lpLocaleName, 0), dwFlags, lpDate, lpFormat, lpDateStr, cchDate); +} + +DWORD WINAPI Implementation_GetDynamicTimeZoneInformation( + PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation +) +{ + DWORD Result; + TIME_ZONE_INFORMATION tzif; + + if(!pTimeZoneInformation) + { + SetLastError(ERROR_INVALID_PARAMETER); + return TIME_ZONE_ID_INVALID; + } + + + Result = GetTimeZoneInformation(pTimeZoneInformation); + + pTimeZoneInformation->TimeZoneKeyName[0] = '\0'; + pTimeZoneInformation->DynamicDaylightTimeDisabled = FALSE; + + + return Result; +} + +int WINAPI Implementation_GetTimeFormatEx( + LPCWSTR lpLocaleName, + DWORD dwFlags, + const SYSTEMTIME *lpTime, + LPCWSTR lpFormat, + LPWSTR lpTimeStr, + int cchTime +) +{ + return GetTimeFormatW(Implementation_LocaleNameToLCID(lpLocaleName, 0), dwFlags, lpTime, lpFormat, lpTimeStr, cchTime); +} + +int WINAPI Implementation_GetLocaleInfoEx( + LPCWSTR lpLocaleName, + LCTYPE LCType, + LPWSTR lpLCData, + int cchData +) +{ + return GetLocaleInfoW(Implementation_LocaleNameToLCID(lpLocaleName, 0), LCType, lpLCData, cchData); +} + +int WINAPI Implementation_GetNumberFormatEx( + LPCWSTR lpLocaleName, + DWORD dwFlags, + LPCWSTR lpValue, + const NUMBERFMTW *lpFormat, + LPWSTR lpNumberStr, + int cchNumber +) +{ + return GetNumberFormatW(Implementation_LocaleNameToLCID(lpLocaleName, 0), dwFlags, lpValue, lpFormat, lpNumberStr, cchNumber); +} + +int WINAPI Implementation_GetUserDefaultLocaleName( + LPWSTR lpLocaleName, + int cchLocaleName +) +{ + return Implementation_LCIDToLocaleName(GetUserDefaultLCID(), lpLocaleName, cchLocaleName, 0); +} + +#define THREAD_LOCALE 1 +#define USER_LOCALE 2 +#define SYSTEM_LOCALE 4 + +BOOL WINAPI Implementation_GetThreadPreferredUILanguages( + DWORD dwFlags, + PULONG pulNumLanguages, + PZZWSTR pwszLanguagesBuffer, + PULONG pcchLanguagesBuffer +) +/* + Objective: get the "thread locale" first. Offer the user locale second, and the system locale third. +*/ +{ + LCID ThreadLocale; + LCID UserLocale; + LCID SystemLocale; + int i; + WCHAR szLocaleName [45]; + int szLocaleName_lens [3] = {0, 0, 0}; + + if(!pulNumLanguages || !pcchLanguagesBuffer) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + *pulNumLanguages = 3; + + ThreadLocale = GetThreadLocale(); + + UserLocale = GetUserDefaultLCID(); + + SystemLocale = GetSystemDefaultLCID(); + + if(dwFlags & MUI_LANGUAGE_ID) + { + *pcchLanguagesBuffer = 10; + + if(pwszLanguagesBuffer) + { + pwszLanguagesBuffer[0] = HIWORD(ThreadLocale); + pwszLanguagesBuffer[1] = LOWORD(ThreadLocale); + pwszLanguagesBuffer[2] = L'\0'; + pwszLanguagesBuffer[3] = HIWORD(UserLocale); + pwszLanguagesBuffer[4] = LOWORD(UserLocale); + pwszLanguagesBuffer[5] = L'\0'; + pwszLanguagesBuffer[6] = HIWORD(SystemLocale); + pwszLanguagesBuffer[7] = LOWORD(SystemLocale); + pwszLanguagesBuffer[8] = L'\0'; + pwszLanguagesBuffer[9] = L'\0'; + } + } + else + { + + szLocaleName_lens[0] = Implementation_LCIDToLocaleName(ThreadLocale, szLocaleName, 45, 0); + + if(pwszLanguagesBuffer) + { + StringCchCopyW(pwszLanguagesBuffer, *pcchLanguagesBuffer, szLocaleName); + StringCchCatW(pwszLanguagesBuffer, *pcchLanguagesBuffer, L";"); + } + + szLocaleName_lens[1] = Implementation_LCIDToLocaleName(UserLocale, szLocaleName, 45, 0); + + if(pwszLanguagesBuffer) + { + StringCchCatW(pwszLanguagesBuffer, *pcchLanguagesBuffer, szLocaleName); + StringCchCatW(pwszLanguagesBuffer, *pcchLanguagesBuffer, L";"); + } + + szLocaleName_lens[2] = Implementation_LCIDToLocaleName(SystemLocale, szLocaleName, 45, 0); + + if(pwszLanguagesBuffer) + { + StringCchCatW(pwszLanguagesBuffer, *pcchLanguagesBuffer, szLocaleName); + StringCchCatW(pwszLanguagesBuffer, *pcchLanguagesBuffer, L";"); + StringCchCatW(pwszLanguagesBuffer, *pcchLanguagesBuffer, L"\0"); + for(i = 0; i < *pcchLanguagesBuffer; i++) + { + if(pwszLanguagesBuffer[i] == L';') + pwszLanguagesBuffer[i] = 0;//L'\0'; + } + } + + *pcchLanguagesBuffer = (szLocaleName_lens[0] + szLocaleName_lens[1] + szLocaleName_lens[2] + 1); + } + + + return TRUE; +} + + +int WINAPI Implementation_GetGeoInfoW( + GEOID Location, + GEOTYPE GeoType, + LPWSTR lpGeoData, + int cchData, + LANGID LangId +) +{ + return 0; +} + +GEOID WINAPI Implementation_GetUserGeoID( + GEOCLASS GeoClass +) +{ + return 0x27; +} + +BOOL WINAPI Implementation_TzSpecificLocalTimeToSystemTime( + const TIME_ZONE_INFORMATION *lpTimeZoneInformation, + const SYSTEMTIME *lpLocalTime, + LPSYSTEMTIME lpUniversalTime +) +{ + return FALSE; +} + +int WINAPI Implementation_LCMapStringEx( + LPCWSTR lpLocaleName, + DWORD dwMapFlags, + LPCWSTR lpSrcStr, + int cchSrc, + LPWSTR lpDestStr, + int cchDest, + LPNLSVERSIONINFO lpVersionInformation, + LPVOID lpReserved, + LPARAM sortHandle +) +{ + return LCMapStringW(Implementation_LocaleNameToLCID(lpLocaleName, 0), dwMapFlags, lpSrcStr, cchSrc, lpDestStr, cchDest); +} \ No newline at end of file diff --git a/locale.h b/locale.h new file mode 100644 index 0000000..d6f9567 --- /dev/null +++ b/locale.h @@ -0,0 +1,45 @@ +#pragma once +#include "progwrp.h" + +/* + Basic implementation of Windows name-based locale API. + The "base locales" are the neutral locales, such as "en". + + A separate list will contain location identifiers attached to the neutral locales. +*/ +// Note: zh is really zh-Hans + +#define LOCALE_NEUTRAL_LIMIT 0x94 +WCHAR NeutralLangIdTbl [][4] = {{L" "}, {L"ar"}, {L"bg"}, {L"ca"}, {L"zh"}, {L"cs"}, {L"da"}, {L"de"}, {L"el"}, {L"en"}, {L"es"}, + {L"fi"}, {L"fr"}, {L"he"}, {L"hu"}, {L"is"}, {L"it"}, {L"ja"}, {L"ko"}, {L"nl"}, {L"no"}, {L"pl"}, + {L"pt"}, {L"rm"}, {L"ro"}, {L"ru"}, {L"hr"}, {L"sk"}, {L"sq"}, {L"sv"}, {L"th"}, {L"tr"}, {L"ur"}, + {L"id"}, {L"uk"}, {L"be"}, {L"sl"}, {L"et"}, {L"lv"}, {L"lt"}, {L"tg"}, {L"fa"}, {L"vi"}, {L"hy"}, + {L"az"}, {L"eu"}, {L"hsb"}, {L"mk"}, {L"st"}, {L"ts"}, {L"tn"}, {L"ve"}, {L"xh"}, {L"zu"}, {L"af"}, + {L"ka"}, {L"fo"}, {L"hi"}, {L"mt"}, {L"se"}, {L"ga"}, {L"yi"}, {L"ms"}, {L"kk"}, {L"ky"}, {L"sw"}, + {L"tk"}, {L"uz"}, {L"tt"}, {L"bn"}, {L"pa"}, {L"gu"}, {L"or"}, {L"ta"}, {L"te"}, {L"kn"}, {L"ml"}, + {L"as"}, {L"mr"}, {L"sa"}, {L"mn"}, {L"bo"}, {L"cy"}, {L"km"}, {L"lo"}, {L"my"}, {L"gl"}, {L"kok"}, + {L"mni"}, {L"sd"}, {L"syr"}, {L"si"}, {L"chr"}, {L"iu"}, {L"am"}, {L"tzm"}, {L"ks"}, {L"ne"}, {L"fy"}, + {L"ps"}, {L"fil"}, {L"dv"}, {L"bin"}, {L"ff"}, {L"ha"}, {L"ibb"}, {L"yo"}, {L"quz"}, {L"nso"}, {L"ba"}, + {L"lb"}, {L"kl"}, {L"ig"}, {L"kr"}, {L"om"}, {L"ti"}, {L"gn"}, {L"haw"}, {L"la"}, {L"so"}, {L"ii"}, + {L"pap"}, {L"arn"}, {L" "}, {L"moh"}, {L" "}, {L"br"}, {L" "}, {L"ug"}, {L"mi"}, {L"oc"}, {L"co"}, + {L"gsw"}, {L"sah"}, {L"qut"}, {L"rw"}, {L"wo"}, {L" "}, {L" "}, {L" "}, {L"prs"}, {L" "}, {L" "}, + {L" "}, {L" "}, {L"gd"}, {L"ku"}, {L"quc"}}; + + +WCHAR LocaleIdentifierTbl [][21][15] = {{L"\0"}, {L"SA", L"IQ", L"EG", L"LY", L"DZ", L"MA", L"TN", L"OM", L"YE", L"SY", L"JO", L"LB", L"KW", + L"AE", L"BH", L"QA", L'\0'}, {L"BG"}, {L"ES", L"ca-ES-valencia", L'\0'}, {L"TW", L"CN", L"SG", L"MO", L'\0'}, {L"CZ", L'\0'}, + {L"DK", L'\0'}, {L"DE", L"CH", L"AT", L"LU", L"LI", L'\0'}, {L"GR"}, {L"US", L"GB", L"AU", L"CA", L"NZ", L"IE", + L"ZA", L"JM", L"029", L"BZ", L"TT", L"ZW", L"PH", L"ID", L"HK", L"IN", L"MY", L"SG", L'\0'}, {L"ES", L"MX", L'\0'}, + {L"FI"}, {L"FR"}, {L"he"}, {L"hu"}, {L"is"}, {L"it"}, {L"JA"}, {L"KO"}, {L"nl"}, {L"no"}, {L"PL"}, + {L"pt"}, {L"rm"}, {L"RO"}, {L"RU"}, {L"hr"}, {L"sk"}, {L"sq"}, {L"sv"}, {L"th"}, {L"tr"}, {L"ur"}, + {L"id"}, {L"uk"}, {L"be"}, {L"sl"}, {L"et"}, {L"lv"}, {L"lt"}, {L"tg"}, {L"fa"}, {L"vi"}, {L"hy"}, + {L"az"}, {L"eu"}, {L"hsb"}, {L"mk"}, {L"st"}, {L"ts"}, {L"tn"}, {L"ve"}, {L"xh"}, {L"zu"}, {L"af"}, + {L"ka"}, {L"fo"}, {L"hi"}, {L"mt"}, {L"se"}, {L"ga"}, {L"yi"}, {L"ms"}, {L"kk"}, {L"ky"}, {L"sw"}, + {L"tk"}, {L"uz"}, {L"tt"}, {L"bn"}, {L"pa"}, {L"gu"}, {L"or"}, {L"ta"}, {L"te"}, {L"kn"}, {L"ml"}, + {L"as"}, {L"mr"}, {L"sa"}, {L"mn"}, {L"bo"}, {L"cy"}, {L"km"}, {L"lo"}, {L"my"}, {L"gl"}, {L"kok"}, + {L"mni"}, {L"sd"}, {L"syr"}, {L"si"}, {L"chr"}, {L"iu"}, {L"am"}, {L"tzm"}, {L"ks"}, {L"ne"}, {L"fy"}, + {L"ps"}, {L"fil"}, {L"dv"}, {L"bin"}, {L"ff"}, {L"ha"}, {L"ibb"}, {L"yo"}, {L"quz"}, {L"nso"}, {L"ba"}, + {L"lb"}, {L"kl"}, {L"ig"}, {L"kr"}, {L"om"}, {L"ti"}, {L"gn"}, {L"haw"}, {L"la"}, {L"so"}, {L"ii"}, + {L"pap"}, {L"arn"}, {L" "}, {L"moh"}, {L" "}, {L"br"}, {L" "}, {L"ug"}, {L"mi"}, {L"oc"}, {L"co"}, + {L"gsw"}, {L"sah"}, {L"qut"}, {L"rw"}, {L"wo"}, {L" "}, {L" "}, {L" "}, {L"prs"}, {L" "}, {L" "}, + {L" "}, {L" "}, {L"gd"}, {L"ku"}, {L"quc"}}; \ No newline at end of file diff --git a/misc.c b/misc.c new file mode 100644 index 0000000..2be6693 --- /dev/null +++ b/misc.c @@ -0,0 +1,293 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +HRESULT WINAPI Implementation_ScriptItemize( + const WCHAR *pwcInChars, + int cInChars, + int cMaxItems, + const SCRIPT_CONTROL *psControl, + const SCRIPT_STATE *psState, + SCRIPT_ITEM *pItems, + int *pcItems +) +{ + return E_NOTIMPL; // This should never be called; ScriptItemize should always be available +} + +PDH_FUNCTION Implementation_PdhAddEnglishCounterW( + PDH_HQUERY hQuery, + LPCWSTR szFullCounterPath, + DWORD_PTR dwUserData, + PDH_HCOUNTER *phCounter +) +{ + PdhAddCounterW(hQuery, szFullCounterPath, dwUserData, phCounter); +} + +PVOID WINAPI Implementation_AddVectoredExceptionHandler( + ULONG First, + PVECTORED_EXCEPTION_HANDLER Handler +) +{ + return NULL; +} + +ULONG WINAPI Implementation_RemoveVectoredExceptionHandler( + PVOID Handle +) +{ + return 0; +} + +BOOL WINAPI Implementation_AttachConsole( + DWORD dwProcessId +) +{ + return FALSE; +} + +BOOL WINAPI Implementation_CheckRemoteDebuggerPresent( + HANDLE hProcess, + PBOOL pbDebuggerPresent +) +{ + if(pbDebuggerPresent) + { + *pbDebuggerPresent = FALSE; + return TRUE; + } + return FALSE; +} + +HANDLE WINAPI Implementation_CreateMemoryResourceNotification( + MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType +) +{ + return NULL; +} + +void WINAPI Implementation_GetNativeSystemInfo( + LPSYSTEM_INFO lpSystemInfo +) +{ + GetSystemInfo(lpSystemInfo); +} + +void WINAPI Implementation_InitializeSListHead( + PSLIST_HEADER ListHead +) +{ + ListHead->Alignment = 0; +} + +PSLIST_ENTRY WINAPI Implementation_InterlockedPushEntrySList( + PSLIST_HEADER ListHead, + __drv_aliasesMem PSLIST_ENTRY ListEntry +) +{ + /* + PSLIST_ENTRY PreviousFirst; +// PreviousFirst = ListHead->Next.Next; + + if(!PreviousFirst) + { + // InterlockedCompareExchange(ListHead->Next.Next, ListEntry, 0); + } + else + { + ListEntry->Next = PreviousFirst; +// InterlockedCompareExchange(ListHead->Next.Next, ListEntry, 0); + } + + return PreviousFirst; + */ +} + +PSLIST_ENTRY WINAPI Implementation_InterlockedFlushSList( + PSLIST_HEADER ListHead +) +{ + /* + PSLIST_ENTRY List; + + List = ListHead->Next.Next; + +// InterlockedCompareExchange(ListHead->Next.Next, 0, List); + + return List; + */ +} + +PSLIST_ENTRY WINAPI Implementation_InterlockedPopEntrySList( + PSLIST_HEADER ListHead +) +{ + return NULL; +} + +DWORD WINAPI Implementation_WTSGetActiveConsoleSessionId() +{ + return -1; +} + +NTSTATUS WINAPI Implementation_RtlGetLastNtStatus() +{ + return 0; +} + +BOOL WINAPI Implementation_WTSRegisterSessionNotification( + HWND hWnd, + DWORD dwFlags +) +{ + return TRUE; +} + +BOOL WINAPI Implementation_WTSUnRegisterSessionNotification( + HWND hWnd +) +{ + return TRUE; +} + +HTHEME WINAPI Implementation_OpenThemeData( + HWND hwnd, + LPCWSTR pszClassList +) +{ + return NULL; +} + +HRESULT WINAPI Implementation_CloseThemeData( + HTHEME hTheme +) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI Implementation_DrawThemeBackground( + HTHEME hTheme, + HDC hdc, + int iPartId, + int iStateId, + LPCRECT pRect, + LPCRECT pClipRect +) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI Implementation_GetThemeBackgroundContentRect( + HTHEME hTheme, + HDC hdc, + int iPartId, + int iStateId, + LPCRECT pBoundingRect, + LPRECT pContentRect +) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI Implementation_GetThemePartSize( + HTHEME hTheme, + HDC hdc, + int iPartId, + int iStateId, + LPCRECT prc, + ULONG eSize, + SIZE *psz +) +{ + return E_NOTIMPL; +} + +BOOL WINAPI Implementation_HeapSetInformation( + HANDLE HeapHandle, + HEAP_INFORMATION_CLASS HeapInformationClass, + PVOID HeapInformation, + SIZE_T HeapInformationLength +) +{ + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; +} + +BOOL WINAPI Implementation_PrefetchVirtualMemory( + HANDLE hProcess, + ULONG_PTR NumberOfEntries, + PWIN32_MEMORY_RANGE_ENTRY VirtualAddresses, + ULONG Flags +) +{ + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; +} + +BOOL WINAPI Implementation_GetFirmwareType( + PFIRMWARE_TYPE FirmwareType +) +{ + if (!FirmwareType) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + *FirmwareType = FirmwareTypeBios; + + return TRUE; +} + +BOOL WINAPI Implementation_CryptProtectMemory( + LPVOID pDataIn, + DWORD cbDataIn, + DWORD dwFlags +) +{ + DATA_BLOB DataIn; + DataIn.cbData = cbDataIn; + DataIn.pbData = pDataIn; + return CryptProtectData(&DataIn, NULL, NULL, NULL, NULL, 0, &DataIn); +} + +BOOL WINAPI Implementation_CryptUnprotectMemory( + LPVOID pDataIn, + DWORD cbDataIn, + DWORD dwFlags +) +{ + DATA_BLOB DataIn; + DataIn.cbData = cbDataIn; + DataIn.pbData = pDataIn; + return CryptUnprotectData(&DataIn, NULL, NULL, NULL, NULL, 0, &DataIn); +} + +LONG WINAPI Implementation_GetPackagePathByFullName( + PCWSTR packageFullName, + UINT32* pathLength, + PWSTR path +) +{ + return ERROR_NOT_SUPPORTED; +} + +LONG WINAPI Implementation_GetPackagesByPackageFamily( + PCWSTR packageFamilyName, + UINT32* count, + PWSTR* packageFullNames, + UINT32* bufferLength, + WCHAR* buffer +) +{ + return ERROR_NOT_SUPPORTED; +} + +DWORD WINAPI Implementation_DiscardVirtualMemory( + PVOID VirtualAddress, + SIZE_T Size +) +{ + return 1; +} \ No newline at end of file diff --git a/module.c b/module.c new file mode 100644 index 0000000..f441f62 --- /dev/null +++ b/module.c @@ -0,0 +1,179 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include "strsafe.h" + +UNICODE_STRING g_DllPath; + +HMODULE WINAPI Implementation_LoadLibraryA(LPCSTR lpLibFileName) +{ + return Implementation_LoadLibraryExA(lpLibFileName, 0, 0); +} + +HMODULE WINAPI Implementation_LoadLibraryExA(LPCSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) +{ + HMODULE hModule; + ANSI_STRING DllPathA; + UNICODE_STRING DllPath; + ULONG LoadFlags; + + hModule = NULL; + + RtlInitAnsiString(&DllPathA, lpLibFileName); + RtlAnsiStringToUnicodeString(&DllPath, &DllPathA, TRUE); + + LoadFlags = 0; + + if (dwFlags & DONT_RESOLVE_DLL_REFERENCES) + LoadFlags |= DONT_RESOLVE_DLL_REFERENCES; + + if (dwFlags & LOAD_LIBRARY_AS_DATAFILE) + LoadFlags |= DONT_RESOLVE_DLL_REFERENCES; + + LdrLoadDll(NULL, &LoadFlags, &DllPath, &hModule); + + if (hModule) + TLSInit_DllMain_ProcessAttach_Internal(hModule); + else + { + if (g_strstr(lpLibFileName, "dxgi") || + g_strstr(lpLibFileName, "bcryptprimitives") || + g_strstr(lpLibFileName, "api-ms-win-core-fibers-l1-1-0") || + g_strstr(lpLibFileName, "api-ms-win-core-fibers-l1-1-1")) + return GetModuleHandleA("progwrp.dll"); + } + + RtlFreeUnicodeString(&DllPath); + + return hModule; +} + +HMODULE WINAPI Implementation_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags) +{ + UNICODE_STRING DllPath; + HMODULE hModule = 0; + ULONG LoadFlags; + + RtlInitUnicodeString(&DllPath, lpLibFileName); + + LoadFlags = 0; + + if (dwFlags & DONT_RESOLVE_DLL_REFERENCES) + LoadFlags |= DONT_RESOLVE_DLL_REFERENCES; + + if (dwFlags & LOAD_LIBRARY_AS_DATAFILE) + LoadFlags |= DONT_RESOLVE_DLL_REFERENCES; + + LdrLoadDll(NULL, &LoadFlags, &DllPath, &hModule); + + if (hModule) + TLSInit_DllMain_ProcessAttach_Internal(hModule); + else + { + if (g_wcsstr(lpLibFileName, L"dxgi") || + g_wcsstr(lpLibFileName, L"bcryptprimitives") || + g_wcsstr(lpLibFileName, L"api-ms-win-core-fibers-l1-1-0") || + g_wcsstr(lpLibFileName, L"api-ms-win-core-fibers-l1-1-1")) + return GetModuleHandleA("progwrp.dll"); + } + + return hModule; +} + +HMODULE WINAPI Implementation_LoadLibraryW(LPCWSTR lpLibFileName) +{ + return Implementation_LoadLibraryExW(lpLibFileName, 0, 0); +} + +FARPROC WINAPI Implementation_GetProcAddress( + HMODULE hModule, + LPCSTR lpProcName +) +{ + ANSI_STRING ProcNameStr; + PANSI_STRING pStr; + ULONG_PTR pfnFunc = NULL; + ULONG Ordinal = 0; + if(lpProcName > 0x10000) + { + RtlInitAnsiString(&ProcNameStr, lpProcName); + pStr = &ProcNameStr; + } + else + { + pStr = NULL; + + if(lpProcName > 0) + Ordinal = lpProcName; + } + if(LdrGetProcedureAddress(hModule, pStr, Ordinal, &pfnFunc) != 0) + { + LdrGetProcedureAddress(GetModuleHandleA("progwrp.dll"), pStr, Ordinal, &pfnFunc); + } + + return pfnFunc; +} + +BOOL WINAPI Implementation_GetModuleHandleExA( + DWORD dwFlags, + LPCSTR lpModuleName, + HMODULE *phModule +) +{ + if (phModule) { + if (lpModuleName) + *phModule = Implementation_LoadLibraryA(lpModuleName); + else + *phModule = GetModuleHandleA(NULL); + } + else + return FALSE; + + return TRUE; +} + +BOOL WINAPI Implementation_GetModuleHandleExW( + DWORD dwFlags, + LPCWSTR lpModuleName, + HMODULE *phModule +) +{ + if (phModule) { + if (lpModuleName) + *phModule = Implementation_LoadLibraryW(lpModuleName); + else + *phModule = GetModuleHandleA(NULL); + } + else + return FALSE; + + return TRUE; +} + +BOOL WINAPI Implementation_SetDllDirectoryW( + LPCWSTR lpPathName +) +{ +/* PWSTR PathStr; + DWORD PathLen; + + PathLen = GetEnvironmentVariableW(L"PATH", NULL, 0); + + PathStr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (PathLen + MAX_PATH + 1)*sizeof(WCHAR)); + + if(PathStr) + { + EnterCriticalSection(&SrwSharedCs2); + GetEnvironmentVariableW(L"PATH", PathStr, (PathLen + MAX_PATH + 1)); + StringCchCatW(PathStr, (PathLen + MAX_PATH + 1), L';'); + StringCchCatW(PathStr, (PathLen + MAX_PATH + 1), lpPathName); + SetEnvironmentVariableW(L"PATH", PathStr); + LeaveCriticalSection(&SrwSharedCs2); + HeapFree(GetProcessHeap(), 0, PathStr); + + return TRUE; + } + else*/ + return FALSE; + +} \ No newline at end of file diff --git a/ntdllex.lib b/ntdllex.lib new file mode 100644 index 0000000..212d699 Binary files /dev/null and b/ntdllex.lib differ diff --git a/ole32.c b/ole32.c new file mode 100644 index 0000000..3f603f5 --- /dev/null +++ b/ole32.c @@ -0,0 +1,16 @@ +#include "progwrp.h" + +HRESULT WINAPI Implementation_CoRegisterInitializeSpy( + IInitializeSpy *pSpy, + ULARGE_INTEGER *puliCookie +) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI Implementation_CoRevokeInitializeSpy( + ULARGE_INTEGER uliCookie +) +{ + return E_NOTIMPL; +} \ No newline at end of file diff --git a/power.c b/power.c new file mode 100644 index 0000000..8bf8c74 --- /dev/null +++ b/power.c @@ -0,0 +1,104 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include + +BOOL WINAPI Implementation_PowerClearRequest( + HANDLE PowerRequest, + POWER_REQUEST_TYPE RequestType +) +{ + LONG dwQuantity; + DWORD dwSize; + switch (RequestType) + { + case PowerRequestDisplayRequired: + SetThreadExecutionState(SetThreadExecutionState(ES_CONTINUOUS) & ~ES_DISPLAY_REQUIRED); + WaitForSingleObject(MutexRegistry, INFINITE); + RegQueryValueExA(g_hkProgwrp, "NumberActiveWakeLocks", NULL, NULL, &dwQuantity, &dwSize); + --dwQuantity; + if (dwQuantity < 0) + dwQuantity = 0; + RegSetValueExA(g_hkProgwrp, "NumberActiveWakeLocks", NULL, REG_DWORD, &dwQuantity, 4); + if(!dwQuantity) + Implementation_SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, 1, NULL, SPIF_SENDCHANGE); + ReleaseMutex(MutexRegistry); + return TRUE; + case PowerRequestSystemRequired: + SetThreadExecutionState(SetThreadExecutionState(ES_CONTINUOUS) & ~ES_SYSTEM_REQUIRED); + return TRUE; + case PowerRequestAwayModeRequired: + SetThreadExecutionState(SetThreadExecutionState(ES_CONTINUOUS) & ~ES_AWAYMODE_REQUIRED); + return TRUE; + case PowerRequestExecutionRequired: + SetThreadExecutionState(SetThreadExecutionState(ES_CONTINUOUS) & ~ES_SYSTEM_REQUIRED); + return TRUE; + } + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; +} +HANDLE WINAPI Implementation_PowerCreateRequest( + PREASON_CONTEXT Context +) +{ + DWORD dwQuantity, dwSize; + WaitForSingleObject(MutexRegistry, INFINITE); + + if(!g_hkProgwrp) + RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Progwrp", &g_hkProgwrp); + if (RegQueryValueExA(g_hkProgwrp, "NumberActiveWakeLocks", NULL, NULL, &dwQuantity, &dwSize) != ERROR_SUCCESS) + { + dwQuantity = 0; + RegSetValueExA(g_hkProgwrp, "NumberActiveWakeLocks", 0, REG_DWORD, &dwQuantity, 4); + } + + ReleaseMutex(MutexRegistry); + return CreateSemaphoreA(NULL, 0, 1, NULL); +} +BOOL WINAPI Implementation_PowerSetRequest( + HANDLE PowerRequest, + POWER_REQUEST_TYPE RequestType +) +{ + LONG dwQuantity; + DWORD dwSize; + ULONG PreviousRequest; + switch (RequestType) + { + case PowerRequestDisplayRequired: + PreviousRequest = SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED); + // MS documentation says that this function has no effect on screensavers, while + // some GLFW code and issues claim otherwise, but that code has mostly Windows 10 in mind. + // On XP, this was insufficient. So I am also calling SystemParametersInfo to + // disable the screensaver. + SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED | PreviousRequest); + WaitForSingleObject(MutexRegistry, INFINITE); + RegQueryValueExA(g_hkProgwrp, "NumberActiveWakeLocks", NULL, NULL, &dwQuantity, &dwSize); + ++dwQuantity; + RegSetValueExA(g_hkProgwrp, "NumberActiveWakeLocks", NULL, REG_DWORD, &dwQuantity, 4); + if (dwQuantity > 0) + Implementation_SystemParametersInfoW(SPI_SETSCREENSAVEACTIVE, 0, NULL, SPIF_SENDCHANGE); + ReleaseMutex(MutexRegistry); + return TRUE; + case PowerRequestSystemRequired: + PreviousRequest = SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); + SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | PreviousRequest); + return TRUE; + case PowerRequestAwayModeRequired: + PreviousRequest = SetThreadExecutionState(ES_CONTINUOUS | ES_AWAYMODE_REQUIRED); + SetThreadExecutionState(ES_CONTINUOUS | ES_AWAYMODE_REQUIRED | PreviousRequest); + return TRUE; + case PowerRequestExecutionRequired: + PreviousRequest = SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); + SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | PreviousRequest); + return TRUE; + } + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; +} + +POWER_PLATFORM_ROLE WINAPI Implementation_PowerDeterminePlatformRole() +// This function reads the registry to determine +{ + return PlatformRoleDesktop; +} \ No newline at end of file diff --git a/processor.c b/processor.c new file mode 100644 index 0000000..818382e --- /dev/null +++ b/processor.c @@ -0,0 +1,411 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include + +PROCESSOR_CACHE_TYPE WINAPI DetermineCacheType(BYTE Descriptor) +{ + if((Descriptor >= 0x6 && Descriptor <= 0x9) + || (Descriptor == 0x30)) + { + return CacheInstruction; // Instruction cache + } + if((Descriptor == 0xA) + ||(Descriptor >= 0xC && Descriptor <= 0xE) + ||(Descriptor == 0x2C) + ||(Descriptor == 0x60) + ||(Descriptor >= 0x66 && Descriptor <= 0x68)) + { + return CacheData; + } + + return CacheUnified; // no trace caches are in scope of the Lx cache descriptors +} + +BYTE WINAPI DetermineCacheAssociativity(BYTE Descriptor) +{ + +} + +WORD WINAPI DetermineCacheLineSize(BYTE Descriptor) +{ + +} + +DWORD WINAPI DetermineCacheSize(BYTE Descriptor) +{ + +} + +BYTE WINAPI DetermineCacheLevel(BYTE Descriptor) +{ + if((Descriptor >= 0x6 && Descriptor <= 0xA) + ||(Descriptor >= 0xC && Descriptor <= 0xE) + ||(Descriptor >= 0x2C && Descriptor <= 0x30) + ||(Descriptor == 0x60) + ||(Descriptor >= 0x66 && Descriptor <= 0x68)) + { + return 1; + } + if((Descriptor >= 0x1D && Descriptor <= 0x21) + ||(Descriptor == 0x24) + ||(Descriptor >= 0x41 && Descriptor <= 0x45) + ||(Descriptor == 0x48) || (Descriptor == 0x4E) + ||(Descriptor >= 0x78 && Descriptor <= 0x87)) + { + return 2; + } + + if((Descriptor >= 0x22 && Descriptor <= 0x23) + ||(Descriptor >= 0x25 && Descriptor <= 0x29) + ||(Descriptor >= 0x46 && Descriptor <= 0x47) + ||(Descriptor >= 0x49 && Descriptor <= 0x4D) + ||(Descriptor >= 0xD0 && Descriptor <= 0xEC)) + { + return 3; + } + + return 0; +} + +BYTE WINAPI BuildCacheDescriptors(int * cpuid_val, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer) +/* + This function is intended to serve two purposes: + -identify the number of non-TLB caches available + -build the cache information based on a legacy Intel/Centaur cpuid leaf (AMD will come later) + + The function returns the number of caches reported by cpuid. + However, if Buffer is not NULL, it can also modify the structs as follows: + Buffer[0] is the L1 cache struct + Buffer[1] is the L2 cache struct + Buffer[3] is the L3 cache struct + + The initial call of GetLogicalProcessorInformationEx will have calculated the buffer size needed + to get all three cache structs, so this should work well. +*/ +{ + BYTE CacheCount, Encoding, LastCacheLvl; + int i; + + for(i = 0; i < 4; i++) + { + if((cpuid_val[i] << 31) & 1) + { + Encoding = cpuid_val[i] & 0xFF; + + LastCacheLvl = DetermineCacheLevel(Encoding); + + if(LastCacheLvl) + ++CacheCount; + + if(Buffer && LastCacheLvl) + { + Buffer->Relationship = RelationCache; + Buffer->Cache.Level = LastCacheLvl; + Buffer->Cache.Associativity = DetermineCacheAssociativity(Encoding); + Buffer->Cache.CacheSize = DetermineCacheSize(Encoding); + Buffer->Cache.Level = DetermineCacheLevel(Encoding); + Buffer->Cache.LineSize = DetermineCacheLineSize(Encoding); + Buffer->Cache.Type = DetermineCacheType(Encoding); + Buffer->Size = sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + ++Buffer; + } + + Encoding = (cpuid_val[i] >> 8) & 0xFF; + + LastCacheLvl = DetermineCacheLevel(Encoding); + + if(LastCacheLvl) + ++CacheCount; + + if(Buffer && LastCacheLvl) + { + Buffer->Relationship = RelationCache; + Buffer->Cache.Level = LastCacheLvl; + Buffer->Cache.Associativity = DetermineCacheAssociativity(Encoding); + Buffer->Cache.CacheSize = DetermineCacheSize(Encoding); + Buffer->Cache.Level = DetermineCacheLevel(Encoding); + Buffer->Cache.LineSize = DetermineCacheLineSize(Encoding); + Buffer->Cache.Type = DetermineCacheType(Encoding); + Buffer->Size = sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + ++Buffer; + } + + Encoding = (cpuid_val[i] >> 16) & 0xFF; + + LastCacheLvl = DetermineCacheLevel(Encoding); + + if(LastCacheLvl) + ++CacheCount; + + if(Buffer && LastCacheLvl) + { + Buffer->Relationship = RelationCache; + Buffer->Cache.Level = LastCacheLvl; + Buffer->Cache.Associativity = DetermineCacheAssociativity(Encoding); + Buffer->Cache.CacheSize = DetermineCacheSize(Encoding); + Buffer->Cache.Level = DetermineCacheLevel(Encoding); + Buffer->Cache.LineSize = DetermineCacheLineSize(Encoding); + Buffer->Cache.Type = DetermineCacheType(Encoding); + Buffer->Size = sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + ++Buffer; + } + + Encoding = (cpuid_val[i] >> 24) & 0xFF; + + LastCacheLvl = DetermineCacheLevel(Encoding); + + if(LastCacheLvl) + ++CacheCount; + + if(Buffer && LastCacheLvl) + { + Buffer->Relationship = RelationCache; + Buffer->Cache.Level = LastCacheLvl; + Buffer->Cache.Associativity = DetermineCacheAssociativity(Encoding); + Buffer->Cache.CacheSize = DetermineCacheSize(Encoding); + Buffer->Cache.Level = DetermineCacheLevel(Encoding); + Buffer->Cache.LineSize = DetermineCacheLineSize(Encoding); + Buffer->Cache.Type = DetermineCacheType(Encoding); + Buffer->Size = sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + ++Buffer; + } + } + + } + + return CacheCount; +} + +WORD WINAPI Implementation_GetMaximumProcessorGroupCount() +// Technically only one processor group until Windows 7. +{ + return 1; +} + +WORD WINAPI Implementation_GetMaximumProcessorCount() +// Technically only one processor group until Windows 7. +{ +#ifdef _AMD64_ + return 64; +#else + return 32; +#endif +} + +BOOL WINAPI Implementation_GetLogicalProcessorInformationEx( + LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType, + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer, + PDWORD ReturnedLength +) +/* + While the predecessor function provides a good proportion of the information in this function, this function + is not available to all operating systems targetted by this function. + + So we can't go into kernel mode and only take advantage of existing user mode functions and cpuid (which will + be called on simultaneously on all CPUs via a pseudo-IPI call - well, my user mode version of it) +*/ +{ + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Iterator; + SYSTEM_INFO sysinfo; + DWORD RequiredLength = 0, i, NumaNodeNumber, ProcessorPackages; + int cpuid_ret [4] = {0, 0, 0, 0}; + + if(!ReturnedLength || ((RelationshipType < RelationProcessorCore || RelationshipType > RelationProcessorModule) && RelationshipType != RelationAll)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + RtlZeroMemory(&sysinfo, sizeof(SYSTEM_INFO)); + + GetSystemInfo(&sysinfo); + + if(RelationshipType == RelationProcessorCore || RelationshipType == RelationAll) + /* + One instance of the struct for each logical processor, but divide by two if + CPUID indicates that HTT is enabled. + */ + { + __cpuid(cpuid_ret, 1); + + if(cpuid_ret[3] & (1 << 28)) + { + RequiredLength += (sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) * sysinfo.dwNumberOfProcessors) / 2; + } + else + { + RequiredLength += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) * sysinfo.dwNumberOfProcessors; + } + } + + if(RelationshipType == RelationNumaNode || RelationshipType == RelationAll) + /* + One instance of the struct for each NUMA node in use. + Windows doesn't seem to recognize NUMA in its user-mode APIs until XP so + we'd have to assume a single node until then. + */ + { + typedef BOOL (WINAPI* NumaNodeMaxNum)(PULONG); + NumaNodeMaxNum GetNumaHighestNodeVal = (NumaNodeMaxNum)Implementation_GetProcAddress(GetModuleHandleA("kernel32.dll"), "GetNumaHighestNodeNumber"); + if(GetNumaHighestNodeVal) + { + GetNumaHighestNodeVal(&NumaNodeNumber); + RequiredLength += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) * (NumaNodeNumber + 1); + } + else + { + RequiredLength += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + NumaNodeNumber = 0; + } + } + + if(RelationshipType == RelationCache || RelationshipType == RelationAll) + /* + One instance of the struct for each cache in use. + There doesn't seem to be a unified way to check cache between + Intel and AMD (Centaur seems to lean towards Intel) so for Intel + I will use eax 0x2 leaf. Not sure about which one I'll use for AMD. + */ + { + __cpuid(cpuid_ret, 2); + + RequiredLength += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) * BuildCacheDescriptors(cpuid_ret, NULL); + } + + if(RelationshipType == RelationProcessorPackage || RelationshipType == RelationAll) + /* + One instance of the struct for each socket in use. + We'll use leaf eax = 0x1 to determine the number of logical processors in a package. + It will be divided by the number of available processors as provided by the system + to determine the number of processors that is available. This should work very well + to indicate not only what is in the system, but what is actually in use. + */ + { + __cpuid(cpuid_ret, 1); + + if(cpuid_ret[0] >> 16 & 0xFF) + ProcessorPackages = (cpuid_ret[0] >> 16 & 0xFF) / sysinfo.dwNumberOfProcessors; + else + ProcessorPackages = 1; + RequiredLength += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX) * ProcessorPackages; + } + + if(RelationshipType == RelationGroup || RelationshipType == RelationAll) + /* + One instance of the struct as there is only one group. + */ + { + RequiredLength += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + } + + if(*ReturnedLength < RequiredLength) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + + *ReturnedLength = RequiredLength; + + if(!Buffer) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + Iterator = Buffer; + + if(RelationshipType == RelationProcessorCore || RelationshipType == RelationAll) + { + __cpuid(cpuid_ret, 1); + + i = 0; + + if(cpuid_ret[3] & (1 << 28)) + { + while(i < sysinfo.dwNumberOfProcessors / 2) + { + Iterator->Relationship = RelationProcessorCore; + Iterator->Processor.Flags = LTP_PC_SMT; + Iterator->Processor.EfficiencyClass = 0; + Iterator->Size = sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + + ++i; + ++Iterator; + } + } + else + { + while(i < sysinfo.dwNumberOfProcessors) + { + Iterator->Relationship = RelationProcessorCore; + Iterator->Processor.Flags = 0; + Iterator->Processor.EfficiencyClass = 0; + Iterator->Size = sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + + ++i; + ++Iterator; + } + } + } + + if(RelationshipType == RelationProcessorPackage || RelationshipType == RelationAll) + { + for(i = 0; i < ProcessorPackages; i++) + { + Iterator[i].Relationship = RelationProcessorPackage; + Iterator[i].Processor.EfficiencyClass = 0; + Iterator[i].Processor.GroupCount = 0; + Iterator[i].Processor.Flags = 0; + Iterator[i].Processor.GroupMask[0].Mask = sysinfo.dwActiveProcessorMask; + Iterator[i].Processor.GroupMask[0].Group = 0; + Iterator->Size = sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + ++Iterator; + } + } + + if(RelationshipType == RelationCache || RelationshipType == RelationAll) + { + BuildCacheDescriptors(cpuid_ret, Iterator); + } + + if(RelationshipType == RelationGroup || RelationshipType == RelationAll) + { + Iterator->Relationship = RelationGroup; + Iterator->Group.MaximumGroupCount = 1; + Iterator->Group.ActiveGroupCount = 1; + Iterator->Group.GroupInfo[0].MaximumProcessorCount = sysinfo.dwNumberOfProcessors; + Iterator->Group.GroupInfo[0].ActiveProcessorCount = sysinfo.dwNumberOfProcessors; + Iterator->Group.GroupInfo[0].ActiveProcessorMask = sysinfo.dwActiveProcessorMask; + Iterator->Size = sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX); + } + + return TRUE; +} + +BOOL WINAPI Implementation_GetThreadGroupAffinity( + HANDLE hThread, + PGROUP_AFFINITY GroupAffinity +) +{ + if(!GroupAffinity || GroupAffinity->Group) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + GroupAffinity->Mask = SetThreadAffinityMask(hThread, 0); + return TRUE; +} + +DWORD WINAPI Implementation_GetCurrentProcessorNumber() +{ + return 0; +} + +BOOL WINAPI Implementation_GetLogicalProcessorInformation( + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, + PDWORD ReturnedLength +) +{ + return FALSE; +} \ No newline at end of file diff --git a/procthread.c b/procthread.c new file mode 100644 index 0000000..2e13f82 --- /dev/null +++ b/procthread.c @@ -0,0 +1,557 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +#ifdef _M_IX86 + +_allmul() +{ + __asm + { + pop ebx ; assembler was adding push ebx by default, so adding this + mov eax, [esp+8] + mov ecx, [esp+16] + or ecx, eax + mov ecx, [esp+12] + jnz hard + mov eax, [esp+4] + mul ecx + ret 16 +hard: + push ebx + mul ecx + mov ebx, eax + mov eax, [esp+8] + mul dword ptr [esp+20] + add ebx, eax + mov eax, [esp+8] + mul ecx + add edx, ebx + pop ebx + ret 16 + } +} +_aulldiv() +{ + __asm + { + pop ebx + pop esi + push ebx + push esi + mov eax, [esp+24] + or eax, eax + jnz hard + mov ecx, [esp+20] + mov eax, [esp+16] + xor edx, edx + div ecx + mov ebx, eax + mov eax, [esp+12] + div ecx + mov edx, ebx + jmp result +hard: + mov ecx, eax + mov ebx, [esp+20] + mov edx, [esp+16] + mov eax, [esp+12] +loop_shr: + shr ecx, 1 + rcr ebx, 1 + shr edx, 1 + rcr eax, 1 + or ecx, ecx + jnz loop_shr + div ebx + mov esi, eax + mul dword ptr [esp+24] + mov ecx, eax + mov eax, [esp+20] + mul esi + add edx, ecx + jb decrement + cmp edx, [esp+10] + ja decrement + jb xor_edx + cmp eax, [esp+12] + jbe xor_edx +decrement: + dec esi +xor_edx: + xor edx, edx + mov eax, esi +result: + pop esi + pop ebx + ret 16 + } +} +#endif + + +HANDLE WINAPI Implementation_CreateRemoteThreadEx( + HANDLE hProcess, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + SIZE_T dwStackSize, + LPTHREAD_START_ROUTINE lpStartAddress, + LPVOID lpParameter, + DWORD dwCreationFlags, + LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, + LPDWORD lpThreadId +) +/* + Only difference is the use of thread attributes. Not applicable in XP and below... + I could add support for a few of the attributes (ideal processor, inherited handles, + nested job objects> - unless I can attach them to generic handles). +*/ +{ + return CreateRemoteThread(hProcess, lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, + dwCreationFlags, lpThreadId); +} + +// Flags to indicate if an attribute is present in the list. +// I believe these are used so that Windows doesn't have to scan the complete list to see if an attribute is present. +#define PARENT_PROCESS (1 << ProcThreadAttributeParentProcess) +#define EXTENDED_FLAGS (1 << ProcThreadAttributeExtendedFlags) +#define HANDLE_LIST (1 << ProcThreadAttributeHandleList) +#define GROUP_AFFINITY (1 << ProcThreadAttributeGroupAffinity) +#define PREFERRED_NODE (1 << ProcThreadAttributePreferredNode) +#define IDEAL_PROCESSOR (1 << ProcThreadAttributeIdealProcessor) +#define UMS_THREAD (1 << ProcThreadAttributeUmsThread) +#define MITIGATION_POLICY (1 << ProcThreadAttributeMitigationPolicy) + +// This structure stores the value for each attribute +typedef struct _PROC_THREAD_ATTRIBUTE_ENTRY +{ + DWORD_PTR Attribute; // PROC_THREAD_ATTRIBUTE_xxx + SIZE_T cbSize; + PVOID lpValue; +} PROC_THREAD_ATTRIBUTE_ENTRY, *LPPROC_THREAD_ATTRIBUTE_ENTRY; + +// This structure contains a list of attributes that have been added using UpdateProcThreadAttribute +typedef struct _PROC_THREAD_ATTRIBUTE_LIST +{ + DWORD dwFlags; + ULONG Size; + ULONG Count; + ULONG Reserved; + PULONG Unknown; + PROC_THREAD_ATTRIBUTE_ENTRY Entries[ANYSIZE_ARRAY]; +} PROC_THREAD_ATTRIBUTE_LIST, *LPPROC_THREAD_ATTRIBUTE_LIST; + +BOOL WINAPI Implementation_InitializeProcThreadAttributeList( + LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, + DWORD dwAttributeCount, + DWORD dwFlags, + PSIZE_T lpSize +) +{ + if(!lpSize) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + *lpSize = sizeof(PROC_THREAD_ATTRIBUTE_LIST)+ (sizeof(PROC_THREAD_ATTRIBUTE_ENTRY) * dwAttributeCount); + + if(!lpAttributeList) + return FALSE; + else + { + lpAttributeList->Count = dwAttributeCount; + lpAttributeList->Size = *lpSize; + return TRUE; + } + + return FALSE; +} + +BOOL WINAPI Implementation_UpdateProcThreadAttribute( + LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, + DWORD dwFlags, + DWORD_PTR Attribute, + PVOID lpValue, + SIZE_T cbSize, + PVOID lpPreviousValue, + PSIZE_T lpReturnSize +) +{ + if(dwFlags || !lpAttributeList) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + switch(Attribute) + { + case PROC_THREAD_ATTRIBUTE_HANDLE_LIST: + lpAttributeList->Entries[0].Attribute = Attribute; + lpAttributeList->dwFlags |= 1; + lpAttributeList->Entries[0].lpValue = lpValue; + return TRUE; + break; + } + + return FALSE; +} + +void WINAPI Implementation_DeleteProcThreadAttributeList( + LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList +) +{ + ; +} + +BOOL WINAPI Implementation_QueryFullProcessImageNameW( + HANDLE hProcess, + DWORD dwFlags, + LPWSTR lpExeName, + PDWORD lpdwSize +) +{ + return FALSE; +} + + +BOOL WINAPI Implementation_QueryFullProcessImageNameA( + HANDLE hProcess, + DWORD dwFlags, + LPSTR lpExeName, + PDWORD lpdwSize +) +{ + return FALSE; +} + + +BOOL WINAPI Implementation_QueryThreadCycleTime( + HANDLE ThreadHandle, + PULONG64 CycleTime +) +{ + LARGE_INTEGER QpcFirst; + LARGE_INTEGER QpcLast; + LARGE_INTEGER CtFreq; + ULONG64 TscFirst; + ULONG64 TscLast; + ULONG64 TscFreq; + ULONG64 Delta; + ULONG64 Dividend; + DWORD OldTp; + ULONG64 CreationTime, ExitTime, KernelTime, UserTime; + + if(!CycleTime) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + OldTp = GetThreadPriority(GetCurrentThread()); + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); + + TscFirst = __rdtsc(); + QueryPerformanceCounter(&QpcFirst); + + TscLast = __rdtsc(); + QueryPerformanceCounter(&QpcLast); + + SetThreadPriority(GetCurrentThread(), OldTp); + + QueryPerformanceFrequency(&CtFreq); + + if(!CtFreq.QuadPart) + CtFreq.QuadPart = 1000; + + Delta = QpcLast.QuadPart - QpcFirst.QuadPart; + + Dividend = Delta / CtFreq.QuadPart; + + if(!Dividend) + Dividend = 1; + + TscFreq = (TscLast - TscFirst) / Dividend; + + if(!GetThreadTimes(ThreadHandle, &CreationTime, &ExitTime, &KernelTime, &UserTime)) + return FALSE; + + *CycleTime = ((KernelTime + UserTime) / 10000000) * TscFreq; + + + return TRUE; +} + + +BOOL WINAPI Implementation_QueryProcessCycleTime( + HANDLE ProcessHandle, + PULONG64 CycleTime +) +{ + LARGE_INTEGER QpcFirst; + LARGE_INTEGER QpcLast; + LARGE_INTEGER CtFreq; + ULONG64 TscFirst; + ULONG64 TscLast; + ULONG64 TscFreq; + ULONG64 Delta; + ULONG64 Dividend; + DWORD OldTp; + ULONG64 CreationTime, ExitTime, KernelTime, UserTime; + + if(!CycleTime) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + OldTp = GetThreadPriority(GetCurrentThread()); + SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); + + TscFirst = __rdtsc(); + QueryPerformanceCounter(&QpcFirst); + + TscLast = __rdtsc(); + QueryPerformanceCounter(&QpcLast); + + SetThreadPriority(GetCurrentThread(), OldTp); + + QueryPerformanceFrequency(&CtFreq); + + if(!CtFreq.QuadPart) + CtFreq.QuadPart = 1000; + + Delta = QpcLast.QuadPart - QpcFirst.QuadPart; + + Dividend = Delta / CtFreq.QuadPart; + + if(!Dividend) + Dividend = 1; + + TscFreq = (TscLast - TscFirst) / Dividend; + + if(!GetProcessTimes(ProcessHandle, &CreationTime, &ExitTime, &KernelTime, &UserTime)) + return FALSE; + + *CycleTime = ((KernelTime + UserTime) / 10000000) * TscFreq; + + + return TRUE; +} + +BOOL WINAPI Implementation_GetNamedPipeServerProcessId( + HANDLE Pipe, + PULONG ServerProcessId +) +{ + return FALSE; +} + +BOOL WINAPI Implementation_GetNamedPipeClientProcessId( + HANDLE Pipe, + PULONG ClientProcessId +) +{ + return FALSE; +} + +BOOL WINAPI Implementation_Wow64GetThreadContext( + HANDLE hThread, + PWOW64_CONTEXT lpContext +) +{ + return FALSE; +} + +#define ThreadBasicInformation 0 + + +typedef struct _THREAD_BASIC_INFORMATION { +NTSTATUS ExitStatus; +PVOID TebBaseAddress; +CLIENT_ID ClientId; +KAFFINITY AffinityMask; +KPRIORITY Priority; +KPRIORITY BasePriority; +} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION; + + +DWORD WINAPI Implementation_GetThreadId( + HANDLE Thread +) +{ + THREAD_BASIC_INFORMATION tbi; + NTSTATUS Status = NtQueryInformationThread(Thread, ThreadBasicInformation, (PVOID)&tbi, sizeof(THREAD_BASIC_INFORMATION), NULL); + + if(Status) + { + BaseSetLastNTError(Status); + return 0; + } + + return (DWORD)tbi.ClientId.UniqueThread; +} + +#ifdef _M_IX86 + +NTSTATUS NTAPI NtSetInformationProcess(HANDLE ProcessHandle, ULONG ProcessInfoClass, PVOID ProcessInformation, ULONG InfoLength); + +BOOL WINAPI Implementation_SetProcessDEPPolicy(DWORD dwFlags) +{ + DWORD dwFlagscpy; + NTSTATUS Status; + + dwFlagscpy = dwFlags; + if ( (dwFlags & 0xFFFFFFFC) != 0 ) //check that only bits 0 and 1 are set + { + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + return FALSE; + } + if ( (dwFlags & PROCESS_DEP_ENABLE) != 0 ) + { + dwFlags = 9; + if ( (dwFlagscpy & PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION) != 0 ) + dwFlags = 13; + } + else + { + if ( (dwFlags & PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION) != 0 ) + { + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + return FALSE; + } + dwFlags = 2; // Set DEP to be disabled for the process + } + Status = NtSetInformationProcess((HANDLE)-1, 0x22, (PVOID)&dwFlags,(ULONG) 4); //class ProcessExecuteFlags + if ( Status < 0 ) + { + BaseSetLastNTError(Status); + return FALSE; + } + return TRUE; +} + +#else + +BOOL WINAPI Implementation_SetProcessDEPPolicy(DWORD dwFlags) +{ + BaseSetLastNTError(0xC00000BB); + return FALSE; +} + +#endif + +DWORD WINAPI Implementation_GetProcessId( + HANDLE Process +) +{ + PROCESS_BASIC_INFORMATION pbi; + NTSTATUS Status = NtQueryInformationProcess(Process, ProcessBasicInformation, (PVOID)&pbi, sizeof(PROCESS_BASIC_INFORMATION), NULL); + + if(Status) + { + BaseSetLastNTError(Status); + return 0; + } + + return (DWORD)pbi.UniqueProcessId; +} + +BOOL WINAPI Implementation_GetProcessHandleCount( + HANDLE hProcess, + PDWORD pdwHandleCount +) +{ + ULONG ulProcessHandleCount; + + if(!pdwHandleCount) + { + BaseSetLastNTError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + NTSTATUS Status = NtQueryInformationProcess(hProcess, 20, (PVOID)&ulProcessHandleCount, sizeof(ULONG), NULL); + + if(Status) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *pdwHandleCount = ulProcessHandleCount; + + return TRUE; +} + +BOOL WINAPI Implementation_IsProcessInJob( + HANDLE ProcessHandle, + HANDLE JobHandle, + PBOOL Result +) +{ + int i; + DWORD dwProcessId; + PJOBOBJECT_BASIC_PROCESS_ID_LIST jbpil; + JOBOBJECT_BASIC_ACCOUNTING_INFORMATION jbai; + if(!Result || !QueryInformationJobObject(JobHandle, JobObjectBasicAccountingInformation, &jbai, sizeof(JOBOBJECT_BASIC_ACCOUNTING_INFORMATION), NULL)) + return FALSE; + + *Result = FALSE; + + jbpil = (PJOBOBJECT_BASIC_PROCESS_ID_LIST)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(JOBOBJECT_BASIC_PROCESS_ID_LIST) * (sizeof(ULONG_PTR)* jbai.TotalProcesses)); + + if(QueryInformationJobObject(JobHandle, JobObjectBasicProcessIdList, &jbpil, sizeof(JOBOBJECT_BASIC_PROCESS_ID_LIST) * (sizeof(ULONG_PTR)* jbai.TotalProcesses), NULL)) + { + dwProcessId = Implementation_GetProcessId(ProcessHandle); + + for(i = 0; i < jbpil->NumberOfProcessIdsInList; i++) + { + if(dwProcessId == jbpil->ProcessIdList[i]) + { + *Result = TRUE; + HeapFree(GetProcessHeap(), 0, jbpil); + return FALSE; + } + } + HeapFree(GetProcessHeap(), 0, jbpil); + return TRUE; + } + else { + HeapFree(GetProcessHeap(), 0, jbpil); + return FALSE; + } +} + +BOOL WINAPI Implementation_IsWow64Process( + HANDLE hProcess, + PBOOL Wow64Process +) +{ + if(!Wow64Process) + return FALSE; + + *Wow64Process = TRUE; + + return TRUE; +} + +BOOL WINAPI Implementation_DuplicateHandle( + HANDLE hSourceProcessHandle, + HANDLE hSourceHandle, + HANDLE hTargetProcessHandle, + LPHANDLE lpTargetHandle, + DWORD dwDesiredAccess, + BOOL bInheritHandle, + DWORD dwOptions +) +{ + typedef BOOL(WINAPI* pfnDuplicateHandle)(HANDLE, HANDLE, HANDLE, LPHANDLE, DWORD, BOOL, DWORD); + pfnDuplicateHandle pDuplicateHandle = (pfnDuplicateHandle)Implementation_GetProcAddress(GetModuleHandleA("kernel32.dll"), "DuplicateHandle"); + if (dwDesiredAccess & PROCESS_QUERY_LIMITED_INFORMATION) + { + dwDesiredAccess &= ~PROCESS_QUERY_LIMITED_INFORMATION; + dwDesiredAccess |= PROCESS_QUERY_INFORMATION; + } + return pDuplicateHandle(hSourceProcessHandle, hSourceHandle, hTargetProcessHandle, lpTargetHandle, dwDesiredAccess, + bInheritHandle, dwOptions); +} \ No newline at end of file diff --git a/product.c b/product.c new file mode 100644 index 0000000..10d15ed --- /dev/null +++ b/product.c @@ -0,0 +1,22 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +BOOL WINAPI Implementation_GetProductInfo( + DWORD dwOSMajorVersion, + DWORD dwOSMinorVersion, + DWORD dwSpMajorVersion, + DWORD dwSpMinorVersion, + PDWORD pdwReturnedProductType +) +{ + if(!pdwReturnedProductType) + { + SetLastError(STATUS_INVALID_PARAMETER); + return FALSE; + } + + *pdwReturnedProductType = PRODUCT_ULTIMATE; + + return TRUE; +} \ No newline at end of file diff --git a/progwrp.h b/progwrp.h new file mode 100644 index 0000000..2e2c981 --- /dev/null +++ b/progwrp.h @@ -0,0 +1,114 @@ +#pragma once +#define PSAPI_VERSION 1 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +CRITICAL_SECTION SrwSharedCs, SrwSharedCs2; +HANDLE MutexInitOnce; +HANDLE g_SRWEvent; +HANDLE MutexRegistry; +HKEY g_hkProgwrp; +/**/ +typedef struct _PEBS_LDR_DATA { + BYTE Reserved1[8]; + PVOID Reserved2[3]; + LIST_ENTRY InMemoryOrderModuleList; +} PEBS_LDR_DATA, * PPEBS_LDR_DATA; + +VOID WINAPI TLSInit_DllMain_ThreadAttach_Internal(ULONG_PTR DllBase, ULONG_PTR TebAddr); +VOID WINAPI TLSInit_DllMain_ProcessAttach_Internal(ULONG_PTR DllBase); +ULONG GetCoreTlsEntriesCount(); + +typedef struct +{ + BOOLEAN InheritedAddressSpace; + BOOLEAN ReadImageFileExecOptions; + BOOLEAN BeingDebugged; + BOOLEAN SpareBool; + HANDLE Mutant; + PVOID ImageBaseAddress; + PPEB_LDR_DATA Ldr; + PVOID ProcessParameters; + PVOID SubSystemData; + PVOID ProcessHeap; + PVOID FastPebLock; + PVOID FastPebLockRoutine; + PVOID FastPebUnlockRoutine; + ULONG EnvironmentUpdateCount; + PVOID KernelCallbackTable; + ULONG SystemReserved; +} PEB_CUSTOM, *PPEB_CUSTOM; + +typedef struct +{ + PVOID ExceptionList; + PVOID StackBase; + PVOID StackLimit; + PVOID SubSystemTib; + union { + PVOID FiberData; + DWORD Version; + }; + PVOID ArbitraryUserPointer; + PVOID Self; + PVOID EnvironmentPointer; + ULONG_PTR UniqueProcess; + ULONG_PTR UniqueThread; + PVOID ActiveRpcHandle; + PVOID ThreadLocalStoragePointer; + PPEB_CUSTOM ProcessEnvironmentBlock; + ULONG LastErrorValue; + ULONG CountOfOwnedCriticalSections; + PVOID CsrClientThread; + PVOID Win32ThreadInfo; + ULONG User32Reserved [0x1A]; + ULONG UserReserved [5]; + PVOID WOW32Reserved; + ULONG CurrentLocale; + ULONG FpSoftwareStatusRegister; + PVOID SystemReserved1 [0x36]; +} TEB_CUSTOM, *PTEB_CUSTOM; + +#define BaseSetLastNTError(x) SetLastError(RtlNtStatusToDosError(x)) + + NTSTATUS NTAPI LdrLoadDll( + PWCHAR DllPathName, + ULONG Flags, + PUNICODE_STRING ModuleName, + PHANDLE Handle); + +NTSYSAPI NTSTATUS NTAPI LdrGetProcedureAddress( + IN HMODULE ModuleHandle, + IN PANSI_STRING FunctionName OPTIONAL, + IN WORD Ordinal OPTIONAL, + OUT PVOID *FunctionAddress ); + +BOOL WINAPI LimitedStrCmp(int StartIdx, int EndIdx, PCWSTR Str0, PCWSTR Str1); + +typedef wchar_t(_cdecl *wcsstr_ntdll)(const wchar_t*, const wchar_t*); + +wcsstr_ntdll g_wcsstr; + +typedef char(_cdecl* strstr_ntdll)(const char*, const char*); + +strstr_ntdll g_strstr; + +HANDLE g_hFile; + +ULONG WINAPI AddRef(void* this); + +ULONG WINAPI Release(void* this); + +PULONG_PTR TlsBases; +ULONG TlsBasesCount, TlsBasesLength; \ No newline at end of file diff --git a/progwrp.idb b/progwrp.idb new file mode 100644 index 0000000..6c38c4b Binary files /dev/null and b/progwrp.idb differ diff --git a/progwrp.pdb b/progwrp.pdb new file mode 100644 index 0000000..0750016 Binary files /dev/null and b/progwrp.pdb differ diff --git a/progwrp.vcproj b/progwrp.vcproj new file mode 100644 index 0000000..6a15251 --- /dev/null +++ b/progwrp.vcproj @@ -0,0 +1,583 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/progwrp.vcproj.Shane-PC.Shane.user b/progwrp.vcproj.Shane-PC.Shane.user new file mode 100644 index 0000000..b00fe1c --- /dev/null +++ b/progwrp.vcproj.Shane-PC.Shane.user @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + diff --git a/progwrp.vcproj.WIN32-PC.win32.user b/progwrp.vcproj.WIN32-PC.win32.user new file mode 100644 index 0000000..c56439c --- /dev/null +++ b/progwrp.vcproj.WIN32-PC.win32.user @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + diff --git a/progwrp.vcxproj b/progwrp.vcxproj new file mode 100644 index 0000000..aad5d4a --- /dev/null +++ b/progwrp.vcxproj @@ -0,0 +1,354 @@ + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + 17.0 + {01C075CA-C7FB-4AB8-B5B1-510565C19C5D} + progwrp + Win32Proj + + + + DynamicLibrary + v143 + Unicode + true + + + DynamicLibrary + v143 + Unicode + true + + + DynamicLibrary + v143 + Unicode + + + DynamicLibrary + v143 + Unicode + + + DynamicLibrary + v143 + Unicode + false + + + DynamicLibrary + v143 + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.34714.143 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + true + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + false + + + false + false + + + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + false + false + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;PROGWRP_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + EditAndContinue + + + true + Windows + MachineX86 + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;PROGWRP_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + EditAndContinue + + + true + Windows + + + + + X64 + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;PROGWRP_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + ProgramDatabase + + + true + Windows + MachineX64 + + + + + MaxSpeed + true + false + WIN32;NDEBUG;_WINDOWS;_USRDLL;PROGWRP_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + false + true + + progwrp.pdb + Level3 + ProgramDatabase + + + crypt32.lib;ntdllex.lib;winmm.lib;ntdll.lib;psapi.lib;setupapi.lib;pdh.lib;user32.lib;ws2_32.lib;%(AdditionalDependencies) + true + true + Yes + Console + true + true + DllMain + true + 0x7000000 + MachineX86 + + + + + MaxSpeed + true + false + WIN32;NDEBUG;_WINDOWS;_USRDLL;PROGWRP_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + false + true + + + progwrp.pdb + Level3 + ProgramDatabase + + + ntdllex.lib;winmm.lib;ntdll.lib;psapi.lib;setupapi.lib;pdh.lib;user32.lib;ws2_32.lib;%(AdditionalDependencies) + true + true + Yes + Console + true + true + DllMain + true + 0x7000000 + + + + + X64 + + + Full + true + false + WIN32;NDEBUG;_WINDOWS;_USRDLL;PROGWRP_EXPORTS;%(PreprocessorDefinitions) + MultiThreaded + false + true + + progwrp.pdb + Level3 + + NoExtensions + + + crypt32.lib;ntdll.lib;setupapi.lib;winmm.lib;psapi.lib;pdh.lib;ws2_32.lib;%(AdditionalDependencies) + true + true + Console + true + true + DllMain + true + 0x17000000 + MachineX64 + + + + + + + + + + + + + false + false + + + false + + + + + false + false + + + false + + + + + + + MinSpace + MinSpace + Default + Default + Size + Size + false + false + MinSpace + + + + + + MaxSpeed + MaxSpeed + Default + Default + true + true + + + + + + + + + + + + + + + + + + Disabled + + + Disabled + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/progwrp.vcxproj.filters b/progwrp.vcxproj.filters new file mode 100644 index 0000000..2883427 --- /dev/null +++ b/progwrp.vcxproj.filters @@ -0,0 +1,143 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + + + + \ No newline at end of file diff --git a/progwrp.vcxproj.user b/progwrp.vcxproj.user new file mode 100644 index 0000000..88a5509 --- /dev/null +++ b/progwrp.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/psapi.c b/psapi.c new file mode 100644 index 0000000..47af7fc --- /dev/null +++ b/psapi.c @@ -0,0 +1,50 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +BOOL WINAPI Implementation_GetProcessMemoryInfo( + HANDLE Process, + PPROCESS_MEMORY_COUNTERS ppsmemCounters, + DWORD cb +) +{ + return FALSE; +} + +BOOL WINAPI Implementation_GetModuleInformation( + HANDLE hProcess, + HMODULE hModule, + LPMODULEINFO lpmodinfo, + DWORD cb +) +{ + return FALSE; +} + +BOOL WINAPI Implementation_QueryWorkingSetEx( + HANDLE hProcess, + PVOID pv, + DWORD cb +) +{ + return FALSE; +} + +BOOL WINAPI Implementation_GetPerformanceInfo( + PPERFORMANCE_INFORMATION pPerformanceInformation, + DWORD cb +) +{ + if(!pPerformanceInformation) + { + BaseSetLastNTError(ERROR_INVALID_PARAMETER); + return FALSE; + } + if(cb != sizeof(PERFORMANCE_INFORMATION)) + { + BaseSetLastNTError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + //pPerformanceInformation-> + return TRUE; +} \ No newline at end of file diff --git a/ptr.c b/ptr.c new file mode 100644 index 0000000..7fc500a --- /dev/null +++ b/ptr.c @@ -0,0 +1,13 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +PVOID WINAPI Implementation_EncodePointer(PVOID Ptr) { + + return (PVOID)((ULONG_PTR)Ptr ^ (ULONG_PTR)NtCurrentTeb()->ProcessEnvironmentBlock); +} + +PVOID WINAPI Implementation_DecodePointer(PVOID Ptr) { + + return (PVOID)((ULONG_PTR)Ptr ^ (ULONG_PTR)NtCurrentTeb()->ProcessEnvironmentBlock); +} \ No newline at end of file diff --git a/registry.c b/registry.c new file mode 100644 index 0000000..37b2b8c --- /dev/null +++ b/registry.c @@ -0,0 +1,42 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +NTSTATUS NTAPI NtOpenKey( + PHANDLE KeyHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes); + +NTSTATUS NTAPI Implementation_NtOpenKeyEx( + PHANDLE KeyHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + ULONG OpenOptions +) +{ + return NtOpenKey(KeyHandle, DesiredAccess, ObjectAttributes); +} + +LSTATUS WINAPI Implementation_RegDeleteKeyExW( + HKEY hKey, + LPCWSTR lpSubKey, + REGSAM samDesired, + DWORD Reserved +) +{ + return RegDeleteKeyW(hKey, lpSubKey); +} + +LSTATUS WINAPI Implementation_RegGetValueW( + HKEY hkey, + LPCWSTR lpSubKey, + LPCWSTR lpValue, + DWORD dwFlags, + LPDWORD pdwType, + PVOID pvData, + LPDWORD pcbData +) +{ + + return RegQueryValueW(hkey, lpSubKey, lpValue, pcbData); +} \ No newline at end of file diff --git a/resource.h b/resource.h new file mode 100644 index 0000000..7d7a454 --- /dev/null +++ b/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by rsrc.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/rsrc.aps b/rsrc.aps new file mode 100644 index 0000000..6a22487 Binary files /dev/null and b/rsrc.aps differ diff --git a/rsrc.rc b/rsrc.rc new file mode 100644 index 0000000..a6e30f3 --- /dev/null +++ b/rsrc.rc @@ -0,0 +1,109 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (Canada) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,1,0,5024 + PRODUCTVERSION 1,1,0,5024 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "100904b0" + BEGIN + VALUE "FileDescription", "Application-side Win32 API Compatibility DLL" + VALUE "FileVersion", "1.1.0.5024" + VALUE "InternalName", "progwrp" + VALUE "LegalCopyright", "Copyright (C) 2024 win32" + VALUE "OriginalFilename", "progwrp.dll" + VALUE "ProductName", "Application-side Win32 API Compatibility Pack" + VALUE "ProductVersion", "1.1.0.5024" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x1009, 1200 + END +END + +#endif // English (Canada) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/setupapi.c b/setupapi.c new file mode 100644 index 0000000..0645a77 --- /dev/null +++ b/setupapi.c @@ -0,0 +1,64 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include + +const DEVPROPKEY DEVPKEY_Device_DeviceDesc = {0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 2 }; +const DEVPROPKEY DEVPKEY_Device_BusNumber = {0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 23}; +const DEVPROPKEY DEVPKEY_Device_Address = {0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 30}; +const DEVPROPKEY DEVPKEY_Device_InstanceId = {0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 256}; +const DEVPROPKEY DEVPKEY_Device_Parent = {0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 8}; +const DEVPROPKEY DEVPKEY_Device_Children = {0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 9}; +const DEVPROPKEY DEVPKEY_Device_HardwareIds = {0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 3}; + +BOOL DevPropKeyCmp(const DEVPROPKEY PropertyKey0, const DEVPROPKEY PropertyKey1) +{ + if(PropertyKey0.fmtid.Data1 == PropertyKey1.fmtid.Data1 && + PropertyKey0.fmtid.Data2 == PropertyKey1.fmtid.Data2 && + PropertyKey0.fmtid.Data3 == PropertyKey1.fmtid.Data3 && + PropertyKey0.fmtid.Data4 == PropertyKey1.fmtid.Data4 && + PropertyKey0.pid == PropertyKey1.pid) + return TRUE; + + return FALSE; +} + +DWORD WINAPI DevPropKeyEqual(const DEVPROPKEY* PropertyKey) +{ + if(DevPropKeyCmp(*PropertyKey, DEVPKEY_Device_DeviceDesc)) + return SPDRP_DEVICEDESC; + if(DevPropKeyCmp(*PropertyKey, DEVPKEY_Device_BusNumber)) + return SPDRP_BUSNUMBER; + if(DevPropKeyCmp(*PropertyKey, DEVPKEY_Device_Address)) + return SPDRP_ADDRESS; + if(DevPropKeyCmp(*PropertyKey, DEVPKEY_Device_InstanceId)) + return SPDRP_MAXIMUM_PROPERTY; // use SetupDiGetDeviceInstanceIdW + if(DevPropKeyCmp(*PropertyKey, DEVPKEY_Device_Parent)) + return SPDRP_MAXIMUM_PROPERTY; // CM_Get_Parent then CM_Get_Device_ID + if(DevPropKeyCmp(*PropertyKey, DEVPKEY_Device_Children)) + return SPDRP_MAXIMUM_PROPERTY; // CM_Get_Child then CM_Get_Sibling CM_Get_Device_ID + if(DevPropKeyCmp(*PropertyKey, DEVPKEY_Device_HardwareIds)) + return SPDRP_HARDWAREID; + + return SPDRP_MAXIMUM_PROPERTY; +} + +BOOL WINAPI Implementation_SetupDiGetDevicePropertyW( + HDEVINFO DeviceInfoSet, + PSP_DEVINFO_DATA DeviceInfoData, + const DEVPROPKEY *PropertyKey, + DEVPROPTYPE *PropertyType, + PBYTE PropertyBuffer, + DWORD PropertyBufferSize, + PDWORD RequiredSize, + DWORD Flags +) +{ + if (DevPropKeyCmp(*PropertyKey, DEVPKEY_Device_InstanceId)) { + return SetupDiGetDeviceInstanceIdW(DeviceInfoSet, DeviceInfoData, (PWSTR)PropertyBuffer, PropertyBufferSize, RequiredSize); + } + if (DevPropKeyCmp(*PropertyKey, DEVPKEY_Device_Parent)) { + return TRUE; + } + return SetupDiGetDeviceRegistryPropertyW(DeviceInfoSet, DeviceInfoData, DevPropKeyEqual(PropertyKey), PropertyType, PropertyBuffer, PropertyBufferSize, RequiredSize); +} \ No newline at end of file diff --git a/shell.c b/shell.c new file mode 100644 index 0000000..bb967a1 --- /dev/null +++ b/shell.c @@ -0,0 +1,100 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +BOOL WINAPI GuidComp(const GUID PropertyKey0, const GUID PropertyKey1) +{ + if(PropertyKey0.Data1 == PropertyKey1.Data1 && + PropertyKey0.Data2 == PropertyKey1.Data2 && + PropertyKey0.Data3 == PropertyKey1.Data3 && + PropertyKey0.Data4 == PropertyKey1.Data4) + return TRUE; + + return FALSE; +} + +HRESULT WINAPI Implementation_SHGetPropertyStoreForWindow( + HWND hwnd, + REFIID riid, + void **ppv +) +{ + return E_NOTIMPL; +} + +HRESULT WINAPI Implementation_SHGetKnownFolderPath( + REFKNOWNFOLDERID rfid, + DWORD dwFlags, + HANDLE hToken, + PWSTR *ppszPath +) +{ + int csidl_conv = 0; + PWSTR pszFolderPath; + HRESULT result; + + pszFolderPath = (PWSTR)CoTaskMemAlloc(MAX_PATH * sizeof(WCHAR)); + + if (!pszFolderPath) + return E_FAIL; + + if(GuidComp(*rfid, FOLDERID_AdminTools)) + csidl_conv = CSIDL_ADMINTOOLS; + else if(GuidComp(*rfid, FOLDERID_CDBurning)) + csidl_conv = CSIDL_CDBURN_AREA; + else if(GuidComp(*rfid, FOLDERID_CommonAdminTools)) + csidl_conv = CSIDL_COMMON_ADMINTOOLS; + else if(GuidComp(*rfid, FOLDERID_CommonOEMLinks)) + csidl_conv = CSIDL_COMMON_OEM_LINKS; + else if(GuidComp(*rfid, FOLDERID_CommonPrograms)) + csidl_conv = CSIDL_COMMON_PROGRAMS; + else if(GuidComp(*rfid, FOLDERID_CommonStartMenu)) + csidl_conv = CSIDL_COMMON_STARTMENU; + else if(GuidComp(*rfid, FOLDERID_CommonStartup)) + csidl_conv = CSIDL_COMMON_STARTUP; + else if(GuidComp(*rfid, FOLDERID_CommonTemplates)) + csidl_conv = CSIDL_COMMON_TEMPLATES; + else if(GuidComp(*rfid, FOLDERID_ComputerFolder)) + csidl_conv = CSIDL_DRIVES; + else if(GuidComp(*rfid, FOLDERID_ConnectionsFolder)) + csidl_conv = CSIDL_CONNECTIONS; + else if(GuidComp(*rfid, FOLDERID_ControlPanelFolder)) + csidl_conv = CSIDL_CONTROLS; + else if(GuidComp(*rfid, FOLDERID_Cookies)) + csidl_conv = CSIDL_COOKIES; + else if(GuidComp(*rfid, FOLDERID_Desktop)) + csidl_conv = CSIDL_DESKTOP; + else if(GuidComp(*rfid, FOLDERID_Documents)) + csidl_conv = CSIDL_MYDOCUMENTS; + else if(GuidComp(*rfid, FOLDERID_Downloads)) + return E_NOTIMPL; + else if(GuidComp(*rfid, FOLDERID_Favorites)) + csidl_conv = CSIDL_FAVORITES; + else if(GuidComp(*rfid, FOLDERID_Fonts)) + csidl_conv = CSIDL_FONTS; + else if(GuidComp(*rfid, FOLDERID_History)) + csidl_conv = CSIDL_HISTORY; + else if(GuidComp(*rfid, FOLDERID_InternetCache)) + csidl_conv = CSIDL_INTERNET_CACHE; + else if(GuidComp(*rfid, FOLDERID_InternetFolder)) + csidl_conv = CSIDL_INTERNET; + else if(GuidComp(*rfid, FOLDERID_LocalAppData)) + csidl_conv = CSIDL_LOCAL_APPDATA; + + if(csidl_conv) + { + result = SHGetFolderPathW(NULL, csidl_conv, hToken, dwFlags, pszFolderPath); + + *ppszPath = pszFolderPath; + + return result; + } + return E_NOTIMPL; +} + +HRESULT WINAPI Implementation_SHQueryUserNotificationState( + QUERY_USER_NOTIFICATION_STATE *pquns +) +{ + return E_NOTIMPL; +} \ No newline at end of file diff --git a/srw.c b/srw.c new file mode 100644 index 0000000..09896b1 --- /dev/null +++ b/srw.c @@ -0,0 +1,169 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include + +typedef struct { + ULONG_PTR pSRWLock; + HANDLE hEvent; +} WAITER, * PWAITER; + +WAITER ExclusiveWaiters[512]; +WAITER SharedWaiters[512]; + +typedef struct { + USHORT Readers; + USHORT WaitingWriters; +}SRWLOCK_INT, * PSRWLOCK_INT; + +BOOLEAN WINAPI Implementation_TryAcquireSRWLockExclusive(PSRWLOCK_INT SRWLock) +{ + // printf("Attempting to acquire SRW Lock holding:\n Exclusive Lock: %d\n Readers: %d\n Waiting Writers: %d\n", SRWLock->WaitingWriters & (1 << 15), SRWLock->Readers, SRWLock->WaitingWriters); + // printf("Trying to acquire exclusive SRW lock, value 0x%X at 0x%X, TID %d\n", SRWLock->Ptr, SRWLock, GetCurrentThreadId()); + return !_interlockedbittestandset(SRWLock, 31); +} + +BOOLEAN WINAPI Implementation_TryAcquireSRWLockShared(PSRWLOCK_INT SRWLock) +{ + // printf("Attempting to acquire SRW Lock holding:\n Exclusive Lock: %d\n Readers: %d\n Waiting Writers: %d\n", SRWLock->WaitingWriters & (1 << 15), SRWLock->Readers, SRWLock->WaitingWriters); + // printf("Trying to acquire shared SRW lock, value 0x%X at 0x%X, TID %d\n", SRWLock->Ptr, SRWLock, GetCurrentThreadId()); + if (!SRWLock->WaitingWriters) + { + if (!_interlockedbittestandset(SRWLock, 31)) + { + InterlockedIncrement16(&SRWLock->Readers); + return TRUE; + } + } + + if (SRWLock->WaitingWriters && SRWLock->Readers) + { + InterlockedIncrement16(&SRWLock->Readers); + return TRUE; + } + + return FALSE; + //return !_interlockedbittestandset(SRWLock, 0); +} + +void WINAPI Implementation_AcquireSRWLockExclusive(PSRWLOCK_INT SRWLock) +{ + // printf("Attempting to acquire SRW Lock holding:\n Exclusive Lock: %d\n Readers: %d\n Waiting Writers: %d\n", SRWLock->WaitingWriters & (1 << 15), SRWLock->Readers, SRWLock->WaitingWriters); + if (_interlockedbittestandset(SRWLock, 31)) + { + // EnterCriticalSection(&SrwSharedCs2); + InterlockedIncrement16(&SRWLock->WaitingWriters); + // _interlockedbittestandset(SRWLock, 31); + // LeaveCriticalSection(&SrwSharedCs2); + wait: + //WaitForSingleObject(g_SRWEvent, INFINITE); + Sleep(1); + + if (!_interlockedbittestandset(SRWLock, 31)) + { + // EnterCriticalSection(&SrwSharedCs2); + InterlockedDecrement16(&SRWLock->WaitingWriters); + // LeaveCriticalSection(&SrwSharedCs2); + return; + } + else + { + goto wait; + } + } +} + +void WINAPI Implementation_AcquireSRWLockShared(PSRWLOCK_INT SRWLock) +{ + // printf("Attempting to acquire SRW Lock holding:\n Exclusive Lock: %d\n Readers: %d\n Waiting Writers: %d\n", SRWLock->WaitingWriters & (1 << 15), SRWLock->Readers, SRWLock->WaitingWriters); + if (_interlockedbittestandset(SRWLock, 31)) + { + if (SRWLock->Readers) + { + InterlockedIncrement16(&SRWLock->Readers); + return; + } + // InterlockedIncrement16(&SRWLock->WaitingReaders); + wait: + //WaitForSingleObject(g_SRWEvent, INFINITE); + Sleep(1); + + if (!SRWLock->WaitingWriters) + { + _interlockedbittestandset(SRWLock, 31); + // InterlockedDecrement16(&SRWLock->WaitingReaders); + InterlockedIncrement16(&SRWLock->Readers); + return; + } + else if (SRWLock->Readers) + { + // InterlockedDecrement16(&SRWLock->WaitingReaders); + InterlockedIncrement16(&SRWLock->Readers); + return; + } + else + goto wait; + } + else + { + InterlockedIncrement16(&SRWLock->Readers); + } +} + +void WINAPI Implementation_ReleaseSRWLockShared(PSRWLOCK_INT SRWLock) +{ + // printf("Release attempt made on SRW Lock holding:\n Exclusive Lock: %d\n Readers: %d\n Waiting Writers: %d\n", SRWLock->WaitingWriters & (1 << 15), SRWLock->Readers, SRWLock->WaitingWriters); + if (!InterlockedDecrement16(&SRWLock->Readers)) + _interlockedbittestandreset(SRWLock, 31); + //SetEvent(g_SRWEvent); +// ResetEvent(g_SRWEvent); +} + +void WINAPI Implementation_ReleaseSRWLockExclusive(PSRWLOCK_INT SRWLock) +{ + // printf("Release attempt made on SRW Lock holding:\n Exclusive Lock: %d\n Readers: %d\n Waiting Writers: %d\n", SRWLock->WaitingWriters & (1 << 15), SRWLock->Readers, SRWLock->WaitingWriters); + _interlockedbittestandreset(SRWLock, 31); +// SetEvent(g_SRWEvent); +// ResetEvent(g_SRWEvent); +} + +BOOLEAN WINAPI Implementation_TryAcquireSRWLockExclusive_Vista(PSRWLOCK SRWLock) +{ + return !_interlockedbittestandset(SRWLock, 0); +} + +BOOLEAN WINAPI Implementation_TryAcquireSRWLockShared_Vista(PSRWLOCK SRWLock) +{ + ULONG_PTR InterlockedVal; + ULONG_PTR NewSRWValue = 0x11; + ULONG_PTR OldSRWValue = 1; + InterlockedVal = (ULONG_PTR)InterlockedCompareExchange(SRWLock, 0x11, 0); + if (InterlockedVal) + { + if (InterlockedVal == 1) + return FALSE; + else + { + + while (InterlockedVal) + { + InterlockedVal = InterlockedCompareExchange(SRWLock, NewSRWValue, OldSRWValue); + if (InterlockedVal == OldSRWValue) + return TRUE; + if (InterlockedVal == 1 || InterlockedVal % 0x10 != 1) + return FALSE; + NewSRWValue += 0x10; + OldSRWValue += 0x10; + } + } + } + + return TRUE; +} + +void WINAPI Implementation_InitializeSRWLock( + PSRWLOCK SRWLock +) +{ + SRWLock->Ptr = 0; +} \ No newline at end of file diff --git a/srw_new.c b/srw_new.c new file mode 100644 index 0000000..1f1d7ac --- /dev/null +++ b/srw_new.c @@ -0,0 +1,170 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" +#include + +BOOLEAN Implementation_TryAcquireSRWLockExclusive(PSRWLOCK SRWLock) +{ + return !_interlockedbittestandset(SRWLock, 0); +} + +BOOLEAN Implementation_TryAcquireSRWLockShared(PSRWLOCK SRWLock) +{ + ULONG_PTR InterlockedVal; + ULONG_PTR NewSRWValue = 1001; + ULONG_PTR OldSRWValue = 1; + InterlockedVal = (ULONG_PTR)InterlockedCompareExchange(SRWLock, 1001, 0); + while(InterlockedVal) + { + if(InterlockedVal % 1000 == 1) + return FALSE; + else + { + + while(InterlockedVal) + { + InterlockedVal = InterlockedCompareExchange(SRWLock, NewSRWValue, OldSRWValue); + if(InterlockedVal == OldSRWValue) + return TRUE; + if(InterlockedVal % 1000 == 1 || InterlockedVal % 10 != 1) + return FALSE; + NewSRWValue += 1000; + OldSRWValue += 1000; + } + } + } + + return TRUE; +/* +#ifdef __WX86 + if(InterlockedAnd(SRWLock, 0xFFFFFFFF) & 1) +#else + if(InterlockedAnd(SRWLock, 0xFFFFFFFFFFFFFFFF) & 1) +#endif + { + return FALSE; + } + else + { + SRWLockVal = (ULONG_PTR)SRWLock->Ptr; + SRWLockVal = (((SRWLockVal >> 1) + 1) << 1) | (SRWLockVal & 1); + #ifdef __WX86 + if(InterlockedAnd(SRWLock, 0xFFFFFFFF) & 1) + #else + if(InterlockedAnd(SRWLock, 0xFFFFFFFFFFFFFFFF) & 1) + #endif + { + return FALSE; + } + InterlockedExchange(SRWLock, SRWLockVal); + return TRUE; + } +*/ +} + +void Implementation_AcquireSRWLockExclusive(PSRWLOCK SRWLock) +{ + printf("Entering AcquireSRWLockExclusive: %d at 0x%X\n", SRWLock->Ptr, SRWLock); + InterlockedAdd(SRWLock, 10); + while(_interlockedbittestandset(SRWLock, 0)) + { + ; + } + InterlockedAdd(SRWLock, -10); + printf("Exiting AcquireSRWLockExclusive: %d at 0x%X\n", SRWLock->Ptr, SRWLock); +} + +void Implementation_AcquireSRWLockShared(PSRWLOCK SRWLock) +/* + TODO: add a critical section to block access to the shared bits + of the SRW lock. +*/ +{ + + ULONG_PTR InterlockedVal; + ULONG_PTR NewSRWValue = 1001; + ULONG_PTR OldSRWValue = 1; + printf("Entering AcquireSRWLockShared: %d at 0x%X\n", SRWLock->Ptr, SRWLock); + InterlockedVal = (ULONG_PTR)InterlockedCompareExchange(SRWLock, 1001, 0); + while(InterlockedVal) + { + if(InterlockedVal < 1000) + { + if(InterlockedVal > 1) + Sleep(100); + InterlockedVal = (ULONG_PTR)InterlockedCompareExchange(SRWLock, 1001, 0); + if(!InterlockedVal) + break; + } + else + { + InterlockedAdd(SRWLock, 1000); + break; + //InterlockedVal = InterlockedCompareExchange(SRWLock, NewSRWValue, OldSRWValue); + //if(InterlockedVal == OldSRWValue) + // break; + //if(InterlockedVal % 0x10 != 1) + // TerminateProcess(-1, 0xC0000194); // Deadlock all but guaranteed + //NewSRWValue += 1000; + //OldSRWValue += 1000; + } + } + printf("Exiting AcquireSRWLockShared: %d at 0x%X\n", SRWLock->Ptr, SRWLock); +/* + ULONG_PTR SRWLockVal; +#ifdef __WX86 + while(InterlockedAnd(SRWLock, 0xFFFFFFFF) & 1) +#else + while(InterlockedAnd(SRWLock, 0xFFFFFFFFFFFFFFFF) & 1) +#endif + { + Sleep(1); + } + SRWLockVal = SRWLock->Ptr; + SRWLockVal = (((SRWLockVal >> 1) + 1) << 1) | (SRWLockVal & 1); + InterlockedExchange(SRWLock, SRWLockVal); +*/ +} + +void Implementation_ReleaseSRWLockShared(PSRWLOCK SRWLock) +/* + TODO: add a critical section to block access to the shared bits + of the SRW lock. +*/ +{ + printf("Entering ReleaseSRWLockShared: %d at 0x%X\n", SRWLock->Ptr, SRWLock); + ULONG_PTR InterlockedVal = (ULONG_PTR)InterlockedCompareExchange(SRWLock, 0, 1001); + if(InterlockedVal == 1001) + { + printf("Exiting RelaseSRWLockShared: %d at 0x%X\n", SRWLock->Ptr, SRWLock); + return; + } + else if(InterlockedVal > 1001 && InterlockedVal < 2000) + { + InterlockedAdd(SRWLock, -1001); + printf("Exiting RelaseSRWLockShared: %d at 0x%X\n", SRWLock->Ptr, SRWLock); + return; + } + if(InterlockedVal > 1000 && InterlockedVal % 10 == 1) + InterlockedAdd(SRWLock, -1000); + printf("Exiting RelaseSRWLockShared: %d at 0x%X\n", SRWLock->Ptr, SRWLock); +} + +void Implementation_ReleaseSRWLockExclusive(PSRWLOCK SRWLock) +{ + printf("Entering ReleaseSRWLockExclusive: %d at 0x%X\n", SRWLock->Ptr, SRWLock); + ULONG_PTR SRWLockVal = (ULONG_PTR)InterlockedCompareExchange(SRWLock, 0, 1); + if(SRWLockVal != 1 && SRWLockVal < 1000) + { + if(SRWLockVal % 10 == 1) + InterlockedAdd(SRWLock, -1); + } + printf("Exiting ReleaseSRWLockExclusive: %d at 0x%X\n", SRWLock->Ptr, SRWLock); +} + +void Implementation_InitializeSRWLock( + PSRWLOCK SRWLock +) +{ + SRWLock->Ptr = 0; +} \ No newline at end of file diff --git a/synch.c b/synch.c new file mode 100644 index 0000000..fbac065 --- /dev/null +++ b/synch.c @@ -0,0 +1,48 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +HANDLE WINAPI Implementation_CreateWaitableTimerExW( + LPSECURITY_ATTRIBUTES lpTimerAttributes, + LPCWSTR lpTimerName, + DWORD dwFlags, + DWORD dwDesiredAccess + ) +{ + if(dwFlags & ~(CREATE_WAITABLE_TIMER_MANUAL_RESET & 0x2)) // CREATE_WAITABLE_TIMER_HIGH_RESOLUTION + { + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + + if(dwFlags & CREATE_WAITABLE_TIMER_MANUAL_RESET) + return CreateWaitableTimerW(lpTimerAttributes, TRUE, lpTimerName); + else + return CreateWaitableTimerW(lpTimerAttributes, FALSE, lpTimerName); +} + +PVOID NTAPI RtlGetCallersAddress(PVOID* Ptr0, PVOID* Ptr1); + + +BOOL WINAPI Implementation_InitializeCriticalSectionEx( + LPCRITICAL_SECTION lpCriticalSection, + DWORD dwSpinCount, + DWORD Flags + ) +{ + DWORD Test = ERROR_INVALID_PARAMETER; + ULONG_PTR Caller, PcVal, DllBase; + RtlGetCallersAddress(&Caller, &PcVal); + RtlPcToFileHeader(PcVal, &DllBase); + + TLSInit_DllMain_ProcessAttach_Internal(DllBase); + if(Flags & ~(CRITICAL_SECTION_NO_DEBUG_INFO)) + { + SetLastError(Test); + return FALSE; + } + InitializeCriticalSectionAndSpinCount(lpCriticalSection, dwSpinCount); + // TODO, investigate whether A) the critical section always allocates the memory for the debug info section and B) whether the older + // iterations of the critical section API will function without it being there. + return TRUE; +} \ No newline at end of file diff --git a/tls.c b/tls.c new file mode 100644 index 0000000..6d2bde1 --- /dev/null +++ b/tls.c @@ -0,0 +1,414 @@ +#include "progwrp.h" + +NTSYSAPI PVOID RtlAllocateHeap( + PVOID HeapHandle, + ULONG Flags, + SIZE_T Size +); + +NTSYSAPI VOID RtlFreeHeap( + PVOID HeapHandle, + ULONG Flags, + PVOID BaseAddress +); + +#define RtlMoveMemory RtlMoveMemory + +VOID NTAPI RtlMoveMemory( + PVOID Destination, + PVOID Source, + SIZE_T Length +); + +typedef struct { + ULONG Ptr0; + ULONG Ptr1; + ULONG Ptr2; +}TlsHack; + +typedef struct _THREAD_BASIC_INFORMATION { + NTSTATUS ExitStatus; + PVOID TebBaseAddress; + CLIENT_ID ClientId; + KAFFINITY AffinityMask; + KPRIORITY Priority; + KPRIORITY BasePriority; +} THREAD_BASIC_INFORMATION, * PTHREAD_BASIC_INFORMATION; + + +EXTERN_C IMAGE_DOS_HEADER __ImageBase; +#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase) + +__declspec(dllexport) VOID WINAPI TLSInit_DllMain_ThreadAttach(ULONG_PTR DllBase); + +/* + Since I will not rewrite the entirety of the fairly complex LdrLoadDll and friends (although if you look at NT 4, + it is relatively simple), I will implement implicit TLS initialization code in DllMain. + + There are two separate functions, which do two separate things: + -Process attach function: performs calls to TLS callback functions and increments the TLS index for the DLL based on the + count of pointers stashed in Teb->ThreadLocalStoragePointer. + + +*/ + +VOID AddToTlsList(ULONG_PTR DllBase) +/* + The previous TLS allocation system broke down after further enhancements were made to Supermium. Evidently it was no longer doing + the job. + + Now, a list of all modules is maintained; when progwrp is first initialized, the TEB is f +*/ +{ + EnterCriticalSection(&SrwSharedCs2); + + LeaveCriticalSection(&SrwSharedCs2); +} + +PIMAGE_TLS_DIRECTORY __stdcall GetTlsDirectory(ULONG_PTR DllBase, PULONG_PTR ImageBase) +{ + PIMAGE_DOS_HEADER DosHeader; + DWORD OptionalHeaderOffset; + IMAGE_NT_HEADERS* ImageOptionalHeader; + ULONG_PTR Base; + + DosHeader = (PIMAGE_DOS_HEADER)DllBase; + + if (!RtlPcToFileHeader(DllBase, &Base)) + return NULL; + + OptionalHeaderOffset = DosHeader->e_lfanew; + + ImageOptionalHeader = (IMAGE_NT_HEADERS*)(OptionalHeaderOffset + DllBase); + + *ImageBase = ImageOptionalHeader->OptionalHeader.ImageBase; + + if (!ImageOptionalHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress) + return NULL; + + return (PIMAGE_TLS_DIRECTORY)(ImageOptionalHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_TLS].VirtualAddress + DllBase); +} + +__declspec(dllexport) VOID WINAPI TLSInit_DllMain_ProcessAttach(ULONG_PTR DllBase) +{ + return; + PIMAGE_TLS_DIRECTORY TlsDirectory; + PIMAGE_TLS_CALLBACK* TlsCallbacks; + PIMAGE_TLS_CALLBACK TlsCall; + PTEB_CUSTOM CustomTeb; + PULONG TlsIdx; + ULONG_PTR* ThreadLocalStoragePointer, ImageBase; + + if (!DllBase) + return; + + CustomTeb = (PTEB_CUSTOM)NtCurrentTeb(); + + if (LOBYTE(GetVersion()) >= 6 || (LOBYTE(GetVersion()) < 6 && CustomTeb->ProcessEnvironmentBlock->SystemReserved == 1)) + return; // Nothing to do here + + TlsDirectory = GetTlsDirectory(DllBase, &ImageBase); + + if (!TlsDirectory) + return; + + TlsCallbacks = (PIMAGE_TLS_CALLBACK*)((TlsDirectory->AddressOfCallBacks)); // - ImageBase) + DllBase); + + TlsIdx = (PULONG)((TlsDirectory->AddressOfIndex));// - ImageBase)); + DllBase); + + if (*TlsIdx) + return; + + ThreadLocalStoragePointer = CustomTeb->ThreadLocalStoragePointer; + + if (ThreadLocalStoragePointer) + { + while (*ThreadLocalStoragePointer > 0 && !(*ThreadLocalStoragePointer % 4)) + // Make sure only valid pointers are counted, and not padding that can also bookend the list of pointers + { + ++*TlsIdx; + ++ThreadLocalStoragePointer; + } + + } + + if (TlsCallbacks) + { + while (*TlsCallbacks) + { + TlsCall = *TlsCallbacks; + TlsCall((PVOID)DllBase, 1, NULL); + ++TlsCallbacks; + } + } + + TLSInit_DllMain_ThreadAttach(DllBase); +} + +VOID WINAPI TLSInit_DllMain_ProcessAttach_Internal(ULONG_PTR DllBase) +/* + This function is relatively simple: + -get the VA of the TLS directory, add the loaded image base to it + -use the size of the current ThreadLocalStoragePointer to set the TLS index in the DLL + -call the TLS callbacks +*/ +{ + PLDR_DATA_TABLE_ENTRY DataTableEntry, DataTableEntryInit; + PIMAGE_TLS_DIRECTORY TlsDirectory; + PIMAGE_TLS_CALLBACK* TlsCallbacks; + PIMAGE_TLS_CALLBACK TlsCall; + PTEB_CUSTOM CustomTeb; + PULONG TlsIdx; + ULONG_PTR* ThreadLocalStoragePointer, ImageBase; + ULONG ulLength; + LONG i; + PSYSTEM_PROCESS_INFORMATION spi; + PULONG_PTR TlsBaseCountTemp, TlsBasesOld; + + if (!DllBase) + return; + + if (DllBase == GetModuleHandleW(NtCurrentTeb()->ProcessEnvironmentBlock->ProcessParameters->ImagePathName.Buffer)) + return; + + CustomTeb = (PTEB_CUSTOM)NtCurrentTeb(); + + if ((LOBYTE(GetVersion()) >= 6)) + return; // Nothing to do here + + TlsDirectory = GetTlsDirectory(DllBase, &ImageBase); + + if (!TlsDirectory) + return; + + TlsCallbacks = (PIMAGE_TLS_CALLBACK*)((TlsDirectory->AddressOfCallBacks)); // - ImageBase) + DllBase); + + TlsIdx = (PULONG)((TlsDirectory->AddressOfIndex));// - ImageBase)); + DllBase); + + if (*TlsIdx) + return; + + ThreadLocalStoragePointer = CustomTeb->ThreadLocalStoragePointer; + + if (ThreadLocalStoragePointer) + { + while (*ThreadLocalStoragePointer > 0 && !(*ThreadLocalStoragePointer % 4)) + // Make sure only valid pointers are counted, and not padding that can also bookend the list of pointers + { + ++*TlsIdx; + ++ThreadLocalStoragePointer; + } + + } + + if (TlsCallbacks) + { + while (*TlsCallbacks) + { + TlsCall = *TlsCallbacks; + TlsCall((PVOID)DllBase, 1, NULL); + ++TlsCallbacks; + } + } + + if (!TlsBasesLength || TlsBasesCount >= (TlsBasesLength - 1)) + { + TlsBaseCountTemp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ULONG_PTR) * (32 + TlsBasesLength)); + TlsBasesOld = TlsBases; + for (i = 0; i < TlsBasesCount; i++) + TlsBaseCountTemp[i] = TlsBases[i]; + TlsBases = TlsBaseCountTemp; + TlsBasesLength += 32; + if(TlsBasesOld) + HeapFree(GetProcessHeap(), 0, TlsBasesOld); + } + + TlsBases[TlsBasesCount] = DllBase; + ++TlsBasesCount; +/* + NtQuerySystemInformation(SystemProcessInformation, NULL, 0, &ulLength); + + spi = (PSYSTEM_PROCESS_INFORMATION)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ulLength); + + if (!spi) + return; + + if (NtQuerySystemInformation(SystemProcessInformation, spi, ulLength, NULL)) + return; + + while (spi->UniqueProcessId != CustomTeb->UniqueProcess) + { + if (!spi->NextEntryOffset) + return; + spi = spi->NextEntryOffset + (ULONG_PTR)spi; + } + + sti = (ULONG_PTR)spi + sizeof(SYSTEM_PROCESS_INFORMATION); // A slight problem here, the struct size got bigger in Windows 2000. Perhaps it will have to be derived from somewhere for anything older. + + for (i = 0; i < spi->NumberOfThreads; i++) + { + hThread = OpenThread(THREAD_QUERY_INFORMATION, FALSE, sti->ClientId.UniqueThread); + if (hThread) + { + NtQueryInformationThread(hThread, 0, &tbi, sizeof(THREAD_BASIC_INFORMATION), NULL); + SuspendThread(hThread); + DataTableEntry = (PLDR_DATA_TABLE_ENTRY)NtCurrentTeb()->ProcessEnvironmentBlock->Ldr->Reserved2[1]; + DataTableEntryInit = DataTableEntry; + do + { + TLSInit_DllMain_ThreadAttach_Internal(DataTableEntry->DllBase, tbi.TebBaseAddress); + DataTableEntry = DataTableEntry->Reserved1[0]; + } while (DataTableEntry != DataTableEntryInit); + ResumeThread(hThread); + CloseHandle(hThread); + } + ++sti; + }*/ + for (i = 0; i < TlsBasesCount; i++) + { + TLSInit_DllMain_ThreadAttach_Internal(TlsBases[i], NULL); + } +// HeapFree(GetProcessHeap(), 0, spi); + spi = NULL; +} + +__declspec(dllexport) VOID WINAPI TLSInit_DllMain_ThreadAttach(ULONG_PTR DllBase) +{ + return; + int i; + PIMAGE_TLS_DIRECTORY TlsDirectory; + PTEB_CUSTOM CustomTeb; + PULONG TlsIdx; + TlsHack* TlsHackEntry; + ULONG_PTR* ThreadLocalStoragePointer; + ULONG_PTR* ThreadLocalStoragePointerNew, ImageBase; + + + if (!DllBase) + return; + + CustomTeb = (PTEB_CUSTOM)NtCurrentTeb(); + + if (LOBYTE(GetVersion()) >= 6 || (LOBYTE(GetVersion()) < 6 && CustomTeb->ProcessEnvironmentBlock->SystemReserved == 1)) + return; // Nothing to do here + + TlsDirectory = GetTlsDirectory(DllBase, &ImageBase); + + if (!TlsDirectory) + return; + + ThreadLocalStoragePointer = CustomTeb->ThreadLocalStoragePointer; + + TlsIdx = (PULONG)((TlsDirectory->AddressOfIndex)); //- ImageBase)); + DllBase); + + if (CustomTeb->SystemReserved1[0x35] >= *TlsIdx) + return; + + CustomTeb->SystemReserved1[0x35] = *TlsIdx; + ThreadLocalStoragePointerNew = (ULONG_PTR*)HeapAlloc(CustomTeb->ProcessEnvironmentBlock->ProcessHeap, HEAP_ZERO_MEMORY, (*TlsIdx + 2) * sizeof(ULONG_PTR)); + + if (ThreadLocalStoragePointer) + { + for (i = 0; i < *TlsIdx; i++) + { + if (i == 0) + { + TlsHackEntry = (TlsHack*)ThreadLocalStoragePointer[i]; + TlsHackEntry->Ptr2 = 0; // Provisional Supermium 121 hack. + } + ThreadLocalStoragePointerNew[i] = ThreadLocalStoragePointer[i]; + } + } + + ThreadLocalStoragePointerNew[*TlsIdx] = (ULONG_PTR)HeapAlloc(CustomTeb->ProcessEnvironmentBlock->ProcessHeap, HEAP_ZERO_MEMORY, + TlsDirectory->EndAddressOfRawData - TlsDirectory->StartAddressOfRawData); + + if(CustomTeb->SystemReserved1[0x35] == *TlsIdx) + ThreadLocalStoragePointerNew[*TlsIdx + 1] = 0xABABABAB; + + RtlMoveMemory((PVOID)ThreadLocalStoragePointerNew[*TlsIdx], (PVOID)(TlsDirectory->StartAddressOfRawData), + TlsDirectory->EndAddressOfRawData - TlsDirectory->StartAddressOfRawData); + +// if (ThreadLocalStoragePointer) +// HeapFree(CustomTeb->ProcessEnvironmentBlock->ProcessHeap, 0, ThreadLocalStoragePointer); + + CustomTeb->ThreadLocalStoragePointer = ThreadLocalStoragePointerNew; +} + +VOID WINAPI TLSInit_DllMain_ThreadAttach_Internal(ULONG_PTR DllBase, ULONG_PTR TebAddr) +{ + int i; + PIMAGE_TLS_DIRECTORY TlsDirectory; + PTEB_CUSTOM CustomTeb; + PULONG TlsIdx; + TlsHack* TlsHackEntry; + ULONG_PTR* ThreadLocalStoragePointer; + ULONG_PTR* ThreadLocalStoragePointerNew, ImageBase; + CHAR Buffer[256]; + CHAR ModuleName[128]; + DWORD BufferWritten; + + memset(Buffer, 0, 256); + + + if (!DllBase) + return; + if (!TebAddr) + CustomTeb = (PTEB_CUSTOM)NtCurrentTeb(); + else + CustomTeb = TebAddr; + + if ((LOBYTE(GetVersion()) >= 6)) + return; // Nothing to do here + + TlsDirectory = GetTlsDirectory(DllBase, &ImageBase); + + if (!TlsDirectory) + return; + + ThreadLocalStoragePointer = CustomTeb->ThreadLocalStoragePointer; + + TlsIdx = (PULONG)((TlsDirectory->AddressOfIndex)); //- ImageBase)); + DllBase); + + if (CustomTeb->SystemReserved1[0x35] >= *TlsIdx) { + // GetModuleFileNameA(DllBase, ModuleName, 128); + // int buffer_size = wsprintfA(Buffer, "Thread ID %d: TLS failed due to TlsIdx below current max slot, %d out of %d, %s\r\n", GetCurrentThreadId(), + // CustomTeb->SystemReserved1[0x35], *TlsIdx, ModuleName); + + // WriteFile(g_hFile, Buffer, buffer_size, &BufferWritten, NULL); + return; + } + + CustomTeb->SystemReserved1[0x35] = *TlsIdx; + ThreadLocalStoragePointerNew = (ULONG_PTR*)HeapAlloc(CustomTeb->ProcessEnvironmentBlock->ProcessHeap, HEAP_ZERO_MEMORY, (*TlsIdx + 2) * sizeof(ULONG_PTR)); + + if (ThreadLocalStoragePointer) + { + for (i = 0; i < *TlsIdx; i++) + { + if (i == 0) + { + TlsHackEntry = (TlsHack*)ThreadLocalStoragePointer[i]; + // TlsHackEntry->Ptr2 = 0; // Provisional Supermium 121 hack. + } + ThreadLocalStoragePointerNew[i] = ThreadLocalStoragePointer[i]; + } + } + + //int buffer_size = wsprintfA(Buffer, "Thread ID %d: TLS request successful\r\n", GetCurrentThreadId()); + + //WriteFile(g_hFile, Buffer, buffer_size, &BufferWritten, NULL); + + ThreadLocalStoragePointerNew[*TlsIdx] = (ULONG_PTR)HeapAlloc(CustomTeb->ProcessEnvironmentBlock->ProcessHeap, HEAP_ZERO_MEMORY, + TlsDirectory->EndAddressOfRawData - TlsDirectory->StartAddressOfRawData); +// if (CustomTeb->SystemReserved1[0x35] == *TlsIdx) +// ThreadLocalStoragePointerNew[*TlsIdx + 1] = 0xABABABAB; + + RtlMoveMemory((PVOID)ThreadLocalStoragePointerNew[*TlsIdx], (PVOID)(TlsDirectory->StartAddressOfRawData), + TlsDirectory->EndAddressOfRawData - TlsDirectory->StartAddressOfRawData); + +// if (ThreadLocalStoragePointer) +// HeapFree(CustomTeb->ProcessEnvironmentBlock->ProcessHeap, 0, ThreadLocalStoragePointer); + + CustomTeb->ThreadLocalStoragePointer = ThreadLocalStoragePointerNew; +} \ No newline at end of file diff --git a/user.c b/user.c new file mode 100644 index 0000000..7dc36ed --- /dev/null +++ b/user.c @@ -0,0 +1,244 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +BOOL WINAPI Implementation_RegisterTouchWindow( + HWND hwnd, + ULONG ulFlags) +{ + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; +} + +LONG WINAPI Implementation_GetDisplayConfigBufferSizes( + UINT32 flags, + UINT32 *numPathArrayElements, + UINT32 *numModeInfoArrayElements +) +{ + return ERROR_NOT_SUPPORTED; +} + +BOOL WINAPI Implementation_CloseTouchInputHandle( + HTOUCHINPUT hTouchInput +) +{ + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; +} + +BOOL WINAPI Implementation_GetGestureInfo( + HGESTUREINFO hGestureInfo, + PGESTUREINFO pGestureInfo +) +{ + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; +} + +LONG WINAPI Implementation_DisplayConfigGetDeviceInfo( + DISPLAYCONFIG_DEVICE_INFO_HEADER *requestPacket +) +{ + return ERROR_NOT_SUPPORTED; +} + +LONG WINAPI Implementation_DisplayConfigSetDeviceInfo( + DISPLAYCONFIG_DEVICE_INFO_HEADER *setPacket +) +{ + return ERROR_NOT_SUPPORTED; +} + +LONG WINAPI Implementation_QueryDisplayConfig( + UINT32 flags, + UINT32 *numPathArrayElements, + DISPLAYCONFIG_PATH_INFO *pathArray, + UINT32 *numModeInfoArrayElements, + DISPLAYCONFIG_MODE_INFO *modeInfoArray, + DISPLAYCONFIG_TOPOLOGY_ID *currentTopologyId +) +{ + return ERROR_NOT_SUPPORTED; +} + +HPOWERNOTIFY WINAPI Implementation_RegisterPowerSettingNotification( + HANDLE hRecipient, + LPCGUID PowerSettingGuid, + DWORD Flags +) +{ + return NULL; +} + +BOOL WINAPI Implementation_UnregisterPowerSettingNotification( + HPOWERNOTIFY Handle +) +{ + return TRUE; +} + +BOOL WINAPI Implementation_SetProcessDPIAware() +{ + return TRUE; +} + +BOOL WINAPI Implementation_SystemParametersInfoW( + UINT uiAction, + UINT uiParam, + PVOID pvParam, + UINT fWinIni +) +/* + The function is "moved" here in the event of possible expansion for win2k purposes. +*/ +{ + BOOL Result; + PNONCLIENTMETRICSW ncm; + typedef BOOL (WINAPI* pfnSystemParametersInfoW)(UINT, UINT, PVOID, UINT); + pfnSystemParametersInfoW pSysParams = (pfnSystemParametersInfoW)Implementation_GetProcAddress(GetModuleHandleA("user32.dll"), "SystemParametersInfoW"); + Result = pSysParams(uiAction, uiParam, pvParam, fWinIni); + + if(!Result) + { + if(uiAction == SPI_GETNONCLIENTMETRICS) + { + if(pvParam) + { + ncm = (PNONCLIENTMETRICSW)pvParam; + + ncm->cbSize -= sizeof(int); + + uiParam -= sizeof(int); + + Result = pSysParams(uiAction, uiParam, pvParam, fWinIni); + } + } + } + + return Result; +} + +HRESULT WINAPI Implementation_GetDpiForMonitor( + HMONITOR hmonitor, + MONITOR_DPI_TYPE dpiType, + UINT *dpiX, + UINT *dpiY +) +{ + HDC hDC; + INT index; + hDC = GetDC(NULL); + *dpiX = GetDeviceCaps(hDC, LOGPIXELSX); + *dpiY = GetDeviceCaps(hDC, LOGPIXELSY); + ReleaseDC(NULL, hDC); + return S_OK; +} + +BOOL WINAPI Implementation_GetLayeredWindowAttributes( + HWND hwnd, + COLORREF *pcrKey, + BYTE *pbAlpha, + DWORD *pdwFlags +) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI Implementation_PrintWindow( + HWND hwnd, + HDC hdcBlt, + UINT nFlags +) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +LRESULT WINAPI Implementation_DefRawInputProc( + PRAWINPUT *paRawInput, + INT nInput, + UINT cbSizeHeader +) +{ + return -1; +} + +UINT WINAPI Implementation_GetRawInputData( + HRAWINPUT hRawInput, + UINT uiCommand, + LPVOID pData, + PUINT pcbSize, + UINT cbSizeHeader +) +{ + return(UINT)-1; +} + +UINT WINAPI Implementation_GetRawInputDeviceInfoW( + HANDLE hDevice, + UINT uiCommand, + LPVOID pData, + PUINT pcbSize +) +{ + return(UINT)-1; +} + +UINT WINAPI Implementation_GetRawInputDeviceList( + PRAWINPUTDEVICELIST pRawInputDeviceList, + PUINT puiNumDevices, + UINT cbSize +) +{ + return(UINT)-1; +} + +BOOL WINAPI Implementation_RegisterRawInputDevices( + PCRAWINPUTDEVICE pRawInputDevices, + UINT uiNumDevices, + UINT cbSize +) +{ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI Implementation_UnhookWindowsHookEx( + HHOOK hhk +) +{ + typedef BOOL(WINAPI* pfnUnhookWindowsHookEx)(HHOOK); + pfnUnhookWindowsHookEx pUnhookWindowsHookEx = (pfnUnhookWindowsHookEx)Implementation_GetProcAddress(GetModuleHandleA("user32.dll"), "UnhookWindowsHookEx"); + return pUnhookWindowsHookEx(hhk); +} + +BOOL WINAPI Implementation_RegisterPointerDeviceNotifications( + HWND window, + BOOL notifyRange +) +// Chromium doesn't react to it. I could return TRUE because no notifications will be sent either way, but I shouldn't lie about that +// unless necessary. +{ + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; +} + +BOOL WINAPI Implementation_GetPointerDevices( + UINT32* deviceCount, + POINTER_DEVICE_INFO* pointerDevices +) +{ + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; +} + +BOOL WINAPI Implementation_GetPointerDevice( + HANDLE device, + POINTER_DEVICE_INFO* pointerDevice +) +{ + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; +} \ No newline at end of file diff --git a/wer.c b/wer.c new file mode 100644 index 0000000..31a3f99 --- /dev/null +++ b/wer.c @@ -0,0 +1,11 @@ +#include "progwrp.h" +#include "export.h" +#include "implementations.h" + +HRESULT WINAPI Implementation_WerRegisterRuntimeExceptionModule( + PCWSTR pwszOutOfProcessCallbackDll, + PVOID pContext +) +{ + return E_NOTIMPL; +} \ No newline at end of file diff --git a/x64/Release/BuildLog.htm b/x64/Release/BuildLog.htm new file mode 100644 index 0000000..b97d2a5 Binary files /dev/null and b/x64/Release/BuildLog.htm differ diff --git a/x64/Release/RCa12784 b/x64/Release/RCa12784 new file mode 100644 index 0000000..12742c0 Binary files /dev/null and b/x64/Release/RCa12784 differ diff --git a/x64/Release/RCa30380 b/x64/Release/RCa30380 new file mode 100644 index 0000000..79f1eec Binary files /dev/null and b/x64/Release/RCa30380 differ diff --git a/x64/Release/RCa75016 b/x64/Release/RCa75016 new file mode 100644 index 0000000..b390552 Binary files /dev/null and b/x64/Release/RCa75016 differ diff --git a/x64/Release/advapi.obj b/x64/Release/advapi.obj new file mode 100644 index 0000000..0048ecd Binary files /dev/null and b/x64/Release/advapi.obj differ diff --git a/x64/Release/combase.obj b/x64/Release/combase.obj new file mode 100644 index 0000000..b27476d Binary files /dev/null and b/x64/Release/combase.obj differ diff --git a/x64/Release/condvar.obj b/x64/Release/condvar.obj new file mode 100644 index 0000000..1fa97fa Binary files /dev/null and b/x64/Release/condvar.obj differ diff --git a/x64/Release/dbg.obj b/x64/Release/dbg.obj new file mode 100644 index 0000000..b128b79 Binary files /dev/null and b/x64/Release/dbg.obj differ diff --git a/x64/Release/dllmain.obj b/x64/Release/dllmain.obj new file mode 100644 index 0000000..1d75688 Binary files /dev/null and b/x64/Release/dllmain.obj differ diff --git a/x64/Release/dwmapi.obj b/x64/Release/dwmapi.obj new file mode 100644 index 0000000..0201180 Binary files /dev/null and b/x64/Release/dwmapi.obj differ diff --git a/x64/Release/dwrite.obj b/x64/Release/dwrite.obj new file mode 100644 index 0000000..1486871 Binary files /dev/null and b/x64/Release/dwrite.obj differ diff --git a/x64/Release/dxgi.obj b/x64/Release/dxgi.obj new file mode 100644 index 0000000..6d10657 Binary files /dev/null and b/x64/Release/dxgi.obj differ diff --git a/x64/Release/evt_log.obj b/x64/Release/evt_log.obj new file mode 100644 index 0000000..63f26b9 Binary files /dev/null and b/x64/Release/evt_log.obj differ diff --git a/x64/Release/exports.obj b/x64/Release/exports.obj new file mode 100644 index 0000000..ffcbc4a Binary files /dev/null and b/x64/Release/exports.obj differ diff --git a/x64/Release/fiber.obj b/x64/Release/fiber.obj new file mode 100644 index 0000000..dc29a15 Binary files /dev/null and b/x64/Release/fiber.obj differ diff --git a/x64/Release/file.obj b/x64/Release/file.obj new file mode 100644 index 0000000..bfd184a Binary files /dev/null and b/x64/Release/file.obj differ diff --git a/x64/Release/initonce.obj b/x64/Release/initonce.obj new file mode 100644 index 0000000..840f3b5 Binary files /dev/null and b/x64/Release/initonce.obj differ diff --git a/x64/Release/ip.obj b/x64/Release/ip.obj new file mode 100644 index 0000000..8f88592 Binary files /dev/null and b/x64/Release/ip.obj differ diff --git a/x64/Release/library.obj b/x64/Release/library.obj new file mode 100644 index 0000000..a378e0a Binary files /dev/null and b/x64/Release/library.obj differ diff --git a/x64/Release/locale.obj b/x64/Release/locale.obj new file mode 100644 index 0000000..2997a10 Binary files /dev/null and b/x64/Release/locale.obj differ diff --git a/x64/Release/misc.obj b/x64/Release/misc.obj new file mode 100644 index 0000000..d8b1845 Binary files /dev/null and b/x64/Release/misc.obj differ diff --git a/x64/Release/module.obj b/x64/Release/module.obj new file mode 100644 index 0000000..8de3880 Binary files /dev/null and b/x64/Release/module.obj differ diff --git a/x64/Release/ole32.obj b/x64/Release/ole32.obj new file mode 100644 index 0000000..c84d2fa Binary files /dev/null and b/x64/Release/ole32.obj differ diff --git a/x64/Release/power.obj b/x64/Release/power.obj new file mode 100644 index 0000000..eca6470 Binary files /dev/null and b/x64/Release/power.obj differ diff --git a/x64/Release/processor.obj b/x64/Release/processor.obj new file mode 100644 index 0000000..b9f6005 Binary files /dev/null and b/x64/Release/processor.obj differ diff --git a/x64/Release/procthread.obj b/x64/Release/procthread.obj new file mode 100644 index 0000000..90e43fc Binary files /dev/null and b/x64/Release/procthread.obj differ diff --git a/x64/Release/product.obj b/x64/Release/product.obj new file mode 100644 index 0000000..aab434d Binary files /dev/null and b/x64/Release/product.obj differ diff --git a/x64/Release/progwrp.dll.recipe b/x64/Release/progwrp.dll.recipe new file mode 100644 index 0000000..b564dcc --- /dev/null +++ b/x64/Release/progwrp.dll.recipe @@ -0,0 +1,11 @@ + + + + + K:\progwrp\x64\Release\progwrp.dll + + + + + + \ No newline at end of file diff --git a/x64/Release/progwrp.log b/x64/Release/progwrp.log new file mode 100644 index 0000000..824846d --- /dev/null +++ b/x64/Release/progwrp.log @@ -0,0 +1 @@ + progwrp.vcxproj -> K:\progwrp\x64\Release\progwrp.dll diff --git a/x64/Release/progwrp.tlog/CL.command.1.tlog b/x64/Release/progwrp.tlog/CL.command.1.tlog new file mode 100644 index 0000000..b881e75 Binary files /dev/null and b/x64/Release/progwrp.tlog/CL.command.1.tlog differ diff --git a/x64/Release/progwrp.tlog/CL.read.1.tlog b/x64/Release/progwrp.tlog/CL.read.1.tlog new file mode 100644 index 0000000..c0e3fc2 Binary files /dev/null and b/x64/Release/progwrp.tlog/CL.read.1.tlog differ diff --git a/x64/Release/progwrp.tlog/CL.write.1.tlog b/x64/Release/progwrp.tlog/CL.write.1.tlog new file mode 100644 index 0000000..3bf9d04 Binary files /dev/null and b/x64/Release/progwrp.tlog/CL.write.1.tlog differ diff --git a/x64/Release/progwrp.tlog/Cl.items.tlog b/x64/Release/progwrp.tlog/Cl.items.tlog new file mode 100644 index 0000000..3a9ed56 --- /dev/null +++ b/x64/Release/progwrp.tlog/Cl.items.tlog @@ -0,0 +1,32 @@ +K:\progwrp\progwrp\advapi.c;K:\progwrp\progwrp\x64\Release\advapi.obj +K:\progwrp\progwrp\combase.c;K:\progwrp\progwrp\x64\Release\combase.obj +K:\progwrp\progwrp\condvar.c;K:\progwrp\progwrp\x64\Release\condvar.obj +K:\progwrp\progwrp\dbg.c;K:\progwrp\progwrp\x64\Release\dbg.obj +K:\progwrp\progwrp\dllmain.c;K:\progwrp\progwrp\x64\Release\dllmain.obj +K:\progwrp\progwrp\dwmapi.c;K:\progwrp\progwrp\x64\Release\dwmapi.obj +K:\progwrp\progwrp\dwrite.c;K:\progwrp\progwrp\x64\Release\dwrite.obj +K:\progwrp\progwrp\dxgi.c;K:\progwrp\progwrp\x64\Release\dxgi.obj +K:\progwrp\progwrp\evt_log.c;K:\progwrp\progwrp\x64\Release\evt_log.obj +K:\progwrp\progwrp\exports.c;K:\progwrp\progwrp\x64\Release\exports.obj +K:\progwrp\progwrp\fiber.c;K:\progwrp\progwrp\x64\Release\fiber.obj +K:\progwrp\progwrp\file.c;K:\progwrp\progwrp\x64\Release\file.obj +K:\progwrp\progwrp\initonce.c;K:\progwrp\progwrp\x64\Release\initonce.obj +K:\progwrp\progwrp\ip.c;K:\progwrp\progwrp\x64\Release\ip.obj +K:\progwrp\progwrp\locale.c;K:\progwrp\progwrp\x64\Release\locale.obj +K:\progwrp\progwrp\misc.c;K:\progwrp\progwrp\x64\Release\misc.obj +K:\progwrp\progwrp\module.c;K:\progwrp\progwrp\x64\Release\module.obj +K:\progwrp\progwrp\ole32.c;K:\progwrp\progwrp\x64\Release\ole32.obj +K:\progwrp\progwrp\power.c;K:\progwrp\progwrp\x64\Release\power.obj +K:\progwrp\progwrp\processor.c;K:\progwrp\progwrp\x64\Release\processor.obj +K:\progwrp\progwrp\procthread.c;K:\progwrp\progwrp\x64\Release\procthread.obj +K:\progwrp\progwrp\product.c;K:\progwrp\progwrp\x64\Release\product.obj +K:\progwrp\progwrp\psapi.c;K:\progwrp\progwrp\x64\Release\psapi.obj +K:\progwrp\progwrp\ptr.c;K:\progwrp\progwrp\x64\Release\ptr.obj +K:\progwrp\progwrp\registry.c;K:\progwrp\progwrp\x64\Release\registry.obj +K:\progwrp\progwrp\setupapi.c;K:\progwrp\progwrp\x64\Release\setupapi.obj +K:\progwrp\progwrp\shell.c;K:\progwrp\progwrp\x64\Release\shell.obj +K:\progwrp\progwrp\srw.c;K:\progwrp\progwrp\x64\Release\srw.obj +K:\progwrp\progwrp\synch.c;K:\progwrp\progwrp\x64\Release\synch.obj +K:\progwrp\progwrp\tls.c;K:\progwrp\progwrp\x64\Release\tls.obj +K:\progwrp\progwrp\user.c;K:\progwrp\progwrp\x64\Release\user.obj +K:\progwrp\progwrp\wer.c;K:\progwrp\progwrp\x64\Release\wer.obj diff --git a/x64/Release/progwrp.tlog/link.command.1.tlog b/x64/Release/progwrp.tlog/link.command.1.tlog new file mode 100644 index 0000000..3a89034 Binary files /dev/null and b/x64/Release/progwrp.tlog/link.command.1.tlog differ diff --git a/x64/Release/progwrp.tlog/link.read.1.tlog b/x64/Release/progwrp.tlog/link.read.1.tlog new file mode 100644 index 0000000..a0f4be5 Binary files /dev/null and b/x64/Release/progwrp.tlog/link.read.1.tlog differ diff --git a/x64/Release/progwrp.tlog/link.secondary.1.tlog b/x64/Release/progwrp.tlog/link.secondary.1.tlog new file mode 100644 index 0000000..3b0aeb5 --- /dev/null +++ b/x64/Release/progwrp.tlog/link.secondary.1.tlog @@ -0,0 +1,3 @@ +^C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\ADVAPI.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\COMBASE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\CONDVAR.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\DBG.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\DLLMAIN.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\DWMAPI.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\DWRITE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\DXGI.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\EVT_LOG.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\EXPORTS.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\FIBER.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\FILE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\INITONCE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\IP.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\LOCALE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\MISC.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\MODULE.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\OLE32.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\POWER.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\PROCESSOR.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\PROCTHREAD.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\PRODUCT.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\PSAPI.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\PTR.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\REGISTRY.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\RSRC.RES|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\SETUPAPI.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\SHELL.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\SRW.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\SYNCH.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\TLS.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\USER.OBJ|C:\USERS\WIN32\DOCUMENTS\PROGWRP\PROGWRP\X64\RELEASE\WER.OBJ +C:\Users\win32\Documents\progwrp\x64\Release\progwrp.lib +C:\Users\win32\Documents\progwrp\x64\Release\progwrp.EXP diff --git a/x64/Release/progwrp.tlog/link.write.1.tlog b/x64/Release/progwrp.tlog/link.write.1.tlog new file mode 100644 index 0000000..f83710c Binary files /dev/null and b/x64/Release/progwrp.tlog/link.write.1.tlog differ diff --git a/x64/Release/progwrp.tlog/link.write.2u.tlog b/x64/Release/progwrp.tlog/link.write.2u.tlog new file mode 100644 index 0000000..809f9e3 Binary files /dev/null and b/x64/Release/progwrp.tlog/link.write.2u.tlog differ diff --git a/x64/Release/progwrp.tlog/progwrp.lastbuildstate b/x64/Release/progwrp.tlog/progwrp.lastbuildstate new file mode 100644 index 0000000..f93f73f --- /dev/null +++ b/x64/Release/progwrp.tlog/progwrp.lastbuildstate @@ -0,0 +1,2 @@ +PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.37.32822:TargetPlatformVersion=10.0.22621.0: +Release|x64|K:\progwrp\| diff --git a/x64/Release/progwrp.tlog/rc.command.1.tlog b/x64/Release/progwrp.tlog/rc.command.1.tlog new file mode 100644 index 0000000..4b115bc Binary files /dev/null and b/x64/Release/progwrp.tlog/rc.command.1.tlog differ diff --git a/x64/Release/progwrp.tlog/rc.read.1.tlog b/x64/Release/progwrp.tlog/rc.read.1.tlog new file mode 100644 index 0000000..ddfba18 Binary files /dev/null and b/x64/Release/progwrp.tlog/rc.read.1.tlog differ diff --git a/x64/Release/progwrp.tlog/rc.write.1.tlog b/x64/Release/progwrp.tlog/rc.write.1.tlog new file mode 100644 index 0000000..9d77fee Binary files /dev/null and b/x64/Release/progwrp.tlog/rc.write.1.tlog differ diff --git a/x64/Release/psapi.obj b/x64/Release/psapi.obj new file mode 100644 index 0000000..bc66b17 Binary files /dev/null and b/x64/Release/psapi.obj differ diff --git a/x64/Release/ptr.obj b/x64/Release/ptr.obj new file mode 100644 index 0000000..7821f9d Binary files /dev/null and b/x64/Release/ptr.obj differ diff --git a/x64/Release/registry.obj b/x64/Release/registry.obj new file mode 100644 index 0000000..4a4a9fa Binary files /dev/null and b/x64/Release/registry.obj differ diff --git a/x64/Release/rsrc.res b/x64/Release/rsrc.res new file mode 100644 index 0000000..f5170eb Binary files /dev/null and b/x64/Release/rsrc.res differ diff --git a/x64/Release/setupapi.obj b/x64/Release/setupapi.obj new file mode 100644 index 0000000..38a2ba0 Binary files /dev/null and b/x64/Release/setupapi.obj differ diff --git a/x64/Release/shell.obj b/x64/Release/shell.obj new file mode 100644 index 0000000..29e1527 Binary files /dev/null and b/x64/Release/shell.obj differ diff --git a/x64/Release/srw.obj b/x64/Release/srw.obj new file mode 100644 index 0000000..34fb378 Binary files /dev/null and b/x64/Release/srw.obj differ diff --git a/x64/Release/synch.obj b/x64/Release/synch.obj new file mode 100644 index 0000000..2f7b28e Binary files /dev/null and b/x64/Release/synch.obj differ diff --git a/x64/Release/thread.obj b/x64/Release/thread.obj new file mode 100644 index 0000000..b7289b3 Binary files /dev/null and b/x64/Release/thread.obj differ diff --git a/x64/Release/tls.obj b/x64/Release/tls.obj new file mode 100644 index 0000000..211f5cb Binary files /dev/null and b/x64/Release/tls.obj differ diff --git a/x64/Release/user.obj b/x64/Release/user.obj new file mode 100644 index 0000000..edbd004 Binary files /dev/null and b/x64/Release/user.obj differ diff --git a/x64/Release/vc90.idb b/x64/Release/vc90.idb new file mode 100644 index 0000000..9bcd509 Binary files /dev/null and b/x64/Release/vc90.idb differ diff --git a/x64/Release/vc90.pdb b/x64/Release/vc90.pdb new file mode 100644 index 0000000..42743e3 Binary files /dev/null and b/x64/Release/vc90.pdb differ diff --git a/x64/Release/wer.obj b/x64/Release/wer.obj new file mode 100644 index 0000000..f45f866 Binary files /dev/null and b/x64/Release/wer.obj differ