コード例 #1
0
ファイル: MsiTest.java プロジェクト: TimReset/jna
  public void testMsiLocateComponentW() {
    char[] componentBuffer = new char[40];
    assertTrue(
        W32Errors.ERROR_SUCCESS
            == Msi.INSTANCE.MsiEnumComponents(new WinDef.DWORD(0), componentBuffer));
    String component = new String(componentBuffer).trim();

    char[] pathBuffer = new char[WinDef.MAX_PATH];
    IntByReference pathBufferSize = new IntByReference(pathBuffer.length);
    Msi.INSTANCE.MsiLocateComponentW(new WString(component), pathBuffer, pathBufferSize);

    String path = new String(pathBuffer, 0, pathBufferSize.getValue()).trim();
    assertTrue(path.length() > 0);
  }
コード例 #2
0
ファイル: MsiTest.java プロジェクト: TimReset/jna
  public void testMsiGetProductCodeW() {
    char[] componentBuffer = new char[40];
    assertTrue(
        W32Errors.ERROR_SUCCESS
            == Msi.INSTANCE.MsiEnumComponents(new WinDef.DWORD(0), componentBuffer));
    String component = new String(componentBuffer).trim();

    char[] productBuffer = new char[40];
    assertTrue(
        W32Errors.ERROR_SUCCESS
            == Msi.INSTANCE.MsiGetProductCodeW(new WString(component), productBuffer));

    String product = new String(productBuffer).trim();
    assertTrue(product.length() > 0);
  }