Chris,

Not sure why I just got your post from 3am, but here are some comments.

> why is the offset hardcoded?

for example only... In the real code it isn't. Refer to my last post which
has actual code. That may help.

>are you using the View Memory window of the debugger to look at m_src
before
>executing DmWrite, and then compare the memory afterwards?  as with any
>debugger, compiler optimizations can confuse the debugger if you're just
>looking in the variables window.

Yes, I am actually watching the entire structure in both the variable window
and the memory window, before and after. When I use DmWrite, no matter what
value I pass in, it writes a zero to that byte. The strange thing is, using
the exact same variables that I pass to DmWrite, DmSet works. That's what is
really strange.


>no, but that's irrelevent.  using C or C++ is not going to alter the
>behavior of DmWrite.

DmWrite will behave the same, but the compiler may handle C++ differently
than it does C when it interprets and passes the parameters, so yes, it
might be relevant.

>if you look at the source to DmWrite, i think you can convince yourself the
>problem is definitely not in DmWrite.  if you can't post your code, you'll
>probably need to do some careful debugging of your app to figure out what's
>going wrong.

I looked through DmWrite source before I ever started this thread. What
would be nice would be to be able to step through DmWrite at debug time.
Don't think that is possible, is it???

>one sanity check you might want to make, is to verify that sizeof(m_x)
>really does == 1.  perhaps this is an alignment issue within classes?  (i'm
>assuming that "m_x" is really a member variable, not a local variable).

Been there, done that<g>. I even assigned all the original parameters to
local variables to that I could check there values before putting them into
DmWrite. The value that I pass of m_x is a class member variable. The
sizeof(src->m_x) is not. It is a globally defined structure member. It's
probably easiest if you look at my previous post.
=======
So, I am stumped as to why this works in the function:

  ::DmSet (src, (ULong)&nilP->m_x, 1, m_x );

but substituting this always writes a 0 regardless of the value of m_x

  ::DmWrite (src, (ULong)&nilP->m_x, &m_x, sizeof(src->m_x));

=======
Bry

Reply via email to