sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\lffs\loadntfs.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: sl@0: _LIT(KFileSystemDllName, "ntfs.fsy"); sl@0: _LIT(KFileSystemName, "ntfs"); sl@0: sl@0: RFs TheFs; sl@0: sl@0: TInt MountNTFS() sl@0: { sl@0: TBuf<256> cmd; sl@0: User::CommandLine(cmd); sl@0: TLex cmdlex(cmd); sl@0: cmdlex.SkipSpace(); sl@0: TUint c = (TUint)cmdlex.Get(); sl@0: if (c>='a' && c<='z') sl@0: c-=0x20; sl@0: if (c<'A' || c>'Z') sl@0: return KErrArgument; sl@0: TBuf<4> driveLetter; sl@0: driveLetter.SetLength(1); sl@0: driveLetter[0] = (TText)c; sl@0: RDebug::Print(_L("Drive %S"), &driveLetter); sl@0: sl@0: TInt driveNumber = TInt(c-'A') + TInt(EDriveA); sl@0: TInt r; sl@0: driveLetter.Append(_L(":\\")); sl@0: sl@0: RDebug::Print(_L("Add file system: %S"), &KFileSystemDllName); sl@0: r=TheFs.AddFileSystem(KFileSystemDllName); sl@0: if (r!=KErrNone && r!=KErrAlreadyExists) sl@0: { sl@0: RDebug::Print(_L("Failed: %d"), r); sl@0: return r; sl@0: } sl@0: sl@0: TFullName name; sl@0: r = TheFs.FileSystemName(name, driveNumber); sl@0: if (name.Length() != 0) sl@0: { sl@0: RDebug::Print(_L("Dismounting %S on drive %S\r\n"), &name, &driveLetter); sl@0: r=TheFs.DismountFileSystem(name, driveNumber); sl@0: RDebug::Print(_L("Dismount ret=%d"), r); sl@0: } sl@0: sl@0: RDebug::Print(_L("Mount NTFS on drive %S\r\n"), &driveLetter); sl@0: r = TheFs.MountFileSystem(KFileSystemName, driveNumber); sl@0: RDebug::Print(_L("Mount r=%d"),r); sl@0: return KErrNone; sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: sl@0: CTrapCleanup* cleanup; sl@0: cleanup=CTrapCleanup::New(); sl@0: sl@0: TInt r=TheFs.Connect(); sl@0: RDebug::Print(_L("Connect ret %d"),r); sl@0: sl@0: if (r == KErrNone) sl@0: r = MountNTFS(); sl@0: RDebug::Print(_L("Mount NTFS ret %d"),r); sl@0: sl@0: TheFs.Close(); sl@0: delete cleanup; sl@0: return KErrNone; sl@0: } sl@0: