| 3115 | } |
| 3116 | |
| 3117 | BOOL |
| 3118 | Ext2InitializeVolume( |
| 3119 | PCHAR NameString, |
| 3120 | PEXT2_VOLUME * Volume |
| 3121 | ) |
| 3122 | { |
| 3123 | BOOL rc = FALSE; |
| 3124 | HANDLE hVolume = NULL; |
| 3125 | NT::NTSTATUS status; |
| 3126 | NT::IO_STATUS_BLOCK ioSb; |
| 3127 | PEXT2_VOLUME volume = NULL; |
| 3128 | |
| 3129 | volume = (PEXT2_VOLUME) malloc(sizeof(EXT2_VOLUME)); |
| 3130 | if (!volume) { |
| 3131 | goto errorout; |
| 3132 | } |
| 3133 | |
| 3134 | status = Ext2Open(NameString, &hVolume, EXT2_DESIRED_ACCESS); |
| 3135 | if (!NT_SUCCESS(status)) { |
| 3136 | free(volume); volume = NULL; |
| 3137 | goto errorout; |
| 3138 | } |
| 3139 | |
| 3140 | memset(volume, 0, sizeof(EXT2_VOLUME)); |
| 3141 | volume->Magic = EXT2_VOLUME_MAGIC; |
| 3142 | strcpy(volume->Name, NameString); |
| 3143 | |
| 3144 | status = NT::ZwQueryVolumeInformationFile( |
| 3145 | hVolume, &ioSb, &volume->FsaInfo, |
| 3146 | MAX_PATH, NT::FileFsAttributeInformation |
| 3147 | ); |
| 3148 | |
| 3149 | if (NT_SUCCESS(status)) { |
| 3150 | |
| 3151 | NT::UNICODE_STRING uniString; |
| 3152 | NT::ANSI_STRING aniString; |
| 3153 | |
| 3154 | NT::ZwQueryVolumeInformationFile( |
| 3155 | hVolume, &ioSb, &volume->FsdInfo, |
| 3156 | sizeof(NT::FILE_FS_DEVICE_INFORMATION), |
| 3157 | NT::FileFsDeviceInformation |
| 3158 | ); |
| 3159 | |
| 3160 | NT::ZwQueryVolumeInformationFile( |
| 3161 | hVolume, &ioSb, &volume->FssInfo, |
| 3162 | sizeof(NT::FILE_FS_SIZE_INFORMATION), |
| 3163 | NT::FileFsSizeInformation |
| 3164 | ); |
| 3165 | |
| 3166 | if (volume->FsaInfo.FileSystemNameLength == 6 && |
| 3167 | (volume->FsaInfo.FileSystemName[0] == (WCHAR)'R' || |
| 3168 | volume->FsaInfo.FileSystemName[0] == (WCHAR)'r') && |
| 3169 | (volume->FsaInfo.FileSystemName[1] == (WCHAR)'A' || |
| 3170 | volume->FsaInfo.FileSystemName[1] == (WCHAR)'a') && |
| 3171 | (volume->FsaInfo.FileSystemName[2] == (WCHAR)'W' || |
| 3172 | volume->FsaInfo.FileSystemName[2] == (WCHAR)'w')) { |
| 3173 | if (!Ext2QueryVolumeFS(hVolume, volume)) { |
| 3174 | /* memcpy(volume->Codepage, "N/A", 3); */ |
no test coverage detected