com.sun.jna.platform.win32.ShTypes Maven / Gradle / Ivy
/* Copyright (c) 2017 Matthias Bläsing, All Rights Reserved
*
* The contents of this file is dual-licensed under 2
* alternative Open Source/Free licenses: LGPL 2.1 or later and
* Apache License 2.0. (starting with JNA version 4.0.0).
*
* You can freely decide which license you want to apply to
* the project.
*
* You may obtain a copy of the LGPL License at:
*
* http://www.gnu.org/licenses/licenses.html
*
* A copy is also included in the downloadable source code package
* containing JNA, in file "LGPL2.1".
*
* You may obtain a copy of the Apache License at:
*
* http://www.apache.org/licenses/
*
* A copy is also included in the downloadable source code package
* containing JNA, in file "AL2.0".
*/
package com.sun.jna.platform.win32;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.Structure.FieldOrder;
import com.sun.jna.Union;
/**
* Ported from ShTypes.h. Microsoft Windows SDK.
*/
public interface ShTypes {
/**
* structure for returning strings from IShellFolder member functions
*/
@FieldOrder({"uType", "u"})
public static class STRRET extends Structure {
public static final int TYPE_WSTR = 0;
public static final int TYPE_OFFSET = 0x1;
public static final int TYPE_CSTR = 0x2;
public static class UNION extends Union {
public static class ByReference extends UNION implements Structure.ByReference {
}
public WTypes.LPWSTR pOleStr;
public int uOffset;
public byte[] cStr = new byte[260];
}
/**
* indicate which union member to use:
*
*
* {@link #TYPE_WSTR} 0x0 Use STRRET.pOleStr must be freed by caller of GetDisplayNameOf
* {@link #TYPE_OFFSET} 0x1 Use STRRET.uOffset Offset into SHITEMID for ANSI string
* {@link #TYPE_CSTR} 0x0 Use STRRET.cStr ANSI Buffer
*
*/
public int uType;
public UNION u;
public STRRET() {
super();
}
public STRRET(Pointer p) {
super(p);
read();
}
@Override
public void read() {
super.read();
switch(uType) {
default:
case TYPE_WSTR:
u.setType("pOleStr");
break;
case TYPE_OFFSET:
u.setType("uOffset");
break;
case TYPE_CSTR:
u.setType("cStr");
break;
}
u.read();
}
}
}