Java 类com.sun.jna.win32.W32APITypeMapper 实例源码

项目:Nird2    文件:WindowsShutdownManagerImpl.java   
WindowsShutdownManagerImpl() {
    // Use the Unicode versions of Win32 API calls
    Map<String, Object> m = new HashMap<>();
    m.put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
    m.put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
    options = Collections.unmodifiableMap(m);
}
项目:Nird2    文件:WindowsShutdownManagerImpl.java   
WindowsShutdownManagerImpl() {
    // Use the Unicode versions of Win32 API calls
    Map<String, Object> m = new HashMap<>();
    m.put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
    m.put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
    options = Collections.unmodifiableMap(m);
}
项目:space-cubes    文件:SystemNativesHelper.java   
/**
 * Returns the correct userDataFolder for the given application name.
 */
public static String defaultDirectory() {
    // default
    String folder = "." + File.separator;

    if (isMac()) {
        folder = System.getProperty("user.home") + File.separator + "Library" + File.separator
                 + "Application Support";
    } else if (isWindows()) {

        Map<String, Object> options = Maps.newHashMap();
        options.put(Library.OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
        options.put(Library.OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);

        HWND hwndOwner   = null;
        int nFolder      = Shell32.CSIDL_LOCAL_APPDATA;
        HANDLE hToken    = null;
        int dwFlags      = Shell32.SHGFP_TYPE_CURRENT;
        char pszPath[]   = new char[Shell32.MAX_PATH];
        Shell32 instance = (Shell32) Native.loadLibrary("shell32", Shell32.class, options);
        int hResult      = instance.SHGetFolderPath(hwndOwner, nFolder, hToken, dwFlags, pszPath);
        if (Shell32.S_OK == hResult) {

            String path = new String(pszPath);
            int len     = path.indexOf('\0');
            folder      = path.substring(0, len);
        } else {
            System.err.println("Error: " + hResult);
        }
    }

    folder = folder + File.separator + "SpaceCubes" + File.separator;

    return folder;
}
项目:briar    文件:WindowsShutdownManagerImpl.java   
WindowsShutdownManagerImpl() {
    // Use the Unicode versions of Win32 API calls
    Map<String, Object> m = new HashMap<String, Object>();
    m.put(OPTION_TYPE_MAPPER, W32APITypeMapper.UNICODE);
    m.put(OPTION_FUNCTION_MAPPER, W32APIFunctionMapper.UNICODE);
    options = Collections.unmodifiableMap(m);
}