Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sorry for my English.

I want to create map file. I found an example at the code project. But in use that example show me some fails:

IntPtr m_pMapFile;
IntPtr m_pBuff;

string data = "TestTest";

// create map file
m_pMapFile = WinCE.CreateFileMapping(WinCEConst.INVALID_HANDLE_VALUE, null, WinCEConst.PAGE_READWRITE, 0, MapSize, MapName);


After compiling, variable m_pMapFile takes the value 0.

// get map file
m_pBuff = WinCE.MapViewOfFile(m_pMapFile, WinCEConst.FILE_MAP_ALL_ACCESS, 0, 0, MapSize);


Then variable m_pBuff takes the value 0.

What's the problem?
Posted
Updated 20-Nov-11 5:12am
v3
Comments
BillWoodruff 20-Nov-11 11:19am    
Please consider posting a question in the comments section in the article you found here on CodeProject. Perhaps the author, or the other users, can assist you.
Addy Tas 20-Nov-11 17:15pm    
Hi, what error code do you get from GetLastError when CreateFile... failed? The error code might lead to the real issue here.

1 solution

You can trace the exact problem by putting try.. catch block around CreateFileMapping statement.
 
Share this answer
 
Comments
Addy Tas 21-Nov-11 2:20am    
the WinCE doesn't throw an exception; it just returns NULL on failure.
see: http://msdn.microsoft.com/en-us/library/ms923951.aspx for more info.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900