From b4b63c5332711c2220a20e9bf5599850e9528cee Mon Sep 17 00:00:00 2001 From: cbouc Date: Tue, 15 Oct 2013 14:00:20 +0200 Subject: [PATCH] Revert "Added missing API, constants..." This reverts commit 94386a151aeed0b7dc96c6a476cd04aea66077ec. --- .../src/com/sun/jna/platform/win32/Ole32.java | 102 ------- .../com/sun/jna/platform/win32/OleAuto.java | 158 +---------- .../com/sun/jna/platform/win32/Variant.java | 210 +++++--------- .../com/sun/jna/platform/win32/WTypes.java | 54 ---- .../src/com/sun/jna/platform/win32/WinNT.java | 262 +----------------- 5 files changed, 80 insertions(+), 706 deletions(-) diff --git a/contrib/platform/src/com/sun/jna/platform/win32/Ole32.java b/contrib/platform/src/com/sun/jna/platform/win32/Ole32.java index 1f088969f9..f240ae4922 100644 --- a/contrib/platform/src/com/sun/jna/platform/win32/Ole32.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/Ole32.java @@ -15,7 +15,6 @@ import com.sun.jna.Native; import com.sun.jna.Pointer; import com.sun.jna.WString; -import com.sun.jna.platform.win32.COM.IUnknown; import com.sun.jna.platform.win32.Guid.CLSID; import com.sun.jna.platform.win32.Guid.GUID; import com.sun.jna.platform.win32.WinDef.LPVOID; @@ -36,107 +35,6 @@ public interface Ole32 extends StdCallLibrary { Ole32 INSTANCE = (Ole32) Native.loadLibrary("Ole32", Ole32.class, W32APIOptions.UNICODE_OPTIONS); - /** - * Identifies the version number of the installed OLE framework. - * - * @return A DWORD uniquely identifying the installed OLE framework build. - */ - int OleBuildVersion(); - - /** - * Initializes the COM library on the current apartment, identifies the - * concurrency model as single-thread apartment (STA), and enables - * additional functionality described in the Remarks section below. - * Applications must initialize the COM library before they can call COM - * library functions other than CoGetMalloc and memory allocation functions. - * @param pvReserved Reserved; must be null - * @return S_OK if the COM library and additional functionality were - * initialized successfully on this apartment. - * S_FALSE if the COM library is already initialized on this apartment. - * OLE_E_WRONGCOMPOBJ if the versions of COMPOBJ.DLL and OLE2.DLL on - * your machine are incompatible with each other. - * RPC_E_CHANGED_MODE if a previous call to CoInitializeEx specified - * the concurrency model for this apartment as - * multithread apartment (MTA). If running - * Windows 2000, this could also mean that a - * change from neutral threaded apartment to - * single threaded apartment occurred. - */ - HRESULT OleInitialize(Pointer pvReserved); - /** - * Closes the COM library on the apartment, releases any class factories, - * other COM objects, or servers held by the apartment, disables RPC on the - * apartment, and frees any resources the apartment maintains. - * - * Remarks: - * Call OleUninitialize on application shutdown, as the last COM library - * call, if the apartment was initialized with a call to - * {@link #OleInitialize}. OleUninitialize calls the CoUninitialize function - * internally to shut down the OLE Component Object(COM) Library. - * - * If the COM library was initialized on the apartment with a call to - * CoInitialize or CoInitializeEx, it must be closed with a call to - * CoUninitialize. - * - * The {@link #OleInitialize} and OleUninitialize calls must be balanced — - * if there are multiple calls to the {@link #OleInitialize} function, there - * must be the same number of calls to OleUninitialize: Only the - * OleUninitialize call corresponding to the {@link #OleInitialize} call - * that actually initialized the library can close it. - */ - void OleUninitialize(); - - /** - * Carries out the clipboard shutdown sequence. It also releases the - * IDataObject pointer that was placed on the clipboard by the - * OleSetClipboard function. - * @return S_OK on success. - * CLIPBRD_E_CANT_OPEN The Windows OpenClipboard function used - * within OleFlushClipboard failed. - * CLIPBRD_E_CANT_CLOSE The Windows CloseClipboard function used - * within OleFlushClipboard failed. - * - * Remarks: - * OleFlushClipboard renders the data from a data object onto the clipboard - * and releases the IDataObject pointer to the data object. While the - * application that put the data object on the clipboard is running, the - * clipboard holds only a pointer to the data object, thus saving memory. - * If you are writing an application that acts as the source of a clipboard - * operation, you can call the OleFlushClipboard function when your - * application is closed, such as when the user exits from your application. - * Calling OleFlushClipboard enables pasting and paste-linking of OLE - * objects after application shutdown. - * Before calling OleFlushClipboard, you can easily determine if your data - * is still on the clipboard with a call to the OleIsCurrentClipboard - * function. - * - * OleFlushClipboard leaves all formats offered by the data transfer object, - * including the OLE 1 compatibility formats, on the clipboard so they are - * available after application shutdown. In addition to OLE 1 compatibility - * formats, these include all formats offered on a global handle medium (all - * except for TYMED_FILE) and formatted with a null target device. For - * example, if a data-source application offers a particular clipboard - * format (say cfFOO) on an IStorage object, and calls the OleFlushClipboard - * function, the storage object is copied into memory and the hglobal memory - * handle is put on the clipboard. - * - * To retrieve the information on the clipboard, you can call the - * OleGetClipboard function from another application, which creates a - * default data object, and the hglobal from the clipboard again becomes a - * storage object. Furthermore, the FORMATETC enumerator and the - * IDataObject::QueryGetData method would all correctly indicate that the - * original clipboard format (cfFOO) is again available on a TYMED_ISTORAGE. - * - * To empty the clipboard, call the OleSetClipboard function specifying a - * null value for its parameter. The application should call this when it - * closes if there is no need to leave data on the clipboard after shutdown, - * or if data will be placed on the clipboard using the standard Windows - * clipboard functions. - */ - HRESULT OleFlushClipboard(); - - HRESULT OleRun(Pointer pUnknown); - /** * Creates a GUID, a unique 128-bit integer used for CLSIDs and interface * identifiers. diff --git a/contrib/platform/src/com/sun/jna/platform/win32/OleAuto.java b/contrib/platform/src/com/sun/jna/platform/win32/OleAuto.java index 2c9b8b216b..83e18277cf 100644 --- a/contrib/platform/src/com/sun/jna/platform/win32/OleAuto.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/OleAuto.java @@ -32,6 +32,7 @@ import com.sun.jna.platform.win32.WinDef.PVOID; import com.sun.jna.platform.win32.WinDef.UINT; import com.sun.jna.platform.win32.WinNT.HRESULT; +import com.sun.jna.platform.win32.COM.TypeLib; import com.sun.jna.ptr.DoubleByReference; import com.sun.jna.ptr.PointerByReference; import com.sun.jna.win32.StdCallLibrary; @@ -214,163 +215,6 @@ public interface OleAuto extends StdCallLibrary { */ HRESULT VariantClear(Pointer pvarg); - public static final short VARIANT_NOVALUEPROP = 0x01; - /** For VT_BOOL to VT_BSTR conversions, convert to "True"/"False" instead of "-1"/"0" */ - public static final short VARIANT_ALPHABOOL = 0x02; - /** For conversions to/from VT_BSTR, passes LOCALE_NOUSEROVERRIDE to core coercion routines */ - public static final short VARIANT_NOUSEROVERRIDE = 0x04; - public static final short VARIANT_CALENDAR_HIJRI = 0x08; - /** For VT_BOOL to VT_BSTR and back, convert to local language rather than English */ - public static final short VARIANT_LOCALBOOL = 0x10; - /** SOUTHASIA calendar support */ - public static final short VARIANT_CALENDAR_THAI = 0x20; - /** SOUTHASIA calendar support */ - public static final short VARIANT_CALENDAR_GREGORIAN = 0x40; - /** NLS function call support */ - public static final short VARIANT_USE_NLS = 0x80; - - /** - * Converts a variant from one type to another. - * @param pvargDest [out] The destination variant. If this is the same as - * pvarSrc, the variant will be converted in place. - * @param pvarSrc [in] The variant to convert. - * @param wFlags Combination of the following flags - * - * - * - * - * - * - * - * - * - * - *
wFlags
ValueMeaning
{@link #VARIANT_NOVALUEPROP}Prevents the function from attempting to coerce an object to a fundamental type by getting the Value property. Applications should set this flag only if necessary, because it makes their behavior inconsistent with other applications.
{@link #VARIANT_ALPHABOOL}Converts a {@link Variant#VT_BOOL VT_BOOL} value to a string containing either "True" or "False".
{@link #VARIANT_NOUSEROVERRIDE}For conversions to or from {@link Variant#VT_BSTR VT_BSTR}, passes LOCALE_NOUSEROVERRIDE to the core coercion routines.
{@link #VARIANT_LOCALBOOL}For conversions from {@link Variant#VT_BOOL VT_BOOL} to {@link Variant#VT_BSTR VT_BSTR} and back, uses the language specified by the locale in use on the local computer.
- * @param vt The type to convert to. If the return code is {@link WinError#S_OK S_OK}, the vt - * field of the vargDest is guaranteed to be equal to this value. - * @return This function can return one of these values: - * - * - * - * - * - * - * - * - * - * - * - * - *
Return codeDescription
{@link WinError#S_OK S_OK}Success.
{@link WinError#DISP_E_BADVARTYPE DISP_E_BADVARTYPE}The variant type is not a valid type of variant.
{@link WinError#DISP_E_OVERFLOW DISP_E_OVERFLOW}The data pointed to by pvarSrc does not fit in the destination type.
{@link WinError#DISP_E_TYPEMISMATCH DISP_E_TYPEMISMATCH}The argument could not be coerced to the specified type.
{@link WinError#E_INVALIDARG E_INVALIDARG}One of the arguments is not valid.
{@link WinError#E_OUTOFMEMORY E_OUTOFMEMORY}Insufficient memory to complete the operation.
- *

- * Remarks - *

- * The VariantChangeType function handles coercions between the fundamental - * types (including numeric-to-string and string-to-numeric coercions). The - * pvarSrc argument is changed during the conversion process. For example, - * if the source variant is of type {@link Variant#VT_BOOL VT_BOOL} and the - * destination is of type {@link Variant#VT_UINT VT_UINT}, the pvarSrc - * argument is first converted to {@link Variant#VT_I2 VT_I2} and then the - * conversion proceeds. A variant that has {@link Variant#VT_BYREF VT_BYREF} - * set is coerced to a value by obtaining the referenced value. An object is - * coerced to a value by invoking the object's Value property - * ({@link OaIdl#DISPID_VALUE DISPID_VALUE}). - *

- * Typically, the implementor of - * {@link com.sun.jna.platform.win32.COM.IDispatch#Invoke IDispatch.Invoke} - * determines which member is being accessed, and then calls - * VariantChangeType to get the value of one or more arguments. For example, - * if the IDispatch call specifies a SetTitle member that takes one string - * argument, the implementor would call VariantChangeType to attempt to - * coerce the argument to {@link Variant#VT_BSTR VT_BSTR}. If - * VariantChangeType does not return an error, the argument could then be - * obtained directly from the - * {@link Variant.VARIANT._VARIANT.__VARIANT#bstrVal bstrVal} field of the - * {@link Variant.VARIANT VARIANT}. If VariantChangeType returns - * {@link WinError#DISP_E_TYPEMISMATCH DISP_E_TYPEMISMATCH}, the implementor - * would set {@link com.sun.jna.platform.win32.COM.IDispatch#Invoke Invoke} - * puArgErr parameter referenced value to 0 (indicating the - * argument in error) and return DISP_E_TYPEMISMATCH from Invoke. - *

- * Arrays of one type cannot be converted to arrays of another type with - * this function. - *

- * Note The type of a {@link Variant.VARIANT VARIANT} should not be - * changed in the {@link DISPPARAMS#rgvarg rgvarg} array in place. - */ - HRESULT VariantChangeType(VARIANT pvargDest, VARIANT pvarSrc, short wFlags, VARTYPE vt); - - /** - * Converts a variant from one type to another. - * @param pvargDest [out] The destination variant. If this is the same as - * pvarSrc, the variant will be converted in place. - * @param pvarSrc [in] The variant to convert. - * @param wFlags Combination of the following flags - * - * - * - * - * - * - * - * - * - * - *
wFlags
ValueMeaning
{@link #VARIANT_NOVALUEPROP}Prevents the function from attempting to coerce an object to a fundamental type by getting the Value property. Applications should set this flag only if necessary, because it makes their behavior inconsistent with other applications.
{@link #VARIANT_ALPHABOOL}Converts a {@link Variant#VT_BOOL VT_BOOL} value to a string containing either "True" or "False".
{@link #VARIANT_NOUSEROVERRIDE}For conversions to or from {@link Variant#VT_BSTR VT_BSTR}, passes LOCALE_NOUSEROVERRIDE to the core coercion routines.
{@link #VARIANT_LOCALBOOL}For conversions from {@link Variant#VT_BOOL VT_BOOL} to {@link Variant#VT_BSTR VT_BSTR} and back, uses the language specified by the locale in use on the local computer.
- * @param vt The type to convert to. If the return code is {@link WinError#S_OK S_OK}, the vt - * field of the vargDest is guaranteed to be equal to this value. - * @return This function can return one of these values: - * - * - * - * - * - * - * - * - * - * - * - * - *
Return codeDescription
{@link WinError#S_OK S_OK}Success.
{@link WinError#DISP_E_BADVARTYPE DISP_E_BADVARTYPE}The variant type is not a valid type of variant.
{@link WinError#DISP_E_OVERFLOW DISP_E_OVERFLOW}The data pointed to by pvarSrc does not fit in the destination type.
{@link WinError#DISP_E_TYPEMISMATCH DISP_E_TYPEMISMATCH}The argument could not be coerced to the specified type.
{@link WinError#E_INVALIDARG E_INVALIDARG}One of the arguments is not valid.
{@link WinError#E_OUTOFMEMORY E_OUTOFMEMORY}Insufficient memory to complete the operation.
- *

- * Remarks - *

- * The VariantChangeType function handles coercions between the fundamental - * types (including numeric-to-string and string-to-numeric coercions). The - * pvarSrc argument is changed during the conversion process. For example, - * if the source variant is of type {@link Variant#VT_BOOL VT_BOOL} and the - * destination is of type {@link Variant#VT_UINT VT_UINT}, the pvarSrc - * argument is first converted to {@link Variant#VT_I2 VT_I2} and then the - * conversion proceeds. A variant that has {@link Variant#VT_BYREF VT_BYREF} - * set is coerced to a value by obtaining the referenced value. An object is - * coerced to a value by invoking the object's Value property - * ({@link OaIdl#DISPID_VALUE DISPID_VALUE}). - *

- * Typically, the implementor of - * {@link com.sun.jna.platform.win32.COM.IDispatch#Invoke IDispatch.Invoke} - * determines which member is being accessed, and then calls - * VariantChangeType to get the value of one or more arguments. For example, - * if the IDispatch call specifies a SetTitle member that takes one string - * argument, the implementor would call VariantChangeType to attempt to - * coerce the argument to {@link Variant#VT_BSTR VT_BSTR}. If - * VariantChangeType does not return an error, the argument could then be - * obtained directly from the - * {@link Variant.VARIANT._VARIANT.__VARIANT#bstrVal bstrVal} field of the - * {@link Variant.VARIANT VARIANT}. If VariantChangeType returns - * {@link WinError#DISP_E_TYPEMISMATCH DISP_E_TYPEMISMATCH}, the implementor - * would set {@link com.sun.jna.platform.win32.COM.IDispatch#Invoke Invoke} - * puArgErr parameter referenced value to 0 (indicating the - * argument in error) and return DISP_E_TYPEMISMATCH from Invoke. - *

- * Arrays of one type cannot be converted to arrays of another type with - * this function. - *

- * Note The type of a {@link Variant.VARIANT VARIANT} should not be - * changed in the {@link DISPPARAMS#rgvarg rgvarg} array in place. - */ - HRESULT VariantChangeType(VARIANT.ByReference pvargDest, VARIANT.ByReference pvarSrc, short wFlags, VARTYPE vt); - /** * Creates a new array descriptor, allocates and initializes the data for * the array, and returns a pointer to the new array descriptor. diff --git a/contrib/platform/src/com/sun/jna/platform/win32/Variant.java b/contrib/platform/src/com/sun/jna/platform/win32/Variant.java index 0dca3eb7d7..64ee249e8e 100644 --- a/contrib/platform/src/com/sun/jna/platform/win32/Variant.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/Variant.java @@ -19,7 +19,6 @@ import com.sun.jna.platform.win32.WinDef.BYTE; import com.sun.jna.platform.win32.WinDef.CHAR; import com.sun.jna.platform.win32.WinDef.CHARByReference; -import com.sun.jna.platform.win32.WinDef.DWORD; import com.sun.jna.platform.win32.WinDef.LONG; import com.sun.jna.platform.win32.WinDef.LONGLONG; import com.sun.jna.platform.win32.WinDef.LONGLONGByReference; @@ -36,8 +35,6 @@ import com.sun.jna.platform.win32.WinDef.ULONGByReference; import com.sun.jna.platform.win32.WinDef.USHORT; import com.sun.jna.platform.win32.WinDef.USHORTByReference; -import com.sun.jna.platform.win32.WinDef.WORD; -import com.sun.jna.platform.win32.WinNT.HRESULT; import com.sun.jna.platform.win32.COM.Dispatch; import com.sun.jna.platform.win32.COM.IDispatch; import com.sun.jna.platform.win32.COM.IRecordInfo; @@ -143,44 +140,14 @@ public VARIANT(VARIANT_BOOL value) { this.setValue(VT_BOOL, value); } - public VARIANT(BYTE value) { - this(); - this.setValue(VT_UI1, value); - } - - public VARIANT(WORD value) { - this(); - this.setValue(VT_UI2, value); - } - - public VARIANT(DWORD value) { - this(); - this.setValue(VT_UI4, value); - } - - public VARIANT(ULONGLONG value) { - this(); - this.setValue(VT_UI8, value); - } - - public VARIANT(CHAR value) { - this(); - this.setValue(VT_I1, value); - } - - public VARIANT(SHORT value) { - this(); - this.setValue(VT_I2, value); - } - public VARIANT(LONG value) { this(); this.setValue(VT_I4, value); } - public VARIANT(LONGLONG value) { + public VARIANT(SHORT value) { this(); - this.setValue(VT_I8, value); + this.setValue(VT_I2, value); } public VARIANT(DATE value) { @@ -188,11 +155,6 @@ public VARIANT(DATE value) { this.setValue(VT_DATE, value); } - public VARIANT(byte value) { - this(); - this.setValue(VT_I1, value); - } - public VARIANT(short value) { this(); this.setValue(VT_I2, value); @@ -243,11 +205,6 @@ public VARIANT(Date value) { this.setValue(VT_DATE, date); } - public VARIANT(CURRENCY value) { - this(); - this.setValue(VT_CY, value); - } - public VARTYPE getVarType() { this.read(); return _variant.vt; @@ -263,36 +220,15 @@ public void setValue(int vt, Object value) { public void setValue(VARTYPE vt, Object value) { switch (vt.intValue()) { - case VT_I1: - this._variant.__variant.writeField("cVal", value); - break; case VT_I2: this._variant.__variant.writeField("iVal", value); break; - case VT_INT: - this._variant.__variant.writeField("intVal", value); - break; case VT_I4: this._variant.__variant.writeField("lVal", value); break; case VT_I8: this._variant.__variant.writeField("llVal", value); break; - case VT_UI1: - this._variant.__variant.writeField("bVal", value); - break; - case VT_UI2: - this._variant.__variant.writeField("uiVal", value); - break; - case VT_UINT: - this._variant.__variant.writeField("uintVal", value); - break; - case VT_UI4: - this._variant.__variant.writeField("ulVal", value); - break; - case VT_UI8: - this._variant.__variant.writeField("ullVal", value); - break; case VT_R4: this._variant.__variant.writeField("fltVal", value); break; @@ -302,7 +238,6 @@ public void setValue(VARTYPE vt, Object value) { case VT_BOOL: this._variant.__variant.writeField("boolVal", value); break; - case VT_HRESULT: case VT_ERROR: this._variant.__variant.writeField("scode", value); break; @@ -327,39 +262,18 @@ public void setValue(VARTYPE vt, Object value) { case VT_ARRAY: this._variant.__variant.writeField("parray", value); break; - case VT_BYREF: - this._variant.__variant.writeField("byref", value); - break; - case VT_BYREF | VT_I1: - this._variant.__variant.writeField("pcVal", value); + case VT_BYREF | VT_UI1: + this._variant.__variant.writeField("pbVal", value); break; case VT_BYREF | VT_I2: this._variant.__variant.writeField("piVal", value); break; - case VT_BYREF | VT_INT: - this._variant.__variant.writeField("pintVal", value); - break; case VT_BYREF | VT_I4: this._variant.__variant.writeField("plVal", value); break; case VT_BYREF | VT_I8: this._variant.__variant.writeField("pllVal", value); break; - case VT_BYREF | VT_UI1: - this._variant.__variant.writeField("pbVal", value); - break; - case VT_BYREF | VT_UI2: - this._variant.__variant.writeField("puiVal", value); - break; - case VT_BYREF | VT_UINT: - this._variant.__variant.writeField("puintVal", value); - break; - case VT_BYREF | VT_UI4: - this._variant.__variant.writeField("pulVal", value); - break; - case VT_BYREF | VT_UI8: - this._variant.__variant.writeField("pullVal", value); - break; case VT_BYREF | VT_R4: this._variant.__variant.writeField("pfltVal", value); break; @@ -393,9 +307,48 @@ public void setValue(VARTYPE vt, Object value) { case VT_BYREF | VT_VARIANT: this._variant.__variant.writeField("pvarVal", value); break; + case VT_BYREF: + this._variant.__variant.writeField("byref", value); + break; + case VT_I1: + this._variant.__variant.writeField("cVal", value); + break; + case VT_UI2: + this._variant.__variant.writeField("uiVal", value); + break; + case VT_UI4: + this._variant.__variant.writeField("ulVal", value); + break; + case VT_UI8: + this._variant.__variant.writeField("ullVal", value); + break; + case VT_INT: + this._variant.__variant.writeField("intVal", value); + break; + case VT_UINT: + this._variant.__variant.writeField("uintVal", value); + break; case VT_BYREF | VT_DECIMAL: this._variant.__variant.writeField("pdecVal", value); break; + case VT_BYREF | VT_I1: + this._variant.__variant.writeField("pcVal", value); + break; + case VT_BYREF | VT_UI2: + this._variant.__variant.writeField("puiVal", value); + break; + case VT_BYREF | VT_UI4: + this._variant.__variant.writeField("pulVal", value); + break; + case VT_BYREF | VT_UI8: + this._variant.__variant.writeField("pullVal", value); + break; + case VT_BYREF | VT_INT: + this._variant.__variant.writeField("pintVal", value); + break; + case VT_BYREF | VT_UINT: + this._variant.__variant.writeField("puintVal", value); + break; } this._variant.writeField("vt", vt); @@ -405,33 +358,18 @@ public void setValue(VARTYPE vt, Object value) { public Object getValue() { this.read(); switch (this.getVarType().intValue()) { - case VT_I1: - return this._variant.__variant.readField("cVal"); case VT_I2: return this._variant.__variant.readField("iVal"); - case VT_INT: - return this._variant.__variant.readField("intVal"); case VT_I4: return this._variant.__variant.readField("lVal"); case VT_I8: return this._variant.__variant.readField("llVal"); - case VT_UI1: - return this._variant.__variant.readField("bVal"); - case VT_UI2: - return this._variant.__variant.readField("uiVal"); - case VT_UINT: - return this._variant.__variant.readField("uintVal"); - case VT_UI4: - return this._variant.__variant.readField("ulVal"); - case VT_UI8: - return this._variant.__variant.readField("ullVal"); case VT_R4: return this._variant.__variant.readField("fltVal"); case VT_R8: return this._variant.__variant.readField("dblVal"); case VT_BOOL: return this._variant.__variant.readField("boolVal"); - case VT_HRESULT: case VT_ERROR: return this._variant.__variant.readField("scode"); case VT_CY: @@ -448,28 +386,14 @@ public Object getValue() { return this._variant.__variant.readField("parray"); case VT_ARRAY: return this._variant.__variant.readField("parray"); - case VT_BYREF: - return this._variant.__variant.readField("byref"); - case VT_BYREF | VT_I1: - return this._variant.__variant.readField("pcVal"); + case VT_BYREF | VT_UI1: + return this._variant.__variant.readField("pbVal"); case VT_BYREF | VT_I2: return this._variant.__variant.readField("piVal"); - case VT_BYREF | VT_INT: - return this._variant.__variant.readField("pintVal"); case VT_BYREF | VT_I4: return this._variant.__variant.readField("plVal"); case VT_BYREF | VT_I8: return this._variant.__variant.readField("pllVal"); - case VT_BYREF | VT_UI1: - return this._variant.__variant.readField("pbVal"); - case VT_BYREF | VT_UI2: - return this._variant.__variant.readField("puiVal"); - case VT_BYREF | VT_UINT: - return this._variant.__variant.readField("puintVal"); - case VT_BYREF | VT_UI4: - return this._variant.__variant.readField("pulVal"); - case VT_BYREF | VT_UI8: - return this._variant.__variant.readField("pullVal"); case VT_BYREF | VT_R4: return this._variant.__variant.readField("pfltVal"); case VT_BYREF | VT_R8: @@ -492,39 +416,57 @@ public Object getValue() { return this._variant.__variant.readField("pparray"); case VT_BYREF | VT_VARIANT: return this._variant.__variant.readField("pvarVal"); + case VT_BYREF: + return this._variant.__variant.readField("byref"); + case VT_I1: + return this._variant.__variant.readField("cVal"); + case VT_UI2: + return this._variant.__variant.readField("uiVal"); + case VT_UI4: + return this._variant.__variant.readField("ulVal"); + case VT_UI8: + return this._variant.__variant.readField("ullVal"); + case VT_INT: + return this._variant.__variant.readField("intVal"); + case VT_UINT: + return this._variant.__variant.readField("uintVal"); case VT_BYREF | VT_DECIMAL: return this._variant.__variant.readField("pdecVal"); + case VT_BYREF | VT_I1: + return this._variant.__variant.readField("pcVal"); + case VT_BYREF | VT_UI2: + return this._variant.__variant.readField("puiVal"); + case VT_BYREF | VT_UI4: + return this._variant.__variant.readField("pulVal"); + case VT_BYREF | VT_UI8: + return this._variant.__variant.readField("pullVal"); + case VT_BYREF | VT_INT: + return this._variant.__variant.readField("pintVal"); + case VT_BYREF | VT_UINT: + return this._variant.__variant.readField("puintVal"); default: return null; } } - public Number numberValue() { - return (Number) this.getValue(); - } - - public int byteValue() { - return ((Number) this.getValue()).byteValue(); - } - public int shortValue() { - return ((Number) this.getValue()).shortValue(); + return (Short) this.getValue(); } public int intValue() { - return ((Number) this.getValue()).intValue(); + return (Integer) this.getValue(); } public long longValue() { - return ((Number) this.getValue()).longValue(); + return (Long) this.getValue(); } public float floatValue() { - return ((Number) this.getValue()).floatValue(); + return (Float) this.getValue(); } public double doubleValue() { - return ((Number) this.getValue()).doubleValue(); + return (Double) this.getValue(); } public String stringValue() { diff --git a/contrib/platform/src/com/sun/jna/platform/win32/WTypes.java b/contrib/platform/src/com/sun/jna/platform/win32/WTypes.java index 4f387a4f18..0b86d047f2 100644 --- a/contrib/platform/src/com/sun/jna/platform/win32/WTypes.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/WTypes.java @@ -61,60 +61,6 @@ public interface WTypes { public static int CLSCTX_ALL = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER; - public static int VT_EMPTY = 0; - public static int VT_NULL = 1; - public static int VT_I2 = 2; - public static int VT_I4 = 3; - public static int VT_R4 = 4; - public static int VT_R8 = 5; - public static int VT_CY = 6; - public static int VT_DATE = 7; - public static int VT_BSTR = 8; - public static int VT_DISPATCH = 9; - public static int VT_ERROR = 10; - public static int VT_BOOL = 11; - public static int VT_VARIANT = 12; - public static int VT_UNKNOWN = 13; - public static int VT_DECIMAL = 14; - public static int VT_I1 = 16; - public static int VT_UI1 = 17; - public static int VT_UI2 = 18; - public static int VT_UI4 = 19; - public static int VT_I8 = 20; - public static int VT_UI8 = 21; - public static int VT_INT = 22; - public static int VT_UINT = 23; - public static int VT_VOID = 24; - public static int VT_HRESULT = 25; - public static int VT_PTR = 26; - public static int VT_SAFEARRAY = 27; - public static int VT_CARRAY = 28; - public static int VT_USERDEFINED = 29; - public static int VT_LPSTR = 30; - public static int VT_LPWSTR = 31; - public static int VT_RECORD = 36; - public static int VT_INT_PTR = 37; - public static int VT_UINT_PTR = 38; - public static int VT_FILETIME = 64; - public static int VT_BLOB = 65; - public static int VT_STREAM = 66; - public static int VT_STORAGE = 67; - public static int VT_STREAMED_OBJECT = 68; - public static int VT_STORED_OBJECT = 69; - public static int VT_BLOB_OBJECT = 70; - public static int VT_CF = 71; - public static int VT_CLSID = 72; - public static int VT_VERSIONED_STREAM = 73; - public static int VT_BSTR_BLOB = 0x0fff; - public static int VT_VECTOR = 0x1000; - public static int VT_ARRAY = 0x2000; - public static int VT_BYREF = 0x4000; - public static int VT_RESERVED = 0x8000; - public static int VT_ILLEGAL = 0xffff; - public static int VT_ILLEGALMASKED= 0x0fff; - public static int VT_TYPEMASK = 0x0fff; - - public static class BSTR extends PointerType { public static class ByReference extends BSTR implements Structure.ByReference { diff --git a/contrib/platform/src/com/sun/jna/platform/win32/WinNT.java b/contrib/platform/src/com/sun/jna/platform/win32/WinNT.java index 868ee48c5b..8c593b3044 100644 --- a/contrib/platform/src/com/sun/jna/platform/win32/WinNT.java +++ b/contrib/platform/src/com/sun/jna/platform/win32/WinNT.java @@ -25,6 +25,9 @@ import com.sun.jna.Union; import com.sun.jna.ptr.ByReference; +import com.sun.jna.platform.win32.WinNT.SYSTEM_LOGICAL_PROCESSOR_INFORMATION; +import com.sun.jna.platform.win32.WinNT.LOGICAL_PROCESSOR_RELATIONSHIP; + /** * This module defines the 32-Bit Windows types and constants that are defined * by NT, but exposed through the Win32 API. Ported from WinNT.h Microsoft @@ -2386,263 +2389,4 @@ public static abstract class PROCESSOR_CACHE_TYPE { */ public static int CacheTrace = 3; } - - /* - * Primary language IDs. - */ - public static final int LANG_NEUTRAL = 0x00; - public static final int LANG_INVARIANT = 0x7f; - - public static final int LANG_AFRIKAANS = 0x36; - public static final int LANG_ALBANIAN = 0x1c; - public static final int LANG_ARABIC = 0x01; - public static final int LANG_ARMENIAN = 0x2b; - public static final int LANG_ASSAMESE = 0x4d; - public static final int LANG_AZERI = 0x2c; - public static final int LANG_BASQUE = 0x2d; - public static final int LANG_BELARUSIAN = 0x23; - public static final int LANG_BENGALI = 0x45; - public static final int LANG_BULGARIAN = 0x02; - public static final int LANG_CATALAN = 0x03; - public static final int LANG_CHINESE = 0x04; - public static final int LANG_CROATIAN = 0x1a; - public static final int LANG_CZECH = 0x05; - public static final int LANG_DANISH = 0x06; - public static final int LANG_DIVEHI = 0x65; - public static final int LANG_DUTCH = 0x13; - public static final int LANG_ENGLISH = 0x09; - public static final int LANG_ESTONIAN = 0x25; - public static final int LANG_FAEROESE = 0x38; - public static final int LANG_FARSI = 0x29; - public static final int LANG_FINNISH = 0x0b; - public static final int LANG_FRENCH = 0x0c; - public static final int LANG_GALICIAN = 0x56; - public static final int LANG_GEORGIAN = 0x37; - public static final int LANG_GERMAN = 0x07; - public static final int LANG_GREEK = 0x08; - public static final int LANG_GUJARATI = 0x47; - public static final int LANG_HEBREW = 0x0d; - public static final int LANG_HINDI = 0x39; - public static final int LANG_HUNGARIAN = 0x0e; - public static final int LANG_ICELANDIC = 0x0f; - public static final int LANG_INDONESIAN = 0x21; - public static final int LANG_ITALIAN = 0x10; - public static final int LANG_JAPANESE = 0x11; - public static final int LANG_KANNADA = 0x4b; - public static final int LANG_KASHMIRI = 0x60; - public static final int LANG_KAZAK = 0x3f; - public static final int LANG_KONKANI = 0x57; - public static final int LANG_KOREAN = 0x12; - public static final int LANG_KYRGYZ = 0x40; - public static final int LANG_LATVIAN = 0x26; - public static final int LANG_LITHUANIAN = 0x27; - public static final int LANG_MACEDONIAN = 0x2f; // the Former Yugoslav Republic of Macedonia - public static final int LANG_MALAY = 0x3e; - public static final int LANG_MALAYALAM = 0x4c; - public static final int LANG_MANIPURI = 0x58; - public static final int LANG_MARATHI = 0x4e; - public static final int LANG_MONGOLIAN = 0x50; - public static final int LANG_NEPALI = 0x61; - public static final int LANG_NORWEGIAN = 0x14; - public static final int LANG_ORIYA = 0x48; - public static final int LANG_POLISH = 0x15; - public static final int LANG_PORTUGUESE = 0x16; - public static final int LANG_PUNJABI = 0x46; - public static final int LANG_ROMANIAN = 0x18; - public static final int LANG_RUSSIAN = 0x19; - public static final int LANG_SANSKRIT = 0x4f; - public static final int LANG_SERBIAN = 0x1a; - public static final int LANG_SINDHI = 0x59; - public static final int LANG_SLOVAK = 0x1b; - public static final int LANG_SLOVENIAN = 0x24; - public static final int LANG_SPANISH = 0x0a; - public static final int LANG_SWAHILI = 0x41; - public static final int LANG_SWEDISH = 0x1d; - public static final int LANG_SYRIAC = 0x5a; - public static final int LANG_TAMIL = 0x49; - public static final int LANG_TATAR = 0x44; - public static final int LANG_TELUGU = 0x4a; - public static final int LANG_THAI = 0x1e; - public static final int LANG_TURKISH = 0x1f; - public static final int LANG_UKRAINIAN = 0x22; - public static final int LANG_URDU = 0x20; - public static final int LANG_UZBEK = 0x43; - public static final int LANG_VIETNAMESE = 0x2a; - - /* - * Sublanguage IDs. - * - * The name immediately following SUBLANG_ dictates which primary - * language ID that sublanguage ID can be combined with to form a - * valid language ID. - */ - public static final int SUBLANG_NEUTRAL = 0x00; // language neutral - public static final int SUBLANG_DEFAULT = 0x01; // user default - public static final int SUBLANG_SYS_DEFAULT = 0x02; // system default - - public static final int SUBLANG_ARABIC_SAUDI_ARABIA = 0x01; // Arabic (Saudi Arabia) - public static final int SUBLANG_ARABIC_IRAQ = 0x02; // Arabic (Iraq) - public static final int SUBLANG_ARABIC_EGYPT = 0x03; // Arabic (Egypt) - public static final int SUBLANG_ARABIC_LIBYA = 0x04; // Arabic (Libya) - public static final int SUBLANG_ARABIC_ALGERIA = 0x05; // Arabic (Algeria) - public static final int SUBLANG_ARABIC_MOROCCO = 0x06; // Arabic (Morocco) - public static final int SUBLANG_ARABIC_TUNISIA = 0x07; // Arabic (Tunisia) - public static final int SUBLANG_ARABIC_OMAN = 0x08; // Arabic (Oman) - public static final int SUBLANG_ARABIC_YEMEN = 0x09; // Arabic (Yemen) - public static final int SUBLANG_ARABIC_SYRIA = 0x0a; // Arabic (Syria) - public static final int SUBLANG_ARABIC_JORDAN = 0x0b; // Arabic (Jordan) - public static final int SUBLANG_ARABIC_LEBANON = 0x0c; // Arabic (Lebanon) - public static final int SUBLANG_ARABIC_KUWAIT = 0x0d; // Arabic (Kuwait) - public static final int SUBLANG_ARABIC_UAE = 0x0e; // Arabic (U.A.E) - public static final int SUBLANG_ARABIC_BAHRAIN = 0x0f; // Arabic (Bahrain) - public static final int SUBLANG_ARABIC_QATAR = 0x10; // Arabic (Qatar) - public static final int SUBLANG_AZERI_LATIN = 0x01; // Azeri (Latin) - public static final int SUBLANG_AZERI_CYRILLIC = 0x02; // Azeri (Cyrillic) - public static final int SUBLANG_CHINESE_TRADITIONAL = 0x01; // Chinese (Taiwan) - public static final int SUBLANG_CHINESE_SIMPLIFIED = 0x02; // Chinese (PR China) - public static final int SUBLANG_CHINESE_HONGKONG = 0x03; // Chinese (Hong Kong S.A.R., P.R.C.) - public static final int SUBLANG_CHINESE_SINGAPORE = 0x04; // Chinese (Singapore) - public static final int SUBLANG_CHINESE_MACAU = 0x05; // Chinese (Macau S.A.R.) - public static final int SUBLANG_DUTCH = 0x01; // Dutch - public static final int SUBLANG_DUTCH_BELGIAN = 0x02; // Dutch (Belgian) - public static final int SUBLANG_ENGLISH_US = 0x01; // English (USA) - public static final int SUBLANG_ENGLISH_UK = 0x02; // English (UK) - public static final int SUBLANG_ENGLISH_AUS = 0x03; // English (Australian) - public static final int SUBLANG_ENGLISH_CAN = 0x04; // English (Canadian) - public static final int SUBLANG_ENGLISH_NZ = 0x05; // English (New Zealand) - public static final int SUBLANG_ENGLISH_EIRE = 0x06; // English (Irish) - public static final int SUBLANG_ENGLISH_SOUTH_AFRICA = 0x07; // English (South Africa) - public static final int SUBLANG_ENGLISH_JAMAICA = 0x08; // English (Jamaica) - public static final int SUBLANG_ENGLISH_CARIBBEAN = 0x09; // English (Caribbean) - public static final int SUBLANG_ENGLISH_BELIZE = 0x0a; // English (Belize) - public static final int SUBLANG_ENGLISH_TRINIDAD = 0x0b; // English (Trinidad) - public static final int SUBLANG_ENGLISH_ZIMBABWE = 0x0c; // English (Zimbabwe) - public static final int SUBLANG_ENGLISH_PHILIPPINES = 0x0d; // English (Philippines) - public static final int SUBLANG_FRENCH = 0x01; // French - public static final int SUBLANG_FRENCH_BELGIAN = 0x02; // French (Belgian) - public static final int SUBLANG_FRENCH_CANADIAN = 0x03; // French (Canadian) - public static final int SUBLANG_FRENCH_SWISS = 0x04; // French (Swiss) - public static final int SUBLANG_FRENCH_LUXEMBOURG = 0x05; // French (Luxembourg) - public static final int SUBLANG_FRENCH_MONACO = 0x06; // French (Monaco) - public static final int SUBLANG_GERMAN = 0x01; // German - public static final int SUBLANG_GERMAN_SWISS = 0x02; // German (Swiss) - public static final int SUBLANG_GERMAN_AUSTRIAN = 0x03; // German (Austrian) - public static final int SUBLANG_GERMAN_LUXEMBOURG = 0x04; // German (Luxembourg) - public static final int SUBLANG_GERMAN_LIECHTENSTEIN = 0x05; // German (Liechtenstein) - public static final int SUBLANG_ITALIAN = 0x01; // Italian - public static final int SUBLANG_ITALIAN_SWISS = 0x02; // Italian (Swiss) - public static final int SUBLANG_KASHMIRI_SASIA = 0x02; // Kashmiri (South Asia) - public static final int SUBLANG_KASHMIRI_INDIA = 0x02; // For app compatibility only - public static final int SUBLANG_KOREAN = 0x01; // Korean (Extended Wansung) - public static final int SUBLANG_LITHUANIAN = 0x01; // Lithuanian - public static final int SUBLANG_MALAY_MALAYSIA = 0x01; // Malay (Malaysia) - public static final int SUBLANG_MALAY_BRUNEI_DARUSSALAM = 0x02; // Malay (Brunei Darussalam) - public static final int SUBLANG_NEPALI_INDIA = 0x02; // Nepali (India) - public static final int SUBLANG_NORWEGIAN_BOKMAL = 0x01; // Norwegian (Bokmal) - public static final int SUBLANG_NORWEGIAN_NYNORSK = 0x02; // Norwegian (Nynorsk) - public static final int SUBLANG_PORTUGUESE = 0x02; // Portuguese - public static final int SUBLANG_PORTUGUESE_BRAZILIAN = 0x01; // Portuguese (Brazilian) - public static final int SUBLANG_SERBIAN_LATIN = 0x02; // Serbian (Latin) - public static final int SUBLANG_SERBIAN_CYRILLIC = 0x03; // Serbian (Cyrillic) - public static final int SUBLANG_SPANISH = 0x01; // Spanish (Castilian) - public static final int SUBLANG_SPANISH_MEXICAN = 0x02; // Spanish (Mexican) - public static final int SUBLANG_SPANISH_MODERN = 0x03; // Spanish (Spain) - public static final int SUBLANG_SPANISH_GUATEMALA = 0x04; // Spanish (Guatemala) - public static final int SUBLANG_SPANISH_COSTA_RICA = 0x05; // Spanish (Costa Rica) - public static final int SUBLANG_SPANISH_PANAMA = 0x06; // Spanish (Panama) - public static final int SUBLANG_SPANISH_DOMINICAN_REPUBLIC = 0x07; // Spanish (Dominican Republic) - public static final int SUBLANG_SPANISH_VENEZUELA = 0x08; // Spanish (Venezuela) - public static final int SUBLANG_SPANISH_COLOMBIA = 0x09; // Spanish (Colombia) - public static final int SUBLANG_SPANISH_PERU = 0x0a; // Spanish (Peru) - public static final int SUBLANG_SPANISH_ARGENTINA = 0x0b; // Spanish (Argentina) - public static final int SUBLANG_SPANISH_ECUADOR = 0x0c; // Spanish (Ecuador) - public static final int SUBLANG_SPANISH_CHILE = 0x0d; // Spanish (Chile) - public static final int SUBLANG_SPANISH_URUGUAY = 0x0e; // Spanish (Uruguay) - public static final int SUBLANG_SPANISH_PARAGUAY = 0x0f; // Spanish (Paraguay) - public static final int SUBLANG_SPANISH_BOLIVIA = 0x10; // Spanish (Bolivia) - public static final int SUBLANG_SPANISH_EL_SALVADOR = 0x11; // Spanish (El Salvador) - public static final int SUBLANG_SPANISH_HONDURAS = 0x12; // Spanish (Honduras) - public static final int SUBLANG_SPANISH_NICARAGUA = 0x13; // Spanish (Nicaragua) - public static final int SUBLANG_SPANISH_PUERTO_RICO = 0x14; // Spanish (Puerto Rico) - public static final int SUBLANG_SWEDISH = 0x01; // Swedish - public static final int SUBLANG_SWEDISH_FINLAND = 0x02; // Swedish (Finland) - public static final int SUBLANG_URDU_PAKISTAN = 0x01; // Urdu (Pakistan) - public static final int SUBLANG_URDU_INDIA = 0x02; // Urdu (India) - public static final int SUBLANG_UZBEK_LATIN = 0x01; // Uzbek (Latin) - public static final int SUBLANG_UZBEK_CYRILLIC = 0x02; // Uzbek (Cyrillic) - - /* - * Sorting IDs. - */ - public static final int SORT_DEFAULT = 0x0; // sorting default - - public static final int SORT_JAPANESE_XJIS = 0x0; // Japanese XJIS order - public static final int SORT_JAPANESE_UNICODE = 0x1; // Japanese Unicode order - - public static final int SORT_CHINESE_BIG5 = 0x0; // Chinese BIG5 order - public static final int SORT_CHINESE_PRCP = 0x0; // PRC Chinese Phonetic order - public static final int SORT_CHINESE_UNICODE = 0x1; // Chinese Unicode order - public static final int SORT_CHINESE_PRC = 0x2; // PRC Chinese Stroke Count order - public static final int SORT_CHINESE_BOPOMOFO = 0x3; // Traditional Chinese Bopomofo order - - public static final int SORT_KOREAN_KSC = 0x0; // Korean KSC order - public static final int SORT_KOREAN_UNICODE = 0x1; // Korean Unicode order - - public static final int SORT_GERMAN_PHONE_BOOK = 0x1; // German Phone Book order - - public static final int SORT_HUNGARIAN_DEFAULT = 0x0; // Hungarian Default order - public static final int SORT_HUNGARIAN_TECHNICAL = 0x1; // Hungarian Technical order - - public static final int SORT_GEORGIAN_TRADITIONAL = 0x0; // Georgian Traditional order - public static final int SORT_GEORGIAN_MODERN = 0x1; // Georgian Modern order - - public static final int NLS_VALID_LOCALE_MASK = 0x000fffff; - - public static final class Macros { - private static final int _MAKELCID(int lgid, int srtid) { - return (srtid << 16) | lgid; - } - - public static final LCID MAKELCID(int lgid, int srtid) { - return new LCID(_MAKELCID(lgid, srtid)); - } - - public static final int MAKESORTLCID(int lgid, int srtid, int ver) { - return _MAKELCID(lgid, srtid) | (ver << 20); - } - - public static final int LANGIDFROMLCID(int lcid) { - return lcid & 0xFFFF; - } - - public static final int SORTIDFROMLCID(int lcid) { - return (lcid >>> 16) & 0xf; - } - - public static final int SORTVERSIONFROMLCID(int lcid) { - return (lcid >>> 20) & 0xf; - } - - public static final int MAKELANGID(int p, int s) { - return (s << 10) | (p & 0xFFFF); - } - - public static final int PRIMARYLANGID(int lgid) { - return lgid & 0x3ff; - } - - public static final int SUBLANGID(int lgid) { - return (lgid & 0xFFFF) >>> 10; - } - } - - public static final int LANG_SYSTEM_DEFAULT = Macros.MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT); - public static final int LANG_USER_DEFAULT = Macros.MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); - - public static final LCID LOCALE_SYSTEM_DEFAULT = Macros.MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT); - public static final LCID LOCALE_USER_DEFAULT = Macros.MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT); - - public static final LCID LOCALE_NEUTRAL = Macros.MAKELCID(Macros.MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT); - - public static final LCID LOCALE_INVARIANT = Macros.MAKELCID(Macros.MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT); }