Changeset 1112 for trunk/dll/misc.c
- Timestamp:
- Aug 24, 2008, 5:13:20 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/misc.c
r1106 r1112 51 51 20 Jul 08 GKY Add save/append filename to clipboard. 52 52 Change menu wording to make these easier to find 53 23 Aug 08 GKY Add CheckDriveSpaceAvail To pre check drive space to prevent failures 53 54 54 55 ***********************************************************************/ … … 2216 2217 } 2217 2218 2219 /** CheckDriveSpaceAvail 2220 * Take space needed and checks that drive has at least 1000 bits in excess of the required space. 2221 * Returns 0 if sufficient space is available; 1 if the drive is full & 2 on abort of operation 2222 * when the drive would have less than ullFreeSpaceWhenComplete remaining or has insufficient space. 2223 */ 2224 2225 INT CheckDriveSpaceAvail(CHAR *pTargetPath, ULONGLONG ullSpaceNeeded, 2226 ULONGLONG ullFreeSpaceWhenComplete) 2227 { 2228 FSALLOCATE fsa; 2229 ULONGLONG ullFreeQty; 2230 APIRET ret; 2231 2232 DosQueryFSInfo(toupper(*pTargetPath) - 'A' + 1, FSIL_ALLOC, &fsa, sizeof(FSALLOCATE)); 2233 ullFreeQty = (ULONGLONG) fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector); 2234 if (ullFreeQty > ullSpaceNeeded + ullFreeSpaceWhenComplete) 2235 return 0; 2236 else if (ullFreeQty < ullSpaceNeeded + 1024) { 2237 CHAR szKB[20]; 2238 2239 if (ullFreeSpaceWhenComplete == 0) 2240 ullSpaceNeeded = 0; 2241 commafmt(szKB, sizeof(szKB), 2242 (ULONG) ullFreeQty - ullSpaceNeeded); 2243 if (ullFreeSpaceWhenComplete == 0) { 2244 saymsg(MB_OK, 2245 HWND_DESKTOP, 2246 NullStr, 2247 GetPString(IDS_DRIVESPACELIMITEDTMPSAVE), 2248 pTargetPath, 2249 szKB); 2250 return 0; 2251 } 2252 else { 2253 if (ullFreeQty - ullSpaceNeeded > 0) { 2254 ret = saymsg(MB_YESNO, 2255 HWND_DESKTOP, 2256 NullStr, 2257 GetPString(IDS_DRIVESPACELIMITED), 2258 pTargetPath, 2259 szKB); 2260 if (ret == MBID_YES) 2261 return 0; 2262 else 2263 return 2; 2264 } 2265 else { 2266 saymsg(MB_OK, 2267 HWND_DESKTOP, 2268 NullStr, 2269 GetPString(IDS_DRIVESPACEEXCEEDED), 2270 pTargetPath); 2271 return 2; 2272 } 2273 } 2274 } 2275 else 2276 return 1; 2277 } 2278 2218 2279 #pragma alloc_text(MAINWND5,SetSysMenu) 2219 2280 #pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow,IsFm2Window) 2220 2281 #pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom) 2282 #pragma alloc_text(MISC1,CheckDriveSpaceAvail) 2221 2283 2222 2284 #ifdef FORTIFY
Note:
See TracChangeset
for help on using the changeset viewer.