From: Alexander Grigoriev on 23 Mar 2010 13:13 OS shutdown process commits all dirty pages, otherwise many other applications would be screwed. That happens before the file systems are shot down. "Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message news:uDuvyrqyKHA.1236(a)TK2MSFTNGP06.phx.gbl... > You mean the OS shutdown process calling ExitProcess() on an application > does is not listening to WM_QUERYENDSESSION? > > Alexander Grigoriev wrote: > >> You said you don't trust ExitProcess path to properly close any open >> handles for the mapped file to flush properly. I said ExitProcess path is >> no worse than your code. >> >> "Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message >> news:%232vT6YkyKHA.1796(a)TK2MSFTNGP02.phx.gbl... >>> Can you elaborate? >>> >>> Alexander Grigoriev wrote: >>> >>>> Handles closed implicitly by ExitProcess/TerminateProcess are closed >>>> for as good as with CloseFile. >>>> >>>> "Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message >>>> news:O2xDD5dyKHA.5036(a)TK2MSFTNGP02.phx.gbl... >>>>> Hugo gleaves(a)hotmail.com> <hugh wrote: >>>>> >>>>>> Finally read this sentence from a microsoft document about MMFs: >>>>>> "Changes made to a memory-mapped file through a view of the file, >>>>>> other than the system pagefile, are automatically written to disk >>>>>> when the view is unmapped or when the file-mapping object is >>>>>> deleted." >>>>>> >>>>>> This is taken from: >>>>>> http://msdn.microsoft.com/en-us/library/ms810613.aspx >>>>>> >>>>>> I think you have to admit, that if one refers to officially published >>>>>> material, then I am correct about this whole issue. Now if I am wrong >>>>>> (and I may be) then we must accept that that official system >>>>>> documentation is wrong. >>>>> Right, but the above is insight into giving you the engineering >>>>> requirement to prepare for it. In other words, it told programmers >>>>> what will happen. The programmer now needs to prepare to unmap or >>>>> delete the file map object to get the system to auto-flush for you. It >>>>> doesn't mean that if a program ends (gracefully) without properly >>>>> unmapped and deleting the object that the system will do this for you. >>>>> >>>>> Is it implied? I don't think so, I wouldn't trust it. You need to >>>>> close your handles properly. >>>>> >>>>> Lets say your code is running and it has an file mapping object open, >>>>> and has not be flushed yet. If your process get a WM_QUERYENDSESSION >>>>> and/or don't handle a system broadcasted exit or shutdown event and >>>>> don't begin a cleanup phase, what happens to the unflushed data? Are >>>>> you sure objects that are not programmatically closed by your process, >>>>> the OS will be quaranteed to be flushed for you? >>>>> >>>>> Can we simulate this with quick test? >>>>> >>>>> - create a small console program with a file map >>>>> - add SMALL AMOUNTS OF data to the mapping view, no flushing. >>>>> - pause by calling _getch() >>>>> >>>>> now abort the process by hitting control C. >>>>> >>>>> See if the data was FLUSHED to the disk file. >>>>> >>>>> I would also try this with a file across a network. >>>>> >>>>> >>>>> -- >>>>> HLS >>>> >>> >>> >>> -- >>> HLS >> >> > > > > -- > HLS
From: Hector Santos on 23 Mar 2010 14:05 Make sense. Alexander Grigoriev wrote: > OS shutdown process commits all dirty pages, otherwise many other > applications would be screwed. That happens before the file systems are shot > down. > > "Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message > news:uDuvyrqyKHA.1236(a)TK2MSFTNGP06.phx.gbl... >> You mean the OS shutdown process calling ExitProcess() on an application >> does is not listening to WM_QUERYENDSESSION? >> >> Alexander Grigoriev wrote: >> >>> You said you don't trust ExitProcess path to properly close any open >>> handles for the mapped file to flush properly. I said ExitProcess path is >>> no worse than your code. >>> >>> "Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message >>> news:%232vT6YkyKHA.1796(a)TK2MSFTNGP02.phx.gbl... >>>> Can you elaborate? >>>> >>>> Alexander Grigoriev wrote: >>>> >>>>> Handles closed implicitly by ExitProcess/TerminateProcess are closed >>>>> for as good as with CloseFile. >>>>> >>>>> "Hector Santos" <sant9442(a)nospam.gmail.com> wrote in message >>>>> news:O2xDD5dyKHA.5036(a)TK2MSFTNGP02.phx.gbl... >>>>>> Hugo gleaves(a)hotmail.com> <hugh wrote: >>>>>> >>>>>>> Finally read this sentence from a microsoft document about MMFs: >>>>>>> "Changes made to a memory-mapped file through a view of the file, >>>>>>> other than the system pagefile, are automatically written to disk >>>>>>> when the view is unmapped or when the file-mapping object is >>>>>>> deleted." >>>>>>> >>>>>>> This is taken from: >>>>>>> http://msdn.microsoft.com/en-us/library/ms810613.aspx >>>>>>> >>>>>>> I think you have to admit, that if one refers to officially published >>>>>>> material, then I am correct about this whole issue. Now if I am wrong >>>>>>> (and I may be) then we must accept that that official system >>>>>>> documentation is wrong. >>>>>> Right, but the above is insight into giving you the engineering >>>>>> requirement to prepare for it. In other words, it told programmers >>>>>> what will happen. The programmer now needs to prepare to unmap or >>>>>> delete the file map object to get the system to auto-flush for you. It >>>>>> doesn't mean that if a program ends (gracefully) without properly >>>>>> unmapped and deleting the object that the system will do this for you. >>>>>> >>>>>> Is it implied? I don't think so, I wouldn't trust it. You need to >>>>>> close your handles properly. >>>>>> >>>>>> Lets say your code is running and it has an file mapping object open, >>>>>> and has not be flushed yet. If your process get a WM_QUERYENDSESSION >>>>>> and/or don't handle a system broadcasted exit or shutdown event and >>>>>> don't begin a cleanup phase, what happens to the unflushed data? Are >>>>>> you sure objects that are not programmatically closed by your process, >>>>>> the OS will be quaranteed to be flushed for you? >>>>>> >>>>>> Can we simulate this with quick test? >>>>>> >>>>>> - create a small console program with a file map >>>>>> - add SMALL AMOUNTS OF data to the mapping view, no flushing. >>>>>> - pause by calling _getch() >>>>>> >>>>>> now abort the process by hitting control C. >>>>>> >>>>>> See if the data was FLUSHED to the disk file. >>>>>> >>>>>> I would also try this with a file across a network. >>>>>> >>>>>> >>>>>> -- >>>>>> HLS >>>> >>>> -- >>>> HLS >>> >> >> >> -- >> HLS > > -- HLS
First
|
Prev
|
Pages: 1 2 3 4 5 6 7 Prev: Disabling RPC MIDL rundown generation Next: Cheat anti-debuging application |