wtller | 1 Feb 2009 05:25
Picon
Favicon

Can anyone write an article to explain how ATL/WTL bypass the DEP

i know the new version of ATL/WTL has a new implementaion to
workaround DEP.

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:wtl-digest@... 
    mailto:wtl-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    wtl-unsubscribe@...

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Igor Tandetnik | 1 Feb 2009 05:45
Favicon

Re: Can anyone write an article to explain how ATL/WTL bypass the DEP

"wtller" <wtller@...> wrote in
message news:gm387e+kteo@...
> i know the new version of ATL/WTL has a new implementaion to
> workaround DEP.

ATL allocates memory for the thunk with VirtualAlloc. Once the thunk is 
set up, it calls VirtualProtect to set PAGE_EXECUTE flag on the page.
-- 
With best wishes,
    Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925 

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

(Continue reading)

Dick Dievendorff | 2 Feb 2009 06:35
Picon

Rich Edit control captures my cursor!

I'm wrestling with a Rich Edit control that I'm using as a read-only event
logging window.

When events occur, I AppendText to the rich edit control.  I also use
LineScroll to scroll down by the number of lines I've inserted.

My problem is the cursor.  When I start a long process (that spans multiple
windows messages), I load an IDC_WAIT cursor in my WM_SETCURSOR handler.
This is working fine.

However when I'm all done and restore the cursor (and call SetCursor with
the old cursor), the wait cursor remains, over my rich edit control, until I
move the cursor slightly with the mouse, then it changes to an I-bar cursor.

I'd like to keep the input focus away from the readonly rich edit control
to another control in my dialog, using GotoDlgCtrl(a button).  I'm doing
this in my OnInitDialog method (returning 0), in my OnShowWindow handler,
and also right after I restore the cursor to its earlier non-wait cursor.
None of the GoToDlgCtrl calls moves the cursor to the chosen control, it
remains over my read-only rich edit control, which is the first control in
the dialog.

What is it about Rich Edit windows that are so insistent about holding the
cursor focus?

The RichEdit control is set up in a dialog with this RC statement:

"", IDC_RICHEDIT_LOADER, "RichEdit20A", ES_MULTILINE | ES_AUTOHSCROLL  |
ES_READONLY | WS_BORDER | WS_VSCROLL | WS_HSCROLL.  It does not have a
WS_TABSTOP.
(Continue reading)

Angus Comber | 2 Feb 2009 08:46

Re: Re: Can anyone write an article to explain how ATL/WTL bypass the DEP

What version of ATL/WTL is required?  Is this a reason to upgrade?  I am not sure what the issue is here?

  ----- Original Message ----- 
  From: Igor Tandetnik 
  To: wtl@... 
  Sent: Sunday, February 01, 2009 4:45 AM
  Subject: [wtl] Re: Can anyone write an article to explain how ATL/WTL bypass the DEP

  "wtller" <wtller@...> wrote in
  message news:gm387e+kteo@...
  > i know the new version of ATL/WTL has a new implementaion to
  > workaround DEP.

  ATL allocates memory for the thunk with VirtualAlloc. Once the thunk is 
  set up, it calls VirtualProtect to set PAGE_EXECUTE flag on the page.
  -- 
  With best wishes,
  Igor Tandetnik

  With sufficient thrust, pigs fly just fine. However, this is not 
  necessarily a good idea. It is hard to be sure where they are going to 
  land, and it could be dangerous sitting under them as they fly 
  overhead. -- RFC 1925 

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

(Continue reading)

Nikos Bozinis | 2 Feb 2009 09:22
Picon
Favicon

Re: Can anyone write an article to explain how ATL/WTL bypass the DEP

--- In wtl@..., "wtller" <wtller <at> ...> wrote:
>
> i know the new version of ATL/WTL has a new implementaion to
> workaround DEP.
>

see this: (it's written for 64 bit but it's also for general ATL3 code)
www.zabkat.com/blog/26Oct08-x64-development-with-VS6-and-ATL3.htm

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wtl/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/wtl/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:wtl-digest@... 
    mailto:wtl-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
    wtl-unsubscribe@...

(Continue reading)

domehead100 | 2 Feb 2009 15:43
Picon

Re: Rich Edit control captures my cursor!

Hi Dick,

I'll just throw out some thoughts:

1)  You might try to eat the WM_SETFOCUS message when it is received 
by the rich edit.  If you eat it (either in a message handler by 
setting it handled or in a PreTranslateMessage function by returning 
TRUE), then the rich edit would never know that is has received focus 
and won't try to show it's caret.

2)  You might call HideCaret(), either in a setfocus handler or in 
PreTranslateMessage.

3)  In the parent dialog, you might try an EN_SETFOCUS handler, which 
will be sent by the rich edit to it's parent when it receives focus 
and set the focus to another control in that handler.

4)  Not sure, if if there is a way to set the background and text 
colors appropriately, the best behavior would be if the rich edit was 
disabled instead of read only.  That would prevent it from receiving 
focus altogether (though it would probably also prevent selecting of 
text via the mouse).

