1

Topic: VirtualAlloc and MapViewOfFile

Hello! Not a secret that mapviewoffile suffers failure by operation with big enough file on the size. A question - whether it is possible to cure it if at first to cause CreateFileMapping or MapViewOfFile with flag MEM_RESERVE? For enough big area of storage. And then to learn memory size which it is possible  (by the way it can be made what function?) to conclude the code of operation with storage in SEH and at origin of an error of access to storage to cause MapViewOfFile repeatedly with instructions of flag MEM_COMMIT and the size of the unit which the system is capable to select? Did something similar with VirtualAlloc, and now I want to understand as it it is possible to make for an image of a file.

2

Re: VirtualAlloc and MapViewOfFile

Hello, Poseidon, you wrote: P> Hello! Not a secret that mapviewoffile suffers failure by operation with big enough file on the size. P> a question - whether it is possible to cure it if at first to cause CreateFileMapping or MapViewOfFile with flag MEM_RESERVE? P> For enough big area of storage. P> and then to learn memory size which it is possible  (by the way it can be made what function?) P> to Conclude the code of operation with storage in SEH and at origin of an error of access to storage to cause MapViewOfFile P> repeatedly with instructions of flag MEM_COMMIT and the size of the unit which the system is capable to select? P> did something similar with VirtualAlloc, and now I want to understand as it it is possible to make for an image of a file. MEM_RESERVE it is normally used if it is necessary to select storage to the certain address. If the address does not matter, it is possible simply MEM_COMMIT. If what that is problems with the big files (about what I do not know), it is possible simply  all file, and its part? 3 last arguments MapViewOfFile see.

3

Re: VirtualAlloc and MapViewOfFile

Hello, Poseidon, you wrote: P> Hello! Not a secret that mapviewoffile suffers failure by operation with big enough file on the size. P> a question - whether it is possible to cure it if at first to cause CreateFileMapping or MapViewOfFile with flag MEM_RESERVE? No. 1. MapViewOfFile cannot  in the specified storage. MapViewOfFileEx can, but that storage should be free, instead of is reserved. 2. Failure  the big files can be in the absence of an appropriate continuous piece of address space. But it concerns shortage of physical storage a little. That can help: usage x64 and the assembly with/LARGEADDRESSAWARE. Then will be 8 TB address space, 128 TB since Windows 8.1

4

Re: VirtualAlloc and MapViewOfFile

Hello, Alexander G, you wrote: AG> Hello, Poseidon, you wrote: P>> Hello! Not a secret that mapviewoffile suffers failure by operation with big enough file on the size. P>> a question - whether it is possible to cure it if at first to cause CreateFileMapping or MapViewOfFile with flag MEM_RESERVE? AG> Is not present. AG> 1. MapViewOfFile cannot  in the specified storage. MapViewOfFileEx can, but that storage should be free, instead of is reserved. AG> 2. Failure  the big files can be in the absence of an appropriate continuous piece of address space. But it concerns shortage of physical storage a little. AG> that can help: usage x64 and the assembly with/LARGEADDRESSAWARE. Then will be 8 TB address space, 128 TB since Windows 8.1 I use lpvBase=MapViewOfFile (hFileMap, FILE_MAP_WRITE, 0,0, cb); if (NULL == lpvBase) dwError=GetLastError (); if (NULL == lpvBase) {n=FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwError, 0, (LPTSTR) &lpMsgBuf, 0, NULL);... Writes "not enough storage for command handling" though a file not such big, whether hardly less than 1  on a disk 19  it is freely possible to learn in advance what volume it is possible safely ?

5

Re: VirtualAlloc and MapViewOfFile

Hello, Poseidon, you wrote: P> though a file not such big, whether hardly less than 1  P> on a disk 19  freely P> it is possible to learn in advance what volume it is possible safely ? It is possible to make, for example, a flash card through VirtualQuery, or to try VirtualAlloc and then to release. But it is unreliable: storage can become  between check and a call. I so understand, system 64-bit, application 32-bit? 1  it is that volume for which failure  in normal 32 bit application is predicted - there only 2  address space. Simple switching-on/LARGEADDRESSAWARE increases it to 4 : It increases chances of success. Transfer on x64 together with included/LARGEADDRESSAWARE gives from 8 , well that is  1  at all a problem becomes. (Transfer on 64 without switching-on/LARGEADDRESSAWARE does not give anything)

6

