public class Kernel32 extends WinFunctionCache
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
expandEnvironmentStrings(java.lang.String source) |
static java.lang.String |
getCurrentDirectory() |
static int |
getCurrentProcessId()
Returns the identifier of the current process.
|
static int |
getCurrentThreadId()
Returns the identifier of the current thread.
|
static Kernel32 |
getInstance() |
static Handle[] |
getProcessHeaps() |
static long |
getProcessId(Process process) |
static java.lang.String |
getSystemDirectory()
Returns the absolute path to the Windows system directory.
|
static java.lang.String |
getWindowsDirectory()
Returns the absolute path to the Windows directory.
|
static int |
globalAddAtom(java.lang.String value)
Creates a globally unique identifier that corresponds to the specified string.
|
static boolean |
heapLock(Handle heap) |
static boolean |
heapUnlock(Handle heap) |
static boolean |
heapWalk(Handle heap,
ProcessHeapEntry heapEntry) |
boolean |
isUnicode()
Says if ANSI or Unicode functions should be used.
|
static int |
lstrlen(com.jniwrapper.Pointer.Void lpStr)
Returns the length of a zero-terminated string.
|
static int |
mulDiv(int number,
int numerator,
int denominator)
Multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value.
|
static int |
multiByteToWideChar(int codePage,
int dwFlags,
com.jniwrapper.Pointer.Void srcStr,
int srcLen,
com.jniwrapper.Pointer.Void destStr,
int destLen)
Translates a multibyte string to a Unicode string.
|
static long |
processIdToSessionId(com.jniwrapper.UInt32 processId) |
static void |
setCurrentDirectory(java.lang.String directory) |
void |
setUnicode(boolean unicode)
Instructs the cache to use Unicode or ANSI functions and parameter types.
|
protected void |
setupEncoding() |
protected void setupEncoding()
setupEncoding
in class WinFunctionCache
public boolean isUnicode()
Detects the platform if this wasn't done before, or property wasn't
explicitly modified directly via setUnicode()
. If the
property wasn't set explicitly, assumes that Unicode should be used if
the underlying OS is NT-based.
NOTE: Since the Unicode support detection is based on the platform version
detection, which itself requires Kernel32
instance, the
detection cannot be performed in the constructor to prevent recursion,
and should be delayed until actually queried.
isUnicode
in class WinFunctionCache
public void setUnicode(boolean unicode)
WinFunctionCache
setUnicode
in class WinFunctionCache
unicode
- if true, Unicode names and types will be used; otherwise
ANSI.public static Kernel32 getInstance()
public static int multiByteToWideChar(int codePage, int dwFlags, com.jniwrapper.Pointer.Void srcStr, int srcLen, com.jniwrapper.Pointer.Void destStr, int destLen)
codePage
- code page.dwFlags
- optionssrcStr
- address multibyte string.srcLen
- the length of multibyte string.destStr
- address for the Unicode string.destLen
- the number of bytes allocated for the Unicode string.public static int lstrlen(com.jniwrapper.Pointer.Void lpStr)
lpStr
- the address of a zero-terminated string.public static int mulDiv(int number, int numerator, int denominator)
number
- Multiplicand.numerator
- Multiplier.denominator
- Number by which the result of the multiplication (nNumber * nNumerator)
is to be dividedpublic static int getCurrentThreadId()
public static int getCurrentProcessId()
public static java.lang.String getWindowsDirectory()
public static java.lang.String getSystemDirectory()
public static int globalAddAtom(java.lang.String value)
value
- a string value not longer than 255 bytes.public static java.lang.String getCurrentDirectory()
public static void setCurrentDirectory(java.lang.String directory)
public static java.lang.String expandEnvironmentStrings(java.lang.String source)
public static long getProcessId(Process process)
public static Handle[] getProcessHeaps()
public static long processIdToSessionId(com.jniwrapper.UInt32 processId)
public static boolean heapLock(Handle heap)
public static boolean heapUnlock(Handle heap)
public static boolean heapWalk(Handle heap, ProcessHeapEntry heapEntry)