I'm trying to workaround a microsoft bug by overring one of their
methods without subclassing.
I need to basically change a Control's vtable entry for the method
PaintBackground method and point it to my own custom method.
Are there facilities to inspect / modify an object vtable with the
standard .net libraries?
If not, what does the object format look like in memory? 8 3885
<sc*********@gmail.com> wrote: I'm trying to workaround a microsoft bug by overring one of their methods without subclassing.
I need to basically change a Control's vtable entry for the method PaintBackground method and point it to my own custom method.
Are there facilities to inspect / modify an object vtable with the standard .net libraries?
If not, what does the object format look like in memory?
I would certainly *hope* that you couldn't do that - the security
implications are horrific. You certainly won't be able to do it in safe
code.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... <sc*********@gmail.com> wrote: I'm trying to workaround a microsoft bug by overring one of their methods without subclassing.
I need to basically change a Control's vtable entry for the method PaintBackground method and point it to my own custom method.
Are there facilities to inspect / modify an object vtable with the standard .net libraries?
If not, what does the object format look like in memory?
I would certainly *hope* that you couldn't do that - the security implications are horrific. You certainly won't be able to do it in safe code.
The MethodRental class offers something similar, actually. It should be
possible in safe code, just not trusted code, IMHO.
"Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
message news:%2****************@tk2msftngp13.phx.gbl... "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message news:MP************************@msnews.microsoft.c om... <sc*********@gmail.com> wrote: I'm trying to workaround a microsoft bug by overring one of their methods without subclassing.
I need to basically change a Control's vtable entry for the method PaintBackground method and point it to my own custom method.
Are there facilities to inspect / modify an object vtable with the standard .net libraries?
If not, what does the object format look like in memory?
I would certainly *hope* that you couldn't do that - the security implications are horrific. You certainly won't be able to do it in safe code.
The MethodRental class offers something similar, actually. It should be possible in safe code, just not trusted code, IMHO.
Similar yes, but not usable in this scenario. SwapMethodBody is only for
user created dynamic modules and types.
Willy.
Willy Denoyette [MVP] wrote: "Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in message news:%2****************@tk2msftngp13.phx.gbl... "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message news:MP************************@msnews.microsoft.c om... <sc*********@gmail.com> wrote: I'm trying to workaround a microsoft bug by overring one of their methods without subclassing.
I need to basically change a Control's vtable entry for the method PaintBackground method and point it to my own custom method.
Are there facilities to inspect / modify an object vtable with the standard .net libraries?
If not, what does the object format look like in memory?
I would certainly *hope* that you couldn't do that - the security implications are horrific. You certainly won't be able to do it in safe code.
The MethodRental class offers something similar, actually. It should be possible in safe code, just not trusted code, IMHO.
Similar yes, but not usable in this scenario. SwapMethodBody is only for user created dynamic modules and types.
Willy.
It should be possible generally, given that all modules reside in a
single process boundary. I found a "better" solution to this problem
anyway (decompile microsoft code, fix the bug, and recompile it).
And break your license agreement! If you ever succeed in (successfully)
recompiling a complete assembly :-)
Willy.
<sc*********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com... Willy Denoyette [MVP] wrote: "Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in message news:%2****************@tk2msftngp13.phx.gbl... > > "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message > news:MP************************@msnews.microsoft.c om... >> <sc*********@gmail.com> wrote: >>> I'm trying to workaround a microsoft bug by overring one of their >>> methods without subclassing. >>> >>> I need to basically change a Control's vtable entry for the method >>> PaintBackground method and point it to my own custom method. >>> >>> Are there facilities to inspect / modify an object vtable with the >>> standard .net libraries? >>> >>> If not, what does the object format look like in memory? >> >> I would certainly *hope* that you couldn't do that - the security >> implications are horrific. You certainly won't be able to do it in >> safe >> code. >> > > The MethodRental class offers something similar, actually. It should be > possible in safe code, just not trusted code, IMHO. > >
Similar yes, but not usable in this scenario. SwapMethodBody is only for user created dynamic modules and types.
Willy.
It should be possible generally, given that all modules reside in a single process boundary. I found a "better" solution to this problem anyway (decompile microsoft code, fix the bug, and recompile it).
Willy Denoyette [MVP] wrote: And break your license agreement! If you ever succeed in (successfully) recompiling a complete assembly :-)
Willy.
Not the entire assembly, just a few controls. The bug was Microsoft
failure to support XP themes in windows forms.
MSDN claims it does, but if anyone actually bothered to test it they
would see a totally different story:
1. nested groupbox's labels are totally screwed up.
2. tabpage does not color using xp theme.
3. group box does not color using xp theme.
These bugs have been well known for years yet no one in MS bothered to
fix it. All they did was update MSDN with claims that xp themes are
fully supported in .net.
<sc*********@gmail.com> wrote in message news:11*********************@f14g2000cwb.googlegro ups.com... Willy Denoyette [MVP] wrote: "Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in message news:%2****************@tk2msftngp13.phx.gbl... > > "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message > news:MP************************@msnews.microsoft.c om... >> <sc*********@gmail.com> wrote: >>> I'm trying to workaround a microsoft bug by overring one of their >>> methods without subclassing. >>> >>> I need to basically change a Control's vtable entry for the method >>> PaintBackground method and point it to my own custom method. >>> >>> Are there facilities to inspect / modify an object vtable with the >>> standard .net libraries? >>> >>> If not, what does the object format look like in memory? >> >> I would certainly *hope* that you couldn't do that - the security >> implications are horrific. You certainly won't be able to do it in >> safe >> code. >> > > The MethodRental class offers something similar, actually. It should be > possible in safe code, just not trusted code, IMHO. > >
Similar yes, but not usable in this scenario. SwapMethodBody is only for user created dynamic modules and types.
Willy.
It should be possible generally, given that all modules reside in a single process boundary. I found a "better" solution to this problem anyway (decompile microsoft code, fix the bug, and recompile it).
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:OA**************@TK2MSFTNGP15.phx.gbl... "Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in message news:%2****************@tk2msftngp13.phx.gbl... "Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message news:MP************************@msnews.microsoft.c om... <sc*********@gmail.com> wrote: I'm trying to workaround a microsoft bug by overring one of their methods without subclassing.
I need to basically change a Control's vtable entry for the method PaintBackground method and point it to my own custom method.
Are there facilities to inspect / modify an object vtable with the standard .net libraries?
If not, what does the object format look like in memory?
I would certainly *hope* that you couldn't do that - the security implications are horrific. You certainly won't be able to do it in safe code.
The MethodRental class offers something similar, actually. It should be possible in safe code, just not trusted code, IMHO.
Similar yes, but not usable in this scenario. SwapMethodBody is only for user created dynamic modules and types.
Yeah, I couldn't recall if that restriction was there or not. The docs I
have are kinda weak right now. Still, with a little ingenuity...
>MSDN claims it does, but if anyone actually bothered to test it they would see a totally different story:
1. nested groupbox's labels are totally screwed up. 2. tabpage does not color using xp theme. 3. group box does not color using xp theme.
These bugs have been well known for years yet no one in MS bothered to fix it.
For #1 you have this
FIX: The captions of the GroupBox controls in your Windows Forms
application may be truncated and may appear in the wrong font after
you install the .NET Framework 1.1 Service Pack 1 http://support.microsoft.com/?kbid=890828
Mattias
--
Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Nolan Martin |
last post by:
Hello, I was wondering if it were possible to access the vtable directly.
Are there any resources that detail the inner workings of the vtable?
|
by: Sandeep |
last post by:
Hi,
In the following code, I wonder how a private member of the class is
being accessed. The code compiles well in Visual Studio 6.0.
class Sample
{
private:
int x;
public:
|
by: James FitzGerald |
last post by:
I am building a small memory model DOS exe (does not actually run in
dos but in a custom 16bit environment). For complex reasons I am not
allowed to have any relocatable items.
I have run into...
|
by: Eric Lilja |
last post by:
Using a macro, can I change what type an object is being cast to?
I know, the initial respone to question might be an instinctive "ugly, don't
even think about it!" or "don't use macros at all",...
|
by: harry |
last post by:
Hi ppl
I have a question about memory layout of a class. Consider the code
below:
class Base1 {
virtual void f() { cout << "Base1::f" << endl; }
virtual void g() { cout << "Base1::g" <<...
|
by: ZenRhapsody |
last post by:
Are ALL methods in subclasses implemented in C# with vtables and virtual
functions?
I know I could test this myself, but I'm still using Express edition of 2.0,
so I cannot view the optimized...
|
by: Rene |
last post by:
I keep reading about this vTables and it's killing me because I am not sure
what they are. I have a feeling that vTables are used when you override
virtual methods or properties but I really have...
|
by: Thierry Chappuis |
last post by:
Hi,
I'm interested in techniques used to program in an object-oriented way
using the C ANSI language. I'm studying the GObject library and Laurent
Deniau's OOPC framework published on his web...
|
by: puzzlecracker |
last post by:
I am kind of confused with the vpointer. Assuming the class has a
virtual function. Would ONE pointer (occupying 16 bits) to virtual
table be create for the class or One for each object? How...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |