94 _LIT(KBitProxyDriveName, "t_bitproxydrive.pxy"); |
94 _LIT(KBitProxyDriveName, "t_bitproxydrive.pxy"); |
95 _LIT(KBitProxyDrive, "bitproxydrive"); |
95 _LIT(KBitProxyDrive, "bitproxydrive"); |
96 |
96 |
97 TInt r; |
97 TInt r; |
98 |
98 |
99 TInt localDriveNumber = GetRemovableDrive(drive); |
99 TInt localDriveNumber = GetRemovableDrive(drive); //-- local _physical_ drive number |
100 if (localDriveNumber < 0) |
100 if (localDriveNumber < 0) |
101 { |
101 { |
102 test.Printf(_L("Not a removable drive, skipping test\n")); |
102 test.Printf(_L("Not a removable drive, skipping test\n")); |
103 return; |
103 return; |
104 } |
104 } |
111 |
111 |
112 TPckgBuf<TInt> p1; p1() = localDriveNumber; |
112 TPckgBuf<TInt> p1; p1() = localDriveNumber; |
113 TBuf<1> p2; |
113 TBuf<1> p2; |
114 TInt driveNumber = EDriveM; |
114 TInt driveNumber = EDriveM; |
115 |
115 |
|
116 //-- this is a hack - mount the proxy drive to the existing one with alive file system just to check |
|
117 //-- that it works. |
|
118 |
116 r = TheFs.MountProxyDrive(driveNumber, KBitProxyDrive, &p1, &p2); |
119 r = TheFs.MountProxyDrive(driveNumber, KBitProxyDrive, &p1, &p2); |
117 test.Printf(_L("MountProxyDrive(%d, %S) r %d\n"), driveNumber, &KBitProxyDrive, r); |
120 test.Printf(_L("MountProxyDrive(%d, %S) r %d\n"), driveNumber, &KBitProxyDrive, r); |
118 test (r >= 0); |
121 test (r >= 0); |
119 |
122 |
120 _LIT(KFileSystem, "FAT"); |
123 //-- query existing file system name on the drive that we are be parasiting on. |
121 r = TheFs.MountFileSystem(KFileSystem, driveNumber); |
124 TFSName fsName; |
122 test.Printf(_L("MountFileSystem(%S) r %d\n"), &KFileSystem, r); |
125 r = TheFs.FileSystemName(fsName, drive); |
|
126 test(r == KErrNone); |
|
127 |
|
128 |
|
129 r = TheFs.MountFileSystem(fsName, driveNumber); |
|
130 test.Printf(_L("MountFileSystem(%S) r %d\n"), &fsName, r); |
123 test(r == KErrNone); |
131 test(r == KErrNone); |
|
132 |
124 |
133 |
125 |
134 |
126 RFs fs; |
135 RFs fs; |
127 r = fs.Connect(); |
136 r = fs.Connect(); |
128 test(r == KErrNone); |
137 test(r == KErrNone); |
133 RDir dir; |
142 RDir dir; |
134 r = dir.Open(fs, dirPath, KEntryAttNormal); |
143 r = dir.Open(fs, dirPath, KEntryAttNormal); |
135 test.Printf(_L("RDir::Open(%S) r %d\n"), &dirPath, r); |
144 test.Printf(_L("RDir::Open(%S) r %d\n"), &dirPath, r); |
136 |
145 |
137 |
146 |
138 r = TheFs.DismountFileSystem(KFileSystem, driveNumber); |
147 r = TheFs.DismountFileSystem(fsName, driveNumber); |
139 test.Printf(_L("DismountFileSystem(%S) r %d\n"), &KFileSystem, r); |
148 test.Printf(_L("DismountFileSystem(%S) r %d\n"), &fsName, r); |
140 test (r == KErrInUse); |
149 test (r == KErrInUse); |
141 |
150 |
142 // dismount failed - attempt a forced dismount |
151 // dismount failed - attempt a forced dismount |
143 TRequestStatus stat; |
152 TRequestStatus stat; |
144 TheFs.NotifyDismount(driveNumber, stat, EFsDismountForceDismount); |
153 TheFs.NotifyDismount(driveNumber, stat, EFsDismountForceDismount); |
145 User::WaitForRequest(stat); |
154 User::WaitForRequest(stat); |
146 r = stat.Int(); |
155 r = stat.Int(); |
147 test.Printf(_L("DismountFileSystem(%S, EFsDismountForceDismount) r %d\n"), &KFileSystem, r); |
156 test.Printf(_L("DismountFileSystem(%S, EFsDismountForceDismount) r %d\n"), &fsName, r); |
148 test (r == KErrNone); |
157 test (r == KErrNone); |
149 |
158 |
150 r = TheFs.DismountProxyDrive(driveNumber); |
159 r = TheFs.DismountProxyDrive(driveNumber); |
151 test.Printf(_L("DismountProxyDrive(%d) r %d\n"), driveNumber, r); |
160 test.Printf(_L("DismountProxyDrive(%d) r %d\n"), driveNumber, r); |
152 test (r == KErrNone); |
161 test (r == KErrNone); |