JNA packages refactoring

This commit is contained in:
Jindra Petřík
2025-05-24 04:40:41 +02:00
parent 470f1411d9
commit a412e51567
41 changed files with 5640 additions and 95 deletions
@@ -190,7 +190,7 @@ import com.jpexs.helpers.utf8.Utf8Helper;
import com.jpexs.process.Process;
import com.jpexs.process.ProcessTools;
import com.sun.jna.Platform;
import com.sun.jna.platform.win32.Kernel32;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Kernel32;
import gnu.jpdf.PDFGraphics;
import gnu.jpdf.PDFJob;
import java.awt.Font;
@@ -19,13 +19,13 @@ package com.jpexs.decompiler.flash.console;
import com.jpexs.helpers.utf8.Utf8Helper;
import com.sun.jna.Platform;
import com.sun.jna.WString;
import com.sun.jna.platform.win32.Advapi32Util;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.SHELLEXECUTEINFO;
import com.sun.jna.platform.win32.Shell32;
import com.sun.jna.platform.win32.Win32Exception;
import com.sun.jna.platform.win32.WinReg;
import com.sun.jna.platform.win32.WinUser;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Advapi32Util;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Kernel32;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.SHELLEXECUTEINFO;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Shell32;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Win32Exception;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinReg;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinUser;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
+3 -4
View File
@@ -49,12 +49,12 @@ import com.jpexs.decompiler.flash.gfx.GfxConvertor;
import com.jpexs.decompiler.flash.gui.debugger.DebugAdapter;
import com.jpexs.decompiler.flash.gui.debugger.DebugLoaderDataModified;
import com.jpexs.decompiler.flash.gui.debugger.DebuggerTools;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Advapi32Util;
import com.jpexs.decompiler.flash.gui.pipes.FirstInstance;
import com.jpexs.decompiler.flash.gui.soleditor.CookiesChangedListener;
import com.jpexs.decompiler.flash.gui.soleditor.SharedObjectsStorage;
import com.jpexs.decompiler.flash.gui.soleditor.SolEditorFrame;
import com.jpexs.decompiler.flash.gui.taglistview.TagListTreeModel;
import com.jpexs.decompiler.flash.gui.tagtree.AbstractTagTreeModel;
import com.jpexs.decompiler.flash.gui.tagtree.TagTreeModel;
import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin;
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
@@ -82,9 +82,8 @@ import com.jpexs.helpers.Stopwatch;
import com.jpexs.helpers.streams.SeekableInputStream;
import com.jpexs.helpers.utf8.Utf8Helper;
import com.sun.jna.Platform;
import com.sun.jna.platform.win32.Advapi32Util;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.WinReg;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Kernel32;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinReg;
import java.awt.Component;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
@@ -0,0 +1,977 @@
/*
* Copyright (C) 2010-2024 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
/**
* @author JPEXS
*/
/* Copyright (c) 2010 Daniel Doubrovkine, All Rights Reserved
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinBase.SECURITY_ATTRIBUTES;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT.HANDLE;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT.HANDLEByReference;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinReg.HKEY;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinReg.HKEYByReference;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
/**
* Advapi32.dll Interface.
*
* @author dblock[at]dblock.org
*/
public interface Advapi32 extends StdCallLibrary {
/**
* Advapi32 instance.
*/
Advapi32 INSTANCE = (Advapi32) Native.loadLibrary("Advapi32",
Advapi32.class, W32APIOptions.UNICODE_OPTIONS);
/**
* Retrieves the name of the user associated with the current thread.
* http://msdn.microsoft.com/en-us/library/ms724432(VS.85).aspx
*
* @param buffer Buffer to receive the user's logon name.
* @param len On input, the size of the buffer, on output the number of
* characters copied into the buffer, including the terminating null
* character.
* @return True if succeeded.
*/
public boolean GetUserNameW(char[] buffer, IntByReference len);
/**
* The LogonUser function attempts to log a user on to the local computer.
* The local computer is the computer from which LogonUser was called. You
* cannot use LogonUser to log on to a remote computer. You specify the user
* with a user name and domain, and authenticate the user with a plaintext
* password. If the function succeeds, you receive a handle to a token that
* represents the logged-on user. You can then use this token handle to
* impersonate the specified user or, in most cases, to create a process
* that runs in the context of the specified user.
*
* @param lpszUsername A pointer to a null-terminated string that specifies
* the name of the user. This is the name of the user account to log on to.
* If you use the user principal name (UPN) format, user@DNS_domain_name,
* the lpszDomain parameter must be NULL.
* @param lpszDomain A pointer to a null-terminated string that specifies
* the name of the domain or server whose account database contains the
* lpszUsername account. If this parameter is NULL, the user name must be
* specified in UPN format. If this parameter is ".", the function validates
* the account using only the local account database.
* @param lpszPassword A pointer to a null-terminated string that specifies
* the plaintext password for the user account specified by lpszUsername.
* @param logonType The type of logon operation to perform.
* @param logonProvider Specifies the logon provider.
* @param phToken A pointer to a handle variable that receives a handle to a
* token that represents the specified user.
* @return If the function succeeds, the function returns nonzero. If the
* function fails, it returns zero. To get extended error information, call
* GetLastError.
*/
public boolean LogonUser(
String lpszUsername,
String lpszDomain,
String lpszPassword,
int logonType,
int logonProvider,
HANDLEByReference phToken);
/**
* The OpenThreadToken function opens the access token associated with a
* thread.
*
* @param ThreadHandle Handle to the thread whose access token is opened.
* @param DesiredAccess Specifies an access mask that specifies the
* requested types of access to the access token. These requested access
* types are reconciled against the token's discretionary access control
* list (DACL) to determine which accesses are granted or denied.
* @param OpenAsSelf Indicates whether the access check is to be made
* against the security context of the thread calling the OpenThreadToken
* function or against the security context of the process for the calling
* thread.
* @param TokenHandle Pointer to a variable that receives the handle to the
* newly opened access token.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean OpenThreadToken(
HANDLE ThreadHandle,
int DesiredAccess,
boolean OpenAsSelf,
HANDLEByReference TokenHandle);
/**
* The OpenProcessToken function opens the access token associated with a
* process.
*
* @param ProcessHandle Handle to the process whose access token is opened.
* The process must have the PROCESS_QUERY_INFORMATION access permission.
* @param DesiredAccess Specifies an access mask that specifies the
* requested types of access to the access token. These requested access
* types are compared with the discretionary access control list (DACL) of
* the token to determine which accesses are granted or denied.
* @param TokenHandle Pointer to a handle that identifies the newly opened
* access token when the function returns.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean OpenProcessToken(
HANDLE ProcessHandle,
int DesiredAccess,
HANDLEByReference TokenHandle);
/**
* The DuplicateToken function creates a new access token that duplicates
* one already in existence.
*
* @param ExistingTokenHandle Handle to an access token opened with
* TOKEN_DUPLICATE access.
* @param ImpersonationLevel Specifies a SECURITY_IMPERSONATION_LEVEL
* enumerated type that supplies the impersonation level of the new token.
* @param DuplicateTokenHandle Pointer to a variable that receives a handle
* to the duplicate token. This handle has TOKEN_IMPERSONATE and TOKEN_QUERY
* access to the new token.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean DuplicateToken(
HANDLE ExistingTokenHandle,
int ImpersonationLevel,
HANDLEByReference DuplicateTokenHandle);
/**
* The DuplicateTokenEx function creates a new access token that duplicates
* an existing token. This function can create either a primary token or an
* impersonation token.
*
* @param hExistingToken A handle to an access token opened with
* TOKEN_DUPLICATE access.
* @param dwDesiredAccess Specifies the requested access rights for the new
* token.
* @param lpTokenAttributes A pointer to a SECURITY_ATTRIBUTES structure
* that specifies a security descriptor for the new token and determines
* whether child processes can inherit the token.
* @param ImpersonationLevel Specifies a value from the
* SECURITY_IMPERSONATION_LEVEL enumeration that indicates the impersonation
* level of the new token.
* @param TokenType Specifies one of the following values from the
* TOKEN_TYPE enumeration.
* @param phNewToken A pointer to a HANDLE variable that receives the new
* token.
* @return If the function succeeds, the function returns a nonzero value.
* If the function fails, it returns zero. To get extended error
* information, call GetLastError.
*/
public boolean DuplicateTokenEx(
HANDLE hExistingToken,
int dwDesiredAccess,
WinBase.SECURITY_ATTRIBUTES lpTokenAttributes,
int ImpersonationLevel,
int TokenType,
HANDLEByReference phNewToken);
/**
* Retrieves a specified type of information about an access token. The
* calling process must have appropriate access rights to obtain the
* information.
*
* @param tokenHandle Handle to an access token from which information is
* retrieved. If TokenInformationClass specifies TokenSource, the handle
* must have TOKEN_QUERY_SOURCE access. For all other TokenInformationClass
* values, the handle must have TOKEN_QUERY access.
* @param tokenInformationClass Specifies a value from the
* TOKEN_INFORMATION_CLASS enumerated type to identify the type of
* information the function retrieves.
* @param tokenInformation Pointer to a buffer the function fills with the
* requested information. The structure put into this buffer depends upon
* the type of information specified by the TokenInformationClass parameter.
* @param tokenInformationLength Specifies the size, in bytes, of the buffer
* pointed to by the TokenInformation parameter. If TokenInformation is
* NULL, this parameter must be zero.
* @param returnLength Pointer to a variable that receives the number of
* bytes needed for the buffer pointed to by the TokenInformation parameter.
* If this value is larger than the value specified in the
* TokenInformationLength parameter, the function fails and stores no data
* in the buffer.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean GetTokenInformation(
HANDLE tokenHandle,
int tokenInformationClass,
Structure tokenInformation,
int tokenInformationLength,
IntByReference returnLength);
/**
* The ImpersonateLoggedOnUser function lets the calling thread impersonate
* the security context of a logged-on user. The user is represented by a
* token handle.
*
* @param hToken Handle to a primary or impersonation access token that
* represents a logged-on user. This can be a token handle returned by a
* call to LogonUser, CreateRestrictedToken, DuplicateToken,
* DuplicateTokenEx, OpenProcessToken, or OpenThreadToken functions. If
* hToken is a primary token, it must have TOKEN_QUERY and TOKEN_DUPLICATE
* access. If hToken is an impersonation token, it must have TOKEN_QUERY and
* TOKEN_IMPERSONATE access.
* @return If the function succeeds, the return value is nonzero.
*/
public boolean ImpersonateLoggedOnUser(HANDLE hToken);
/**
* The ImpersonateSelf function obtains an access token that impersonates
* the security context of the calling process. The token is assigned to the
* calling thread.
*
* @param ImpersonationLevel Specifies a SECURITY_IMPERSONATION_LEVEL
* enumerated type that supplies the impersonation level of the new token.
* @return If the function succeeds, the return value is nonzero.
*/
public boolean ImpersonateSelf(int ImpersonationLevel);
/**
* The RevertToSelf function terminates the impersonation of a client
* application.
*
* @return If the function succeeds, the return value is nonzero.
*/
public boolean RevertToSelf();
/**
* The RegOpenKeyEx function opens the specified registry key. Note that key
* names are not case-sensitive.
*
* @param hKey Handle to an open key.
* @param lpSubKey Pointer to a null-terminated string containing the name
* of the subkey to open.
* @param ulOptions Reserved; must be zero.
* @param samDesired Access mask that specifies the desired access rights to
* the key. The function fails if the security descriptor of the key does
* not permit the requested access for the calling process.
* @param phkResult Pointer to a variable that receives a handle to the
* opened key. If the key is not one of the predefined registry keys, call
* the RegCloseKey function after you have finished using the handle.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegOpenKeyEx(HKEY hKey, String lpSubKey, int ulOptions, int samDesired,
HKEYByReference phkResult);
/**
* The RegQueryValueEx function retrieves the type and data for a specified
* value name associated with an open registry key.
*
* @param hKey Handle to an open key. The key must have been opened with the
* KEY_QUERY_VALUE access right.
* @param lpValueName Pointer to a null-terminated string containing the
* name of the value to query. If lpValueName is NULL or an empty string,
* "", the function retrieves the type and data for the key's unnamed or
* default value, if any.
* @param lpReserved Reserved; must be NULL.
* @param lpType Pointer to a variable that receives a code indicating the
* type of data stored in the specified value.
* @param lpData Pointer to a buffer that receives the value's data. This
* parameter can be NULL if the data is not required. If the data is a
* string, the function checks for a terminating null character. If one is
* not found, the string is stored with a null terminator if the buffer is
* large enough to accommodate the extra character. Otherwise, the string is
* stored as is.
* @param lpcbData Pointer to a variable that specifies the size of the
* buffer pointed to by the lpData parameter, in bytes. When the function
* returns, this variable contains the size of the data copied to lpData.
* The lpcbData parameter can be NULL only if lpData is NULL. If the data
* has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, this size includes
* any terminating null character or characters. If the buffer specified by
* lpData parameter is not large enough to hold the data, the function
* returns ERROR_MORE_DATA and stores the required buffer size in the
* variable pointed to by lpcbData. In this case, the contents of the lpData
* buffer are undefined. If lpData is NULL, and lpcbData is non-NULL, the
* function returns ERROR_SUCCESS and stores the size of the data, in bytes,
* in the variable pointed to by lpcbData. This enables an application to
* determine the best way to allocate a buffer for the value's data.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegQueryValueEx(HKEY hKey, String lpValueName, int lpReserved,
IntByReference lpType, char[] lpData, IntByReference lpcbData);
/**
* The RegQueryValueEx function retrieves the type and data for a specified
* value name associated with an open registry key.
*
* @param hKey Handle to an open key. The key must have been opened with the
* KEY_QUERY_VALUE access right.
* @param lpValueName Pointer to a null-terminated string containing the
* name of the value to query. If lpValueName is NULL or an empty string,
* "", the function retrieves the type and data for the key's unnamed or
* default value, if any.
* @param lpReserved Reserved; must be NULL.
* @param lpType Pointer to a variable that receives a code indicating the
* type of data stored in the specified value.
* @param lpData Pointer to a buffer that receives the value's data. This
* parameter can be NULL if the data is not required. If the data is a
* string, the function checks for a terminating null character. If one is
* not found, the string is stored with a null terminator if the buffer is
* large enough to accommodate the extra character. Otherwise, the string is
* stored as is.
* @param lpcbData Pointer to a variable that specifies the size of the
* buffer pointed to by the lpData parameter, in bytes. When the function
* returns, this variable contains the size of the data copied to lpData.
* The lpcbData parameter can be NULL only if lpData is NULL. If the data
* has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, this size includes
* any terminating null character or characters. If the buffer specified by
* lpData parameter is not large enough to hold the data, the function
* returns ERROR_MORE_DATA and stores the required buffer size in the
* variable pointed to by lpcbData. In this case, the contents of the lpData
* buffer are undefined. If lpData is NULL, and lpcbData is non-NULL, the
* function returns ERROR_SUCCESS and stores the size of the data, in bytes,
* in the variable pointed to by lpcbData. This enables an application to
* determine the best way to allocate a buffer for the value's data.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegQueryValueEx(HKEY hKey, String lpValueName, int lpReserved,
IntByReference lpType, byte[] lpData, IntByReference lpcbData);
/**
* The RegQueryValueEx function retrieves the type and data for a specified
* value name associated with an open registry key.
*
* @param hKey Handle to an open key. The key must have been opened with the
* KEY_QUERY_VALUE access right.
* @param lpValueName Pointer to a null-terminated string containing the
* name of the value to query. If lpValueName is NULL or an empty string,
* "", the function retrieves the type and data for the key's unnamed or
* default value, if any.
* @param lpReserved Reserved; must be NULL.
* @param lpType Pointer to a variable that receives a code indicating the
* type of data stored in the specified value.
* @param lpData Pointer to a buffer that receives the value's data. This
* parameter can be NULL if the data is not required. If the data is a
* string, the function checks for a terminating null character. If one is
* not found, the string is stored with a null terminator if the buffer is
* large enough to accommodate the extra character. Otherwise, the string is
* stored as is.
* @param lpcbData Pointer to a variable that specifies the size of the
* buffer pointed to by the lpData parameter, in bytes. When the function
* returns, this variable contains the size of the data copied to lpData.
* The lpcbData parameter can be NULL only if lpData is NULL. If the data
* has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, this size includes
* any terminating null character or characters. If the buffer specified by
* lpData parameter is not large enough to hold the data, the function
* returns ERROR_MORE_DATA and stores the required buffer size in the
* variable pointed to by lpcbData. In this case, the contents of the lpData
* buffer are undefined. If lpData is NULL, and lpcbData is non-NULL, the
* function returns ERROR_SUCCESS and stores the size of the data, in bytes,
* in the variable pointed to by lpcbData. This enables an application to
* determine the best way to allocate a buffer for the value's data.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegQueryValueEx(HKEY hKey, String lpValueName, int lpReserved,
IntByReference lpType, IntByReference lpData, IntByReference lpcbData);
/**
* The RegQueryValueEx function retrieves the type and data for a specified
* value name associated with an open registry key.
*
* @param hKey Handle to an open key. The key must have been opened with the
* KEY_QUERY_VALUE access right.
* @param lpValueName Pointer to a null-terminated string containing the
* name of the value to query. If lpValueName is NULL or an empty string,
* "", the function retrieves the type and data for the key's unnamed or
* default value, if any.
* @param lpReserved Reserved; must be NULL.
* @param lpType Pointer to a variable that receives a code indicating the
* type of data stored in the specified value.
* @param lpData Pointer to a buffer that receives the value's data. This
* parameter can be NULL if the data is not required. If the data is a
* string, the function checks for a terminating null character. If one is
* not found, the string is stored with a null terminator if the buffer is
* large enough to accommodate the extra character. Otherwise, the string is
* stored as is.
* @param lpcbData Pointer to a variable that specifies the size of the
* buffer pointed to by the lpData parameter, in bytes. When the function
* returns, this variable contains the size of the data copied to lpData.
* The lpcbData parameter can be NULL only if lpData is NULL. If the data
* has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, this size includes
* any terminating null character or characters. If the buffer specified by
* lpData parameter is not large enough to hold the data, the function
* returns ERROR_MORE_DATA and stores the required buffer size in the
* variable pointed to by lpcbData. In this case, the contents of the lpData
* buffer are undefined. If lpData is NULL, and lpcbData is non-NULL, the
* function returns ERROR_SUCCESS and stores the size of the data, in bytes,
* in the variable pointed to by lpcbData. This enables an application to
* determine the best way to allocate a buffer for the value's data.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegQueryValueEx(HKEY hKey, String lpValueName, int lpReserved,
IntByReference lpType, Pointer lpData, IntByReference lpcbData);
/**
* The RegCloseKey function releases a handle to the specified registry key.
*
* @param hKey Handle to the open key to be closed. The handle must have
* been opened by the RegCreateKeyEx, RegOpenKeyEx, or RegConnectRegistry
* function.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegCloseKey(HKEY hKey);
/**
* The RegDeleteValue function removes a named value from the specified
* registry key. Note that value names are not case-sensitive.
*
* @param hKey Handle to an open key. The key must have been opened with the
* KEY_SET_VALUE access right.
* @param lpValueName Pointer to a null-terminated string that names the
* value to remove. If this parameter is NULL or an empty string, the value
* set by the RegSetValue function is removed.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegDeleteValue(HKEY hKey, String lpValueName);
/**
* The RegSetValueEx function sets the data and type of a specified value
* under a registry key.
*
* @param hKey Handle to an open key. The key must have been opened with the
* KEY_SET_VALUE access right.
* @param lpValueName Pointer to a string containing the name of the value
* to set. If a value with this name is not already present in the key, the
* function adds it to the key. If lpValueName is NULL or an empty string,
* "", the function sets the type and data for the key's unnamed or default
* value.
* @param Reserved Reserved; must be zero.
* @param dwType Type of data pointed to by the lpData parameter.
* @param lpData Pointer to a buffer containing the data to be stored with
* the specified value name.
* @param cbData Size of the information pointed to by the lpData parameter,
* in bytes. If the data is of type REG_SZ, REG_EXPAND_SZ, or REG_MULTI_SZ,
* cbData must include the size of the terminating null character or
* characters.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegSetValueEx(HKEY hKey, String lpValueName, int Reserved, int dwType,
char[] lpData, int cbData);
/**
* The RegSetValueEx function sets the data and type of a specified value
* under a registry key.
*
* @param hKey Handle to an open key. The key must have been opened with the
* KEY_SET_VALUE access right.
* @param lpValueName Pointer to a string containing the name of the value
* to set. If a value with this name is not already present in the key, the
* function adds it to the key. If lpValueName is NULL or an empty string,
* "", the function sets the type and data for the key's unnamed or default
* value.
* @param Reserved Reserved; must be zero.
* @param dwType Type of data pointed to by the lpData parameter.
* @param lpData Pointer to a buffer containing the data to be stored with
* the specified value name.
* @param cbData Size of the information pointed to by the lpData parameter,
* in bytes. If the data is of type REG_SZ, REG_EXPAND_SZ, or REG_MULTI_SZ,
* cbData must include the size of the terminating null character or
* characters.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegSetValueEx(HKEY hKey, String lpValueName, int Reserved, int dwType,
byte[] lpData, int cbData);
/**
* Creates the specified registry key.
* @param hKey hKey
* @param lpSubKey lpSubKey
* @param Reserved Reserved
* @param lpClass lpClass
* @param dwOptions dwOptions
* @param samDesired samDesired
* @param lpSecurityAttributes lpSecurityAttributes
* @param phkResult phkResult
* @param lpdwDisposition lpdwDisposition
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegCreateKeyEx(HKEY hKey, String lpSubKey, int Reserved, String lpClass,
int dwOptions, int samDesired, SECURITY_ATTRIBUTES lpSecurityAttributes,
HKEYByReference phkResult, IntByReference lpdwDisposition);
/**
* Removes the specified registry key.
* @param hKey hKey
* @param name name
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegDeleteKey(HKEY hKey, String name);
/**
* The RegEnumKeyEx function enumerates subkeys of the specified open
* registry key. The function retrieves information about one subkey each
* time it is called.
*
* @param hKey Handle to an open key. The key must have been opened with the
* KEY_ENUMERATE_SUB_KEYS access right.
* @param dwIndex Index of the subkey to retrieve. This parameter should be
* zero for the first call to the RegEnumKeyEx function and then incremented
* for subsequent calls. Because subkeys are not ordered, any new subkey
* will have an arbitrary index. This means that the function may return
* subkeys in any order.
* @param lpName Pointer to a buffer that receives the name of the subkey,
* including the terminating null character. The function copies only the
* name of the subkey, not the full key hierarchy, to the buffer.
* @param lpcName Pointer to a variable that specifies the size of the
* buffer specified by the lpName parameter, in TCHARs. This size should
* include the terminating null character. When the function returns, the
* variable pointed to by lpcName contains the number of characters stored
* in the buffer. The count returned does not include the terminating null
* character.
* @param reserved Reserved; must be NULL.
* @param lpClass Pointer to a buffer that receives the null-terminated
* class string of the enumerated subkey. This parameter can be NULL.
* @param lpcClass Pointer to a variable that specifies the size of the
* buffer specified by the lpClass parameter, in TCHARs. The size should
* include the terminating null character. When the function returns,
* lpcClass contains the number of characters stored in the buffer. The
* count returned does not include the terminating null character. This
* parameter can be NULL only if lpClass is NULL.
* @param lpftLastWriteTime Pointer to a variable that receives the time at
* which the enumerated subkey was last written.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegEnumKeyEx(HKEY hKey, int dwIndex, char[] lpName, IntByReference lpcName,
IntByReference reserved, char[] lpClass, IntByReference lpcClass,
WinBase.FILETIME lpftLastWriteTime);
/**
* The RegEnumValue function enumerates the values for the specified open
* registry key. The function copies one indexed value name and data block
* for the key each time it is called.
*
* @param hKey Handle to an open key. The key must have been opened with the
* KEY_QUERY_VALUE access right.
* @param dwIndex Index of the value to be retrieved. This parameter should
* be zero for the first call to the RegEnumValue function and then be
* incremented for subsequent calls. Because values are not ordered, any new
* value will have an arbitrary index. This means that the function may
* return values in any order.
* @param lpValueName Pointer to a buffer that receives the name of the
* value, including the terminating null character.
* @param lpcchValueName Pointer to a variable that specifies the size of
* the buffer pointed to by the lpValueName parameter, in TCHARs. This size
* should include the terminating null character. When the function returns,
* the variable pointed to by lpcValueName contains the number of characters
* stored in the buffer. The count returned does not include the terminating
* null character.
* @param reserved Reserved; must be NULL.
* @param lpType Pointer to a variable that receives a code indicating the
* type of data stored in the specified value.
* @param lpData Pointer to a buffer that receives the data for the value
* entry. This parameter can be NULL if the data is not required.
* @param lpcbData Pointer to a variable that specifies the size of the
* buffer pointed to by the lpData parameter, in bytes.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegEnumValue(HKEY hKey, int dwIndex, char[] lpValueName,
IntByReference lpcchValueName, IntByReference reserved,
IntByReference lpType, byte[] lpData, IntByReference lpcbData);
/**
* The RegQueryInfoKey function retrieves information about the specified
* registry key.
*
* @param hKey A handle to an open key. The key must have been opened with
* the KEY_QUERY_VALUE access right.
* @param lpClass A pointer to a buffer that receives the null-terminated
* class string of the key. This parameter can be ignored. This parameter
* can be NULL.
* @param lpcClass A pointer to a variable that specifies the size of the
* buffer pointed to by the lpClass parameter, in characters.
* @param lpReserved Reserved; must be NULL.
* @param lpcSubKeys A pointer to a variable that receives the number of
* subkeys that are contained by the specified key. This parameter can be
* NULL.
* @param lpcMaxSubKeyLen A pointer to a variable that receives the size of
* the key's subkey with the longest name, in characters, not including the
* terminating null character. This parameter can be NULL.
* @param lpcMaxClassLen A pointer to a variable that receives the size of
* the longest string that specifies a subkey class, in characters. The
* count returned does not include the terminating null character. This
* parameter can be NULL.
* @param lpcValues A pointer to a variable that receives the number of
* values that are associated with the key. This parameter can be NULL.
* @param lpcMaxValueNameLen A pointer to a variable that receives the size
* of the key's longest value name, in characters. The size does not include
* the terminating null character. This parameter can be NULL.
* @param lpcMaxValueLen A pointer to a variable that receives the size of
* the longest data component among the key's values, in bytes. This
* parameter can be NULL.
* @param lpcbSecurityDescriptor A pointer to a variable that receives the
* size of the key's security descriptor, in bytes. This parameter can be
* NULL.
* @param lpftLastWriteTime A pointer to a FILETIME structure that receives
* the last write time. This parameter can be NULL.
* @return If the function succeeds, the return value is ERROR_SUCCESS. If
* the function fails, the return value is a nonzero error code defined in
* Winerror.h.
*/
public int RegQueryInfoKey(HKEY hKey, char[] lpClass,
IntByReference lpcClass, IntByReference lpReserved,
IntByReference lpcSubKeys, IntByReference lpcMaxSubKeyLen,
IntByReference lpcMaxClassLen, IntByReference lpcValues,
IntByReference lpcMaxValueNameLen, IntByReference lpcMaxValueLen,
IntByReference lpcbSecurityDescriptor,
WinBase.FILETIME lpftLastWriteTime);
/**
* Retrieves a registered handle to the specified event log.
*
* @param lpUNCServerName The Universal Naming Convention (UNC) name of the
* remote server on which this operation is to be performed. If this
* parameter is NULL, the local computer is used.
* @param lpSourceName The name of the event source whose handle is to be
* retrieved. The source name must be a subkey of a log under the Eventlog
* registry key. However, the Security log is for system use only.
* @return If the function succeeds, the return value is a handle to the
* event log. If the function fails, the return value is NULL. To get
* extended error information, call GetLastError. The function returns
* ERROR_ACCESS_DENIED if lpSourceName specifies the Security event log.
*/
public HANDLE RegisterEventSource(String lpUNCServerName, String lpSourceName);
/**
* Closes the specified event log.
*
* @param hEventLog A handle to the event log. The RegisterEventSource
* function returns this handle.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean DeregisterEventSource(HANDLE hEventLog);
/**
* Opens a handle to the specified event log.
*
* @param lpUNCServerName The Universal Naming Convention (UNC) name of the
* remote server on which the event log is to be opened. If this parameter
* is NULL, the local computer is used.
* @param lpSourceName The name of the log. If you specify a custom log and
* it cannot be found, the event logging service opens the Application log;
* however, there will be no associated message or category string file.
* @return If the function succeeds, the return value is the handle to an
* event log. If the function fails, the return value is NULL. To get
* extended error information, call GetLastError.
*/
public HANDLE OpenEventLog(String lpUNCServerName, String lpSourceName);
/**
* Closes the specified event log.
*
* @param hEventLog A handle to the event log to be closed. The OpenEventLog
* or OpenBackupEventLog function returns this handle.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean CloseEventLog(HANDLE hEventLog);
/**
* Retrieves the number of records in the specified event log.
*
* @param hEventLog A handle to the open event log. The OpenEventLog or
* OpenBackupEventLog function returns this handle.
* @param NumberOfRecords A pointer to a variable that receives the number
* of records in the specified event log.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean GetNumberOfEventLogRecords(HANDLE hEventLog, IntByReference NumberOfRecords);
/**
* Clears the specified event log, and optionally saves the current copy of
* the log to a backup file.
*
* @param hEventLog A handle to the event log to be cleared. The
* OpenEventLog function returns this handle.
* @param lpBackupFileName The absolute or relative path of the backup file.
* If this file already exists, the function fails. If the lpBackupFileName
* parameter is NULL, the event log is not backed up.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError. The ClearEventLog function can fail if
* the event log is empty or the backup file already exists.
*/
public boolean ClearEventLog(HANDLE hEventLog, String lpBackupFileName);
/**
* Saves the specified event log to a backup file. The function does not
* clear the event log.
*
* @param hEventLog A handle to the open event log. The OpenEventLog
* function returns this handle.
* @param lpBackupFileName The absolute or relative path of the backup file.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean BackupEventLog(HANDLE hEventLog, String lpBackupFileName);
/**
* Opens a handle to a backup event log created by the BackupEventLog
* function.
*
* @param lpUNCServerName The Universal Naming Convention (UNC) name of the
* remote server on which this operation is to be performed. If this
* parameter is NULL, the local computer is used.
* @param lpFileName The full path of the backup file.
* @return If the function succeeds, the return value is a handle to the
* backup event log. If the function fails, the return value is NULL. To get
* extended error information, call GetLastError.
*/
public HANDLE OpenBackupEventLog(String lpUNCServerName, String lpFileName);
/**
* Reads the specified number of entries from the specified event log. The
* function can be used to read log entries in chronological or reverse
* chronological order.
*
* @param hEventLog A handle to the event log to be read. The OpenEventLog
* function returns this handle.
* @param dwReadFlags Use the following flag values to indicate how to read
* the log file.
* @param dwRecordOffset The record number of the log-entry at which the
* read operation should start. This parameter is ignored unless dwReadFlags
* includes the EVENTLOG_SEEK_READ flag.
* @param lpBuffer An application-allocated buffer that will receive one or
* more EVENTLOGRECORD structures. This parameter cannot be NULL, even if
* the nNumberOfBytesToRead parameter is zero. The maximum size of this
* buffer is 0x7ffff bytes.
* @param nNumberOfBytesToRead The size of the lpBuffer buffer, in bytes.
* This function will read as many log entries as will fit in the buffer;
* the function will not return partial entries.
* @param pnBytesRead A pointer to a variable that receives the number of
* bytes read by the function.
* @param pnMinNumberOfBytesNeeded A pointer to a variable that receives the
* required size of the lpBuffer buffer. This value is valid only this
* function returns zero and GetLastError returns ERROR_INSUFFICIENT_BUFFER.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean ReadEventLog(HANDLE hEventLog, int dwReadFlags, int dwRecordOffset,
Pointer lpBuffer, int nNumberOfBytesToRead, IntByReference pnBytesRead,
IntByReference pnMinNumberOfBytesNeeded);
/**
* The GetOldestEventLogRecord function retrieves the absolute record number
* of the oldest record in the specified event log.
*
* @param hEventLog Handle to the open event log. This handle is returned by
* the OpenEventLog or OpenBackupEventLog function.
* @param OldestRecord Pointer to a variable that receives the absolute
* record number of the oldest record in the specified event log.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean GetOldestEventLogRecord(HANDLE hEventLog, IntByReference OldestRecord);
/**
* Creates a new process and its primary thread. The new process runs in the
* security context of the user represented by the specified token.
* <p>
* Typically, the process that calls the CreateProcessAsUser function must
* have the SE_INCREASE_QUOTA_NAME privilege and may require the
* SE_ASSIGNPRIMARYTOKEN_NAME privilege if the token is not assignable. If
* this function fails with ERROR_PRIVILEGE_NOT_HELD (1314), use the
* CreateProcessWithLogonW function instead. CreateProcessWithLogonW
* requires no special privileges, but the specified user account must be
* allowed to log on interactively. Generally, it is best to use
* CreateProcessWithLogonW to create a process with alternate credentials.
*
* @param hToken A handle to the primary token that represents a user.
* @param lpApplicationName The name of the module to be executed.
* @param lpCommandLine The command line to be executed.
* @param lpProcessAttributes A pointer to a SECURITY_ATTRIBUTES structure
* that specifies a security descriptor for the new process object and
* determines whether child processes can inherit the returned handle to the
* process.
* @param lpThreadAttributes A pointer to a SECURITY_ATTRIBUTES structure
* that specifies a security descriptor for the new thread object and
* determines whether child processes can inherit the returned handle to the
* thread.
* @param bInheritHandles If this parameter is TRUE, each inheritable handle
* in the calling process is inherited by the new process. If the parameter
* is FALSE, the handles are not inherited. Note that inherited handles have
* the same value and access rights as the original handles.
* @param dwCreationFlags The flags that control the priority class and the
* creation of the process. For a list of values, see Process Creation
* Flags.
* @param lpEnvironment A pointer to an environment block for the new
* process. If this parameter is NULL, the new process uses the environment
* of the calling process.
* <p>
* An environment block consists of a null-terminated block of
* null-terminated strings. Each string is in the following form:
* name=value\0
* @param lpCurrentDirectory The full path to the current directory for the
* process. The string can also specify a UNC path.
* @param lpStartupInfo A pointer to a STARTUPINFO or STARTUPINFOEX
* structure.
* @param lpProcessInformation A pointer to a PROCESS_INFORMATION structure
* that receives identification information about the new process.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean CreateProcessAsUser(
HANDLE hToken,
String lpApplicationName,
String lpCommandLine,
SECURITY_ATTRIBUTES lpProcessAttributes,
SECURITY_ATTRIBUTES lpThreadAttributes,
boolean bInheritHandles,
int dwCreationFlags,
String lpEnvironment,
String lpCurrentDirectory,
WinBase.STARTUPINFO lpStartupInfo,
WinBase.PROCESS_INFORMATION lpProcessInformation);
/**
* The AdjustTokenPrivileges function enables or disables privileges in the
* specified access token. Enabling or disabling privileges in an access
* token requires TOKEN_ADJUST_PRIVILEGES access.
*
* @param TokenHandle A handle to the access token that contains the
* privileges to be modified.
* @param DisableAllPrivileges Specifies whether the function disables all
* of the token's privileges.
* @param NewState A pointer to a TOKEN_PRIVILEGES structure that specifies
* an array of privileges and their attributes.
* @param BufferLength Specifies the size, in bytes, of the buffer pointed
* to by the PreviousState parameter. This parameter can be zero if the
* PreviousState parameter is NULL.
* @param PreviousState A pointer to a buffer that the function fills with a
* TOKEN_PRIVILEGES structure that contains the previous state of any
* privileges that the function modifies.
* @param ReturnLength A pointer to a variable that receives the required
* size, in bytes, of the buffer pointed to by the PreviousState parameter.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean AdjustTokenPrivileges(
HANDLE TokenHandle,
boolean DisableAllPrivileges,
WinNT.TOKEN_PRIVILEGES NewState,
int BufferLength,
WinNT.TOKEN_PRIVILEGES PreviousState,
IntByReference ReturnLength);
/**
* The LookupPrivilegeName function retrieves the name that corresponds to
* the privilege represented on a specific system by a specified locally
* unique identifier (LUID).
*
* @param lpSystemName A pointer to a null-terminated string that specifies
* the name of the system on which the privilege name is retrieved. If a
* null string is specified, the function attempts to find the privilege
* name on the local system.
* @param lpLuid A pointer to the LUID by which the privilege is known on
* the target system.
* @param lpName A pointer to a buffer that receives a null-terminated
* string that represents the privilege name. For example, this string could
* be "SeSecurityPrivilege".
* @param cchName A pointer to a variable that specifies the size, in a
* TCHAR value, of the lpName buffer.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean LookupPrivilegeName(
String lpSystemName,
WinNT.LUID lpLuid,
char[] lpName,
IntByReference cchName);
/**
* The LookupPrivilegeValue function retrieves the locally unique identifier
* (LUID) used on a specified system to locally represent the specified
* privilege name.
*
* @param lpSystemName A pointer to a null-terminated string that specifies
* the name of the system on which the privilege name is retrieved. If a
* null string is specified, the function attempts to find the privilege
* name on the local system.
* @param lpName A pointer to a null-terminated string that specifies the
* name of the privilege, as defined in the Winnt.h header file. For
* example, this parameter could specify the constant, SE_SECURITY_NAME, or
* its corresponding string, "SeSecurityPrivilege".
* @param lpLuid A pointer to a variable that receives the LUID by which the
* privilege is known on the system specified by the lpSystemName parameter.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
public boolean LookupPrivilegeValue(
String lpSystemName,
String lpName,
WinNT.LUID lpLuid);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,49 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.Structure;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.LONG;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.LPVOID;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.WORD;
import java.util.Arrays;
import java.util.List;
/**
* @author JPEXS
*/
public class BITMAP extends Structure {
public LONG bmType;
public LONG bmWidth;
public LONG bmHeight;
public LONG bmWidthBytes;
public WORD bmPlanes;
public WORD bmBitsPixel;
public LPVOID bmBits;
@Override
protected List getFieldOrder() {
return Arrays.asList("bmType", "bmWidth", "bmHeight", "bmWidthBytes", "bmPlanes", "bmBitsPixel", "bmBits");
}
}
@@ -0,0 +1,141 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.IntegerType;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.ByReference;
import com.sun.jna.win32.StdCallLibrary;
/**
* Based on basetsd.h (various types)
*
* @author dblock[at]dblock[dot]org
*/
@SuppressWarnings("serial")
public interface BaseTSD extends StdCallLibrary {
/**
* Signed long type for pointer precision. Use when casting a pointer to a
* long to perform pointer arithmetic.
*/
public static class LONG_PTR extends IntegerType {
public LONG_PTR() {
this(0);
}
public LONG_PTR(long value) {
super(Native.POINTER_SIZE, value);
}
public Pointer toPointer() {
return Pointer.createConstant(longValue());
}
}
/**
* Signed SIZE_T.
*/
public static class SSIZE_T extends LONG_PTR {
public SSIZE_T() {
this(0);
}
public SSIZE_T(long value) {
super(value);
}
}
/**
* Unsigned LONG_PTR.
*/
public static class ULONG_PTR extends IntegerType {
public ULONG_PTR() {
this(0);
}
public ULONG_PTR(long value) {
super(Native.POINTER_SIZE, value, true);
}
public Pointer toPointer() {
return Pointer.createConstant(longValue());
}
}
/**
* PULONG_PTR
*/
public static final class ULONG_PTRByReference extends ByReference {
public ULONG_PTRByReference() {
this(new ULONG_PTR(0));
}
public ULONG_PTRByReference(ULONG_PTR value) {
super(Native.POINTER_SIZE);
setValue(value);
}
public void setValue(ULONG_PTR value) {
if (Native.POINTER_SIZE == 4) {
getPointer().setInt(0, value.intValue());
} else {
getPointer().setLong(0, value.longValue());
}
}
public ULONG_PTR getValue() {
return new ULONG_PTR(Native.POINTER_SIZE == 4
? getPointer().getInt(0)
: getPointer().getLong(0));
}
}
/**
* Unsigned DWORD_PTR.
*/
public static class DWORD_PTR extends IntegerType {
public DWORD_PTR() {
this(0);
}
public DWORD_PTR(long value) {
super(Native.POINTER_SIZE, value);
}
}
/**
* The maximum number of bytes to which a pointer can point. Use for a count
* that must span the full range of a pointer.
*/
public static class SIZE_T extends ULONG_PTR {
public SIZE_T() {
this(0);
}
public SIZE_T(long value) {
super(value);
}
}
}
@@ -0,0 +1,332 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.DWORD;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.HBITMAP;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.HDC;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.HRGN;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinGDI.BITMAPINFO;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinGDI.BITMAPINFOHEADER;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinGDI.RGNDATA;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.ptr.PointerByReference;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
/**
* Definition (incomplete) of <code>gdi32.dll</code>.
*/
public interface Gdi32 extends StdCallLibrary {
Gdi32 INSTANCE = (Gdi32) Native.loadLibrary("gdi32", Gdi32.class,
W32APIOptions.DEFAULT_OPTIONS);
/**
* The ExtCreateRegion function creates a region from the specified region
* and transformation data.
*
* @param lpXform Pointer to an XFORM structure that defines the
* transformation to be performed on the region. If this pointer is NULL,
* the identity transformation is used.
* @param nCount Specifies the number of bytes pointed to by lpRgnData.
* @param lpRgnData Pointer to a RGNDATA structure that contains the region
* data in logical units.
* @return If the function succeeds, the return value is the value of the
* region. If the function fails, the return value is NULL. To get extended
* error information, call GetLastError.
*/
public HRGN ExtCreateRegion(Pointer lpXform, int nCount, RGNDATA lpRgnData);
/**
* The CombineRgn function combines two regions and stores the result in a
* third region. The two regions are combined according to the specified
* mode.
*
* @param hrgnDest Handle to a new region with dimensions defined by
* combining two other regions.
* @param hrgnSrc1 Handle to the first of two regions to be combined.
* @param hrgnSrc2 Handle to the second of two regions to be combined.
* @param fnCombineMode Specifies a mode indicating how the two regions will
* be combined.
* @return The return value specifies the type of the resulting region.
*/
int CombineRgn(HRGN hrgnDest, HRGN hrgnSrc1, HRGN hrgnSrc2,
int fnCombineMode);
/**
* The CreateRectRgn function creates a rectangular region.
*
* @param nLeftRect Specifies the x-coordinate of the upper-left corner of
* the region in logical units.
* @param nTopRect Specifies the y-coordinate of the upper-left corner of
* the region in logical units.
* @param nRightRect Specifies the x-coordinate of the lower-right corner of
* the region in logical units.
* @param nBottomRect Specifies the y-coordinate of the lower-right corner
* of the region in logical units.
* @return If the function succeeds, the return value is the handle to the
* region. If the function fails, the return value is NULL. To get extended
* error information, call GetLastError.
*/
HRGN CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect);
/**
* The CreateRoundRectRgn function creates a rectangular region with rounded
* corners.
*
* @param nLeftRect Specifies the x-coordinate of the upper-left corner of
* the region in logical units.
* @param nTopRect Specifies the y-coordinate of the upper-left corner of
* the region in logical units.
* @param nRightRect Specifies the x-coordinate of the lower-right corner of
* the region in logical units.
* @param nBottomRect Specifies the y-coordinate of the lower-right corner
* of the region in logical units.
* @param nWidthEllipse Specifies the width of the ellipse used to create
* the rounded corners in logical units.
* @param nHeightEllipse Specifies the height of the ellipse used to create
* the rounded corners in logical units.
* @return If the function succeeds, the return value is the handle to the
* region. If the function fails, the return value is NULL. To get extended
* error information, call GetLastError.
*/
HRGN CreateRoundRectRgn(int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect, int nWidthEllipse, int nHeightEllipse);
/**
* The CreatePolyPolygonRgn function creates a region consisting of a series
* of polygons. The polygons can overlap.
*
* @param lppt Pointer to an array of POINT structures that define the
* vertices of the polygons in logical units. The polygons are specified
* consecutively. Each polygon is presumed closed and each vertex is
* specified only once.
* @param lpPolyCounts Pointer to an array of integers, each of which
* specifies the number of points in one of the polygons in the array
* pointed to by lppt.
* @param nCount Specifies the total number of integers in the array pointed
* to by lpPolyCounts.
* @param fnPolyFillMode Specifies the fill mode used to determine which
* pixels are in the region.
* @return If the function succeeds, the return value is the handle to the
* region. If the function fails, the return value is zero. To get extended
* error information, call GetLastError.
*/
HRGN CreatePolyPolygonRgn(WinUser.POINT[] lppt, int[] lpPolyCounts,
int nCount, int fnPolyFillMode);
/**
* The SetRectRgn function converts a region into a rectangular region with
* the specified coordinates.
*
* @param hrgn Handle to the region.
* @param nLeftRect Specifies the x-coordinate of the upper-left corner of
* the rectangular region in logical units.
* @param nTopRect Specifies the y-coordinate of the upper-left corner of
* the rectangular region in logical units.
* @param nRightRect Specifies the x-coordinate of the lower-right corner of
* the rectangular region in logical units.
* @param nBottomRect Specifies the y-coordinate of the lower-right corner
* of the rectangular region in logical units.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
boolean SetRectRgn(HRGN hrgn, int nLeftRect, int nTopRect, int nRightRect,
int nBottomRect);
/**
* The SetPixel function sets the pixel at the specified coordinates to the
* specified color.
*
* @param hDC Handle to the device context.
* @param x Specifies the x-coordinate, in logical units, of the point to be
* set.
* @param y Specifies the y-coordinate, in logical units, of the point to be
* set.
* @param crColor Specifies the color to be used to paint the point. To
* create a COLORREF color value, use the RGB macro.
* @return If the function succeeds, the return value is the RGB value that
* the function sets the pixel to. This value may differ from the color
* specified by crColor; that occurs when an exact match for the specified
* color cannot be found. If the function fails, the return value is 1. To
* get extended error information, call GetLastError. This can be the
* following value.
*/
int SetPixel(HDC hDC, int x, int y, int crColor);
/**
* The CreateCompatibleDC function creates a memory device context (DC)
* compatible with the specified device.
*
* @param hDC Handle to an existing DC. If this handle is NULL, the function
* creates a memory DC compatible with the application's current screen.
* @return If the function succeeds, the return value is the handle to a
* memory DC. If the function fails, the return value is NULL. To get
* extended error information, call GetLastError.
*/
HDC CreateCompatibleDC(HDC hDC);
/**
* The DeleteDC function deletes the specified device context (DC).
*
* @param hDC Handle to the device context.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
boolean DeleteDC(HDC hDC);
/**
* The CreateDIBitmap function creates a compatible bitmap (DDB) from a DIB
* and, optionally, sets the bitmap bits.
*
* @param hDC Handle to a device context.
* @param lpbmih Pointer to a bitmap information header structure, which may
* be one of those shown in the following table.
* @param fdwInit Specifies how the system initializes the bitmap bits.
* @param lpbInit Pointer to an array of bytes containing the initial bitmap
* data.
* @param lpbmi Pointer to a BITMAPINFO structure that describes the
* dimensions and color format of the array pointed to by the lpbInit
* parameter.
* @param fuUsage Specifies whether the bmiColors member of the BITMAPINFO
* structure was initialized and, if so, whether bmiColors contains explicit
* red, green, blue (RGB) values or palette indexes. The fuUsage parameter
* must be one of the following values.
* @return If the function succeeds, the return value is a handle to the
* compatible bitmap. If the function fails, the return value is NULL. To
* get extended error information, call GetLastError.
*/
HBITMAP CreateDIBitmap(HDC hDC, BITMAPINFOHEADER lpbmih, int fdwInit,
Pointer lpbInit, BITMAPINFO lpbmi, int fuUsage);
/**
* The CreateDIBSection function creates a DIB that applications can write
* to directly. The function gives you a pointer to the location of the
* bitmap bit values. You can supply a handle to a file-mapping object that
* the function will use to create the bitmap, or you can let the system
* allocate the memory for the bitmap.
*
* @param hDC Handle to a device context. If the value of iUsage is
* DIB_PAL_COLORS, the function uses this device context's logical palette
* to initialize the DIB colors.
* @param pbmi Pointer to a BITMAPINFO structure that specifies various
* attributes of the DIB, including the bitmap dimensions and colors.
* @param iUsage Specifies the type of data contained in the bmiColors array
* member of the BITMAPINFO structure pointed to by pbmi (either logical
* palette indexes or literal RGB values).
* @param ppvBits Pointer to a variable that receives a pointer to the
* location of the DIB bit values.
* @param hSection Handle to a file-mapping object that the function will
* use to create the DIB. This parameter can be NULL.
* @param dwOffset Specifies the offset from the beginning of the
* file-mapping object referenced by hSection where storage for the bitmap
* bit values is to begin.
* @return Specifies the offset from the beginning of the file-mapping
* object referenced by hSection where storage for the bitmap bit values is
* to begin.
*/
HBITMAP CreateDIBSection(HDC hDC, BITMAPINFO pbmi, int iUsage,
PointerByReference ppvBits, Pointer hSection, int dwOffset);
/**
* The CreateCompatibleBitmap function creates a bitmap compatible with the
* device that is associated with the specified device context.
*
* @param hDC Handle to a device context.
* @param width Specifies the bitmap width, in pixels.
* @param height Specifies the bitmap height, in pixels.
* @return If the function succeeds, the return value is a handle to the
* compatible bitmap (DDB). If the function fails, the return value is NULL.
* To get extended error information, call GetLastError.
*/
HBITMAP CreateCompatibleBitmap(HDC hDC, int width, int height);
/**
* The SelectObject function selects an object into the specified device
* context (DC). The new object replaces the previous object of the same
* type.
*
* @param hDC Handle to the DC.
* @param hGDIObj Handle to the object to be selected.
* @return If the selected object is not a region and the function succeeds,
* the return value is a handle to the object being replaced. If the
* selected object is a region and the function succeeds, the return value
* is one of the REGION values.
*/
HANDLE SelectObject(HDC hDC, HANDLE hGDIObj);
/**
* The DeleteObject function deletes a logical pen, brush, font, bitmap,
* region, or palette, freeing all system resources associated with the
* object. After the object is deleted, the specified handle is no longer
* valid.
*
* @param hObject Handle to a logical pen, brush, font, bitmap, region, or
* palette.
* @return If the function succeeds, the return value is nonzero. If the
* specified handle is not valid or is currently selected into a DC, the
* return value is zero. To get extended error information, call
* GetLastError.
*/
boolean DeleteObject(HANDLE hObject);
/**
* The GetDeviceCaps function retrieves device-specific information for the
* specified device.
*
* @param hdc A handle to the DC.
* @param nIndex The item to be returned.
* @return The return value specifies the value of the desired item. When
* <i>nIndex</i> is <code>BITSPIXEL</code> and the device has 15bpp or
* 16bpp, the return value is 16.
*/
int GetDeviceCaps(HDC hdc, int nIndex);
/**
* The GetDIBits function retrieves the bits fo the specified compatible
* bitmap and copies them into a buffer as a DIB using the specified format.
*
* @param hdc A handle to the device context.
* @param hbmp A handle to the bitmap. This must be a compatible bitmap
* (DDB).
* @param uStartScan The first scan line to retrieve
* @param cScanLines The number of scan lines to retrieve.
* @param lpvBits A pointer to a buffer to receive the bitmap data. If this
* parameter is <code>null</code>, the function passes the dimensions and
* format of the bitmap to the {@link BITMAPINFO} structure pointed to by
* the <i>lpbi</i> parameter.
* @param lpbi A pointer to a {@link BITMAPINFO} structure that specifies
* the desired format for the DIB data.
* @param uUsage The format of the bmiColors member of the {@link
* BITMAPINFO} structure.
* @return the number of scan lines copied from the bitmap
*/
int GetDIBits(HDC hdc, HBITMAP hbmp, int uStartScan, int cScanLines, Pointer lpvBits, BITMAPINFO lpbi, int uUsage);
int GetObject(HANDLE hgdiobj, int cbBuffer, Structure lpvObject);
DWORD GetPixel(HDC hdc, int nXPos, int nYPos);
HANDLE CreateSolidBrush(DWORD crColor);
}
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.Structure;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.DWORD;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.HBITMAP;
import java.util.Arrays;
import java.util.List;
/**
* @author JPEXS
*/
public class ICONINFO extends Structure {
public boolean fIcon;
public DWORD xHotspot;
public DWORD yHotspot;
public HBITMAP hbmMask;
public HBITMAP hbmColor;
@Override
protected List getFieldOrder() {
return Arrays.asList("fIcon", "xHotspot", "yHotspot", "hbmMask", "hbmColor");
}
}
@@ -0,0 +1,350 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.LPVOID;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.NativeLongByReference;
import com.sun.jna.win32.W32APIOptions;
// TODO: Auto-generated Javadoc
/**
* Interface definitions for <code>kernel32.dll</code>. Includes additional
* alternate mappings from {@link WinNT} which make use of NIO buffers.
*/
public interface Kernel32 extends WinNT {
/**
* The instance.
*/
Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("kernel32",
Kernel32.class, W32APIOptions.UNICODE_OPTIONS);
/**
* The CloseHandle function closes an open object handle.
*
* @param hObject Handle to an open object. This parameter can be a pseudo
* handle or INVALID_HANDLE_VALUE.
* @return If the function succeeds, the return value is nonzero. If the
* function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
boolean CloseHandle(HANDLE hObject);
/**
* Terminates the specified process and all of its threads.
*
* @param hProcess A handle to the process to be terminated.
* @param uExitCode The exit code to be used by the process and threads
* terminated as a result of this call.
* @return If the function succeeds, the return value is nonzero.
* <p>
* If the function fails, the return value is zero. To get extended error
* information, call GetLastError.
*/
boolean TerminateProcess(HANDLE hProcess, int uExitCode);
/**
* Writes data to the specified file or input/output (I/O) device.
*
* @param hFile A handle to the file or I/O device (for example, a file,
* file stream, physical disk, volume, console buffer, tape drive, socket,
* communications resource, mailslot, or pipe).
* @param lpBuffer A pointer to the buffer containing the data to be written
* to the file or device.
* @param nNumberOfBytesToWrite The number of bytes to be written to the
* file or device.
* @param lpNumberOfBytesWritten A pointer to the variable that receives the
* number of bytes written when using a synchronous hFile parameter.
* @param lpOverlapped A pointer to an OVERLAPPED structure is required if
* the hFile parameter was opened with FILE_FLAG_OVERLAPPED, otherwise this
* parameter can be NULL.
* @return If the function succeeds, the return value is nonzero (TRUE). If
* the function fails, or is completing asynchronously, the return value is
* zero (FALSE). To get extended error information, call the GetLastError
* function.
*/
boolean WriteFile(HANDLE hFile, byte[] lpBuffer, int nNumberOfBytesToWrite,
IntByReference lpNumberOfBytesWritten,
WinBase.OVERLAPPED lpOverlapped);
boolean ReadFile(HANDLE hFile, byte[] lpBuffer, int nNumberOfBytesToRead, IntByReference lpNumberOfBytesRead, WinBase.OVERLAPPED lpOverlapped);
//
// Define the NamedPipe definitions
//
//
// Define the dwOpenMode values for CreateNamedPipe
//
public static final int PIPE_ACCESS_INBOUND = 0x00000001;
public static final int PIPE_ACCESS_OUTBOUND = 0x00000002;
public static final int PIPE_ACCESS_DUPLEX = 0x00000003;
//
// Define the Named Pipe End flags for GetNamedPipeInfo
//
public static final int PIPE_CLIENT_END = 0x00000000;
public static final int PIPE_SERVER_END = 0x00000001;
//
// Define the dwPipeMode values for CreateNamedPipe
//
public static final int PIPE_WAIT = 0x00000000;
public static final int PIPE_NOWAIT = 0x00000001;
public static final int PIPE_READMODE_BYTE = 0x00000000;
public static final int PIPE_READMODE_MESSAGE = 0x00000002;
public static final int PIPE_TYPE_BYTE = 0x00000000;
public static final int PIPE_TYPE_MESSAGE = 0x00000004;
public static final int PIPE_ACCEPT_REMOTE_CLIENTS = 0x00000000;
public static final int PIPE_REJECT_REMOTE_CLIENTS = 0x00000008;
//
// Define the well known values for CreateNamedPipe nMaxInstances
//
public static final int PIPE_UNLIMITED_INSTANCES = 255;
//
// Define the values for process priority
//
public static final int ABOVE_NORMAL_PRIORITY_CLASS = 0x00008000;
public static final int BELOW_NORMAL_PRIORITY_CLASS = 0x00004000;
public static final int HIGH_PRIORITY_CLASS = 0x00000080;
public static final int IDLE_PRIORITY_CLASS = 0x00000040;
public static final int NORMAL_PRIORITY_CLASS = 0x00000020;
public static final int PROCESS_MODE_BACKGROUND_BEGIN = 0x00100000;
public static final int PROCESS_MODE_BACKGROUND_END = 0x00200000;
public static final int REALTIME_PRIORITY_CLASS = 0x00000100;
// __out
// HANDLE
// WINAPI
// CreateNamedPipe(
// __in LPCWSTR lpName,
// __in DWORD dwOpenMode,
// __in DWORD dwPipeMode,
// __in DWORD nMaxInstances,
// __in DWORD nOutBufferSize,
// __in DWORD nInBufferSize,
// __in DWORD nDefaultTimeOut,
// __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes
// );
HANDLE CreateNamedPipe(String lpName, int dwOpenMode, int dwPipeMode, int nMaxInstances, int nOutBufferSize, int nInBufferSize, int nDefaultTimeOut,
WinBase.SECURITY_ATTRIBUTES lpSecurityAttributes);
// WINBASEAPI
// BOOL
// WINAPI
// ConnectNamedPipe(
// __in HANDLE hNamedPipe,
// __inout_opt LPOVERLAPPED lpOverlapped
// );
boolean ConnectNamedPipe(HANDLE hNamedPipe, WinBase.OVERLAPPED lpOverlapped);
// WINBASEAPI
// BOOL
// WINAPI
// DisconnectNamedPipe(
// __in HANDLE hNamedPipe
// );
boolean DisconnectNamedPipe(HANDLE hNamedPipe);
/**
* Waits until the specified object is in the signaled state or the time-out
* interval elapses. To enter an alertable wait state, use the
* WaitForSingleObjectEx function. To wait for multiple objects, use the
* WaitForMultipleObjects.
*
* @param hHandle A handle to the object. For a list of the object types
* whose handles can be specified, see the following Remarks section. If
* this handle is closed while the wait is still pending, the function's
* behavior is undefined. The handle must have the SYNCHRONIZE access right.
* For more information, see Standard Access Rights.
* @param dwMilliseconds The time-out interval, in milliseconds. If a
* nonzero value is specified, the function waits until the object is
* signaled or the interval elapses. If dwMilliseconds is zero, the function
* does not enter a wait state if the object is not signaled; it always
* returns immediately. If dwMilliseconds is INFINITE, the function will
* return only when the object is signaled.
* @return If the function succeeds, the return value indicates the event
* that caused the function to return.
*/
int WaitForSingleObject(HANDLE hHandle, int dwMilliseconds);
/**
* This function returns a pseudohandle for the current process.
*
* @return The return value is a pseudohandle to the current process.
*/
HANDLE GetCurrentProcess();
int SetProcessAffinityMask(HANDLE hProcess, int mask);
int SetPriorityClass(HANDLE hProcess, int dwPriorityClass);
/**
* This function returns a handle to an existing process object.
*
* @param fdwAccess Not supported; set to zero.
* @param fInherit Not supported; set to FALSE.
* @param IDProcess Specifies the process identifier of the process to open.
* @return An open handle to the specified process indicates success. NULL
* indicates failure. To get extended error information, call GetLastError.
*/
HANDLE OpenProcess(int fdwAccess, boolean fInherit, DWORD IDProcess);
/**
* The GetSystemInfo function returns information about the current system.
*
* @param lpSystemInfo Pointer to a SYSTEM_INFO structure that receives the
* information.
*/
void GetSystemInfo(SYSTEM_INFO lpSystemInfo);
public static final int PROCESS_VM_READ = 0x0010;
public static final int PROCESS_VM_WRITE = 0x0020;
public static final int PROCESS_QUERY_INFORMATION = 0x0400;
public static final int PROCESS_VM_OPERATION = 0x0008;
SIZE_T VirtualQueryEx(HANDLE hProcess, Pointer lpAddress, MEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength);
/**
* The GetLastError function retrieves the calling thread's last-error code
* value. The last-error code is maintained on a per-thread basis. Multiple
* threads do not overwrite each other's last-error code.
*
* @return The return value is the calling thread's last-error code value.
*/
int GetLastError();
public static int MEM_COMMIT = 0x1000;
public static int MEM_FREE = 0x10000;
public static int MEM_RESERVE = 0x2000;
public static int MEM_IMAGE = 0x1000000;
public static int MEM_MAPPED = 0x40000;
public static int MEM_PRIVATE = 0x20000;
boolean ReadProcessMemory(HANDLE hProcess, Pointer inBaseAddress, Pointer outputBuffer, NativeLong nSize, NativeLongByReference outNumberOfBytesRead);
/**
* Takes a snapshot of the specified processes, as well as the heaps,
* modules, and threads used by these processes.
*
* @param dwFlags The portions of the system to be included in the snapshot.
* @param th32ProcessID The process identifier of the process to be included
* in the snapshot. This parameter can be zero to indicate the current
* process. This parameter is used when the TH32CS_SNAPHEAPLIST,
* TH32CS_SNAPMODULE, TH32CS_SNAPMODULE32, or TH32CS_SNAPALL value is
* specified. Otherwise, it is ignored and all processes are included in the
* snapshot.
* <p>
* If the specified process is the Idle process or one of the CSRSS
* processes, this function fails and the last error code is
* ERROR_ACCESS_DENIED because their access restrictions prevent user-level
* code from opening them.
* <p>
* If the specified process is a 64-bit process and the caller is a 32-bit
* process, this function fails and the last error code is
* ERROR_PARTIAL_COPY (299).
* @return If the function succeeds, it returns an open handle to the
* specified snapshot.
* <p>
* If the function fails, it returns INVALID_HANDLE_VALUE. To get extended
* error information, call GetLastError. Possible error codes include
* ERROR_BAD_LENGTH.
*/
HANDLE CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID);
/**
* Retrieves information about the first process encountered in a system
* snapshot.
*
* @param hSnapshot A handle to the snapshot returned from a previous call
* to the CreateToolhelp32Snapshot function.
* @param lppe A pointer to a PROCESSENTRY32 structure. It contains process
* information such as the name of the executable file, the process
* identifier, and the process identifier of the parent process.
* @return Returns TRUE if the first entry of the process list has been
* copied to the buffer or FALSE otherwise. The ERROR_NO_MORE_FILES error
* value is returned by the GetLastError function if no processes exist or
* the snapshot does not contain process information.
*/
boolean Process32First(HANDLE hSnapshot, PROCESSENTRY32 lppe);
/**
* Retrieves information about the next process recorded in a system
* snapshot.
*
* @param hSnapshot A handle to the snapshot returned from a previous call
* to the CreateToolhelp32Snapshot function.
* @param lppe A pointer to a PROCESSENTRY32 structure.
* @return Returns TRUE if the next entry of the process list has been
* copied to the buffer or FALSE otherwise. The ERROR_NO_MORE_FILES error
* value is returned by the GetLastError function if no processes exist or
* the snapshot does not contain process information.
*/
boolean Process32Next(HANDLE hSnapshot, PROCESSENTRY32 lppe);
public static int TH32CS_SNAPPROCESS = 0x00000002;
//Needed for some Windows 7 Versions
//boolean EnumProcesses(int[] ProcessIDsOut, int size, int[] BytesReturned);
int GetProcessImageFileNameW(HANDLE Process, char[] outputname, int length);
DWORD QueryDosDevice(String lpDeviceName, char[] lpTargetPath, int length);
boolean VirtualProtectEx(HANDLE hProcess, LPVOID lpAddress, SIZE_T dwSize, int flNewProtect, IntByReference lpflOldProtect);
public static final int LOCALE_SISO3166CTRYNAME = 90;
public static final int LOCALE_SISO639LANGNAME = 89;
int GetLocaleInfo(int Locale, int LCType, char[] lpLCData, int cchData);
public HANDLE CreateMutex(WinBase.SECURITY_ATTRIBUTES sa, boolean initialOwner, String name);
HANDLE CreateFile(String lpFileName, int dwDesiredAccess, int dwShareMode,
WinBase.SECURITY_ATTRIBUTES lpSecurityAttributes, int dwCreationDisposition,
int dwFlagsAndAttributes, HANDLE hTemplateFile);
}
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.BaseTSD.SIZE_T;
import java.util.Arrays;
import java.util.List;
/**
* @author JPEXS
*/
public class MEMORY_BASIC_INFORMATION extends Structure {
public Pointer baseAddress;
public Pointer allocationBase;
public NativeLong allocationProtect;
public SIZE_T regionSize;
public NativeLong state;
public NativeLong protect;
public NativeLong type;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"baseAddress", "allocationBase", "allocationProtect",
"regionSize", "state", "protect", "type"});
}
}
@@ -0,0 +1,107 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import java.util.Arrays;
import java.util.List;
public class PROCESSENTRY32 extends Structure {
public static class ByReference extends PROCESSENTRY32 implements Structure.ByReference {
public ByReference() {
}
public ByReference(Pointer memory) {
super(memory);
}
}
public PROCESSENTRY32() {
dwSize = new WinDef.DWORD(size());
}
public PROCESSENTRY32(Pointer memory) {
super(memory);
read();
}
/**
* The size of the structure, in bytes. Before calling the Process32First
* function, set this member to sizeof(PROCESSENTRY32). If you do not
* initialize dwSize, Process32First fails.
*/
public WinDef.DWORD dwSize;
/**
* This member is no longer used and is always set to zero.
*/
public WinDef.DWORD cntUsage;
/**
* The process identifier.
*/
public WinNT.DWORD th32ProcessID;
/**
* This member is no longer used and is always set to zero.
*/
public BaseTSD.ULONG_PTR th32DefaultHeapID;
/**
* This member is no longer used and is always set to zero.
*/
public WinDef.DWORD th32ModuleID;
/**
* The number of execution threads started by the process.
*/
public WinDef.DWORD cntThreads;
/**
* The identifier of the process that created this process (its parent
* process).
*/
public WinDef.DWORD th32ParentProcessID;
/**
* The base priority of any threads created by this process.
*/
public WinDef.LONG pcPriClassBase;
/**
* This member is no longer used, and is always set to zero.
*/
public WinDef.DWORD dwFlags;
/**
* The name of the executable file for the process. To retrieve the full
* path to the executable file, call the Module32First function and check
* the szExePath member of the MODULEENTRY32 structure that is returned.
* However, if the calling process is a 32-bit process, you must call the
* QueryFullProcessImageName function to retrieve the full path of the
* executable file for a 64-bit process.
*/
public char[] szExeFile = new char[WinDef.MAX_PATH];
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"dwSize", "cntUsage", "th32ProcessID", "th32DefaultHeapID", "th32ModuleID", "cntThreads", "th32ParentProcessID", "pcPriClassBase", "dwFlags", "szExeFile"});
}
}
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.Native;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.win32.StdCallLibrary;
/**
* @author JPEXS
*/
public interface Psapi extends StdCallLibrary {
Psapi INSTANCE = (Psapi) Native.loadLibrary("Psapi", Psapi.class);
//For some Windows 7 Versions and older down to XP
//boolean EnumProcesses(int[] ProcessIDsOut, int size, int[] BytesReturned);
int GetProcessImageFileNameW(HANDLE Process, char[] outputname, int length);
}
@@ -0,0 +1,66 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import com.sun.jna.WString;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.HINSTANCE;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.HWND;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT.HANDLE;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinReg.HKEY;
import java.util.Arrays;
import java.util.List;
public class SHELLEXECUTEINFO extends Structure {
public int cbSize = size();
public int fMask;
public HWND hwnd;
public WString lpVerb;
public WString lpFile;
public WString lpParameters;
public WString lpDirectory;
public int nShow;
public HINSTANCE hInstApp;
public Pointer lpIDList;
public WString lpClass;
public HKEY hKeyClass;
public int dwHotKey;
public HANDLE hMonitor;
public HANDLE hProcess;
@Override
protected List<String> getFieldOrder() {
return Arrays.asList(new String[]{"cbSize", "fMask", "hwnd", "lpVerb", "lpFile", "lpParameters", "lpDirectory", "nShow", "hInstApp", "lpIDList",
"lpClass", "hKeyClass", "dwHotKey", "hMonitor", "hProcess"});
}
}
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.DWORD;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.HICON;
import java.util.Arrays;
import java.util.List;
/**
* @author JPEXS
*/
public class SHFILEINFO extends Structure {
public HICON hIcon;
public int iIcon;
public DWORD dwAttributes;
public char[] szDisplayName = new char[260];
public char[] szTypeName = new char[80];
@Override
protected List getFieldOrder() {
return Arrays.asList("hIcon", "iIcon", "dwAttributes", "szDisplayName", "szTypeName");
}
}
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.Native;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.BaseTSD.DWORD_PTR;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.UINT;
import com.sun.jna.ptr.PointerByReference;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
/**
* Shell32.dll Interface.
*/
public interface Shell32 extends StdCallLibrary {
Shell32 INSTANCE = (Shell32) Native.loadLibrary("shell32", Shell32.class,
W32APIOptions.UNICODE_OPTIONS);
/**
* @param lpExecInfo lpExecInfo
* @return true if successful. Otherwise false.
*/
boolean ShellExecuteEx(SHELLEXECUTEINFO lpExecInfo);
UINT ExtractIconEx(String lpszFile, int nIconIndex, PointerByReference phiconLarge, PointerByReference phiconSmall, UINT nIcons);
DWORD_PTR SHGetFileInfo(String pszPath, int dwFileAttributes, SHFILEINFO psfi, int cbFileInfo, int uFlags);
public static final int SHGFI_ICON = 0x000000100;
public static final int SHGFI_SMALLICON = 0x000000001;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,186 @@
/*
* Copyright (C) 2010-2024 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.platform.win32.WinError;
import com.sun.jna.platform.win32.WinNT.HRESULT;
// TODO: Auto-generated Javadoc
/**
* Utility class for some common error functions.
*/
public abstract class W32Errors implements WinError {
/**
* Generic test for success on any status value (non-negative numbers
* indicate success).
*
* @param hr the hr
* @return true, if successful
*/
public static final boolean SUCCEEDED(int hr) {
return hr >= 0;
}
/**
* and the inverse.
*
* @param hr the hr
* @return true, if successful
*/
public static final boolean FAILED(int hr) {
return hr < 0;
}
/**
* Succeeded.
*
* @param hr the hr
* @return true, if successful
*/
public static final boolean SUCCEEDED(HRESULT hr) {
if (hr != null) {
return SUCCEEDED(hr.intValue());
} else {
return false;
}
}
/**
* Failed.
*
* @param hr the hr
* @return true, if successful
*/
public static final boolean FAILED(HRESULT hr) {
if (hr != null) {
return FAILED(hr.intValue());
} else {
return false;
}
}
/**
* Extract error code from HRESULT.
*
* @param hr the hr
* @return the int
*/
public static final int HRESULT_CODE(int hr) {
return hr & 0xFFFF;
}
/**
* Extract error code from SCODE.
*
* @param sc the sc
* @return the int
*/
public static final int SCODE_CODE(int sc) {
return sc & 0xFFFF;
}
/**
* Return the facility.
*
* @param hr the hr
* @return the int
*/
public static final int HRESULT_FACILITY(int hr) {
return (hr >>= 16) & 0x1fff;
}
/**
* Scode facility.
*
* @param sc the sc
* @return the int
*/
public static final int SCODE_FACILITY(short sc) {
return (sc >>= 16) & 0x1fff;
}
/**
* Return the severity.
*
* @param hr the hr
* @return the short
*/
public static short HRESULT_SEVERITY(int hr) {
return (short) ((hr >>= 31) & 0x1);
}
/**
* Scode severity.
*
* @param sc the sc
* @return the short
*/
public static short SCODE_SEVERITY(short sc) {
return (short) ((sc >>= 31) & 0x1);
}
/**
* Create an HRESULT value from component pieces.
*
* @param sev the sev
* @param fac the fac
* @param code the code
* @return the int
*/
public static int MAKE_HRESULT(short sev, short fac, short code) {
return ((sev << 31) | (fac << 16) | code);
}
/**
* Make scode.
*
* @param sev the sev
* @param fac the fac
* @param code the code
* @return the int
*/
public static final int MAKE_SCODE(short sev, short fac, short code) {
return ((sev << 31) | (fac << 16) | code);
}
/**
* Map a WIN32 error value into a HRESULT Note: This assumes that WIN32
* errors fall in the range -32k to=32k.
*
* @param x original w32 error code
* @return the converted value
*/
public static final HRESULT HRESULT_FROM_WIN32(int x) {
int f = FACILITY_WIN32;
return new HRESULT(x <= 0 ? x : ((x) & 0x0000FFFF) | (f <<= 16)
| 0x80000000);
}
/**
* FACILITY_USERMODE_FILTER_MANAGER
* <p>
* Translation macro for converting: NTSTATUS --&gt; HRESULT.
*
* @param x the x
* @return the int
*/
public static final int FILTER_HRESULT_FROM_FLT_NTSTATUS(int x) {
int f = FACILITY_USERMODE_FILTER_MANAGER;
return (((x) & 0x8000FFFF) | (f <<= 16));
}
}
@@ -0,0 +1,75 @@
/*
* Copyright (C) 2010-2024 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
/**
* @author JPEXS
*/
/* Copyright (c) 2010 Daniel Doubrovkine, All Rights Reserved
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
import com.sun.jna.platform.win32.WinNT.HRESULT;
/**
* Win32 exception.
*
* @author dblock[at]dblock[dot]org
*/
public class Win32Exception extends RuntimeException {
private static final long serialVersionUID = 1L;
private HRESULT _hr;
/**
* Returns the error code of the error.
*
* @return Error code.
*/
public HRESULT getHR() {
return _hr;
}
/**
* New Win32 exception from HRESULT.
*
* @param hr HRESULT
*/
public Win32Exception(HRESULT hr) {
//super(Kernel32Util.formatMessageFromHR(hr));
_hr = hr;
}
/**
* New Win32 exception from an error code, usually obtained from
* GetLastError.
*
* @param code Error code.
*/
public Win32Exception(int code) {
this(W32Errors.HRESULT_FROM_WIN32(code));
}
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,179 @@
/*
* Copyright (C) 2010-2024 JPEXS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
/**
* @author JPEXS
*/
import com.sun.jna.Structure;
import com.sun.jna.platform.win32.WinDef.RECT;
import com.sun.jna.win32.StdCallLibrary;
import java.util.Arrays;
import java.util.List;
/**
* Ported from WinGDI.h. Microsoft Windows SDK 6.0A.
*
* @author dblock[at]dblock.org
*/
public interface WinGDI extends StdCallLibrary {
public int RDH_RECTANGLES = 1;
public class RGNDATAHEADER extends Structure {
public int dwSize = size();
public int iType = RDH_RECTANGLES; // required
public int nCount;
public int nRgnSize;
public RECT rcBound;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"dwSize", "iType", "nCount", "nRgnSize", "rcBound"});
}
}
public class RGNDATA extends Structure {
public RGNDATAHEADER rdh;
public byte[] Buffer;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"rdh", "Buffer"});
}
public RGNDATA() {
this(1);
}
public RGNDATA(int bufferSize) {
Buffer = new byte[bufferSize];
allocateMemory();
}
}
public int RGN_AND = 1;
public int RGN_OR = 2;
public int RGN_XOR = 3;
public int RGN_DIFF = 4;
public int RGN_COPY = 5;
public int ERROR = 0;
public int NULLREGION = 1;
public int SIMPLEREGION = 2;
public int COMPLEXREGION = 3;
public int ALTERNATE = 1;
public int WINDING = 2;
public int BI_RGB = 0;
public int BI_RLE8 = 1;
public int BI_RLE4 = 2;
public int BI_BITFIELDS = 3;
public int BI_JPEG = 4;
public int BI_PNG = 5;
public class BITMAPINFOHEADER extends Structure {
public int biSize = size();
public int biWidth;
public int biHeight;
public short biPlanes;
public short biBitCount;
public int biCompression;
public int biSizeImage;
public int biXPelsPerMeter;
public int biYPelsPerMeter;
public int biClrUsed;
public int biClrImportant;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"biSize", "biWidth", "biHeight", "biPlanes", "biBitCount", "biCompression", "biSizeImage", "biXPelsPerMeter", "biYPelsPerMeter", "biClrUsed", "biClrImportant"});
}
}
public class RGBQUAD extends Structure {
public byte rgbBlue;
public byte rgbGreen;
public byte rgbRed;
public byte rgbReserved = 0;
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"rgbBlue", "rgbGreen", "rgbRed", "rgbReserved"});
}
}
public class BITMAPINFO extends Structure {
public BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER();
public RGBQUAD[] bmiColors = new RGBQUAD[1];
@Override
protected List getFieldOrder() {
return Arrays.asList(new String[]{"bmiHeader", "bmiColors"});
}
public BITMAPINFO() {
this(1);
}
public BITMAPINFO(int size) {
bmiColors = new RGBQUAD[size];
}
}
public int DIB_RGB_COLORS = 0;
public int DIB_PAL_COLORS = 1;
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,94 @@
/*
* Copyright (C) 2010-2024 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.ptr.ByReference;
import com.sun.jna.win32.StdCallLibrary;
/**
* This module contains the function prototypes and constant, type and structure
* definitions for the Windows 32-Bit Registry API. Ported from WinReg.h
* Microsoft Windows SDK 6.0A.
*
* @author dblock[at]dblock.org
*/
public interface WinReg extends StdCallLibrary {
public static class HKEY extends HANDLE {
public HKEY() {
}
public HKEY(Pointer p) {
super(p);
}
public HKEY(int value) {
super(new Pointer(value));
}
}
public static final class HKEYByReference extends ByReference {
public HKEYByReference() {
this(null);
}
public HKEYByReference(HKEY h) {
super(Native.POINTER_SIZE);
setValue(h);
}
public void setValue(HKEY h) {
getPointer().setPointer(0, h != null ? h.getPointer() : null);
}
public HKEY getValue() {
Pointer p = getPointer().getPointer(0);
if (p == null) {
return null;
}
if (WinBase.INVALID_HANDLE_VALUE.getPointer().equals(p)) {
return (HKEY) WinBase.INVALID_HANDLE_VALUE;
}
HKEY h = new HKEY();
h.setPointer(p);
return h;
}
}
HKEY HKEY_CLASSES_ROOT = new HKEY(0x80000000);
HKEY HKEY_CURRENT_USER = new HKEY(0x80000001);
HKEY HKEY_LOCAL_MACHINE = new HKEY(0x80000002);
HKEY HKEY_USERS = new HKEY(0x80000003);
HKEY HKEY_PERFORMANCE_DATA = new HKEY(0x80000004);
HKEY HKEY_PERFORMANCE_TEXT = new HKEY(0x80000050);
HKEY HKEY_PERFORMANCE_NLSTEXT = new HKEY(0x80000060);
HKEY HKEY_CURRENT_CONFIG = new HKEY(0x80000005);
HKEY HKEY_DYN_DATA = new HKEY(0x80000006);
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,4 @@
/**
* Windows API functions and structures accessible via JNA.
*/
package com.jpexs.decompiler.flash.gui.jna.platform.win32;
@@ -19,10 +19,10 @@ package com.jpexs.decompiler.flash.gui.pipes;
import com.jpexs.decompiler.flash.ApplicationInfo;
import com.jpexs.decompiler.flash.gui.Main;
import com.jpexs.decompiler.flash.gui.View;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Kernel32;
import com.sun.jna.Platform;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.WinError;
import com.sun.jna.platform.win32.WinNT;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT;
import java.awt.Window;
import java.io.IOException;
import java.io.ObjectInputStream;
@@ -16,9 +16,9 @@
*/
package com.jpexs.decompiler.flash.gui.pipes;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Kernel32;
import com.sun.jna.Platform;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.ptr.IntByReference;
import java.io.IOException;
import java.io.InputStream;
@@ -16,9 +16,9 @@
*/
package com.jpexs.decompiler.flash.gui.pipes;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Kernel32;
import com.sun.jna.Platform;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.ptr.IntByReference;
import java.io.IOException;
import java.io.OutputStream;
@@ -18,7 +18,7 @@ package com.jpexs.process.win32;
import com.jpexs.helpers.ProgressListener;
import com.jpexs.process.Process;
import com.sun.jna.platform.win32.WinDef.DWORD;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef.DWORD;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.InputStream;
@@ -21,22 +21,22 @@ import com.jpexs.process.ProcessTools;
import com.sun.jna.Memory;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.Advapi32;
import com.sun.jna.platform.win32.BITMAP;
import com.sun.jna.platform.win32.BaseTSD;
import com.sun.jna.platform.win32.Gdi32;
import com.sun.jna.platform.win32.ICONINFO;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.MEMORY_BASIC_INFORMATION;
import com.sun.jna.platform.win32.PROCESSENTRY32;
import com.sun.jna.platform.win32.Psapi;
import com.sun.jna.platform.win32.SHFILEINFO;
import com.sun.jna.platform.win32.Shell32;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinBase;
import com.sun.jna.platform.win32.WinDef;
import com.sun.jna.platform.win32.WinNT;
import com.sun.jna.platform.win32.WinNT.HANDLE;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Advapi32;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.BITMAP;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.BaseTSD;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Gdi32;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.ICONINFO;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Kernel32;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.MEMORY_BASIC_INFORMATION;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.PROCESSENTRY32;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Psapi;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.SHFILEINFO;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.Shell32;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.User32;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinBase;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinDef;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT;
import com.jpexs.decompiler.flash.gui.jna.platform.win32.WinNT.HANDLE;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.NativeLongByReference;
import com.sun.jna.ptr.PointerByReference;