Package com.sun.jna.platform.win32.Advapi32Util

Examples of com.sun.jna.platform.win32.Advapi32Util.EventLogIterator


        assertTrue(Advapi32Util.isWellKnownSid(everyoneBytes, WELL_KNOWN_SID_TYPE.WinWorldSid));   
        assertFalse(Advapi32Util.isWellKnownSid(everyoneBytes, WELL_KNOWN_SID_TYPE.WinAccountAdministratorSid));
    }
 
    public void testEventLogIteratorForwards() {
        EventLogIterator iter = new EventLogIterator("Application");
        try {
            int max = 100;
            int lastId = 0;
            while(iter.hasNext()) {
                EventLogRecord record = iter.next();
                assertTrue(record.getRecordNumber() > lastId);
                lastId = record.getRecordNumber();
                assertNotNull(record.getType().name());
                assertNotNull(record.getSource());
                if (record.getRecord().DataLength.intValue() > 0) {
                    assertEquals(record.getData().length,
                                 record.getRecord().DataLength.intValue());
                } else {
                    assertNull(record.getData());
                }
                if (record.getRecord().NumStrings.intValue() > 0) {
                    assertEquals(record.getStrings().length,
                                 record.getRecord().NumStrings.intValue());
                } else {
                    assertNull(record.getStrings());
                }
       
                if (max-- <= 0) {
                    break; // shorten test
                }
                /*
                  System.out.println(record.getRecordNumber()
                  + ": Event ID: " + record.getEventId()
                  + ", Event Type: " + record.getType()
                  + ", Event Source: " + record.getSource());
                */
            }
        } finally {
            iter.close();
        }
    }
View Full Code Here


            iter.close();
        }
    }
 
    public void testEventLogIteratorBackwards() {
        EventLogIterator iter = new EventLogIterator(null,
                                                     "Application", WinNT.EVENTLOG_BACKWARDS_READ);
        try {
            int max = 100;
            int lastId = -1;
            while(iter.hasNext()) {
                EventLogRecord record = iter.next();
                /*
                  System.out.println(record.getRecordNumber()
                  + ": Event ID: " + record.getEventId()
                  + ", Event Type: " + record.getType()
                  + ", Event Source: " + record.getSource());
                */
                assertTrue(record.getRecordNumber() < lastId || lastId == -1);
                lastId = record.getRecordNumber();
                if (max-- <= 0) {
                    break; // shorten test
                }
            }
        } finally {
            iter.close();
        }
    }
View Full Code Here

        assertTrue(Advapi32Util.isWellKnownSid(everyoneBytes, WELL_KNOWN_SID_TYPE.WinWorldSid));   
        assertFalse(Advapi32Util.isWellKnownSid(everyoneBytes, WELL_KNOWN_SID_TYPE.WinAccountAdministratorSid));
  }
 
  public void testEventLogIteratorForwards() {
    EventLogIterator iter = new EventLogIterator("Application");
    try {
      int max = 100;
      int lastId = 0;
      while(iter.hasNext()) {
        EventLogRecord record = iter.next();
        assertTrue(record.getRecordNumber() > lastId);
        lastId = record.getRecordNumber();
        assertNotNull(record.getType().name());
        assertNotNull(record.getSource());
        if (record.getRecord().DataLength.intValue() > 0) {
          assertEquals(record.getData().length,
              record.getRecord().DataLength.intValue());
        } else {
          assertNull(record.getData());
        }
        if (record.getRecord().NumStrings.intValue() > 0) {
          assertEquals(record.getStrings().length,
              record.getRecord().NumStrings.intValue());
        } else {
          assertNull(record.getStrings());
        }
       
        if (max-- <= 0) {
          break; // shorten test
        }
        /*
        System.out.println(record.getRecordNumber()
            + ": Event ID: " + record.getEventId()
            + ", Event Type: " + record.getType()
            + ", Event Source: " + record.getSource());
            */
      }
    } finally {
      iter.close();
    }
  }
