Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors in win7 sp1 x64 #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sifilemgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int FindU8FlagFromLink(char* title)
{
char filename[256];
GetFilenameFromPath(cur->fileinfo.orgfile, filename);
if(strcasecmp(filename, Trim(title)) == 0)
if(_stricmp(filename, Trim(title)) == 0)
{
count++;
last = cur;
Expand Down
3 changes: 2 additions & 1 deletion siloaderex/loaderex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CHAR szDllPath[1024];
CHAR szCommand[2048];
CHAR szPath[1024];

#define HOOK_DLL "loaderdll.dll"
//////////////////////////////////////////////////////////////////////////////
//
static BOOL CALLBACK ListBywayCallback(PVOID pContext,
Expand Down Expand Up @@ -48,7 +49,7 @@ static BOOL CALLBACK AddBywayCallback(PVOID pContext,
PBOOL pbAddedDll = (PBOOL)pContext;
if (!pszFile && !*pbAddedDll) { // Add new byway.
*pbAddedDll = TRUE;
*ppszOutFile = szDllPath;
*ppszOutFile = HOOK_DLL;
}
return TRUE;
}
Expand Down
14 changes: 13 additions & 1 deletion siutf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
#include "winapihook.h"
#include "sifilemgr.h"

BOOL g_isHooked = FALSE;

static void HookSI(void)
{
HookWinApi();
if (g_isHooked) {
HookWinApi();
}
}

static void UnhookSI(void)
Expand All @@ -18,6 +22,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
HookSI();
break;

Expand All @@ -34,3 +39,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
return TRUE; // succesful
}

#ifdef _WIN64
#pragma comment(linker, "/EXPORT:VoidExport,@1,NONAME")
#else
#pragma comment(linker, "/EXPORT:_VoidExport,@1,NONAME")
#endif

VOID VoidExport(){}
2 changes: 1 addition & 1 deletion utf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void gbk_to_utf8(const char* gbk,char* u8,DWORD* u8size)
* @param bit [1~8位 低~高]
* @return [1 真 0 假]
*/
static inline int CheckBit(unsigned char value, int bit)
static int CheckBit(unsigned char value, int bit)
{
unsigned char bitvalue[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};

Expand Down
Binary file added vs2013/bin/Release/loaderdll.dll
Binary file not shown.
Binary file added vs2013/bin/Release/siloaderex.exe
Binary file not shown.
115 changes: 115 additions & 0 deletions vs2013/hook.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{59E577EB-5E28-4A32-A32F-849C80DBEDB8}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>hook</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<TargetName>loaderdll</TargetName>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<TargetName>loaderdll</TargetName>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;HOOK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)lib.X86</AdditionalLibraryDirectories>
<AdditionalDependencies>detours.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_WINDOWS;_USRDLL;HOOK_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir)include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(SolutionDir)lib.X86</AdditionalLibraryDirectories>
<AdditionalDependencies>detours.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\hook\hookapi.c" />
<ClCompile Include="..\hook\ldasm.c" />
<ClCompile Include="..\md5.c" />
<ClCompile Include="..\sifilemgr.c" />
<ClCompile Include="..\sihandlemgr.c" />
<ClCompile Include="..\siutf8.c" />
<ClCompile Include="..\utf8.c" />
<ClCompile Include="..\utils.c" />
<ClCompile Include="..\winapihook.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\hook\hookapi.h" />
<ClInclude Include="..\hook\ldasm.h" />
<ClInclude Include="..\md5.h" />
<ClInclude Include="..\sifilemgr.h" />
<ClInclude Include="..\sihandlemgr.h" />
<ClInclude Include="..\utf8.h" />
<ClInclude Include="..\utils.h" />
<ClInclude Include="..\winapihook.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
72 changes: 72 additions & 0 deletions vs2013/hook.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\hook\hookapi.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\hook\ldasm.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\md5.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\sifilemgr.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\sihandlemgr.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\siutf8.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\utf8.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\utils.c">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="..\winapihook.c">
<Filter>源文件</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\hook\hookapi.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\hook\ldasm.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\md5.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\sifilemgr.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\sihandlemgr.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\utf8.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\utils.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="..\winapihook.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup>
</Project>
Loading