Changeset 773 in dev for trunk


Ignore:
Timestamp:
Jan 15, 2011, 6:04:58 PM (14 years ago)
Author:
イグトランス (egtra)
Message:

セキュリティ対策の機能を有効化

Location:
trunk/ab5.0/abdev
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/BasicCompiler.cpp

    r750 r773  
    581581    char temporary[1024],temp2[MAX_PATH];
    582582
     583    ActiveBasic::Common::EnableNX();
     584    ActiveBasic::Common::SetHeapOptions();
     585
    583586    hInst = GetModuleHandle( NULL );
    584587
  • trunk/ab5.0/abdev/ab_common/include/Environment.h

    r719 r773  
    5252};
    5353
     54BOOL EnableNX();
     55void SetHeapOptions();
    5456
    5557}}
  • trunk/ab5.0/abdev/ab_common/src/Environment.cpp

    r763 r773  
    3535    }
    3636    throw;
    37 }
    38 
    39 BOOL EnableLFH(HANDLE hHeap)
    40 {
    41     ULONG enableLFH = 2;
    42     return HeapSetInformation(hHeap, HeapCompatibilityInformation, &enableLFH, sizeof enableLFH);
    4337}
    4438
     
    8478    return E_NOTIMPL;
    8579}
     80
     81BOOL ActiveBasic::Common::EnableNX()
     82{
     83    typedef BOOL (WINAPI* PFNSETDEP)(DWORD);
     84
     85    HMODULE hmodKernel = GetModuleHandle(TEXT("KERNEL32.DLL"));
     86    if (PFNSETDEP pfnSetDEP = reinterpret_cast<PFNSETDEP>(GetProcAddress(hmodKernel, "SetProcessDEPPolicy")))
     87    {
     88        return pfnSetDEP(PROCESS_DEP_ENABLE);
     89    }
     90    else
     91    {
     92        return FALSE;
     93    }
     94}
     95
     96void ActiveBasic::Common::SetHeapOptions()
     97{
     98//  SetDllDirectory(_T(""));
     99    HMODULE hmodKernel = GetModuleHandle(TEXT("KERNEL32.DLL"));
     100
     101    typedef BOOL (WINAPI* HSI)(HANDLE, HEAP_INFORMATION_CLASS ,PVOID, SIZE_T);
     102    HSI pHsi = reinterpret_cast<HSI>(GetProcAddress(hmodKernel, "HeapSetInformation"));
     103    if (!pHsi)
     104    {
     105        return;
     106    }
     107
     108    ULONG enableLFH = 2;
     109    pHsi(GetProcessHeap(), HeapCompatibilityInformation, &enableLFH, sizeof enableLFH);
     110
     111#ifndef HeapEnableTerminationOnCorruption
     112#   define HeapEnableTerminationOnCorruption (HEAP_INFORMATION_CLASS)1
     113#endif
     114
     115    pHsi(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
     116}
  • trunk/ab5.0/abdev/ab_common/stdafx.h

    r763 r773  
    11#pragma once
     2#pragma strict_gs_check(on)
    23
    34#include <map>
  • trunk/ab5.0/abdev/abdev/abdev.cpp

    r772 r773  
    14981498    HACCEL hAccel;
    14991499
     1500    ActiveBasic::Common::EnableNX();
     1501    ActiveBasic::Common::SetHeapOptions();
     1502
    15001503    hInst=hThisInst;
    15011504    if(!SetupProjectEditor()) return 0;
  • trunk/ab5.0/abdev/abdev/abdev.vcproj

    r772 r773  
    178178            <Tool
    179179                Name="VCLinkerTool"
     180                AdditionalOptions="/NXCOMPAT /DYNAMICBASE"
    180181                AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib imm32.lib htmlhelp.lib rpcrt4.lib imagehlp.lib tinyxmld_STL.lib"
    181182                OutputFile="$(OutDir)\abdev.exe"
     
    279280            <Tool
    280281                Name="VCLinkerTool"
     282                AdditionalOptions="/NXCOMPAT /DYNAMICBASE /SAFESEH"
    281283                AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib imm32.lib htmlhelp.lib rpcrt4.lib imagehlp.lib tinyxml_STL.lib"
    282284                OutputFile="$(OutDir)\abdev.exe"
  • trunk/ab5.0/abdev/compiler_x64/compiler_x64.vcproj

    r650 r773  
    8181            <Tool
    8282                Name="VCLinkerTool"
    83                 AdditionalOptions="/MACHINE:AMD64"
     83                AdditionalOptions="/MACHINE:AMD64 /NXCOMPAT /DYNAMICBASE"
    8484                AdditionalDependencies="comctl32.lib psapi.lib imagehlp.lib shlwapi.lib"
    8585                OutputFile="$(OutDir)\abc.exe"
     
    194194            <Tool
    195195                Name="VCLinkerTool"
    196                 AdditionalOptions="/MACHINE:AMD64"
     196                AdditionalOptions="/MACHINE:AMD64 /NXCOMPAT /DYNAMICBASE"
    197197                AdditionalDependencies="comctl32.lib psapi.lib imagehlp.lib shlwapi.lib"
    198198                OutputFile="$(OutDir)\abc.exe"
     
    238238        <ProjectReference
    239239            ReferencedProjectIdentifier="{F01805B6-65B4-4708-88F4-A5E07DEA9FBD}"
    240             RelativePathToProject="..\jenga\projects\jenga\jenga.vcproj"
    241240        />
    242241        <ProjectReference
    243242            ReferencedProjectIdentifier="{87835C33-64C9-4BA5-9B39-608BA5394387}"
    244             RelativePathToProject=".\ab_common\ab_common.vcproj"
    245243        />
    246244    </References>
  • trunk/ab5.0/abdev/compiler_x86/compiler_x86.vcproj

    r648 r773  
    7777            <Tool
    7878                Name="VCLinkerTool"
     79                AdditionalOptions="/NXCOMPAT /DYNAMICBASE"
    7980                AdditionalDependencies="comctl32.lib psapi.lib imagehlp.lib shlwapi.lib"
    8081                OutputFile="$(OutDir)\abc.exe"
     
    182183            <Tool
    183184                Name="VCLinkerTool"
     185                AdditionalOptions="/NXCOMPAT /DYNAMICBASE /SAFESEH"
    184186                AdditionalDependencies="comctl32.lib psapi.lib imagehlp.lib shlwapi.lib"
    185187                OutputFile="$(OutDir)\abc.exe"
Note: See TracChangeset for help on using the changeset viewer.