18 Jul
2023
18 Jul
'23
10:16 a.m.
Hans Leidekker (@hans) commented about programs/klist/main.c:
+#define UNICODE +#include <ntstatus.h> +#define WIN32_NO_STATUS +#include <windows.h> +#include <ntsecapi.h> + +#include "wine/debug.h" + +#define USAGE L"Usage: klist <tickets | tgt | purge | get [service principal name]>\n" + +#define EXPAND_KERB_ETYPE(x) case KERB_ETYPE_##x: return L ## #x + +#define EXPAND_KERB_ETYPES(x) switch (x) { \ + EXPAND_KERB_ETYPE(NULL); \ + EXPAND_KERB_ETYPE(DES_CBC_CRC); \ + EXPAND_KERB_ETYPE(DES_CBC_MD4); \ There's no need for EXPAND_KERB_ETYPES since you're only using it once. Something like this would be better (omitting _KERB to keep the name short):
static const WCHAR *get_etype_text(LONG encryption_type)
{
switch (encryption_type)
{
#define EXPAND_ETYPE(x) case KERB_ETYPE_##x: return L ## #x;
EXPAND_ETYPE(NULL)
EXPAND_ETYPE(DES_CBC_CRC)
EXPAND_ETYPE(DES_CBC_MD4)
EXPAND_ETYPE(DES_CBC_MD5)
...
#undef EXPAND_ETYPE
default: return NULL;
}
}
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3347#note_39270