コード例 #1
0
ファイル: dokan.c プロジェクト: DieBagger/MediaPortal-2
VOID
DokanNotifyReportChange0(
	__in PDokanFCB			Fcb,
	__in PUNICODE_STRING	FileName,
	__in ULONG				FilterMatch,
	__in ULONG				Action)
{
	USHORT	nameOffset;

	DDbgPrint("==> DokanNotifyReportChange %wZ\n", FileName);

	ASSERT(Fcb != NULL);
	ASSERT(FileName != NULL);

	// search the last "\"
	nameOffset = (USHORT)(FileName->Length/sizeof(WCHAR)-1);
	for(; FileName->Buffer[nameOffset] != L'\\'; --nameOffset)
		;
	nameOffset++; // the next is the begining of filename

	nameOffset *= sizeof(WCHAR); // Offset is in bytes

	FsRtlNotifyFullReportChange(
		Fcb->Vcb->NotifySync,
		&Fcb->Vcb->DirNotifyList,
		(PSTRING)FileName,
		nameOffset,
		NULL, // StreamName
		NULL, // NormalizedParentName
		FilterMatch,
		Action,
		NULL); // TargetContext

	DDbgPrint("<== DokanNotifyReportChange\n");
}
コード例 #2
0
ファイル: fastfat.c プロジェクト: GYGit/reactos
VOID
NTAPI
FatNotifyReportChange(IN PFAT_IRP_CONTEXT IrpContext,
                      IN PVCB Vcb,
                      IN PFCB Fcb,
                      IN ULONG Filter,
                      IN ULONG Action)
{
    if (Fcb->FullFileName.Buffer == NULL)
        FatSetFullFileNameInFcb(IrpContext, Fcb);

    ASSERT(Fcb->FullFileName.Length != 0 );
    ASSERT(Fcb->FileNameLength != 0 );
    ASSERT(Fcb->FullFileName.Length > Fcb->FileNameLength );
    ASSERT(Fcb->FullFileName.Buffer[(Fcb->FullFileName.Length - Fcb->FileNameLength)/sizeof(WCHAR) - 1] == L'\\' );

    FsRtlNotifyFullReportChange(Vcb->NotifySync,
                                &Vcb->NotifyList,
                                (PSTRING)&Fcb->FullFileName,
                                (USHORT)(Fcb->FullFileName.Length -
                                         Fcb->FileNameLength),
                                NULL,
                                NULL,
                                Filter,
                                Action,
                                NULL);
}
コード例 #3
0
ファイル: dokan.c プロジェクト: dokan-dev/dokany
VOID DokanNotifyReportChange0(__in PDokanFCB Fcb, __in PUNICODE_STRING FileName,
                              __in ULONG FilterMatch, __in ULONG Action) {
  USHORT nameOffset;

  DDbgPrint("==> DokanNotifyReportChange %wZ\n", FileName);

  ASSERT(Fcb != NULL);
  ASSERT(FileName != NULL);

  if (DokanUnicodeStringChar(FileName, L':') != -1) { //FileStream

    //Convert file action to stream action
    switch (Action) {
    case FILE_ACTION_ADDED:
      Action = FILE_ACTION_ADDED_STREAM;
      break;
    case FILE_ACTION_REMOVED:
      Action = FILE_ACTION_REMOVED_STREAM;
      break;
    case FILE_ACTION_MODIFIED:
      Action = FILE_ACTION_MODIFIED_STREAM;
      break;
    default:
      break;
    }

    //Convert file flag to stream flag
    if (FlagOn(FilterMatch,
               FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_FILE_NAME))
      SetFlag(FilterMatch, FILE_NOTIFY_CHANGE_STREAM_NAME);
    if (FlagOn(FilterMatch, FILE_NOTIFY_CHANGE_SIZE))
      SetFlag(FilterMatch, FILE_NOTIFY_CHANGE_STREAM_SIZE);
    if (FlagOn(FilterMatch, FILE_NOTIFY_CHANGE_LAST_WRITE))
      SetFlag(FilterMatch, FILE_NOTIFY_CHANGE_STREAM_WRITE);

    //Cleanup file flag converted
    ClearFlag(FilterMatch, ~(FILE_NOTIFY_CHANGE_STREAM_NAME |
                             FILE_NOTIFY_CHANGE_STREAM_SIZE |
                             FILE_NOTIFY_CHANGE_STREAM_WRITE));
  }

  nameOffset = (USHORT)(FileName->Length / sizeof(WCHAR) - 1);

  // search the last "\" and then calculate the Offset in bytes
  nameOffset = (USHORT)(DokanSearchWcharinUnicodeStringWithUlong(
      FileName, L'\\', (ULONG)nameOffset, 1));
  nameOffset *= sizeof(WCHAR); // Offset is in bytes

  FsRtlNotifyFullReportChange(Fcb->Vcb->NotifySync, &Fcb->Vcb->DirNotifyList,
                              (PSTRING)FileName, nameOffset,
                              NULL, // StreamName
                              NULL, // NormalizedParentName
                              FilterMatch, Action,
                              NULL); // TargetContext

  DDbgPrint("<== DokanNotifyReportChange\n");
}
コード例 #4
0
ファイル: dirctl.c プロジェクト: GYGit/reactos
VOID
FFSNotifyReportChange(
	IN PFFS_IRP_CONTEXT  IrpContext,
	IN PFFS_VCB          Vcb,
	IN PFFS_FCB          Fcb,
	IN ULONG             Filter,
	IN ULONG             Action)
{
	PUNICODE_STRING FullName;
	USHORT          Offset;

	FullName = &Fcb->LongName;

	// ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL);

	if (FullName->Buffer == NULL)
	{
		if (!FFSGetFullFileName(Fcb->FFSMcb, FullName))
		{
			/*Status = STATUS_INSUFFICIENT_RESOURCES;*/
			return;
		}
	}

	Offset = (USHORT)(FullName->Length - 
			Fcb->FFSMcb->ShortName.Length);

	FsRtlNotifyFullReportChange(Vcb->NotifySync,
			&(Vcb->NotifyList),
			(PSTRING)(FullName),
			(USHORT)Offset,
			(PSTRING)NULL,
			(PSTRING)NULL,
			(ULONG)Filter,
			(ULONG)Action,
			(PVOID)NULL);

	// ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL);
}
コード例 #5
0
ファイル: close.c プロジェクト: staring/RosFE
/*
 * FUNCTION: Closes a file
 */
