Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

create.c File Reference

#include "iop.h"

Go to the source code of this file.

Functions

NTSTATUS NtCreateFile (OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
NTSTATUS NtCreateNamedPipeFile (OUT PHANDLE FileHandle, IN ULONG DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN ULONG NamedPipeType, IN ULONG ReadMode, IN ULONG CompletionMode, IN ULONG MaximumInstances, IN ULONG InboundQuota, IN ULONG OutboundQuota, IN PLARGE_INTEGER DefaultTimeout OPTIONAL)
NTSTATUS NtCreateMailslotFile (OUT PHANDLE FileHandle, IN ULONG DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, ULONG CreateOptions, IN ULONG MailslotQuota, IN ULONG MaximumMessageSize, IN PLARGE_INTEGER ReadTimeout)


Function Documentation

NTSTATUS NtCreateFile OUT PHANDLE  FileHandle,
IN ACCESS_MASK  DesiredAccess,
IN POBJECT_ATTRIBUTES  ObjectAttributes,
OUT PIO_STATUS_BLOCK  IoStatusBlock,
IN PLARGE_INTEGER AllocationSize  OPTIONAL,
IN ULONG  FileAttributes,
IN ULONG  ShareAccess,
IN ULONG  CreateDisposition,
IN ULONG  CreateOptions,
IN PVOID EaBuffer  OPTIONAL,
IN ULONG  EaLength
 

Definition at line 37 of file io/create.c.

References CreateFileTypeNone, FileAttributes, IoCreateFile(), NULL, ObjectAttributes, and PAGED_CODE.

Referenced by IopCacheNetbiosNameForIpAddress(), IopSetDefaultGateway(), IopStartNetworkForRemoteBoot(), IopStartTcpIpForRemoteBoot(), LdrLoadAlternateResourceModule(), main(), MemPrintWriteThread(), and ZwCreateFile().

00053 : 00054 00055 This service opens or creates a file, or opens a device. It is used to 00056 establish a file handle to the open device/file that can then be used 00057 in subsequent operations to perform I/O operations on. For purposes of 00058 readability, files and devices are treated as "files" throughout the 00059 majority of this module and the system service portion of the I/O system. 00060 The only time a distinction is made is when it is important to determine 00061 which is really being accessed. Then a distinction is also made in the 00062 comments. 00063 00064 Arguments: 00065 00066 FileHandle - A pointer to a variable to receive the handle to the open file. 00067 00068 DesiredAccess - Supplies the types of access that the caller would like to 00069 the file. 00070 00071 ObjectAttributes - Supplies the attributes to be used for file object (name, 00072 SECURITY_DESCRIPTOR, etc.) 00073 00074 IoStatusBlock - Specifies the address of the caller's I/O status block. 00075 00076 AllocationSize - Initial size that should be allocated to the file. This 00077 parameter only has an affect if the file is created. Further, if 00078 not specified, then it is taken to mean zero. 00079 00080 FileAttributes - Specifies the attributes that should be set on the file, 00081 if it is created. 00082 00083 ShareAccess - Supplies the types of share access that the caller would like 00084 to the file. 00085 00086 CreateDisposition - Supplies the method for handling the create/open. 00087 00088 CreateOptions - Caller options for how to perform the create/open. 00089 00090 EaBuffer - Optionally specifies a set of EAs to be applied to the file if 00091 it is created. 00092 00093 EaLength - Supplies the length of the EaBuffer. 00094 00095 Return Value: 00096 00097 The function value is the final status of the create/open operation. 00098 00099 --*/ 00100 00101 { 00102 // 00103 // Simply invoke the common I/O file creation routine to do the work. 00104 // 00105 00106 PAGED_CODE(); 00107 00108 return IoCreateFile( FileHandle, 00109 DesiredAccess, 00110 ObjectAttributes, 00111 IoStatusBlock, 00112 AllocationSize, 00113 FileAttributes, 00114 ShareAccess, 00115 CreateDisposition, 00116 CreateOptions, 00117 EaBuffer, 00118 EaLength, 00119 CreateFileTypeNone, 00120 (PVOID)NULL, 00121 0 ); 00122 }

NTSTATUS NtCreateMailslotFile OUT PHANDLE  FileHandle,
IN ULONG  DesiredAccess,
IN POBJECT_ATTRIBUTES  ObjectAttributes,
OUT PIO_STATUS_BLOCK  IoStatusBlock,
ULONG  CreateOptions,
IN ULONG  MailslotQuota,
IN ULONG  MaximumMessageSize,
IN PLARGE_INTEGER  ReadTimeout
 

Definition at line 285 of file io/create.c.

References CreateFileTypeMailslot, EXCEPTION_EXECUTE_HANDLER, FALSE, IoCreateFile(), KernelMode, L, MAILSLOT_CREATE_PARAMETERS, _MAILSLOT_CREATE_PARAMETERS::MailslotQuota, _MAILSLOT_CREATE_PARAMETERS::MaximumMessageSize, NULL, ObjectAttributes, PAGED_CODE, ProbeForRead, _MAILSLOT_CREATE_PARAMETERS::ReadTimeout, _MAILSLOT_CREATE_PARAMETERS::TimeoutSpecified, and TRUE.

00298 : 00299 00300 Creates and opens the server end handle of a mailslot file. 00301 00302 Arguments: 00303 00304 FileHandle - Supplies a handle to the file on which the service is being 00305 performed. 00306 00307 DesiredAccess - Supplies the types of access that the caller would like to 00308 the file. 00309 00310 ObjectAttributes - Supplies the attributes to be used for file object 00311 (name, SECURITY_DESCRIPTOR, etc.) 00312 00313 IoStatusBlock - Address of the caller's I/O status block. 00314 00315 CreateOptions - Caller options for how to perform the create/open. 00316 00317 MailslotQuota - Specifies the pool quota that is reserved for writes 00318 to this mailslot. 00319 00320 MaximumMessageSize - Specifies the size of the largest message that 00321 can be written to this mailslot. 00322 00323 ReadTimeout - The timeout period for a read operation. This must 00324 be specified as a relative time. 00325 00326 Return Value: 00327 00328 The function value is the final status of the create operation. 00329 00330 --*/ 00331 00332 { 00333 MAILSLOT_CREATE_PARAMETERS mailslotCreateParameters; 00334 00335 PAGED_CODE(); 00336 00337 // 00338 // Check whether or not the DefaultTimeout parameter was specified. If 00339 // so, then capture it in the mailslot create parameter structure. 00340 // 00341 00342 if (ARGUMENT_PRESENT( ReadTimeout )) { 00343 00344 // 00345 // Indicate that a read timeout period was specified. 00346 // 00347 00348 mailslotCreateParameters.TimeoutSpecified = TRUE; 00349 00350 // 00351 // A read timeout parameter was specified. Check to see whether 00352 // the caller's mode is kernel and if not capture the parameter inside 00353 // of a try...except clause. 00354 // 00355 00356 if (KeGetPreviousMode() != KernelMode) { 00357 try { 00358 ProbeForRead( ReadTimeout, 00359 sizeof( LARGE_INTEGER ), 00360 sizeof( ULONG ) ); 00361 mailslotCreateParameters.ReadTimeout = *ReadTimeout; 00362 } except(EXCEPTION_EXECUTE_HANDLER) { 00363 00364 // 00365 // Something went awry attempting to access the parameter. 00366 // Get the reason for the error and return it as the status 00367 // value from this service. 00368 // 00369 00370 return GetExceptionCode(); 00371 } 00372 } else { 00373 00374 // 00375 // The caller's mode was kernel so simply store the parameter. 00376 // 00377 00378 mailslotCreateParameters.ReadTimeout = *ReadTimeout; 00379 } 00380 } else { 00381 00382 // 00383 // Indicate that no default timeout period was specified. 00384 // 00385 00386 mailslotCreateParameters.TimeoutSpecified = FALSE; 00387 } 00388 00389 // 00390 // Store the mailslot-specific parameters in the structure for use 00391 // in the call to the common create file routine. 00392 // 00393 00394 mailslotCreateParameters.MailslotQuota = MailslotQuota; 00395 mailslotCreateParameters.MaximumMessageSize = MaximumMessageSize; 00396 00397 // 00398 // Simply perform the remainder of the service by allowing the common 00399 // file creation code to do the work. 00400 // 00401 00402 return IoCreateFile( FileHandle, 00403 DesiredAccess, 00404 ObjectAttributes, 00405 IoStatusBlock, 00406 (PLARGE_INTEGER) NULL, 00407 0L, 00408 FILE_SHARE_READ | FILE_SHARE_WRITE, 00409 FILE_CREATE, 00410 CreateOptions, 00411 (PVOID) NULL, 00412 0L, 00413 CreateFileTypeMailslot, 00414 &mailslotCreateParameters, 00415 0 ); 00416 } }

NTSTATUS NtCreateNamedPipeFile OUT PHANDLE  FileHandle,
IN ULONG  DesiredAccess,
IN POBJECT_ATTRIBUTES  ObjectAttributes,
OUT PIO_STATUS_BLOCK  IoStatusBlock,
IN ULONG  ShareAccess,
IN ULONG  CreateDisposition,
IN ULONG  CreateOptions,
IN ULONG  NamedPipeType,
IN ULONG  ReadMode,
IN ULONG  CompletionMode,
IN ULONG  MaximumInstances,
IN ULONG  InboundQuota,
IN ULONG  OutboundQuota,
IN PLARGE_INTEGER DefaultTimeout  OPTIONAL
 

Definition at line 125 of file io/create.c.

References _NAMED_PIPE_CREATE_PARAMETERS::CompletionMode, CreateFileTypeNamedPipe, _NAMED_PIPE_CREATE_PARAMETERS::DefaultTimeout, EXCEPTION_EXECUTE_HANDLER, FALSE, _NAMED_PIPE_CREATE_PARAMETERS::InboundQuota, IoCreateFile(), KernelMode, L, _NAMED_PIPE_CREATE_PARAMETERS::MaximumInstances, NAMED_PIPE_CREATE_PARAMETERS, _NAMED_PIPE_CREATE_PARAMETERS::NamedPipeType, NULL, ObjectAttributes, _NAMED_PIPE_CREATE_PARAMETERS::OutboundQuota, PAGED_CODE, ProbeForRead, _NAMED_PIPE_CREATE_PARAMETERS::ReadMode, _NAMED_PIPE_CREATE_PARAMETERS::TimeoutSpecified, and TRUE.

Referenced by SepServerCreatePipe().

00144 : 00145 00146 Creates and opens the server end handle of the first instance of a 00147 specific named pipe or another instance of an existing named pipe. 00148 00149 Arguments: 00150 00151 FileHandle - Supplies a handle to the file on which the service is being 00152 performed. 00153 00154 DesiredAccess - Supplies the types of access that the caller would like to 00155 the file. 00156 00157 ObjectAttributes - Supplies the attributes to be used for file object 00158 (name, SECURITY_DESCRIPTOR, etc.) 00159 00160 IoStatusBlock - Address of the caller's I/O status block. 00161 00162 ShareAccess - Supplies the types of share access that the caller would 00163 like to the file. 00164 00165 CreateDisposition - Supplies the method for handling the create/open. 00166 00167 CreateOptions - Caller options for how to perform the create/open. 00168 00169 NamedPipeType - Type of named pipe to create (Bitstream or message). 00170 00171 ReadMode - Mode in which to read the pipe (Bitstream or message). 00172 00173 CompletionMode - Specifies how the operation is to be completed. 00174 00175 MaximumInstances - Maximum number of simultaneous instances of the named 00176 pipe. 00177 00178 InboundQuota - Specifies the pool quota that is reserved for writes to the 00179 inbound side of the named pipe. 00180 00181 OutboundQuota - Specifies the pool quota that is reserved for writes to 00182 the inbound side of the named pipe. 00183 00184 DefaultTimeout - Optional pointer to a timeout value that is used if a 00185 timeout value is not specified when waiting for an instance of a named 00186 pipe. 00187 00188 Return Value: 00189 00190 The function value is the final status of the create/open operation. 00191 00192 --*/ 00193 00194 { 00195 NAMED_PIPE_CREATE_PARAMETERS namedPipeCreateParameters; 00196 00197 PAGED_CODE(); 00198 00199 // 00200 // Check whether or not the DefaultTimeout parameter was specified. If 00201 // so, then capture it in the named pipe create parameter structure. 00202 // 00203 00204 if (ARGUMENT_PRESENT( DefaultTimeout )) { 00205 00206 // 00207 // Indicate that a default timeout period was specified. 00208 // 00209 00210 namedPipeCreateParameters.TimeoutSpecified = TRUE; 00211 00212 // 00213 // A default timeout parameter was specified. Check to see whether 00214 // the caller's mode is kernel and if not capture the parameter inside 00215 // of a try...except clause. 00216 // 00217 00218 if (KeGetPreviousMode() != KernelMode) { 00219 try { 00220 ProbeForRead( DefaultTimeout, 00221 sizeof( LARGE_INTEGER ), 00222 sizeof( ULONG ) ); 00223 namedPipeCreateParameters.DefaultTimeout = *DefaultTimeout; 00224 } except(EXCEPTION_EXECUTE_HANDLER) { 00225 00226 // 00227 // Something went awry attempting to access the parameter. 00228 // Get the reason for the error and return it as the status 00229 // value from this service. 00230 // 00231 00232 return GetExceptionCode(); 00233 } 00234 } else { 00235 00236 // 00237 // The caller's mode was kernel so simply store the parameter. 00238 // 00239 00240 namedPipeCreateParameters.DefaultTimeout = *DefaultTimeout; 00241 } 00242 } else { 00243 00244 // 00245 // Indicate that no default timeout period was specified. 00246 // 00247 00248 namedPipeCreateParameters.TimeoutSpecified = FALSE; 00249 } 00250 00251 // 00252 // Store the remainder of the named pipe-specific parameters in the 00253 // structure for use in the call to the common create file routine. 00254 // 00255 00256 namedPipeCreateParameters.NamedPipeType = NamedPipeType; 00257 namedPipeCreateParameters.ReadMode = ReadMode; 00258 namedPipeCreateParameters.CompletionMode = CompletionMode; 00259 namedPipeCreateParameters.MaximumInstances = MaximumInstances; 00260 namedPipeCreateParameters.InboundQuota = InboundQuota; 00261 namedPipeCreateParameters.OutboundQuota = OutboundQuota; 00262 00263 // 00264 // Simply perform the remainder of the service by allowing the common 00265 // file creation code to do the work. 00266 // 00267 00268 return IoCreateFile( FileHandle, 00269 DesiredAccess, 00270 ObjectAttributes, 00271 IoStatusBlock, 00272 (PLARGE_INTEGER) NULL, 00273 0L, 00274 ShareAccess, 00275 CreateDisposition, 00276 CreateOptions, 00277 (PVOID) NULL, 00278 0L, 00279 CreateFileTypeNamedPipe, 00280 &namedPipeCreateParameters, 00281 0 ); 00282 }


Generated on Sat May 15 19:43:18 2004 for test by doxygen 1.3.7