What's _Buffer? According to the error, it's an 'unsigned char'.Originally Posted by Denethor2000
What's _Buffer? According to the error, it's an 'unsigned char'.Originally Posted by Denethor2000
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
> input Line = { GetCurrentProcessId(), Address, Length, _Buffer };
You can't assign arrays - use memcpy()
Having BYTE *bytes; in your struct would work, but that wouldn't be making a copy of the buffer.
Yeah, I edited that in a minute later, sorry about that.Originally Posted by dwks
It's a BYTE array.
Code:BYTE _Buffer[300];
What the hell is the above? what are those curly-braces doing there? First calls GetCurrentProcessID() and assigns the return value to Line (which is wrong because Input is not a DWORD). but what's the purpose of Address, Length, and _Buffer in that line?Code:input Line = { GetCurrentProcessId(), Address, Length, _Buffer };
Last edited by Ancient Dragon; 11-12-2005 at 05:42 PM.
It's a struct. Which I included in the same post.Originally Posted by Ancient Dragon
It gets passed to a driver with DeviceIoControl. Which has nothing to do with my problem.
Probably to initialize the remaining members of the structure.
[edit]You beat me to it.[/edit]Code:struct s { int x; float f; }; s one; s two = {1}; s three = {1, 2.0};
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
It might, depending on what _Buffer is. It's [300], right?Which has nothing to do with my problem.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Yes, I reread your previous post and found that out. You can't assign members of a struct like that -- each member requires its own assign statement.Originally Posted by Denethor2000
Code:Line.processid = GetProcessID(); Line.address = Address; Line.bytestowrite = Length; // The next line may not work if sizeof(Line.bytes) > siezof(_Buffer) memcpy(Line.bytes,_Buffer,sizeof(Line.bytes));
You can too assign a struct like that. How about you re-read my post:
Originally Posted by dwks
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
And what's siezof?
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
That obscure trick won't work with his struct because it contains character arrays which cannot be copied like that.Originally Posted by dwks
I use it all the time.That obscure trick
Yes, you're right. (It does work for char*, not for char[].) Butwon't work with his struct because it contains character arrays
Address and Length are valid.but what's the purpose of Address, Length, and _Buffer in that line?
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
You are one of a very select few who do. I've never see that before in over 20 years.Originally Posted by dwks
well, it really does not work for char* either -- unless all you want copied is the address and not the object to which it points.Originally Posted by dwks
What? Really? That's amazing.You are one of a very select few who do. I've never see that before in over 20 years.
It does work? Oh, you mean doesn't. It does work, because all I want copied is the address.well, it really does work for char* either -- unless all you want copied is the address and not the object to which it points.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
technically you aren't doing assignment. You are doing initalization.
Denethor2000 instead of rationing out your limitations to us how about you give us all the info in the beginning?
A BYTE is nothing more then a fancy unsigned char.
how does it corrupt it?Changing both types to char[300] is accepted, but "corrupts" it.