1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-03-09 05:51:31 -04:00

Try to fix 32-bit MWS support

This commit is contained in:
Reinhard Pointner 2018-08-14 01:49:09 +07:00
parent 3aaedfe1dc
commit 61e2f54884
2 changed files with 9 additions and 7 deletions

View File

@ -1,6 +1,7 @@
package net.filebot.platform.windows;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.platform.win32.WTypes.LPWSTR;
import com.sun.jna.platform.win32.WinDef.UINTByReference;
import com.sun.jna.win32.StdCallLibrary;
@ -13,8 +14,8 @@ public interface Kernel32 extends StdCallLibrary {
long APPMODEL_ERROR_NO_PACKAGE = 15700;
long ERROR_INSUFFICIENT_BUFFER = 122;
long GetCurrentPackageFullName(UINTByReference packageFullNameLength, LPWSTR packageFullName);
NativeLong GetCurrentPackageFullName(UINTByReference packageFullNameLength, LPWSTR packageFullName);
long GetCurrentApplicationUserModelId(UINTByReference applicationUserModelIdLength, LPWSTR applicationUserModelId);
NativeLong GetCurrentApplicationUserModelId(UINTByReference applicationUserModelIdLength, LPWSTR applicationUserModelId);
}

View File

@ -10,6 +10,7 @@ import javax.swing.UIManager;
import com.sun.jna.Memory;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.WString;
import com.sun.jna.platform.win32.Shell32;
import com.sun.jna.platform.win32.W32Errors;
@ -45,10 +46,10 @@ public class WinAppUtilities {
UINTByReference packageFullNameLength = new UINTByReference(new UINT(64));
LPWSTR packageFullName = new LPWSTR(new Memory(packageFullNameLength.getValue().intValue() * Native.WCHAR_SIZE));
long r = Kernel32.INSTANCE.GetCurrentPackageFullName(packageFullNameLength, packageFullName);
NativeLong r = Kernel32.INSTANCE.GetCurrentPackageFullName(packageFullNameLength, packageFullName);
if (r != W32Errors.ERROR_SUCCESS) {
throw new IllegalStateException(String.format("Kernel32.GetCurrentPackageFullName (%d)", r));
if (r.intValue() != W32Errors.ERROR_SUCCESS) {
throw new IllegalStateException(String.format("Kernel32.GetCurrentPackageFullName (%s)", r));
}
return packageFullName.getValue();
@ -58,9 +59,9 @@ public class WinAppUtilities {
UINTByReference applicationUserModelIdLength = new UINTByReference(new UINT(64));
LPWSTR applicationUserModelId = new LPWSTR(new Memory(applicationUserModelIdLength.getValue().intValue() * Native.WCHAR_SIZE));
long r = Kernel32.INSTANCE.GetCurrentApplicationUserModelId(applicationUserModelIdLength, applicationUserModelId);
NativeLong r = Kernel32.INSTANCE.GetCurrentApplicationUserModelId(applicationUserModelIdLength, applicationUserModelId);
if (r != W32Errors.ERROR_SUCCESS) {
if (r.intValue() != W32Errors.ERROR_SUCCESS) {
throw new IllegalStateException(String.format("Kernel32.GetCurrentApplicationUserModelId (%d)", r));
}