Пример #1
0
  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
  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);
  }