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

fsrtlpc.c File Reference

#include "FsRtlP.h"

Go to the source code of this file.

Defines

#define COMPATIBILITY_MODE_KEY_NAME   L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\FileSystem"
#define COMPATIBILITY_MODE_VALUE_NAME   L"Win95TruncatedExtensions"
#define KEY_WORK_AREA
#define FSRTL_NUMBER_OF_RESOURCES   (16)
#define _FAT_   FSRTL_FAT_LEGAL
#define _HPFS_   FSRTL_HPFS_LEGAL
#define _NTFS_   FSRTL_NTFS_LEGAL
#define _OLE_   FSRTL_OLE_LEGAL
#define _WILD_   FSRTL_WILD_CHARACTER

Functions

NTSTATUS FsRtlGetCompatibilityModeValue (IN PUNICODE_STRING ValueName, IN OUT PULONG Value)
BOOLEAN FsRtlInitSystem ()
PERESOURCE FsRtlAllocateResource ()

Variables

PERESOURCE FsRtlPagingIoResources
ULONG FsRtlPagingIoResourceSelector = 0
BOOLEAN FsRtlSafeExtensions = TRUE
UCHAR LocalLegalAnsiCharacterArray [128]
PUCHAR FsRtlLegalAnsiCharacterArray = &LocalLegalAnsiCharacterArray[0]


Define Documentation

#define _FAT_   FSRTL_FAT_LEGAL
 

Definition at line 70 of file fsrtlpc.c.

#define _HPFS_   FSRTL_HPFS_LEGAL
 

Definition at line 71 of file fsrtlpc.c.

#define _NTFS_   FSRTL_NTFS_LEGAL
 

Definition at line 72 of file fsrtlpc.c.

#define _OLE_   FSRTL_OLE_LEGAL
 

Definition at line 73 of file fsrtlpc.c.

#define _WILD_   FSRTL_WILD_CHARACTER
 

Definition at line 74 of file fsrtlpc.c.

#define COMPATIBILITY_MODE_KEY_NAME   L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\FileSystem"
 

Definition at line 23 of file fsrtlpc.c.

Referenced by FsRtlGetCompatibilityModeValue().

#define COMPATIBILITY_MODE_VALUE_NAME   L"Win95TruncatedExtensions"
 

Definition at line 24 of file fsrtlpc.c.

Referenced by FsRtlInitSystem().

#define FSRTL_NUMBER_OF_RESOURCES   (16)
 

Definition at line 57 of file fsrtlpc.c.

Referenced by FsRtlAllocateResource(), and FsRtlInitSystem().

#define KEY_WORK_AREA
 

Value:

((sizeof(KEY_VALUE_FULL_INFORMATION) + \ sizeof(ULONG)) + 64)

Definition at line 26 of file fsrtlpc.c.

Referenced by FsRtlGetCompatibilityModeValue(), and FsRtlGetTunnelParameterValue().


Function Documentation

PERESOURCE FsRtlAllocateResource  ) 
 

Definition at line 293 of file fsrtlpc.c.

References FSRTL_NUMBER_OF_RESOURCES, FsRtlPagingIoResources, FsRtlPagingIoResourceSelector, and PAGED_CODE.

00298 : 00299 00300 This routine is used to allocate a resource from the FsRtl pool. 00301 00302 Arguments: 00303 00304 Return Value: 00305 00306 PERESOURCE - A pointer to the provided resource. 00307 00308 --*/ 00309 00310 { 00311 PAGED_CODE(); 00312 00313 return &FsRtlPagingIoResources[ FsRtlPagingIoResourceSelector++ % 00314 FSRTL_NUMBER_OF_RESOURCES]; 00315 }

NTSTATUS FsRtlGetCompatibilityModeValue IN PUNICODE_STRING  ValueName,
IN OUT PULONG  Value
 

Definition at line 323 of file fsrtlpc.c.

