Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. A story about code-frog, shog, Surfulater and DEP

A story about code-frog, shog, Surfulater and DEP

Scheduled Pinned Locked Moved The Lounge
helpcomhardwareannouncementlearning
19 Posts 9 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C code frog 0

    Interestingly enough there were two things I discovered with regard to this. DEP at the hardware level (motherboard) and DEP at the software level (OS) might also enable something called PAE (I think that's it.). Remember a while back I could not see all 4 gigs of my memory. 3.2 was my physical limit. Everyone thought Windows 2003 would fix that (myself included). Turns out that DEP and PAE fix that. I'm totally paraphrasing here and I'm not even going to bother googling to be sure I'm right but PAE enables 64 bit (I think that's what I read) memory addressing and reservation. Once it was enabled all 4 gigs of memory showed up. So if you are throttled at 3.2 and want all 4.0 gigs you might investigate DEP and PAE more closely. I lied about not Googling. Here's a link to PAE http://www.microsoft.com/whdc/system/platform/server/PAE/PAEdrv.mspx[^] Also be aware that each motherboard manufacturer may use their own name for DEP. Intel uses Nx and if you recall I'm using a 955-XBK and thanks to Michael I'm running it in RAID-0,1 (thanks to Jeffry Brickly for educating me on RAID-0,1). See! If you just hang out at CP long enough you can learn all sorts of crazy stuff. I'm an addict!:-O


    If we all used the Plain English compiler every post in the lounge would be a programming question.:cool: Welcome to CP in your language. Post the unicode version in My CP Blog [ ^ ] now. People who don't understand how awesome Firefox is have never used CPhog. The act of using CPhog alone doesn't make Firefox cool. It opens your eyes to the possibilities and then you start looking for other things like CPhog and your eyes are suddenly open to all sorts of useful things all through Firefox. - (Self Quote)

    N Offline
    N Offline
    Neville Franks
    wrote on last edited by
    #6

    Rex, thanks for mentioning that. When Surfulater wouldn't even start on your PC one thought that crossed my mind was whether this change from 3.2 to 4.0 gig of RAM was somehow playing a part, mainly because I do stuff with Memory Mapped Files. As you know it made absolutely no sense that Surfulater wouldn't even start. It turned out the RAM increase wasn't relevant. Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com

    C 1 Reply Last reply
    0
    • N Neville Franks

      Rex, thanks for mentioning that. When Surfulater wouldn't even start on your PC one thought that crossed my mind was whether this change from 3.2 to 4.0 gig of RAM was somehow playing a part, mainly because I do stuff with Memory Mapped Files. As you know it made absolutely no sense that Surfulater wouldn't even start. It turned out the RAM increase wasn't relevant. Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com

      C Offline
      C Offline
      code frog 0
      wrote on last edited by
      #7

      Well I think the way we approached it we were going to find out the problem one way or another. Thankfully it was DEP and we didn't have to physically swap memory sticks around. That was my next concern if your rebuild hadn't worked. I was thinking to yank 2 and test, swap those 2 and test etc... To see if maybe I had bad memory somewhere. Pretty amazing to learn about something like that on your PC. You'd think a little more promotion would have gone in to letting people know about DEP and what problems it can cause. It was on your board and OS and you didn't even know you had the option to run it. But in running it you have better protection against viruses and stuff. Seems like every day there is something new to learn...:sigh: which makes you sigh but it's kind of cool to learn new things to. - Rex


      If we all used the Plain English compiler every post in the lounge would be a programming question.:cool:
      Welcome to CP in your language. Post the unicode version in My CP Blog [ ^ ] now.

      People who don't understand how awesome Firefox is have never used CPhog. The act of using CPhog alone doesn't make Firefox cool. It opens your eyes to the possibilities and then you start looking for other things like CPhog and your eyes are suddenly open to all sorts of useful things all through Firefox. - (Self Quote)

      1 Reply Last reply
      0
      • C code frog 0

        Interestingly enough there were two things I discovered with regard to this. DEP at the hardware level (motherboard) and DEP at the software level (OS) might also enable something called PAE (I think that's it.). Remember a while back I could not see all 4 gigs of my memory. 3.2 was my physical limit. Everyone thought Windows 2003 would fix that (myself included). Turns out that DEP and PAE fix that. I'm totally paraphrasing here and I'm not even going to bother googling to be sure I'm right but PAE enables 64 bit (I think that's what I read) memory addressing and reservation. Once it was enabled all 4 gigs of memory showed up. So if you are throttled at 3.2 and want all 4.0 gigs you might investigate DEP and PAE more closely. I lied about not Googling. Here's a link to PAE http://www.microsoft.com/whdc/system/platform/server/PAE/PAEdrv.mspx[^] Also be aware that each motherboard manufacturer may use their own name for DEP. Intel uses Nx and if you recall I'm using a 955-XBK and thanks to Michael I'm running it in RAID-0,1 (thanks to Jeffry Brickly for educating me on RAID-0,1). See! If you just hang out at CP long enough you can learn all sorts of crazy stuff. I'm an addict!:-O


        If we all used the Plain English compiler every post in the lounge would be a programming question.:cool: Welcome to CP in your language. Post the unicode version in My CP Blog [ ^ ] now. People who don't understand how awesome Firefox is have never used CPhog. The act of using CPhog alone doesn't make Firefox cool. It opens your eyes to the possibilities and then you start looking for other things like CPhog and your eyes are suddenly open to all sorts of useful things all through Firefox. - (Self Quote)

        J Offline
        J Offline
        Jim Crafton
        wrote on last edited by
        #8

        Juts out of curiousity: how can you have access to the whole 4 gigs? I thought it was a requirement that the OS keep aside 1 Gig (or 2 gig in the more traditional layout) just for itself? Is this not the case? If it's not, how do you prevent userland memory from completely clobbering kernel mem? ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF!

        S 1 Reply Last reply
        0
        • N Neville Franks

          Long story short. Had a serious problem that code-frog (Rex) reported earlier this month where Surfulater would crash. Follows on from a report of the same problem back in Dec 2005 that I never resolved. After fantastic help from Rex he worked out that DEP (Data Execution Prevention) was causing the crash. After I enabled Hardware DEP I was finally able to reproduce the crash and track it down to some code that shog wrote back in Dec 2001 (see: http://www.codeproject.com/miscctrl/balloonhelp.as[^]) I use a sub-set of this code. Fortunately others had already found and fixed the problem and I'm most grateful to KHDev4u for his solution. But the real hero of the day is Rex, who I can't thank enough.:rose: And of course shog for his great code as well.:rose: I've written a long version of this here http://blog.surfulater.com/2006/05/22/data-execution-protection-rex-winn/[^] And the moral of this story is make sure you enable Hardware and Software DEP and test your code thoroughly in this environment. Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com

          S Offline
          S Offline
          Shog9 0
          wrote on last edited by
          #9

          Heh, looks like it's about time i updated that article... :-O

          ----

          Grease Paint and Monkey Brains

          A 1 Reply Last reply
          0
          • J Jim Crafton

            Juts out of curiousity: how can you have access to the whole 4 gigs? I thought it was a requirement that the OS keep aside 1 Gig (or 2 gig in the more traditional layout) just for itself? Is this not the case? If it's not, how do you prevent userland memory from completely clobbering kernel mem? ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF!

            S Offline
            S Offline
            S Senthil Kumar
            wrote on last edited by
            #10

            PAE (Physical Address Extension) allows the CPU (and hence the OS) to access memory above the 4 Gig limit (imposed by the 32 address pins in the processor). Processors that support PAE have 36 address pins and therefore can access 2^36=64 Gigs of RAM. PAE has no effect on the Virtual Address space that Windows allocates to each process, it still remains 4 GB, with 2 GB taken up by the OS, unless you turn on /3GB in boot.ini, in which case the OS share reduces to ~1.2 GB. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

            R 1 Reply Last reply
            0
            • S S Senthil Kumar

              PAE (Physical Address Extension) allows the CPU (and hence the OS) to access memory above the 4 Gig limit (imposed by the 32 address pins in the processor). Processors that support PAE have 36 address pins and therefore can access 2^36=64 Gigs of RAM. PAE has no effect on the Virtual Address space that Windows allocates to each process, it still remains 4 GB, with 2 GB taken up by the OS, unless you turn on /3GB in boot.ini, in which case the OS share reduces to ~1.2 GB. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

              R Offline
              R Offline
              Rick York
              wrote on last edited by
              #11

              Reducing the OS down to around 1GB can be hazardous. I had a customer try it on a system with a huge amount of stuff running as services in kernel mode and that thing was paging so hard they couldn't even open notepad to fix their boot.ini file and restart. They had to copy the boot.ini file to the machine to undo the /3GB switch. The reason they tried this in the first place is that they process some enormous data files and our app occasionally wants to use over 2GB and vomits when it tries.

              M 1 Reply Last reply
              0
              • R Rick York

                Reducing the OS down to around 1GB can be hazardous. I had a customer try it on a system with a huge amount of stuff running as services in kernel mode and that thing was paging so hard they couldn't even open notepad to fix their boot.ini file and restart. They had to copy the boot.ini file to the machine to undo the /3GB switch. The reason they tried this in the first place is that they process some enormous data files and our app occasionally wants to use over 2GB and vomits when it tries.

                M Offline
                M Offline
                Mike Dimmick
                wrote on last edited by
                #12

                Unless your app was linked with /LARGEADDRESSAWARE, it wouldn't have helped anyway - your application would still be limited to a 2GB address space, the space between 2GB and 3GB going unused. Stability. What an interesting concept. -- Chris Maunder

                1 Reply Last reply
                0
                • N Neville Franks

                  Long story short. Had a serious problem that code-frog (Rex) reported earlier this month where Surfulater would crash. Follows on from a report of the same problem back in Dec 2005 that I never resolved. After fantastic help from Rex he worked out that DEP (Data Execution Prevention) was causing the crash. After I enabled Hardware DEP I was finally able to reproduce the crash and track it down to some code that shog wrote back in Dec 2001 (see: http://www.codeproject.com/miscctrl/balloonhelp.as[^]) I use a sub-set of this code. Fortunately others had already found and fixed the problem and I'm most grateful to KHDev4u for his solution. But the real hero of the day is Rex, who I can't thank enough.:rose: And of course shog for his great code as well.:rose: I've written a long version of this here http://blog.surfulater.com/2006/05/22/data-execution-protection-rex-winn/[^] And the moral of this story is make sure you enable Hardware and Software DEP and test your code thoroughly in this environment. Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com

                  M Offline
                  M Offline
                  Mike Dimmick
                  wrote on last edited by
                  #13

                  Another difference between XP SP2 and Server 2003 SP1 is that, IIRC, XP defaults to DEP 'Opt In' while Server 2003 defaults to 'Opt Out'. This setting is in the System control panel applet, Advanced tab, click Performance, the Data Execution Prevention tab. The options are "Turn on DEP for essential Windows programs and services only" (i.e. "Opt In") or "Turn on DEP for all programs and services except those I specify" (Opt Out), with a box to specify programs to exclude. This may be why you couldn't replicate it even after turning Hardware DEP on. It's still possible to execute dynamically-generated code, but you must tell the OS which regions you plan to do this from. For memory allocated with VirtualAlloc, either supply PAGE_EXECUTE_READWRITE at the point of allocation, or use VirtualProtect to apply PAGE_EXECUTE subsequently. For heap memory, specify the HEAP_CREATE_ENABLE_EXECUTE flag when calling HeapCreate. It's not possible to specify this after creation, and the process default heap does not allow it IIRC. Stability. What an interesting concept. -- Chris Maunder

                  N 1 Reply Last reply
                  0
                  • M Mike Dimmick

                    Another difference between XP SP2 and Server 2003 SP1 is that, IIRC, XP defaults to DEP 'Opt In' while Server 2003 defaults to 'Opt Out'. This setting is in the System control panel applet, Advanced tab, click Performance, the Data Execution Prevention tab. The options are "Turn on DEP for essential Windows programs and services only" (i.e. "Opt In") or "Turn on DEP for all programs and services except those I specify" (Opt Out), with a box to specify programs to exclude. This may be why you couldn't replicate it even after turning Hardware DEP on. It's still possible to execute dynamically-generated code, but you must tell the OS which regions you plan to do this from. For memory allocated with VirtualAlloc, either supply PAGE_EXECUTE_READWRITE at the point of allocation, or use VirtualProtect to apply PAGE_EXECUTE subsequently. For heap memory, specify the HEAP_CREATE_ENABLE_EXECUTE flag when calling HeapCreate. It's not possible to specify this after creation, and the process default heap does not allow it IIRC. Stability. What an interesting concept. -- Chris Maunder

                    N Offline
                    N Offline
                    Neville Franks
                    wrote on last edited by
                    #14

                    When Rex and I were going back and forth on this he got to a point where turning off Hardware DEP made no difference. ie. Surfulater still wouldn't start. There is a post in shog's article suggesting a solution using VirtualProtect() or similar, but other solutions including the one I adopted replaced the dynamically generated code (thunk), all together, which seems to me the best approach. It will be interesting to watch programs stop working as over time DEP becomes more widely used. Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com

                    M 1 Reply Last reply
                    0
                    • N Neville Franks

                      When Rex and I were going back and forth on this he got to a point where turning off Hardware DEP made no difference. ie. Surfulater still wouldn't start. There is a post in shog's article suggesting a solution using VirtualProtect() or similar, but other solutions including the one I adopted replaced the dynamically generated code (thunk), all together, which seems to me the best approach. It will be interesting to watch programs stop working as over time DEP becomes more widely used. Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com

                      M Offline
                      M Offline
                      Mike Dimmick
                      wrote on last edited by
                      #15

                      Programs using ATL windowing may well not work, because ATL uses dynamically-generated thunks to map from the static WindowProc implementation to the class's own WndProc (basically to work out what the this pointer should be). In ATL 3.0 (which came with VS 6.0) this is a member of the CWindowImplRoot class template, so you'd have to allocate your window objects on an appropriately-configured heap to avoid DEP problems. ATL 7.1 (VS.NET 2003) has new code which allocates these thunks from the process-default heap, regardless of where the window object is allocated. ATL 8.0 has really wacky code used to work out if NX is enabled and VirtualAllocs special space for the thunks if it is. Stability. What an interesting concept. -- Chris Maunder

                      N 1 Reply Last reply
                      0
                      • M Mike Dimmick

                        Programs using ATL windowing may well not work, because ATL uses dynamically-generated thunks to map from the static WindowProc implementation to the class's own WndProc (basically to work out what the this pointer should be). In ATL 3.0 (which came with VS 6.0) this is a member of the CWindowImplRoot class template, so you'd have to allocate your window objects on an appropriately-configured heap to avoid DEP problems. ATL 7.1 (VS.NET 2003) has new code which allocates these thunks from the process-default heap, regardless of where the window object is allocated. ATL 8.0 has really wacky code used to work out if NX is enabled and VirtualAllocs special space for the thunks if it is. Stability. What an interesting concept. -- Chris Maunder

                        N Offline
                        N Offline
                        Neville Franks
                        wrote on last edited by
                        #16

                        Thanks for that Mike. Makes me glad I'm not using ATL.:) Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com

                        1 Reply Last reply
                        0
                        • S Shog9 0

                          Heh, looks like it's about time i updated that article... :-O

                          ----

                          Grease Paint and Monkey Brains

                          A Offline
                          A Offline
                          Anna Jayne Metcalfe
                          wrote on last edited by
                          #17

                          Maybe it is. ;) I've an update to the WTL version incorporating the DEP patch and theme support if you want it...:cool: Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "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.

                          S 1 Reply Last reply
                          0
                          • A Anna Jayne Metcalfe

                            Maybe it is. ;) I've an update to the WTL version incorporating the DEP patch and theme support if you want it...:cool: Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "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.

                            S Offline
                            S Offline
                            Shog9 0
                            wrote on last edited by
                            #18

                            Sure, send it on. :)

                            ---- Scripts i’ve known... CPhog 1.0.0.0 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                            A 1 Reply Last reply
                            0
                            • S Shog9 0

                              Sure, send it on. :)

                              ---- Scripts i’ve known... CPhog 1.0.0.0 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                              A Offline
                              A Offline
                              Anna Jayne Metcalfe
                              wrote on last edited by
                              #19

                              You should have it later today then. :) Anna :rose: Currently working mostly on: Visual Lint :cool: Anna's Place | Tears and Laughter "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.

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups