If this parameter is zero 0 and CreateFile succeeds, the object cannot be shared and cannot be opened again until the handle is closed. To enable other processes to share the object while your process has it open, use a combination of one or more of the following values to specify the type of access they can request when they open the object.
These sharing options remain in effect until you close the handle to the object. If the object has already been opened with delete access, the sharing mode must include this flag. If the object has already been opened with write access, the sharing mode must include this flag. You can also set this flag to obtain a handle to a directory.
Where indicated, a directory handle can be passed to some functions in place of a file handle. An application can determine a volume sector size by calling the GetDiskFreeSpace function. This flag also enables more than one operation to be performed simultaneously with the handle a simultaneous read and write operation, for example. Specifying this flag can increase performance for applications that read large files using sequential access.
Performance gains can be even more noticeable for applications that read large files mostly sequentially, but occasionally skip over small ranges of bytes. If the handle represents the client side of a named pipe, the dwFlags parameter can also contain Security Quality of Service information.
For more information, see Impersonation Levels. This allows the client to limit the groups and privileges that a server can use while impersonating the client. To get extended error information, call GetLastError. These can only be specified when the file is created. File Management Functions.
Skip to main content. The CreateConsoleScreenBuffer function creates a new screen buffer and returns a handle. This handle can be used in any function that accepts a handle to console output.
The new screen buffer is not active displayed until its handle is specified in a call to the SetConsoleActiveScreenBuffer function. Note that changing the active screen buffer does not affect the handle returned by GetStdHandle. Console handles returned by CreateFile and CreateConsoleScreenBuffer can be used in any of the console functions that require a handle to a console's input buffer or of a console screen buffer.
If a standard handle has been redirected to refer to a file or a pipe, however, the handle can only be used by the ReadFile and WriteFile functions. GetFileType can assist in determining what device type the handle refers to. A process can use the DuplicateHandle function to create a duplicate console handle that has different access or inheritability from the original handle. The file handle is used to identify the file in many function calls.
Each file handle and file object is generally unique to each process that opens a file—the only exceptions to this are when a file handle held by a process is duplicated, or when a child process inherits the file handles of the parent process.
In these situations, these file handles are unique, but see a single, shared file object. See DuplicateHandle for more information on duplicating file handles held by processes. Victor Sergienko StreamHandler ch. DEBUG ch. FileHandler : fixed two typos here log. Haggis T. Haggis 31 3 3 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses.
0コメント