| 272 | } |
| 273 | |
| 274 | static USHORT inst_error(ULONG status, const TEXT* string) |
| 275 | { |
| 276 | /************************************** |
| 277 | * |
| 278 | * i n s t _ e r r o r |
| 279 | * |
| 280 | ************************************** |
| 281 | * |
| 282 | * Functional description |
| 283 | * Report an error and punt. |
| 284 | * |
| 285 | **************************************/ |
| 286 | TEXT buffer[512]; |
| 287 | |
| 288 | if (status == 0) |
| 289 | { |
| 290 | // Allows to report non System errors |
| 291 | printf("%s\n", string); |
| 292 | } |
| 293 | else |
| 294 | { |
| 295 | printf("Error %u occurred during \"%s\".\n", status, string); |
| 296 | |
| 297 | if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, |
| 298 | NULL, |
| 299 | status, |
| 300 | MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), |
| 301 | buffer, |
| 302 | sizeof(buffer), |
| 303 | NULL)) |
| 304 | { |
| 305 | printf("Windows NT error %" SLONGFORMAT"\n", status); |
| 306 | } |
| 307 | else |
| 308 | { |
| 309 | CharToOem(buffer, buffer); |
| 310 | printf("%s", buffer); // '\n' is included in system messages |
| 311 | } |
| 312 | } |
| 313 | return FB_FAILURE; |
| 314 | } |
| 315 | |
| 316 | static void usage_exit() |
| 317 | { |