- $ diff -u winsg.c.original winsg.c
- --- winsg.c.original 2024-07-23 02:25:12.855982600 +0200
- +++ winsg.c 2024-07-23 02:24:06.536385600 +0200
- @@ -44,7 +44,7 @@
- #include <Lmcons.h>
- #include <process.h>
- -#if 0
- +#if 1
- #define D(x) x
- #else
- #define D(x)
- @@ -80,10 +80,10 @@
- * always fails in Win10 with |ERROR_INSUFFICIENT_BUFFER| if you
- * just pass the |sizeof(TOKEN_*)| value. Instead of calling
- * |GetTokenInformation()| with |NULL| arg to obtain the size to
- - * allocate we just provide 2048 bytes of extra space after the
- + * allocate we just provide 8192 bytes of extra space after the
- * |TOKEN_*| size, and pray it is enough
- */
- -#define GETTOKINFO_EXTRA_BUFFER (2048)
- +#define GETTOKINFO_EXTRA_BUFFER (8192)
- D(
- static
- @@ -163,9 +163,9 @@
- DWORD tokdatalen;
- PTOKEN_GROUPS ptgroups;
- char namebuffer[GNLEN+1];
- - DWORD namesize = GNLEN+1;
- + DWORD namesize;
- char domainbuffer[UNLEN+1];
- - DWORD domainbuffer_size = sizeof(domainbuffer);
- + DWORD domainbuffer_size;
- SID_NAME_USE name_use;
- tokdatalen = sizeof(TOKEN_GROUPS)+GETTOKINFO_EXTRA_BUFFER;
- @@ -189,6 +189,9 @@
- continue;
- }
- + namesize = sizeof(namebuffer);
- + domainbuffer_size = sizeof(domainbuffer);
- +
- if (!LookupAccountSidA(NULL, ptgroups->Groups[i].Sid,
- namebuffer, &namesize, domainbuffer, &domainbuffer_size, &name_use)) {
- D((void)fprintf(stderr, "print_groups_in_token: "
- @@ -428,7 +431,7 @@
- "# shelltype=%d, cmd_arg_index=%d, "
- "av[cmd_arg_index]='%s', "
- "new group name '%s'\n",
- - (int)st, cmd_arg_index, av[cmd_arg_index], newgrpname));
- + (int)st, cmd_arg_index, cmd_arg_index>=0?av[cmd_arg_index]:NULL, newgrpname));
- if (!OpenProcessToken(GetCurrentProcess(),
- TOKEN_QUERY|TOKEN_ADJUST_DEFAULT|TOKEN_DUPLICATE,
WinSG patch for large number of groups
Posted by Anonymous on Tue 23rd Jul 2024 01:33
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.