Shared Memory Issue..

Hi,

I just learnt about the shared memory mechanism between application and driver in OSR article (http://www.osronline.com/article.cfm?id=39) and tried a implement a sample application and driver. Initially i tried to build a win32 application in VS2005 and get the User Space mapped shared memory, when i tried to access that violation occured. But when i built the application in WinDDK, the violation is not happening and i’m able to access the memory. Please help me in solving this in VS application?

Kumar

>Initially i tried to build a win32 application in VS2005 and get the User Space mapped shared

memory, when i tried to access that violation occured. But when i built the application in WinDDK

__stdcall vs. __cdecl calling convention issue?


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

I’m new to this application side. Can you just elaborate this. I selected win32 console application in visual studio which doesnt work.

Well in visual studio you can specify weather the compiler makes the function stack using the __stdcall or __cdecl calling convention.
See Project -> Properties -> c/c++ -> Advanced -> Calling Convention.
You can choose _stdcall, _cdecl, _fastcall

Yes… I understood this. My doubt is the application which is built using DDK is using __cdecl calling convention and the console application is also using __cdel calling convention. But i dont know why i’m not able to access the mapped memory in VS2K5 application case.

wrote in message news:xxxxx@ntdev…
>But i dont know why i’m not able to access the mapped memory in VS2K5
>application case.

You haven’t provided any detail, so neither does anyone else. You need to
actually debug this a bit and come back with a real question, not just, “it
doesn’t work.”

You have a copy that works and a copy that doesn’t work, so I suggest
running each of them under a debugger and single stepping until you find
what’s different. The entire application is less than 300 lines of code, so
you’ll get an answer faster than you will from here and you’ll probably
learn something along the way.

-scott


Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com

wrote in message news:xxxxx@ntdev…
> Yes… I understood this. My doubt is the application which is built using
> DDK is using cdecl calling convention and the console application is
> also using
cdel calling convention. But i dont know why i’m not able to
> access the mapped memory in VS2K5 application case.
>

Or, if like so many we have been getting here lately, you object to using
WinDbg, bring both sources up in Visual Studio, side by side, and compare
the code. BC3 does a great job of comparing two files or you may have a
compare-du-jour that you would prefer to use.

Gary G. Little
H (952) 223-1349
C (952) 454-4629
xxxxx@comcast.net

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Scott Noone
Sent: Thursday, July 08, 2010 9:34 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Shared Memory Issue…

wrote in message news:xxxxx@ntdev…
>But i dont know why i’m not able to access the mapped memory in VS2K5
>application case.

You haven’t provided any detail, so neither does anyone else. You need to
actually debug this a bit and come back with a real question, not just, “it
doesn’t work.”

You have a copy that works and a copy that doesn’t work, so I suggest
running each of them under a debugger and single stepping until you find
what’s different. The entire application is less than 300 lines of code, so
you’ll get an answer faster than you will from here and you’ll probably
learn something along the way.

-scott


Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com

wrote in message news:xxxxx@ntdev…
> Yes… I understood this. My doubt is the application which is built using
> DDK is using cdecl calling convention and the console application is
> also using
cdel calling convention. But i dont know why i’m not able to
> access the mapped memory in VS2K5 application case.
>


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

xxxxx@yahoo.com wrote:

I just learnt about the shared memory mechanism between application and driver in OSR article (http://www.osronline.com/article.cfm?id=39) and tried a implement a sample application and driver. Initially i tried to build a win32 application in VS2005 and get the User Space mapped shared memory, when i tried to access that violation occured. But when i built the application in WinDDK, the violation is not happening and i’m able to access the memory. Please help me in solving this in VS application?

You must be joking. None of us have crystal balls, and our mindreading
abilities are severely limited when the weather gets so hot.

What your describing has been done innumerable times over the decades,
so the concept is known to work. That’s means you have screwed up
something in your code or your configuration. Show us some code.
That’s the only way we can help.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.