Opened 14 years ago

Closed 14 years ago

#14 closed defect (fixed)

KEIL does not work - src\kernel32\mmap.cpp line 725 - can this be changed? sideeffects?

Reported by: andib Owned by:
Priority: minor Milestone: general enhancement
Component: odin Version:
Severity: Keywords:
Cc:

Description

Problem is, KEIL does not work cause it can not read it's tools.ini file. Hermann Ulrichskoetter found out where this fails and made a build about 3 years ago with this one line commented out. For me his build worked for years now. But we do not understand if there are any problems with this change.

Here is the original post from Herman from 18.11.2007 at the odin.user group


This weekend I had some time to get deeper into this problem. I found that at line 725 in src\kernel32\mmap.cpp

(fdwAccess & FILE_MAP_READ) && !(mProtFlags & (PAGE_READWRITE|PAGE_READONLY))

becomes true and generates an error because fdwAccess==FILE_MAP_READ and mProtFlags==PAGE_WRITECOPY.

I just commented that line and now TOOLS.INI can be read without problems. I have no idea wether this modification can make problems because I don't understand what mProtFlags==PAGE_WRITECOPY means :-(

Anyway, now I can run KEIL 6.5 with PEC. That is not a problem because I don't use the IDE.

Hermann


Change History (6)

comment:1 by ktk, 14 years ago

Just as a remark, if that was in Odin32xp the code should be in svn as well, I imported that to http://svn.netlabs.org/odin32/browser/tags/odin32xp

comment:2 by dmik, 14 years ago

Did a quick look at the code (which is still exactly there) and in MSDN.

The MSDN contradicts itself. The MapViewOfFile docs explicitly say what PAGE_* flags the CreateFileMapping() call should specify for the given FILE_MAP_* flags to succeed, and according to that, the current code behaves correctly (for PAGE_WRITECOPY only FILE_MAP_COPY is allowed according to it).

However, the CreateFileMapping docs say quite the opposite regarding PAGE_WRITECOPY (underline is mine):

PAGE_WRITECOPY

Allows views to be mapped for read-only or copy-on-write access. This value is equivalent to PAGE_READONLY.

The file handle that the hFile parameter specifies must be created with the GENERIC_READ access right.

Which means that the KEIL application behaves correctly by creating a mapping with PAGE_WRITECOPY and requesting a view with FILE_MA_READ.

comment:3 by dmik, 14 years ago

I added a fix for this to SVN in r21472. Let's test it a bit.

comment:4 by andib, 14 years ago

Unfortunately right now I can not compile odin and currently have no time to dig in further. But if anyone makes a build available of course I'll test it with Keil.

comment:5 by Silvan Scherrer, 14 years ago

Milestone: general enhancement

could you already test this with latest odin?

comment:6 by andib, 14 years ago

Resolution: fixed
Status: newclosed

Works with odin32bin-20101230-release and odin32bin-20110221-release. I think we can close this issue.

Note: See TracTickets for help on using tickets.