Re: VirtualAlloc and MapViewOfFile

Hello, Poseidon, you wrote: Download here it https://docs.microsoft.com/en-us/sysint … oads/vmmap P> I use Here here something like getch () that the program stopped. Launch it without debugging. P> lpvBase=MapViewOfFile (hFileMap, FILE_MAP_WRITE, 0,0, cb); and when it reaches this place, launch vmmap and look, what there the biggest continuous free section. If <the file size - really does not suffice If> - search at itself for an error.

7

Re: VirtualAlloc and MapViewOfFile

Hello, Poseidon, you wrote: P> Hello! Not a secret that mapviewoffile suffers failure by operation with big enough file on the size. P> a question - whether it is possible to cure it if at first to cause CreateFileMapping or MapViewOfFile with flag MEM_RESERVE? P> For enough big area of storage. P> and then to learn memory size which it is possible  (by the way it can be made what function?) P> to Conclude the code of operation with storage in SEH and at origin of an error of access to storage to cause MapViewOfFile P> repeatedly with instructions of flag MEM_COMMIT and the size of the unit which the system is capable to select? P> did something similar with VirtualAlloc, and now I want to understand as it it is possible to make for an image of a file. Not clearly here that in operation  CreateFileMapping... nSizeMax) - selects to me area of storage with the MAXIMUM size which to me it is necessary MapViewOfFile (Ex) - it is possible in parts, beforehand causing UnmapViewOfFile And what happens to the selected area of storage?? It continuous is necessary to me! Where a warranty that MapView in parts  the address in a proper place? Can is better VirtualAlloc + ReadFile use? Differently the big uniform area of storage in which is necessary to me it is possible  or to read out files (entirely or parts) to lead record-reading of this storage and then to drop this area on a disk in the form of one big file. Can be to select area for  in the size it is admissible 100 Mb, the big continuous area to select with function VirtualAlloc and to use AWE for a data interchange between  and the main storage? And then to drop all storage on a disk function WriteFile?

8

Re: VirtualAlloc and MapViewOfFile

Hello, Poseidon, you wrote: P> Hello, Poseidon, you wrote: P>> Hello! Not a secret that mapviewoffile suffers failure by operation with big enough file on the size. P>> a question - whether it is possible to cure it if at first to cause CreateFileMapping or MapViewOfFile with flag MEM_RESERVE? P>> For enough big area of storage. P>> and then to learn memory size which it is possible  (by the way it can be made what function?) P>> to Conclude the code of operation with storage in SEH and at origin of an error of access to storage to cause MapViewOfFile P>> repeatedly with instructions of flag MEM_COMMIT and the size of the unit which the system is capable to select? P>> did something similar with VirtualAlloc, and now I want to understand as it it is possible to make for an image of a file. P> it is not clear here that in operation  P> CreateFileMapping... nSizeMax) - selects to me area of storage with the MAXIMUM size which to me it is necessary P> MapViewOfFile (Ex) - it is possible in parts, beforehand causing UnmapViewOfFile P> And what happens to the selected area of storage?? It continuous is necessary to me! Where a warranty that MapView in parts  P> the address in a proper place? What for such warranty is necessary? Let projects, where it turns out. At offset instructions in parameter MapViewOfFile there will be  that part  which corresponds to this offset. Thus, pieces MapViewOfFile "fragmentary", but their basic CreateFileMapping remains to continuous. P> can be to select area for  in the size it is admissible 100 Mb, P> the big continuous area to select with function VirtualAlloc and to use AWE for a data interchange between  and the main storage?  AWE are all the same projected anywhere, as well as MapViewOfFile, and in the same way enough big AWE it will not be projected by one piece. AWE at all for this purpose and to get access to great volume of physical storage. With the registration of that x86 Windows versions are all the same restricted 4  physical storage, and on 64 it is possible to receive its much more simple method, collecting 64-bit application, AWE now generally for what it is not necessary.

9

Re: VirtualAlloc and MapViewOfFile

Hello, Alexander G, you wrote: AG> AWE at all for this purpose and to get access to great volume of physical storage. AG> with the registration of that x86 Windows versions are all the same restricted 4  physical storage, AG> and on 64 it is possible to receive its much more simple method, collecting 64-bit application, AWE now generally for what it is not necessary. It turns out in 32 bit application is unreal to select area of storage more than 1  without special shifts? Even the option  not especially helped, instead of 940 megabytes the system selects all 1150