I have attached a zip file that has 2 EXE files in it that I need to test on both win2k and XP. I have tested them both on 95/98 and NT4 and they work fine and I need to see if they work on 2k/xp as well.

To test them, unzip the file into a single directory which will leave you with 2 EXE files, MMFS.EXE and TESTMMF.EXE. Start MMFS.EXE and click on the 1st button on the toolbar. It should start the other EXE file TESTMMF.EXE.

Click on the second button in MMFS.EXE and it should close the file TESTMMF.EXE.

What I am testing is a combination of using a memory mapped file that is opened by both EXE files, passing the handles of both files to a location in the MMF and then direct messaging the TESTMMF.EXE app with a message to activate code that closes it using the handle passed to the MMF by TESTMMF.EXE.

Any help here would be appreciated. Note that it will not work the other way around.

Regards,

hutch@movsd.com
Posted on 2002-01-25 19:44:39 by hutch--
Hutch, I'm sure you know this----but curiously looked at it in '98---and it opens multiple multiple instances of test window---yet only closes the last opened-----B
Posted on 2002-01-25 20:00:13 by BradB
WinXP:
TESTMMF executes and closes, but with an error:
---------------------------

Test File: testmmf.exe - Application Error
---------------------------
The instruction at "0x0040262d" referenced memory at "0x0040262d". The memory could not be "read".


Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------
Then when I exit MMFS, I get another error:
---------------------------

Memory mapped files: MMFS.EXE - Application Error
---------------------------
The instruction at "0x00402561" referenced memory at "0x00402561". The memory could not be "read".


Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------
Posted on 2002-01-25 20:00:26 by bitRAKE
Hi Hutch--

Works well on XP. I have some trouble wit my 2k installation so I was not able to test it on 2k.

KetilO
Posted on 2002-01-25 20:02:33 by KetilO
no prb with w2k..
like bradb said, it close last instance only.
Posted on 2002-01-25 20:25:00 by kamilh
Got exactly the same error that bitRake on Win2K



---------------------------
Test File: TESTMMF.EXE - Application Error
---------------------------
The instruction at "0x0040262d" referenced memory at "0x0040262d". The memory could not be "read".




---------------------------
Memory mapped files: MMFS.EXE - Application Error
---------------------------
The instruction at "0x00402561" referenced memory at "0x00402561". The memory could not be "read".


Both where at the exit of the programs.
Posted on 2002-01-25 20:25:56 by dxantos
Guys,

Thanks for testing this stuff for me, the multiple instance on is no problem as the last one opened will overwrite the handle at the address set aside for the handle of the second prog.

I am shutting down the MMF according to the documentation I have so it looks like win2k does something different in the way it handles memory mapped files so I will have to look for a work around to test if the memory mapped file is still valid when either or both apps close.

Regards & Thanks

hutch@movsd.com
Posted on 2002-01-25 20:37:20 by hutch--
I tested it on winXP prof. and it works ok for me.
Posted on 2002-01-26 15:05:42 by Zcoder
I have added a couple of dialog boxes to the two EXE files to see where the failure occurs on win2k.

What I need is for bitrake and dxantos to run these two modified versions on their setup of win2k to see what API is triggering the read fault.

The two APIs are in the WM_CLOSE message processing and are respectively,


UnmapViewOfFile lpMemFile
CloseHandle hFile

The handle and the starting address of the memory mapped file are correct anfd the two variables have GLOBAL scope so there is no problems here.

What I don't understand is why some versions of Win2k work OK with it and others do not.

Any help here would be appreciated.

Regards,

hutch@movsd.com
Posted on 2002-01-26 21:15:32 by hutch--
Hutch,
Just tested your 2nd version on my W2K machine.
Version 5.0 build 2195 service pack 2.
The MMFS.EXE correctly opens TESTMMF.EXE :grin:
But, when I click on the 2nd button in MMFS.EXE, the
button just 'sticks' in the down position and the prog hangs :(
I don't see any popup messages from the prog OR windows.
Posted on 2002-01-26 21:57:50 by anon
Both versions crash on my machine as well (win2k, sp2).

This is what your second version outputs:


---------------------------
Test File: testmmf.exe - Application Error
---------------------------
The instruction at "0x0040267f" referenced memory at "0x0040267f". The memory could not be "read".

Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------



---------------------------
Memory mapped files: MMFS.EXE - Application Error
---------------------------
The instruction at "0x004025b3" referenced memory at "0x004025b3". The memory could not be "read".

Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------


Thomas
Posted on 2002-01-27 03:13:34 by Thomas
Hutch--, same here on WinXP.
Posted on 2002-01-27 09:28:37 by bitRAKE
Hi Hutch--

Still works well on my XP. Msg boxes pops up.
Strange that some have problems, some not.

anon: You need to click OK on the msg box in 2nd window.

KetilO
Posted on 2002-01-27 11:40:26 by KetilO
Both apps crash after the "UnmapViewOfFile" msgbox has been shown.
Posted on 2002-01-27 13:06:31 by f0dder
KetilO is right, I did not see the popup. The program
does seem to work correctly on my machine.
Posted on 2002-01-27 13:19:11 by anon
Worked on ME: no errors, but only closes last. But then you didn't actually ask us to check it there.
Posted on 2002-01-27 16:58:31 by peterverstappen
Guys,

Thanks for doing this extra testing, from what has been reported, the "UnmapViewOfFile" function is buggy in Win2k sp2 and there seems to be nothing wrong with the code that calls it as I did a search through the available Microsoft documentation and I have used it correctly.

It could probably be made to work by simply omitting it but this would lead to a memory leak which is unacceptable coding practice. Unfortunate as it has the potential to be a very useful interface between EXE files that removes the dependence on both the stack and on using DLLs.

I will keep looking around to see if there is a workaround for it but it has all the hallmarks of a Microsoft bug in win2k/sp2.

Regards,

hutch@movsd.com
Posted on 2002-01-27 17:57:31 by hutch--
quote: "Ah Micro$oft, U've dunnit again !"
Intentually I'm sure!!!!
Posted on 2002-01-27 18:04:11 by BradB
I've had no problems with UnmapViewOfFile in my code. win2ksp2.
While microsoft certainly have made a lot of buggy things, I'm inclined
to believe that there's something wrong with your code, El Hutchesson.
I was about to disassemble the app to trace your code, but you
seem to have run an exepacker on it, and I couldn't be bothered
to do a manual unpack.
Posted on 2002-01-27 18:11:36 by f0dder
A little late but. it gives:



---------------------------
WM_CLOSE in MMFS.EXE
---------------------------
Next API is UnmapViewOfFile
---------------------------
OK
---------------------------


Before crashing.

Using OllyDebug, I found that your app calls UnmapViewOfFile with an address of 4042B8h and after that the executable area of memory is invalid, thus giving a GPF AFTER the call to UnmapViewOfFile (address 4025B3h is the next instruction after the call to UnmapViewOfFile). Why Is that the executable address is invalid after the UnmapViewOfFile. I dont know since I dont have the original code and the exe is packed so I cannot do a dissasembly.

The function UnmapViewOfFile itself is successfull, since eax has a value of 1 after the call is made.
Posted on 2002-01-27 18:21:25 by dxantos