Changeset 4137


Ignore:
Timestamp:
Dec 16, 2009, 5:15:40 PM (11 years ago)
Author:
Sam Hocevar
Message:

Synchronise VS 2010 solution with [4112].

Location:
zzuf/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • zzuf/trunk/msvc/libzzuf.vcxproj

    r4100 r4137  
    5252    <ClCompile>
    5353      <Optimization>Disabled</Optimization>
    54       <AdditionalIncludeDirectories>..\msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     54      <AdditionalIncludeDirectories>..\msvc;..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    5555      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    5656      <MinimalRebuild>true</MinimalRebuild>
     
    7979  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    8080    <ClCompile>
    81       <AdditionalIncludeDirectories>..\msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     81      <AdditionalIncludeDirectories>..\msvc;..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    8282      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    8383      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     
    105105  </ItemDefinitionGroup>
    106106  <ItemGroup>
    107     <ClCompile Include="..\src\debug.c" />
    108     <ClCompile Include="..\src\fd.c" />
    109     <ClCompile Include="..\src\fuzz.c" />
    110     <ClCompile Include="..\src\lib-fd.c" />
    111     <ClCompile Include="..\src\lib-mem.c" />
    112     <ClCompile Include="..\src\lib-signal.c" />
    113     <ClCompile Include="..\src\lib-stream.c" />
    114     <ClCompile Include="..\src\libzzuf.c" />
    115     <ClCompile Include="..\src\network.c" />
    116     <ClCompile Include="..\src\random.c" />
    117     <ClCompile Include="..\src\ranges.c" />
    118     <ClCompile Include="..\src\sys.c" />
     107    <ClInclude Include="..\src\common\common.h" />
     108    <ClInclude Include="..\src\common\fd.h" />
     109    <ClInclude Include="..\src\common\fuzz.h" />
     110    <ClInclude Include="..\src\common\random.h" />
     111    <ClInclude Include="..\src\common\ranges.h" />
     112    <ClInclude Include="..\src\libzzuf\debug.h" />
     113    <ClInclude Include="..\src\libzzuf\lib-load.h" />
     114    <ClInclude Include="..\src\libzzuf\libzzuf.h" />
     115    <ClInclude Include="..\src\libzzuf\network.h" />
     116    <ClInclude Include="..\src\libzzuf\sys.h" />
     117    <ClInclude Include="config.h" />
    119118  </ItemGroup>
    120119  <ItemGroup>
    121     <ClInclude Include="config.h" />
    122     <ClInclude Include="..\src\debug.h" />
    123     <ClInclude Include="..\src\fd.h" />
    124     <ClInclude Include="..\src\fuzz.h" />
    125     <ClInclude Include="..\src\lib-load.h" />
    126     <ClInclude Include="..\src\libzzuf.h" />
    127     <ClInclude Include="..\src\network.h" />
    128     <ClInclude Include="..\src\random.h" />
    129     <ClInclude Include="..\src\ranges.h" />
    130     <ClInclude Include="..\src\sys.h" />
     120    <ClCompile Include="..\src\common\fd.c" />
     121    <ClCompile Include="..\src\common\fuzz.c" />
     122    <ClCompile Include="..\src\common\random.c" />
     123    <ClCompile Include="..\src\common\ranges.c" />
     124    <ClCompile Include="..\src\libzzuf\debug.c" />
     125    <ClCompile Include="..\src\libzzuf\lib-fd.c" />
     126    <ClCompile Include="..\src\libzzuf\lib-mem.c" />
     127    <ClCompile Include="..\src\libzzuf\lib-signal.c" />
     128    <ClCompile Include="..\src\libzzuf\lib-stream.c" />
     129    <ClCompile Include="..\src\libzzuf\libzzuf.c" />
     130    <ClCompile Include="..\src\libzzuf\network.c" />
     131    <ClCompile Include="..\src\libzzuf\sys.c" />
    131132  </ItemGroup>
    132133  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  • zzuf/trunk/msvc/zzuf.vcxproj

    r3971 r4137  
    5252    <ClCompile>
    5353      <Optimization>Disabled</Optimization>
    54       <AdditionalIncludeDirectories>..\msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     54      <AdditionalIncludeDirectories>..\msvc;..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    5555      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    5656      <MinimalRebuild>true</MinimalRebuild>
     
    7474  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    7575    <ClCompile>
    76       <AdditionalIncludeDirectories>..\msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     76      <AdditionalIncludeDirectories>..\msvc;..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    7777      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    7878      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
     
    9494  </ItemDefinitionGroup>
    9595  <ItemGroup>
    96     <ClCompile Include="..\src\fd.c" />
    97     <ClCompile Include="..\src\fuzz.c" />
     96    <ClInclude Include="..\src\common\common.h" />
     97    <ClInclude Include="..\src\common\fd.h" />
     98    <ClInclude Include="..\src\common\fuzz.h" />
     99    <ClInclude Include="..\src\common\random.h" />
     100    <ClInclude Include="..\src\common\ranges.h" />
     101    <ClInclude Include="..\src\md5.h" />
     102    <ClInclude Include="..\src\myfork.h" />
     103    <ClInclude Include="..\src\mygetopt.h" />
     104    <ClInclude Include="..\src\opts.h" />
     105    <ClInclude Include="..\src\timer.h" />
     106    <ClInclude Include="config.h" />
     107  </ItemGroup>
     108  <ItemGroup>
     109    <ClCompile Include="..\src\common\fd.c" />
     110    <ClCompile Include="..\src\common\fuzz.c" />
     111    <ClCompile Include="..\src\common\random.c" />
     112    <ClCompile Include="..\src\common\ranges.c" />
    98113    <ClCompile Include="..\src\md5.c" />
     114    <ClCompile Include="..\src\myfork.c" />
    99115    <ClCompile Include="..\src\mygetopt.c" />
    100116    <ClCompile Include="..\src\opts.c" />
    101     <ClCompile Include="..\src\random.c" />
    102     <ClCompile Include="..\src\ranges.c" />
    103117    <ClCompile Include="..\src\timer.c" />
    104     <ClCompile Include="..\src\zzuf.c">
    105       <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(FileName)1.obj</ObjectFileName>
    106       <ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(FileName)1.obj</ObjectFileName>
    107     </ClCompile>
    108   </ItemGroup>
    109   <ItemGroup>
    110     <ClInclude Include="config.h" />
    111     <ClInclude Include="..\src\fd.h" />
    112     <ClInclude Include="..\src\fuzz.h" />
    113     <ClInclude Include="..\src\md5.h" />
    114     <ClInclude Include="..\src\mygetopt.h" />
    115     <ClInclude Include="..\src\opts.h" />
    116     <ClInclude Include="..\src\random.h" />
    117     <ClInclude Include="..\src\ranges.h" />
    118     <ClInclude Include="..\src\timer.h" />
     118    <ClCompile Include="..\src\zzuf.c" />
    119119  </ItemGroup>
    120120  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  • zzuf/trunk/src/myfork.c

    r4122 r4137  
    266266
    267267    /* Get the child process's entry point address */
    268     epaddr = (void *)(get_base_address(pinfo.dwProcessId)
    269                        + get_entry_point_offset(opts->newargv[0]));
     268    epaddr = (void *)get_entry_point(opts->newargv[0],
     269                                     pinfo.dwProcessId);
    270270    if(!epaddr)
    271271        return -1;
     
    414414}
    415415
    416 /* Find the process's base address once it is loaded in memory (the header
    417  * information is unreliable because of Vista's ASLR). */
    418 static intptr_t get_base_address(DWORD pid)
    419 {
    420     MODULEENTRY32 entry;
    421     intptr_t ret = 0;
    422     void *list;
    423     int k;
    424 
    425     list = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
    426     entry.dwSize = sizeof(entry);
    427     for(k = Module32First(list, &entry); k; k = Module32Next(list, &entry))
    428     {
    429         /* FIXME: how do we select the correct module? */
    430         ret = (intptr_t)entry.modBaseAddr;
    431     }
    432     CloseHandle(list);
    433 
    434     return ret;
    435 }
    436 
    437416/* Find the process's entry point address offset. The information is in
    438417 * the file's PE header. */
    439 static intptr_t get_entry_point_offset(char const *name)
     418static intptr_t get_entry_point(char const *name, DWORD pid)
    440419{
    441420    PIMAGE_DOS_HEADER dos;
     
    472451      && nt->OptionalHeader.Magic == 0x10b /* IMAGE_NT_OPTIONAL_HDR32_MAGIC */)
    473452    {
    474         ret = (intptr_t)nt->OptionalHeader.AddressOfEntryPoint;
     453        ret = get_base_address(pid);
     454        /* Base address not found in the running process. Falling back
     455         * to the header's information, which is unreliable because of
     456         * Vista's address space randomisation. */
     457        if (!ret)
     458            ret = (intptr_t)nt->OptionalHeader.BaseOfCode;
     459
     460        ret += (intptr_t)nt->OptionalHeader.AddressOfEntryPoint;
    475461    }
    476462
     
    481467    return ret;
    482468}
    483 #endif
    484 
     469
     470/* Find the process's base address once it is loaded in memory (the header
     471 * information is unreliable because of Vista's ASLR). */
     472static intptr_t get_base_address(DWORD pid)
     473{
     474    MODULEENTRY32 entry;
     475    intptr_t ret = 0;
     476    void *list;
     477    int k;
     478
     479    list = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
     480    entry.dwSize = sizeof(entry);
     481    for(k = Module32First(list, &entry); k; k = Module32Next(list, &entry))
     482    {
     483        /* FIXME: how do we select the correct module? */
     484        ret = (intptr_t)entry.modBaseAddr;
     485    }
     486    CloseHandle(list);
     487
     488    return ret;
     489}
     490
     491#endif
Note: See TracChangeset for help on using the changeset viewer.