testprogs: print secdesc->Control in spoolss test.
[ira/wip.git] / testprogs / win32 / spoolss / printlib.c
index ff185170fc523501ea9e719de0604cc21ecdd9cc..b9198d46afb206168453a91766f61c4f35bb6050 100644 (file)
@@ -22,6 +22,7 @@
 #include <windows.h>
 #include <stdio.h>
 #include <assert.h>
+#include <sddl.h>
 
 void print_devmode(DEVMODE *pDevModeIn)
 {
@@ -125,24 +126,27 @@ void print_acl(const char* str, ACL *acl)
        return;
 }
 
-void print_sid(const char* str, SID *sid)
+void PrintLastError();
+
+void print_sid(LPSTR str, PSID sid)
 {
-       DWORD   i = 0;
+       LPSTR sid_string;
 
        printf("%s\n", str);
-       printf("0x%x\n", sid);
-       if (sid == NULL)
+
+       if (sid == NULL) {
+               printf("(null sid)\n");
+               return;
+       }
+
+       if (!ConvertSidToStringSid(sid, &sid_string)) {
+               PrintLastError();
                return;
-       printf("\t\tRevision\t\t0x%x\n", sid->Revision);
-       printf("\t\tSubAuthorityCount\t0x%x\n", sid->SubAuthorityCount);
-       printf("\t\tSubAuthority\n\t");
-       while (i < sid->SubAuthorityCount) {
-               printf("\t0x%x", sid->SubAuthority[i]);
-               if (i%4 == 3)
-                       printf("\n\t");
-               i++;
        }
 
+       printf("%s\n", sid_string);
+       LocalFree(sid_string);
+
        return;
 }
 
@@ -155,6 +159,7 @@ void print_secdesc(SECURITY_DESCRIPTOR *secdesc)
 
        printf("\tRevision\t= 0x%x\n", secdesc->Revision);
        printf("\tSbz1\t\t= 0x%x\n", secdesc->Sbz1);
+       printf("\tControl\t\t= 0x%x\n", secdesc->Control);
 #if 0
        print_sid("\tOwner\t\t= ", secdesc->Owner);
        print_sid("\tGroup\t\t= ",secdesc->Group);
@@ -583,11 +588,9 @@ void print_printer_info_2(PPRINTER_INFO_2 info)
        printf("\tDevice Mode Information\n");
        printf("\t-----------------------\n");
        print_devmode(info->pDevMode);
-#if 0
        printf("\tSecurity Descriptor Information\n");
        printf("\t-------------------------------\n");
        print_secdesc(info->pSecurityDescriptor);
-#endif
        return;
 }