NTSTATUS
VfatCloseFile(
    PDEVICE_EXTENSION DeviceExt,
    PFILE_OBJECT FileObject)
{
    PVFATFCB pFcb;
    PVFATCCB pCcb;
    NTSTATUS Status = STATUS_SUCCESS;

    DPRINT("VfatCloseFile(DeviceExt %p, FileObject %p)\n",
            DeviceExt, FileObject);

    /* FIXME : update entry in directory? */
    pCcb = (PVFATCCB) (FileObject->FsContext2);
    pFcb = (PVFATFCB) (FileObject->FsContext);

    if (pFcb == NULL)
    {
        return STATUS_SUCCESS;
    }

    if (pFcb->Flags & FCB_IS_VOLUME)
    {
        DPRINT("Volume\n");
        FileObject->FsContext2 = NULL;
    }
    else
    {
        if (FileObject->DeletePending)
        {
            if (pFcb->Flags & FCB_DELETE_PENDING)
            {
                VfatDelEntry(DeviceExt, pFcb, NULL);

                FsRtlNotifyFullReportChange(DeviceExt->NotifySync,
                                            &(DeviceExt->NotifyList),
                                            (PSTRING)&pFcb->PathNameU,
                                            pFcb->PathNameU.Length - pFcb->LongNameU.Length,
                                            NULL,
                                            NULL,
                                            ((*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) ?
                                            FILE_NOTIFY_CHANGE_DIR_NAME : FILE_NOTIFY_CHANGE_FILE_NAME),
                                            FILE_ACTION_REMOVED,
                                            NULL);
            }
            else
            {
                Status = STATUS_DELETE_PENDING;
            }
        }

        vfatReleaseFCB(DeviceExt, pFcb);
    }

    FileObject->FsContext2 = NULL;
    FileObject->FsContext = NULL;
    FileObject->SectionObjectPointer = NULL;
    DeviceExt->OpenHandleCount--;

    if (pCcb)
    {
        vfatDestroyCCB(pCcb);
    }

    if (DeviceExt->OpenHandleCount == 0)
    {
        VfatCheckForDismount(DeviceExt, FALSE);
    }

    return Status;
}