Skip to content

Commit

Permalink
utils: Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Jul 30, 2024
1 parent 5dc9f7e commit c907012
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions ext/winevt/winevt_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ typedef struct {
extern "C" {
#endif /* __cplusplus */

#define WINEVT_UTILS_ERROR_NONE_MAPPED -1
#define WINEVT_UTILS_ERROR_OTHERS -2

VALUE wstr_to_rb_str(UINT cp, const WCHAR* wstr, int clen);
#if defined(__cplusplus)
[[ noreturn ]]
Expand Down
9 changes: 5 additions & 4 deletions ext/winevt/winevt_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -635,16 +635,17 @@ static int ExpandSIDWString(PSID sid, CHAR **out_expanded)
DWORD result_len = 0;
CHAR *formatted = NULL;
VALUE vformatted;
#undef MAX_NAME

if (!LookupAccountSidW(NULL, sid,
wAccount, &len, wDomain,
&len, &sid_type)) {
err = GetLastError();
if (err == ERROR_NONE_MAPPED) {
goto not_mapped_error;
goto none_mapped_error;
}
else {
return -2;
return WINEVT_UTILS_ERROR_OTHERS;
}

goto error;
Expand Down Expand Up @@ -680,9 +681,9 @@ static int ExpandSIDWString(PSID sid, CHAR **out_expanded)

return 0;

not_mapped_error:
none_mapped_error:

return -1;
return WINEVT_UTILS_ERROR_NONE_MAPPED;

error:
err = GetLastError();
Expand Down

0 comments on commit c907012

Please sign in to comment.