Package com.sun.jna.platform.win32.Guid

Examples of com.sun.jna.platform.win32.Guid.GUID


  }

  public void testCoCreateInstance() {
    HRESULT hrCI = Ole32.INSTANCE.CoInitializeEx(null, 0);

    GUID guid = Ole32Util
        .getGUIDFromString("{00021401-0000-0000-C000-000000000046}"); // Shell object
    GUID riid = Ole32Util
        .getGUIDFromString("{000214EE-0000-0000-C000-000000000046}"); // IShellLinkA

    PointerByReference pDispatch = new PointerByReference();

    HRESULT hr = Ole32.INSTANCE.CoCreateInstance(guid, null, // pOuter =
View Full Code Here


   *  String representation of a GUID, including { }.
   * @return
   *  A GUID.
   */
  public static GUID getGUIDFromString(String guidString) {
    GUID lpiid = new GUID();
      HRESULT hr = Ole32.INSTANCE.IIDFromString(guidString, lpiid);
      if (! hr.equals(W32Errors.S_OK)) {
        throw new RuntimeException(hr.toString());
      }
      return lpiid;
View Full Code Here

   *  GUID.
   * @return
   *  String representation of a GUID.
   */
  public static String getStringFromGUID(GUID guid) {
    GUID pguid = new GUID(guid.getPointer());
      int max = 39;
      char[] lpsz = new char[max];
      int len = Ole32.INSTANCE.StringFromGUID2(pguid, lpsz, max);
      if (len == 0) {
        throw new RuntimeException("StringFromGUID2");
View Full Code Here

   * Generate a new GUID.
   * @return
   *  New GUID.
   */
  public static GUID generateGUID() {
    GUID pguid = new GUID();
      HRESULT hr = Ole32.INSTANCE.CoCreateGuid(pguid);
      if (! hr.equals(W32Errors.S_OK)) {
        throw new RuntimeException(hr.toString());
      }
      return pguid;
View Full Code Here

    public void testSHGetKnownFolderPath()
    {
        int flags = ShlObj.KNOWN_FOLDER_FLAG.NONE.getFlag();
        PointerByReference outPath = new PointerByReference();
        HANDLE token = null;
        GUID guid = KnownFolders.FOLDERID_Fonts;
        HRESULT hr = Shell32.INSTANCE.SHGetKnownFolderPath(guid, flags, token, outPath);

        Ole32.INSTANCE.CoTaskMemFree(outPath.getValue());

        assertTrue(W32Errors.SUCCEEDED(hr.intValue()));
View Full Code Here

   * expected values in each byte.
   */
  public void testGUIDFromString() {
    String sourceGuidStr = "{A5DCBF10-6530-11D2-901F-00C04FB951ED}";
    // test loading via static method
    GUID targetGuid = GUID.fromString(sourceGuidStr);

    assertEquals(targetGuid.toGuidString(), sourceGuidStr);
  }
View Full Code Here

   * returned has the expected values in each byte.
   */
  public void testGUIDFromString2() {
    String sourceGuidStr = "{A5DCBF10-6530-11D2-901F-00C04FB951ED}";
    // test loading via constructor
    GUID targetGuid = new GUID(sourceGuidStr);

    assertEquals(targetGuid.toGuidString(), sourceGuidStr);
  }
View Full Code Here

        (byte) 0x11, (byte) 0xD2, (byte) 0x90, (byte) 0x1F,
        (byte) 0x00, (byte) 0xC0, (byte) 0x4F, (byte) 0xB9,
        (byte) 0x51, (byte) 0xED };

    // test loading via static method
    GUID targetGuid = GUID.fromBinary(sourceGuidBArr);
    byte[] targetGuidBArr = targetGuid.toByteArray();

    for (int i = 0; i < sourceGuidBArr.length; i++) {
      assertEquals(targetGuidBArr[i], sourceGuidBArr[i]);
    }
  }
View Full Code Here

        (byte) 0x11, (byte) 0xD2, (byte) 0x90, (byte) 0x1F,
        (byte) 0x00, (byte) 0xC0, (byte) 0x4F, (byte) 0xB9,
        (byte) 0x51, (byte) 0xED };

    // test loading via constructor
    GUID targetGuid = new GUID(sourceGuidBArr);
    byte[] targetGuidBArr = targetGuid.toByteArray();

    for (int i = 0; i < sourceGuidBArr.length; i++) {
      assertEquals(targetGuidBArr[i], sourceGuidBArr[i]);
    }
  }
View Full Code Here

  /**
   * Instantiates two guids, one with windows build-in function and one via
   * jna and compares it.
   */
  public void testBehaviourWithOle32() {
    GUID ole32Guid = Ole32Util.getGUIDFromString("{A5DCBF10-6530-11D2-901F-00C04FB951ED}");
    GUID jnaGuid = new GUID("{A5DCBF10-6530-11D2-901F-00C04FB951ED}");

    assertEquals(ole32Guid, jnaGuid);
  }
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.Guid.GUID

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.