private static ErrorCategory GetErrorCategory(Deployment.WindowsInstaller.Record record, out string resource) { resource = null; if (1 < record.FieldCount) { int code = record.GetInteger(1); if (1000 <= code && code < 25000) { // Specifically handle common errors. switch (code) { case 1301: case 1304: resource = record.GetString(2); return ErrorCategory.WriteError; case 1303: case 1306: case 1718: resource = record.GetString(2); return ErrorCategory.PermissionDenied; case 1305: resource = record.GetString(2); return ErrorCategory.ReadError; case 1308: case 1334: resource = record.GetString(2); return ErrorCategory.ResourceUnavailable; case 1706: resource = record.GetString(2); return ErrorCategory.ResourceUnavailable; case 1715: case 1716: case 1717: resource = record.GetString(2); return ErrorCategory.NotSpecified; case 1935: case 1937: resource = record.GetString(6); return ErrorCategory.InvalidData; } } } return ErrorCategory.NotSpecified; }