View Full Code Here

      iter.close();
    }
  }
 
  public void testEventLogIteratorBackwards() {
    EventLogIterator iter = new EventLogIterator(null,
        "Application", WinNT.EVENTLOG_BACKWARDS_READ);
    try {
      int max = 100;
      int lastId = -1;
      while(iter.hasNext()) {
        EventLogRecord record = iter.next();
        /*
        System.out.println(record.getRecordNumber()
            + ": Event ID: " + record.getEventId()
            + ", Event Type: " + record.getType()
            + ", Event Source: " + record.getSource());
            */
        assertTrue(record.getRecordNumber() < lastId || lastId == -1);
        lastId = record.getRecordNumber();
        if (max-- <= 0) {
          break; // shorten test
        }
      }
    } finally {
      iter.close();
    }
  }
View Full Code Here

        int cImplTypes = typeAttr.cImplTypes.intValue();
        String interfaces = "";

        for (int i = 0; i < cImplTypes; i++) {
            HREFTYPE refTypeOfImplType = typeInfoUtil.getRefTypeOfImplType(i);
            ITypeInfo refTypeInfo = typeInfoUtil
                    .getRefTypeInfo(refTypeOfImplType);
            TypeInfoUtil refTypeInfoUtil = new TypeInfoUtil(refTypeInfo);
            this.createFunctions(refTypeInfoUtil, bindingMode);
            TypeInfoDoc documentation = refTypeInfoUtil
                    .getDocumentation(new MEMBERID(-1));
View Full Code Here

        this.createPackageName(packagename);
        this.createClassName(this.name);
        this.setFilename(this.name);

        // Get the TypeAttributes
        TypeInfoUtil typeInfoUtil = typeLibUtil.getTypeInfoUtil(index);
        TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();

        this.createJavaDocHeader(typeAttr.guid.toGuidString(), docString);

        int cFuncs = typeAttr.cFuncs.intValue();
        for (int i = 0; i < cFuncs; i++) {
            // Get the function description
            FUNCDESC funcDesc = typeInfoUtil.getFuncDesc(i);

            // Get the member ID
            MEMBERID memberID = funcDesc.memid;

            // Get the name of the method
            TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
            String methodName = typeInfoDoc2.getName();
            TlbAbstractMethod method = null;

            if (!isReservedMethod(methodName)) {
                if (funcDesc.invkind.equals(INVOKEKIND.INVOKE_FUNC)) {
                    method = new TlbFunctionStub(index, typeLibUtil, funcDesc,
                            typeInfoUtil);
                } else if (funcDesc.invkind
                        .equals(INVOKEKIND.INVOKE_PROPERTYGET)) {
                    method = new TlbPropertyGetStub(index, typeLibUtil,
                            funcDesc, typeInfoUtil);
                } else if (funcDesc.invkind
                        .equals(INVOKEKIND.INVOKE_PROPERTYPUT)) {
                    method = new TlbPropertyPutStub(index, typeLibUtil,
                            funcDesc, typeInfoUtil);
                } else if (funcDesc.invkind
                        .equals(INVOKEKIND.INVOKE_PROPERTYPUTREF)) {
                    method = new TlbPropertyPutStub(index, typeLibUtil,
                            funcDesc, typeInfoUtil);
                }

                this.content += method.getClassBuffer();

                if (i < cFuncs - 1)
                    this.content += CR;
            }

            // Release our function description stuff
            typeInfoUtil.ReleaseFuncDesc(funcDesc);
        }

        this.createContent(this.content);
    }
