| 1079 | } |
| 1080 | |
| 1081 | const WCHAR * // returns UNICODE plaintext stream name. input stream name is expected to start with colon |
| 1082 | decrypt_stream_name(CryptContext *con, const BYTE *dir_iv, const WCHAR *stream, wstring& storage) |
| 1083 | { |
| 1084 | if (!stream || stream[0] != ':') |
| 1085 | return NULL; |
| 1086 | |
| 1087 | if (is_long_name(stream + 1)) |
| 1088 | return NULL; |
| 1089 | |
| 1090 | wstring stream_without_type; |
| 1091 | wstring type; |
| 1092 | |
| 1093 | if (!remove_stream_type(stream, stream_without_type, type)) |
| 1094 | return NULL; |
| 1095 | |
| 1096 | LPCWSTR rs; |
| 1097 | |
| 1098 | if (stream_without_type.length() > 1) { |
| 1099 | rs = decrypt_filename(con, dir_iv, NULL, stream_without_type.c_str() + 1, storage); |
| 1100 | } else { |
| 1101 | storage = L""; |
| 1102 | rs = storage.c_str(); |
| 1103 | } |
| 1104 | |
| 1105 | if (!rs) |
| 1106 | return NULL; |
| 1107 | |
| 1108 | storage = L":" + storage + type; |
| 1109 | |
| 1110 | return storage.c_str(); |
| 1111 | } |
no test coverage detected