Accessing .NET private members
-
Brian Delahunty wrote: I really like the: #define private public #define protected public way of doing it in C++... does this work.. can't try it here. Yes, it does work in VS 6. ------------------------------------------ "What happened in that Rhode Island club is shocking. To think that over a hundred people would attend a Great White concert." - The Onion
Brit wrote: Yes, it does work in VS 6. Cool :-D Regards, Brian Dela :-)
-
this guy? You've never heard of Dan Appleman? Pretty big in the vb world. He's written a pretty good whitepaper (and book too) on regex.
tidge wrote: this guy? You've never heard of Dan Appleman? I must confess my ignorance. But then again, I am happy to remain ignorant of everything, especially having to do with the VB world. :-D Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus
Every line of code is a liability - Taka Muraoka
Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files" -
tidge wrote: this guy? You've never heard of Dan Appleman? I must confess my ignorance. But then again, I am happy to remain ignorant of everything, especially having to do with the VB world. :-D Marc Help! I'm an AI running around in someone's f*cked up universe simulator.
Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus
Every line of code is a liability - Taka Muraoka
Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files" -
I just noticed a book review[^] on slashdot regarding techniques that allow you to access private members of classes. Anyone here know or has heard anything about this? Thought it was interesting, not sure how big a deal it is, though the book review seems to imply that it is not very difficult to do at all. Seems weird. ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
It is done through reflection... But you also need to give your code the rights to query for private members... Use the "Administrative Tools/Microsoft .NET Framework Configuration" utility to create permission sets and assign them to code groups (assemblies) When running your code from the VS.NET IDE you might actually have those rights, even though your code don't have those right when run as standalone. I dunno why this is, but one should keep it in mind when developing/using this ability... Even though one would expect privates to remain private whatsoever, this feature can come in quite handy when it comes to creating your own generic classes for serialization/deserialization. (Been there, done that...)
-
I just noticed a book review[^] on slashdot regarding techniques that allow you to access private members of classes. Anyone here know or has heard anything about this? Thought it was interesting, not sure how big a deal it is, though the book review seems to imply that it is not very difficult to do at all. Seems weird. ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
I consider it rude, not to mention an invasion of privacy, to access anyone's private members on the 'net. There oughtta be a law!:mad:
"Ask not for whom the bell tolls;
It tolls for thee..." -
I just noticed a book review[^] on slashdot regarding techniques that allow you to access private members of classes. Anyone here know or has heard anything about this? Thought it was interesting, not sure how big a deal it is, though the book review seems to imply that it is not very difficult to do at all. Seems weird. ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
It's obvious that they haven't spent all that much time with .NET. They're going at it a completely roundabout way. You can do it very easily through Reflection.
Hawaian shirts and shorts work too in Summer. People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage... -Anna-Jayne Metcalfe on Paintballing
-
It's obvious that they haven't spent all that much time with .NET. They're going at it a completely roundabout way. You can do it very easily through Reflection.
Hawaian shirts and shorts work too in Summer. People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage... -Anna-Jayne Metcalfe on Paintballing
Reflection allows you to easily list the members of a class (even private) but can you actually call those members easily? cheers, Chris Maunder
-
I just noticed a book review[^] on slashdot regarding techniques that allow you to access private members of classes. Anyone here know or has heard anything about this? Thought it was interesting, not sure how big a deal it is, though the book review seems to imply that it is not very difficult to do at all. Seems weird. ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
The comments under this are truly great: "OMG .NET sucks and is so secure. Perl is SO much better because you can do this anyway. Man - Microsoft really screwed up letting this bug through QA. Lucky that Java sandboxes everything so you can't do this so it's more secure. Blah blah blah blah blah". yaawwwwwwn cheers, Chris Maunder
-
I consider it rude, not to mention an invasion of privacy, to access anyone's private members on the 'net. There oughtta be a law!:mad:
"Ask not for whom the bell tolls;
It tolls for thee..."Roger Wright wrote: to access anyone's private members on the 'net :laugh: How about "In C++, only your
friend
s can handle yourprivate
parts" ?
Vikram. ----------------------------- My site due for a massive update Radioactive cats have 18 half-lives. "Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design. -
I consider it rude, not to mention an invasion of privacy, to access anyone's private members on the 'net. There oughtta be a law!:mad:
"Ask not for whom the bell tolls;
It tolls for thee..."Good one! :laugh: I don't keep much
private
these days, but I do like to feelprotected
. ;) Anna :rose: Homepage | My life in tears "Be yourself - not what others think you should be" - Marcia Graesch "Anna's just a sexy-looking lesbian tart" - A friend, trying to wind me up. It didn't work. Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In