-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix D3D11/DXGI Wrapper + Initial x64 Hook Compatibility
- Loading branch information
1 parent
5131398
commit b74fbc1
Showing
9 changed files
with
176 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
namespace StringReloads.Hook | ||
{ | ||
public unsafe class MultiByteToWideChar : Base.Hook<MultiByteToWideCharDelegate> | ||
{ | ||
public override string Library => "Kernel32.dll"; | ||
|
||
public override string Export => "MultiByteToWideChar"; | ||
|
||
public override void Initialize() | ||
{ | ||
HookDelegate = new MultiByteToWideCharDelegate(hMultiByteToWideChar); | ||
Compile(); | ||
} | ||
|
||
private int hMultiByteToWideChar(uint CodePage, uint dwFlags, byte* lpMultiByteStr, int cbMultiByte, ushort* lpWideCharStr, int cchWideChar) | ||
{ | ||
int Rst = 0; | ||
if (cbMultiByte > 0) | ||
{ | ||
byte[] Buffer = new byte[cbMultiByte]; | ||
for (int i = 0; i < Buffer.Length; i++) | ||
{ | ||
Buffer[i] = *(lpMultiByteStr + i); | ||
} | ||
fixed (void* pBuffer = &Buffer[0]) | ||
{ | ||
Uninstall(); | ||
lpMultiByteStr = (byte*)EntryPoint.Process(pBuffer); | ||
Install(); | ||
Rst = Bypass(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar); | ||
} | ||
|
||
} else { | ||
Uninstall(); | ||
lpMultiByteStr = (byte*)EntryPoint.Process((void*)lpMultiByteStr); | ||
Install(); | ||
Rst = Bypass(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar); | ||
} | ||
return Rst; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters