Amazing Problem in AllocPhysMem wince 6.0 - returns Error code 0x57

Hi

I am writing a Port Driver for x86 platform in WinCE 6.0. I want to
allocate virtual and equivalent physical memory in driver and mapped
it to USER mode to use application. For that I used AllocPhysMem in
driver and passed that
address through IOCTL calls but i cant use that virtual and physical
address in application side. Because AllocPhysMem returns Error Code
as 0x57 (meaning Parameter incorrect).

But the same code is working in WinCe 5.0.

My code snippet is,

         VirAddress = (LPVOID)AllocPhysMem(32,
									 PAGE_READWRITE|PAGE_NOCACHE,
									 0,
									 0,
									 &PhyAddress.LowPart);
	glerr=GetLastError();



Any inputs?

Thanks in Advance.

regards - D.
0
dsrking
12/20/2009 1:42:36 PM
windowsce.platbuilder 744 articles. 0 followers. Follow

8 Replies
1905 Views

Similar Articles

[PageSpeed] 42

it may work in wince 5.0 but not in wince 6.0  because of the memory access 
restrictions in 6.0 (User Mode, Kernel Mode). I think it is not possilbe to 
allocate less than one page of physical memory using AllocPhysMem().

Also you can't use the pointer created by AllocPhysMem() and sent it through 
the IOCTL from the kernel mode driver to user mode application directly in 
window ce 6.0.
See this blog, i have given an example of sharing the memory between the 
kernel mode driver and the user mode application in wince 6.0 using 
VirtualAllocEX API.
http://vinoth-vinothblog.blogspot.com/2008/11/sharing-blocks-of-memory-between-kernel.html
Good Luck,
-- 
vinoth.R
Aritcles:
http://www.windowsfordevices.com/articles/AT8185724467.html
http://e-consystems.com/gprsconnectivity.asp
http://vinoth-vinothblog.blogspot.com
http://www.e-consystems.com/blog


"dsrking" wrote:

> Hi
> 
> I am writing a Port Driver for x86 platform in WinCE 6.0. I want to
> allocate virtual and equivalent physical memory in driver and mapped
> it to USER mode to use application. For that I used AllocPhysMem in
> driver and passed that
> address through IOCTL calls but i cant use that virtual and physical
> address in application side. Because AllocPhysMem returns Error Code
> as 0x57 (meaning Parameter incorrect).
> 
> But the same code is working in WinCe 5.0.
> 
> My code snippet is,
> 
>          VirAddress = (LPVOID)AllocPhysMem(32,
> 									 PAGE_READWRITE|PAGE_NOCACHE,
> 									 0,
> 									 0,
> 									 &PhyAddress.LowPart);
> 	glerr=GetLastError();
> 
> 
> 
> Any inputs?
> 
> Thanks in Advance.
> 
> regards - D.
> .
> 
0
Utf
12/20/2009 3:19:01 PM
Do you call GetLastError() even when the return value is not NULL? If so, 
then the error value may be for something else, not this call.

-- 
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT Eurotech DOT com
My BLOG http://geekswithblogs.net/bruceeitman

Eurotech Inc.
www.Eurotech.com

"dsrking" <dsrking2006@gmail.com> wrote in message 
news:cca7339a-d530-4367-b861-e21f99bae80a@b36g2000prf.googlegroups.com...
> Hi
>
> I am writing a Port Driver for x86 platform in WinCE 6.0. I want to
> allocate virtual and equivalent physical memory in driver and mapped
> it to USER mode to use application. For that I used AllocPhysMem in
> driver and passed that
> address through IOCTL calls but i cant use that virtual and physical
> address in application side. Because AllocPhysMem returns Error Code
> as 0x57 (meaning Parameter incorrect).
>
> But the same code is working in WinCe 5.0.
>
> My code snippet is,
>
>         VirAddress = (LPVOID)AllocPhysMem(32,
> PAGE_READWRITE|PAGE_NOCACHE,
> 0,
> 0,
> &PhyAddress.LowPart);
> glerr=GetLastError();
>
>
>
> Any inputs?
>
> Thanks in Advance.
>
> regards - D. 


0
Bruce
12/20/2009 3:26:58 PM
Thanks Vinoth & Bruce.

>>I think it is not possilbe to
>>allocate less than one page of physical memory using AllocPhysMem().

in above sample code, i mentioned 32bytes as only example, but
actually i need memory more than PAGE size.

From your blog sample source code, you are using PHYSICAL address
(DWORD sDevPhysAddr = 0x81F00000;) but in my case, application give
only number of bytes to allocate memory. So, without this Physical
address (using only size), shall i allocate memory in driver and
accessed in Application?

Thanks in Advance.

Regards - D.
0
dsrking
12/21/2009 4:07:17 PM
On Dec 20, 1:42=A0pm, dsrking <dsrking2...@gmail.com> wrote:
> Hi
>
> I am writing a Port Driver for x86 platform in WinCE 6.0. I want to
> allocate virtual and equivalent physical memory in driver and mapped
> it to USER mode to use application. For that I used AllocPhysMem in
> driver and passed that
> address through IOCTL calls but i cant use that virtual and physical
> address in application side. Because AllocPhysMem returns Error Code
> as 0x57 (meaning Parameter incorrect).
>
> But the same code is working in WinCe 5.0.
>
> My code snippet is,
>
> =A0 =A0 =A0 =A0 =A0VirAddress =3D (LPVOID)AllocPhysMem(32,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
PAGE_READWRITE|PAGE_NOCACHE,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
0,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
0,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
&PhyAddress.LowPart);
> =A0 =A0 =A0 =A0 glerr=3DGetLastError();
>
> Any inputs?
>
> Thanks in Advance.
>
> regards - D.

PAGE_NOCACHE is not supported by AllocPhysMem() - see the CE 6.0 help
- I suspect that's why you're getting ERROR_INVALID_PARAMETER.

Perhaps if you describe what you are wanting to achieve we might be
able to help you more. Is this related to your previous post...
http://groups.google.com/group/microsoft.public.windowsce.platbuilder/brows=
e_frm/thread/c4955101dcde9b13/cd13639ff23a3d3f#cd13639ff23a3d3f
??

If so, then you should have no need to use AllocPhysMem() - this is
useful only when you need physically *contiguous* memory (for example
a DMA buffer) ?

Regards,
Andrew.
0
AndrewScholan
12/21/2009 4:40:30 PM
No. Thats related to hardware registers read/write in user mode. but
my current requirement is "allocate memory in driver & used it in
Application. not related to physical address".

0
dsrking
12/21/2009 4:53:14 PM
On Dec 21, 4:53=A0pm, dsrking <dsrking2...@gmail.com> wrote:
> No. Thats related to hardware registers read/write in user mode. but
> my current requirement is "allocate memory in driver & used it in
> Application. not related to physical address".

Why don't you allocate the memory in the application, and pass it to
the driver? There are lots of functions available to drivers to access
buffers allocated in applications!

Look in the help at CeOpenCallerBuffer() and see the associated
functions available...

Andrew.
0
AndrewScholan
12/21/2009 5:35:56 PM
Hi,

Thanks for ur inputs.

I used CeOpenCallerBuffer() API in my code. But it always return
Failure. So I used Ioctl input buffer to pass memory.
Eg: I allocate memory in Application, and filled data and passed it
through IOCTL input buffer. In driver side, I can read in IOControl
function inputbuffer argument.

But it ll cause any problem or it is correct way?

Thanks n Regards - D.

0
dsrking
12/22/2009 3:44:38 PM
Hi

AllocPhysMem is working without any Error Code.

Regards - D.
0
dsrking
12/28/2009 7:20:48 PM
Reply:

Similar Artilces:

Error Generating the Offlice Address Book
I have a mixed site with 3 5.5 server and 4 2003 servers. I installed 2003 SP1 a few weeks back and since then I'm having an issue generating my Offline Address Book. Here the event log messages I'm getting. Event ID 9331: OALGen encountered error 80040107 (internal ID 501023d) accessing the public folder store while generating the offline address list for address list '/'. - Default Offline Address List For more information, click http://www.microsoft.com/contentredirect.asp. Event ID 9335: OALGen encountered error 80040107 while cleaning the offline address list public ...

XCH Error 3092, OAB replication
I am getting error 3092 for OAB in Exchnage 2003 (migrated from 5.5) "Error 1129 occurred while processing a replication event. Folder: (3-8) NON_IPM_SUBTREE\OFFLINE ADDRESS BOOK\EX:/o" Tried to delete offilne addressbook and recreate but error has not stopped. Any help will be a great help on where to look to get rid of this issue. Thanks ...

Exchange update problem
I have tried to upgrade exch2k3 sp1 to sp2, but the update fails with "the file pcproxy.dll is in use, and setup cannot identify the app or srvc. setup cannot continue" Any clues/ideas/suggestions? Please. -- ----------------------------------------------------------------------------------------------------------------------- This message has been checked for all known viruses. The information contained in this e-mail and any attachments is confidential and may be the subject of legal, professional or other privilege. It is intended for the named addressee only and may not ...

Copy entire row where CellValue=0
I need to loop through the collumn and search for value that is more then 0. When I find it I need to copy whole row and paste it 2-3 rows below the table. I tried to select the collumn and search the selection but for some reason I copy and paste only one row. Thank you for any help. Hi as a starting point: http://www.rondebruin.nl/copy5.htm -- Regards Frank Kabel Frankfurt, Germany "OxanaB" <OxanaB@discussions.microsoft.com> schrieb im Newsbeitrag news:8628F791-CF2D-480A-9EBF-6C31BCEF0293@microsoft.com... > I need to loop through the collumn and search for value tha...

multiple Domain name delivery problem
hi, I currently have Exchange Server 2003 Build 7638:2 SP2,. We have multiple domain names being delivered to the exchange store. I have nothad any problems, but i currently have one user that is not receiving emails with attachments from one certain "internet" sender to one of her email addresses, but the other address works fine & if they send emails without attachments, everything works fine from either address. I have had the user send them message with attachments to me & the user with the problem & i get the message, but not the other user! I even use message...

SQL deadlock problem
I am currently having a big issue with sql deadlocking on the PrincipalObjectAccess table. The last few months I have been working on a synchronization process using a Biztalk orchestration. The sync uses the crm webservices to create and update account and contact records in CRM. But now deployment to the production environment gives me some problems. It seems that when trying to update account records (which is one of the first actions in the sync process) the webservice gives me Generic SQL errors and SQL timeouts. After extensive profiling and tracing in SQL I found that there are...

Error: Invalid byte was found at byte index 63.
Does anyone know what this means: "Invalid byte was found at byte index 63. " If yes, please help. Apogee Apogee wrote: > Does anyone know what this means: > > "Invalid byte was found at byte index 63. " That means exactly what it says: At index 63 XML parser found a byte, which is invalid either according document's encoding or is forbidden in XML documents at all (see list of allowed in XML characters at http://www.w3.org/TR/2000/REC-xml-20001006#charsets) -- Oleg Tkachenko http://www.tkachenko.com/blog Multiconn Technologies, Israel ...

docmd.transfertext problem
Hi, I am using access 97 and tried to import a csv file to the mdb table. I run a code as following: DoCmd.TransferText acImportDelim, "Specification4", "input", DEFAULT_PATH & "online.txt", 1 In online.txt, there is a field which is 10 digit number and I specified it as a double datatype in the specification4. After the import, I found out that the 10 digit number data in the field get empty in the destined table while other fields are all right. Therefore I import manually using specification4 instead of running code. This time the 1...

Adding Industry Codes
I am picking up the pieces on a previous installation of CRM, and want to add additional industries to my industry dropdown in the Lead form. For the life of me, I can't find the proper table in the database. Can someone be good enough to point me in the right direction? Thanks, Chris Chris, You don't do this via a table, you need to do it via form customization. You will need system admin rights, then go into System Customization and modify the Lead form. After making the changes, you will need to publish the change via Deployment Manager and issue an IISRESET. Matt "Chris...

Invalid XML error when I open customization setting
I have a problem when I try to open customization setting after I import an entity. The system errored "Invalid XML" "The XML passed to the platform is not well-formed XML". Please recommend how to resolve this problem. Thanks. ...

Linker Error after upgrade from VC7.1
Hello all, After upgrading a VC7.1 project to visual studio 2005, it failed to build in the release configuration with the follwoing error : 1>nafxcw.lib(winocc.obj) : error LNK2005: "public: class CWnd * __thiscall CWnd::GetDlgItem(int)const " (?GetDlgItem@CWnd@@QBEPAV1@H@Z) already defined in InstallDlg.obj The debug build works fine. The project uses MFC in a static library. Well, after doing some research, it seems that this one is tied to the fact that in a release configuration, _AFX_ENABLE_INLINES is defined, so inline functions are embedded in the .obj file. Sure there...

Strange Access Denied Problem with Windows 7
I got a new computer about six months ago that came with Windows Vista Home Premium 64bit. Before that I had done all of my .NET development either on an XP Pro VM or my former XP Pro computer at home. Shortly after getting my new computer at home, I also got a license for VMWare to be able to test my software on multiple platforms and configurations. I had wrote an application originally in VB.NET that was a simple backup utility. It supports mutiple backup configurations. Any given copnfiguration would define a backup which would be a list of files to backup, a list of folders to ...

Unexpected error message on closing an Excel file
Suddenly I am getting the following message when I try to close a workbook: "Your formula contains an invalid external reference to a worksheet. Verify that the path, workbook, and range name or cell reference are correct, and try again" The mysterious thing is that it does not happen consistently and that, after I click OK after the above message, I can still save the file. What might be the cause of this error message and can the "invalid reference" be tracked down using one of the utility add-ins such as J. Walkenbach's PUP? If it only happens when you close ...

Outlook freezes after sending one email after upgrading 4.0
We just upgraded from 3.0 to 4.0 this weekend. All client machines have had the desktop client upgraded and 2 have the same issue. One is XP with Outlook 2003 and the other is Vista with Outlook 2007. Open opens and the CRM addin initializes correctly. As soon as you compose and send an email, Outlook locks up and you have to kill the process in task manager to close Outlook. I've had the same problem and have tried all I can think of...how did you fix this issue? Thank you. "Sander" wrote: > We just upgraded from 3.0 to 4.0 this weekend. All client machines have...

Import from Eudora 6 to Outlook 2003
I am trying to import messages from Eudora 6 to Outlook 2003. I am receiving the error message "The mail folder could not be opened. If another application is using this file, please close and try again. No other applications are running Thanks for any help see article 257354 of the microsoft knowledge base on http://support.microsoft.com: "Outlook Cannot Import Eudora Messages When Eudora Mail Is Stored in a Non-Default Location" ciaos >-----Original Message----- >I am trying to import messages from Eudora 6 to Outlook 2003. I am receiving the error message ...

Excel Problem
I have a 23.8 meg excel 2000 spreadsheet set for manual calculation saved to my local hard drive. Every time I try to open it, it takes forver and sometimes never opens but I do not get any error messages, let me just tell you that I am running a P4, 1 GB memory, Office 2K with SP3, and nothing else running when I try to open it. As I said it is set for manual calculation, and it is cleared to not auto calculate when opening or closing. Any idea's as to why this is happening? -- Todd I don't know why you're having this problem but I would like to point something out for w...