View Full Code Here

        this.createPackageName(packagename);
        this.createClassName(this.name);
        this.setFilename(this.name);

        // Get the TypeAttributes
        TypeInfoUtil typeInfoUtil = typeLibUtil.getTypeInfoUtil(index);
        TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();

        this.createJavaDocHeader(typeAttr.guid.toGuidString(), docString);

        int cVars = typeAttr.cVars.intValue();
        for (int i = 0; i < cVars; i++) {
            // Get the property description
            VARDESC varDesc = typeInfoUtil.getVarDesc(i);
            VARIANT constValue = varDesc._vardesc.lpvarValue;
            Object value = constValue.getValue();

            // Get the member ID
            MEMBERID memberID = varDesc.memid;

            // Get the name of the property
            TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
            this.content += TABTAB + "//" + typeInfoDoc2.getName() + CR;
            this.content += TABTAB + "public static final int "
                    + typeInfoDoc2.getName() + " = " + value.toString() + ";";

            if (i < cVars - 1)
                this.content += CR;

            // release the pointer
            typeInfoUtil.ReleaseVarDesc(varDesc);
        }

        this.createContent(this.content);
    }
View Full Code Here

     *            the type lib util
     */
    public TlbCoClass(int index, String packagename, TypeLibUtil typeLibUtil, String bindingMode) {
        super(index, typeLibUtil, null);
       
        TypeInfoUtil typeInfoUtil = typeLibUtil.getTypeInfoUtil(index);

        TypeLibDoc typeLibDoc = this.typeLibUtil.getDocumentation(index);
        String docString = typeLibDoc.getDocString();

        if(typeLibDoc.getName().length() > 0)
            this.name = typeLibDoc.getName();
       
        this.logInfo("Type of kind 'CoClass' found: " + this.name);

        this.createPackageName(packagename);
        this.createClassName(this.name);
        this.setFilename(this.name);

        String guidStr = this.typeLibUtil.getLibAttr().guid.toGuidString();
        int majorVerNum = this.typeLibUtil.getLibAttr().wMajorVerNum.intValue();
        int minorVerNum = this.typeLibUtil.getLibAttr().wMinorVerNum.intValue();
        String version = majorVerNum + "." + minorVerNum;
        String clsid = typeInfoUtil.getTypeAttr().guid.toGuidString();
       
        this.createJavaDocHeader(guidStr, version, docString);
        this.createCLSID(clsid);
        this.createCLSIDName(this.name);
       
     // Get the TypeAttributes
        TYPEATTR typeAttr = typeInfoUtil.getTypeAttr();
        int cImplTypes = typeAttr.cImplTypes.intValue();
        String interfaces = "";

        for (int i = 0; i < cImplTypes; i++) {
            HREFTYPE refTypeOfImplType = typeInfoUtil.getRefTypeOfImplType(i);
            ITypeInfo refTypeInfo = typeInfoUtil
                    .getRefTypeInfo(refTypeOfImplType);
            TypeInfoUtil refTypeInfoUtil = new TypeInfoUtil(refTypeInfo);
            this.createFunctions(refTypeInfoUtil, bindingMode);
            TypeInfoDoc documentation = refTypeInfoUtil
                    .getDocumentation(new MEMBERID(-1));
            interfaces += documentation.getName();

            if (i < cImplTypes - 1)
                interfaces += ", ";
View Full Code Here

            // Get the member ID
            MEMBERID memberID = varDesc.memid;

            // Get the name of the property
            TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
            this.content += TABTAB + "//" + typeInfoDoc2.getName() + CR;
            this.content += TABTAB + "public static final int "
                    + typeInfoDoc2.getName() + " = " + value.toString() + ";";

            if (i < cVars - 1)
                this.content += CR;
        }
View Full Code Here

            // Get the member ID
            MEMBERID memberID = funcDesc.memid;

            // Get the name of the method
            TypeInfoDoc typeInfoDoc2 = typeInfoUtil.getDocumentation(memberID);
            String methodName = typeInfoDoc2.getName();
            TlbAbstractMethod method = null;

            if (!isReservedMethod(methodName)) {
                if (funcDesc.invkind.equals(INVOKEKIND.INVOKE_FUNC)) {
                    method = new TlbFunctionStub(index, typeLibUtil, funcDesc,
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.Advapi32Util.EventLogIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.