References ASSERT, Buffer, COMPATIBILITY_MODE_KEY_NAME, ExAllocatePoolWithTag, ExFreePool(), Handle, KEY_WORK_AREA, KeyName, NT_SUCCESS, NTSTATUS(), NULL, ObjectAttributes, PagedPool, Status, and ValueName.

Referenced by FsRtlInitSystem().

00330 : 00331 00332 Given a unicode value name this routine will go into the registry 00333 location for the Chicago compatibilitymode information and get the 00334 value. 00335 00336 Arguments: 00337 00338 ValueName - the unicode name for the registry value located in the 00339 double space configuration location of the registry. 00340 Value - a pointer to the ULONG for the result. 00341 00342 Return Value: 00343 00344 NTSTATUS 00345 00346 If STATUS_SUCCESSFUL is returned, the location *Value will be 00347 updated with the DWORD value from the registry. If any failing 00348 status is returned, this value is untouched. 00349 00350 --*/ 00351 00352 { 00353 HANDLE Handle; 00354 NTSTATUS Status; 00355 ULONG RequestLength; 00356 ULONG ResultLength; 00357 UCHAR Buffer[KEY_WORK_AREA]; 00358 UNICODE_STRING KeyName; 00359 OBJECT_ATTRIBUTES ObjectAttributes; 00360 PKEY_VALUE_FULL_INFORMATION KeyValueInformation; 00361 00362 KeyName.Buffer = COMPATIBILITY_MODE_KEY_NAME; 00363 KeyName.Length = sizeof(COMPATIBILITY_MODE_KEY_NAME) - sizeof(WCHAR); 00364 KeyName.MaximumLength = sizeof(COMPATIBILITY_MODE_KEY_NAME); 00365 00366 InitializeObjectAttributes(&ObjectAttributes, 00367 &KeyName, 00368 OBJ_CASE_INSENSITIVE, 00369 NULL, 00370 NULL); 00371 00372 Status = ZwOpenKey(&Handle, 00373 KEY_READ, 00374 &ObjectAttributes); 00375 00376 if (!NT_SUCCESS(Status)) { 00377 00378 return Status; 00379 } 00380 00381 RequestLength = KEY_WORK_AREA; 00382 00383 KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION)Buffer; 00384 00385 while (1) { 00386 00387 Status = ZwQueryValueKey(Handle, 00388 ValueName, 00389 KeyValueFullInformation, 00390 KeyValueInformation, 00391 RequestLength, 00392 &ResultLength); 00393 00394 ASSERT( Status != STATUS_BUFFER_OVERFLOW ); 00395 00396 if (Status == STATUS_BUFFER_OVERFLOW) { 00397 00398 // 00399 // Try to get a buffer big enough. 00400 // 00401 00402 if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) { 00403 00404 ExFreePool(KeyValueInformation); 00405 } 00406 00407 RequestLength += 256; 00408 00409 KeyValueInformation = (PKEY_VALUE_FULL_INFORMATION) 00410 ExAllocatePoolWithTag(PagedPool, 00411 RequestLength, 00412 ' taF'); 00413 00414 if (!KeyValueInformation) { 00415 return STATUS_NO_MEMORY; 00416 } 00417 00418 } else { 00419 00420 break; 00421 } 00422 } 00423 00424 ZwClose(Handle); 00425 00426 if (NT_SUCCESS(Status)) { 00427 00428 if (KeyValueInformation->DataLength != 0) { 00429 00430 PULONG DataPtr; 00431 00432 // 00433 // Return contents to the caller. 00434 // 00435 00436 DataPtr = (PULONG) 00437 ((PUCHAR)KeyValueInformation + KeyValueInformation->DataOffset); 00438 *Value = *DataPtr; 00439 00440 } else { 00441 00442 // 00443 // Treat as if no value was found 00444 // 00445 00446 Status = STATUS_OBJECT_NAME_NOT_FOUND; 00447 } 00448 } 00449 00450 if (KeyValueInformation != (PKEY_VALUE_FULL_INFORMATION)Buffer) { 00451 00452 ExFreePool(KeyValueInformation); 00453 } 00454 00455 return Status; 00456 } }

BOOLEAN FsRtlInitSystem  ) 
 

Definition at line 215 of file fsrtlpc.c.

References COMPATIBILITY_MODE_VALUE_NAME, ExInitializeResource, FALSE, FSRTL_NUMBER_OF_RESOURCES, FsRtlAllocatePool, FsRtlGetCompatibilityModeValue(), FsRtlInitializeFileLocks(), FsRtlInitializeLargeMcbs(), FsRtlInitializeTunnels(), FsRtlInitializeWorkerThread(), FsRtlPagingIoResources, FsRtlpUncSemaphore, FsRtlSafeExtensions, KeInitializeSemaphore(), NonPagedPool, NT_SUCCESS, PAGED_CODE, TRUE, and ValueName.

00217 { 00218 ULONG i; 00219 00220 ULONG Value; 00221 UNICODE_STRING ValueName; 00222 00223 extern KSEMAPHORE FsRtlpUncSemaphore; 00224 00225 PAGED_CODE(); 00226 00227 // 00228 // Allocate and initialize all the paging Io resources 00229 // 00230 00231 FsRtlPagingIoResources = FsRtlAllocatePool( NonPagedPool, 00232 FSRTL_NUMBER_OF_RESOURCES * 00233 sizeof(ERESOURCE) ); 00234 00235 for (i=0; i < FSRTL_NUMBER_OF_RESOURCES; i++) { 00236 00237 ExInitializeResource( &FsRtlPagingIoResources[i] ); 00238 } 00239 00240 // 00241 // Initialize the global tunneling structures. 00242 // 00243 00244 FsRtlInitializeTunnels(); 00245 00246 // 00247 // Initialize the global filelock structures. 00248 // 00249 00250 FsRtlInitializeFileLocks(); 00251 00252 // 00253 // Initialize the global largemcb structures. 00254 // 00255 00256 FsRtlInitializeLargeMcbs(); 00257 00258 // 00259 // Initialize the semaphore used to guard loading of the MUP 00260 // 00261 00262 KeInitializeSemaphore( &FsRtlpUncSemaphore, 1, MAXLONG ); 00263 00264 // 00265 // Pull the bit from the registry telling us whether to do a safe 00266 // or dangerous extension truncation. 00267 // 00268 00269 ValueName.Buffer = COMPATIBILITY_MODE_VALUE_NAME; 00270 ValueName.Length = sizeof(COMPATIBILITY_MODE_VALUE_NAME) - sizeof(WCHAR); 00271 ValueName.MaximumLength = sizeof(COMPATIBILITY_MODE_VALUE_NAME); 00272 00273 if (NT_SUCCESS(FsRtlGetCompatibilityModeValue( &ValueName, &Value )) && 00274 (Value != 0)) { 00275 00276 FsRtlSafeExtensions = FALSE; 00277 } 00278 00279 // 00280 // Initialize the FsRtl stack overflow work QueueObject and thread. 00281 // 00282 00283 if (!NT_SUCCESS(FsRtlInitializeWorkerThread())) { 00284 00285 return FALSE; 00286 } 00287 00288 return TRUE; 00289 }


Variable Documentation

PUCHAR FsRtlLegalAnsiCharacterArray = &LocalLegalAnsiCharacterArray[0]
 

Definition at line 208 of file fsrtlpc.c.

PERESOURCE FsRtlPagingIoResources
 

Definition at line 59 of file fsrtlpc.c.

Referenced by FsRtlAllocateResource(), and FsRtlInitSystem().

ULONG FsRtlPagingIoResourceSelector = 0
 

Definition at line 61 of file fsrtlpc.c.

Referenced by FsRtlAllocateResource().

BOOLEAN FsRtlSafeExtensions = TRUE
 

Definition at line 62 of file fsrtlpc.c.

Referenced by FsRtlInitSystem(), and RtlGenerate8dot3Name().

UCHAR LocalLegalAnsiCharacterArray[128] [static]
 

Definition at line 76 of file fsrtlpc.c.


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