SOAP Exception
Hi, In my C# code, I have defined a Map object which is sent as part of a request to a web service, here's an extract of the part of the code: - Map map = new Map(); map.item = new mapItem[4] { new mapItem(), new mapItem(), new mapItem(), new mapItem() }; ................. But when I submit the request containing the Map object, the compiler throws an error with the following message:- org.xml.sax.SAXException: No deserializer for {http://xml.apache.org/ xml-soap}...

DNS Error on Exchange
I am getting the following error on my Exchange server. What is my problem? Thanks. Event Type: Warning Event Source: smtpsvc Event Category: None Event ID: 2012 Date: 1/28/2005 Time: 12:01:53 PM User: N/A Computer: PUMA Description: SMTP could not connect to the DNS server '24.220.0.11'. The protocol used was 'UDP'. It may be down or inaccessible. For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Data: 0000: d5 04 00 00 Õ... Is that a DNS server that's configured on your Exchange box? It shoul...

error on upgrade: ID 4386
Hello, I am upgrading from DPM 2010 RC to DPM 2010 RTM, 64 bit version, on Win 2008 R2 standard. The RC is working without any issues. The upgrade scenario is supported. At the very end of the process the upgrade fails giving me the following. _____ The SQL Server installation failed because a restart was pending on this computer. Restart the computer and then start DPM Setup again. ID: 4386. Details: Unknown error (0x84be0bc2) _____ Restarting the server does not correct the issue. On the next attempt I am getting the same error message. Where to look for the pending rest...

Outlook Express 6 w/multiple accounts
I have three accounts set up in Outlook Express 6. Two of them work fine, but when I reply to or forward a message sent to the third address, it uses the second address in the "from" line, so I have to change it manually. This does not happen with the other two. How do I fix this? ...

Border problems
Not sure why all of a sudden all my borders in my tables created with Publisher can only be white. No other color will show when selected. Opening a pub file done on another computer where the borders show color, shows white only. I have attempted to do a repair on publisher, which gave no help. Have attempted to uninstalled and reinstall Publisher without clearing the problem. Anyone have any ideas or suggestions? Look in the Accessibility Options in the control panel, display tab, disable "use high contrast." If that doesn't solve the issue, read the third FAQ here....

Upgrade CRM 4.0 Professional to CRM 4.0 Enterprise
When I enter the CRM license code in the Deployment Manager to upgrade to Enterprise I get a message "The license code entered is not valid for upgrade. Make sure you have entered the license code correctly, and then try again". Do I have to reinstall CRM 4 to install Enterprise? Hi, what is your current installation? Professional? Have you entered trial version license keys ? /Aamir Current is Professional. I got the key from our MSDN subscription which didn't indicate a trial license. I was able to install the Enterprise edition on a test server using the same key w...

error 0x800cc0f
i installed windows xp, and i set up all my email accounts. they are all working , except one: i receive 0x800cc0f message, which states that the service has been interrupted, contact your ISP...., but this is not the case, since my internet conneciton is working fine all the account settings are correct I am having the same problem. I have to close outlook and reopen to retrieve all of my messages. Have you found a resolution yet? "Kerstin" wrote: > i installed windows xp, and i set up all my email > accounts. they are all working , except one: i receive > 0x800c...

Send/Recieve error #3
I had few viruses in my computer that I cleaned up. Ever since, I face send/recieve error in my pop3 email account. I think I deleted a driver or somthing. Any idea? ...

outlook express 6.0 in ms 98
I cant seem to delete any of my sent mail messages in Outlook express 6.0 i am operaitng in ms 98..up to 8400 messages now. Please help ! At the risk of being obvious, click on the first item in your sent items folder while holding down the shift key. Then scroll to the bottom and click the last item. That will select them all - or you can use any range you desire. Then just click the delete icon or press the delete button. Once done, you might want to empty the deleted items folder (assuming it doesn't tell you there isn't enough room there and they'll be permanently delete...