From: Prashant Shelar on
Hello,

1. I have injected a my own DLL into IE-8, when DLLMain is called i
have sub-classed IE-8 main window procedure.

2. After sub-classing the main window i have sub-classed a window
where i put my caret. That is when i click at TextBox that window is
sub-classed.

3. This is working fine with all other application and versions (IE7
and lower also mozilla) but fails in IE8 and get a Error Code : 5
(Access Denied)


4. Even I have checked the my application thread and process priority
with IE-8 so it found same.

Can anybody suggest why this is happening so that i can extract a
solution from it.

Thanks

From: Leo Davidson on
On May 10, 8:24 am, Prashant Shelar <shelar...(a)gmail.com> wrote:

> 1. I have injected a my own DLL into IE-8, when DLLMain is called i
> have sub-classed IE-8 main window procedure.

Doing that from DllMain isn't legal and may lead to problems, BTW.
Doing anything much, other than creating a critical section or two, in
DllMain isn't legal. See the DllMain docs in MSDN (although that they
are annoyingly vague on what is actually legal).


> 3. This is working fine with all other application and versions (IE7
> and lower also mozilla) but fails in IE8 and get a Error Code : 5
> (Access Denied)

I expect it's something to do with Protected Mode IE and/or the fact
that IE uses multiple processes for different groups of tab.

The window you're trying to subclass may not be part of the process
your DLL has been loaded into. (You can have windows from multiple
processes are all part of the same top-level window and appear as a
single application to the user.)

You can use GetWindowThreadProcessId to see if a window belongs to the
same process (although, since it is a User32.dll function, calling
that in DllMain is explicitly against the DllMain guidelines).
From: Prashant Shelar on
On May 10, 3:06 pm, Leo Davidson <leonudeldavid...(a)googlemail.com>
wrote:
> On May 10, 8:24 am, Prashant Shelar <shelar...(a)gmail.com> wrote:
>
> > 1. I have injected a my own DLL into IE-8, when DLLMain is called i
> > have sub-classed IE-8 main window procedure.
>
> Doing that from DllMain isn't legal and may lead to problems, BTW.
> Doing anything much, other than creating a critical section or two, in
> DllMain isn't legal. See the DllMain docs in MSDN (although that they
> are annoyingly vague on what is actually legal).
>
> > 3. This is working fine with all other application and versions (IE7
> > and lower also mozilla) but fails in IE8 and get a Error Code : 5
> > (Access Denied)
>
> I expect it's something to do with Protected Mode IE and/or the fact
> that IE uses multiple processes for different groups of tab.
>
> The window you're trying to subclass may not be part of the process
> your DLL has been loaded into. (You can have windows from multiple
> processes are all part of the same top-level window and appear as a
> single application to the user.)
>
> You can use GetWindowThreadProcessId to see if a window belongs to the
> same process (although, since it is a User32.dll function, calling
> that in DllMain is explicitly against the DllMain guidelines).

I think i got the answer - I verified the process that are used to
create TABs in IE-8 and found that each tab has created by different
process. Thanks for suggestion.
From: Jochen Kalmbach on
Hi Prashant!

> I think i got the answer - I verified the process that are used to
> create TABs in IE-8 and found that each tab has created by different
> process. Thanks for suggestion.

Also be aware of the new subclassing functions, which are more safe than
the old-style SetWindowLongPtr approach...

See: Subclassing Controls
http://msdn.microsoft.com/en-us/library/bb773183

Greetings
Jochen