Hi,
I notice that Abs(Null) should return Null according to��http://msdn.microsoft.com/en-us/library/307330xe(v=vs.84).aspx

In wine source code, NULL is defined as 0 in file��dlls/windowscodecs/ungif.h, line 66. I have tried to write like this:
1260 �� �� if(V_VT(arg) == VT_NULL) {
1261 �� �� �� �� V_VT(res) = VT_NULL;
1262 �� �� �� �� V_NULL(res) = NULL;
1263 �� �� }
1264 �� �� else {
1265 �� �� �� �� hres = to_double(arg, &v);
1266 �� �� �� �� if (FAILED(hres))
1267 �� �� �� �� �� �� return hres;
1268 �� �� �� ����
1269 �� �� �� �� if(res) {
1270 �� �� �� �� �� �� V_VT(res) = VT_R8;��
1271 �� �� �� �� �� �� V_R8(res) = v >= 0 ? v : -v;
1272 �� �� �� �� }
1273 �� �� }
1274 �� �� return S_OK;

But apparently this makes no sense: V_NULL is defined in��dlls/oleaut32/tests/vartest.c, not along with V_I2 in��include/oleauto.h; I don't know how give res a "Null" value in C.


2014-06-17 17:44 GMT+08:00 Jacek Caban <jacek@codeweavers.com>:
On 06/17/14 08:00, Shuai Meng wrote:
> diff --git a/dlls/vbscript/global.c b/dlls/vbscript/global.c
> index d21784d..e646a29 100644
> --- a/dlls/vbscript/global.c
> +++ b/dlls/vbscript/global.c
> @@ -1302,8 +1302,24 @@ static HRESULT Global_ChrW(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARI
>
> ��static HRESULT Global_Abs(vbdisp_t *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
> ��{
> - �� ��FIXME("\n");
> - �� ��return E_NOTIMPL;
> + �� ��VARIANT v;
> + �� ��HRESULT hres;
> +
> + �� ��TRACE("(%s)\n", debugstr_variant(arg));
> +
> + �� ��assert(args_cnt == 1);
> +
> + �� ��V_VT(&v) = VT_EMPTY;
> + �� ��hres = VariantChangeType(&v, arg, VARIANT_LOCALBOOL, VT_R8);
> + �� �� �� ��if (FAILED(hres))
> + �� �� �� �� �� ��return S_OK;

Please use to_double here. Also note weird indention here.

Jacek