/* returns Z + 1 if there are no more available letters */ static char allocate_letter(int type) { char letter, start; if (type == DRIVE_REMOVABLE) start = 'A'; else start = 'C'; for (letter = start; letter <= 'Z'; letter++) if ((DRIVE_MASK_BIT(letter) & working_mask) != 0) break; return letter; }
/* This function produces a mask for each drive letter that isn't * currently used. Each bit of the long result represents a letter, * with A being the least significant bit, and Z being the most * significant. * * To calculate this, we loop over each letter, and see if we can get * a drive entry for it. If so, we set the appropriate bit. At the * end, we flip each bit, to give the desired result. * * The letter parameter is always marked as being available. This is * so the edit dialog can display the currently used drive letter * alongside the available ones. */ ULONG drive_available_mask(char letter) { ULONG result = 0; int i; WINE_TRACE("\n"); for(i = 0; i < 26; i++) { if (!drives[i].in_use) continue; result |= (1 << (letter_to_index(drives[i].letter))); } result = ~result; if (letter) result |= DRIVE_MASK_BIT(letter); WINE_TRACE("finished drive letter loop with %x\n", result); return result; }