Commit 493a6480755ed4d6b30ca35c946eeac924e48ab0
1 parent
320b3075
Exists in
master
and in
5 other branches
Melhorando retornos de erro nas funções que obtem strings da tela
Showing
1 changed file
with
13 additions
and
7 deletions
Show diff stats
src/plugins/hllapi/calls.c
| ... | ... | @@ -219,7 +219,7 @@ |
| 219 | 219 | |
| 220 | 220 | if(!ptr) |
| 221 | 221 | { |
| 222 | - trace(stderr,"Can´t load \"%s\"\n",entry_point[f].name); | |
| 222 | + trace("Can´t load \"%s\"\n",entry_point[f].name); | |
| 223 | 223 | hllapi_deinit(); |
| 224 | 224 | return -ENOENT; |
| 225 | 225 | } |
| ... | ... | @@ -359,15 +359,18 @@ |
| 359 | 359 | |
| 360 | 360 | trace(" text=%p errno=%d %s\n",text,errno,strerror(errno)); |
| 361 | 361 | |
| 362 | - if(!text) | |
| 363 | - return HLLAPI_STATUS_SYSTEM_ERROR; | |
| 362 | + if(!text) | |
| 363 | + { | |
| 364 | + int rc = hllapi_get_state(); | |
| 365 | + return rc == HLLAPI_STATUS_SUCCESS ? -1 : rc; | |
| 366 | + } | |
| 364 | 367 | |
| 365 | 368 | strncpy(buffer,text,len); |
| 366 | 369 | release_memory(text); |
| 367 | 370 | |
| 368 | 371 | trace("text:\n%s\n",buffer); |
| 369 | 372 | |
| 370 | - return 0; | |
| 373 | + return HLLAPI_STATUS_SUCCESS; | |
| 371 | 374 | } |
| 372 | 375 | |
| 373 | 376 | __declspec (dllexport) DWORD __stdcall hllapi_enter(void) |
| ... | ... | @@ -439,7 +442,7 @@ |
| 439 | 442 | __declspec (dllexport) DWORD __stdcall hllapi_getcursor() |
| 440 | 443 | { |
| 441 | 444 | if(!(getcursor && hSession)) |
| 442 | - return -EINVAL; | |
| 445 | + return HLLAPI_STATUS_SYSTEM_ERROR; | |
| 443 | 446 | return getcursor(hSession)+1; |
| 444 | 447 | } |
| 445 | 448 | |
| ... | ... | @@ -453,13 +456,16 @@ |
| 453 | 456 | |
| 454 | 457 | text = hllapi_get_string(offset, szBuffer); |
| 455 | 458 | if(!text) |
| 456 | - return HLLAPI_STATUS_SYSTEM_ERROR; | |
| 459 | + { | |
| 460 | + int rc = hllapi_get_state(); | |
| 461 | + return rc == HLLAPI_STATUS_SUCCESS ? -1 : rc; | |
| 462 | + } | |
| 457 | 463 | |
| 458 | 464 | memcpy(buffer,text,len); |
| 459 | 465 | |
| 460 | 466 | hllapi_free(text); |
| 461 | 467 | |
| 462 | - return 0; | |
| 468 | + return HLLAPI_STATUS_SUCCESS; | |
| 463 | 469 | } |
| 464 | 470 | |
| 465 | 471 | __declspec (dllexport) DWORD __stdcall hllapi_emulate_input(LPSTR buffer, WORD len, WORD pasting) | ... | ... |