Sorry I don't have anything more concrete to suggest at this point, 
but good luck with it.

~Mike

--- In wtl@..., "Dick Dievendorff" <dieven <at> ...> wrote:
>
(Continue reading)

Mojtaba Fathi | 1 Feb 2009 08:28
Picon
Favicon

This seems to be a small bug


Hi All

I use DDX_FLOAT_P macro in my application to read a double number from an Edit control. But whenever the user
enters "-0" in Edit box, it simply fails. I traced the code and reached to the following line:

======================================================
FILE: atlddx.h
    static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d)
    {
        ATLASSERT(lpszText != NULL);
        while (*lpszText == _T(' ') || *lpszText == _T('\t'))
            lpszText++;

        TCHAR chFirst = lpszText[0];
        d = _tcstod(lpszText, (LPTSTR*)&lpszText);
        if (d == 0.0 && chFirst != _T('0'))
            return FALSE;   // could not convert
======================================================

Highlighted line is the one which causes the failure. I think it should be changed to:
        if (d == 0.0 && chFirst != _T('0') && chFirst != _T(' '))

to avoid the problem. Any other suggestions?

Regards, Moji the Great

[Non-text portions of this message have been removed]

------------------------------------
(Continue reading)

Mojtaba Fathi | 1 Feb 2009 09:08
Picon
Favicon

This seems to be a small bug (CORRECTION)


Hi again

I had a mistake in my suggestion. The correct one seems to be:

        if (d == 0.0 && chFirst != _T('0') && chFirst != _T('-'))

Any other suggestions?

Regards, Moji the Great

Hi All

I use DDX_FLOAT_P macro in my application to read a double number from an Edit control. But whenever the user
enters "-0" in Edit box, it simply fails. I traced the code and reached to the following line:

======================================================
FILE: atlddx.h
    static BOOL _AtlSimpleFloatParse(LPCTSTR lpszText, double& d)
    {
        ATLASSERT(lpszText != NULL);
        while (*lpszText == _T(' ') || *lpszText == _T('\t'))
            lpszText++;

        TCHAR chFirst = lpszText[0];
        d = _tcstod(lpszText, (LPTSTR*)&lpszText);
        if (d == 0.0 && chFirst != _T('0'))
            return FALSE;   // could not convert
======================================================

(Continue reading)

Dick Dievendorff | 2 Feb 2009 18:44
Picon

RE: Re: Rich Edit control captures my cursor!

Thanks, Mike, you've given me a lot of leads.

I do want to allow the user to select text from the rich edit control, so I
don't want to disable it.

Adding an EnOnSetFocus handler shows me that I've been confused about Focus.
The Rich Edit control doesn't receive focus when it shouldn't, and it
doesn't enter my EN_SETFOCUS handler unless I click it.  All my GotoDlgCtrls
are working fine, as the right button has the focus.  

The issue is just the mouse cursor position and restoring the cursor in the
rich edit control when the wait is over.

I've clicked a button on a parent dialog that launches this dialog.  The
cursor remains in about the same screen position of the button in the parent
dialog, which happens to be over the rich edit control in my dialog.   When
I start the long operation, I load and set a wait cursor.  When I'm done
waiting, I issue SetCursor to the old cursor, but that isn't restoring the
rich edit control's cursor.  Maybe my OnSetCursor isn't quite right.  I want
my wait cursor to be the hourglass when over the client area (as opposed to
the title bar), and I want the cancel button to use its normal IDC_ARROW
cursor.

The cursor is correct when I'm waiting.  When I move it around the dialog,
it shows the hourglass when it should, and shows the IDC_ARROW over my
Cancel button and when I move to the title bar (outside the client area).
So the wait cursor over the rich edit control is right until I try to
restore it to the "old" cursor.

My thinking is that I have to somehow tell the Rich Edit control to restore
(Continue reading)

Dick Dievendorff | 2 Feb 2009 19:54
Picon

RE: Re: Rich Edit control captures my cursor!

Found it. 

I was kicking off the long-running operation from my OnInitDialog method.  I
saved the cursor that was then current, which happened to be the wait cursor
that is displayed during the initial creation of my dialog. When the
long-running operation ended, I restored the old cursor, which was a Wait
cursor.

I moved the code that starts the long-running operation (and the call to my
ShowWaitCursor) to an "OnShowWindow" method, where the current cursor is the
normal IDC_ARROW cursor.  Now when I restore the cursor after the
long-running operation, the restored cursor value isn't the hourglass.

I got off on this "focus" tangent, mistaking cursor position with keyboard
focus.

I'm not sure that I'm restoring the appropriate cursor, though.  What if
someone starts a long operation, the old cursor is remembered from where the
mouse is at the time the operation starts, then the user moves the cursor to
another control before the long running operation ends, and restore cursor
just restores the wrong cursor value.

Thanks, Mike!

Dick

From: wtl@...
[mailto:wtl@...] On Behalf Of Dick
Dievendorff
Sent: Monday, February 02, 2009 9:44 AM
(Continue reading)


Gmane