Synchronise VS 2010 solution with [4112].
This commit is contained in:
+1
-1
@@ -131,7 +131,7 @@
|
||||
|
||||
/* Fucking Visual Studio should just shut the fuck up with this fucking
|
||||
* warning about fucking ISO C++ when we fucking compile fucking C. */
|
||||
#pragma warning(disable: 4996)
|
||||
#pragma warning(disable: 4996)
|
||||
|
||||
/* Win32-specific, of course. */
|
||||
typedef signed long long int int64_t;
|
||||
|
||||
+25
-24
@@ -51,7 +51,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\msvc;..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@@ -78,7 +78,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\msvc;..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<ObjectFileName>$(IntDir).libs/</ObjectFileName>
|
||||
@@ -104,30 +104,31 @@
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\debug.c" />
|
||||
<ClCompile Include="..\src\fd.c" />
|
||||
<ClCompile Include="..\src\fuzz.c" />
|
||||
<ClCompile Include="..\src\lib-fd.c" />
|
||||
<ClCompile Include="..\src\lib-mem.c" />
|
||||
<ClCompile Include="..\src\lib-signal.c" />
|
||||
<ClCompile Include="..\src\lib-stream.c" />
|
||||
<ClCompile Include="..\src\libzzuf.c" />
|
||||
<ClCompile Include="..\src\network.c" />
|
||||
<ClCompile Include="..\src\random.c" />
|
||||
<ClCompile Include="..\src\ranges.c" />
|
||||
<ClCompile Include="..\src\sys.c" />
|
||||
<ClInclude Include="..\src\common\common.h" />
|
||||
<ClInclude Include="..\src\common\fd.h" />
|
||||
<ClInclude Include="..\src\common\fuzz.h" />
|
||||
<ClInclude Include="..\src\common\random.h" />
|
||||
<ClInclude Include="..\src\common\ranges.h" />
|
||||
<ClInclude Include="..\src\libzzuf\debug.h" />
|
||||
<ClInclude Include="..\src\libzzuf\lib-load.h" />
|
||||
<ClInclude Include="..\src\libzzuf\libzzuf.h" />
|
||||
<ClInclude Include="..\src\libzzuf\network.h" />
|
||||
<ClInclude Include="..\src\libzzuf\sys.h" />
|
||||
<ClInclude Include="config.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="config.h" />
|
||||
<ClInclude Include="..\src\debug.h" />
|
||||
<ClInclude Include="..\src\fd.h" />
|
||||
<ClInclude Include="..\src\fuzz.h" />
|
||||
<ClInclude Include="..\src\lib-load.h" />
|
||||
<ClInclude Include="..\src\libzzuf.h" />
|
||||
<ClInclude Include="..\src\network.h" />
|
||||
<ClInclude Include="..\src\random.h" />
|
||||
<ClInclude Include="..\src\ranges.h" />
|
||||
<ClInclude Include="..\src\sys.h" />
|
||||
<ClCompile Include="..\src\common\fd.c" />
|
||||
<ClCompile Include="..\src\common\fuzz.c" />
|
||||
<ClCompile Include="..\src\common\random.c" />
|
||||
<ClCompile Include="..\src\common\ranges.c" />
|
||||
<ClCompile Include="..\src\libzzuf\debug.c" />
|
||||
<ClCompile Include="..\src\libzzuf\lib-fd.c" />
|
||||
<ClCompile Include="..\src\libzzuf\lib-mem.c" />
|
||||
<ClCompile Include="..\src\libzzuf\lib-signal.c" />
|
||||
<ClCompile Include="..\src\libzzuf\lib-stream.c" />
|
||||
<ClCompile Include="..\src\libzzuf\libzzuf.c" />
|
||||
<ClCompile Include="..\src\libzzuf\network.c" />
|
||||
<ClCompile Include="..\src\libzzuf\sys.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
+21
-21
@@ -51,7 +51,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\msvc;..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@@ -73,7 +73,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\msvc;..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@@ -93,29 +93,29 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\fd.c" />
|
||||
<ClCompile Include="..\src\fuzz.c" />
|
||||
<ClCompile Include="..\src\md5.c" />
|
||||
<ClCompile Include="..\src\mygetopt.c" />
|
||||
<ClCompile Include="..\src\opts.c" />
|
||||
<ClCompile Include="..\src\random.c" />
|
||||
<ClCompile Include="..\src\ranges.c" />
|
||||
<ClCompile Include="..\src\timer.c" />
|
||||
<ClCompile Include="..\src\zzuf.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(FileName)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(FileName)1.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="config.h" />
|
||||
<ClInclude Include="..\src\fd.h" />
|
||||
<ClInclude Include="..\src\fuzz.h" />
|
||||
<ClInclude Include="..\src\common\common.h" />
|
||||
<ClInclude Include="..\src\common\fd.h" />
|
||||
<ClInclude Include="..\src\common\fuzz.h" />
|
||||
<ClInclude Include="..\src\common\random.h" />
|
||||
<ClInclude Include="..\src\common\ranges.h" />
|
||||
<ClInclude Include="..\src\md5.h" />
|
||||
<ClInclude Include="..\src\myfork.h" />
|
||||
<ClInclude Include="..\src\mygetopt.h" />
|
||||
<ClInclude Include="..\src\opts.h" />
|
||||
<ClInclude Include="..\src\random.h" />
|
||||
<ClInclude Include="..\src\ranges.h" />
|
||||
<ClInclude Include="..\src\timer.h" />
|
||||
<ClInclude Include="config.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\common\fd.c" />
|
||||
<ClCompile Include="..\src\common\fuzz.c" />
|
||||
<ClCompile Include="..\src\common\random.c" />
|
||||
<ClCompile Include="..\src\common\ranges.c" />
|
||||
<ClCompile Include="..\src\md5.c" />
|
||||
<ClCompile Include="..\src\myfork.c" />
|
||||
<ClCompile Include="..\src\mygetopt.c" />
|
||||
<ClCompile Include="..\src\opts.c" />
|
||||
<ClCompile Include="..\src\timer.c" />
|
||||
<ClCompile Include="..\src\zzuf.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
+33
-26
@@ -265,8 +265,8 @@ static int run_process(struct opts *opts, int pipes[][2])
|
||||
return -1;
|
||||
|
||||
/* Get the child process's entry point address */
|
||||
epaddr = (void *)(get_base_address(pinfo.dwProcessId)
|
||||
+ get_entry_point_offset(opts->newargv[0]));
|
||||
epaddr = (void *)get_entry_point(opts->newargv[0],
|
||||
pinfo.dwProcessId);
|
||||
if(!epaddr)
|
||||
return -1;
|
||||
|
||||
@@ -413,30 +413,9 @@ static int dll_inject(void *process, void *epaddr, char const *lib)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Find the process's base address once it is loaded in memory (the header
|
||||
* information is unreliable because of Vista's ASLR). */
|
||||
static intptr_t get_base_address(DWORD pid)
|
||||
{
|
||||
MODULEENTRY32 entry;
|
||||
intptr_t ret = 0;
|
||||
void *list;
|
||||
int k;
|
||||
|
||||
list = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
|
||||
entry.dwSize = sizeof(entry);
|
||||
for(k = Module32First(list, &entry); k; k = Module32Next(list, &entry))
|
||||
{
|
||||
/* FIXME: how do we select the correct module? */
|
||||
ret = (intptr_t)entry.modBaseAddr;
|
||||
}
|
||||
CloseHandle(list);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Find the process's entry point address offset. The information is in
|
||||
* the file's PE header. */
|
||||
static intptr_t get_entry_point_offset(char const *name)
|
||||
static intptr_t get_entry_point(char const *name, DWORD pid)
|
||||
{
|
||||
PIMAGE_DOS_HEADER dos;
|
||||
PIMAGE_NT_HEADERS nt;
|
||||
@@ -471,7 +450,14 @@ static intptr_t get_entry_point_offset(char const *name)
|
||||
&& nt->FileHeader.Machine == IMAGE_FILE_MACHINE_I386
|
||||
&& nt->OptionalHeader.Magic == 0x10b /* IMAGE_NT_OPTIONAL_HDR32_MAGIC */)
|
||||
{
|
||||
ret = (intptr_t)nt->OptionalHeader.AddressOfEntryPoint;
|
||||
ret = get_base_address(pid);
|
||||
/* Base address not found in the running process. Falling back
|
||||
* to the header's information, which is unreliable because of
|
||||
* Vista's address space randomisation. */
|
||||
if (!ret)
|
||||
ret = (intptr_t)nt->OptionalHeader.BaseOfCode;
|
||||
|
||||
ret += (intptr_t)nt->OptionalHeader.AddressOfEntryPoint;
|
||||
}
|
||||
|
||||
UnmapViewOfFile(base);
|
||||
@@ -480,5 +466,26 @@ static intptr_t get_entry_point_offset(char const *name)
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Find the process's base address once it is loaded in memory (the header
|
||||
* information is unreliable because of Vista's ASLR). */
|
||||
static intptr_t get_base_address(DWORD pid)
|
||||
{
|
||||
MODULEENTRY32 entry;
|
||||
intptr_t ret = 0;
|
||||
void *list;
|
||||
int k;
|
||||
|
||||
list = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
|
||||
entry.dwSize = sizeof(entry);
|
||||
for(k = Module32First(list, &entry); k; k = Module32Next(list, &entry))
|
||||
{
|
||||
/* FIXME: how do we select the correct module? */
|
||||
ret = (intptr_t)entry.modBaseAddr;
|
||||
}
|
||||
CloseHandle(list);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user