Top Description Fields Constructors Methods
org.lwjgl.system.windows

public Class WinBase

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.system.*

Native bindings to WinBase.h.

Field Summary

Modifier and TypeField and Description
public static final int
FALSE

BOOL return values.

public static final int
TRUE

BOOL return values.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static boolean
FreeLibrary(long
a handle to the loaded library module
handle
)

Frees the loaded dynamic-link library (DLL) module and, if necessary, decrements its reference count.

public static native int
GetLastError()

Retrieves the calling thread's last-error code value.

public static native int
getLastError()

Retrieves the calling thread's last-error code value.

public static int

Returns:

if the function succeeds, the return value is the length of the string that is copied to the buffer, in characters, not including the terminating null character.

If the buffer is too small to hold the module name, the string is truncated to nSize characters including the terminating null character, the function returns nSize, and the function sets the last error to ERROR_INSUFFICIENT_BUFFER.

If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.

GetModuleFileName
(long
a handle to the loaded module whose path is being requested.

If this parameter is NULL, GetModuleFileName retrieves the path of the executable file of the current process.

hModule
,
ByteBuffer
a pointer to a buffer that receives the fully qualified path of the module.

If the length of the path is less than the size that the nSize parameter specifies, the function succeeds and the path is returned as a null-terminated string.

If the length of the path exceeds the size that the nSize parameter specifies, the function succeeds and the string is truncated to nSize characters including the terminating null character.

The string returned will use the same format that was specified when the module was loaded. Therefore, the path can be a long or short file name, and can use the prefix "\?".

lpFilename
)

Retrieves the fully qualified path for the file that contains the specified module.

public static String

Returns:

if the function succeeds, the return value is the length of the string that is copied to the buffer, in characters, not including the terminating null character.

If the buffer is too small to hold the module name, the string is truncated to nSize characters including the terminating null character, the function returns nSize, and the function sets the last error to ERROR_INSUFFICIENT_BUFFER.

If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.

GetModuleFileName
(long
a handle to the loaded module whose path is being requested.

If this parameter is NULL, GetModuleFileName retrieves the path of the executable file of the current process.

hModule
,
int
the size of the lpFilename buffer, in TCHARs.
nSize
)

Retrieves the fully qualified path for the file that contains the specified module.

public static long
GetModuleHandle(ByteBuffer
the name of the loaded module (either a .dll or .exe file). If the file name extension is omitted, the default library extension .dll is appended. The file name string can include a trailing point character (.) to indicate that the module name has no extension. The string does not have to specify a path. When specifying a path, be sure to use backslashes (\), not forward slashes (/). The name is compared (case independently) to the names of modules currently mapped into the address space of the calling process.

If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file).

moduleName
)

Retrieves a module handle for the specified module.

public static long
GetModuleHandle(CharSequence
the name of the loaded module (either a .dll or .exe file). If the file name extension is omitted, the default library extension .dll is appended. The file name string can include a trailing point character (.) to indicate that the module name has no extension. The string does not have to specify a path. When specifying a path, be sure to use backslashes (\), not forward slashes (/). The name is compared (case independently) to the names of modules currently mapped into the address space of the calling process.

If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file).

moduleName
)

Retrieves a module handle for the specified module.

public static long
GetProcAddress(long
a handle to the DLL module that contains the function or variable
handle
,
ByteBuffer
the function or variable name, or the function's ordinal value. If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero.
name
)

Retrieves the address of an exported function or variable from the specified dynamic-link library (DLL).

public static long
GetProcAddress(long
a handle to the DLL module that contains the function or variable
handle
,
CharSequence
the function or variable name, or the function's ordinal value. If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero.
name
)

Retrieves the address of an exported function or variable from the specified dynamic-link library (DLL).

public static long
LoadLibrary(ByteBuffer
the name of the module. This can be either a library module (a .dll file) or an executable module (an .exe file). The name specified is the file name of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.def) file.

If the string specifies a full path, the function searches only that path for the module.

If the string specifies a relative path or a module name without a path, the function uses a standard search strategy to find the module.

If the function cannot find the module, the function fails. When specifying a path, be sure to use backslashes (\), not forward slashes (/).

If the string specifies a module name without a path and the file name extension is omitted, the function appends the default library extension .dll to the module name. To prevent the function from appending .dll to the module name, include a trailing point character (.) in the module name string.

name
)

Loads the specified module into the address space of the calling process.

public static long
LoadLibrary(CharSequence
the name of the module. This can be either a library module (a .dll file) or an executable module (an .exe file). The name specified is the file name of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.def) file.

If the string specifies a full path, the function searches only that path for the module.

If the string specifies a relative path or a module name without a path, the function uses a standard search strategy to find the module.

If the function cannot find the module, the function fails. When specifying a path, be sure to use backslashes (\), not forward slashes (/).

If the string specifies a module name without a path and the file name extension is omitted, the function appends the default library extension .dll to the module name. To prevent the function from appending .dll to the module name, include a trailing point character (.) in the module name string.

name
)

Loads the specified module into the address space of the calling process.

public static long

Returns:

if the function succeeds, the return value is NULL.

If the function fails, the return value is equal to a handle to the local memory object. To get extended error information, call GetLastError.

LocalFree
(long
a handle to the local memory object
hMem
)

Frees the specified local memory object and invalidates its handle.

public static native int
nFreeLibrary(long handle)

Unsafe version of: FreeLibrary

public static native int
nGetModuleFileName(long hModule, long lpFilename, int
the size of the lpFilename buffer, in TCHARs.
nSize
)

Unsafe version of: GetModuleFileName

public static native long
nGetModuleHandle(long moduleName)

Unsafe version of: GetModuleHandle

public static native long
nGetProcAddress(long handle, long name)

Unsafe version of: GetProcAddress

public static native long
nLoadLibrary(long name)

Unsafe version of: LoadLibrary

public static native long
nLocalFree(long hMem)

Unsafe version of: LocalFree

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FALSEback to summary
public static final int FALSE

BOOL return values.

TRUEback to summary
public static final int TRUE

BOOL return values.

Constructor Detail

WinBaseback to summary
protected WinBase()

Method Detail

FreeLibraryback to summary
public static boolean FreeLibrary(long handle)

Frees the loaded dynamic-link library (DLL) module and, if necessary, decrements its reference count. When the reference count reaches zero, the module is unloaded from the address space of the calling process and the handle is no longer valid.

Parameters
handle:long

a handle to the loaded library module

Annotations
@NativeType:BOOL
GetLastErrorback to summary
public static native int GetLastError()

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.

LWJGL note: This function cannot be used after another JNI call to a Windows function, because the last error resets before that call returns. For this reason, LWJGL stores the last error in thread-local storage, you can use getLastError to access it.

Annotations
@NativeType:DWORD
getLastErrorback to summary
public static native int getLastError()

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.

LWJGL note: This method has a meaningful value only after another LWJGL JNI call. It does not call GetLastError() from WinBase.h, it returns the thread-local error code stored by a previous JNI call.

Annotations
@NativeType:DWORD
GetModuleFileNameback to summary
public static int GetModuleFileName(long hModule, ByteBuffer lpFilename)

Retrieves the fully qualified path for the file that contains the specified module. The module must have been loaded by the current process.

Parameters
hModule:long

a handle to the loaded module whose path is being requested.

If this parameter is NULL, GetModuleFileName retrieves the path of the executable file of the current process.

lpFilename:ByteBuffer

a pointer to a buffer that receives the fully qualified path of the module.

If the length of the path is less than the size that the nSize parameter specifies, the function succeeds and the path is returned as a null-terminated string.

If the length of the path exceeds the size that the nSize parameter specifies, the function succeeds and the string is truncated to nSize characters including the terminating null character.

The string returned will use the same format that was specified when the module was loaded. Therefore, the path can be a long or short file name, and can use the prefix "\?".

Returns:int

if the function succeeds, the return value is the length of the string that is copied to the buffer, in characters, not including the terminating null character.

If the buffer is too small to hold the module name, the string is truncated to nSize characters including the terminating null character, the function returns nSize, and the function sets the last error to ERROR_INSUFFICIENT_BUFFER.

If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.

Annotations
@NativeType:DWORD
GetModuleFileNameback to summary
public static String GetModuleFileName(long hModule, int nSize)

Retrieves the fully qualified path for the file that contains the specified module. The module must have been loaded by the current process.

Parameters
hModule:long

a handle to the loaded module whose path is being requested.

If this parameter is NULL, GetModuleFileName retrieves the path of the executable file of the current process.

nSize:int

the size of the lpFilename buffer, in TCHARs.

Returns:String

if the function succeeds, the return value is the length of the string that is copied to the buffer, in characters, not including the terminating null character.

If the buffer is too small to hold the module name, the string is truncated to nSize characters including the terminating null character, the function returns nSize, and the function sets the last error to ERROR_INSUFFICIENT_BUFFER.

If the function fails, the return value is 0 (zero). To get extended error information, call GetLastError.

Annotations
@NativeType:DWORD
GetModuleHandleback to summary
public static long GetModuleHandle(ByteBuffer moduleName)

Retrieves a module handle for the specified module. The module must have been loaded by the calling process.

Parameters
moduleName:ByteBuffer

the name of the loaded module (either a .dll or .exe file). If the file name extension is omitted, the default library extension .dll is appended. The file name string can include a trailing point character (.) to indicate that the module name has no extension. The string does not have to specify a path. When specifying a path, be sure to use backslashes (\), not forward slashes (/). The name is compared (case independently) to the names of modules currently mapped into the address space of the calling process.

If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file).

Annotations
@NativeType:HMODULE
GetModuleHandleback to summary
public static long GetModuleHandle(CharSequence moduleName)

Retrieves a module handle for the specified module. The module must have been loaded by the calling process.

Parameters
moduleName:CharSequence

the name of the loaded module (either a .dll or .exe file). If the file name extension is omitted, the default library extension .dll is appended. The file name string can include a trailing point character (.) to indicate that the module name has no extension. The string does not have to specify a path. When specifying a path, be sure to use backslashes (\), not forward slashes (/). The name is compared (case independently) to the names of modules currently mapped into the address space of the calling process.

If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process (.exe file).

Annotations
@NativeType:HMODULE
GetProcAddressback to summary
public static long GetProcAddress(long handle, ByteBuffer name)

Retrieves the address of an exported function or variable from the specified dynamic-link library (DLL).

Parameters
handle:long

a handle to the DLL module that contains the function or variable

name:ByteBuffer

the function or variable name, or the function's ordinal value. If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero.

Annotations
@NativeType:FARPROC
GetProcAddressback to summary
public static long GetProcAddress(long handle, CharSequence name)

Retrieves the address of an exported function or variable from the specified dynamic-link library (DLL).

Parameters
handle:long

a handle to the DLL module that contains the function or variable

name:CharSequence

the function or variable name, or the function's ordinal value. If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero.

Annotations
@NativeType:FARPROC
LoadLibraryback to summary
public static long LoadLibrary(ByteBuffer name)

Loads the specified module into the address space of the calling process. The specified module may cause other modules to be loaded.

Parameters
name:ByteBuffer

the name of the module. This can be either a library module (a .dll file) or an executable module (an .exe file). The name specified is the file name of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.def) file.

If the string specifies a full path, the function searches only that path for the module.

If the string specifies a relative path or a module name without a path, the function uses a standard search strategy to find the module.

If the function cannot find the module, the function fails. When specifying a path, be sure to use backslashes (\), not forward slashes (/).

If the string specifies a module name without a path and the file name extension is omitted, the function appends the default library extension .dll to the module name. To prevent the function from appending .dll to the module name, include a trailing point character (.) in the module name string.

Annotations
@NativeType:HMODULE
LoadLibraryback to summary
public static long LoadLibrary(CharSequence name)

Loads the specified module into the address space of the calling process. The specified module may cause other modules to be loaded.

Parameters
name:CharSequence

the name of the module. This can be either a library module (a .dll file) or an executable module (an .exe file). The name specified is the file name of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.def) file.

If the string specifies a full path, the function searches only that path for the module.

If the string specifies a relative path or a module name without a path, the function uses a standard search strategy to find the module.

If the function cannot find the module, the function fails. When specifying a path, be sure to use backslashes (\), not forward slashes (/).

If the string specifies a module name without a path and the file name extension is omitted, the function appends the default library extension .dll to the module name. To prevent the function from appending .dll to the module name, include a trailing point character (.) in the module name string.

Annotations
@NativeType:HMODULE
LocalFreeback to summary
public static long LocalFree(long hMem)

Frees the specified local memory object and invalidates its handle.

Parameters
hMem:long

a handle to the local memory object

Returns:long

if the function succeeds, the return value is NULL.

If the function fails, the return value is equal to a handle to the local memory object. To get extended error information, call GetLastError.

Annotations
@NativeType:HLOCAL
nFreeLibraryback to summary
public static native int nFreeLibrary(long handle)

Unsafe version of: FreeLibrary

nGetModuleFileNameback to summary
public static native int nGetModuleFileName(long hModule, long lpFilename, int nSize)

Unsafe version of: GetModuleFileName

Parameters
nSize:int

the size of the lpFilename buffer, in TCHARs.

nGetModuleHandleback to summary
public static native long nGetModuleHandle(long moduleName)

Unsafe version of: GetModuleHandle

nGetProcAddressback to summary
public static native long nGetProcAddress(long handle, long name)

Unsafe version of: GetProcAddress

nLoadLibraryback to summary
public static native long nLoadLibrary(long name)

Unsafe version of: LoadLibrary

nLocalFreeback to summary
public static native long nLocalFree(long hMem)

Unsafe version of: LocalFree