Changeset 769 in dev for trunk/ab5.0


Ignore:
Timestamp:
Mar 28, 2009, 12:12:58 PM (16 years ago)
Author:
イグトランス (egtra)
Message:

読み取りのみのファイル操作の場合、CreateFileでFILE_SHARE_READ指定を追加。コンパイラを同時起動しても正常動作させるための修正。

Location:
trunk/ab5.0
Files:
6 edited

Legend:

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

    r750 r769  
    9898    foreach( const ActiveBasic::Common::ResourceItem &resourceItem, compiler.resourceManager.cursorResources )
    9999    {
    100         hFile=CreateFile(resourceItem.filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     100        hFile=CreateFile(resourceItem.filepath.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    101101        if(hFile==INVALID_HANDLE_VALUE){
    102102            compiler.errorMessenger.Output(23,resourceItem.filepath.c_str(),-1);
     
    118118    foreach( const ActiveBasic::Common::ResourceItem &resourceItem, compiler.resourceManager.bitmapResources )
    119119    {
    120         hFile=CreateFile(resourceItem.filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     120        hFile=CreateFile(resourceItem.filepath.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    121121        if(hFile==INVALID_HANDLE_VALUE){
    122122            compiler.errorMessenger.Output(23,resourceItem.filepath.c_str(),-1);
     
    130130    foreach( const ActiveBasic::Common::ResourceItem &resourceItem, compiler.resourceManager.iconResources )
    131131    {
    132         hFile=CreateFile(resourceItem.filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     132        hFile=CreateFile(resourceItem.filepath.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    133133        if(hFile==INVALID_HANDLE_VALUE){
    134134            compiler.errorMessenger.Output(23,resourceItem.filepath.c_str(),-1);
     
    661661    //カーソルリソース
    662662    for(i3=0,i6=0;i3<static_cast<int>(compiler.resourceManager.cursorResources.size());i3++){
    663         hFile=CreateFile(compiler.resourceManager.cursorResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     663        hFile=CreateFile(compiler.resourceManager.cursorResources[i3].filepath.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    664664        if(hFile==INVALID_HANDLE_VALUE){
    665665            compiler.errorMessenger.Output(23,compiler.resourceManager.cursorResources[i3].filepath.c_str(),-1);
     
    741741    //ビットマップリソース
    742742    for(i3=0;i3<static_cast<int>(compiler.resourceManager.bitmapResources.size());i3++){
    743         hFile=CreateFile(compiler.resourceManager.bitmapResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     743        hFile=CreateFile(compiler.resourceManager.bitmapResources[i3].filepath.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    744744        if(hFile==INVALID_HANDLE_VALUE){
    745745            compiler.errorMessenger.Output(23,compiler.resourceManager.bitmapResources[i3].filepath.c_str(),-1);
     
    769769    //アイコンリソース
    770770    for(i3=0,i6=0;i3<static_cast<int>(compiler.resourceManager.iconResources.size());i3++){
    771         hFile=CreateFile(compiler.resourceManager.iconResources[i3].filepath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     771        hFile=CreateFile(compiler.resourceManager.iconResources[i3].filepath.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    772772        if(hFile==INVALID_HANDLE_VALUE){
    773773            compiler.errorMessenger.Output(23,compiler.resourceManager.iconResources[i3].filepath.c_str(),-1);
     
    852852    if( !compiler.resourceManager.manifestFilePath.empty() )
    853853    {
    854         hFile=CreateFile(compiler.resourceManager.manifestFilePath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     854        hFile=CreateFile(compiler.resourceManager.manifestFilePath.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    855855        if(hFile==INVALID_HANDLE_VALUE){
    856856            compiler.errorMessenger.Output(59,compiler.resourceManager.manifestFilePath.c_str(),-1);
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Source.cpp

    r760 r769  
    320320bool Text::ReadFile( const std::string &filePath ){
    321321    //ファイルオープン
    322     HANDLE hFile=CreateFile(filePath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     322    HANDLE hFile=CreateFile(filePath.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    323323    if(hFile==INVALID_HANDLE_VALUE){
    324         return false;
     324        DebugBreak(); return false;
    325325    }
    326326
  • trunk/ab5.0/abdev/ab_common/src/ResourceManager/ResourceManager.cpp

    r662 r769  
    2222    HANDLE hFile;
    2323
    24     hFile=CreateFile(resourceFilePath.c_str(),GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     24    hFile=CreateFile(resourceFilePath.c_str(),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    2525    if(hFile==INVALID_HANDLE_VALUE)
    2626    {
  • trunk/ab5.0/abdev/abdev/DocumentAdvice.cpp

    r705 r769  
    186186            if(i3==MdiInfo.size()){
    187187                //ファイルから開く
    188                 ATL::CHandle fh(CreateFile(temporary,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL));
     188                ATL::CHandle fh(CreateFile(temporary,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL));
    189189                if(fh==INVALID_HANDLE_VALUE){
    190190                    fh.Detach();
  • trunk/ab5.0/abdev/compiler_x64/MakePeHdr.cpp

    r768 r769  
    11311131    hFile=CreateFile(
    11321132        ( ActiveBasic::Common::Environment::GetAbdevSystemDirPath() + "\\dosstub.pgm" ).c_str(),
    1133         GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
     1133        GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
    11341134    if(hFile==INVALID_HANDLE_VALUE){
    11351135        MessageBox(hOwnerEditor,"dosstub.pgmの読み込みに失敗","error",MB_OK);
  • trunk/ab5.0/jenga/include/common/File.h

    r583 r769  
    1818    std::string Read()
    1919    {
    20         HANDLE hFile = CreateFile( filePath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
     20        HANDLE hFile = CreateFile( filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
    2121        if( hFile == INVALID_HANDLE_VALUE )
    2222        {
     
    3838    bool ReadBinary( Binary &binary )
    3939    {
    40         HANDLE hFile = CreateFile( filePath.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
     40        HANDLE hFile = CreateFile( filePath.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
    4141        if( hFile == INVALID_HANDLE_VALUE )
    4242        {
Note: See TracChangeset for help on using the changeset viewer.