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); //-- local _physical_ drive number |
99 TInt localDriveNumber = GetRemovableDrive(drive); |
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 |
|
119 r = TheFs.MountProxyDrive(driveNumber, KBitProxyDrive, &p1, &p2); |
116 r = TheFs.MountProxyDrive(driveNumber, KBitProxyDrive, &p1, &p2); |
120 test.Printf(_L("MountProxyDrive(%d, %S) r %d\n"), driveNumber, &KBitProxyDrive, r); |
117 test.Printf(_L("MountProxyDrive(%d, %S) r %d\n"), driveNumber, &KBitProxyDrive, r); |
121 test (r >= 0); |
118 test (r >= 0); |
122 |
119 |
123 //-- query existing file system name on the drive that we are be parasiting on. |
120 _LIT(KFileSystem, "FAT"); |
124 TFSName fsName; |
121 r = TheFs.MountFileSystem(KFileSystem, driveNumber); |
125 r = TheFs.FileSystemName(fsName, drive); |
122 test.Printf(_L("MountFileSystem(%S) r %d\n"), &KFileSystem, r); |
126 test(r == KErrNone); |
|
127 |
|
128 |
|
129 r = TheFs.MountFileSystem(fsName, driveNumber); |
|
130 test.Printf(_L("MountFileSystem(%S) r %d\n"), &fsName, r); |
|
131 test(r == KErrNone); |
123 test(r == KErrNone); |
132 |
|
133 |
124 |
134 |
125 |
135 RFs fs; |
126 RFs fs; |
136 r = fs.Connect(); |
127 r = fs.Connect(); |
137 test(r == KErrNone); |
128 test(r == KErrNone); |
142 RDir dir; |
133 RDir dir; |
143 r = dir.Open(fs, dirPath, KEntryAttNormal); |
134 r = dir.Open(fs, dirPath, KEntryAttNormal); |
144 test.Printf(_L("RDir::Open(%S) r %d\n"), &dirPath, r); |
135 test.Printf(_L("RDir::Open(%S) r %d\n"), &dirPath, r); |
145 |
136 |
146 |
137 |
147 r = TheFs.DismountFileSystem(fsName, driveNumber); |
138 r = TheFs.DismountFileSystem(KFileSystem, driveNumber); |
148 test.Printf(_L("DismountFileSystem(%S) r %d\n"), &fsName, r); |
139 test.Printf(_L("DismountFileSystem(%S) r %d\n"), &KFileSystem, r); |
149 test (r == KErrInUse); |
140 test (r == KErrInUse); |
150 |
141 |
151 // dismount failed - attempt a forced dismount |
142 // dismount failed - attempt a forced dismount |
152 TRequestStatus stat; |
143 TRequestStatus stat; |
153 TheFs.NotifyDismount(driveNumber, stat, EFsDismountForceDismount); |
144 TheFs.NotifyDismount(driveNumber, stat, EFsDismountForceDismount); |
154 User::WaitForRequest(stat); |
145 User::WaitForRequest(stat); |
155 r = stat.Int(); |
146 r = stat.Int(); |
156 test.Printf(_L("DismountFileSystem(%S, EFsDismountForceDismount) r %d\n"), &fsName, r); |
147 test.Printf(_L("DismountFileSystem(%S, EFsDismountForceDismount) r %d\n"), &KFileSystem, r); |
157 test (r == KErrNone); |
148 test (r == KErrNone); |
158 |
149 |
159 r = TheFs.DismountProxyDrive(driveNumber); |
150 r = TheFs.DismountProxyDrive(driveNumber); |
160 test.Printf(_L("DismountProxyDrive(%d) r %d\n"), driveNumber, r); |
151 test.Printf(_L("DismountProxyDrive(%d) r %d\n"), driveNumber, r); |
161 test (r == KErrNone); |
152 test (r == KErrNone); |